Projekt

Obecné

Profil

« Předchozí | Další » 

Revize f05d950e

Přidáno uživatelem Ondřej Fibich před více než 5 roky(ů)

Refs #1110: Fix showing works/work reports/request from user detail on PHP 7.0 >=. Fix is done by creating sub-controllers instead of static calls to them. Support of creating sub-controllers with shared resources was introduced to MY_Controller.

Zobrazit rozdíly:

application/controllers/users.php
*/
public function show_work ($work_id = NULL)
{
Works_Controller::show ($work_id);
$controller = new Works_Controller();
$controller->show($work_id);
}
/**
......
*/
public function show_work_report ($work_report_id = NULL)
{
Work_reports_Controller::show ($work_report_id);
$controller = new Work_reports_Controller();
$controller->show($work_report_id);
}
/**
......
*/
public function show_request ($request_id = NULL)
{
Requests_Controller::show ($request_id);
$controller = new Requests_Controller();
$controller->show($request_id);
}
/**
application/libraries/MY_Controller.php
fclose($f);
}
// load these variables only if preprocessor is enabled and user is logged
if ($this->is_preprocesor_enabled() && $this->user_id)
{
// for preprocessing some variable
try
{
$this->preprocessor();
}
catch(Exception $e)
{
Log::add_exception($e);
}
}
$this->preprocessor_if_enabled();
// Singleton instance
self::$instance = $this;
}
else // copy resources from singleton in order to be capable to initiate another controller
{
$this->settings = self::$instance->settings;
$this->session = self::$instance->session;
$this->user_id = self::$instance->user_id;
$this->member_id = self::$instance->member_id;
$this->popup = self::$instance->popup;
$this->dialog = self::$instance->dialog;
$this->noredirect = self::$instance->noredirect;
$this->preprocessor_if_enabled();
}
}
/**
......
$response_code = 403; // Forbidden
break;
case EMAIL:
$message = url_lang::lang('states.Failed to send e-mail') .
$message = url_lang::lang('states.Failed to send e-mail') .
'<br />' . url_lang::lang('states.Please check settings.');
$response_code = 500; // Internal server error
break;
......
return TRUE;
}
/**
* Loads variables only if preprocessor is enabled and user is logged.
*/
private function preprocessor_if_enabled()
{
if ($this->is_preprocesor_enabled() && $this->user_id)
{
// for preprocessing some variable
try
{
$this->preprocessor();
}
catch(Exception $e)
{
Log::add_exception($e);
}
}
}
/**
* Function to preprocessing of some useful variables
*
......
}
// my requests
if (Settings::get('approval_enabled') &&
if (Settings::get('approval_enabled') &&
$this->member_id != Member_Model::ASSOCIATION &&
$this->acl_check_view('Requests_Controller', 'request', $this->member_id))
{

Také k dispozici: Unified diff