$func = 'system-module-del'; System::check_func($func, FALSE); $res = Module::uninstall($module); switch ($res) { case 'locked': echo '<div id="state" class="failure">抱歉!当前模块已卸载(' . $module . ')</div>'; break; case 'script': echo '<div id="state" class="failure">抱歉!未找到卸载脚本(' . $module . ')</div>'; break; case 'abort': echo '<div id="state" class="failure">抱歉!卸载模块(' . $module . ')失败,以下是本错误信息详细报告:</div>'; break; case 'success': //写入日志 System::insert_event($func, time(), time(), "卸载模块成功:" . $module); echo '<div id="state">恭喜!成功卸载模块(' . $module . ')</div>'; break; } break; //禁用模块 //禁用模块 case "disabled": //检查权限 $func = 'system-module-dis'; System::check_func($func, FALSE); Module::set_state($module, FALSE); break; //启用模块 //启用模块 case "enabled":
if (!$do) { ob_end_clean(); header("location:?do=global"); exit; } $active = array('global', 'attach', 'mail'); if (in_array($do, $active)) { $_GalSet = new Setting(VI_ROOT . 'config/' . $do . '.php', VI_ROOT . 'config/' . $do . '.xml', $do); if ($_GET["action"] == "update" && !empty($_POST)) { //var_dump($_POST); //exit; if ($_GalSet->save('POST')) { //连接数据库 System::connect(); //写入日志 System::insert_event($func, time(), time()); //关闭数据库 System::connect(); //更新模块缓存 Module::search(); echo '<div id="state">成功修改系统配置:' . $do . '</div>'; } else { echo "<div id='state' class='failure'>保存系统配置失败!请检查 ./config/" . $do . ".php 是否有读写权限</div>"; } } elseif ($_GalSet->writable() == FALSE) { echo "<div id='state' class='failure'>请检查 ./config/" . $do . ".php 是否有读写权限</div>"; } $form = $_GalSet->transform(); } ?>
echo '<div id="state" class="failure">抱歉!安装更新失败。以下是本错误信息详细报告:</div>'; break; case 'success': echo '<div id="state">恭喜!成功安装更新:' . $update . '</div>'; break; } break; case "execute": //检查权限 $func = 'system-update-sql'; System::check_func($func, FALSE); $res = Database::query(stripslashes($_POST['sql'])); if ($res['error'] == 0) { echo '<div id="state">恭喜!成功执行自定义 SQL 语句。</div>'; //写入日志 System::insert_event($func, time(), time(), "执行查询:" . $_POST['sql']); //更新模块 Module::search(); } else { echo '<div id="state" class="failure">抱歉!执行SQL语句失败。以下是本错误信息详细报告:</div>'; //trigger_error(str_replace('class="error"','class="text-no"',preg_replace('/<h4>(.*?)<\/h4>/','',$array[1])), E_USER_ERROR); } break; } //关闭数据库 System::connect(); ?> <div class="item">数据更新清单</div> <table width="100%" border="0" cellpadding="0" cellspacing="0" class="table">
System::insert_event($func, time(), time(), "更改用户组状态:" . $_CACHE['system']['group'][$id]["name"]); } else { $_G['project']['message'] = "未找到指定用户组!"; } break; case "delete": //检查权限 $func = 'system-group-del'; System::check_func($func, FALSE); //删除数据 $sql = "DELETE FROM `sys:group` WHERE id=" . $id; System::$db->execute($sql); if (System::$db->getAffectedRows()) { $_G['project']['message'] = "成功删除用户组!"; //写入日志 System::insert_event($func, time(), time(), "删除用户组:" . $_CACHE['system']['group'][$id]["name"]); } else { $_G['project']['message'] = "未找到指定用户组!"; } break; } //缓存系统用户组 Cached::table('system', 'sys:group', array('jsonde' => array('config'), 'serialize' => array('module', 'widget'))); } //search $s = getgpc("s"); $q = getgpc('q'); ?> <div id="search">
$list = rglob(VI_ROOT . 'cache/compile/{*.htm.php}', GLOB_BRACE); foreach ($list as $item) { unlink($item); } $_G['project']['message'] = "成功清除模板缓存:" . $file; } else { if (in_array($file, array("rss", "sql"))) { $cache = VI_ROOT . 'cache/' . $file . "/"; //开始时间 $start = time(); //删除并重建目录 if (delete_dir($cache) && create_dir($cache)) { System::insert_event($func, $start, time(), '清除系统查询缓存' . $ext); $_G['project']['message'] = "成功清除系统缓存:" . $file; } else { System::insert_event($func, $start, time(), '清除系统查询缓存<span class="text-no">失败</span>' . $ext); $_G['project']['message'] = "清除统缓存失败:" . $file; } } } /////////////////// //关闭数据库 System::connect(); break; case '': if (file_exists($log)) { $time = filemtime($log); //大于一周时提醒 if (time() - $time > 604800) { echo '<div id="state" class="failure"><span class="text-no">注意:上一次扫描在' . format_date($time) . '</span></div>'; } else {
function update($file) { global $_CACHE; $base = self::direct('update'); $sqlfile = $base . $file; //锁文件 $lock = str_replace(".sql", ".lock", $sqlfile); if (file_exists($lock)) { //echo '<div id="state" class="failure">抱歉!安装已经存在。更新于早前已经安装,并在使用中:<span class="text-key">'.$update.'</span></div>'; return 'locked'; } else { if (file_exists($sqlfile)) { //日志开始时间 $time = time(); $text = sreadfile($sqlfile); ///////////////////////////// //获取全部参数 preg_match_all("/#\\[module=(.*?)\\](.+?)#\\[\\/module\\]/ism", $text, $match); //遍历模块 foreach ($match[1] as $index => $appid) { //不存在此模块 if (array_key_exists($appid, $_CACHE['system']['module']) === FALSE) { //从更新语句中移除,#[module=appid]...#[/module] $text = str_replace($match[0][$index], '', $text); } } ///////////////////////////// $res = self::query($text); if ($res['error'] == 0) { //写入锁 create_file($lock, date("Y-m-d H:i:s")); //写入日志 System::insert_event($func, $time, time(), "安装更新:" . $file); //搜索模块 //Module :: search(); //缓存系统用户组 //Cached :: table( 'system', 'sys:group', array( 'jsonde' => array('config') ) ); //echo '<div id="state">恭喜!成功安装更新:'.$update.'</div>'; return 'success'; } else { //echo '<div id="state" class="failure">抱歉!安装更新失败。以下是本错误信息详细报告:</div>'; return 'abort'; } } } }
System::$db->execute($sql); //写入日志 System::insert_event($func, time(), time(), "修改用户密码:" . $_CACHE['system']['admin'][$id]["name"]); } //更改权限 if ($gid) { $func = 'system-account-gid'; System::check_func($func, FALSE); $sql = "UPDATE `sys:admin` SET gid='" . $gid . "' WHERE id=" . $id; System::$db->execute($sql); //写入日志 System::insert_event($func, time(), time(), "变更用户组:" . $_CACHE['system']['admin'][$id]["name"]); } $_G['manager']['id'] == $id && System::admin_update('avatar', $avatar); //写入日志 System::insert_event($func, time(), time(), "修改用户资料:" . $_CACHE['system']['admin'][$id]["name"]); //缓存系统用户 Cached::table('system', 'sys:admin', array('jsonde' => array('config', 'extra'))); System::redirect($jump ? $jump : "?id=" . $id . "&action=edit", "成功修改用户信息!"); break; case "edit": $sql = "SELECT * FROM `sys:admin` WHERE id=" . $id; $row = System::$db->getOne($sql); $extra = fix_json($row['extra']); break; } //关闭数据库 System::connect(); /* 安全问题 <select name="question" onchange="showcustomquest(this.value)" style="width:124px">
//echo $update; break; case "create": //检查权限 $func = 'system-backup-add'; System::check_func($func, FALSE); $name = getgpc('name'); if (!$name) { System::redirect($jump, "备份名称不能为空!"); } elseif (!preg_match('/^[^\\/\\\\?!\\*]+$/', $name)) { System::redirect($jump, "备份名称中有非法字符!"); } else { $stat = Database::export($name, getgpc('prefix'), getgpc('option')); if ($stat) { //写入日志 System::insert_event($func, time(), time(), "数据备份:" . $name . ".sql"); echo '<div id="state">恭喜!成功备份数据库,共有 ' . $stat . ' 条记录。</div>'; } else { echo '<div id="state" class="failure">抱歉!备份数据库失败。</div>'; } } break; } //关闭数据库 System::connect(); } ?> <div class="item">数据备份清单</div> <table width="100%" border="0" cellpadding="0" cellspacing="0" class="table">
$ftp = new ClsFTP($_G['setting']["attach"]["FTP_USER"], $_G['setting']["attach"]["FTP_PASS"], $_G['setting']["attach"]["FTP_HOST"], $_G['setting']["attach"]["FTP_PORT"]); //FTP 模式 $ftp->pasv($_G['setting']['attach']['FTP_PASV'] == 'true'); //删除文件 $ftp->delete($row['name']); //关闭 FTP $ftp->close(); } else { //删除数据_文件 if (file_exists(VI_ROOT . $row['name'])) { unlink(VI_ROOT . $row['name']); } } } //写入日志 System::insert_event($func, time(), time(), "删除文件:" . $list); //System :: redirect($url,"所选文件成功被删除!"); $_G['project']['message'] = $row_count . "个文件成功被删除!"; break; } } $s = getgpc("s"); $q = getgpc('q'); $f = getgpc("f"); $r = getnum("r", -1); $a = getnum("a", 0); //查看方式 $v = getgpc("v"); $v = $v ? $v : "list"; //exit($v); //日期筛选
System::insert_event($func, time(), time(), "新增用户组:" . $name); //缓存系统用户组 Cached::table('system', 'sys:group', array('jsonde' => array('config'), 'serialize' => array('module', 'widget'))); System::redirect("group.list.php", "<b>消息:</b> 成功添加用户组!"); break; case "update": //检查权限 $func = 'system-group-mod'; System::check_func($func, FALSE); //更新数据 $sql = "UPDATE `sys:group` SET name='" . $name . "',`state`='" . $state . "',description='" . $description . "',`modify`='" . time() . "',config='" . $config . "',module='" . $module . "',widget='" . $widget . "',medal='" . $medal . "' WHERE id=" . $gid; System::$db->execute($sql); //缓存系统用户组 Cached::table('system', 'sys:group', array('jsonde' => array('config'), 'serialize' => array('module', 'widget'))); //写入日志 System::insert_event($func, time(), time(), "修改用户组:" . $name); //重载权限 $_SESSION["GroupLife"] = 0; //$_G['project']['message']="<b>消息:</b> 成功修改用户!"; System::redirect("group.list.php", "成功修改用户组!"); break; case "edit": $sql = "SELECT * FROM `sys:group` WHERE id=" . $gid; $row = System::$db->getOne($sql); if ($row) { //权限配置 $config = fix_json($row['config']); //快捷方式 $module = unserialize($row['module']); //小工具 $widget = unserialize($row['widget']);
public static function set_state($appid, $state = TRUE) { global $_G; global $_CACHE; //模块列表缓存文件 $file = self::get_list(); //设置状态 $_CACHE['system']['module'][$appid]['state'] = $state; $text = '<?php' . chr(13); $text .= ' /*' . date("Y-m-t H:i:s") . '*/ ' . chr(13); $text .= '$_CACHE[\'system\'][\'module\']=' . var_export($_CACHE['system']['module'], true); $text .= ';'; //写入日志 if ($state) { System::insert_event($func, time(), time(), "启用模块成功:" . $appid); } else { System::insert_event($func, time(), time(), "禁用模块成功:" . $appid); } //写入缓存 return create_file($file, $text); }