function __construct() { parent::__construct(); if (!admin_login()) { redirect('login/index'); } }
public function logout() { if (admin_login()) { session('admins', null); session('admins_sign', null); session('[destroy]'); $this->success('退出成功!', '/'); } else { $this->redirect('index'); } }
public function __construct() { parent::__construct(); if (admin_login() === FALSE) { redirect('admin/login'); } }
function module_info_main() { switch (post('cmd')) { case 'admin_login': admin_login(); break; } }
/** * 检查是否管理员登录 */ protected function _check_admin() { $admin = C('admin_id'); if (!admin_login() || !in_array(admin_login(), $admin)) { $this->error(L('please_login'), U('login/logout')); $this->redirect('login/logout'); exit; } }
echo base_url(); ?> system/assets/images/facebook.png" width="32" height="32" /> <img src="<?php echo base_url(); ?> system/assets/images/twitter.png" width="32" height="32" /> <img src="<?php echo base_url(); ?> system/assets/images/rss.png" width="32" height="32" /> </div> </div> <?php if (!user_login() && !admin_login()) { ?> <div class="row-fluid" style="padding-top:15px"> <div class="span12"> <h4>Login</h4> <form method="post" enctype="multipart/form-data" action="<?php echo base_url(); ?> main/home/user_dologin" id="user_login_form" name="user_login_form" class="form-horizontal" autocomplete="off" > <input id="action" name="action" type="hidden" value="user_login_form" /> <div class="message"><?php echo $this->session->flashdata('alert_message'); ?> </div> <table width="100%">
*/ ini_set('display_errors', 1); //Отображаем ошибки error_reporting(E_ALL); //Отображение ошибок require_once '../config.php'; //Подключаем файл с конфигами require_once 'a_functions.php'; //Подключаем файл с конфигами if (isset($_POST['send'])) { if (!empty($_POST['login']) and !empty($_POST['password'])) { $u_login = $_POST['login']; $u_pass = $_POST['password']; $a_token = token_generation(); //Копируем токен admin_login($u_login, $u_pass, $a_token); //Вызыаем функцию авторизации header("Location: http://" . $url); //Обновляем страницу } } if (isset($_GET['mod']) and $_GET['mod'] == 'logout') { admin_logout(); //Выход header("Location: http://" . $url); //Обновляем страницу } ?> <!doctype html> <!--[if lt IE 7]> <html class="lt-ie9 lt-ie8 lt-ie7" lang="en-US"> <![endif]-->
// Fix undefined variables notices $error = NULL; $applications_have_update = NULL; $applications_update_count = NULL; $msg = NULL; $arrowchat_has_update = false; $themes_have_update = false; $themes_update_count = 0; if (empty($_GET['do'])) { $_GET['do'] = NULL; } // Get do variable $do = get_var('do'); // Admin Login if (var_check('login')) { $error = admin_login(get_var('username'), get_var('password')); } // Admin logout if ($do == "logout") { admin_logout(); } $smarty->assign('username_post', htmlspecialchars(get_var('username'))); $smarty->assign('password_post', htmlspecialchars(get_var('password'))); $smarty->assign('login_post', get_var('login')); // Check if logged in as admin admin_check_login($error); //session_write_close(); // Various admin checks $result = $db->execute("\n\t\tSELECT arrowchat_themes.folder \n\t\tFROM arrowchat_themes\n\t\tWHERE arrowchat_themes.default = 1\n\t"); $row = $db->fetch_array($result); $theme = $row['folder'];
public function execute() { admin_login("verbose"); }
if (admin_logined()) { redirect($_CFG['URL_ADMIN'] . 'index.php'); } /* 加载视图 */ include $_CFG['DIR_ADMIN_TPL'] . 'login.html'; } elseif ($_REQUEST['act'] == 'loginsubmit') { /* 非法提交 */ if (!isset($_POST['submit'])) { sys_msg($_LANG['lawless_submit']); } /* 用户名或密码空检查 */ if (!trim($_POST['username']) || !trim($_POST['password'])) { make_json_fail(trim($_POST['username']) ? $_LANG['fill_login_pwd'] : $_LANG['fill_login_usr']); } /* 登陆 */ if (admin_login(trim($_POST['username']), md5(trim($_POST['password'])))) { admin_log($_LANG['str_login']); make_json_ok(); } /* 登陆失败 */ make_json_fail($_LANG['fail_login']); } elseif ($_REQUEST['act'] == 'logout') { admin_log($_LANG['str_logout']); admin_logout(); } elseif ($_REQUEST['act'] == 'flush') { /* 刷新权限系统 */ flush_privilege_sys(); /* 跳转到后台首页 */ redirect($_CFG['URL_ADMIN'] . 'index.php'); } elseif ($_REQUEST['act'] == 'home') { /* 初始化页面信息 */
<li><a href="<?php echo C('sys_siteurl'); ?> " target="_blank"><?php echo L('web_home'); ?> </a></li> <li class="divider-vertical"></li> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo $_SESSION['admins']['username']; ?> <b class="caret"></b></a> <ul class="dropdown-menu"> <li><a href="<?php echo U('admins/edit', array('id' => admin_login())); ?> "><?php echo L('editpassword'); ?> </a></li> <li><a href="<?php echo U('login/logout'); ?> "><?php echo L('logout'); ?> </a></li> </ul> </li> <li class="divider-vertical"></li>
function __construct() { parent::__construct(); admin_login(); $this->header = get_header_data(); }
<?php // Load model=================================================================== require_once 'backend/models/users.php'; //Title ======================================================================== $title = LOGIN_TITLE; //xử lý đăng nhập ============================================================== if (!empty($_POST)) { $url = 'location:admin.php'; $email = escape($_POST['username']); $password = md5($_POST['password']); if (!admin_login($email, $password)) { //Đăng nhập thành công chuyển hướng vào trang chủ ql $url .= "?statuslogin=false"; } header($url); } //if (isset($_SESSION['login']) && $_SESSION['login'][11] == 1) { // header('location:admin.php'); //} //load view ==================================================================== require 'backend/views/home/login.php';
/** * Log a user in */ protected function login() { if (isset($_POST['stayonline']) && $_POST['stayonline'] == 1) { admin_set_cookie($_POST['username'], $_POST['userpassword']); } if (isset($_COOKIE['login']) && $_COOKIE['login'] && !is_authorized()) { $userpassword = substr($_COOKIE['login'], 0, 32); $username = substr($_COOKIE['login'], 32, strlen($_COOKIE['login'])); admin_login($username, $userpassword, TRUE); } if (isset($_POST['login']) && $_POST['login'] == 1 && !is_authorized()) { admin_login($_POST['username'], $_POST['userpassword'], false); } }
<?php include 'inc/dashboard-functions.php'; if (!empty($_POST['email']) && !empty($_POST['password'])) { $login_admin = admin_login($_POST['email'], $_POST['password']); if ($login_admin == 1) { header('Location:index.php'); } else { $errormessage = "Email and Password combinations are invalid. Please Try Again!!"; } } ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Dashboard | LiveProduct</title> <!-- Core CSS - Include with every page --> <link href="asset/css/bootstrap.css" rel="stylesheet"> <link href="asset/font-awesome/css/font-awesome.css" rel="stylesheet"> <!-- SB Admin CSS - Include with every page --> <link href="asset/css/sb-admin.css" rel="stylesheet"> </head>
$query = mysql_query($sql, $conn); $result = mysql_fetch_array($query); return $result; } function get_username($post_username) { $conn = connDB(); $sql = "SELECT COUNT(*) AS rows FROM tbl_admin WHERE `username` = '{$post_username}'"; $query = mysql_query($sql, $conn); $result = mysql_fetch_array($query); return $result; } $username = clean_alphanum($_POST['username']); $password = clean_alphanum($_POST['password']); if ($_POST['btn-admin-login'] == "Sign In") { $get_admin = admin_login($username, $password); if ($get_admin['rows'] != 1) { $_SESSION['alert'] = "error"; $_SESSION['msg'] = "<strong>Login invalid.</strong> Please check your username and password."; $forgot = get_username($username); if ($forgot['rows'] > 0) { $_SESSION['username'] = $username; } else { $_SESSION['username'] = "******"; } } else { $_SESSION['admin'] = $get_admin['id']; ini_set('session.gc_probability', '1'); if (isset($_SESSION['alert'])) { unset($_SESSION['alert']); unset($_SESSION['msg']);
else echo "0result"; */ } $servername = "ruochenwebtestcom.ipagemysql.com"; $username = "******"; $password = "******"; $dbname = "inventory_management"; $conn = new mysqli($servername, $username, $password, $dbname); if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } //create_id_table($conn); //drop_table($conn,$dbname); //setAdmin($conn,"administrator","password","yes"); if (strcmp($_GET["purpose"], "add") == 0) { add($conn); } if (strcmp($_GET["purpose"], "read") == 0) { read($conn); } if (strcmp($_GET["purpose"], "delete") == 0) { delete($conn); } if (strcmp($_GET["purpose"], "update") == 0) { update($conn); } if (strcmp($_POST["purpose"], "administrator") == 0) { admin_login($conn, $_POST["user"], $_POST["pass"]); } $conn->close();
<?php include "admin_controller.php"; echo admin_login(); ?> <html> <head> <meta charset "UTF=8"> <title></title> </head> <body> <form action ="<?php $_SERVER['PHP_SELF']; ?> " method = "POST"> <div>USERNAME:<input type ="text" name ="admin_username" required/></div><br> <div>PASSWORD:<input type ="text" name ="admin_password" required/></div><br> <div> </div><br> <div><input type ="submit" value= "SAVE" name="ss"/></div> </form> </body> </html>
main/user/view_profile">Profile</a></li> <li><a href="<?php echo base_url(); ?> main/user/change_password">Change Password</a></li> <li class="divider"></li> <li><a href="<?php echo base_url(); ?> main/home/user_dologout">Logout</a></li> </ul> </li> </ul> <?php } else { if (admin_login()) { ?> <ul class="nav"> <!--<li class="<?php if ($page == 'home') { echo $active; } ?> "><a href="<?php echo base_url(); ?> ">Home</a></li>--> <li class="<?php if ($page == 'dashboard') { echo $active; }
<?php // +---------------------------------------------------------------------- // | Demila [ Beautiful Digital Content Trading System ] // +---------------------------------------------------------------------- // | Copyright (c) 2015 http://demila.org All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- // | Email author@demila.org // +---------------------------------------------------------------------- define('USING_LANGUAGE', false); require_once '../../../config.php'; require_once $config['root_path'] . '/core/functions.php'; include_once $config['system_core'] . "/initEngine.php"; admin_login(); if (isset($_POST['delete']) && isset($_POST['id']) && isset($_SESSION['user']['access']['items'])) { require_once ROOT_PATH . "/apps/items/models/items.class.php"; $cms = new items(); $cms->delete(intval($_POST['id'])); die(json_encode(array_merge($_POST, array('status' => 'true')))); } elseif (isset($_POST['deleteComment']) && isset($_POST['id']) && isset($_SESSION['user']['access']['items'])) { require_once ROOT_PATH . "/apps/items/models/comments.class.php"; $cms = new comments(); $cms->delete(intval($_POST['id'])); die(json_encode(array_merge($_POST, array('status' => 'true')))); } echo json_encode(array_merge($_POST, array('status' => 'unknown error'))); die;
<?php $dir = preg_replace('/\\b\\w*admin\\w*\\b/i', '', trim(__DIR__)); $dir = preg_replace('/\\b\\w*includes\\w*\\b/i', '', trim($dir)); include_once $dir . '/config/db_connect.php'; include_once $_SERVER["DOCUMENT_ROOT"] . site_name . '/classes/functions.php'; sec_session_start(); // Our custom secure way of starting a PHP session. if (isset($_POST['email'], $_POST['p'])) { $email = $_POST['email']; $password = $_POST['p']; // The hashed password. if (admin_login($email, $password, $mysqli) == true) { // Login success header('Location: ../index.php'); } else { // Login failed header('Location: ../admin_login.php?error=1'); } } else { // The correct POST variables were not sent to this page. echo 'Invalid Request'; }
function __construct() { parent::__construct(); admin_login(); $this->header = get_header_data(); $this->load->model('person_model'); }
function __construct() { parent::__construct(); admin_login(); $this->header = get_header_data(); $this->load->model('person_model'); $this->load->model('ban_model'); date_default_timezone_set('Asia/Bangkok'); }
function Home() { parent::Controller(); $this->load->model('home_model'); $this->load->model('user_model'); $this->load->model('admin_model'); $this->load->helper('check_login'); $this->load->helper('breadcrumb'); if (!admin_login()) { redirect('main/home/admin_login'); } }
/** * 登录首页 */ public function index() { if (admin_login()) { redirect('/index/index'); } if (isset($_POST['username']) && isset($_POST['password'])) { $data = $this->admin_model->admin_login(); var_dump($data); if ($data) { admin_login($data); redirect('index/index'); } show_error('用户名或者密码错误!', 500, '操作错误!'); } $data['title'] = '管理员登录'; $data['foundation_dir'] = config_item('foundation_dir'); $this->load->view('templates/header', $data); $this->load->view('login/index'); $this->load->view('templates/footer', $data); }
<?php // include function files for this application require_once 'food_galaxy_fns.php'; session_start(); //create short variable names $username = $_POST['username']; $passwd = $_POST['passwd']; if ($username && $passwd) { // they have just tried logging in $id = admin_login($username, $passwd); if ($id != -1) { $_SESSION['valid_admin'] = $username; $_SESSION['name'] = $username; do_html_header('Home Page'); echo '<div class="form-group" id="success_message"> <div class="col-sm-offset-2 col-sm-8"> <div class="alert alert-success"> <h3> Administrator log in Success! Now, you can manage the system! </h3> </div> </div> </div>'; } else { echo '<div class="form-group" id="success_message"> <div class="col-sm-offset-2 col-sm-8"> <div class="alert alert-danger"> <h3> logged in Failure. <a href="login.php">Click here to log in again</a></h3> </div> </div> </div>'; }
exit; } if (isset($_GET['e'])) { $has_error = true; } else { $has_error = false; } $page_title = $lang['admin_login']; $page_body = TPL_FOLDER . '/' . $site_tpl . '/login.php'; break; case '2': // do login if (!referer_check()) { die; } if (admin_login($_POST['admin_name'], $_POST['admin_pwd'], $_POST['admin_vcode'])) { if (empty($forward_page)) { header('Location:index.php'); exit; } else { header('Location:' . $forward_page); exit; } } else { header('Location:index.php?ac=1&e='); exit; } break; case '3': // category form if (admin_check()) {
<?php if (session_status() !== PHP_SESSION_ACTIVE) { session_start(); } ini_set('display_errors', 'On'); require './functions/functions.php'; if (isset($_POST['admin_email']) && isset($_POST['admin_password'])) { if (filter_input(INPUT_POST, 'admin_email', FILTER_VALIDATE_EMAIL) && filter_input(INPUT_POST, 'admin_password')) { $email = strip_tags(trim($_POST['admin_email'])); $password = strip_tags(trim($_POST['admin_password'])); $admin = array("email" => $email, "password" => $password); $result = admin_login($admin); if ($result) { echo "<script> window.location ='./index.php';</script>"; } else { $error = "error"; } } } ?> <!DOCTYPE html> <html lang=""> <head> <?php include "header.php"; ?> <title> Login </title>
public function edit_all($id) { $map = array('name' => 'DISPLAY_NAME', 'password' => 'PASSWORD', 'birthdate' => 'BIRTHDATE', 'twitter' => 'TWITTER', 'facebook' => 'FACEBOOK', 'email' => 'EMAIL', 'picture' => 'AVARTAR'); admin_login(); $success = false; $this->load->model('person_model'); $person_id = $id; $data['profile'] = $this->person_model->get_person($person_id); $name = $data['profile']->DISPLAY_NAME; $email = $data['profile']->EMAIL; //------------------------------------------------ $this->load->model('signup'); $this->load->library('form_validation'); $this->load->library('form_validation'); $this->form_validation->set_rules('password', 'Password', 'trim|required|matches[password2]|min_length[8]|max_length[45]'); $this->form_validation->set_rules('password2', 'Password Confirmation', 'trim|required'); if (!isset($_POST['name'])) { $this->form_validation->set_rules('name', 'Username', 'trim|required|min_length[3]|max_length[45]|xss_clean'); } else { if ($name != $_POST['name']) { $this->form_validation->set_rules('name', 'Username', 'trim|required|min_length[3]|max_length[45]|xss_clean|callback_username_check'); } else { $this->form_validation->set_rules('name', 'Username', 'trim|required|min_length[3]|max_length[45]|xss_clean'); } } if (!isset($_POST['email'])) { $this->form_validation->set_rules('email', 'Email', 'trim|required|valid_email'); } elseif ($email != $_POST['email']) { $this->form_validation->set_rules('email', 'Email', 'trim|required|matches[password2]|min_length[8]|max_length[45]|callback_email_check'); } else { $this->form_validation->set_rules('email', 'Email', 'trim|required|valid_email'); } // $this->form_validation->set_message('username_check','Member is already used!'); // $this->form_validation->set_message('email_check','Email is already used!'); $map = array('name' => 'DISPLAY_NAME', 'password' => 'PASSWORD', 'birthdate' => 'BIRTHDATE', 'twitter' => 'TWITTER', 'facebook' => 'FACEBOOK', 'email' => 'EMAIL'); if ($this->form_validation->run() != false) { //if($this->signup->check_name($_POST['name'])&&$this->signup->check_email($_POST['email'])){ $tmp = $this->signup->add_picture(); // if(isset($tmp['upload_data'])){ foreach ($map as $key => $value) { # code... $person[$value] = $_POST[$key]; } $this->load->model('person_model'); $person['AVATAR'] = $tmp['upload_data']['file_name']; $co = $this->signup->edit_person($person_id, $person); $success = true; $this->session->set_flashdata('alert', 'Successfully updated profile.'); redirect('admin/user'); // } //} } // $data['type'] = 'edit'; $data['type'] = 'edit'; $data['header'] = $this->load->view('header', $this->header, TRUE); $data['footer'] = $this->load->view('footer', $this->footer, TRUE); $this->load->view('auth/signup', $data); }
/** main program for site maintenance * * This is the main administrator program. * First step is to deal with users logging in or out. * If a user is not logged in, a login dialog is displayed. * If a user is logged in but has no admin privileges, she * is redirected to the public site (ie. index.php). * * Once we have established that the user is an administrator, * we setup an output collecting object and see what the user * wants us to do by interpreting the parameter 'job'. * If the user has access to the specified job, the corresponding * code is included and the main routine of that handler is called. * It is then the responsability of that handler to further decide * what needs to be done. * After the handler returns, the collected output is sent to the user. * This includes the main navigation (i.e. links to the various * 'managers') and also the menu and the content generated by the * handler. * * If the user has no privilege to access a particular manager, * an error messate is displayed in both the message area and the content * area. This makes it clear to the user that access is denied. * Note that the inaccessible items are displayed in the main navigation * via 'dimmed' (light-grey) links or black/white images. * By showing these 'dimmed' links, the user will be aware that there * is more that just what she is allowed to see. This is more transparent * than suppressing items and keeping them secret. * * @return void generated page sent to user's browser * @uses $CFG; * @uses $LANGUAGE; * @uses $USER; * @todo should we cater for a special 'print' button + * support for a special style sheet for media="print"? */ function main_admin() { global $CFG; global $LANGUAGE; global $USER; /** initialise, setup database, read configuration, etc. */ require_once $CFG->progdir . '/init.php'; initialise(); // user must be logged in to perform any admin tasks at all if (isset($_GET['logout'])) { admin_logout_and_exit(); } elseif (isset($_GET['login'])) { $user_id = admin_login(magic_unquote($_GET['login'])); } elseif (isset($_COOKIE[$CFG->session_name])) { $user_id = admin_continue_session(); } else { admin_show_login_and_exit(); } /** useraccount.class.php is used to define the USER object */ require_once $CFG->progdir . '/lib/useraccount.class.php'; $USER = new Useraccount($user_id); $USER->is_logged_in = TRUE; $_SESSION['language_key'] = $LANGUAGE->get_current_language(); // remember language set via _GET or otherwise // Only admins are allowed, others are redirected to index.php if (!$USER->is_admin()) { logger("admin.php: '{$USER->username}' ({$USER->user_id}) is no admin and was redirected to index.php or login"); session_write_close(); non_admin_redirect_and_exit(); } // We now know that this user is an admin, but // is she allowed to perform upgrades if any? Check it out in 2 steps // 1--we do NOT want exit on error if the user has enough privileges // 2--we check the version and stay here if the user has enough privileges $exit_on_error = $USER->has_job_permissions(JOB_PERMISSION_UPDATE) ? FALSE : TRUE; $need_to_update = was_version_check($exit_on_error) ? FALSE : TRUE; // We are still here if versions are OK _or_ versions mismatch but user has UPDATE privilege. // Now we know we _will_ be generating output => setup output object // using the specified skin OR the user's prefererred skin OR the one // stored before in $_SESSION $_SESSION['skin'] = get_current_skin(); // echo "DDD: {$_SESSION['skin']}"; $output = new AdminOutput($_SESSION['skin'], $CFG->title); // Display a 'welcome message' if this is the first page after logging in. if ($_SESSION['session_counter'] == 1) { $output->add_message(t('login_user_success', 'admin', array('{USERNAME}' => $USER->username))); } // Let's see what what job needs to be done $job = $need_to_update ? JOB_UPDATE : get_parameter_string('job', JOB_STARTCENTER); // main dispatcher switch ($job) { case JOB_STARTCENTER: job_start($output); break; case JOB_PAGEMANAGER: add_javascript_popup_function($output, ' '); if ($USER->has_job_permissions(JOB_PERMISSION_PAGEMANAGER)) { include $CFG->progdir . '/lib/pagemanager.class.php'; $manager = new PageManager($output); } else { $output->add_content("<h2>" . t('access_denied', 'admin') . "</h2>"); $output->add_content(t('job_access_denied', 'admin')); $output->add_message(t('job_access_denied', 'admin')); } break; case JOB_FILEMANAGER: case JOB_FILEBROWSER: case JOB_IMAGEBROWSER: case JOB_FLASHBROWSER: add_javascript_popup_function($output, ' '); add_javascript_select_url_function($output, ' '); if ($USER->has_job_permissions(JOB_PERMISSION_FILEMANAGER)) { include $CFG->progdir . '/lib/filemanager.class.php'; $manager = new FileManager($output, $job); } else { $output->add_content("<h2>" . t('access_denied', 'admin') . "</h2>"); $output->add_content(t('job_access_denied', 'admin')); $output->add_message(t('job_access_denied', 'admin')); } break; case JOB_MODULEMANAGER: if ($USER->has_job_permissions(JOB_PERMISSION_MODULEMANAGER)) { include $CFG->progdir . '/lib/modulemanagerlib.php'; job_modulemanager($output); } else { $output->add_content("<h2>" . t('access_denied', 'admin') . "</h2>"); $output->add_content(t('job_access_denied', 'admin')); $output->add_message(t('job_access_denied', 'admin')); } break; case JOB_ACCOUNTMANAGER: if ($USER->has_job_permissions(JOB_PERMISSION_ACCOUNTMANAGER)) { include $CFG->progdir . '/lib/accountmanagerlib.php'; job_accountmanager($output); } else { $output->add_content("<h2>" . t('access_denied', 'admin') . "</h2>"); $output->add_content(t('job_access_denied', 'admin')); $output->add_message(t('job_access_denied', 'admin')); } break; case JOB_CONFIGURATIONMANAGER: if ($USER->has_job_permissions(JOB_PERMISSION_CONFIGURATIONMANAGER)) { include $CFG->progdir . '/lib/configurationmanagerlib.php'; job_configurationmanager($output); } else { $output->add_content("<h2>" . t('access_denied', 'admin') . "</h2>"); $output->add_content(t('job_access_denied', 'admin')); $output->add_message(t('job_access_denied', 'admin')); } break; case JOB_STATISTICS: if ($USER->has_job_permissions(JOB_PERMISSION_STATISTICS)) { include $CFG->progdir . '/lib/statisticslib.php'; job_statistics($output); } else { $output->add_content("<h2>" . t('access_denied', 'admin') . "</h2>"); $output->add_content(t('job_access_denied', 'admin')); $output->add_message(t('job_access_denied', 'admin')); } break; case JOB_TOOLS: if ($USER->has_job_permissions(JOB_PERMISSION_TOOLS)) { // user has permission to access at least one of the tools include $CFG->progdir . '/lib/toolslib.php'; job_tools($output); } else { $output->add_content("<h2>" . t('access_denied', 'admin') . "</h2>"); $output->add_content(t('job_access_denied', 'admin')); $output->add_message(t('job_access_denied', 'admin')); } break; case JOB_UPDATE: if ($USER->has_job_permissions(JOB_PERMISSION_UPDATE)) { // user has permission to access the update routine(s) include $CFG->progdir . '/lib/updatelib.php'; job_update($output); } else { $output->add_content("<h2>" . t('access_denied', 'admin') . "</h2>"); $output->add_content(t('job_access_denied', 'admin')); $output->add_message(t('job_access_denied', 'admin')); } break; default: if (!empty($job)) { $output->add_content("<h2>" . t('access_denied', 'admin') . "</h2>"); $output->add_content(t('unknown_job', 'admin', array('{JOB}' => htmlspecialchars($job)))); $output->add_message(t('unknown_job', 'admin', array('{JOB}' => htmlspecialchars($job)))); logger("'" . $USER->username . "': unknown job '" . htmlspecialchars($job) . "'"); } else { job_start($output); } break; } // the various functions job_*() will have put their output in $output // Now it is time to actually output the output to the user's browser. $output->send_output(); // make sure that any changes in $_SESSION are properly stored // note that we close the session only after all processing is done, // allowing the various job_*()'s to manipulate the session variables session_write_close(); // at this point we have sent the page to the user, // we can now use the remaining time in this run to process // a few alerts (if any). cron_send_queued_alerts(25); // if there are more than 25, do them later or let cron do it. return; }