📄 admin.inc.php
字号:
<?php
defined('IN_PHPCMS') or exit('Access Denied');
require 'admin/admin.class.php';
$userid = isset($userid) ? intval($userid) : 0;
$a = new admin($userid);
$action = $action ? $action : 'manage';
$submenu = array
(
array($LANG['add_admin'], '?mod='.$mod.'&file='.$file.'&action=add'),
array($LANG['administrator_list'], '?mod='.$mod.'&file='.$file.'&action=manage')
);
foreach($ROLE as $id=>$name)
{
$submenu[] = array($name, '?mod='.$mod.'&file='.$file.'&action=manage&roleid='.$id);
}
$menu = admin_menu($LANG['admin_option'], $submenu);
$admin_founders = explode(',',ADMIN_FOUNDERS);
if(in_array($action,array('edit','disable','delete')) && in_array($userid,$admin_founders)) showmessage('涓嶅厑璁镐慨鏀瑰垱濮嬩汉淇℃伅');
switch($action)
{
case 'add':
if($dosubmit)
{
if(!$a->add($admin, $roleids)) showmessage($a->errormsg());
showmessage($LANG['add_admin_success'],'?mod='.$mod.'&file='.$file.'&action=manage');
}
else
{
$roles = $a->listrole();
include admin_tpl('admin_add');
}
break;
case 'edit':
if($dosubmit)
{
if(!$a->edit($admin, $roleids)) showmessage($a->errormsg());
showmessage($LANG['edit_authority_success'], '?mod='.$mod.'&file='.$file.'&action=manage');
}
else
{
$admin = $a->get();
if(!$admin) showmessage($a->errormsg());
extract($admin);
$roles = $a->listrole();
include admin_tpl('admin_edit');
}
break;
case 'view':
$data = $a->view($userid);
extract($data);
$roles = $a->get_role_name($roleids);
include admin_tpl('admin_view');
break;
case 'manage':
$where = $roleid ? array(DB_PRE.'admin_role','userid',"roleid=$roleid") : '';
$order = $roleid ? 'a.userid' : '';
$admins = $a->listinfo($where, $order, $page, 20);
include admin_tpl('admin_manage');
break;
case 'delete':
$a->delete();
showmessage($LANG['operation_success'], '?mod='.$mod.'&file='.$file.'&action=manage');
break;
case 'disable':
$a->disable($disabled);
showmessage($LANG['operation_success'], '?mod='.$mod.'&file='.$file.'&action=manage');
break;
case 'check':
if($a->check($value))
{
exit('success');
}
else
{
exit($a->errormsg());
}
break;
}
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -