芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/public_html/cepali/admin/roles/admins.php
. /** * Select site administrators. * * @package core_role * @copyright 2010 Petr Skoda {@link http://skodak.org} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once(__DIR__ . '/../../config.php'); require_once($CFG->libdir.'/adminlib.php'); $confirmadd = optional_param('confirmadd', 0, PARAM_INT); $confirmdel = optional_param('confirmdel', 0, PARAM_INT); $PAGE->set_url('/admin/roles/admins.php'); admin_externalpage_setup('admins'); if (!is_siteadmin()) { die; } $admisselector = new core_role_admins_existing_selector(); $potentialadmisselector = new core_role_admins_potential_selector(); if (optional_param('add', false, PARAM_BOOL) and confirm_sesskey()) { if ($userstoadd = $potentialadmisselector->get_selected_users()) { $user = reset($userstoadd); $username = $potentialadmisselector->output_user($user); echo $OUTPUT->header(); $yesurl = new moodle_url('/admin/roles/admins.php', array('confirmadd'=>$user->id, 'sesskey'=>sesskey())); echo $OUTPUT->confirm(get_string('confirmaddadmin', 'core_role', $username), $yesurl, $PAGE->url); echo $OUTPUT->footer(); die; } } else if (optional_param('remove', false, PARAM_BOOL) and confirm_sesskey()) { if ($userstoremove = $admisselector->get_selected_users()) { $user = reset($userstoremove); if ($USER->id == $user->id) { // Can not remove self. } else { $username = $admisselector->output_user($user); echo $OUTPUT->header(); $yesurl = new moodle_url('/admin/roles/admins.php', array('confirmdel'=>$user->id, 'sesskey'=>sesskey())); echo $OUTPUT->confirm(get_string('confirmdeladmin', 'core_role', $username), $yesurl, $PAGE->url); echo $OUTPUT->footer(); die; } } } else if (optional_param('main', false, PARAM_BOOL) and confirm_sesskey()) { if ($newmain = $admisselector->get_selected_users()) { $newmain = reset($newmain); $newmain = $newmain->id; $admins = array(); foreach (explode(',', $CFG->siteadmins) as $admin) { $admin = (int)$admin; if ($admin) { $admins[$admin] = $admin; } } if (isset($admins[$newmain])) { $logstringold = implode(', ', $admins); unset($admins[$newmain]); array_unshift($admins, $newmain); $logstringnew = implode(', ', $admins); set_config('siteadmins', implode(',', $admins)); add_to_config_log('siteadmins', $logstringold, $logstringnew, null); redirect($PAGE->url); } } } else if ($confirmadd and confirm_sesskey()) { $admins = array(); foreach (explode(',', $CFG->siteadmins) as $admin) { $admin = (int)$admin; if ($admin) { $admins[$admin] = $admin; } } $logstringold = implode(', ', $admins); $admins[$confirmadd] = $confirmadd; $logstringnew = implode(', ', $admins); set_config('siteadmins', implode(',', $admins)); add_to_config_log('siteadmins', $logstringold, $logstringnew, 'core'); redirect($PAGE->url); } else if ($confirmdel and confirm_sesskey() and $confirmdel != $USER->id) { $admins = array(); foreach (explode(',', $CFG->siteadmins) as $admin) { $admin = (int)$admin; if ($admin) { $admins[$admin] = $admin; } } $logstringold = implode(', ', $admins); unset($admins[$confirmdel]); $logstringnew = implode(', ', $admins); set_config('siteadmins', implode(',', $admins)); add_to_config_log('siteadmins', $logstringold, $logstringnew, 'core'); redirect($PAGE->url); } // Print header. echo $OUTPUT->header(); ?>
display(); ?>
display(); ?>
footer();