本文整理匯總了PHP中System::insert_event方法的典型用法代碼示例。如果您正苦於以下問題:PHP System::insert_event方法的具體用法?PHP System::insert_event怎麽用?PHP System::insert_event使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System
的用法示例。
在下文中一共展示了System::insert_event方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: switch
$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":
示例2: ob_end_clean
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();
}
?>
示例3: time
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">
示例4: time
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">
示例5: rglob
$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 {
示例6: update
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';
}
}
}
}
示例7: time
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">
示例8: getgpc
//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">
示例9: ClsFTP
$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);
//日期篩選
示例10: time
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']);
示例11: set_state
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);
}