Revize 3a9a4269
Přidáno uživatelem Ondřej Fibich před více než 5 roky(ů)
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 | ||
---|---|---|
$this->upgrade_db();
|
||
}
|
||
|
||
// 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
|
||
{
|
||
$user_model = new User_Model($this->user_id);
|
||
if ($user_model->id &&
|
||
$user_model->password_is_onetime &&
|
||
url_lang::current(2) != 'login/change_password' &&
|
||
url_lang::current(2) != 'login/logout')
|
||
{
|
||
url::redirect('login/change_password');
|
||
}
|
||
else
|
||
{
|
||
$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();
|
||
}
|
||
}
|
||
|
||
/**
|
||
... | ... | |
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)
|
||
{
|
||
try
|
||
{
|
||
$user_model = new User_Model($this->user_id);
|
||
if ($user_model->id &&
|
||
$user_model->password_is_onetime &&
|
||
url_lang::current(2) != 'login/change_password' &&
|
||
url_lang::current(2) != 'login/logout')
|
||
{
|
||
url::redirect('login/change_password');
|
||
}
|
||
else
|
||
{
|
||
$this->preprocessor();
|
||
}
|
||
}
|
||
catch(Exception $e)
|
||
{
|
||
Log::add_exception($e);
|
||
}
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Function to preprocessing of some useful variables
|
||
*
|
Také k dispozici: Unified diff
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.
Conflicts:
application/libraries/MY_Controller.php