/** * Show Kernel Error * Break the script and show error * * @param string Kernel Error (optional) * @return void */ public static function kernelError($message = NULL) { if (loadIsAjax() == true) { exit(self::showSimpleError("Kernel Error: " . $message)); } if (file_exists(CTM_CACHE_PATH . "skin_cache/kernelError.php")) { require_once CTM_CACHE_PATH . "skin_cache/kernelError.php"; } elseif (function_exists("ctm_exception_error")) { ctm_exception_error($message); } else { throw new Exception($message); } exit; }
/** * Init Class * * @return void */ public function init() { $this->registry(); $this->loadGlobalArguments(); $this->loadGlobalTags(); if (loadIsAjax() == true && (!($_GET['pag'] || !$_GET['module']) && !$this->URLData[1]) && !$_GET['ajax']) { $this->loadWebRecordOnline(); $this->loadWebServerList(); $this->loadHeaderQuerys(); $this->loadHeaderArguments(); } elseif (loadIsAjax() == false) { $this->loadWebRecordOnline(); $this->loadWebServerList(); $this->loadHeaderQuerys(); $this->loadHeaderArguments(); } }
/** * Init ACP Board * * @return void */ public static function init($core_module = NULL) { self::acp_instance()->registry(); self::start($core_module); self::setup($core_module); $skin_global = self::output()->loadSkinCache("core_global", false); if (ACP_SESSION_LOGGED == TRUE) { self::instance()->lang->loadLanguageFile("header", "Core"); self::instance()->lang->setArguments("Header,Footer,LoadTime", CTM_LoadTime::resultTime()); if (!self::$output_content) { self::$output_content = $skin_global; } $skin_global->registry(); self::$output_content->registry(); if (ACP_PERMISSION_ACCESS_ERROR == 1) { $output_content = $skin_global->permission_error(); } elseif (ACP_PERMISSION_LICENSE_ERROR == 1) { $output_content = $skin_global->module_unavailable(); } elseif (method_exists(self::$output_content, self::$output_method)) { $output_content = self::$output_content->{self::$output_method}(); } if (method_exists(self::$output_content, "core_global_sidebar")) { $output_sidebar = self::$output_content->core_global_sidebar(); } else { $output_sidebar = NULL; } if (loadIsAjax() == true) { print $output_content; } else { print $skin_global->global_header($output_content, $output_sidebar); } } else { self::instance()->lang->loadLanguageFile("auth", "Core"); $skin_global->registry(); print $skin_global->auth_login($GLOBALS['auth_login']['message']); } print "\r\n<!-- Effect Web 2 :: Admin Control Panel " . ACP_PUBLIC_VERSION . " / Powered by Erick-Master & Litlle / (c) 2012 - www.cetemaster.com.br [Licensed to: " . SERVER_NAME . "] -->"; }
/** * Option: Change Mail * Change the e-mail from account * * @return void */ public function ChangeMail() { switch ($_GET['do']) { case "send_code": $currentId = $this->DB->GetCurrentId("CTM_ChangeMail") + 1; $dechex = create_function("\$integer", "return str_pad(dechex(\$integer >= 255 ? 255 : \$integer), 2, 0, STR_PAD_LEFT);"); $confirmCode = $dechex($currentId); $confirmCode .= ":" . $dechex(0xbb - strlen($this->userData['memb___id']) + mt_rand(0, 50)); $confirmCode .= ":" . $dechex(strlen($this->userData['mail_addr']) + mt_rand(0, 50)); $confirmCode .= ":" . $dechex(mt_rand(0, 70)); $confirmCode .= ":" . $dechex(mt_rand(71, 170)); $confirmCode .= ":" . $dechex(0xbb / intval(date("d")) + intval(date("H")) + intval(date("m")) + intval(date("s")) + mt_rand(0, 50)); $confirmCode .= ":" . $dechex(0xbb / intval(date("m")) + intval(date("H")) + intval(date("m")) + intval(date("s")) + mt_rand(0, 50)); $confirmCode .= ":" . $dechex(intval(date("Y")) / 0xbb + intval(date("H")) + intval(date("m")) + intval(date("s")) + mt_rand(0, 50)); $confirmCode = strtoupper($confirmCode); $link = gerateFullLink("?/userpanel/changeMail"); $this->DB->Insert("CTM_ChangeMail", array("Account" => $this->userData['info']['memb___id'], "ConfirmCode" => $confirmCode, "Expiration" => strtotime("+ 24 hours"))); $this->email->arguments = array("NAME" => htmlEncode($this->userData['info']['memb_name']), "CONFIRM_CODE" => $confirmCode, "SYSTEM_LINK" => $link); $this->email->LoadTemplate("ChangeMemberMail"); $this->email->GetMailContent($mail); $this->mailer->AddAddress($this->userData['info']['mail_addr'], $this->userData['info']['memb_name']); $this->mailer->SetSubject($mail['subject']); $this->mailer->SetBody($mail['content']); if ($this->mailer->SendMail() == true) { $this->WriteLog(array("option" => "Change Mail", "data" => array("Process: Send Confirm Code", "Result: Success"))); return setResult(showMessage($this->lang->words['UserPanel']['ChangeMail']['Messages']['SendCode']['Success'], 3)); } else { $this->WriteLog(array("option" => "Change Mail", "data" => array("Process: Send Confirm Code", "Result: Error"))); $this->lang->setArguments("UserPanel,ChangeMail,Messages,Error_SendMail", CoreVariables::ErrorsCode()->SendMailError); return setResult(showMessage($this->lang->words['UserPanel']['ChangeMail']['Messages']['SendCode']['Error_SendMail'], 2)); } break; case "process": if (empty($_POST['NewMail']) || empty($_POST['ConfirmCode'])) { return setResult(showMessage($this->lang->words['UserPanel']['ChangeMail']['Messages']['Process']['Void'], 1)); } if (!CTM_Text::CheckMail($_POST['NewMail'])) { return setResult(showMessage($this->lang->words['UserPanel']['ChangeMail']['Messages']['Process']['MailInvalid'], 2)); } $this->DB->Arguments($_POST['ConfirmCode'], USER_ACCOUNT); $findConfirmCodeQ = $this->DB->Select("Expiration", "CTM_ChangeMail", "ConfirmCode = '%s' AND Account = '%s'"); if ($this->DB->CountRows($findConfirmCodeQ) < 1) { return setResult(showMessage($this->lang->words['UserPanel']['ChangeMail']['Messages']['Process']['CodeInvalid'], 2)); } $findConfirmCode = $this->DB->FetchRow($findConfirmCodeQ); if (time() >= $findConfirmCode[0]) { return setResult(showMessage($this->lang->words['UserPanel']['ChangeMail']['Messages']['Process']['CodeExpired'], 2)); } $this->MuLib('Member')->UpdateAccount(USER_ACCOUNT, array("info" => array("mail_addr" => $_POST['NewMail']))); $this->DB->Arguments(USER_ACCOUNT, $_POST['ConfirmCode']); $this->DB->Delete("CTM_ChangeMail", "Account = '%s' AND ConfirmCode = '%s'"); $this->WriteLog(array("option" => "Change Mail", "data" => array("Process: Change Mail", "New Mail: " . $_POST['NewMail']))); return setResult(showMessage($this->lang->words['UserPanel']['ChangeMail']['Messages']['Process']['Success'], 3)); break; default: if (loadIsAjax() == true && LOADING_PAGE_AJAX == false) { exit; } break; } }
<?php global $ErrorMessage, $ExtraMessages, $AllOk, $ProductInfo, $LicenseInfo, $DomainAddress, $IPAddress; if (CTM_DEVELOPER_MODE == TRUE) { $SerialKey = explode("-", "D84AE-5D6F0-E26C5-E93BE-50479"); } else { $SerialKey = array(NULL, NULL, NULL, NULL, NULL); if ($LicenseInfo['serialKey']) { $SerialKey = $LicenseInfo['serialKey']; } } if (loadIsAjax() == true) { if ($AllOk == true) { exit("<script>activationSucceed();</script>"); } else { if ($ExtraMessages) { $extra = "<div class='warning-box'> "; foreach ($ExtraMessages as $msg) { $extra .= "» " . $msg . "<br />\n"; } $extra .= "</div>"; } exit("<div class='error-box'> <strong>{$ErrorMessage}</strong></div>{$extra}"); } } if (!empty($ErrorMessage)) { $licenseError = "<h2>{$ErrorMessage}</h2>"; } if ($LicenseInfo) { $licenseData = <<<HTML \t<blockquote><h3><strong>Product License:</strong></h3><br />
/** * Private: Get Content * * @return string */ private static function GetContent() { if (LOADING_PAGE_AJAX == true) { if (loadIsAjax() == false) { CTM_Command::instance()->output->loadSkinCache("global", "headerTemplate", true); $subContent = CTM_Command::instance()->output->returnContent(false, "subContent"); return CTM_Command::instance()->output->returnFullContent(array("{#TEMPLATE_CONTENT#}" => $subContent)); } else { return CTM_Command::instance()->output->returnContent(false, "subContent"); } } else { CTM_Command::instance()->output->loadSkinCache("global", "headerTemplate", true); $subContent = CTM_Command::instance()->output->returnContent(false, "subContent"); return CTM_Command::instance()->output->returnFullContent(array("{#TEMPLATE_CONTENT#}" => $subContent)); } }
/** * Private: Manage Character * Manage a character from database * * @return void */ private function loadManageCharacter() { if ($this->loadCheckCharacter($_GET['charname'])) { $char_data = $this->MuLib('Member')->LoadChar($_GET['charname'] = urldecode($_GET['charname'])); switch ($_GET['do']) { case "ban": if ($this->CheckPermissionItem("characters_manageCharacter_ban") == true) { if ($_GET['write'] == true) { if (empty($_POST['banReason']) || empty($_POST['banExpiration'])) { $GLOBALS['result_command'] = $this->lang->words['Members']['Characters']['ManageCharacter']['BanCharacter']['Messages']['FieldsVoid']; $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 1); } else { $date = explode("/", $_POST['banExpiration']); if (count($date) != 3 || (strlen($date[0]) != 2 || strlen($date[1]) != 2 || strlen($date[2]) != 4)) { $GLOBALS['result_command'] = $this->lang->words['Members']['Characters']['ManageCharacter']['BanCharacter']['Messages']['DateInvalid']; $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 2); } elseif ($char_data['CtlCode'] == 1) { $GLOBALS['result_command'] = $this->lang->words['Members']['Characters']['ManageCharacter']['BanCharacter']['Messages']['CharacterBanned']; $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 2); } else { $insert_columns = array("Responsible" => USER_ACCOUNT, "Account" => $char_data['AccountID'], "Character" => $_GET['charname'], "Expiration" => $expiration = mktime(23, 59, 59, $date[0], $date[1], $date[2]), "Reason" => htmlEncode($_POST['banReason'])); $this->DB->Arguments($_GET['charname']); $this->DB->Delete("CTM_CharactersBanneds", "Character = '%s'"); $this->DB->Arguments($_GET['charname']); $this->DB->Update(MUGEN_CORE . "@Character", array("CtlCode" => 1), "Name = '%s'"); $this->DB->Insert("CTM_CharactersBanneds", $insert_columns); $GLOBALS['result_command'] = $this->lang->words['Members']['Characters']['ManageCharacter']['BanCharacter']['Messages']['Success']; $GLOBALS['result_command'] = adminShowMessage(sprintf($GLOBALS['result_command'], date("d/m/Y", $expiration)), 3); } } if (loadIsAjax() == true) { exit($GLOBALS['result_command']); } } $this->output->setContent("characters_banCharacter"); } break; case "unban": if ($this->CheckPermissionItem("characters_manageCharacter_unban") == true) { if ($_GET['write'] == true) { if ($char_data['CtlCode'] != 1) { $GLOBALS['result_command'] = $this->lang->words['Members']['Characters']['ManageCharacter']['UnbanCharacter']['Messages']['NoBanned']; $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 2); } else { $this->DB->Arguments($_GET['charname']); $this->DB->Delete("CTM_CharactersBanneds", "Account = '%s'"); $this->DB->Arguments($_GET['charname']); $this->DB->Update(MUGEN_CORE . "@Character", array("CtlCode" => 0), "Name = '%s'"); if (loadIsAjax() == false) { $_GET['write'] = FALSE; $GLOBALS['result_command'] = $this->lang->words['Members']['Characters']['ManageCharacter']['UnbanCharacter']['Messages']['Success']; $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 3); if ($_GET['go'] == "banneds") { $this->loadBannedCharacters(); $this->output->setContent("accounts_bannedCharacters"); } else { $this->loadSearchCharacters(); $this->output->setContent("characters_search"); } return NULL; } } if (loadIsAjax() == true) { exit($GLOBALS['result_command']); } } if ($char_data['CtlCode'] == 1) { $this->DB->Arguments($_GET['charname']); $characterBlockInfoQ = $this->DB->Select("Responsible,Expiration,Reason", "CTM_CharactersBanneds", "Character = '%s'"); if ($this->DB->CountRows($characterBlockInfoQ) > 0) { $characterBlockInfo = $this->DB->FetchObject($characterBlockInfoQ); $GLOBALS['block_info']['responsible'] = $characterBlockInfo->Responsible; $GLOBALS['block_info']['expiration'] = date("d/m/Y - H:i", $characterBlockInfo->Expiration); $GLOBALS['block_info']['reason'] = $characterBlockInfo->Reason; } else { $GLOBALS['block_info']['responsible'] = $this->lang->words['Words']['None']; $GLOBALS['block_info']['expiration'] = $this->lang->words['Words']['Never']; $GLOBALS['block_info']['reason'] = $this->lang->words['Words']['None']; } } $this->output->setContent("characters_unbanCharacter"); } break; default: if ($this->CheckPermissionItem("characters_manageCharacter_edit") == true) { if ($_GET['write'] == "name" && loadIsAjax() == true) { if (empty($_POST['NewName'])) { exit(adminShowMessage($this->lang->words['Members']['Characters']['ManageCharacter']['EditCharacter']['ChangeName']['Messages']['NameVoid'], 1)); } elseif (strlen($_POST['NewName']) > 10) { exit(adminShowMessage($this->lang->words['Members']['Characters']['ManageCharacter']['EditCharacter']['ChangeName']['Messages']['MaxLength'], 2)); } elseif (eregi("[^a-zA-Z0-9_!=?&-]", $_POST['NewName'])) { exit(adminShowMessage($this->lang->words['Members']['Characters']['ManageCharacter']['EditCharacter']['ChangeName']['Messages']['CaractersInvalid'], 2)); } else { $rename = $this->MuLib('Member')->RenameCharacter($_GET['charname'], $char_data['AccountID'], $_POST['NewName']); if ($rename == "NAME_IN_USE") { exit(adminShowMessage($this->lang->words['Members']['Characters']['ManageCharacter']['EditCharacter']['ChangeName']['Messages']['NameInUse'], 2)); } elseif ($rename == "ALL_OK") { exit("<script>editCharacter_writeSuccess('name', '" . str_replace("'", "\\'", $_POST['NewName']) . "');</script>"); } else { exit(adminShowMessage(sprintf($this->lang->words['Members']['Characters']['ManageCharacter']['EditCharacter']['ChangeName']['Messages']['Error'], 12), 2)); } } } elseif ($_GET['write'] == "account" && loadIsAjax() == true) { if (empty($_POST['NewAccount'])) { exit(adminShowMessage($this->lang->words['Members']['Characters']['ManageCharacter']['EditCharacter']['ChangeAccount']['Messages']['AccountVoid'], 1)); } elseif (strlen($_POST['NewAccount']) > 10) { exit(adminShowMessage($this->lang->words['Members']['Characters']['ManageCharacter']['EditCharacter']['ChangeAccount']['Messages']['MaxLength'], 2)); } else { $change_command = $this->MuLib('Member')->ChangeCharacterAccount($_GET['charname'], $char_data['AccountID'], $_POST['NewAccount']); if ($change_command == "ACCOUNT_NO_EXISTS") { exit(adminShowMessage($this->lang->words['Members']['Characters']['ManageCharacter']['EditCharacter']['ChangeAccount']['Messages']['AccountNoExists'], 2)); } elseif ($change_command == "ID_ERROR") { exit(adminShowMessage($this->lang->words['Members']['Characters']['ManageCharacter']['EditCharacter']['ChangeAccount']['Messages']['NoSlot'], 2)); } else { exit("<script>editCharacter_writeSuccess('account', '" . str_replace("'", "\\'", $_POST['NewAccount']) . "');</script>"); } } } elseif ($_GET['write'] == "save") { if (strlen($_POST['C_Level']) < 1 || strlen($_POST['C_LevelUpPoint']) < 1 || strlen($_POST['C_Class']) < 1 || strlen($_POST['C_Experience']) < 1 || strlen($_POST['C_Money']) < 1 || strlen($_POST['C_MapNumber']) < 1 || strlen($_POST['C_MapPosX']) < 1 || strlen($_POST['C_MapPosY']) < 1 || strlen($_POST['C_PkCount']) < 1 || strlen($_POST['C_PkLevel']) < 1 || strlen($_POST['C_PkTime']) < 1 || strlen($_POST['C_CtlCode']) < 1 || strlen($_POST['C_HeroCount']) < 1 || strlen($_POST['C_Resets']) < 1 || strlen($_POST['C_RDaily']) < 1 || strlen($_POST['C_RWeekly']) < 1 || strlen($_POST['C_RMonthly']) < 1 || strlen($_POST['C_MResets']) < 1 || strlen($_POST['C_MRDaily']) < 1 || strlen($_POST['C_MRWeekly']) < 1 || strlen($_POST['C_MRMonthly']) < 1 || strlen($_POST['C_Strength']) < 1 || strlen($_POST['C_Dexterity']) < 1 || strlen($_POST['C_Vitality']) < 1 || strlen($_POST['C_Energy']) < 1 || strlen($_POST['C_Command']) < 1 && MUSERVER_VERSION >= 1) { $GLOBALS['result_command'] = $this->lang->words['Members']['Characters']['ManageCharacter']['EditCharacter']['Save']['Messages']['FieldsVoid']; $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 1); } elseif ($_POST['C_Level'] < 1 || $_POST['C_Level'] > MAX_LEVEL) { $GLOBALS['result_command'] = $this->lang->words['Members']['Characters']['ManageCharacter']['EditCharacter']['Save']['Messages']['InvalidLevel']; $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 2); } elseif ($_POST['C_Strength'] > MAX_STRENGTH) { $GLOBALS['result_command'] = $this->lang->words['Members']['Characters']['ManageCharacter']['EditCharacter']['Save']['Messages']['MaxStrength']; $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 2); } elseif ($_POST['C_Dexterity'] > MAX_DEXTERITY) { $GLOBALS['result_command'] = $this->lang->words['Members']['Characters']['ManageCharacter']['EditCharacter']['Save']['Messages']['MaxDexterity']; $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 2); } elseif ($_POST['C_Vitality'] > MAX_VITALITY) { $GLOBALS['result_command'] = $this->lang->words['Members']['Characters']['ManageCharacter']['EditCharacter']['Save']['Messages']['MaxVitality']; $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 2); } elseif ($_POST['C_Energy'] > MAX_ENERGY) { $GLOBALS['result_command'] = $this->lang->words['Members']['Characters']['ManageCharacter']['EditCharacter']['Save']['Messages']['MaxEnergy']; $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 2); } elseif ($_POST['C_Command'] > MAX_COMMAND && MUSERVER_VERSION >= 1) { $GLOBALS['result_command'] = $this->lang->words['Members']['Characters']['ManageCharacter']['EditCharacter']['Save']['Messages']['MaxCommand']; $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 2); } elseif ($_POST['C_PkLevel'] < 0 || $_POST['C_PkLevel'] > 7) { $GLOBALS['result_command'] = $this->lang->words['Members']['Characters']['ManageCharacter']['EditCharacter']['Save']['Messages']['InvalidPkLevel']; $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 2); } elseif (!in_array($_POST['C_CtlCode'], array(0, 1, CTLCODE_GAMEMASTER))) { $GLOBALS['result_command'] = $this->lang->words['Members']['Characters']['ManageCharacter']['EditCharacter']['Save']['Messages']['InvalidCtlCode']; $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 2); } else { $class_index = substr($_POST['C_Class'], 0, 1); $class_id = substr($_POST['C_Class'], 2); $class_number = $this->settings['CLASSCODE'][$class_id][0]; if (!array_key_exists($class_id, $this->settings['CLASSCODE'])) { $GLOBALS['result_command'] = $this->lang->words['Members']['Characters']['ManageCharacter']['EditCharacter']['Save']['Messages']['InvalidClass']; $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 2); } else { $update_columns = array("cLevel" => intval($_POST['C_Level']), "LevelUpPoint" => intval($_POST['C_LevelUpPoint']), "Experience" => intval($_POST['C_Experience']), "Strength" => intval($_POST['C_Strength']), "Dexterity" => intval($_POST['C_Dexterity']), "Vitality" => intval($_POST['C_Vitality']), "Energy" => intval($_POST['C_Energy']), "Money" => intval($_POST['C_Money']), "MapNumber" => intval($_POST['C_MapNumber']), "MapPosX" => intval($_POST['C_MapPosX']), "MapPosY" => intval($_POST['C_MapPosY']), "PkLevel" => intval($_POST['C_PkLevel']), "PkTime" => intval($_POST['C_PkTime']), "CtlCode" => intval($_POST['C_CtlCode']), COLUMN_RESET => intval($_POST['C_Resets']), COLUMN_RDAILY => intval($_POST['C_RDaily']), COLUMN_RWEEKLY => intval($_POST['C_RWeekly']), COLUMN_RMONTHLY => intval($_POST['C_RMonthly']), COLUMN_MRESET => intval($_POST['C_MResets']), COLUMN_MRDAILY => intval($_POST['C_MRDaily']), COLUMN_MRWEEKLY => intval($_POST['C_MRWeekly']), COLUMN_MRMONTHLY => intval($_POST['C_MRMonthly']), COLUMN_PKCOUNT => intval($_POST['C_PkCount']), COLUMN_HEROCOUNT => intval($_POST['C_HeroCount'])); if (MUSERVER_VERSION >= 1) { $update_columns[COLUMN_COMMAND] = intval($_POST['C_Command']); } if ($class_number != $char_data['Class']) { $this->MuLib('Quest')->OpenQuest($_GET['charname']); $this->MuLib('Quest')->GetAllQuestStatus($quests); $this->MuLib('Quest')->GetQuestDatabase(-1, $quest_db); switch ($class_index) { case 2: if ($class_id != "LE" && $class_id != "DM" && $class_id != "FM") { $this->MuLib('Quest')->SetQuestStatus(0, 2); $this->MuLib('Quest')->SetQuestStatus(1, 2); if (MUSERVER_VERSION >= 4) { $this->MuLib('Quest')->SetQuestStatus(4, 3); $this->MuLib('Quest')->SetQuestStatus(5, 3); $this->MuLib('Quest')->SetQuestStatus(6, 3); $this->MuLib('Quest')->SetQuestStatus(7, 3); } } break; case 3: if ($class_id != "LE" && $class_id != "DM" && $class_id != "FM") { $this->MuLib('Quest')->SetQuestStatus(0, 2); $this->MuLib('Quest')->SetQuestStatus(1, 2); //$this->MuLib('Quest')->SetQuestStatus(2, 2); } $this->MuLib('Quest')->SetQuestStatus(4, 2); $this->MuLib('Quest')->SetQuestStatus(5, 2); $this->MuLib('Quest')->SetQuestStatus(6, 2); $this->MuLib('Quest')->SetQuestStatus(7, 2); break; default: $this->MuLib('Quest')->SetAllQuestStatus(3); break; } $update_columns['Class'] = $this->settings['CLASSCODE'][$class_id][0]; $update_columns['Quest'] = "0x" . $this->MuLib('Quest')->CloseQuest(false); } $this->MuLib('Member')->UpdateCharacter($_GET['charname'], $update_columns); $GLOBALS['result_command'] = $this->lang->words['Members']['Characters']['ManageCharacter']['EditCharacter']['Save']['Messages']['Success']; $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 3); } } } elseif ($_GET['write'] == "delete") { $this->MuLib('Member')->DeleteCharacter($_GET['charname'], $char_data['AccountID'], false); $this->loadSearchCharacters(true, adminShowMessage($this->lang->words['Members']['Characters']['ManageCharacter']['EditCharacter']['DeleteCharacter']['Success'], 3)); $this->output->setContent("characters_search"); return NULL; } $this->DB->Arguments($char_data['AccountID']); $this->DB->Query("SELECT * FROM " . MUACC_CORE . ".dbo.MEMB_STAT WHERE memb___id = '%s'", $stat_query); if ($this->DB->CountRows($stat_query) > 0) { $stat_fetch = $this->DB->FetchObject($stat_query); $stat_array = array("server" => $this->functions->GetServerName($stat_fetch->ServerName), "ip" => $stat_fetch->IP, "date" => date("d/m/Y - h:i a", strtotime($stat_fetch->ConnectTM))); } else { $stat_array = array("server" => $this->lang->words['Words']['None'], "ip" => $this->lang->words['Words']['None'], "date" => $this->lang->words['Words']['Never']); } $class[0] = array(); $class[1] = array(); $clsss[2] = array(); $class[0]['DW'] = $this->settings['CLASSCODE']['DW'][1]; $class[0]['DK'] = $this->settings['CLASSCODE']['DK'][1]; $class[0]['FE'] = $this->settings['CLASSCODE']['FE'][1]; if (MUSERVER_VERSION >= 5) { $class[0]['SU'] = $this->settings['CLASSCODE']['SU'][1]; } $class[1]['SM'] = $this->settings['CLASSCODE']['SM'][1]; $class[1]['BK'] = $this->settings['CLASSCODE']['BK'][1]; $class[1]['ME'] = $this->settings['CLASSCODE']['ME'][1]; if (MUSERVER_VERSION >= 5) { $class[1]['BS'] = $this->settings['CLASSCODE']['BS'][1]; } $class[1]['MG'] = $this->settings['CLASSCODE']['MG'][1]; if (MUSERVER_VERSION >= 1) { $class[1]['DL'] = $this->settings['CLASSCODE']['DL'][1]; } if (MUSERVER_VERSION >= 4) { $class[2]['GM'] = $this->settings['CLASSCODE']['GM'][1]; $class[2]['BM'] = $this->settings['CLASSCODE']['BM'][1]; $class[2]['HE'] = $this->settings['CLASSCODE']['HE'][1]; if (MUSERVER_VERSION >= 5) { $class[2]['DIM'] = $this->settings['CLASSCODE']['DIM'][1]; } $class[2]['DM'] = $this->settings['CLASSCODE']['DM'][1]; $class[2]['LE'] = $this->settings['CLASSCODE']['LE'][1]; } if (MUSERVER_VERSION == 8) { $class[1]['RF'] = $this->settings['CLASSCODE']['RF'][1]; $class[2]['FM'] = $this->settings['CLASSCODE']['FM'][1]; } $GLOBALS['class_info'] = array(0 => $class[0], 1 => $class[1], 2 => $class[2]); $GLOBALS['character_info'] = array("info" => array("photo" => $this->functions->GetCharImage($char_data[COLUMN_CHARIMAGE])), "data" => array("name" => $_GET['charname'], "account" => $char_data['AccountID'], "class" => $char_data['Class'], "level" => $char_data['cLevel'], "experience" => $char_data['Experience'], "points" => $char_data['LevelUpPoint'], "money" => $char_data['Money'], "strength" => $char_data['Strength'], "dexterity" => $char_data['Dexterity'], "vitality" => $char_data['Vitality'], "energy" => $char_data['Energy'], "command" => $char_data[COLUMN_COMMAND] ? $char_data[COLUMN_COMMAND] : 0, "ctlcode" => $char_data['CtlCode'], "map_number" => $char_data['MapNumber'], "map_pos_x" => $char_data['MapPosX'], "map_pos_y" => $char_data['MapPosY'], "pk_level" => $char_data['PkLevel'], "pk_time" => $char_data['PkTime'], "pk_count" => $char_data[COLUMN_PKCOUNT], "hero_count" => $char_data[COLUMN_HEROCOUNT], "resets_general" => $char_data[COLUMN_RESET], "resets_daily" => $char_data[COLUMN_RDAILY], "resets_weekly" => $char_data[COLUMN_RWEEKLY], "resets_monthly" => $char_data[COLUMN_RMONTHLY], "mresets_general" => $char_data[COLUMN_MRESET], "mresets_daily" => $char_data[COLUMN_MRDAILY], "mresets_weekly" => $char_data[COLUMN_MRWEEKLY], "mresets_monthly" => $char_data[COLUMN_MRMONTHLY]), "stat" => $stat_array); $this->output->setContent("characters_editCharacter"); } break; } } }
/** * 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§ion=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§ion=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§ion=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); } } }
/** * Characters: Unban Character * * @return string HTML String */ public function characters_unbanCharacter() { global $result_command, $block_info; $charname = urldecode($_GET['charname']); $_charname = $_GET['charname']; if (!empty($_GET['go'])) { $go = "&go=" . $_GET['go']; } $CTM_HTML = <<<HTML \t\t\t<script type="text/javascript"> \t\t\t\$(function() \t\t\t{ \t\t\t\t\$("#unBanNow").click(function() \t\t\t\t{ \t\t\t\t\tSexy.confirm("{$this->lang->words['Members']['Characters']['ManageCharacter']['UnbanCharacter']['Messages']['Confirm']}", { "onComplete" : function(commandResult) \t\t\t\t\t{ \t\t\t\t\t\tif(commandResult) \t\t\t\t\t\t{ HTML; if (loadIsAjax() == true) { $CTM_HTML .= <<<HTML \t\t\t\t\t\t\t\$.fancybox( \t\t\t\t\t\t\t{ \t\t\t\t\t\t\t\tajax : \t\t\t\t\t\t\t\t{ \t\t\t\t\t\t\t\t\ttype : "POST", \t\t\t\t\t\t\t\t\tdata : \$("#unBanCharacter").serializeArray() \t\t\t\t\t\t\t\t}, \t\t\t\t\t\t\t\thref : "{$this->vars['acp_url']}?app=core&module=members§ion=characters&index=manageCharacter&charname={$_charname}&do=unban&write=true&ajaxLoadSet=true" \t\t\t\t\t\t\t}); HTML; } else { $CTM_HTML .= <<<HTML \t\t\t\t\t\t\t\$("#unBanCharacter").submit(); HTML; } $CTM_HTML .= <<<HTML \t\t\t\t\t\t} \t\t\t\t\t}}); \t\t\t\t}); \t\t\t}); \t\t\t</script> HTML; if (loadIsAjax() == true) { $CTM_HTML .= <<<HTML <div style="width:600px"> HTML; } $CTM_HTML .= <<<HTML \t\t\t<article> \t\t\t\t<h1>{$this->lang->words['Members']['Characters']['ManageCharacter']['UnbanCharacter']['Title']} :: {$charname}</h1> HTML; if (count($block_info) > 0) { $CTM_HTML .= <<<HTML <form name="unBanCharacter" id="unBanCharacter" action="{$this->vars['acp_url']}?app=core&module=members&section=characters&index=manageCharacter&charname={$_charname}&do=unban&write=true{$go}" method="post" class="uniform"> <table id="table1" class="gtable"> \t\t\t\t\t\t<tbody> \t\t\t\t\t\t\t<tr> \t\t\t\t\t\t\t\t<td>{$this->lang->words['Members']['Characters']['ManageCharacter']['UnbanCharacter']['Reason']}</td> \t\t\t\t\t\t\t\t<td>{$block_info['reason']}</td> \t\t\t\t\t\t\t</tr> <tr> \t\t\t\t\t\t\t\t<td>{$this->lang->words['Members']['Characters']['ManageCharacter']['UnbanCharacter']['Expiration']}</td> \t\t\t\t\t\t\t\t<td>{$block_info['expiration']}</td> \t\t\t\t\t\t\t</tr> <tr> \t\t\t\t\t\t\t\t<td>{$this->lang->words['Members']['Characters']['ManageCharacter']['UnbanCharacter']['Responsible']}</td> \t\t\t\t\t\t\t\t<td>{$block_info['responsible']}</td> \t\t\t\t\t\t\t</tr> \t\t\t\t\t\t</tbody> \t\t\t\t\t</table> \t\t\t\t\t<p> \t\t\t\t\t\t<button type="button" name="unBanNow" id="unBanNow" class="button">{$this->lang->words['Members']['Characters']['ManageCharacter']['UnbanCharacter']['Button']}</button> \t\t\t\t\t</p> \t\t\t\t</form> HTML; } else { $CTM_HTML .= <<<HTML <div class="error msg">{$this->lang->words['Members']['Characters']['ManageCharacter']['UnbanCharacter']['Messages']['NoBanned']}</div> HTML; } $CTM_HTML .= <<<HTML \t\t\t</article> HTML; if (loadIsAjax() == true) { $CTM_HTML .= <<<HTML </div> HTML; } return $CTM_HTML; }
/** * Logout Module * * @return void */ public static function LogoutModule($onlyDestroy = FALSE) { if (loadIsAjax() == true) { $location = CTM_URLEngine::URLBase() . "?app=core&module=global§ion=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); } }
/** * Module Unavailable * * @return string HTML String */ public function module_unavailable() { $CTM_HTML = NULL; if (loadIsAjax()) { $CTM_HTML .= <<<HTML <div style="width:600px"> HTML; } $CTM_HTML .= <<<HTML <article> \t\t\t\t<h1>{$this->lang->words['ModuleUnavailable']['Title']}</h1> \t<div class="error msg">{$this->lang->words['ModuleUnavailable']['Message']}</div> \t\t\t</article> HTML; if (loadIsAjax()) { $CTM_HTML .= <<<HTML </div> HTML; } return $CTM_HTML; }
/** * Private: User Panel Global Modules * * @return void */ private function GlobalModules() { if (loadIsAjax() == true && $this->notLoadGeneral == true) { exit($this->output->returnContent(false, "userpanelContent")); } if ($this->notLoadGeneral == false) { $GLOBALS['userpanel']['content'] = $this->output->returnContent(false, "userpanelContent"); require_once THIS_APPLICATION_PATH . "sources/variables/userpanel_options.php"; foreach ($userpanel_options as $key => $options) { foreach ($options as $name => $value) { if ($value['privilegy'] == true) { $GLOBALS['userpanel']['permissions'][$name] = array(0 => $this->settings['USERPANEL']['PERMISSION'][$key][$name][1] == true ? 1 : 0, 1 => $this->settings['USERPANEL']['PERMISSION'][$key][$name][2] == true ? 1 : 0, 2 => $this->settings['USERPANEL']['PERMISSION'][$key][$name][3] == true ? 1 : 0, 3 => $this->settings['USERPANEL']['PERMISSION'][$key][$name][4] == true ? 1 : 0, 4 => $this->settings['USERPANEL']['PERMISSION'][$key][$name][5] == true ? 1 : 0, 5 => $this->settings['USERPANEL']['PERMISSION'][$key][$name][6] == true ? 1 : 0); } } } } }
/** * Set Result * Set template result * * @param string Text * @return void */ function setResult($string) { if (loadIsAjax()) { exit($string); } else { $GLOBALS['write_result'] = $string; } }
/** * Server Informations * * @return void */ private function loadServerInformations() { if (loadIsAjax() == true) { $CTM_EWGeneral = new CTM_EWGeneral(); $CTM_EWGeneral->registry(); $CTM_EWGeneral->loadHeaderQuerys(); } $yes = "<font color=\"red\">" . $this->lang->words['Words']['Yes'] . "</font>"; $no = "<font color=\"green\">" . $this->lang->words['Words']['No'] . "</font>"; $MResetCoin = constant("COIN_NAME_" . $this->settings['USERPANEL']['CHARACTER']['MASTER_RESET'][0xff]['COIN_NUMBER']); $this->lang->setArguments("Infos,ResetTable,Title", $this->functions->GetResetInfo("TYPE", TRUE)); $this->lang->setArguments("Infos,MResetTable,CoinAward", $MResetCoin); switch (SERVER_STATUS) { case 1: $fp = fsockopen(GAMESERVER_HOST, GAMESERVER_PORT, $error, $msg, 1); $status = $fp ? "<font color=\"green\">Online</span>" : "<font color=\"red\">Offline</font>"; break; case 2: $status = "<font color=\"red\">" . $this->lang->words['Infos']['Maintenance'] . "</font>"; break; } if ($this->settings['USERPANEL']['CHARACTER']['RESET_SYSTEM'][0xff]['MODE'] < 4) { $MODE = self::instance()->functions->GetResetInfo(0, "MODE"); for ($i = 0; $i < VIP_NUMBER + 1; $i++) { $resetTable['level_reset'][$i] = $this->settings['USERPANEL']['CHARACTER']['RESET_SYSTEM'][0xff]['LEVEL_RESET'][$i]; $resetTable['money_require'][$i] = $this->settings['USERPANEL']['CHARACTER']['RESET_SYSTEM'][0xff]['MONEY_REQUIRE'][$i]; $resetTable['level_after'][$i] = $this->settings['USERPANEL']['CHARACTER']['RESET_SYSTEM'][0xff]['LEVEL_AFTER'][$i]; $resetTable['clear_invent'][$i] = $this->settings['USERPANEL']['CHARACTER']['RESET_SYSTEM'][0xff]['CLEAR_INVENT'][$i] == true ? $yes : $no; $resetTable['clear_skill'][$i] = $this->settings['USERPANEL']['CHARACTER']['RESET_SYSTEM'][0xff]['CLEAR_SKILL'][$i] == true ? $yes : $no; $resetTable['clear_quest'][$i] = $this->settings['USERPANEL']['CHARACTER']['RESET_SYSTEM'][0xff]['CLEAR_QUEST'][$i] == true ? $yes : $no; if ($MODE == 0xc1 || $MODE == 0xc2) { $resetTable['set_points'][$i] = $this->settings['USERPANEL']['CHARACTER']['RESET_SYSTEM'][$MODE]['SET_POINTS'][$i]; } } } else { $serialize_file = CTM_FileManage::Lib('ReadScript')->CheckSerializeFile("Web_ResetTable.serialize.dat") == false; $structure_file = CTM_FileManage::Lib('ReadScript')->StructureFile(CTM_CONTROL_PATH . "Data/ResetTable.txt", "Web_ResetTable.serialize.dat", FALSE); $serialize_data = CTM_FileManage::Lib('ReadScript')->ReadScript(); foreach ($serialize_data as $key => $value) { for ($i = 0; $i < VIP_NUMBER + 1; $i++) { $resetTable[$key]['level_reset'][$i] = $value[0][$i]; $resetTable[$key]['money_require'][$i] = $value[1][$i]; $resetTable[$key]['level_after'][$i] = $value[2][$i]; $resetTable[$key]['clear_invent'][$i] = $value[3][$i] == 1 ? $yes : $no; $resetTable[$key]['clear_skill'][$i] = $value[4][$i] == 1 ? $yes : $no; $resetTable[$key]['clear_quest'][$i] = $value[5][$i] == 1 ? $yes : $no; $resetTable[$key]['set_points'][$i] = $value[6][$i]; } } unset($tData); } switch ($this->settings['USERPANEL']['CHARACTER']['MASTER_RESET'][0xff]['MODE']) { case 1: $MRMODE = 0xc0; break; case 2: $MRMODE = 0xc1; break; } for ($i = 0; $i < VIP_NUMBER + 1; $i++) { $mresetTable['level_reset'][$i] = $this->settings['USERPANEL']['CHARACTER']['MASTER_RESET'][0xff]['LEVEL_RESET'][$i]; $mresetTable['money_require'][$i] = $this->settings['USERPANEL']['CHARACTER']['MASTER_RESET'][0xff]['MONEY_REQUIRE'][$i]; $mresetTable['reset_points'][$i] = $this->settings['USERPANEL']['CHARACTER']['MASTER_RESET'][0xff]['RESET_POINTS'][$i] == true ? $yes : $no; $mresetTable['clear_invent'][$i] = $this->settings['USERPANEL']['CHARACTER']['MASTER_RESET'][0xff]['CLEAR_INVENT'][$i] == true ? $yes : $no; $mresetTable['clear_skill'][$i] = $this->settings['USERPANEL']['CHARACTER']['MASTER_RESET'][0xff]['CLEAR_SKILL'][$i] == true ? $yes : $no; $mresetTable['clear_quest'][$i] = $this->settings['USERPANEL']['CHARACTER']['MASTER_RESET'][0xff]['CLEAR_QUEST'][$i] == true ? $yes : $no; $mresetTable['coin_award'][$i] = $this->settings['USERPANEL']['CHARACTER']['MASTER_RESET'][0xff]['COIN_AWARD'][$i]; if ($this->settings['USERPANEL']['CHARACTER']['MASTER_RESET'][0xff]['MODE'] < 3) { $mresetTable['resets_require'][$i] = $this->settings['USERPANEL']['CHARACTER']['MASTER_RESET'][$MRMODE]['RESETS_REQUIRE'][$i]; if ($MRMODE == 192) { $mresetTable['resets_remove'][$i] = $this->settings['USERPANEL']['CHARACTER']['MASTER_RESET'][$MRMODE]['RESETS_REMOVE'][$i]; } } } $mresetTable['strength_require'] = $this->settings['USERPANEL']['CHARACTER']['MASTER_RESET'][0xff]['STATS_REQUIRE'][0]; $mresetTable['dexterity_require'] = $this->settings['USERPANEL']['CHARACTER']['MASTER_RESET'][0xff]['STATS_REQUIRE'][1]; $mresetTable['vitality_require'] = $this->settings['USERPANEL']['CHARACTER']['MASTER_RESET'][0xff]['STATS_REQUIRE'][2]; $mresetTable['energy_require'] = $this->settings['USERPANEL']['CHARACTER']['MASTER_RESET'][0xff]['STATS_REQUIRE'][3]; $mresetTable['command_require'] = $this->settings['USERPANEL']['CHARACTER']['MASTER_RESET'][0xff]['STATS_REQUIRE'][4]; $queryCharsPk = self::DB()->Query("SELECT count(Name) FROM " . MUGEN_CORE . ".dbo.Character WHERE PkLevel > 3"); $queryCharsHero = self::DB()->Query("SELECT count(Name) FROM " . MUGEN_CORE . ".dbo.Character WHERE PkLevel < 3"); //$queryOnlines = self::DB()->Query("SELECT count(memb___id) FROM ".MUACC_CORE.".dbo.MEMB_STAT WHERE ConnectStat > 0"); $countCharsPk = self::DB()->FetchRow($queryCharsPk); $countCharsHero = self::DB()->FetchRow($queryCharsHero); //$countOnlines = self::DB()->FetchRow($queryOnlines); $GLOBALS['informations'] = array("count" => array("chars_pk" => number_format($countCharsPk[0], 0, false, "."), "chars_hero" => number_format($countCharsHero[0], 0, false, ".")), "status" => $status, "resetTable" => $resetTable, "masterResetTable" => $mresetTable); }
/** * 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&module=global&section=login&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); } } } } } }
/** * Option: Change Name * Change the name from character * * @return void */ public function ChangeName() { if ($_GET['write'] == true) { if (empty($_POST['NewName'])) { setResult(showMessage($this->lang->words['UserPanel']['ChangeName']['Messages']['FieldVoid'], 1)); } elseif (empty($_POST['Captcha'])) { setResult(showMessage($this->lang->words['Global']['Captcha']['Messages']['Void'], 1)); } elseif (!CTM_Captcha::Check($_POST['Captcha'])) { setResult(showMessage($this->lang->words['Global']['Captcha']['Messages']['Invalid'], 2)); } elseif (strlen($_POST['NewName']) < 4) { setResult(showMessage($this->lang->words['UserPanel']['ChangeName']['Messages']['ErrorLength'], 2)); } elseif (eregi("[^a-zA-Z0-9_!=?&-]", $_POST['NewName'])) { setResult(showMessage($this->lang->words['UserPanel']['ChangeName']['Messages']['ErrorWords'], 2)); } else { $bad_syntax = FALSE; foreach ($this->settings['USERPANEL']['CHARACTER']['CHANGE_NAME']['BAD_SYNTAX'] as $badSyntax) { if (stristr($_POST['NewName'], $badSyntax)) { $bad_syntax = TRUE; break; } } if ($bad_syntax == true) { setResult(showMessage($this->lang->words['UserPanel']['ChangeName']['Messages']['ErrorSyntax'], 2)); } else { $this->DB->Arguments($this->character); $this->DB->Query("SELECT Name FROM " . MUGEN_CORE . ".dbo.GuildMember WHERE Name = '%s'", $find_guild); if ($this->DB->CountRows($find_guild) > 0) { setResult(showMessage($this->lang->words['UserPanel']['ChangeName']['Messages']['ErrorGuild'], 2)); } else { $change_name_result = $this->MuLib('Member')->RenameCharacter($this->character, USER_ACCOUNT, $_POST['NewName']); switch ($change_name_result) { case "NAME_IN_USE": setResult(showMessage($this->lang->words['UserPanel']['ChangeName']['Messages']['ErrorName'], 2)); break; case "ALL_OK": $temp_name = $this->character; $this->character = $_POST['NewName']; $_SESSION['USERCP_CHARACTER_SELECTED'] = $_POST['NewName']; $GLOBALS['userpanel']['character'] = $_POST['NewName']; CTM_Captcha::gerateCaptchaText(); $this->WriteLog(array("option" => "Change Name", "character" => true, "data" => array("[Before] Name: " . $temp_name, "[After] Name: " . $this->character))); $string = showMessage(sprintf($this->lang->words['UserPanel']['ChangeName']['Messages']['Success'], $_POST['NewName']), 3); if (loadIsAjax() == true) { $string .= "\n<script>\$('#cpCharSelected').val('" . $_POST['NewName'] . "');\n"; $string .= "\$('#currentCharName').val('" . $_POST['NewName'] . "');</script>"; } setResult($string); break; case "ID_ERROR": $this->WriteLog(array("option" => "Change Name", "character" => true, "data" => array("Error #" . CoreVariables::ErrorsCode()->CharGameIDFail))); setResult(showMessage(sprintf($this->lang->words['UserPanel']['ChangeName']['Messages']['GeneralError'], CoreVariables::ErrorsCode()->CharGameIDFail), 2)); break; } } } } } }
/** * Private: Manage Account * Manage a account from database * * @return void */ private function loadManageAccount() { if ($this->loadCheckAccount($_GET['username'], "login")) { $user_data = $this->MuLib('Member')->Load($_GET['username'] = urldecode($_GET['username'])); switch ($_GET['do']) { case "ban": if ($this->CheckPermissionItem("accounts_manageAccount_ban") == true) { if ($_GET['write'] == true) { if (empty($_POST['banReason']) || empty($_POST['banExpiration'])) { $GLOBALS['result_command'] = $this->lang->words['Members']['Accounts']['ManageAccount']['BanAccount']['Messages']['FieldsVoid']; $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 1); } else { $date = explode("/", $_POST['banExpiration']); if (count($date) != 3 || (strlen($date[0]) != 2 || strlen($date[1]) != 2 || strlen($date[2]) != 4)) { $GLOBALS['result_command'] = $this->lang->words['Members']['Accounts']['ManageAccount']['BanAccount']['Messages']['DateInvalid']; $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 2); } elseif ($user_data['info']['bloc_code'] == 1 && $user_data['info']['MemberStatus'] == 0) { $GLOBALS['result_command'] = $this->lang->words['Members']['Accounts']['ManageAccount']['BanAccount']['Messages']['AccountBanned']; $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 2); } else { $insert_columns = array("Responsible" => USER_ACCOUNT, "Account" => $_GET['username'], "Expiration" => $expiration = mktime(23, 59, 59, $date[0], $date[1], $date[2]), "Reason" => htmlEncode($_POST['banReason'])); $this->DB->Arguments($_GET['username']); $this->DB->Delete("CTM_AccountsBanneds", "Account = '%s'"); $this->DB->Arguments($_GET['username']); $this->DB->Update(MUACC_CORE . "@MEMB_INFO", array("bloc_code" => 1), "memb___id = '%s'"); $this->DB->Insert("CTM_AccountsBanneds", $insert_columns); $GLOBALS['result_command'] = $this->lang->words['Members']['Accounts']['ManageAccount']['BanAccount']['Messages']['Success']; $GLOBALS['result_command'] = adminShowMessage(sprintf($GLOBALS['result_command'], date("d/m/Y", $expiration)), 3); } } if (loadIsAjax() == true) { exit($GLOBALS['result_command']); } } $this->output->setContent("accounts_banAccount"); } break; case "unban": if ($this->CheckPermissionItem("accounts_manageAccount_unban") == true) { if ($_GET['write'] == true) { if ($user_data['info']['bloc_code'] == 0) { $GLOBALS['result_command'] = $this->lang->words['Members']['Accounts']['ManageAccount']['UnbanAccount']['Messages']['NoBanned']; $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 2); } else { $this->DB->Arguments($_GET['username']); $this->DB->Delete("CTM_AccountsBanneds", "Account = '%s'"); $this->DB->Arguments($_GET['username']); $this->DB->Update(MUACC_CORE . "@MEMB_INFO", array("bloc_code" => 0), "memb___id = '%s'"); if (loadIsAjax() == false) { $_GET['write'] = FALSE; $GLOBALS['result_command'] = $this->lang->words['Members']['Accounts']['ManageAccount']['UnbanAccount']['Messages']['Success']; $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 3); if ($_GET['go'] == "banneds") { $this->loadBannedAccounts(); $this->output->setContent("accounts_bannedAccounts"); } else { $this->loadSearchAccounts(); $this->output->setContent("accounts_search"); } return NULL; } } if (loadIsAjax() == true) { exit($GLOBALS['result_command']); } } if ($user_data['info']['bloc_code'] == 1 && $user_data['info']['MemberStatus'] == 0) { $this->DB->Arguments($_GET['username']); $accountBlockInfoQ = $this->DB->Select("Responsible,Expiration,Reason", "CTM_AccountsBanneds", "Account = '%s'"); if ($this->DB->CountRows($accountBlockInfoQ) > 0) { $accountBlockInfo = $this->DB->FetchObject($accountBlockInfoQ); $GLOBALS['block_info']['responsible'] = $accountBlockInfo->Responsible; $GLOBALS['block_info']['expiration'] = date("d/m/Y - H:i", $accountBlockInfo->Expiration); $GLOBALS['block_info']['reason'] = $accountBlockInfo->Reason; } else { $GLOBALS['block_info']['responsible'] = $this->lang->words['Words']['None']; $GLOBALS['block_info']['expiration'] = $this->lang->words['Words']['Never']; $GLOBALS['block_info']['reason'] = $this->lang->words['Words']['None']; } } $this->output->setContent("accounts_unbanAccount"); } break; case "manageVIP": if ($this->CheckPermissionItem("accounts_manageAccount_manageVIP") == true) { if ($_GET['command'] == "write") { if ($_POST['VIPType'] != 1 && $_POST['VIPType'] != 2 && $_POST['VIPType'] != 3 && $_POST['VIPType'] != 4 && $_POST['VIPType'] != 5) { $GLOBALS['result_command'] = $this->lang->words['Members']['Accounts']['ManageAccount']['ManageVIP']['Messages']['VIPInvalid']; $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 3); } else { if (empty($_POST['VIPDays']) || $_POST['VIPDays'] < 0) { $_POST['VIPDays'] = 0; } $timeVIP = $user_data['vip'][VIP_TIME] + $_POST['VIPDays']; $beginVIP = strlen($user_data['vip'][VIP_BEGIN]) == 10 ? $user_data['vip'][VIP_BEGIN] : time(); $commandVIP = "Added"; if ($user_data['vip'][VIP_COLUMN] > 0) { if (strlen($user_data['vip'][VIP_TIME]) == 10) { $timeVIP = strtotime("+ " . $_POST['VIPDays'] . " days", $user_data['vip'][VIP_TIME]); } if ($_POST['VIPDays'] == 0) { $commandVIP = "Transformed"; } else { $commandVIP = "Added"; } } $this->DB->Arguments($_POST['VIPType'], $beginVIP, $timeVIP, $_GET['username']); $this->DB->Query("UPDATE " . VIP_CORE . ".dbo." . VIP_TABLE . " SET " . VIP_COLUMN . " = %d, " . VIP_BEGIN . " = %d, " . VIP_TIME . " = %d WHERE " . VIP_LOGIN . " = '%s'"); $_timeVIP = $timeVIP; $timeVIP = strlen($timeVIP) == 10 ? $timeVIP : strtotime("+ " . $timeVIP . " days"); $result_1 = $this->lang->words['Members']['Accounts']['ManageAccount']['ManageVIP']['Messages']['Success'][$commandVIP]; $result_1 = sprintf($result_1, $this->functions->AccountLevel($_POST['VIPType']), $_GET['username']); $result_2 = $this->lang->words['Members']['Accounts']['ManageAccount']['ManageVIP']['Messages']['Success']['Expiration']; $result_2 = sprintf($result_2, date("d/m/Y", $timeVIP), $_POST['VIPDays']); $GLOBALS['result_command'] = "<strong>" . $result_1 . "</strong><br />\n" . $result_2; $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 3); if (loadIsAjax() == false) { $user_data['vip'] = array(VIP_COLUMN => $_POST['VIPType'], VIP_BEGIN => $beginVIP, VIP_TIME => $_timeVIP); } } if (loadIsAjax() == true) { exit($GLOBALS['result_command']); } } elseif ($_GET['command'] == "remove") { self::DB()->Arguments($_GET['username']); self::DB()->Query("UPDATE " . VIP_CORE . ".dbo." . VIP_TABLE . " SET " . VIP_COLUMN . " = 0, " . VIP_BEGIN . " = 0, " . VIP_TIME . " = 0 WHERE " . VIP_LOGIN . " = '%s'"); $GLOBALS['result_command'] = $this->lang->words['Members']['Accounts']['ManageAccount']['ManageVIP']['Messages']['Success']['Removed']; $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 3); if (loadIsAjax() == true) { exit($GLOBALS['result_command']); } else { $user_data['vip'] = array(VIP_COLUMN => 0, VIP_BEGIN => 0, VIP_TIME => 0); } } /*$GLOBALS['vip_info'] = array ( "type" => $this->functions->AccountLevel($user_data['vip'][VIP_COLUMN]), "begin" => $this->functions->MakeVIPTime($user_data['vip'][VIP_BEGIN]), "end" => $this->functions->MakeVIPTime($user_data['vip'][VIP_TIME]) );*/ $this->output->setContent("accounts_manageVIP"); } break; case "manageCoin": if ($this->CheckPermissionItem("accounts_manageAccount_manageCoin") == true) { if ($_GET['command'] == "insert" || $_GET['command'] == "remove") { $_POST['Coin'] = intval($_POST['Coin']); $_POST['Quantity'] = intval($_POST['Quantity']); if (empty($_POST['Quantity'])) { $_POST['Quantity'] = 0; } if ($_POST['Coin'] != 1 && $_POST['Coin'] != 2 && $_POST['Coin'] != 3) { $GLOBALS['result_command'] = $this->lang->words['Members']['Accounts']['ManageAccount']['ManageCoin']['Messages']['CoinInvalid']; $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 2); } else { if ($_GET['command'] == "insert") { $coin_command = "Insert"; $coin_signal = "+"; } elseif ($_GET['command'] == "remove") { $coin_command = "Remove"; $coin_signal = "-"; } $coin_column = $_POST['Coin']; $coin_name = constant("COIN_NAME_" . $_POST['Coin']); if ($user_data['coin'][$coin_column] < $_POST['Quantity'] && $_GET['command'] == "remove") { $GLOBALS['result_command'] = $this->lang->words['Members']['Accounts']['ManageAccount']['ManageCoin']['Messages']['NoCoin']; $GLOBALS['result_command'] = adminShowMessage(sprintf($GLOBALS['result_command'], $coin_name), 2); } else { $this->DB->Arguments($_GET['username'], $coin_column, $_POST['Quantity'], intval(COIN_USE_CACHE)); $this->DB->Query("EXEC dbo.CTM_PlusAccountCoin '%s', %d, %d, %d"); $GLOBALS['result_command'] = $this->lang->words['Members']['Accounts']['ManageAccount']['ManageCoin']['Messages']['Success'][$coin_command]; $GLOBALS['result_command'] = adminShowMessage(sprintf($GLOBALS['result_command'], $_POST['Quantity'], $coin_name), 3); } } if (loadIsAjax() == true) { exit($GLOBALS['result_command']); } } $this->output->setContent("accounts_manageCoin"); } break; case "disconnect": if ($user_data['stat']['ConnectStat'] < 1) { $message = $this->lang->words['Members']['Accounts']['ManageAccount']['DisconnectAccount']['Messages']['UserOffline']; $type = 2; } elseif ($this->MuLib('JoinServer')->ForceLogout($_GET['username'])) { $message = $this->lang->words['Members']['Accounts']['ManageAccount']['DisconnectAccount']['Messages']['Success']; $type = 3; } else { $message = sprintf($this->lang->words['Members']['Accounts']['ManageAccount']['DisconnectAccount']['Messages']['Error'], 11); $type = 2; } $this->loadSearchAccounts(true, adminShowMessage($message, $type)); $this->output->setContent("accounts_search"); break; default: if ($this->CheckPermissionItem("accounts_manageAccount_edit") == true) { if ($_GET['write'] == "name" && loadIsAjax() == true) { if (empty($_POST['NewName'])) { exit(adminShowMessage($this->lang->words['Members']['Accounts']['ManageAccount']['EditAccount']['ChangeName']['Messages']['NameVoid'], 1)); } elseif (strlen($_POST['NewName']) > 10) { exit(adminShowMessage($this->lang->words['Members']['Accounts']['ManageAccount']['EditAccount']['ChangeName']['Messages']['MaxLength'], 2)); } else { $this->DB->Arguments($_GET['username']); $this->DB->Update(MUACC_CORE . "@MEMB_INFO", array("memb_name" => utf8_encode($_POST['NewName'])), "memb___id = '%s'"); exit("<script>editAccount_writeSuccess('name', '" . str_replace("'", "\\'", $_POST['NewName']) . "');</script>"); } } elseif ($_GET['write'] == "email" && loadIsAjax() == true) { if (empty($_POST['NewMail'])) { exit(adminShowMessage($this->lang->words['Members']['Accounts']['ManageAccount']['EditAccount']['ChangeMail']['Messages']['MailVoid'], 1)); } elseif (!CTM_Text::CheckMail($_POST['NewMail'])) { exit(adminShowMessage($this->lang->words['Members']['Accounts']['ManageAccount']['EditAccount']['ChangeMail']['Messages']['InvalidMail'], 2)); } else { $this->DB->Arguments($_GET['username']); $this->DB->Update(MUACC_CORE . "@MEMB_INFO", array("mail_addr" => $_POST['NewMail']), "memb___id = '%s'"); exit("<script>editAccount_writeSuccess('email', '" . str_replace("'", "\\'", $_POST['NewMail']) . "');</script>"); } } elseif ($_GET['write'] == "password" && loadIsAjax() == true) { if (empty($_POST['NewPassword'])) { exit(adminShowMessage($this->lang->words['Members']['Accounts']['ManageAccount']['EditAccount']['ChangePassword']['Messages']['PasswordVoid'], 1)); } elseif (empty($_POST['ConfirmNewPassword'])) { exit(adminShowMessage($this->lang->words['Members']['Accounts']['ManageAccount']['EditAccount']['ChangePassword']['Messages']['ConfirmPasswordVoid'], 1)); } elseif (eregi("[^a-zA-Z0-9_!=?&-]", $_POST['NewPassword'])) { exit(adminShowMessage($this->lang->words['Members']['Accounts']['ManageAccount']['EditAccount']['ChangePassword']['Messages']['CaractersInvalid'], 2)); } elseif ($_POST['NewPassword'] != $_POST['ConfirmNewPassword']) { exit(adminShowMessage($this->lang->words['Members']['Accounts']['ManageAccount']['EditAccount']['ChangePassword']['Messages']['PasswordError'], 2)); } else { $this->MuLib('Member')->ChangePassword($_GET['username'], $_POST['NewPassword']); exit("<script>editAccount_writeSuccess('password');</script>"); } } elseif ($_GET['write'] == "pid" && loadIsAjax() == true) { if (empty($_POST['NewPID'])) { exit(adminShowMessage($this->lang->words['Members']['Accounts']['ManageAccount']['EditAccount']['ChangePID']['Messages']['PIDVoid'], 1)); } elseif (strlen($_POST['NewPID']) != 7) { exit(adminShowMessage($this->lang->words['Members']['Accounts']['ManageAccount']['EditAccount']['ChangePID']['Messages']['ErrorLength'], 2)); } elseif (!is_numeric($_POST['NewPID'])) { exit(adminShowMessage($this->lang->words['Members']['Accounts']['ManageAccount']['EditAccount']['ChangePID']['Messages']['ErrorCaracters'], 2)); } else { $this->DB->Arguments($_GET['username']); $this->DB->Update(MUACC_CORE . "@MEMB_INFO", array("sno__numb" => str_pad($_POST['NewPID'], 13, 1, STR_PAD_LEFT)), "memb___id = '%s'"); exit("<script>editAccount_writeSuccess('pid', '" . str_replace("'", "\\'", $_POST['NewPID']) . "');</script>"); } } elseif ($_GET['write'] == "save") { if (is_null($_POST['MemberStatus']) || is_null($_POST['AccountLevel']) || empty($_POST['SecureQuestion']) || empty($_POST['SecureAnswer'])) { $GLOBALS['result_command'] = $this->lang->words['Members']['Accounts']['ManageAccount']['EditAccount']['Save']['Messages']['FieldsVoid']; $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 1); } elseif (empty($_POST['BirthDay']) || empty($_POST['BirthMonth']) || empty($_POST['BirthYear'])) { $GLOBALS['result_command'] = $this->lang->words['Members']['Accounts']['ManageAccount']['EditAccount']['Save']['Messages']['FieldsVoid']; $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 1); } elseif (is_null($_POST['CoinBalance_1']) || is_null($_POST['CoinBalance_2']) && COIN_NUMBER >= 2 || is_null($_POST['CoinBalance_3']) && COIN_NUMBER == 3) { $GLOBALS['result_command'] = $this->lang->words['Members']['Accounts']['ManageAccount']['EditAccount']['Save']['Messages']['FieldsVoid']; $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 1); } elseif ($_POST['AccountLevel'] < 0 || $_POST['AccountLevel'] > VIP_NUMBER) { $GLOBALS['result_command'] = $this->lang->words['Members']['Accounts']['ManageAccount']['EditAccount']['Save']['Messages']['ErrorAccountLevel']; $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 2); } elseif ($_POST['MemberStatus'] != 0 && $_POST['MemberStatus'] != 1) { $GLOBALS['result_command'] = $this->lang->words['Members']['Accounts']['ManageAccount']['EditAccount']['Save']['Messages']['ErrorStatus']; $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 2); } else { $_POST['BirthDay'] = eregi_replace("[^0-9]", NULL, $_POST['BirthDay']); $_POST['BirthMonth'] = eregi_replace("[^0-9]", NULL, $_POST['BirthMonth']); $_POST['BirthYear'] = eregi_replace("[^0-9]", NULL, $_POST['BirthYear']); $save_data = array("info" => array("fpas_ques" => utf8_encode($_POST['SecureQuestion']), "fpas_answ" => utf8_encode($_POST['SecureAnswer']), "MemberBirth" => $_POST['BirthDay'] . "/" . $_POST['BirthMonth'] . "/" . $_POST['BirthYear'], "MemberStatus" => intval($_POST['MemberStatus'])), "vip" => array(VIP_COLUMN => intval($_POST['AccountLevel'])), "coin" => array(COIN_COLUMN_1 => intval($_POST['CoinBalance_1']))); if (COIN_NUMBER >= 2) { $save_data['coin'][COIN_COLUMN_2] = intval($_POST['CoinBalance_2']); if (COIN_NUMBER == 3) { $save_data['coin'][COIN_COLUMN_3] = intval($_POST['CoinBalance_3']); } } $this->MuLib('Member')->UpdateAccount($_GET['username'], $save_data); $GLOBALS['result_command'] = $this->lang->words['Members']['Accounts']['ManageAccount']['EditAccount']['Save']['Messages']['Success']; $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 3); $user_data = $this->MuLib('Member')->Load($_GET['username'] = urldecode($_GET['username'])); } } elseif ($_GET['write'] == "delete") { if (USER_ACCOUNT == $_GET['username']) { $GLOBALS['result_command'] = $this->lang->words['Members']['Accounts']['ManageAccount']['EditAccount']['DeleteAccount']['NoDelSelf']; $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 2); } elseif (in_array($_GET['username'], $this->settings['ADMINCONTROLPANEL']['SADMIN_ACCOUNTS'])) { $GLOBALS['result_command'] = $this->lang->words['Members']['Accounts']['ManageAccount']['EditAccount']['DeleteAccount']['NoDelUser']; $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 2); } else { $this->MuLib('Member')->DeleteAccount($_GET['username']); $this->loadSearchAccounts(true, adminShowMessage($this->lang->words['Members']['Accounts']['ManageAccount']['EditAccount']['DeleteAccount']['Success'], 3)); $this->output->setContent("accounts_search"); return NULL; } } elseif ($_GET['command'] == "disconnect") { if ($user_data['stat']['ConnectStat'] < 1) { $GLOBALS['result_command'] = $this->lang->words['Members']['Accounts']['ManageAccount']['DisconnectAccount']['Messages']['UserOffline']; $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 2); } elseif ($this->MuLib('JoinServer')->ForceLogout($_GET['username'])) { $GLOBALS['result_command'] = $this->lang->words['Members']['Accounts']['ManageAccount']['DisconnectAccount']['Messages']['Success']; $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 3); } else { $GLOBALS['result_command'] = sprintf($this->lang->words['Members']['Accounts']['ManageAccount']['DisconnectAccount']['Messages']['Error'], 11); $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 2); $GLOBALS['result_command'] .= "\r\n<script>\$('#userStatus').html(\"<span style='color: red;'>Offline</span>\");</script>"; } } $GLOBALS['account_info'] = array("info" => array("register_date" => $user_data['info']['RegisterDate'], "sex" => utf8_decode($user_data['info']['MemberSex'])), "data" => array("name" => utf8_decode($user_data['info']['memb_name']), "mail" => $user_data['info']['mail_addr'], "pid" => substr($user_data['info']['sno__numb'], 6), "status" => $user_data['info']['MemberStatus'], "account_level" => $user_data['vip'][VIP_COLUMN], "coin_1" => $user_data['coin'][COIN_COLUMN_1], "coin_2" => $user_data['coin'][COIN_COLUMN_2], "coin_3" => $user_data['coin'][COIN_COLUMN_3], "secure_question" => utf8_decode($user_data['info']['fpas_ques']), "secure_answer" => utf8_decode($user_data['info']['fpas_answ']), "birth" => explode("/", $user_data['info']['MemberBirth'])), "stat" => array("server" => $this->functions->GetServerName($user_data['stat']['ServerName']), "ip" => $user_data['stat']['IP'], "date" => date("d/m/Y - h:i a", strtotime($user_data['stat']['ConnectTM'])), "status" => $user_data['stat']['ConnectStat'] > 0)); $this->output->setContent("accounts_editAccount"); } break; } } }