function ShowClearCachePage() { global $LNG; ClearCache(); $template = new template(); $template->show('clearcache.tpl'); }
function ShowClearCachePage() { global $LNG; ClearCache(); $template = new template(); $template->message($LNG['cc_cache_clear']); }
function ShowModulePage() { global $LNG; $config = Config::get(Universe::getEmulated()); $module = explode(';', $config->moduls); if ($_GET['mode']) { $module[HTTP::_GP('id', 0)] = $_GET['mode'] == 'aktiv' ? 1 : 0; $config->moduls = implode(";", $module); $config->save(); ClearCache(); } $IDs = range(0, MODULE_AMOUNT - 1); foreach ($IDs as $ID => $Name) { $Modules[$ID] = array('name' => $LNG['modul'][$ID], 'state' => isset($module[$ID]) ? $module[$ID] : 1); } asort($Modules); $template = new template(); $template->assign_vars(array('Modules' => $Modules, 'mod_module' => $LNG['mod_module'], 'mod_info' => $LNG['mod_info'], 'mod_active' => $LNG['mod_active'], 'mod_deactive' => $LNG['mod_deactive'], 'mod_change_active' => $LNG['mod_change_active'], 'mod_change_deactive' => $LNG['mod_change_deactive'])); $template->show('ModulePage.tpl'); }
* * On Debian GNU/Linux systems, the complete text of the GNU General * Public License can be found in `/usr/share/common-licenses/GPL-2'. * * Otherwise you can read it here: http://www.gnu.org/licenses/gpl-2.0.txt ****************************************************************************/ /** * Class and Function List: * Function list: * Classes list: */ require_once 'classes/Session.inc'; require_once 'classes/Security.inc'; Session::logcheck("MenuEvents", "ControlPanelSEM"); require_once "handle_cache.inc"; $config = parse_ini_file("everything.ini"); $cache_dir = $config["cache_dir"]; $action = GET("action"); ossim_valid($action, OSS_ALPHA, 'illegal:' . _("action")); if (ossim_error()) { die(ossim_error()); } if ($action == "update") { print GetCacheInfo($cache_dir); } elseif ($action == "print") { PrintCacheInfo($cache_dir); } elseif ($action == "clean") { CleanCache($cache_dir); } elseif ($action == "purge") { ClearCache($cache_dir); }
function clearCache() { ClearCache(); }
$message = 'Update error.<br><br>' . $errorMessage . '<br><br><b><i>Backup restored.</i></b>'; } catch (Exception $e) { $message = 'Update error.<br><br>' . $errorMessage . '<br><br><b><i>Can not restore backup. Your game is maybe broken right now.</i></b><br><br>Restore error:<br>' . $e->getMessage(); } throw new Exception($message); } break; } } $revision = end($fileList); $revision = $revision['fileRevision']; } $gameVersion = explode('.', Config::get(ROOT_UNI)->VERSION); $gameVersion[2] = $revision; Database::get()->update("UPDATE %%CONFIG%% SET VERSION = '" . implode('.', $gameVersion) . "', sql_revision = " . $revision . ";"); ClearCache(); $template->assign_vars(array('update' => !empty($fileList), 'revision' => $revision, 'header' => $LNG['menu_upgrade'])); $template->show('ins_doupdate.tpl'); break; case 'install': $step = HTTP::_GP('step', 0); switch ($step) { case 1: if (isset($_POST['post'])) { if (isset($_POST['accept'])) { HTTP::redirectTo('index.php?mode=install&step=2'); } else { $template->assign(array('accept' => false)); } } $template->show('ins_license.tpl');
function ShowUpdatePage() { global $LNG, $CONF, $db; if (isset($_REQUEST['version'])) { $Temp = explode('.', $_REQUEST['version']); $Temp = array_map('intval', $Temp); update_config(array('VERSION' => $Temp[0] . '.' . $Temp[1] . '.' . $Temp[2]), true); } $Patchlevel = explode(".", $GLOBALS['CONF']['VERSION']); if ($_REQUEST['action'] == 'history') { $Level = 0; } elseif (isset($Patchlevel[2])) { $Level = $Patchlevel[2]; } switch ($_REQUEST['action']) { case "download": $UpdateArray = getDatafromServer('getupdate'); if (!is_array($UpdateArray['revs'])) { exitupdate(array('debug' => array('noupdate' => $LNG['up_kein_update']))); } require_once ROOT_PATH . 'includes/libs/zip/zip.lib.php'; $SVN_ROOT = $UpdateArray['info']['svn']; $zipfile = new zipfile(); $TodoDelete = ""; $Files = array('add' => array(), 'edit' => array(), 'del' => array()); $FirstRev = 0; $LastRev = 0; foreach ($UpdateArray['revs'] as $Rev => $RevInfo) { if (!empty($RevInfo['add'])) { foreach ($RevInfo['add'] as $File) { if (in_array($File, $Files['add']) || strpos($File, '.') === false) { continue; } $Files['add'][] = $File; $zipfile->addFile(@file_get_contents($SVN_ROOT . $File), str_replace("/trunk/", "", $File), $RevInfo['timestamp']); } } if (!empty($RevInfo['edit'])) { foreach ($RevInfo['edit'] as $File) { if (in_array($File, $Files['edit']) || strpos($File, '.') === false) { continue; } $Files['edit'][] = $File; $zipfile->addFile(@file_get_contents($SVN_ROOT . $File), str_replace("/trunk/", "", $File), $RevInfo['timestamp']); } } if (!empty($RevInfo['del'])) { foreach ($RevInfo['del'] as $File) { if (in_array($File, $Files['del']) || strpos($File, '.') === false) { continue; } $Files['del'][] = $File; $TodoDelete .= str_replace("/trunk/", "", $File) . "\r\n"; } } if ($FirstRev === 0) { $FirstRev = $Rev; } $LastRev = $Rev; } if (!empty($TodoDelete)) { $zipfile->addFile($TodoDelete, "!TodoDelete!.txt", $RevInfo['timestamp']); } update_config(array('VERSION' => $Patchlevel[0] . "." . $Patchlevel[1] . "." . $LastRev), true); // Header für Download senden $File = $zipfile->file(); header("Content-length: " . strlen($File)); header("Content-Type: application/force-download"); header('Content-Disposition: attachment; filename="patch_' . $FirstRev . '_to_' . $LastRev . '.zip"'); header("Content-Transfer-Encoding: binary"); // Zip File senden echo $File; exit; break; case "update": require_once ROOT_PATH . 'includes/libs/ftp/ftp.class.php'; require_once ROOT_PATH . 'includes/libs/ftp/ftpexception.class.php'; $UpdateArray = getDatafromServer('getupdate'); if (!is_array($UpdateArray['revs'])) { exitupdate(array('debug' => array('noupdate' => $LNG['up_kein_update']))); } $SVN_ROOT = $UpdateArray['info']['svn']; $CONFIG = array("host" => $CONF['ftp_server'], "username" => $CONF['ftp_user_name'], "password" => $_POST['password'], "port" => 21); try { $ftp = FTP::getInstance(); $ftp->connect($CONFIG); $LOG['debug']['connect'] = $LNG['up_ftp_ok']; } catch (FTPException $error) { $LOG['debug']['connect'] = $LNG['up_ftp_error'] . "" . $error->getMessage(); exitupdate($LOG); } if ($ftp->changeDir($CONF['ftp_root_path'])) { $LOG['debug']['chdir'] = $LNG['up_ftp_change'] . "" . $CONF['ftp_root_path'] . "): " . $LNG['up_ftp_ok']; } else { $LOG['debug']['chdir'] = $LNG['up_ftp_change'] . "" . $CONF['ftp_root_path'] . "): " . $LNG['up_ftp_change_error']; exitupdate($LOG); } $Files = array('add' => array(), 'edit' => array(), 'del' => array()); $Check = 0; foreach ($UpdateArray['revs'] as $Rev => $RevInfo) { if ($Check === 0) { $Check = 1; if ($Rev - 1 != $Level) { $LOG['debug']['rev'] = "UpdateServer requrie Revision " . ($Rev - 1) . "."; exitupdate($LOG); } } if (!empty($RevInfo['add'])) { foreach ($RevInfo['add'] as $File) { if (in_array($File, $Files['add'])) { continue; } $Files['add'][] = $File; if ($File == "/trunk/updates/update_" . $Rev . ".sql") { $db->multi_query(str_replace("prefix_", DB_PREFIX, @file_get_contents($SVN_ROOT . $File))); continue; } elseif ($File == "/trunk/updates/update_" . $Rev . ".php") { require $SVN_ROOT . $File; } else { if (strpos($File, '.') !== false) { $Data = fopen($SVN_ROOT . $File, "r"); if ($ftp->uploadFromFile($Data, str_replace("/trunk/", "", $File))) { $LOG['update'][$Rev][$File] = $LNG['up_ok_update']; } else { $LOG['update'][$Rev][$File] = $LNG['up_error_update']; } fclose($Data); } else { if ($ftp->makeDir(str_replace("/trunk/", "", $File), 1)) { if (PHP_SAPI == 'apache2handler') { $ftp->chmod(str_replace("/trunk/", "", $File), '0777'); } else { $ftp->chmod(str_replace("/trunk/", "", $File), '0755'); } $LOG['update'][$Rev][$File] = $LNG['up_ok_update']; } else { $LOG['update'][$Rev][$File] = $LNG['up_error_update']; } } } } } if (!empty($RevInfo['edit'])) { foreach ($RevInfo['edit'] as $File) { if (in_array($File, $Files['edit'])) { continue; } $Files['edit'][] = $File; if (strpos($File, '.') !== false) { if ($File == "/trunk/updates/update_" . $Rev . ".sql") { $db->multi_query(str_replace("prefix_", DB_PREFIX, @file_get_contents($SVN_ROOT . $File))); continue; } else { $Data = fopen($SVN_ROOT . $File, "r"); if ($ftp->uploadFromFile($Data, str_replace("/trunk/", "", $File))) { $LOG['update'][$Rev][$File] = $LNG['up_ok_update']; } else { $LOG['update'][$Rev][$File] = $LNG['up_error_update']; } fclose($Data); } } } } if (!empty($RevInfo['del'])) { foreach ($RevInfo['del'] as $File) { if (in_array($File, $Files['del'])) { continue; } $Files['del'][] = $File; if (strpos($File, '.') !== false) { if ($ftp->delete(str_replace("/trunk/", "", $File))) { $LOG['update'][$Rev][$File] = $LNG['up_delete_file']; } else { $LOG['update'][$Rev][$File] = $LNG['up_error_delete_file']; } } else { if ($ftp->removeDir(str_replace("/trunk/", "", $File), 1)) { $LOG['update'][$Rev][$File] = $LNG['up_delete_file']; } else { $LOG['update'][$Rev][$File] = $LNG['up_error_delete_file']; } } } } $LastRev = $Rev; } $LOG['finish']['atrev'] = $LNG['up_update_ok_rev'] . " " . $LastRev; // Verbindung schließen ClearCache(); update_config(array('VERSION' => $Patchlevel[0] . "." . $Patchlevel[1] . "." . $LastRev), true); exitupdate($LOG); break; default: $template = new template(); $RevList = ''; $Update = ''; $Info = ''; $UpdateArray = getDatafromServer('update'); if (!is_array($UpdateArray)) { $template->message($UpdateArray); } else { if (is_array($UpdateArray['revs'])) { foreach ($UpdateArray['revs'] as $Rev => $RevInfo) { if (!(empty($RevInfo['add']) && empty($RevInfo['edit'])) && $Patchlevel[2] < $Rev) { $Update = "<tr><td><a href=\"#\" onclick=\"openPWDialog();return false;\">Update</a>" . (function_exists('gzcompress') ? " - <a href=\"?page=update&action=download\">" . $LNG['up_download_patch_files'] . "</a>" : "") . "</td></tr>"; $Info = "<tr><th colspan=\"5\">" . $LNG['up_aktuelle_updates'] . "</th></tr>"; } $edit = ""; if (!empty($RevInfo['edit']) || is_array($RevInfo['edit'])) { foreach ($RevInfo['edit'] as $file) { $edit .= '<a href="http://code.google.com/p/2moons/source/diff?spec=svn' . $Rev . '&r=' . $Rev . '&format=side&path=' . $file . '" target="diff">' . str_replace("/trunk/", "", $file) . '</a><br>'; } } $RevList .= "<tr>\r\n\t\t\t\t\t\t" . ($Patchlevel[2] == $Rev ? "<th colspan=5>" . $LNG['up_momentane_version'] . "</th></tr><tr>" : ($Patchlevel[2] - 1 == $Rev ? "<th colspan=5>" . $LNG['up_alte_updates'] . "</th></tr><tr>" : "")) . "\r\n\t\t\t\t\t\t<th>" . ($Patchlevel[2] == $Rev ? "<font color=\"red\">" : "") . "" . $LNG['up_revision'] . "" . $Rev . " " . date(TDFORMAT, $RevInfo['timestamp']) . " " . $LNG['ml_from'] . " " . $RevInfo['author'] . ($Patchlevel[2] == $Rev ? "</font>" : "") . "</th></tr>\r\n\t\t\t\t\t\t<tr><td>" . makebr($RevInfo['log']) . "</th></tr>\r\n\t\t\t\t\t\t" . (!empty($RevInfo['add']) ? "<tr><td>" . $LNG['up_add'] . "<br>" . str_replace("/trunk/", "", implode("<br>\n", $RevInfo['add'])) . "</b></td></tr>" : "") . "\r\n\t\t\t\t\t\t" . (!empty($RevInfo['edit']) ? "<tr><td>" . $LNG['up_edit'] . "<br>" . $edit . "</b></td></tr>" : "") . "\r\n\t\t\t\t\t\t" . (!empty($RevInfo['del']) ? "<tr><td>" . $LNG['up_del'] . "<br>" . str_replace("/trunk/", "", implode("<br>\n", $RevInfo['del'])) . "</b></td></tr>" : "") . "\r\n\t\t\t\t\t\t</tr>"; } } $template->assign_vars(array('up_password_title' => $LNG['up_password_title'], 'up_password_info' => $LNG['up_password_info'], 'up_password_label' => $LNG['up_password_label'], 'up_submit' => $LNG['up_submit'], 'up_version' => $LNG['up_version'], 'version' => $CONF['VERSION'], 'RevList' => $RevList, 'Update' => $Update, 'Info' => $Info)); $template->show('adm/UpdatePage.tpl'); } break; } }
function Logout() { $this->UpdateHistory(0); $this->SaveSession(); if (!($row = $this->db->Query_Fetch_Assoc("SELECT uid, INET_NTOA(ip) as ip, sessid " . "FROM users_online " . "WHERE id=" . $_SESSION[S_ID]["online_table_id"] . " " . "LIMIT 0,1"))) { LogWrite(USERS_LOG, "ненайдена сессия для " . $this->login . ", в подключенных пользователях"); return; } if ($row["uid"] != $this->id) { LogWrite(USERS_LOG, "для пользователя " . $this->login . " в сессии " . $_REQUEST["PHPSESSID"] . " не совпадает id пользователя (" . $row["uid"] . ")"); } if ($row["ip"] != $_SESSION[S_ID]["ip_login"]) { LogWrite(USERS_LOG, "для пользователя " . $this->login . " в сессии " . $_REQUEST["PHPSESSID"] . " не совпадает ip (" . $_SESSION[S_ID]["ip_login"] . " - " . $row["ip_login"] . ")"); } if ($row["sessid"] != $_REQUEST["PHPSESSID"]) { LogWrite(USERS_LOG, "для пользователя " . $this->login . " не совпадают сессии " . $_REQUEST["PHPSESSID"] . " и " . $row["sessid"]); } $this->db->Query("DELETE FROM users_online WHERE id=" . $_SESSION[S_ID]["online_table_id"]); $user = new System_User($this->db); // проверяем есть ли в списке залогиненых этот же пользователь? если есть, и последняя активность более 24 часов, то удаляем запись if (!($result = $this->db->Query_Fetch("SELECT id, uid, TIMEDIFF(NOW(), time_last_active)+0 as time, inet_ntoa(ip) as ip, time_login, time_last_active " . "FROM users_online "))) { return; } // чистим таблицу с давно законнекчиными foreach ($result as $row) { if ($row["time"] < SESSION_HOURS) { continue; } $this->db->Query("INSERT INTO users_connection_history (uid, ip, time_active, state) " . "VALUES ('" . $row["uid"] . "', inet_aton('" . $row["ip"] . "'), '" . $row["time_last_active"] . "', 0)"); $this->db->Query("DELETE FROM users_online WHERE id=" . $row["id"]); $user->Reset($row["uid"]); LogWrite(USERS_LOG, "из залогиненых пользователей была удалена старая запись пользователя " . $user->login . ", " . "от " . $row["time_login"] . " (IP: " . $row["ip"] . ")"); } // чистим старые кешы ClearCache(); }