case 'add': case 'edit': if ($config->isPOST()) { $adm->email = $_POST['email']; if (!empty($_POST['password']) && $_POST['password'] == $_POST['password2']) { $adm->password = md5($_POST['password']); } else { Messages::addError('Password not changed'); } $adm->access = isset($_POST['access']) ? array_sum($_POST['access']) : 0; if (empty($adm->id) && empty($adm->password)) { Messages::addError('Password can\'t be empty'); jump('?page=administrators&action=add'); } else { $adm->save(); if ($adm->id == Admin::getLogged()->id) { Admin::setLoggedUser($adm); } Messages::addNotice('Saved'); jump('?page=administrators&action=edit&id=' . $adm->id); } } $smarty->assign('accessData', Admin::getAccessData()); $smarty->assign('adm', $adm); $smarty->assign('CONTENT', 'administrators/add_edit.tpl'); break; case 'remove': $adm->delete(); Messages::addNotice('Deleted'); jump('?page=administrators'); break;
/** * Removes a tournament. * * @param string $name * * @return boolean */ public function removeTournament($name) { return $this->repo->removeTournament(\Admin::getLogged(), $name); }
/** * Removes an existing match from the specified * Tournament. * * @param int $matchID * * @return boolean */ public function removeMatch($matchID) { return $this->repo->removeMatch(\Admin::getLogged(), $matchID); }
<?php #init: include "../init.php"; #smarty: $smarty = Application::getSmarty('/admin/templates/', '/admin/templates_c/'); $page = empty($_GET['page']) ? 'home' : $_GET['page']; $action = empty($_GET['action']) ? 'index' : $_GET['action']; session_start(); $smarty->assign('SESSION_ID', session_id()); if (Admin::isLogged()) { Admin::checkPageAccess($page); $smarty->assign('ADMIN', Admin::getLogged()); } else { $page = 'login'; } $controller = $config->absolute_path . '/admin/pages/' . $page . '.php'; $template = $config->absolute_path . '/admin/templates/' . $page . '.tpl'; if (file_exists($controller)) { require_once $controller; $content_var = $smarty->get_template_vars('CONTENT'); if (empty($content_var)) { $content_var = $page . '.tpl'; } } else { if (file_exists($template)) { $content_var = $page . '.tpl'; } else { header("HTTP/1.1 404 Not Found"); $smarty->assign('ERROR', 'The page you are trying to access does not exists.'); $smarty->assign('ERROR_TITLE', 'Page not found');
/** * Removes the specified ranking. * * @param $rankingID * * @return boolean */ public function removeRanking($rankingID) { return $this->repo->removeRanking(\Admin::getLogged(), $rankingID); }