function Error() { SesVarSet('esalert', _('Content does not exist') . ' "' . $_GET['url'] . '"'); EsRedir(); }
if (!file_exists('../controllers/' . $controller . '.php')) { $controller = $default_controller; $page = 'error'; } // specific controler loading include '../controllers/' . $controller . '.php'; // controller class name and member function (ie page name) $cntr_class = str_replace(' ', '', ucwords(str_replace('_', ' ', $controller))); $page_function = str_replace(' ', '', ucwords(str_replace('_', ' ', $page))); if (!class_exists($cntr_class)) { SesVarSet('esalert', _("The Controller doesn't exist.")); EsRedir(); } $contr = new $cntr_class(); if (!method_exists($contr, $page_function)) { SesVarSet('esalert', _("The page doesn't exist")); $page = 'index'; $page_function = 'Index'; } // setup controller (its models and components) $contr->__ModulesInit(); $contr->EsBefore(); $contr->{$page_function}(); if (!isset($title_page)) { if ($controller != $page) { $title_page = '..:: ' . ucfirst($cntr_class) . '->' . ucfirst($page_function) . ' ::..'; } else { $title_page = '..:: ' . ucfirst($cntr_class) . ' ::..'; } } // template variables defined by the controller
function Edit() { if ($this->usr_type == 3) { EsMessage(_('Acesso negato')); EsRedir('main'); } if ($_SERVER['REQUEST_METHOD'] == 'POST' && SesVarCheck('usredit')) { $id = SesVarGet('usredit'); if (isset($_POST['email'])) { if (filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) { $new = array('email' => $_POST['email']); $this->users->Save($id, $new); EsMessage(_('Dati utente salvati')); EsRedir('user'); } else { EsMessage(_('Indirizzo email non valido')); } } } else { if (!isset($_GET['id']) || !is_numeric($_GET['id'])) { EsRedir('user'); } else { $id = $_GET['id']; } } TemplVar('title', _('Modifica Utente')); $udata = $this->users->SearchByID($id); $usr_id = SesVarGet('user_id'); if ($udata !== FALSE && ($udata['type'] > $this->usr_type || $udata['id'] == $usr_id || $this->users->FullAccess($usr_id))) { ViewVar('user', $udata); SesVarSet('usredit', $udata['id']); } else { EsMessage(_('Operazione non consentita')); EsRedir('user'); } }
function EsMessage($msg) { SesVarSet('esalert', $msg); }
function UserNodes() { if (!isset($_GET['id']) || $this->utype == 3) { EsMessage(_("Operazione non consentita")); EsRedir('main', 'nodes_list'); } $user_id = $_GET['id']; $user_info = $this->users->SearchByID($user_id); if ($user_info == FALSE) { EsMessage(_("Operazione non consentita")); EsRedir('main', 'nodes_list'); } $user_nodes = $this->nodes->UserNodes($user_id); $nodes = $this->nodes->Get(SesVarGet('user_id'), 1); foreach ($nodes as &$node) { $node['enabled'] = FALSE; if ($user_nodes !== FALSE) { foreach ($user_nodes as $unode) { if ($unode['node_id'] == $node['id']) { $node['enabled'] = TRUE; break; } } } } SesVarSet('user_id', $user_id); ViewVar('user_info', $user_info); ViewVar('nodes', $nodes); }