/**
  *	Get URL Base
  *	Get the base from URL requested
  *
  *	@param	boolean	With basename
  *	@return	string
  */
 public static function URLBase($wirh_basename = FALSE)
 {
     if (!self::$URLBase) {
         $URLBase = strtolower($_SERVER['HTTPS']) == "on" ? "https" : "http";
         $URLBase .= "://";
         $URLBase .= $_SERVER['HTTP_HOST'];
         $URLBase .= str_replace(basename($_SERVER['PHP_SELF']), NULL, $_SERVER['PHP_SELF']);
         self::$URLBase = $URLBase;
     }
     return self::$URLBase . ($with_basename == true ? basename($_SERVER['PHP_SELF']) : NULL);
 }
 public function init()
 {
     $this->refererLink = !empty($_GET['referer']) ? urldecode($_GET['referer']) : CTM_URLEngine::URLBase();
     switch ($_GET['do']) {
         case "loginSuccess":
             $this->loadRedirectLoginSuccess();
             break;
         case "logoutSuccess":
             $this->loadRedirectLogoutSuccess();
             break;
     }
     CTM_Template::closeOpen();
     CTM_Template::open("redirector");
 }
    /**
     *	Global: System Information
     *
     *	@return	void
     */
    private function loadSystemInformation()
    {
        $license_name = SERVER_NAME;
        $license_address = preg_replace("/(www\\.|:.*)/i", NULL, $_SERVER['HTTP_HOST']);
        $url = CTM_URLEngine::URLBase();
        echo <<<HTML
<div align="center" style="width: 350px">
\t<a href="http://www.cetemaster.com.br" target="_blank"><img src="{$rl}admin/skin_cp/images/logo.png" border="0" /></a><br />
\t<a href="http://www.cetemaster.com.br" target="_blank">www.cetemaster.com.br</a> / <a href="http://www.cetemaster.com" target="_blank">www.cetemaster.com</a><br /><br />
    <strong style="color:rgb(6, 62, 80);">Effect Web {$this->vars['web_version']}</strong><br />
    Suite and control developed by <strong style="color:rgb(6, 62, 80);">Erick-Master & Litlle</strong><br />
    Design and images developed by <strong style="color:rgb(6, 62, 80);">LucasHP</strong><br /><br />
    <strong style="color:rgb(6, 62, 80);">MuOnline Suite Software (2013)</strong><br />
    Licensed to: <strong>{$license_name} - {$license_address}</strong><br />
    This software is not a free distribution.<br /><br />
    <strong style="color:rgb(6, 62, 80);">Cetemaster Services, Limited</strong><br />
    Copyright (c) 2010-2013. All Rights Reserved,<br />
    <a href="http://www.cetemaster.com.br" target="_blank">www.cetemaster.com.br</a> / <a href="http://www.cetemaster.com" target="_blank">www.cetemaster.com</a>

</div>
HTML;
        exit;
    }
 /**
  *	Redirect Page
  *
  *	@param	string	Title
  *	@param	string	Message
  *	@param	string	Link referer
  *	@return	void
  */
 public function redirectPage($title, $message, $referer = "*")
 {
     if ($referer == "*") {
         $referer = CTM_URLEngine::URLBase();
     }
     $GLOBALS['redirector']['title'] = $title;
     $GLOBALS['redirector']['message'] = $message;
     $GLOBALS['redirector']['referer'] = $referer;
     $this->loadSkinCache("others", "redirector", true);
     $this->noSetCache(true);
 }
 /**
  *	Private: Setup Variables
  *
  *	@return	void
  */
 private static function Setup()
 {
     if (CTM_ROOT_AREA == "public") {
         $template = CTM_Command::instance()->output->template;
         $publicDir = PUBLIC_DIRECTORY . "/%s/" . $template . "/";
         CTM_Command::instance()->updateVars("public_directory", PUBLIC_DIRECTORY . "/");
         CTM_Command::instance()->updateVars("admincp_directory", ADMINCP_DIRECTORY . "/");
         CTM_Command::instance()->updateVars("style_dirs,skin_styles", sprintf($publicDir, "style_css"));
         CTM_Command::instance()->updateVars("style_dirs,skin_images", sprintf($publicDir, "style_images"));
         CTM_Command::instance()->updateVars("style_dirs,skin_res", sprintf($publicDir, "style_resources"));
         CTM_Command::instance()->updateVars("style_dirs,styles", PUBLIC_DIRECTORY . "/style_css/");
         CTM_Command::instance()->updateVars("style_dirs,images", PUBLIC_DIRECTORY . "/images/");
         CTM_Command::instance()->updateVars("style_dirs,js", PUBLIC_DIRECTORY . "/javascripts/");
         CTM_Command::instance()->updateVars("board_host", CTM_URLEngine::URLHost());
         CTM_Command::instance()->updateVars("board_url", CTM_URLEngine::URLBase());
         CTM_Command::instance()->updateVars("path_url", CTM_URLEngine::URIString());
         CTM_Command::instance()->updateVars("language_js", EffectWebData::LANGUAGE_JS . CTM_Command::instance()->lang->language);
         define("SESSION_USER_LOGGED", Authentication::Check());
     }
 }
Beispiel #6
0
 /**
  *	Private: System Logs
  *	View and manage the system's logs
  *
  *	@return	void
  */
 private function loadSystemLogs()
 {
     if (!empty($_GET['load_file']) && !empty($_GET['folder'])) {
         if (array_key_exists($_GET['folder'], $this->logs_folders)) {
             $folder = $this->logs_folders[$_GET['folder']][0];
             $file = $folder . "-(" . str_replace(EW_LOG_EXT, NULL, $_GET['load_file']) . ")" . EW_LOG_EXT;
             $_GET['load_file'] = urldecode($_GET['load_file']);
             $GLOBALS['file_exists'] = file_exists(EW_LOG_PATH . $folder . "/" . $_GET['load_file']);
             if ($GLOBALS['file_exists'] == true) {
                 $GLOBALS['log_file_content'] = file_get_contents(EW_LOG_PATH . $folder . "/" . $_GET['load_file']);
             }
             if ($_GET['do'] == "download") {
                 if ($GLOBALS['file_exists'] == true) {
                     if (CTM_ACP_USE_ZIP == "gzip") {
                         showFileDownload($file . ".gz", gzencode($GLOBALS['log_file_content'], 9));
                     } elseif (CTM_ACP_USE_ZIP == "zip") {
                         if (class_exists("ZipArchive")) {
                             $zip = new ZipArchive();
                             $zip->open($filepath = CTM_CACHE_PATH . "temp_cache/" . md5(mt_rand() . "log__::" . time() . "__zip") . ".tmp", ZipArchive::CREATE);
                             $zip->addFile(EW_LOG_PATH . $folder . "/" . $_GET['load_file'], $_GET['load_file']);
                             $zip->close();
                             $content = file_get_contents($filepath);
                             unlink($filepath);
                         } else {
                             $zip = new ZipFile();
                             $zip->addFile($GLOBALS['log_file_content'], $_GET['load_file'], filemtime(EW_LOG_PATH . $log . "/" . $filename));
                             $content = $zip->file();
                         }
                         showFileDownload($file . ".zip", $content);
                     } else {
                         showFileDownload($file, $GLOBALS['log_file_content']);
                     }
                 }
             } elseif ($_GET['do'] == "delete") {
                 if ($GLOBALS['file_exists'] == true) {
                     if (!unlink(EW_LOG_PATH . $folder . "/" . $_GET['load_file'])) {
                         $GLOBALS['result_command'] = $this->lang->words['System']['Analysis']['SystemLogs']['ShowLogs']['Messages']['DeleteError'];
                         $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 2);
                     } else {
                         $url = "?app=core&module=system&section=analysis&index=logs&load_folder=" . $_GET['folder'] . "&message=file_deleted";
                         header("Location: " . CTM_URLEngine::URLBase() . $url);
                         exit;
                     }
                 }
             }
             $this->lang->setArguments("System,Analysis,SystemLogs,ShowLogs,Title", $_GET['load_file']);
             return $this->output->setContent("analysis_logsShowFile");
         } else {
             header("Location: " . CTM_URLEngine::URLBase() . "?app=core&module=system&section=analysis&index=logs");
         }
     } elseif (!empty($_GET['load_folder'])) {
         if (array_key_exists($_GET['load_folder'], $this->logs_folders)) {
             $log = $this->logs_folders[$_GET['load_folder']][0];
             if (!file_exists(EW_LOG_PATH . $log)) {
                 mkdir(EW_LOG_PATH . $log);
                 $GLOBALS['logs_files'] = array();
             } else {
                 if ($_GET['do'] == true) {
                     if ($_POST['DoCommand'] == "deleteFiles") {
                         $count = 0;
                         if (count($_POST) > 0) {
                             foreach ($_POST as $key => $value) {
                                 if (substr($key, 0, 6) == "file__" && $value == 1) {
                                     $file = substr($key, 6);
                                     $file = str_replace("_" . substr(EW_LOG_EXT, 1), EW_LOG_EXT, $file);
                                     if (file_exists(EW_LOG_PATH . $log . "/" . $file)) {
                                         unlink(EW_LOG_PATH . $log . "/" . $file);
                                         $count++;
                                     }
                                 }
                             }
                         }
                         $GLOBALS['result_command'] = sprintf($this->lang->words['System']['Analysis']['SystemLogs']['CategoryLogs']['Messages']['FilesDeleted'], $count);
                         $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 3);
                     } elseif ($_POST['DoCommand'] == "downloadFiles") {
                         $files_to_download = array();
                         if (count($_POST) > 0) {
                             foreach ($_POST as $key => $value) {
                                 if (substr($key, 0, 6) == "file__" && $value == 1) {
                                     $file = substr($key, 6);
                                     $file = str_replace("_" . substr(EW_LOG_EXT, 1), EW_LOG_EXT, $file);
                                     if (file_exists(EW_LOG_PATH . $log . "/" . $file)) {
                                         $files_to_download[] = $file;
                                     }
                                 }
                             }
                         }
                         if (count($files_to_download) == 0) {
                             $GLOBALS['result_command'] = $this->lang->words['System']['Analysis']['SystemLogs']['CategoryLogs']['Messages']['SelectFiles'];
                             $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 1);
                         } else {
                             if (class_exists("ZipArchive")) {
                                 $filepath = CTM_CACHE_PATH . "temp_cache/" . md5(mt_rand() . "log__::" . time() . "__zip") . ".tmp";
                                 $zip = new ZipArchive();
                                 $zip->open($filepath, ZipArchive::CREATE);
                             } else {
                                 $zip = new ZipFile();
                             }
                             foreach ($files_to_download as $filename) {
                                 if (class_exists("ZipArchive")) {
                                     $zip->addFile(EW_LOG_PATH . $log . "/" . $filename, $filename);
                                 } else {
                                     $content = file_get_contents(EW_LOG_PATH . $log . "/" . $filename);
                                     $time = filemtime(EW_LOG_PATH . $log . "/" . $filename);
                                     $zip->addFile($content, $filename, $time);
                                 }
                             }
                             if (class_exists("ZipArchive")) {
                                 $zip->close();
                                 $content = file_get_contents($filepath);
                                 unlink($filepath);
                             } else {
                                 $content = $zip->file();
                             }
                             showFileDownload($log . "_Logs.zip", $content);
                         }
                     } else {
                         $GLOBALS['result_command'] = $this->lang->words['System']['Analysis']['SystemLogs']['CategoryLogs']['Messages']['SelectAction'];
                         $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 1);
                     }
                 }
                 $GLOBALS['logs_files'] = array();
                 if (count($iterator = new DirectoryIterator(EW_LOG_PATH . $log)) > 0) {
                     foreach ($iterator as $fileinfo) {
                         if ($fileinfo->isDot() == false && $fileinfo->isDir() == false) {
                             $extension = strrpos($fileinfo->getFilename(), ".");
                             $extension = substr($fileinfo->getFilename(), $extension);
                             if (($fileinfo->isFile() == true || $fileinfo->isLink() == true) && $extension == EW_LOG_EXT) {
                                 $GLOBALS['logs_files'][$fileinfo->getFilename()] = array("change_data" => date("d/m/Y - H:i:s", $fileinfo->getMTime()), "file_size" => realFormatBytes($fileinfo->getSize()));
                             }
                         }
                     }
                 }
             }
             $this->lang->setArguments("System,Analysis,SystemLogs,CategoryLogs,Title", $this->logs_folders[$_GET['load_folder']][1]);
             return $this->output->setContent("analysis_logsFiles");
         } else {
             header("Location: " . CTM_URLEngine::URLBase() . "?app=core&module=system&section=analysis&index=logs");
         }
     } else {
         if ($_GET['do_folder'] == true) {
             if ($_POST['DoCommand'] != "clearFolders" && $_POST['DoCommand'] != "downloadFolders") {
                 $GLOBALS['result_command'] = $this->lang->words['System']['Analysis']['SystemLogs']['DoCommand']['Messages']['SelectAction'];
                 $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 1);
             } elseif ($_POST['DoCommand'] == "clearFolders") {
                 $folders_count = 0;
                 $files_count = 0;
                 $select_count = 0;
                 foreach ($_POST as $key => $value) {
                     if (substr($key, 0, 8) == "folder__" && $value == 1) {
                         $folder = substr($key, 8);
                         $tmp_count = 0;
                         $select_count++;
                         if (array_key_exists($folder, $this->logs_folders)) {
                             $folder = $this->logs_folders[substr($key, 8)][0];
                             if (!file_exists(EW_LOG_PATH . $folder)) {
                                 mkdir(EW_LOG_PATH . $folder);
                             }
                             if (count($iterator = new DirectoryIterator(EW_LOG_PATH . $folder)) > 0) {
                                 foreach ($iterator as $fileinfo) {
                                     if ($fileinfo->isDot() == false && $fileinfo->isDir() == false) {
                                         $extension = strrpos($fileinfo->getFilename(), ".");
                                         $extension = substr($fileinfo->getFilename(), $extension);
                                         if (($fileinfo->isFile() == true || $fileinfo->isLink() == true) && $extension == EW_LOG_EXT) {
                                             unlink(EW_LOG_PATH . $folder . "/" . $fileinfo->getFilename());
                                             $files_count++;
                                             $tmp_count++;
                                         }
                                     }
                                 }
                             }
                             if ($tmp_count > 0) {
                                 $folders_count++;
                             }
                         }
                     }
                 }
                 if ($select_count == 0) {
                     $GLOBALS['result_command'] = $this->lang->words['System']['Analysis']['SystemLogs']['DoCommand']['Messages']['SelectFolders'];
                     $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 1);
                 } else {
                     $this->lang->setTags("System,Analysis,SystemLogs,DoCommand,Messages,FoldersCleaned", $files_count, $folders_count);
                     $GLOBALS['result_command'] = $this->lang->words['System']['Analysis']['SystemLogs']['DoCommand']['Messages']['FoldersCleaned'];
                     $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 3);
                 }
             } elseif ($_POST['DoCommand'] == "downloadFolders") {
                 $folders_to_download = array();
                 $select_count = 0;
                 foreach ($_POST as $key => $value) {
                     if (substr($key, 0, 8) == "folder__" && $value == 1) {
                         $folder = substr($key, 8);
                         $select_count++;
                         if (array_key_exists($folder, $this->logs_folders)) {
                             $folder = $this->logs_folders[substr($key, 8)][0];
                             $folders_to_download[$folder] = array();
                             if (!file_exists(EW_LOG_PATH . $folder)) {
                                 mkdir(EW_LOG_PATH . $folder);
                             }
                             if (count($iterator = new DirectoryIterator(EW_LOG_PATH . $folder)) > 0) {
                                 foreach ($iterator as $fileinfo) {
                                     if ($fileinfo->isDot() == false && $fileinfo->isDir() == false) {
                                         $extension = strrpos($fileinfo->getFilename(), ".");
                                         $extension = substr($fileinfo->getFilename(), $extension);
                                         if (($fileinfo->isFile() == true || $fileinfo->isLink() == true) && $extension == EW_LOG_EXT) {
                                             $folders_to_download[$folder][$fileinfo->getFilename()] = $fileinfo->getMTime();
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
                 if ($select_count == 0) {
                     $GLOBALS['result_command'] = $this->lang->words['System']['Analysis']['SystemLogs']['DoCommand']['Messages']['SelectFolders'];
                     $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 1);
                 } else {
                     if (class_exists("ZipArchive")) {
                         $filepath = CTM_CACHE_PATH . "temp_cache/" . md5(mt_rand() . "log__::" . time() . "__zip") . ".tmp";
                         $zip = new ZipArchive();
                         $zip->open($filepath, ZipArchive::CREATE);
                     } else {
                         $zip = new ZipFile();
                     }
                     foreach ($folders_to_download as $folder => $files) {
                         if (class_exists("ZipArchive")) {
                             $zip->addEmptyDir($folder);
                         } else {
                             $zip->addFile(NULL, $folder . "/");
                         }
                         if (count($files) > 0) {
                             foreach ($files as $filename => $filetime) {
                                 if (class_exists("ZipArchive")) {
                                     $zip->addFile(EW_LOG_PATH . $folder . "/" . $filename, $folder . "/" . $filename);
                                 } else {
                                     $content = file_get_contents(EW_LOG_PATH . $folder . "/" . $filename);
                                     $zip->addFile($content, $folder . "/" . $filename, $filetime);
                                 }
                             }
                         }
                     }
                     if (class_exists("ZipArchive")) {
                         $zip->close();
                         $content = file_get_contents($filepath);
                         unlink($filepath);
                     } else {
                         $content = $zip->file();
                     }
                     showFileDownload(sprintf($this->logs_zip_file['name'], date($this->logs_zip_file['date'])) . ".zip", $content);
                 }
             }
         }
         foreach ($this->logs_folders as $key => $value) {
             $GLOBALS['logs_folders'][$key] = array("name" => $value[1], "count_files" => number_format(intval(count(glob(EW_LOG_PATH . $value[0] . "/*" . EW_LOG_EXT))), 0, false, "."));
         }
         $this->output->setContent("analysis_logs");
         if (loadIsAjax() == true) {
             $this->output->setVariable("no_set_tmp", true);
         }
     }
 }
 /**
  *	Get Guild Mark
  *	Get the guild mark link
  *
  *	@param	string	Mark Hexa
  *	@return	string
  */
 public function GetGuildMark($hexa)
 {
     $url = CTM_URLEngine::URLBase();
     return $url . EffectWebData::LOGOGUILD_URL . "&hexa=" . urlencode(bin2hex($hexa));
 }
Beispiel #8
0
 /**
  *	Redirect page
  *
  *	@param	string	Title
  *	@param	string	Message
  *	@param	string	Referer link
  *	@return	void
  */
 public function redirectPage($title, $message, $referer = "*")
 {
     if ($referer == "*") {
         $referer = CTM_URLEngine::URLBase();
     }
     exit(self::loadSkinCache("core_global")->global_redirect($title, $message, $referer));
 }
 /**
  *	Logout Module
  *
  * @return void
  */
 public static function LogoutModule($onlyDestroy = FALSE)
 {
     if (loadIsAjax() == true) {
         $location = CTM_URLEngine::URLBase() . "?app=core&module=global&section=login&do=logout";
         exit("<script>window.location = '{$location}'</script>");
     }
     CTM_Cookies::setCookie("AuthLogin", NULL);
     CTM_Cookies::setCookie("AuthSession", NULL);
     CTM_Cookies::setCookie("AuthKey", NULL);
     unset($_SESSION['USERCP_CHARACTER_SELECTED']);
     unset($_SESSION['ACCOUNT_DATA']);
     unset($_SESSION['AUTH_SESSION']);
     if ($onlyDestroy == false) {
         self::instance()->lang->loadLanguageFile("auth");
         self::instance()->output->redirectPage(self::instance()->lang->words['Auth']['Redirect']['Logout'], NULL);
     }
 }
 /**
  *	Login Module
  *
  *	@param	boolean	Process
  *	@return void
  */
 public static function LoginModule($proccess = FALSE)
 {
     self::instance()->lang->loadLanguageFile("auth");
     if ($proccess == TRUE) {
         $set_result = create_function("\$content, \$msg", "\r\n\t\t\t\$requestURI = CTM_URLEngine::URIString();\r\n\t\t\t\$is_ajax = false;\r\n\t\r\n\t\t\tif(substr_count(\$requestURI, \"&ajaxLoadSet=true\") > 0) \$is_ajax = true;\r\n\t\t\tif(substr_count(\$requestURI, \"&ajaxLoadCache=\") > 0) \$is_ajax = true;\r\n\t\t\t\r\n\t\t\tif(\$is_ajax == true)\r\n\t\t\t\texit(adminShowMessage(\$content, \$msg));\r\n\t\t\telse \$GLOBALS['auth_login']['message'] = \$content;\r\n\t\t\t");
         $_username = str_replace("'", NULL, $_REQUEST['username']);
         $_password = str_replace("'", NULL, $_REQUEST['password']);
         $_referer = $_REQUEST['referer'];
         $warning = $_GET['min_login'] == true ? -1 : 1;
         $error = $_GET['min_login'] == true ? -2 : 2;
         if (empty($_username) || empty($_password)) {
             return $set_result(self::instance()->lang->words['Auth']['Login']['Process']['EmptyFields'], $warning);
         } else {
             self::DB()->Arguments($_username, $_password, USE_MD5);
             $checkLoginQ = self::DB()->Query("EXEC dbo.CTM_CheckAccount '%s','%s',%d");
             $checkLogin = self::DB()->FetchRow($checkLoginQ);
             $resultLogin = "******" . bin2hex($checkLogin[0]);
             if ($resultLogin == "0x02") {
                 return $set_result(self::instance()->lang->words['Auth']['Login']['Process']['LoginFailed'], $error);
             } elseif ($resultLogin == "0x03") {
                 self::DB()->Arguments($_username);
                 $get_info = self::DB()->Select("*", "CTM_TeamMembers", "Account = '%s'");
                 if (self::DB()->CountRows($get_info) < 1) {
                     return $set_result(self::instance()->lang->words['Auth']['Login']['Process']['NoPermission'], $error);
                 } else {
                     $_info = self::DB()->FetchArray($get_info);
                     if ($_info['ACP_Access'] != 1) {
                         return $set_result(self::instance()->lang->words['Auth']['Login']['Process']['NoPermission'], $error);
                     } else {
                         self::$_tmp_team_info = (array) $_info;
                         $authSession = md5($_username . "&" . $_password . "&" . time() . "&" . mt_rand());
                         $authKey = self::EncodeKey($_username, $authSession);
                         CTM_Cookies::setCookie("ACP_AuthLogin", self::Encode($_username));
                         CTM_Cookies::setCookie("ACP_AuthSession", $authSession);
                         CTM_Cookies::setCookie("ACP_AuthKey", $authKey);
                         define("USER_ACCOUNT", $_username);
                         $_SESSION['ACP_AUTH_SESSION'] = $authSession;
                         $_SESSION['ACP_ACCOUNT_DATA'] = self::LoadData();
                         $_SESSION['ACP_AUTH_SECURE_TIMER'] = strtotime("+ 30 minutes");
                         if (loadIsAjax() == true) {
                             $location = CTM_URLEngine::URLBase() . "?app=core&amp;module=global&amp;section=login&amp;do=process";
                             $data = "<form action='{$location}' method='post' name='continue'>";
                             $data .= "<input type='hidden' name='referer' value='" . $_referer . "' />";
                             $data .= "<input type='hidden' name='username' value='" . $_username . "' />";
                             $data .= "<input type='hidden' name='password' value='" . $_password . "' />";
                             $data .= "</form>";
                             $data .= "<script> document.continue.submit(); </script>";
                             exit($data);
                         }
                         CTM_ACPBoard::output()->redirectPage(self::instance()->lang->words['Auth']['Redirect']['Login'], NULL, $_referer);
                     }
                 }
             }
         }
     }
 }