function loadHandler($handler) { $sf = new SiteFunction(); $sf->noForeign(); $sf->clauseSafe('handler', $handler); if ($sf->id()) { $ret = $sf->getHandler(); } else { if (class_exists(str_replace('Application', 'Setup', constant('APPLICATION')))) { $class_name = str_replace('Application', 'Setup', constant('APPLICATION')); $ret = new $class_name(); } else { $ret = Application::loadHandler($handler); } } return $ret; }
function authorise($handler) { $sf = new SiteFunction(); $sf->clauseSafe('handler', $handler); $sf->noForeign(); if ($sf->get('access_id') == 2) { $ret = true; } else { if ($sf->id()) { $ret = false; } else { if ($handler == str_replace('Application', 'Setup', constant('APPLICATION'))) { $ret = true; } else { $ret = $this->authorise(str_replace('Application', 'Setup', constant('APPLICATION'))); } } } return $ret; }
/** * Return true if this user is allowed to access the given handler */ function authorise($handler) { $sf = new SiteFunction(); $sf->noForeign(); //$sf->clause('handler','%'.$handler,Clause::LIKE); $sf->clauseSafe('handler', $handler); $access_id = $sf->get('access_id'); if ($access_id != -1 && $access_id) { if ($func = $this->accessible($handler)) { $ret = count($func); } else { $ret = 0; } } else { if ($access_id == -1) { $ret = true; } else { if (!$access_id) { $ret = false; } } } return $ret; }
protected function editSiteFunction() { if ($site_function_id = Application::param('select_site_function_id')) { $site_function = new SiteFunction(); $site_function->clauseSafe('site_function_id', $site_function_id); $site_function->noForeign(); $this->site_function_to_edit = $site_function; } else { $this->failed = 'Could not get site function to edit'; } }