/** * Load Comment Notice * * @return void */ private function loadCommentNotice() { if (SESSION_USER_LOGGED == false) { exit(showMessage($this->lang->words['NoticeAjax']['CommentNotice']['Messages']['NotLogged'], 2)); } else { $this->DB->Arguments($_GET['id']); $findSwitchQ = $this->DB->Select("CommentSwitch", "CTM_Notices", "Id = %d"); $findSwitchR = $this->DB->CountRows($findSwitchQ); $findSwitch = $this->DB->FetchRow($findSwitchQ); if ($findSwitchR < 1) { exit(showMessage($this->lang->words['NoticeAjax']['CommentNotice']['Messages']['NotExists'], 2)); } elseif ($findSwitch[0] == 0) { exit(showMessage($this->lang->words['NoticeAjax']['CommentNotice']['Messages']['Disabled'], 2)); } elseif (empty($_POST['Character'])) { exit(showMessage($this->lang->words['NoticeAjax']['CommentNotice']['Messages']['SelectChar'], 1)); } elseif (empty($_POST['Text'])) { exit(showMessage($this->lang->words['NoticeAjax']['CommentNotice']['Messages']['SetComment'], 1)); } else { $insertData = array("NoticeID" => "%d", "Account" => "%s", "Author" => "%s", "Date" => "%d", "Text" => "%s"); $this->DB->Arguments(intval($_GET['id']), USER_ACCOUNT, $_POST['Character'], time(), htmlEncode($_POST['Text'])); $this->DB->Insert("CTM_NoticeComments", $insertData); $string = "<script>CTM.AjaxLoad('?app=core&module=notices&load=loadComments&id=" . $_GET['id'] . "','noticeComments');</script>"; $string .= showMessage($this->lang->words['NoticeAjax']['CommentNotice']['Messages']['Success'], 3); exit($string); } } }
/** * Init Module * * @return void */ public function init() { $this->lang->loadLanguageFile("profile"); if (strlen($_GET['guild']) > 0) { $guild = $_GET['guild']; } elseif ($this->URLData[1] == "guild") { $guild = $this->URLData[2]; } else { $guild = $this->URLData[1]; } $this->DB->Arguments($guild); $guild_profile_q = $this->DB->Query("SELECT * FROM " . MUGEN_CORE . ".dbo.Guild WHERE G_Name = '%s'"); if ($this->DB->CountRows($guild_profile_q) < 1) { $GLOBALS['guild_profile'] = "GUILD_NOT_FOUND"; $GLOBALS['guild_name'] = "Error"; } else { $guild_profile = $this->DB->FetchObject($guild_profile_q); $_members = array(); $this->DB->Arguments($guild); $members_q = $this->DB->Query("SELECT " . MUGEN_CORE . ".dbo.GuildMember.Name, " . MUGEN_CORE . ".dbo.Character.Class, " . MUGEN_CORE . ".dbo.Character.cLevel, " . MUACC_CORE . ".dbo.MEMB_STAT.ConnectStat FROM " . MUGEN_CORE . ".dbo.GuildMember LEFT JOIN " . MUGEN_CORE . ".dbo.Character ON (" . MUGEN_CORE . ".dbo.Character.Name = " . MUGEN_CORE . ".dbo.GuildMember.Name) LEFT JOIN " . MUACC_CORE . ".dbo.MEMB_STAT ON (" . MUACC_CORE . ".dbo.MEMB_STAT.memb___id = " . MUGEN_CORE . ".dbo.Character.AccountID) WHERE " . MUGEN_CORE . ".dbo.GuildMember.G_Name = '%s' ORDER BY G_Level DESC"); if ($this->DB->CountRows($members_q) > 0) { while ($members = $this->DB->FetchObject($members_q)) { $_members[$members->Name] = array("level" => $members->cLevel, "class" => $this->functions->ClassInfo($members->Class), "status" => $members->ConnectStat > 0 ? "<font color=\"green\">Online</span>" : "<font color=\"red\">Offline</font>"); } } $GLOBALS['guild_name'] = $guild_profile->G_Name; $GLOBALS['guild_profile'] = array("master" => $guild_profile->G_Master, "score" => number_format($guild_profile, 0, false, "."), "notice" => htmlEncode($this->lang->words['Profile']['GuildProfile']['Notice']['Content'] . $guild_profile->G_Notice), "image" => $this->functions->GetGuildMark($guild_profile->G_Mark), "members" => $_members, "member_count" => count($_members)); } $this->output->loadSkinCache("profile", "profile_guild"); }
function htmlEncode($arr) { if (is_array($arr)) { foreach ($arr as $key => $val) { $arr[$key] = htmlEncode($val); } } else { $arr = htmlspecialchars($arr); } return $arr; }
/** * Recover Member Data * Recover member and send e-mail * * @return void */ private function loadRecoverMember() { if ($_GET['write'] == true) { if (empty($_POST['Login']) && empty($_POST['Mail'])) { return setResult(showMessage($this->lang->words['Recovery']['Recover']['Messages']['Void'], 1)); } if (!empty($_POST['Login'])) { $source = "login"; } else { $source = "mail"; } $member = $this->MuLib('Member')->Load($source == "login" ? $_POST['Login'] : $_POST['Mail'], array("info" => "memb_name,fpas_ques,fpas_answ")); if (!$member) { return setResult(showMessage($this->lang->words['Recovery']['Recover']['Messages']['Invalid'], 2)); } $currentId = $this->DB->GetCurrentId("CTM_RecoverData") + 1; $dechex = create_function("\$integer", "return str_pad(dechex(\$integer >= 255 ? 255 : \$integer), 2, 0, STR_PAD_LEFT);"); $confirmCode = $dechex($currentId); $confirmCode .= ":" . $dechex(0xaa - strlen($member['memb___id']) + mt_rand(0, 50)); $confirmCode .= ":" . $dechex(strlen($member['mail_addr']) + mt_rand(0, 50)); $confirmCode .= ":" . $dechex(mt_rand(0, 70)); $confirmCode .= ":" . $dechex(mt_rand(71, 170)); $confirmCode .= ":" . $dechex(0xaa / intval(date("d")) + intval(date("H")) + intval(date("m")) + intval(date("s")) + mt_rand(0, 50)); $confirmCode .= ":" . $dechex(0xaa / intval(date("m")) + intval(date("H")) + intval(date("m")) + intval(date("s")) + mt_rand(0, 50)); $confirmCode .= ":" . $dechex(intval(date("Y")) / 0xaa + intval(date("H")) + intval(date("m")) + intval(date("s")) + mt_rand(0, 50)); $confirmCode = strtoupper($confirmCode); $link = gerateFullLink("?/recovery/process"); $this->DB->Insert("CTM_RecoverData", array("Account" => $member['info']['memb___id'], "RedefineCode" => $confirmCode, "Expiration" => strtotime("+ 24 hours"))); $this->email->arguments = array("NAME" => htmlEncode($member['info']['memb_name']), "LOGIN" => $member['info']['memb___id'], "EMAIL" => $member['info']['mail_addr'], "SECURE_QUESTION" => htmlEncode($member['info']['fpas_ques']), "SECURE_ANSWER" => htmlEncode($member['info']['fpas_answ']), "VALIDATION_LINK" => $currentId, "VALIDATION_CODE" => $confirmCode, "SYSTEM_LINK" => $link); $this->email->LoadTemplate("RecoverMemberData"); $this->email->GetMailContent($mail); $this->mailer->AddAddress($member['info']['mail_addr'], $member['info']['memb_name']); $this->mailer->SetSubject($mail['subject']); $this->mailer->SetBody($mail['content']); if ($this->mailer->SendMail() == true) { return setResult(showMessage($this->lang->words['Recovery']['Recover']['Messages']['Success'], 3)); } else { $this->lang->setArguments("Recovery,Recover,Messages,Error_SendMail", CoreVariables::ErrorsCode()->SendMailError); return setResult(showMessage($this->lang->words['Recovery']['Recover']['Messages']['Error_SendMail'], 2)); } } }
/** * 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; } }
/** * Private: Header Arguments * * @return void */ private function loadHeaderArguments() { if (SESSION_USER_LOGGED) { $member = Authentication::GetAuthData(); $member = $member['ACCOUNT']; $GLOBALS['user_logged_data']['info'] = array("member_name" => htmlEncode($member['info']['memb_name']), "member_level" => $this->functions->AccountLevel($member['vip'][VIP_COLUMN]), "member_coin" => array(1 => number_format($member['coin'][COIN_COLUMN_1], 0, false, "."), 2 => number_format($member['coin'][COIN_COLUMN_2], 0, false, "."), 3 => number_format($member['coin'][COIN_COLUMN_3], 0, false, "."))); } }
} if ($PARAM['WHERE']) { //pokaji kinata $query = "SELECT\t{$tbl_1d_cinemas}.ID,\n\t\t\t\t{$tbl_1d_cinemas}.Cinema\n\t\t\tFROM {$tbl_1d_cinemas}\n\t\t\tWHERE {$tbl_1d_cinemas}.CityID = " . dbQuote($PARAM['WHERE']) . "\n\t\t\tORDER BY {$tbl_1d_cinemas}.ID"; $result = runQuery($query, 'manageAgenda()', 'GET_CINEMAS_FOR_CITY'); while ($row = db_fetch_row($result)) { if ($PARAM['PLACES'] == $row[0]) { $SUBS['PLACES'] .= "\n<option value=\"{$row['0']}\" selected>" . htmlEncode($row[1]); } else { $SUBS['PLACES'] .= "\n<option value=\"{$row['0']}\">" . htmlEncode($row[1]); } } } $SUBS['FILM2'] = htmlEncode($PARAM['FILM']); $SUBS['DATE'] = htmlEncode($PARAM['DATE']); $SUBS['ID'] = htmlEncode($PARAM['id']); $SUBS['NO'] = $PARAM['NO']; $SUBS['TYPE' . strtoupper($PARAM['TYPE'])] = ' checked'; //get oldest week $query = "SELECT min(tsWhen) FROM {$tbl_1d_agenda}"; $result = runQuery($query, 'manageAgenda()', 'GET_OLDEST_WEEK'); if ($row = db_fetch_row($result)) { global $span; $span = $row[0]; } ////----[Mrasnika's] Edition 02.10.2002 // $SUBS['WHEN'] = getWeeks($PARAM['WHEN']); //compatibility if (!$PARAM['WHEN']) { //no date applied if (!$PARAM['Day1'] || !$PARAM['Month1'] || !$PARAM['Year1']) {
/** * 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; } } }
function setCharts() { global $SUBS, $PARAM, $MSG; global $tbl_1d_charts, $tbl_1d_kino_charts, $tbl_1d_videodvd_charts, $tbl_1d_films, $tbl_1d_videodvd; global $MONTHS, $MONTHS2; // check chart length $query = "SELECT Length, Type\n\t\tFROM {$tbl_1d_charts}\n\t\tORDER BY ID = " . dbQuote($PARAM['PLACES']) . " DESC "; $result = runQuery($query, 'setCharts()', 'GET_CHART_LENGTH_AND_TYPE'); if ($row = db_fetch_row($result)) { $max = $row[0]; $type = $row[1]; } else { adminMenu(); return; } //iztriwane if ($PARAM['Delete'] == 1) { reset($PARAM); $Films = '0'; while (list($k, $v) = each($PARAM)) { if (ereg('^c_([0-9]+)$', $k, $R)) { $Films .= ",{$R['1']}"; } } //get chart type $query = "SELECT Type\n\t\t\tFROM {$tbl_1d_charts}\n\t\t\tWHERE ID = " . dbQuote($PARAM['PLACES']); $result = runQuery($query, 'setCharts()', 'GET_CHART_TYPE2'); if ($row = db_fetch_row($result)) { $type = $row[0]; } else { $SUBS['ERROR'] = $MSG[20008]; } switch ($type) { case 'videodvd': $query = "DELETE FROM {$tbl_1d_videodvd_charts} WHERE ID IN ({$Films})"; break; case 'kino': $query = "DELETE FROM {$tbl_1d_kino_charts} WHERE ID IN ({$Films})"; break; } if ($Films == '0') { $SUBS['ERROR'] = $MSG[20008]; } if ($SUBS['ERROR']) { $SUBS['ERROR'] = fileParse('_admin_error.htmlt'); } else { runQuery($query, 'setCharts()', 'DEL_CHART_RECORDS'); $SUBS['COMMAND'] = $PARAM['cmd'] . "&err=20030&WHEN=" . $PARAM['WEEK'] . "&WEEK=" . $PARAM['WEEK'] . "&WHERE=" . $PARAM['WHERE'] . "&PLACES=" . $PARAM['PLACES']; printPage('_admin_done.htmlt'); return; } } //add chart record if ($PARAM['Add'] == 1) { $SUBS['ERROR'] = ''; if ($PARAM['NO'] == '') { //poziciya w klasaciyata $SUBS['ERROR'] = $MSG[20097]; } if ($SUBS['ERROR'] == '' && !is_numeric($PARAM['NO'])) { $SUBS['ERROR'] = $MSG[20099]; } //poziciyata dali e cefira if ($SUBS['ERROR'] == '' && $PARAM['NO'] > $max) { $SUBS['ERROR'] = $MSG[20099]; } //poziciyata dali e po-golyama ot poziciite w klasaciyata if ($SUBS['ERROR'] == '' && $PARAM['NO'] < 0) { $SUBS['ERROR'] = $MSG[20099]; } //poziciyata dali e po-malka ot nula //tipa na filma switch ($PARAM['TYPE']) { case 'list': //list if ($SUBS['ERROR'] == '' && $PARAM['FILMS'] == 0) { $SUBS['ERROR'] = $MSG[20026]; } $film = $PARAM['FILMS']; break; case 'raw': //raw if ($SUBS['ERROR'] == '' && $PARAM['FILM'] == '') { $SUBS['ERROR'] = $MSG[20027]; } $film = $PARAM['FILM']; break; default: if ($SUBS['ERROR'] == '') { $SUBS['ERROR'] = $MSG[20028]; } } switch ($type) { case 'kino': if ($SUBS['ERROR'] == '' && $PARAM['WEEKS'] == '') { $SUBS['ERROR'] = $MSG[20098]; } //sedmici w klasaciyata if ($SUBS['ERROR'] == '' && !is_numeric($PARAM['WEEKS'])) { $SUBS['ERROR'] = $MSG[20100]; } //sedmicite dali sa cefira if ($SUBS['ERROR'] == '' && $PARAM['SCREENS'] == '') { $SUBS['ERROR'] = $MSG[20101]; } //ekrani na klasaciyata if ($SUBS['ERROR'] == '' && !is_numeric($PARAM['SCREENS'])) { $SUBS['ERROR'] = $MSG[20102]; } //ekranite dali sa cefira if ($SUBS['ERROR'] == '' && $PARAM['BO'] == '') { $SUBS['ERROR'] = $MSG[20103]; } //sedmichen prihod na klasaciyata /*if (($SUBS['ERROR'] =='' ) && (!is_numeric($PARAM['BO']))) $SUBS['ERROR'] = $MSG[20104]; //sedmichen prihod dali sa cefira*/ if ($SUBS['ERROR'] == '' && $PARAM['CBO'] == '') { $SUBS['ERROR'] = $MSG[20105]; } //obscht prihod na klasaciyata /*if (($SUBS['ERROR'] =='' ) && (!is_numeric($PARAM['CBO']))) $SUBS['ERROR'] = $MSG[20106]; //obscht prihod dali sa cefira*/ break; case 'videodvd': if ($SUBS['ERROR'] == '' && $PARAM['WEEKS'] == '') { $SUBS['ERROR'] = $MSG[20098]; } //sedmici w klasaciyata if ($SUBS['ERROR'] == '' && !is_numeric($PARAM['WEEKS'])) { $SUBS['ERROR'] = $MSG[20100]; } //sedmicite dali sa cefira break; } if ($SUBS['ERROR'] == '') { if ($PARAM['id'] == '') { switch ($type) { case 'videodvd': $query = "INSERT INTO {$tbl_1d_videodvd_charts} (\n\t\t\t\t\t\t\t\tChartID,\n\t\t\t\t\t\t\t\tNo,\n\t\t\t\t\t\t\t\tType,\n\t\t\t\t\t\t\t\tFilm,\n\t\t\t\t\t\t\t\tWeeks,\n\t\t\t\t\t\t\t\ttsWhen\n\t\t\t\t\t\t\t\t) VALUES (\n\t\t\t\t\t\t\t\t" . dbQuote($PARAM['PLACES']) . ",\n\t\t\t\t\t\t\t\t" . dbQuote($PARAM['NO']) . ",\n\t\t\t\t\t\t\t\t" . dbQuote($PARAM['TYPE']) . ",\n\t\t\t\t\t\t\t\t" . dbQuote($film) . ",\n\t\t\t\t\t\t\t\t" . dbQuote($PARAM['WEEKS']) . ",\n\t\t\t\t\t\t\t\t" . dbQuote($PARAM['WEEK']) . " )"; break; case 'kino': $query = "INSERT INTO {$tbl_1d_kino_charts} (\n\t\t\t\t\t\t\t\tChartID,\n\t\t\t\t\t\t\t\tNo,\n\t\t\t\t\t\t\t\tType,\n\t\t\t\t\t\t\t\tFilm,\n\t\t\t\t\t\t\t\tBoxOffice,\n\t\t\t\t\t\t\t\tcumBoxOffice,\n\t\t\t\t\t\t\t\tWeeks,\n\t\t\t\t\t\t\t\tScreens,\n\t\t\t\t\t\t\t\ttsWhen\n\t\t\t\t\t\t\t\t) VALUES (\n\t\t\t\t\t\t\t\t" . dbQuote($PARAM['PLACES']) . ",\n\t\t\t\t\t\t\t\t" . dbQuote($PARAM['NO']) . ",\n\t\t\t\t\t\t\t\t" . dbQuote($PARAM['TYPE']) . ",\n\t\t\t\t\t\t\t\t" . dbQuote($film) . ",\n\t\t\t\t\t\t\t\t" . dbQuote($PARAM['BO']) . ",\n\t\t\t\t\t\t\t\t" . dbQuote($PARAM['CBO']) . ",\n\t\t\t\t\t\t\t\t" . dbQuote($PARAM['WEEKS']) . ",\n\t\t\t\t\t\t\t\t" . dbQuote($PARAM['SCREENS']) . ",\n\t\t\t\t\t\t\t\t" . dbQuote($PARAM['WEEK']) . " )"; break; } } else { switch ($type) { case 'videodvd': $query = "UPDATE {$tbl_1d_videodvd_charts} SET\n\t\t\t\t\t\t\t\tChartID = " . dbQuote($PARAM['PLACES']) . ",\n\t\t\t\t\t\t\t\tNo = " . dbQuote($PARAM['NO']) . ",\n\t\t\t\t\t\t\t\tType = " . dbQuote($PARAM['TYPE']) . ",\n\t\t\t\t\t\t\t\tFilm = " . dbQuote($film) . ",\n\t\t\t\t\t\t\t\tWeeks = " . dbQuote($PARAM['WEEKS']) . ",\n\t\t\t\t\t\t\t\ttsWhen = " . dbQuote($PARAM['WEEK']) . " \n\t\t\t\t\t\t\tWHERE ID = " . dbQuote($PARAM['id']); break; case 'kino': $query = "UPDATE {$tbl_1d_kino_charts} SET\n\t\t\t\t\t\t\t\tChartID = " . dbQuote($PARAM['PLACES']) . ",\n\t\t\t\t\t\t\t\tNo = " . dbQuote($PARAM['NO']) . ",\n\t\t\t\t\t\t\t\tType = " . dbQuote($PARAM['TYPE']) . ",\n\t\t\t\t\t\t\t\tFilm = " . dbQuote($film) . ",\n\t\t\t\t\t\t\t\tBoxOffice = " . dbQuote($PARAM['BO']) . ",\n\t\t\t\t\t\t\t\tcumBoxOffice = " . dbQuote($PARAM['CBO']) . ",\n\t\t\t\t\t\t\t\tWeeks = " . dbQuote($PARAM['WEEKS']) . ",\n\t\t\t\t\t\t\t\tScreens = " . dbQuote($PARAM['SCREENS']) . ",\n\t\t\t\t\t\t\t\ttsWhen = " . dbQuote($PARAM['WEEK']) . " \n\t\t\t\t\t\t\tWHERE ID = " . dbQuote($PARAM['id']); break; } } $result = runQuery($query, 'setCharts()', 'SAVE_CHART'); $SUBS['COMMAND'] = $PARAM['cmd'] . "&err=20107&PLACES=" . $PARAM['PLACES'] . "&WHEN=" . $PARAM['WEEK'] . "&WEEK=" . $PARAM['WEEK']; printPage('_admin_done.htmlt'); return; } else { $SUBS['ERROR'] = fileParse('_admin_error.htmlt'); } } ////----[Mrasnika's] Edition 12.10.2002 if ($PARAM['WHEN']) { $PARAM['Year1'] = date('Y', $PARAM['WHEN']); $PARAM['Month1'] = date('m', $PARAM['WHEN']); $PARAM['Day1'] = date('d', $PARAM['WHEN']); } else { if ($PARAM['Day1'] && $PARAM['Month1'] && $PARAM['Year1']) { $PARAM['WHEN'] = 1 + strToTime($PARAM['Day1'] . ' ' . $MONTHS2[$PARAM['Month1']] . ' ' . $PARAM['Year1']); } else { $PARAM['WHEN'] = getNextWeek(); } } $SUBS['PREV'] = week($PARAM['WHEN']) - 518400; $SUBS['NEXT'] = week($PARAM['WHEN']) + 1026800; //show charts records switch ($type) { case 'kino': $query = "SELECT\t{$tbl_1d_kino_charts}.ID,\n\t\t\t\tChartID,\n\t\t\t\tNo,\n\t\t\t\tType,\n\t\t\t\tFilm,\n\t\t\t\tBoxOffice,\n\t\t\t\tcumBoxOffice,\n\t\t\t\tWeeks,\n\t\t\t\tScreens,\n\t\t\t\ttsWhen,\n\t\t\t\t\n\t\t\t\t{$tbl_1d_films}.Title,\n\t\t\t\t{$tbl_1d_films}.OriginalTitle\n\n\t\t\t\tFROM {$tbl_1d_kino_charts}\n\t\t\t\tLEFT JOIN {$tbl_1d_films}\n\t\t\t\t\tON {$tbl_1d_kino_charts}.Type = 'list'\n\t\t\t\t\t\tAND {$tbl_1d_films}.ID = {$tbl_1d_kino_charts}.Film\n\t\t\t\tWHERE {$tbl_1d_kino_charts}.ChartID = " . dbQuote($PARAM['PLACES']) . "\n\t\t\t\t\tAND {$tbl_1d_kino_charts}.tsWhen >= " . week($PARAM['WHEN']) . "\n\t\t\t\t\tAND {$tbl_1d_kino_charts}.tsWhen <= (" . week($PARAM['WHEN']) . "+604799)\n\t\t\t\tORDER BY {$tbl_1d_kino_charts}.No,\n\t\t\t\t\t{$tbl_1d_kino_charts}.BoxOffice"; break; case 'videodvd': $query = "SELECT\t{$tbl_1d_videodvd_charts}.ID,\n\t\t\t\tChartID,\n\t\t\t\tNo,\n\t\t\t\tType,\n\t\t\t\tFilm,\n\t\t\t\tWeeks,\n\t\t\t\tWeeks,\n\t\t\t\tWeeks,\n\t\t\t\tWeeks,\n\t\t\t\ttsWhen,\n\t\t\t\t\n\t\t\t\t{$tbl_1d_films}.Title,\n\t\t\t\t{$tbl_1d_films}.OriginalTitle\n\n\t\t\t\tFROM {$tbl_1d_videodvd_charts}\n\t\t\t\tLEFT JOIN {$tbl_1d_films}\n\t\t\t\t\tON {$tbl_1d_videodvd_charts}.Type = 'list'\n\t\t\t\t\t\tAND {$tbl_1d_films}.ID = {$tbl_1d_videodvd_charts}.Film\n\t\t\t\tWHERE {$tbl_1d_videodvd_charts}.ChartID = " . dbQuote($PARAM['PLACES']) . "\n\t\t\t\t\tAND {$tbl_1d_videodvd_charts}.tsWhen >= " . week($PARAM['WHEN']) . "\n\t\t\t\t\tAND {$tbl_1d_videodvd_charts}.tsWhen <= (" . week($PARAM['WHEN']) . "+604799)\n\t\t\t\tORDER BY {$tbl_1d_videodvd_charts}.No "; break; } $result = runQuery($query, 'setCharts()', 'GET_CHART_RECORDS'); while ($row = db_fetch_row($result)) { $SUBS['CHECK'] = $row[0]; $SUBS['CHARTID'] = $row[1]; $SUBS['NO2'] = sprintf("%02d", $row[2]); if ($row[3] == 'list') { if ($row[10]) { $SUBS['TITLE'] = htmlEncode($row[10]); } else { $SUBS['TITLE'] = htmlEncode($row[11]); } $SUBS['MOVIE'] = $SUBS['ACTION'] . "?cmd=insertfilm&ID={$row['4']}"; } else { $SUBS['TITLE'] = htmlEncode($row[4]); $SUBS['MOVIE'] = "javascript:alert('{$MSG['20031']}')"; } $SUBS['PRATI'] = $row[9]; switch ($type) { case 'kino': $SUBS['BO2'] = $row[5]; $SUBS['CBO2'] = $row[6]; $SUBS['SCREENS2'] = $row[8]; $SUBS['WEEKS2'] = $row[7]; $SUBS['SHOWCHARTS'] .= fileParse('_admin_charts_row.htmlt'); break; case 'videodvd': $SUBS['WEEKS2'] = $row[7]; $SUBS['SHOWCHARTS'] .= fileParse('_admin_charts_row2.htmlt'); break; } if ($PARAM['Add'] != 1 && $PARAM['id'] == $row[0]) { //load form $PARAM['PLACES'] = $row[1]; $PARAM['TYPE'] = $row[3]; if ($row[3] != 'list') { $PARAM['FILM'] = $row[4]; } else { $PARAM['FILMS'] = htmlEncode($row[4]); } $PARAM['WEEK'] = $row[9]; $PARAM['NO'] = $row[2]; switch ($type) { default: //kino $PARAM['BO'] = $row[5]; $PARAM['CBO'] = $row[6]; $PARAM['WEEKS'] = $row[7]; $PARAM['SCREENS'] = $row[8]; } } } //get charts $SUBS['CHARTS'] = $PARAM['PLACES']; $query = "SELECT ID, Title\n \t\tFROM {$tbl_1d_charts}"; $result = runQuery($query, 'setCharts()', 'GET_CHARTS'); while ($row = db_fetch_row($result)) { ////----[Mrasnika's] Edition 12.10.2002 // if ($row[0] == $PARAM['chartid']) // $SUBS['CHARTS'] .= "<OPTION value=\"$row[0]\" SELECTED>".htmlEncode($row[1]); // else $SUBS['CHARTS'] .= "<OPTION value=\"$row[0]\">".htmlEncode($row[1]); if (!$s1) { //store default chart $s1 = $row[0]; $s2 = $row[1]; } if ($row[0] == $PARAM['PLACES']) { $SUBS['CHARTTITLE'] = htmlEncode($row[1]); } if ($row[0] == $PARAM['PLACES']) { $SUBS['PLACES'] .= "<OPTION value=\"{$row['0']}\" SELECTED>" . htmlEncode($row[1]); } else { $SUBS['PLACES'] .= "<OPTION value=\"{$row['0']}\">" . htmlEncode($row[1]); } } if (!$SUBS['CHARTTITLE']) { //no default chart $SUBS['CHARTS'] = $s1; $SUBS['CHARTTITLE'] = htmlEncode($s2); } //get oldest week switch ($type) { default: //kino $query = "SELECT\tmin({$tbl_1d_kino_charts}.tsWhen)\n\t\t\t\tFROM\t{$tbl_1d_kino_charts}\n\t\t\t\tGROUP BY {$tbl_1d_kino_charts}.ChartID\n\t\t\t\tORDER BY {$tbl_1d_kino_charts}.ChartID=" . dbQuote($PARAM['PLACES']) . " DESC"; $result = runQuery($query, 'setCharts()', 'GET_OLDEST_WEEK_KINO'); if ($row = db_fetch_row($result)) { $span = $row[0]; } break; case 'videodvd': //videodvd $query = "SELECT\tmin({$tbl_1d_videodvd_charts}.tsWhen)\n\t\t\t\tFROM\t{$tbl_1d_videodvd_charts}"; $result = runQuery($query, 'setCharts()', 'GET_OLDEST_WEEK_VIDEO'); if ($row = db_fetch_row($result)) { $span = $row[0]; } break; } if (!$span) { $span = getNextWeek(); } ////----[Mrasnika's] Edition 12.10.2002 // $SUBS['WEEK'] = getWeeks($PARAM['WEEK']); // $SUBS['WHEN'] = getWeeks($PARAM['WHEN']); //compatibility if (!$PARAM['WHEN']) { //no date applied if (!$PARAM['Day1'] || !$PARAM['Month1'] || !$PARAM['Year1']) { $PARAM['WHEN'] = getNextWeek(); $PARAM['Year1'] = date('Y', $PARAM['WHEN']); $PARAM['Month1'] = date('m', $PARAM['WHEN']); $PARAM['Day1'] = date('d', $PARAM['WHEN']); } else { $PARAM['WHEN'] = 1 + strToTime($PARAM['Day1'] . ' ' . $MONTHS2[$PARAM['Month1']] . ' ' . $PARAM['Year1']); } } else { //load date form $PARAM['Year1'] = date('Y', $PARAM['WHEN']); $PARAM['Month1'] = date('m', $PARAM['WHEN']); $PARAM['Day1'] = date('d', $PARAM['WHEN']); } if ($span > $PARAM['WHEN']) { //ima data, no e po-malka ot naj-starata klasaciya $SUBS['COMMAND'] = $PARAM['cmd'] . "&WHEN={$span}&PLACES=" . $PARAM['PLACES']; printPage('_admin_done.htmlt'); return; } $Year2 = 1 + date('Y', max($PARAM['WHEN'], time())); $Year1 = date('Y', $span); for ($i = $Year1; $i <= $Year2; $i++) { if ($i == $PARAM['Year1']) { $SUBS['YEAR1'] .= "<OPTION value=\"{$i}\" selected>{$i}"; } else { $SUBS['YEAR1'] .= "<OPTION value=\"{$i}\">{$i}"; } } for ($i = 1; $i <= 12; $i++) { if ($i == $PARAM['Month1']) { $SUBS['MONTH1'] .= "<OPTION value=\"{$i}\" selected>" . $MONTHS[$i]; } else { $SUBS['MONTH1'] .= "<OPTION value=\"{$i}\">" . $MONTHS[$i]; } } for ($i = 1; $i <= 31; $i++) { if ($i == $PARAM['Day1']) { $SUBS['DAY1'] .= "<OPTION value=\"{$i}\" selected>" . sprintf('%02d', $i); } else { $SUBS['DAY1'] .= "<OPTION value=\"{$i}\">" . sprintf('%02d', $i); } } $SUBS['WEEK'] = $PARAM['WHEN']; $SUBS['DISPLAYWEEK'] = displayWeek($SUBS['WEEK']); //get films switch ($type) { case 'kino': $query = "SELECT\t{$tbl_1d_films}.ID,\n\t\t\t\tTitle,\n\t\t\t\tOriginalTitle\n\t\t\tFROM {$tbl_1d_films}\n\t\t\tLEFT JOIN {$tbl_1d_videodvd}\n\t\t\t\tON {$tbl_1d_videodvd}.FilmID = {$tbl_1d_films}.ID\n\t\t\tWHERE\t{$tbl_1d_videodvd}.ID IS NULL\n\t\t\tGROUP BY {$tbl_1d_films}.ID\n\t\t\tORDER BY OriginalTitle !='' DESC, Title='' DESC"; break; case 'videodvd': $query = "SELECT\t{$tbl_1d_films}.ID, Title\n\t\t\tFROM {$tbl_1d_films}\n\t\t\tLEFT JOIN {$tbl_1d_videodvd}\n\t\t\t\tON {$tbl_1d_videodvd}.FilmID = {$tbl_1d_films}.ID\n\t\t\tWHERE\t{$tbl_1d_videodvd}.ID IS NOT NULL\n\t\t\tGROUP BY {$tbl_1d_films}.ID\n\t\t\tORDER BY Title DESC"; break; } $result = runQuery($query, 'setCharts()', 'GET_FILMS'); while ($row = db_fetch_row($result)) { //fix titles if (!$row[1]) { $row[1] = $row[2]; } if ($PARAM['FILMS'] == $row[0]) { ////----[Mrasnika's] Edition 12.10.2002 // $SUBS['FILM'] .= "\n<option value=\"$row[0]\" selected>".htmlEncode("$row[1] $row[2] "); // else $SUBS['FILM'] .= "\n<option value=\"$row[0]\">".htmlEncode("$row[1] $row[2] "); $SUBS['FILM'] .= "\n<option value=\"{$row['0']}\" selected>" . htmlEncode($row[1]); } else { $SUBS['FILM'] .= "\n<option value=\"{$row['0']}\">" . htmlEncode($row[1]); } } // display $SUBS['TYPE' . strToUpper($PARAM['TYPE'])] = ' checked '; $SUBS['FILM2'] = htmlEncode($PARAM['FILM']); $SUBS['NO'] = htmlEncode($PARAM['NO']); switch ($type) { default: //kino $SUBS['WEEKS'] = htmlEncode($PARAM['WEEKS']); $SUBS['SCREENS'] = htmlEncode($PARAM['SCREENS']); $SUBS['BO'] = htmlEncode($PARAM['BO']); $SUBS['CBO'] = htmlEncode($PARAM['CBO']); $SUBS['DISPLAYCHART'] = fileParse("_admin_charts_kino.htmlt"); break; case 'videodvd': //video & dvd $SUBS['WEEKS'] = htmlEncode($PARAM['WEEKS']); $SUBS['DISPLAYCHART'] = fileParse("_admin_charts_videodvd.htmlt"); break; } $SUBS['ID'] = htmlEncode($PARAM['id']); if ($PARAM['err'] != '' && $SUBS['ERROR'] == '') { $SUBS['ERROR'] = $MSG[$PARAM['err']]; $SUBS['ERROR'] = fileParse('_admin_error.htmlt'); } printPage('_admin_charts.htmlt'); }
function showCharts() { global $SUBS, $PARAM, $MSG; global $tbl_1d_charts, $tbl_1d_videodvd_charts, $tbl_1d_kino_charts, $tbl_1d_films, $tbl_1d_pictures; ////----[Mrasnika's] Edition 26.10.2002 // proweri tipa na klasaciyata $query = "SELECT Type\n\t\tFROM {$tbl_1d_charts}\n\t\tWHERE ID = " . dbQuote($PARAM['id']); $result = runQuery($query, 'showCharts()', 'GET_CHART_TYPE'); if ($row = db_fetch_row($result)) { $type = $row[0]; } switch ($type) { case 'videodvd': $query = "SELECT\t{$tbl_1d_charts}.ID,\n\t\t\t\t\t{$tbl_1d_charts}.Type,\n\t\t \t\t\t{$tbl_1d_charts}.Title AS a1,\n\n\t\t \t\t\t{$tbl_1d_videodvd_charts}.No,\n\t\t \t\t\t{$tbl_1d_videodvd_charts}.Type,\n\t\t \t\t\t{$tbl_1d_videodvd_charts}.Film,\n\n\t\t \t\t\t{$tbl_1d_films}.Title AS a2,\n\t\t \t\t\t{$tbl_1d_films}.OriginalTitle,\n\t\t \t\t\t{$tbl_1d_films}.Actors,\n\n\t\t \t\t\t'',\n\t\t \t\t\t'',\n\t\t \t\t\t{$tbl_1d_videodvd_charts}.Weeks,\n\t\t \t\t\t'',\n\t\t \t\t\t{$tbl_1d_videodvd_charts}.tsWhen,\n\n\t\t \t\t\t{$tbl_1d_pictures}.URL,\n\t\t\t\t\t{$tbl_1d_pictures}.Width,\n\t\t\t\t\t{$tbl_1d_pictures}.Height,\n\n\t\t\t\t\tp1.URL,\n\t\t\t\t\tp1.Width,\n\t\t\t\t\tp1.Height\n\n\t\t \t\tFROM {$tbl_1d_charts}\n\t\t\t\tLEFT JOIN {$tbl_1d_videodvd_charts}\n\t\t\t\t\tON {$tbl_1d_videodvd_charts}.ChartID = {$tbl_1d_charts}.ID\n\t\t\t\t\t\tAND {$tbl_1d_charts}.Type = 'videodvd'\n\n\t\t\t\tLEFT JOIN {$tbl_1d_films}\n\t\t\t\t\tON {$tbl_1d_videodvd_charts}.Film = {$tbl_1d_films}.ID\n\t\t\t\t\t\tAND {$tbl_1d_videodvd_charts}.Type = 'list'\n\t\t\t\t\t\t\n\t\t\t\tLEFT JOIN {$tbl_1d_pictures}\n\t\t\t\t\tON {$tbl_1d_pictures}.RefID = {$tbl_1d_films}.ID\n\t\t\t\t\t\tAND {$tbl_1d_pictures}.RefType = 'film'\n\t\t\t\tLEFT JOIN {$tbl_1d_pictures} AS p1\n\t\t\t\t\tON {$tbl_1d_pictures}.ID = p1.RefID\n\t\t\t\t\t\tAND p1.RefType = 'thumb'\n\t\t\t\t\n\t\t\t\tWHERE\t({$tbl_1d_videodvd_charts}.ID IS NOT NULL)\n\t\t\t\t\t\tAND ({$tbl_1d_videodvd_charts}.tsWhen <= (" . week() . "+604800))\n\t\t\t\t\t\tAND {$tbl_1d_charts}.ID = " . dbQuote($PARAM['id']) . "\n\t\t\t\t\n\t\t\t\tGROUP BY {$tbl_1d_videodvd_charts}.ID\n\t\t\t\t\n\t\t\t\tORDER BY ({$tbl_1d_videodvd_charts}.tsWhen > " . week() . ") DESC,\n\t\t\t\t\t{$tbl_1d_videodvd_charts}.No,\n\t\t\t\t\t{$tbl_1d_videodvd_charts}.tsWhen DESC,\n\t\t\t\t\tRAND()"; break; default: case 'kino': $query = "SELECT\t{$tbl_1d_charts}.ID,\n\t\t\t\t\t{$tbl_1d_charts}.Type,\n\t\t \t\t\t{$tbl_1d_charts}.Title AS a1,\n\n\t\t \t\t\t{$tbl_1d_kino_charts}.No,\n\t\t \t\t\t{$tbl_1d_kino_charts}.Type,\n\t\t \t\t\t{$tbl_1d_kino_charts}.Film,\n\n\t\t \t\t\t{$tbl_1d_films}.Title AS a2,\n\t\t \t\t\t{$tbl_1d_films}.OriginalTitle,\n\t\t \t\t\t{$tbl_1d_films}.Actors,\n\n\t\t \t\t\t{$tbl_1d_kino_charts}.BoxOffice,\n\t\t \t\t\t{$tbl_1d_kino_charts}.cumBoxOffice,\n\t\t \t\t\t{$tbl_1d_kino_charts}.Weeks,\n\t\t \t\t\t{$tbl_1d_kino_charts}.Screens,\n\t\t \t\t\t{$tbl_1d_kino_charts}.tsWhen,\n\n\t\t \t\t\t{$tbl_1d_pictures}.URL,\n\t\t\t\t\t{$tbl_1d_pictures}.Width,\n\t\t\t\t\t{$tbl_1d_pictures}.Height,\n\n\t\t\t\t\tp1.URL,\n\t\t\t\t\tp1.Width,\n\t\t\t\t\tp1.Height\n\n\t\t \t\tFROM {$tbl_1d_charts}\n\t\t\t\tLEFT JOIN {$tbl_1d_kino_charts}\n\t\t\t\t\tON {$tbl_1d_kino_charts}.ChartID = {$tbl_1d_charts}.ID\n\t\t\t\t\t\tAND {$tbl_1d_charts}.Type = 'kino'\n\n\t\t\t\tLEFT JOIN {$tbl_1d_films}\n\t\t\t\t\tON {$tbl_1d_kino_charts}.Film = {$tbl_1d_films}.ID\n\t\t\t\t\t\tAND {$tbl_1d_kino_charts}.Type = 'list'\n\t\t\t\t\t\t\n\t\t\t\tLEFT JOIN {$tbl_1d_pictures}\n\t\t\t\t\tON {$tbl_1d_pictures}.RefID = {$tbl_1d_films}.ID\n\t\t\t\t\t\tAND {$tbl_1d_pictures}.RefType = 'film'\n\t\t\t\tLEFT JOIN {$tbl_1d_pictures} AS p1\n\t\t\t\t\tON {$tbl_1d_pictures}.ID = p1.RefID\n\t\t\t\t\t\tAND p1.RefType = 'thumb'\n\t\t\t\t\n\t\t\t\tWHERE\t({$tbl_1d_kino_charts}.ID IS NOT NULL)\n\t\t\t\t\t\tAND ({$tbl_1d_kino_charts}.tsWhen <= (" . week() . "+604800))\n\t\t\t\t\t\tAND {$tbl_1d_charts}.ID = " . dbQuote($PARAM['id']) . "\n\t\t\t\t\n\t\t\t\tGROUP BY {$tbl_1d_kino_charts}.ID\n\t\t\t\t\n\t\t\t\tORDER BY ({$tbl_1d_kino_charts}.tsWhen > " . week() . ") DESC,\n\t\t\t\t\t{$tbl_1d_kino_charts}.No,\n\t\t\t\t\t{$tbl_1d_kino_charts}.tsWhen DESC,\n\t\t\t\t\tRAND()"; break; } $result = runQuery($query, 'showCharts()', 'GET_CHARTS_INFO'); $week = '0'; $chart = '0'; $path = getAdmSetting('UPLOAD_DIR'); $SUBS['ALIGN'] = 'absmiddle'; while ($row = db_fetch_row($result)) { switch ($row[1]) { case 'videodvd': $SUBS['CHART_TITLE'] = htmlEncode($row[2]); $SUBS['CHART_WEEK'] = showWeek($row[13]); if ($chart != $row[0]) { //pechatay zaglawie $SUBS['KLASACII'] .= fileParse('_index_charts_title.htmlt'); $chart = $row[0]; $week = $row[13]; } else { if (week($week) != week($row[13])) { continue; } } $SUBS['NO'] = sprintf('%02d', $row[3]); $SUBS['ACTORS'] = ''; if ($row['4'] != 'list') { $SUBS['TITLE'] = htmlEncode($row[5]); } else { $SUBS['FILMID'] = $row[5]; if ($row[6]) { $SUBS['TITLE'] = htmlEncode($row[6]); } else { $SUBS['TITLE'] = htmlEncode($row[7]); } $SUBS['ALT'] = $SUBS['TITLE']; $SUBS['TITLE'] = fileParse('_index_charts_link.htmlt'); $SUBS['ACTORS'] = htmlEncode($row[8]); } $SUBS['WEEKS'] = $row[11]; //kartinka, ako ima $SUBS['PIC'] = ''; if ($row[14]) { $SUBS['URL'] = $path . $row[14]; $SUBS['WIDTH'] = $row[15]; $SUBS['HEIGHT'] = $row[16]; $SUBS['TURL'] = $path . $row[17]; $SUBS['TWIDTH'] = $row[18]; $SUBS['THEIGHT'] = $row[19]; $SUBS['PIC'] = fileParse('_index_thumb.htmlt'); } $SUBS['KLASACII'] .= fileParse('_index_charts_videodvd.htmlt'); break; default: case 'kino': $SUBS['CHART_TITLE'] = htmlEncode($row[2]); $SUBS['CHART_WEEK'] = showWeek($row[13]); if ($chart != $row[0]) { //pechatay zaglawie $SUBS['KLASACII'] .= fileParse('_index_charts_title.htmlt'); $chart = $row[0]; $week = $row[13]; } else { if (week($week) != week($row[13])) { continue; } } $SUBS['NO'] = sprintf('%02d', $row[3]); $SUBS['ACTORS'] = ''; if ($row['4'] != 'list') { $SUBS['TITLE'] = htmlEncode($row[5]); } else { $SUBS['FILMID'] = $row[5]; if ($row[6]) { $SUBS['TITLE'] = htmlEncode($row[6]); } else { $SUBS['TITLE'] = htmlEncode($row[7]); } $SUBS['ALT'] = $SUBS['TITLE']; $SUBS['TITLE'] = fileParse('_index_charts_link.htmlt'); $SUBS['ACTORS'] = htmlEncode($row[8]); } $SUBS['BO'] = ''; while (ereg('([0-9]{1,3}$)', $row[9], $R)) { if (strlen($R[1]) < 3) { $SUBS['BO'] = "{$R['1']}" . $SUBS['BO']; } else { $SUBS['BO'] = ",{$R['1']}" . $SUBS['BO']; } $row[9] = ereg_replace('([0-9]{0,3}$)', '', $row[9]); } $SUBS['BO'] = ereg_replace('^,', '', $SUBS['BO']); $SUBS['CBO'] = ''; while (ereg('([0-9]{1,3}$)', $row[10], $R)) { if (strlen($R[1]) < 3) { $SUBS['CBO'] = "{$R['1']}" . $SUBS['CBO']; } else { $SUBS['CBO'] = ",{$R['1']}" . $SUBS['CBO']; } $row[10] = ereg_replace('([0-9]{0,3}$)', '', $row[10]); } $SUBS['CBO'] = ereg_replace('^,', '', $SUBS['CBO']); $SUBS['WEEKS'] = $row[11]; $SUBS['SCREENS'] = $row[12]; //kartinka, ako ima $SUBS['PIC'] = ''; if ($row[14]) { $SUBS['URL'] = $path . $row[14]; $SUBS['WIDTH'] = $row[15]; $SUBS['HEIGHT'] = $row[16]; $SUBS['TURL'] = $path . $row[17]; $SUBS['TWIDTH'] = $row[18]; $SUBS['THEIGHT'] = $row[19]; $SUBS['PIC'] = fileParse('_index_thumb.htmlt'); } $SUBS['KLASACII'] .= fileParse('_index_charts_kino.htmlt'); break; } } ////----[Mrasnika's] Edition 24.10.2002 // $SUBS['MORE'] = getBlock(1) . getBlock(2) . getBlock(3); if ($SUBS['KLASACII']) { $SUBS['MORE'] = getBlock(7); } else { $SUBS['CHARTS2'] = '<br>' . getBlock(7, 1) . '<br><br>'; $SUBS['MORE'] = getBlock(1) . getBlock(2) . getBlock(3) . getBlock(4); } index('_index_charts.htmlt'); }
/** * Private: Edit Poll * Edit a poll from Effect Web * * @return void */ private function loadEditPoll() { $GLOBALS['poll_exists'] = $this->loadCheckPoll($_GET['id']); if ($GLOBALS['poll_exists'] == true) { if ($_GET['write'] == true) { $date = explode("/", $_POST['expiration']); if (empty($_POST['fieldQuestion'])) { $GLOBALS['result_command'] = $this->lang->words['EWMain']['Polls']['EditPoll']['Messages']['FieldsVoid']; $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 1); } elseif (empty($_POST['answerCount']) || $_POST['answerCount'] < 2) { $GLOBALS['result_command'] = $this->lang->words['EWMain']['Polls']['EditPoll']['Messages']['AnswerError']; $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 2); } elseif (count($date) != 3) { $GLOBALS['result_command'] = $this->lang->words['EWMain']['Polls']['EditPoll']['Messages']['DateError']; $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 2); } else { $expiration = mktime(23, 59, 59, $date[0], $date[1], $date[2]); $break = 0; for ($i = 1; $i <= $_POST['answerCount']; $i++) { if (empty($_POST['Answer_' . $i]) || $_POST['VotesAnswers_' . $i] == NULL) { $break++; } } if ($break > 0) { $GLOBALS['result_command'] = $this->lang->words['EWMain']['Polls']['EditPoll']['Messages']['FieldsVoid']; $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 1); } else { $prepare = "UPDATE dbo.CTM_Polls SET Question = '%s', EndDate = %d, Status = %d WHERE Id = %d;\n"; for ($i = 1; $i <= $_POST['answerCount']; $i++) { if ($i > $_POST['answerAfterCount']) { $poll_id = intval($_GET['id']); $answer = htmlEncode($_POST['Answer_' . $i]); $votes = (int) $_POST['VotesAnswers_' . $i]; $prepare .= "INSERT INTO dbo.CTM_PollAnswers (PollID, Answer, Votes) VALUES ({$poll_id}, '{$answer}', {$votes});\n"; } else { if ($this->loadCheckAnswer($_POST['IdAnswer_' . $i], $_GET['id']) == true) { $answer_id = intval($_POST['IdAnswer_' . $i]); $poll_id = intval($_GET['id']); $answer = htmlEncode($_POST['Answer_' . $i]); $votes = (int) $_POST['VotesAnswers_' . $i]; $prepare .= "UPDATE dbo.CTM_PollAnswers SET Answer = '{$answer}', Votes = {$votes} WHERE Id = {$answer_id} AND PollID = {$poll_id};\n"; } } } $this->DB->Arguments(htmlEncode($_POST['fieldQuestion']), $expiration, $_POST['PollStatus'], intval($_GET['id'])); $this->DB->Query($prepare); $GLOBALS['result_command'] = $this->lang->words['EWMain']['Polls']['EditPoll']['Messages']['Success']; $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 3); } } } $find_poll_q = $this->DB->Query("SELECT * FROM dbo.CTM_Polls WHERE Id = " . intval($_GET['id'])); $find_poll = $this->DB->FetchObject($find_poll_q); $find_answers_q = $this->DB->Query("SELECT * FROM dbo.CTM_PollAnswers WHERE PollID = " . intval($_GET['id'])); $find_answers_c = $this->DB->CountRows($find_answers_q); $answers = array(); $i = 1; while ($find_answers = $this->DB->FetchObject($find_answers_q)) { $answers[$i++] = array("id" => intval($find_answers->Id), "answer" => $find_answers->Answer, "votes" => intval($find_answers->Votes)); } $GLOBALS['edit_poll'] = array("answer_after_count" => intval($find_answers_c), "question" => $find_poll->Question, "end_date" => date("m/d/Y", $find_poll->EndDate), "status" => intval($find_poll->Status), "answers" => $answers); unset($answers, $i); $this->lang->setArguments("EWMain,Polls,EditPoll,Title", $_GET['id']); } }
/** * Private: Edit Notice * Edit the notice from Effect Web * * @return void */ private function loadEditNotice() { $GLOBALS['notice_exists'] = $this->loadCheckNotice($_GET['id']); if ($GLOBALS['notice_exists'] == true) { if ($_GET['write'] == true) { if (empty($_POST['fieldTitle'])) { $GLOBALS['result_command'] = $this->lang->words['EWMain']['Notices']['EditNotice']['Messages']['TitleVoid']; $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 1); } elseif (empty($_POST['fieldText'])) { $GLOBALS['result_command'] = $this->lang->words['EWMain']['Notices']['EditNotice']['Messages']['TextVoid']; $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 1); } else { $update_columns = array("Title" => htmlEncode($_POST['fieldTitle']), "Text" => htmlEncode($_POST['fieldText']), "CommentSwitch" => $_POST['enableComments'] == true ? 1 : 0); if ($_POST['refreshDate'] == true) { $update_columns['Date'] = time(); } $this->DB->Update("CTM_Notices", $update_columns, "Id = " . intval($_GET['id'])); $GLOBALS['result_command'] = $this->lang->words['EWMain']['Notices']['EditNotice']['Messages']['Success']; $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 3); } } $select_notice = $this->DB->Select("*", "CTM_Notices", "Id = " . intval($_GET['id'])); $fetch_notice = $this->DB->FetchObject($select_notice); $GLOBALS['notice_data'] = array("id" => intval($_GET['id']), "title" => str_replace(array("<", ">"), array("<", ">"), htmlDecode($fetch_notice->Title)), "date" => date("d/m/Y", $fetch_notice->Date), "text" => str_replace(array("<", ">"), array("<", ">"), htmlDecode($fetch_notice->Text)), "comments_enabled" => $fetch_notice->CommentSwitch == 1); $this->lang->setArguments("EWMain,Notices,EditNotice,Title", $_GET['id']); } }
/** * Init Module * * @return void */ public function initSection() { $this->DB->Arguments($_GET['id']); $find_ticket_q = $this->DB->Query("SELECT * FROM dbo.CTM_Tickets WHERE Id = %d"); if ($this->DB->CountRows($find_ticket_q) > 0) { $ticket = $this->DB->FetchObject($find_ticket_q); define("EDIT_TICKET_ACCESS", $this->CheckPermissionItem("edit_ticket")); define("DELETE_TICKET_ACCESS", $this->CheckPermissionItem("delete_ticket")); switch ($_GET['cmd']) { case "annex": if (!empty($ticket->Annex)) { ini_set("memory_limit", "240M"); ob_end_clean(); $filename = "../" . $this->settings['WEBDATA']['UPLOADS']['DIRECTORY']['TICKET_ANNEX'] . $ticket->Annex; $fileext = substr($filename, strrpos($filename, ".")); if (preg_match("/\\.([gif|jpg|jpeg|png])/i", $fileext)) { switch ($fileext) { case ".gif": $image = imagecreatefromgif($filename); header("Content-type: image/gif"); imagegif($image); break; case ".png": $image = imagecreatefrompng($filename); header("Content-type: image/png"); imagepng($image); break; case ".jpg": $image = imagecreatefromjpeg($filename); header("Content-type: image/jpeg"); imagejpeg($image); break; case ".jpeg": $image = imagecreatefromjpeg($filename); header("Content-type: image/jpeg"); imagejpeg($image); break; } imagedestroy($image); } else { header("Content-type: text/plain"); readfile($filename); } } exit; break; case "close": if ($ticket->Status == 3) { if ($_GET['return'] == true) { exit("<script>location.href='?app=support&do=tickets&load=isClosed';</script>"); } else { exit(adminShowMessage($this->lang->words['EWSupport']['Tickets']['ViewTicket']['CloseTicket']['Messages']['TicketClosed'], 2)); } } else { $this->DB->Arguments($_GET['id']); $this->DB->Query("UPDATE dbo.CTM_Tickets SET Status = 3 WHERE Id = %d"); if ($_GET['return'] == true) { exit("<script>location.href='?app=support&do=tickets&load=closed';</script>"); } else { exit("<script>closeThisTicket();</script>"); } } break; case "reply": if (empty($_POST['ReplyText'])) { exit(adminShowMessage($this->lang->words['EWSupport']['Tickets']['ViewTicket']['ReplyTicket']['Messages']['TextVold'], 2)); } else { $sendDate = time(); $this->DB->Arguments($_GET['id'], $this->member['account']['data']['Name'], USER_ACCOUNT, $sendDate, htmlEncode($_POST['ReplyText'])); $this->DB->Query("INSERT INTO dbo.CTM_TicketReplies (TicketID, Author, Account, [Date], Message) VALUES (%d, '%s', '%s', %d, '%s')"); $this->DB->Arguments($_GET['id']); $this->DB->Query("UPDATE dbo.CTM_Tickets SET Status = 1 WHERE Id = %d"); $id = $this->DB->GetLastedId(); exit("<script>addReplyTicket('" . str_replace("'", "\\'", $_POST['ReplyText']) . "','" . $this->member['account']['data']['Name'] . "','" . date("d/m/Y - H:i", $sendDate) . "',{$id});</script>"); } break; case "edit": if (EDIT_TICKET_ACCESS) { if (empty($_POST['Subject']) || empty($_POST['Message'])) { exit(adminShowMessage($this->lang->words['EWSupport']['Tickets']['ViewTicket']['EditTicket']['Messages']['FieldsVold'], 1)); } $this->DB->Arguments(htmlEncode($_POST['Subject']), $_POST['Departament'], $_POST['Status'], htmlEncode($_POST['Message']), $_GET['id']); $this->DB->Query("UPDATE dbo.CTM_Tickets SET Subject = '%s',Departament = %d,Status = %d,Text = '%s' WHERE Id = %d"); switch ($_POST['Status']) { case 0: $status = "<span style='color: blue;'>" . $this->lang->words['EWSupport']['Tickets']['Status']['Opened'] . "</span>"; break; case 1: $status = "<span style='color: green;'>" . $this->lang->words['EWSupport']['Tickets']['Status']['Responded'] . "</span>"; break; case 2: $status = "<span style='color: orange;'>" . $this->lang->words['EWSupport']['Tickets']['Status']['Progress'] . "</span>"; break; case 3: $status = "<span style='color: red;'>" . $this->lang->words['EWSupport']['Tickets']['Status']['Closed'] . "</span>"; break; } $return = "<script>completeEditTicket("; $return .= "'" . str_replace("'", "\\'", htmlDecode(htmlEncode($_POST['Subject']), TRUE)) . "',"; $return .= "'" . str_replace("'", "\\'", $this->settings['USERPANEL']['SUPPORT']['TICKETS']['DEPARTAMENTS'][$_POST['Departament']]) . "',"; $return .= "'" . str_replace("'", "\\'", $status) . "',"; $return .= "'" . str_replace("'", "\\'", htmlDecode(htmlEncode($_POST['Message']), TRUE)) . "'"; $return .= ");</script>"; exit($return); } break; case "delete": if (DELETE_TICKET_ACCESS) { $query = "DELETE FROM dbo.CTM_Tickets WHERE Id = %d;\n"; $query .= "DELETE FROM dbo.CTM_TicketReplies WHERE TicketID = %d;"; $this->DB->Arguments($_GET['id'], $_GET['id']); $this->DB->Query($query); if (!empty($ticket->Annex)) { if (file_exists("../" . $this->settings['WEBDATA']['UPLOADS']['DIRECTORY']['TICKET_ANNEX'] . $ticket->Annex)) { unlink("../" . $this->settings['WEBDATA']['UPLOADS']['DIRECTORY']['TICKET_ANNEX'] . $ticket->Annex); } } exit("<script>location.href='" . $this->acp_vars['acp_url'] . "?app=effectweb&module=support§ion=tickets&message=deleted';</script>"); } break; case "editReply": $this->DB->Arguments($_GET['rid'], $_GET['id']); $query = $this->DB->Query("SELECT Id,Message FROM dbo.CTM_TicketReplies WHERE Id = %d AND TicketID = %d"); if ($this->DB->CountRows($query) > 0) { if ($_GET['write'] == TRUE) { if (empty($_POST['ReplyMessage'])) { exit(adminShowMessage($this->lang->words['EWSupport']['Tickets']['ViewTicket']['EditReply']['Messages']['FieldVoid'], 1)); } $this->DB->Arguments(htmlEncode($_POST['ReplyMessage']), $_GET['rid'], $_GET['id']); $this->DB->Query("UPDATE dbo.CTM_TicketReplies SET Message = '%s' WHERE Id = %d AND TicketID = %d"); exit("<script>editTicketReply('" . str_replace(array("\n", "\r"), NULL, $_POST['ReplyMessage']) . "'," . $_GET['rid'] . ");</script>"); } else { $reply = $this->DB->FetchArray($query); $noOpenCache = TRUE; $GLOBALS['edit_reply']['ticket_id'] = $_GET['id']; $GLOBALS['edit_reply']['reply_id'] = $_GET['rid']; $GLOBALS['edit_reply']['reply_message'] = str_replace(array("\n", "\r"), NULL, htmlDecode($reply['Message'], true)); $this->output->setContent("tickets_viewTicket_editReply"); $this->output->setVariable("no_set_temp", true); } } else { exit; } break; case "deleteReply": $this->DB->Arguments($_GET['rid'], $_GET['id']); $query = $this->DB->Query("SELECT Id FROM dbo.CTM_TicketReplies WHERE Id = %d AND TicketID = %d"); if ($this->DB->CountRows($query) > 0) { $this->DB->Arguments($_GET['rid'], $_GET['id']); $this->DB->Query("DELETE FROM dbo.CTM_TicketReplies WHERE Id = %d AND TicketID = %d"); exit("<script>" . "\$" . "('#replyId-" . $_GET['rid'] . "').hide('slow');</script>"); } exit; break; } $this->DB->Arguments($_GET['id']); $query = $this->DB->Query("SELECT * FROM dbo.CTM_TicketReplies WHERE TicketID = %d"); $replies = array(); if ($this->DB->CountRows($query) > 0) { while ($reply = self::DB()->FetchObject($query)) { $replies[$reply->Id] = array("author" => $reply->Author, "is_team" => $this->functions->CheckTeamACP($reply->Account), "send_date" => date("d/m/Y - G:i a", $reply->Date), "message" => htmlDecode($reply->Message, true)); } } $GLOBALS['view_ticket'] = array("id" => $ticket->Id, "subject" => $ticket->Subject, "departament" => array("id" => $ticket->Departament, "title" => $this->settings['USERPANEL']['SUPPORT']['TICKETS']['DEPARTAMENTS'][$ticket->Departament]), "open_date" => date("d/m/Y - G:i a", $ticket->Date), "account" => $ticket->Account, "character" => $ticket->Character, "message" => nl2br(htmlDecode($ticket->Text)), "status" => $ticket->Status, "protocol" => $ticket->Protocol, "annex" => $ticket->Annex, "replies" => $replies); if ($noOpenCache == false) { $this->output->setContent("tickets_viewTicket"); } } }
/** * Option: Invoices * Invoices of payments * * @return void */ public function Invoices() { switch ($_GET['section'] ? $_GET['section'] : $this->URLData[2]) { case "list": $this->DB->Arguments(USER_ACCOUNT); $this->DB->Query("SELECT Id, Document, Status, StartDate, [Value], CoinQuantity FROM dbo.CTM_Invoices WHERE Account = '%s' ORDER BY Id DESC", $all_invoices_q); $invoices_opened = array(); $invoices_finalized = array(); $invoices_canceled = array(); if ($this->DB->CountRows($all_invoices_q) > 0) { while ($all_invoices = $this->DB->FetchObject($all_invoices_q)) { switch ($all_invoices->Status) { case 0: $var_name = "invoices_opened"; $status = "<span style='color: #C00;'>" . $this->lang->words['UserPanel']['Invoices']['Status']['Pending'] . "</span>"; break; case 1: $var_name = "invoices_opened"; $status = "<span style='color: blue;'>" . $this->lang->words['UserPanel']['Invoices']['Status']['InProgress'] . "</span>"; break; case 2: $var_name = "invoices_finalized"; $status = "<span style='color: green;'>" . $this->lang->words['UserPanel']['Invoices']['Status']['Paid'] . "</span>"; break; case 3: $var_name = "invoices_finalized"; $status = "<span style='color: red;'>" . $this->lang->words['UserPanel']['Invoices']['Status']['Rejected'] . "</span>"; break; case 4: $var_name = "invoices_canceled"; $status = "<span style='color: #CCC;'>" . $this->lang->words['UserPanel']['Invoices']['Status']['Canceled'] . "</span>"; break; } ${$var_name}[$all_invoices->Id] = array("document" => $all_invoices->Document, "quantity" => number_format($all_invoices->CoinQuantity, 0, false, ".") . " " . COIN_NAME_1, "value" => CTM_Text::MoneyFormat(MONEY_SYMBOL, $all_invoices->Value), "date" => date("d/m/Y - h:i a", $all_invoices->StartDate), "status" => $status); } } $GLOBALS['userpanel']['invoices']['auto_load_invoice'] = $_GET['showinvoice'] ? $_GET['showinvoice'] : $this->URLData[3]; $GLOBALS['userpanel']['invoices']['list_invoices'] = array("opened" => $invoices_opened, "finalized" => $invoices_finalized, "canceled" => $invoices_canceled); unset($invoices_opened); unset($invoices_finalized); unset($invoices_canceled); return $this->LoadPage("option_invoices_list", true); break; case "show": $invoice_id = intval($_GET['id'] ? $_GET['id'] : $this->URLData[3]); $section = $_GET['do'] ? $_GET['do'] : $this->URLData[4]; $this->DB->Arguments($invoice_id, USER_ACCOUNT); $this->DB->Query("SELECT * FROM dbo.CTM_Invoices WHERE Id = %d AND Account = '%s'", $get_invoice); if ($this->DB->CountRows($get_invoice) < 1) { return exit(showMessage(sprintf($this->lang->words['UserPanel']['Invoices']['ErrorMessage'], CoreVariables::ErrorsCode()->PaymentNotFound), 2)); } $invoice = $this->DB->FetchObject($get_invoice); if ($section) { switch ($section) { case "payment": $this->DB->Arguments($invoice_id, USER_ACCOUNT); $this->DB->Query("SELECT * FROM dbo.CTM_Payments WHERE InvoiceId = %d AND Account = '%s'", $get_payment); if ($this->DB->CountRows($get_payment) < 1) { if ($invoice->Status != 0 && $invoice->Status != 3) { exit(showMessage($this->lang->words['UserPanel']['Invoices']['ShowInvoice']['Messages']['InvoiceInProgress'], 0)); } $method = strlen($_GET['method']) > 0 ? $_GET['method'] : $this->URLData[5]; if (strlen($method) < 1 || !array_key_exists($method, $this->settings['PAYMENTMETHOD']['FORM'])) { $GLOBALS['userpanel']['payments']['confirm_payment']['invoice_id'] = $invoice_id; if ($_GET['write'] == true) { exit(showMessage($this->lang->words['UserPanel']['Payments']['ConfirmPayment']['Messages']['SelectMethod'], 2)); } return $this->LoadPage("option_payments_confirm", true); } else { $error = $this->LoadClass("Error", "class_sources"); $method = intval($method); if ($_GET['write'] == true) { if (empty($_POST['Date'])) { $error->addError($this->lang->words['UserPanel']['Payments']['ConfirmPayment']['Messages']['DateVoid'], 0); } if (empty($_POST['Hour'])) { $error->addError($this->lang->words['UserPanel']['Payments']['ConfirmPayment']['Messages']['HourVoid'], 0); } if (empty($_POST['Value'])) { $error->addError($this->lang->words['UserPanel']['Payments']['ConfirmPayment']['Messages']['ValueVoid'], 0); } if (empty($_POST['Local'])) { $error->addError($this->lang->words['UserPanel']['Payments']['ConfirmPayment']['Messages']['LocalVoid'], 0); } foreach ($this->settings['PAYMENTMETHOD']['FORM'][$method][1] as $key => $value) { if (empty($_POST[$key])) { $error->addError(htmlEncode($value), 0); } } if ($error->count[0] > 0) { $_error = "<strong>" . $this->lang->words['UserPanel']['Payments']['ConfirmPayment']['Messages']['VoidMessage'] . "<strong><br />"; exit(showMessage($_error . "<br />" . $error->showError(0), 1)); } else { if ($_POST['u_sendFile'] == 1) { if ($_POST['u_ready'] == 1) { $name = str_pad($this->DB->GetCurrentId("CTM_Payments") + 1, 10, 0, STR_PAD_LEFT); $size = $this->settings['WEBDATA']['UPLOADS']['FILESIZE']['PAYMENT_ANNEX']; $dir = CTM_ROOT_PATH . $this->settings['WEBDATA']['UPLOADS']['DIRECTORY']['PAYMENT_ANNEX']; Uploadify::set("Filedata", $size, array("gif", "jpg", "jpeg", "png"), $name, $dir, $session); exit("<script>startUpload('{$name}', '{$session}');</script>"); } else { $data = unserialize(base64_decode($_POST['u_fileUploaded'])); $annex = $data['parsed_file_name']; if (!$data) { exit(showMessage($this->lang->words['UserPanel']['Payments']['ConfirmPayment']['Messages']['AnnexError'], 2)); } elseif ($data['error_no'] == 2) { $this->lang->setArguments("UserPanel,Payments,ConfirmPayment,Messages,ErrorFormat", "<b>JPEG</b>, <b>GIF</b>, <b>PNG</b>"); exit(showMessage($this->lang->words['UserPanel']['Payments']['ConfirmPayment']['Messages']['ErrorFormat'], 2)); } elseif ($data['error_no'] == 3) { $this->lang->setArguments("UserPanel,Payments,ConfirmPayment,Messages,ErrorSize", "<b>" . $data['max_file_size'] . "</b>"); exit(showMessage($this->lang->words['UserPanel']['Payments']['ConfirmPayment']['Messages']['ErrorSize'], 2)); } elseif ($data['error_no'] != 0) { exit(showMessage($this->lang->words['UserPanel']['Payments']['ConfirmPayment']['Messages']['AnnexError'], 2)); } } } $payment_data = array(); foreach ($this->settings['PAYMENTMETHOD']['FORM'][$method][1] as $key => $value) { $payment_data[$key] = utf8_encode($_POST[$key]); } $columns_insert = array("Account" => USER_ACCOUNT, "InvoiceId" => $invoice_id, "Status" => 0, "ConfirmDate" => time(), "Method" => $method, "Date" => $_POST['Date'], "Hour" => $_POST['Hour'], "Value" => $_POST['Value'], "Local" => utf8_encode($_POST['Local']), "ConfirmData" => serialize($payment_data), "Message" => htmlEncode(nl2br(strip_tags($_POST['Message']))), "Annex" => $annex); $this->DB->ForceDataType("InvoiceId", "integer"); $this->DB->ForceDataType("Status", "integer"); $this->DB->ForceDataType("ConfirmDate", "integer"); $this->DB->ForceDataType("Method", "integer"); $this->DB->ForceDataType("Message", empty($_POST['Message']) ? "null" : "string"); $this->DB->ForceDataType("Annex", empty($annex) ? "null" : "string"); $this->DB->Insert("CTM_Payments", $columns_insert); $this->DB->Arguments($invoice_id); $this->DB->ForceDataType("Status", "integer"); $this->DB->Update("CTM_Invoices", array("Status" => 1, "PaymentMethod" => "bank"), "Id = %d"); return exit(showMessage($this->lang->words['UserPanel']['Payments']['ConfirmPayment']['Messages']['Success'], 3)); } } $inputs = array(); foreach ($this->settings['PAYMENTMETHOD']['FORM'][$method][1] as $key => $value) { $inputs[$key] = htmlEncode($value); } $GLOBALS['userpanel']['payments']['confirm_payment'] = array("invoice_id" => $invoice_id, "method_name" => htmlEncode($this->settings['PAYMENTMETHOD']['FORM'][$method][0]), "method_id" => $method, "method_fields" => $inputs); return $this->LoadPage("option_payments_confirm_form", true); } } else { $payment = $this->DB->FetchObject($get_payment); switch ($payment->Status) { case 0: $status = "<span style='color: blue;'>" . $this->lang->words['UserPanel']['Payments']['Status']['Opened'] . "</span>"; break; case 1: $status = "<span style='color: green;'>" . $this->lang->words['UserPanel']['Payments']['Status']['Confirmed'] . "</span>"; break; case 2: $status = "<span style='color: red;'>" . $this->lang->words['UserPanel']['Payments']['Status']['Rejected'] . "</span>"; break; } if (!($payment_data = unserialize($payment->ConfirmData))) { $payment_data = array(); } $GLOBALS['userpanel']['payments']['show_payment'] = array("id" => $payment_id, "method" => htmlEncode($this->settings['PAYMENTMETHOD']['FORM'][$payment->Method][0]), "confirm_date" => date("d/m/Y - h:i a", $payment->ConfirmDate), "status" => $status, "quantity" => number_format($payment->Quantity, 0, false, ".") . " " . COIN_NAME_1, "date" => $payment->Date, "hour" => $payment->Hour, "value" => $payment->Value, "local" => utf8_decode($payment->Local), "message" => htmlDecode($payment->Message), "payment_data" => $payment_data); if (strlen($payment->Annex) > 1) { $GLOBALS['userpanel']['payments']['show_payment']['annex'] = array("link" => $this->settings['WEBDATA']['UPLOADS']['DIRECTORY']['PAYMENT_ANNEX'] . $payment->Annex, "name" => $payment->Annex); } return $this->LoadPage("option_payments_show", true); } break; } } switch ($invoice->Status) { case 0: $status = "<span style='color: #C00;'>" . $this->lang->words['UserPanel']['Invoices']['Status']['Pending'] . "</span>"; break; case 1: $status = "<span style='color: blue;'>" . $this->lang->words['UserPanel']['Invoices']['Status']['InProgress'] . "</span>"; break; case 2: $status = "<span style='color: green;'>" . $this->lang->words['UserPanel']['Invoices']['Status']['Paid'] . "</span>"; break; case 3: $status = "<span style='color: red;'>" . $this->lang->words['UserPanel']['Invoices']['Status']['Rejected'] . "</span>"; break; case 4: $status = "<span style='color: #CCC;'>" . $this->lang->words['UserPanel']['Invoices']['Status']['Canceled'] . "</span>"; break; } $GLOBALS['userpanel']['invoices']['show_invoice'] = array("id" => $invoice_id, "document" => $invoice->Document, "start_date" => date("d/m/Y - h:i a", $invoice->StartDate), "quantity" => number_format($invoice->CoinQuantity, 0, false, "."), "value" => CTM_Text::MoneyFormat(MONEY_SYMBOL, $invoice->Value), "status" => $status, "canceled" => $invoice->Status == 4); if ($invoice->Status > 0 && $invoice->PaymentMethod != "none") { if (!($payment_data = unserialize($invoice->PaymentData))) { $payment_data = array(); } switch ($invoice->PaymentMethod) { case "bank": $method_name = $this->lang->words['UserPanel']['Invoices']['Methods']['Bank']; break; } $GLOBALS['userpanel']['invoices']['show_invoice']['payment_method'] = array("method" => $method_name, "data" => $payment_data, "key" => $invoice->PaymentMethod); } $this->lang->setArguments("UserPanel,Invoices,ShowInvoice,Title", $invoice_id); return $this->LoadPage("option_invoices_show", true); break; case "open": if ($this->settings['USERPANEL']['FINANCIAL']['INVOICES']['LIMIT_OPENED'] > 0) { $this->DB->Arguments(USER_ACCOUNT); $this->DB->Query("SELECT 1 FROM dbo.CTM_Invoices WHERE Account = '%s' AND Status < 2", $count_invoices); if ($this->DB->CountRows($count_invoices) >= $this->settings['USERPANEL']['FINANCIAL']['INVOICES']['LIMIT_OPENED']) { $limit = $this->settings['USERPANEL']['FINANCIAL']['INVOICES']['LIMIT_OPENED']; exit(showMessage(sprintf($this->lang->words['UserPanel']['Invoices']['OpenInvoice']['Messages']['LimitReached'], $limit), 2)); } } if ($_GET['write'] == true) { if (empty($_POST['Quantity'])) { exit(showMessage($this->lang->words['UserPanel']['Invoices']['OpenInvoice']['Messages']['QuantityVoid'], 1)); } if (!is_numeric($_POST['Quantity'])) { exit(showMessage($this->lang->words['UserPanel']['Invoices']['OpenInvoice']['Messages']['QuantitySyntax'], 2)); } $_POST['Quantity'] = ltrim($_POST['Quantity'], 0); $money_value = COIN_PRICE * $_POST['Quantity']; if (strstr($money_value, ".")) { list($note, $coin) = explode(".", $money_value); if (strlen($coin) > 2) { $coin = substr($coin, 0, 2); } while ($coin % 5 != 0 && $coin > 0) { if ($coin < 5 && $coin > 0) { $coin = 5; } else { $coin++; } } if (strlen($coin) == 1) { $coin = "0" . $coin; } $final_money = $note . "." . $coin; } else { $final_money = $money_value . ".00"; } if ($_GET['confirm'] == true) { $insert_columns = array("Account" => USER_ACCOUNT, "StartDate" => time(), "EndDate" => 0, "Value" => $final_money, "CoinQuantity" => $_POST['Quantity'], "Status" => 0); $this->DB->Insert("CTM_Invoices", $insert_columns); $last_id = $this->DB->GetLastedId(); $this->DB->Update("CTM_Invoices", array("Document" => INVOICE_PREFIX . $last_id), "Id = " . $last_id); exit("<script>runOpenInvoice({$last_id});</script>"); } else { exit("<script>showConfirmMessage('" . CTM_Text::MoneyFormat(MONEY_SYMBOL, $final_money) . "');</script>"); } } $GLOBALS['default_value'] = str_replace(MONEY_SYMBOL . " ", NULL, CTM_Text::MoneyFormat(MONEY_SYMBOL, COIN_PRICE)); return $this->LoadPage("option_invoices_open", true); break; default: if ($_GET['showinvoice']) { $GLOBALS['userpanel']['invoices']['auto_load_invoice'] = $_GET['showinvoice']; } elseif (strstr($this->URLData[2], "showinvoice-")) { $GLOBALS['userpanel']['invoices']['auto_load_invoice'] = str_replace("showinvoice-", NULL, $this->URLData[2]); } break; } }
/** * Private: Edit Task * Edit the task registed * * @return void */ private function loadEditTask() { $GLOBALS['cronTasks'] = array(); $GLOBALS['task_error'] = 0; $this->DB->Arguments($_GET['id']); $this->DB->Query("SELECT 1 FROM dbo.CTM_CronJob WHERE Id = %d", $checkTask); if ($this->DB->CountRows($checkTask) < 1) { return $GLOBALS['task_error'] = 1; } $open_dir = opendir(CTM_ROOT_PATH . "modules/tasks"); $tasks = array(); if (!$open_dir) { return $GLOBALS['task_error'] = 2; } while ($read_dir = readdir($open_dir)) { $extension = substr($read_dir, -9, 9); if ($extension == ".task.php") { $tasks[] = substr($read_dir, 0, strlen($read_dir) - 9); } } if (count($tasks) < 1) { return $GLOBALS['task_error'] = 2; } $GLOBALS['cronTasks'] = $tasks; if ($_GET['write'] == true) { if (empty($_POST['TaskName'])) { $GLOBALS['result_command'] = adminShowMessage($this->lang->words['System']['CronJob']['AddTask']['Messages']['NameVoid'], 1); } elseif (!in_array($_POST['TaskFile'], $tasks)) { $GLOBALS['result_command'] = adminShowMessage($this->lang->words['System']['CronJob']['AddTask']['Messages']['InvalidFile'], 2); } else { if (empty($_POST['EveryDays'])) { $_POST['EveryDays'] = 0; $count++; } if (empty($_POST['EveryWeeks'])) { $_POST['EveryWeeks'] = 0; $count++; } if (empty($_POST['EveryMonths'])) { $_POST['EveryMonths'] = 0; $count++; } if (empty($_POST['EveryHours'])) { $_POST['EveryHours'] = 0; $count++; } if (empty($_POST['EveryMinutes'])) { $_POST['EveryMinutes'] = 0; $count++; } if ($count == 5) { $GLOBALS['result_command'] = adminShowMessage($this->lang->words['System']['CronJob']['AddCronTab']['Messages']['SetOccur'], 2); } else { $time = time(); $occurOptions = $_POST['EveryDays'] . ","; $occurOptions .= $_POST['EveryWeeks'] . ","; $occurOptions .= $_POST['EveryMonths'] . ","; $occurOptions .= $_POST['EveryHours'] . ","; $occurOptions .= $_POST['EveryMinutes']; $beginDate = 0; $endDate = 0; if ($_POST['BeginDate']) { $date = explode("/", $_POST['BeginDate']); $hour = $_POST['BeginHour'] ? explode(":", $_POST['BeginHour']) : array(date("H"), date("i")); $beginDate = mktime($hour[0], $hour[1], 0, $date[0], $date[1], $date[2]); } if ($_POST['EndDate']) { $date = explode("/", $_POST['EndDate']); $hour = $_POST['EndDate'] ? explode(":", $_POST['EndDate']) : array(23, 59); $endDate = mktime($hour[0], $hour[1], 0, $date[0], $date[1], $date[2]); } $beginDate = strlen($beginDate) != 10 ? 0 : $beginDate; $endDate = strlen($endDate) != 10 ? 0 : $endDate; if (!$_POST['EndEnable']) { $endDate = 0; } $update_columns = array("TaskName" => utf8_encode($_POST['TaskName']), "TaskDescription" => utf8_encode($_POST['TaskDescription']), "TaskFile" => $_POST['TaskFile'], "Switch" => $_POST['Switch'] == 1 ? 1 : 0, "NextExecution" => $time, "BeginDate" => $beginDate, "EndDate" => $endDate, "OccurOptions" => $occurOptions); $this->DB->ForceDataType("Switch", "integer"); $this->DB->ForceDataType("NextExecution", "integer"); $this->DB->ForceDataType("BeginDate", "integer"); $this->DB->ForceDataType("EndDate", "integer"); $this->DB->Arguments($_GET['id']); $this->DB->Update("CTM_CronJob", $update_columns, "Id = %d"); if ($_GET['run'] == true) { exit("<script>window.location = '?app=core&module=system§ion=cronjob&index=runTask&id={$id}';</script>"); } $GLOBALS['result_command'] = $this->lang->words['System']['CronJob']['EditTask']['Messages']['Success']; $GLOBALS['result_command'] = sprintf($GLOBALS['result_command'], $_GET['id'], date("d/m/Y - H:i:s", $beginDate)); $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 3); } } } $this->DB->Arguments($_GET['id']); $findCronTasksQ = $this->DB->Select("*", "CTM_CronJob", "Id = %d"); $findCronTask = $this->DB->FetchObject($findCronTaskQ); $GLOBALS['cron_task'] = array("id" => intval($findCronTask->Id), "name" => utf8_decode(htmlEncode($findCronTask->TaskName)), "description" => utf8_decode(htmlEncode($findCronTask->TaskDescription)), "file" => $findCronTask->TaskFile, "switch" => $findCronTask->Switch, "begin_date" => date("m/d/Y", $findCronTask->BeginDate), "begin_hour" => date("H:i", $findCronTask->BeginDate), "end_date" => strlen($findCronTask->EndDate) == 10 ? date("m/d/Y", $findCronTask->EndDate) : NULL, "end_hour" => strlen($findCronTask->EndDate) == 10 ? date("H:i", $findCronTask->EndDate) : "00:00", "end_enabled" => strlen($findCronTask->EndDate) == 10, "occur_options" => explode(",", $findCronTask->OccurOptions)); }
} if ($order->leftdays <= 0) { $order->leftdays = 0; } $slotsRaznica = $newSlots - $order->slots; if ($slotsRaznica > 0) { $money = $order->leftdays * ($tarif->cost * $slotsRaznica / 30); $money = round($money, 2); } # else if ($slotsRaznica < 0) { # $money = $order->leftdays * (($tarif->cost*(-$slotsRaznica))/30); # $money = round(-$money, 2); # } if ($money > 0) { $history = "<B>{$tarif->name}</b><BR><B>{$order->slots}</b> => <B>{$newSlots}</B>"; @mysql_query("insert into bills (uid,tarif,host_id,money_host,created,newslots,history) values('{$order->uid}','{$tarif->id}','{$order->id}','{$money}',NOW(),'{$newSlots}','" . htmlEncode($history) . "')") or die("File: " . __FILE__ . "<BR>Line: " . __LINE__ . "<BR>MySQL Error: " . mysql_error()); $billId = mysql_insert_id(); mclose(); Header("Location: billing.php?do=pay&fromchangeslots=1&id={$billId}"); exit; } else { # if ($money < 0) { # $money = -$money; # @mysql_query("update users set money=money+$money where id='".$_SESSION["userId"]."'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error()); # } if (changeSlots($host_id, $newSlots)) { @mysql_query("update orders set slots='{$newSlots}' where id='{$host_id}'") or die("File: " . __FILE__ . "<BR>Line: " . __LINE__ . "<BR>MySQL Error: " . mysql_error()); addUserLog($_SESSION["userId"], 'changeslots', "For order ID #{$order->id}, {$order->domain}, {$tarif->name}, from {$order->slots} to {$newSlots}"); head('utf-8', $_lang[ChangeSlotsTitle]); print "<H1 class=pagetitle>" . $_lang[ChangeSlotsTitle] . "</H1><hr class=hr>"; print $_lang[ChangeSlotsChangeSuccess];
/** * Private: Create Team Group * Create the new team group * * @return void */ private function loadCreateTeamGroup() { if ($_GET['write'] == true) { if (empty($_POST['Name']) || empty($_POST['GroupTitle'])) { $GLOBALS['result_command'] = $this->lang->words['Members']['Team']['Groups']['CreateGroup']['Messages']['FieldsVoid']; $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 1); } else { $insert_columns = array("Name" => utf8_encode($_POST['Name']), "FormatPrefix" => htmlEncode($_POST['FormatPrefix']), "FormatSuffix" => htmlEncode($_POST['FormatSuffix']), "GroupTitle" => utf8_encode($_POST['GroupTitle']), "ACP_Access" => $_POST['ACP_Access'] == 1 ? 1 : 0); if (empty($_POST['FormatPrefix'])) { $this->DB->ForceDataType("FormatPrefix", "null"); } if (empty($_POST['FormatSuffix'])) { $this->DB->ForceDataType("FormatSuffix", "null"); } $this->DB->Insert("CTM_TeamGroups", $insert_columns); $group_id = $this->DB->GetLastedId(); $GLOBALS['result_command'] = $this->lang->words['Members']['Team']['Groups']['CreateGroup']['Messages']['Success']; $GLOBALS['result_command'] = adminShowMessage(sprintf($GLOBALS['result_command'], $group_id), 3); $GLOBALS['_success'] = TRUE; } if ($GLOBALS['_success'] == true) { $this->lang->setArguments("Members,Team,Groups,CreateGroup,SetPermission", $this->vars['acp_url'] . "?app=core&module=members&section=team&index=setPermissions&do=group&id=" . $group_id); } } }
public function getInputs() { $inputs = ' <form action="' . $this->oTpe->sUrlPaiement . '" method="post" id="PaymentRequest"> <input type="hidden" name="version" id="version" value="' . $this->oTpe->sVersion . '" /> <input type="hidden" name="TPE" id="TPE" value="' . $this->oTpe->sNumero . '" /> <input type="hidden" name="date" id="date" value="' . $this->sDate . '" /> <input type="hidden" name="montant" id="montant" value="' . $this->sMontant . $this->sDevise . '" /> <input type="hidden" name="reference" id="reference" value="' . $this->sReference . '" /> <input type="hidden" name="MAC" id="MAC" value="' . $this->sMac . '" /> <input type="hidden" name="url_retour" id="url_retour" value="' . route($this->oTpe->sUrlKO) . '" /> <input type="hidden" name="url_retour_ok" id="url_retour_ok" value="' . route($this->oTpe->sUrlOK) . '" /> <input type="hidden" name="url_retour_err" id="url_retour_err" value="' . route($this->oTpe->sUrlKO) . '" /> <input type="hidden" name="lgue" id="lgue" value="' . $this->oTpe->sLangue . '" /> <input type="hidden" name="societe" id="societe" value="' . $this->oTpe->sCodeSociete . '" /> <input type="hidden" name="texte-libre" id="texte-libre" value="' . htmlEncode($this->sTexteLibre) . '" /> <input type="hidden" name="mail" id="mail" value="' . $this->sEmail . '" />'; if ($this->sNbrEch != '') { $inputs .= ' <input type="hidden" name="nbrech" id="nbrech" value="' . $this->sNbrEch . '" /> <input type="hidden" name="dateech1" id="dateech1" value="' . $this->sDateEcheance1 . ' /> <input type="hidden" name="montantech1" id="montantech1" value="' . $this->sMontantEcheance1 . '" /> <input type="hidden" name="dateech2" id="dateech2" value="' . $this->sDateEcheance2 . ' /> <input type="hidden" name="montantech2" id="montantech2" value="' . $this->sMontantEcheance2 . '" /> <input type="hidden" name="dateech3" id="dateech3" value="' . $this->sDateEcheance3 . ' /> <input type="hidden" name="montantech3" id="montantech3" value="' . $this->sMontantEcheance3 . '" /> <input type="hidden" name="dateech4" id="dateech4" value="' . $this->sDateEcheance4 . ' /> <input type="hidden" name="montantech4" id="montantech4" value="' . $this->sMontantEcheance4 . '" />'; } return $inputs; }
/** * Register Account * * @return void */ private function loadRegisterAccount() { if ($_GET['write'] == true) { if ($_POST['Terms'] != 1) { setResult(showMessage($this->lang->words['Register']['Register']['Messages']['CheckTerms'], 2)); } else { $error = NULL; $finishRegister = FALSE; $PID = $this->settings['REGISTER']['REGISTER_PID']; /* Variables to lower */ $_POST['Login'] = strtolower($_POST['Login']); $_POST['Mail'] = strtolower($_POST['Mail']); $_POST['CMail'] = strtolower($_POST['CMail']); /* Check Void Fields */ if (empty($_POST['Login'])) { $error .= "» " . $this->lang->words['Register']['Register']['Messages']['NULL_Login'] . "<br />\n"; } if (empty($_POST['Password'])) { $error .= "» " . $this->lang->words['Register']['Register']['Messages']['NULL_Password'] . "<br />\n"; } if (empty($_POST['CPassword'])) { $error .= "» " . $this->lang->words['Register']['Register']['Messages']['NULL_CPassword'] . "<br />\n"; } if (empty($_POST['Mail'])) { $error .= "» " . $this->lang->words['Register']['Register']['Messages']['NULL_Mail'] . "<br />\n"; } if (empty($_POST['CMail'])) { $error .= "» " . $this->lang->words['Register']['Register']['Messages']['NULL_CMail'] . "<br />\n"; } if (empty($_POST['PersonalID']) && $PID) { $error .= "» " . $this->lang->words['Register']['Register']['Messages']['NULL_PID'] . "<br />\n"; } if (empty($_POST['Name'])) { $error .= "» " . $this->lang->words['Register']['Register']['Messages']['NULL_Name'] . "<br />\n"; } if (empty($_POST['Phone'])) { $error .= "» " . $this->lang->words['Register']['Register']['Messages']['NULL_Phone'] . "<br />\n"; } if (empty($_POST['Sex'])) { $error .= "» " . $this->lang->words['Register']['Register']['Messages']['NULL_Sex'] . "<br />\n"; } if (empty($_POST['BirthDay'])) { $error .= "» " . $this->lang->words['Register']['Register']['Messages']['NULL_BirthDay'] . "<br />\n"; } if (empty($_POST['BirthMonth'])) { $error .= "» " . $this->lang->words['Register']['Register']['Messages']['NULL_BirthMonth'] . "<br />\n"; } if (empty($_POST['BirthYear'])) { $error .= "» " . $this->lang->words['Register']['Register']['Messages']['NULL_BirthYear'] . "<br />\n"; } if (empty($_POST['SecureQuestion'])) { $error .= "» " . $this->lang->words['Register']['Register']['Messages']['NULL_SecureQuestion'] . "<br />\n"; } if (empty($_POST['SecureAnswer'])) { $error .= "» " . $this->lang->words['Register']['Register']['Messages']['NULL_SecureAnswer'] . "<br />\n"; } if (empty($_POST['Captcha'])) { $error .= "» " . $this->lang->words['Global']['Captcha']['Messages']['Void']; } if (strlen($error) > 0) { return setResult(showMessage($this->lang->words['Register']['Register']['Messages']['NULL_Message'] . "<br /><br />" . $error, 1)); } /* Check Error Fields */ if (!CTM_Captcha::Check($_POST['Captcha'])) { $error .= "» " . $this->lang->words['Global']['Captcha']['Messages']['Invalid'] . "<br />\n"; } if (strlen($_POST['Login']) <= 3 || strlen($_POST['Login']) > 10) { $error .= "» " . $this->lang->words['Register']['Register']['Messages']['Error_LoginLength'] . "<br />\n"; } if (strlen($_POST['Password']) <= 3 || strlen($_POST['Password']) > 10) { $error .= "» " . $this->lang->words['Register']['Register']['Messages']['Error_PassLength'] . "<br />\n"; } if (strlen($_POST['PersonalID']) != 7 && $PID) { $error .= "» " . $this->lang->words['Register']['Register']['Messages']['Error_PIDLength'] . "<br />\n"; } if (eregi("[^a-zA-Z0-9_!=?&-]", $_POST['Login'])) { $error .= "» " . $this->lang->words['Register']['Register']['Messages']['Error_LoginWords'] . "<br />\n"; } if (eregi("[^a-zA-Z0-9_!=?&-]", $_POST['Password'])) { $error .= "» " . $this->lang->words['Register']['Register']['Messages']['Error_PassWords'] . "<br />\n"; } if (!CTM_Text::checkMail($_POST['Mail'])) { $error .= "» " . $this->lang->words['Register']['Register']['Messages']['Error_MailWords'] . "<br />\n"; } if (!is_numeric($_POST['PersonalID']) && $PID) { $error .= "» " . $this->lang->words['Register']['Register']['Messages']['Error_PIDWords'] . "<br />\n"; } if (strcmp($_POST['Password'], $_POST['CPassword']) != 0) { $error .= "» " . $this->lang->words['Register']['Register']['Messages']['Error_ConfirmPass'] . "<br />\n"; } if (strcmp($_POST['Mail'], $_POST['CMail']) != 0) { $error .= "» " . $this->lang->words['Register']['Register']['Messages']['Error_ConfirmMail'] . "<br />\n"; } $this->DB->Arguments($_POST['Login']); $this->DB->Query("SELECT 1 FROM " . MUACC_CORE . ".dbo.MEMB_INFO WHERE LOWER(memb___id) = '%s'", $checkLoginQ); if ($this->DB->CountRows($checkLoginQ) > 0) { $error .= "» " . $this->lang->words['Register']['Register']['Messages']['Error_LoginExists'] . "<br />\n"; } $this->DB->Arguments($_POST['Mail']); $this->DB->Query("SELECT 1 FROM " . MUACC_CORE . ".dbo.MEMB_INFO WHERE LOWER(mail_addr) = '%s'", $checkMailQ); if ($this->DB->CountRows($checkMailQ) > 0) { $error .= "» " . $this->lang->words['Register']['Register']['Messages']['Error_MailExists'] . "<br />\n"; } if (strlen($error) > 0) { return setResult(showMessage($this->lang->words['Register']['Register']['Messages']['Error_Message'] . "<br /><br />" . $error, 2)); } /* Finish and save fields values */ CTM_MuOnline::Lib('Member')->CreateAccount(array("Name" => utf8_encode($_POST['Name']), "Login" => $_POST['Login'], "Password" => $_POST['Password'], "Mail" => $_POST['Mail'], "PID" => $PID ? $_POST['PersonalID'] : $this->settings['REGISTER']['DEFAULT_PID'], "Phone" => $_POST['Phone'], "Sex" => $_POST['Sex'], "Birth" => $_POST['BirthDay'] . "/" . $_POST['BirthMonth'] . "/" . $_POST['BirthYear'], "SecureQuestion" => array(utf8_encode($_POST['SecureQuestion']), utf8_encode($_POST['SecureAnswer'])), "Lock" => $this->settings['REGISTER']['CONFIRM_MAIL'] == true ? 1 : 0, "Status" => $this->settings['REGISTER']['CONFIRM_MAIL'] == true ? 1 : 0)); $bonusCount = 0; $VIPBonus = FALSE; $coinBonus = FALSE; $vaultBonus = FALSE; if ($this->settings['REGISTER']['VIP']['SWITCH'] == TRUE && $_POST['VIPBonus'] == 1) { $this->DB->Arguments($this->settings['REGISTER']['VIP']['TYPE'], $this->settings['REGISTER']['VIP']['TIME'], time(), $_POST['Login']); $this->DB->Query("UPDATE " . VIP_CORE . ".dbo." . VIP_TABLE . " SET " . VIP_COLUMN . " = %d, " . VIP_TIME . " = %d, " . VIP_BEGIN . " = %d WHERE " . VIP_LOGIN . " = '%s'"); $VIPBonus = TRUE; $bonusCount++; } if ($this->settings['REGISTER']['COIN']['SWITCH'] == true && $_POST['CoinBonus'] == 1) { $column = constant("COIN_COLUMN_" . $this->settings['REGISTER']['COIN']['TYPE']); $this->DB->Arguments($column, $this->settings['REGISTER']['COIN']['NUMBER'], $_POST['Login']); $this->DB->Query("UPDATE " . COIN_CORE . ".dbo." . COIN_TABLE . " SET %s = %d WHERE " . COIN_LOGIN . "= '%s'"); $coinBonus = TRUE; $bonusCount++; } if ($this->settings['REGISTER']['VAULT_BONUS']['SWITCH'] == true && $_POST['VaultBonus'] != NULL) { if (array_key_exists($_POST['VaultBonus'], $this->settings['REGISTER']['VAULT_BONUS']['OPTIONS'])) { $this->loadVaultBonus($_POST['VaultBonus'], $_POST['Login']); $vaultBonus = TRUE; $bonusCount++; } } if ($this->settings['REGISTER']['CONFIRM_MAIL'] == true) { $dechex = create_function("\$integer", "return str_pad(dechex(\$integer >= 255 ? 255 : \$integer), 2, 0, STR_PAD_LEFT);"); $currentId = $this->DB->GetCurrentId("CTM_ValidingAccounts") + 1; $confirmCode = $dechex($currentId); $confirmCode .= ":" . $dechex(0xff - strlen($_POST['Account']) + mt_rand(0, 50)); $confirmCode .= ":" . $dechex(strlen($_POST['Mail']) + mt_rand(0, 50)); $confirmCode .= ":" . $dechex(mt_rand(0, 150)); $confirmCode .= ":" . $dechex(mt_rand(151, 255)); $confirmCode .= ":" . $dechex(0xff / intval(date("d")) + intval(date("H")) + intval(date("m")) + intval(date("s")) + mt_rand(0, 50)); $confirmCode .= ":" . $dechex(0xff / intval(date("m")) + intval(date("H")) + intval(date("m")) + intval(date("s")) + mt_rand(0, 50)); $confirmCode .= ":" . $dechex(intval(date("Y")) / 0xff + intval(date("H")) + intval(date("m")) + intval(date("s")) + mt_rand(0, 50)); $confirmCode = strtoupper($confirmCode); $link = gerateFullLink("?/register/confirm"); $this->DB->Arguments($_POST['Login'], utf8_encode($_POST['Name']), $_POST['Mail'], $confirmCode); $this->DB->Query("INSERT INTO dbo.CTM_ValidatingAccounts (Account,Name,Mail,ConfirmCode) VALUES ('%s','%s','%s','%s')"); $this->email->arguments = array("NAME" => htmlEncode($_POST['Name']), "LOGIN" => $_POST['Login'], "EMAIL" => $_POST['Mail'], "SECURE_QUESTION" => htmlEncode($_POST['SecureQuestion']), "SECURE_ANSWER" => htmlEncode($_POST['SecureAnswer']), "VALIDATION_LINK" => $currentId, "VALIDATION_CODE" => $confirmCode, "SYSTEM_LINK" => $link); $this->email->LoadTemplate("RegisterNewMember"); $this->email->GetMailContent($mail); $this->mailer->AddAddress($_POST['Mail'], $_POST['Name']); $this->mailer->SetSubject($mail['subject']); $this->mailer->SetBody($mail['content']); if ($this->mailer->SendMail() == true) { $finishRegister = TRUE; $this->lang->setArguments("Register,Register,Messages,Success,NotCompleted", $_POST['Mail']); $success = "<strong>" . $this->lang->words['Register']['Register']['Messages']['Success'][1] . "</strong><br /><br />\n"; $success .= $this->lang->words['Register']['Register']['Messages']['Success']['NotCompleted']; } else { CTM_MuOnline::Lib('Member')->DeleteAccount($_POST['Login']); $this->lang->setArguments("Register,Register,Messages,Error_SendMail", CoreVariables::ErrorsCode()->SendMailError); setResult(showMessage($this->lang->words['Register']['Register']['Messages']['Error_SendMail'], 2)); } } else { $finishRegister = TRUE; $success = "<strong>" . $this->lang->words['Register']['Register']['Messages']['Success'][1] . "</strong><br /><br />\n"; $success .= "» " . $this->lang->words['Register']['Register']['Messages']['Success'][2] . "<strong> " . htmlEncode($_POST['Name']) . "</strong><br />\n"; $success .= "» " . $this->lang->words['Register']['Register']['Messages']['Success'][3] . "<strong> " . strtolower($_POST['Login']) . "</strong><br />\n"; $success .= "» " . $this->lang->words['Register']['Register']['Messages']['Success'][4] . "<strong> " . $_POST['Mail'] . "</strong>\n"; } if ($finishRegister == true) { if ($bonusCount > 0) { $success .= "<br /><br />\n"; $success .= "<strong>" . $this->lang->words['Register']['Register']['Messages']['Success'][5] . "</strong><br /><br />\n"; if ($VIPBonus) { $this->lang->setTags("Register,Register,Messages,Success,6", $this->settings['REGISTER']['VIP']['TIME'], constant("VIP_NAME_" . $this->settings['REGISTER']['VIP']['TYPE'])); $success .= "» " . $this->lang->words['Register']['Register']['Messages']['Success'][6] . "<br />\n"; } if ($coinBonus) { $this->lang->setTags("Register,Register,Messages,Success,7", $this->settings['REGISTER']['COIN']['NUMBER'], constant("COIN_NAME_" . $this->settings['REGISTER']['COIN']['TYPE'])); $success .= "» " . $this->lang->words['Register']['Register']['Messages']['Success'][7] . "<br />\n"; } if ($vaultBonus) { $success .= "» " . htmlEncode($this->settings['REGISTER']['VAULT_BONUS']['OPTIONS'][$_POST['VaultBonus']]) . "<br />\n"; } } $success .= "<br />\n"; $success .= $this->lang->words['Register']['Register']['Messages']['Success'][8]; CTM_Captcha::gerateCaptchaText(); setResult(showMessage($success, 3)); } } } }
function column($a) { $res = wordwrap($a, getAdmSetting('COLUMN_LEN'), "\n "); $res = htmlEncode($res); return ereg_replace(" ", " ", nl2br($res)); }
var data = new google.visualization.DataTable(); data.addColumn('string', 'Topping'); data.addColumn('number', 'Slices'); data.addRows([ <?php function htmlEncode($s) { return htmlspecialchars($s, ENT_QUOTES, 'UTF-8'); } // utf8_encode($data) //utf8_decode($data) foreach ($data['stats'] as $stats) { echo "['" . htmlEncode($stats['name']) . "', " . (int) $stats['number'] . "],"; } ?> ]); // Set chart options var options = {'title':'<?php //if (!is_string($stats['title']) OR preg_match('|[^a-z0-9#_. -]|i',$stats['title']) !== 0 ) $stats['title']="Default"; echo htmlEncode($data['title']); ?> ', 'width':400, 'height':200, 'backgroundColor':'transparent'}; // Instantiate and draw our chart, passing in some options. var chart = new google.visualization.PieChart(document.getElementById('statscontainer')); chart.draw(data, options); } <?php }
/** * Init Module * * @return void */ public function initSection() { $this->DB->Arguments($_GET['id']); $find_invoice_q = $this->DB->Query("SELECT * FROM dbo.CTM_Invoices WHERE Id = %d"); if ($this->DB->CountRows($find_ticket_q) > 0) { $invoice = $this->DB->FetchObject($find_invoice_q); define("EDIT_INVOICE_ACCESS", $this->CheckPermissionItem("edit_ticket")); define("DELETE_INVOICE_ACCESS", $this->CheckPermissionItem("delete_ticket")); switch ($_GET['cmd']) { case "approve": if ($invoice->Status != 0 && $invoice->Status != 1) { exit(adminShowMessage($this->lang->words['EWFinancial']['Invoices']['ViewInvoice']['Messages']['IsClosed'], 2)); } else { $quantity = (int) $_GET['quantity']; if ($quantity < 0) { exit(adminShowMessage($this->lang->words['EWFinancial']['Invoices']['ViewInvoice']['ApproveInvoice']['Messages']['SetNumber'], 2)); } else { $this->DB->Arguments($invoice->Account, 1, $quantity, intval(COIN_USE_CACHE)); $this->DB->Query("EXEC dbo.CTM_PlusAccountCoin '%s', %d, %d, %d"); $this->DB->Arguments($_GET['id']); $this->DB->ForceDataType("Status", "integer"); $this->DB->Update("CTM_Invoices", array("Status" => 2), "Id = %d"); exit("<script>approveThisInvoice('" . $quantity . "', '" . $invoice->Account . "');"); } } break; case "reject": if ($invoice->Status != 0 && $invoice->Status != 1) { exit(adminShowMessage($this->lang->words['EWFinancial']['Invoices']['ViewInvoice']['Messages']['IsClosed'], 2)); } else { $this->DB->Arguments($_GET['id']); $this->DB->ForceDataType("Status", "integer"); $this->DB->Update("CTM_Invoices", array("Status" => 3), "Id = %d"); exit("<script>rejectThisInvoice();"); } break; case "edit": if (EDIT_INVOICE_ACCESS == TRUE) { if ($_POST['Quantity'] == NULL || $_POST['Value'] == NULL || $_POST['Status'] == NULL) { exit(adminShowMessage($this->lang->words['EWFinancial']['Invoices']['ViewInvoice']['EditInvoice']['Messages']['FieldsVoid'], 1)); } elseif (!is_numeric($_POST['Quantity'])) { exit(adminShowMessage($this->lang->words['EWFinancial']['Invoices']['ViewInvoice']['EditInvoice']['Messages']['InvalidQuantity'], 2)); } elseif ($_POST['Status'] != 0 && $_POST['Status'] != 1 && $_POST['Status'] != 2 && $_POST['Status'] != 3 && $_POST['Status'] != 4) { exit(adminShowMessage($this->lang->words['EWFinancial']['Invoices']['ViewInvoice']['EditInvoice']['Messages']['InvalidStatus'], 2)); } else { $update = array("CoinQuantity" => $_POST['Quantity'], "Value" => $_POST['Value'], "Status" => $_POST['Status']); $this->DB->ForceDataType("Quantity", "integer"); $this->DB->ForceDataType("Value", "string"); $this->DB->ForceDataType("Status", "integer"); $this->DB->Arguments($_GET['id']); $this->DB->Update("CTM_Invoices", $update, "Id = %d"); switch ($_POST['Status']) { case 0: $status = "<span style='color: #C00;'>" . $this->lang->words['EWFinancial']['Invoices']['Status']['Pending'] . "</span>"; break; case 1: $status = "<span style='color: blue;'>" . $this->lang->words['EWFinancial']['Invoices']['Status']['InProgress'] . "</span>"; break; case 2: $status = "<span style='color: green;'>" . $this->lang->words['EWFinancial']['Invoices']['Status']['Paid'] . "</span>"; break; case 3: $status = "<span style='color: red;'>" . $this->lang->words['EWFinancial']['Invoices']['Status']['Rejected'] . "</span>"; break; case 4: $status = "<span style='color: #666;'>" . $this->lang->words['EWFinancial']['Invoices']['Status']['Canceled'] . "</span>"; break; } exit("<script>completeEditInvoice('" . $_POST['Quantity'] . "', '" . str_replace("'", "\\'", $_POST['Value']) . "', '" . str_replace("'", "\\'", $status) . "', " . $_POST['Status'] . ");</script>"); } } break; case "reopen": if ($invoice->Status == 0) { exit(adminShowMessage($this->lang->words['EWFinancial']['Invoices']['ViewInvoice']['Messages']['IsOpened'], 2)); } else { $this->DB->Arguments($_GET['id']); $this->DB->ForceDataType("Status", "integer"); $this->DB->Update("CTM_Invoices", array("Status" => 0), "Id = %d"); exit("<script>reopenThisInvoice();"); } break; case "delete": if (DELETE_INVOICE_ACCESS) { $query = "DELETE FROM dbo.CTM_Invoices WHERE Id = %d;\n"; $query .= "DELETE FROM dbo.CTM_Payments WHERE InvoiceID = %d;"; $this->DB->Arguments($_GET['id'], $_GET['id']); $this->DB->Query($query); if (!empty($ticket->Annex)) { if (file_exists("../" . $this->settings['WEBDATA']['UPLOADS']['DIRECTORY']['PAYMENT_ANNEX'] . $ticket->Annex)) { unlink("../" . $this->settings['WEBDATA']['UPLOADS']['DIRECTORY']['PAYMENT_ANNEX'] . $ticket->Annex); } } exit("<script>location.href='" . $this->acp_vars['acp_url'] . "?app=effectweb&module=financial§ion=invoices&message=deleted';</script>"); } break; } $GLOBALS['view_invoice'] = array("id" => $_GET['id'], "method_key" => $invoice->PaymentMethod, "document" => $invoice->Document, "start_date" => date("d/m/Y - h:i a", $invoice->StartDate), "quantity" => number_format($invoice->CoinQuantity, 0, false, "."), "value" => CTM_Text::MoneyFormat(MONEY_SYMBOL, $invoice->Value), "account" => $invoice->Account, "status" => $invoice->Status, "canceled" => $invoice->Status == 4); if ($invoice->Status > 0 && $invoice->PaymentMethod != "none") { if (!($payment_data = unserialize($invoice->PaymentData))) { $payment_data = array(); } switch ($invoice->PaymentMethod) { case "bank": $method_name = $this->lang->words['EWFinancial']['Invoices']['Methods']['Bank']; $this->DB->Arguments($invoice->Id); $this->DB->Query("SELECT * FROM dbo.CTM_Payments WHERE InvoiceId = %d", $find_payment); if ($this->DB->CountRows($find_payment) > 0) { $payment = $this->DB->FetchObject($find_payment); switch ($payment->Status) { case 0: $status = "<span style='color: blue;'>" . $this->lang->words['EWFinancial']['Invoices']['PaymentStatus']['Opened'] . "</span>"; break; case 1: $status = "<span style='color: green;'>" . $this->lang->words['EWFinancial']['Invoices']['PaymentStatus']['Confirmed'] . "</span>"; break; case 2: $status = "<span style='color: red;'>" . $this->lang->words['EWFinancial']['Invoices']['PaymentStatus']['Rejected'] . "</span>"; break; } if (!($_payment_data = unserialize($payment->ConfirmData))) { $_payment_data = array(); } $GLOBALS['view_invoice']['bank_payment'] = array("method" => htmlEncode($this->settings['PAYMENTMETHOD']['FORM'][$payment->Method][0]), "confirm_date" => date("d/m/Y - h:i a", $payment->ConfirmDate), "status" => $status, "quantity" => number_format($payment->Quantity, 0, false, ".") . " " . COIN_NAME_1, "date" => $payment->Date, "hour" => $payment->Hour, "value" => $payment->Value, "local" => utf8_decode($payment->Local), "message" => htmlDecode($payment->Message), "payment_data" => $_payment_data); if (strlen($payment->Annex) > 1) { $GLOBALS['view_invoice']['bank_payment']['annex'] = array("link" => $this->settings['WEBDATA']['UPLOADS']['DIRECTORY']['PAYMENT_ANNEX'] . $payment->Annex, "name" => $payment->Annex); } } break; } $GLOBALS['view_invoice']['payment_method'] = array("method" => $method_name, "data" => $payment_data, "key" => $invoice->PaymentMethod); } if ($noOpenCache == false) { $this->output->setContent("invoices_viewInvoice"); } } }
/** * Castle Siege Informations * * @return void */ private function loadCastleSiege() { if ($this->settings['HOME']['SIEGE']['SHOW'] == true) { $query = $this->DB->Query("EXEC dbo.CTM_GetCastleSiege"); $data = $this->DB->FetchObject($query); $owner = strlen($data->GuildOwner) < 2 ? $this->lang->words['Home']['CastleSiege']['No_Owner'] : $data->GuildOwner; $date = explode("/", $data->SiegeEndDate); $date = $date[0] - 1 . "/" . $date[1]; $date = !empty($data->SiegeEndDate) ? $date : $data->SiegeEndDate; $date = $this->settings['HOME']['SIEGE']['DATE'] == "*" ? $date : htmlEncode($this->settings['HOME']['SIEGE']['DATE']); $date = empty($date) ? $this->lang->words['Home']['CastleSiege']['No_Date'] : $date; $GLOBALS['home_module']['CastleSiege'] = array("guildName" => $owner, "guildMark" => $this->functions->GetGuildMark($data->GuildMark), "invasionDate" => $date, "invasionHour" => $this->settings['HOME']['SIEGE']['HOUR']); } }
/** * Option: Tickets * Tickets for support * * @return void */ public function SupportTickets() { switch ($_GET['section'] ? $_GET['section'] : $this->URLData[2]) { case "list": $this->DB->Arguments(USER_ACCOUNT); $this->DB->Query("SELECT Id, Departament, Subject, Status, [Date] FROM dbo.CTM_Tickets WHERE Account = '%s' ORDER BY Id DESC", $all_tickets_q); $tickets_opened = array(); $tickets_progress = array(); $tickets_closed = array(); if ($this->DB->CountRows($all_tickets_q) > 0) { while ($all_tickets = $this->DB->FetchObject($all_tickets_q)) { switch ($all_tickets->Status) { case 0: $var_name = "tickets_opened"; $status = "<span style='color: blue;'>" . $this->lang->words['UserPanel']['SupportTickets']['Status']['Opened'] . "</span>"; break; case 1: $var_name = "tickets_progress"; $status = "<span style='color: green;'>" . $this->lang->words['UserPanel']['SupportTickets']['Status']['Responded'] . "</span>"; break; case 2: $var_name = "tickets_progress"; $status = "<span style='color: orange;'>" . $this->lang->words['UserPanel']['SupportTickets']['Status']['Progress'] . "</span>"; break; case 3: $var_name = "tickets_closed"; $status = "<span style='color: red;'>" . $this->lang->words['UserPanel']['SupportTickets']['Status']['Closed'] . "</span>"; break; } ${$var_name}[$all_tickets->Id] = array("departament" => htmlEncode($this->settings['USERPANEL']['SUPPORT']['TICKETS']['DEPARTAMENTS'][$all_tickets->Departament]), "subject" => htmlEncode($all_tickets->Subject), "date" => date("d/m/Y - h:i a", $all_tickets->Date), "status" => $status); } } $GLOBALS['userpanel']['support_tickets']['auto_load_ticket'] = $_GET['showticket'] ? $_GET['showticket'] : $this->URLData[3]; $GLOBALS['userpanel']['support_tickets']['list_tickets'] = array("opened" => $tickets_opened, "progress" => $tickets_progress, "closed" => $tickets_closed); unset($tickets_opened); unset($tickets_progress); unset($tickets_closed); return $this->LoadPage("option_supportTickets_list", true); break; case "show": $ticket_id = intval($_GET['id']); $this->DB->Arguments($ticket_id, USER_ACCOUNT); $this->DB->Query("SELECT * FROM dbo.CTM_Tickets WHERE Id = %d AND Account = '%s'", $get_ticket); if ($this->DB->CountRows($get_ticket) < 1) { return exit(showMessage(sprintf($this->lang->words['UserPanel']['SupportTickets']['ErrorMessage'], CoreVariables::ErrorsCode()->TicketNotFound), 2)); } $ticket = $this->DB->FetchObject($get_ticket); switch ($_GET['do']) { case "show_annex": if (!empty($ticket->Annex)) { $filename = $this->settings['WEBDATA']['UPLOADS']['DIRECTORY']['TICKET_ANNEX'] . $ticket->Annex; if (preg_match("/\\.([gif|jpg|jpeg|png])/i", substr($filename, strrpos($filename, ".")))) { header("Location: " . $this->settings['WEBDATA']['UPLOADS']['DIRECTORY']['TICKET_ANNEX'] . $ticket->Annex); } else { header("Content-type: text/plain"); readfile($filename); } } exit; break; case "reply": if (empty($_POST['ReplyMessage'])) { exit(showMessage($this->lang->words['UserPanel']['SupportTickets']['ShowTicket']['Messages']['ReplyVoid'], 1)); } else { $message = htmlEncode(nl2br(strip_tags($_POST['ReplyMessage']))); $insert_columns = array("TicketID" => $ticket_id, "Author" => "%s", "Account" => "%s", "Date" => time(), "Message" => "%s"); $this->DB->Arguments($ticket->Character, USER_ACCOUNT, htmlEncode(nl2br(strip_tags($_POST['ReplyMessage'])))); $this->DB->Insert("CTM_TicketReplies", $insert_columns); $this->DB->Arguments($ticket_id, USER_ACCOUNT); $this->DB->Update("CTM_Tickets", array("Status" => 2), "Id = %d AND Account = '%s'"); exit("<script>CTM.AjaxLoad('?app=core&module=userpanel&option=supportTickets&showticket=" . $ticket_id . "', 'showTicket');</script>"); } break; case "close": if ($ticket->Status == 3) { exit(showMessage($this->lang->words['UserPanel']['SupportTickets']['ShowTicket']['Messages']['IsClosed'], 2)); } else { $this->DB->Arguments($ticket_id, USER_ACCOUNT); $this->DB->Query("UPDATE dbo.CTM_Tickets SET Status = 3 WHERE Id = %d AND Account = '%s'"); $string = "<script>changeTicketStatus("; $string .= "'" . $ticket->Id . "','"; $string .= str_replace("'", "\\'", htmlEncode($this->settings['USERPANEL']['SUPPORT']['TICKETS']['DEPARTAMENTS'][$ticket->Departament])) . "',"; $string .= "'" . str_replace("'", "\\'", $ticket->Subject) . "',"; $string .= "'" . date("d/m/Y - H:i", $ticket->Date) . "',"; $string .= "'<span style=\\'color: red;\\'>"; $string .= str_replace("'", "\\'", $this->lang->words['UserPanel']['SupportTickets']['Status']['Closed']); $string .= "</span>',3);</script>" . showMessage($this->lang->words['UserPanel']['SupportTickets']['ShowTicket']['Messages']['Closed'], 3); exit($string); } break; } switch ($ticket->Status) { case 0: $status = "<span style='color: blue;'>" . $this->lang->words['UserPanel']['SupportTickets']['Status']['Opened'] . "</span>"; break; case 1: $status = "<span style='color: green;'>" . $this->lang->words['UserPanel']['SupportTickets']['Status']['Responded'] . "</span>"; break; case 2: $status = "<span style='color: orange;'>" . $this->lang->words['UserPanel']['SupportTickets']['Status']['Progress'] . "</span>"; break; case 3: $status = "<span style='color: red;'>" . $this->lang->words['UserPanel']['SupportTickets']['Status']['Closed'] . "</span>"; break; } $this->DB->Arguments($ticket_id); $this->DB->Query("SELECT * FROM dbo.CTM_TicketReplies WHERE TicketID = %d ORDER BY Id DESC", $get_replies); $replies = array(); if ($this->DB->CountRows($get_replies) > 0) { while ($_reply = $this->DB->FetchObject($get_replies)) { $replies[] = array("author" => $_reply->Author, "date" => date("d/m/Y - h:i a", $_reply->Date), "message" => htmlDecode($_reply->Message)); } } $GLOBALS['userpanel']['support_tickets']['show_ticket'] = array("id" => $ticket_id, "departament" => htmlEncode($this->settings['USERPANEL']['SUPPORT']['TICKETS']['DEPARTAMENTS'][$ticket->Departament]), "subject" => htmlDecode($ticket->Subject), "character" => $ticket->Character, "status" => $status, "date" => date("d/m/Y - h:i a", $ticket->Date), "message" => htmlDecode($ticket->Text), "_replies" => $replies, "_opened" => $ticket->Status < 3); if (strlen($ticket->Annex) > 1) { $GLOBALS['userpanel']['support_tickets']['show_ticket']['annex'] = array("link" => "?app=core&module=userpanel&option=supportTickets&section=show&id=" . $ticket_id . "&do=show_annex", "name" => $ticket->Annex); } $this->lang->setArguments("UserPanel,SupportTickets,ShowTicket,Title", "#" . $ticket_id); return $this->LoadPage("option_supportTickets_show", true); break; case "open": $departament = !is_null($_GET['departament']) ? $_GET['departament'] : $this->URLData[3]; if (is_null($departament) || !array_key_exists($departament, $this->settings['USERPANEL']['SUPPORT']['TICKETS']['DEPARTAMENTS'])) { if ($_GET['write'] == true) { exit(showMessage($this->lang->words['UserPanel']['SupportTickets']['OpenTicket']['Messages']['SelectDepartament'], 2)); } return $this->LoadPage("option_supportTickets_open", true); } else { if ($_GET['write'] == true) { $error = $this->LoadClass("Error", "class_sources"); if (empty($_POST['Subject'])) { $error->addError($this->lang->words['UserPanel']['SupportTickets']['OpenTicket']['Messages']['SubjectVoid'], 0); } if (empty($_POST['Character'])) { $error->addError($this->lang->words['UserPanel']['SupportTickets']['OpenTicket']['Messages']['SelectCharacter'], 0); } if (empty($_POST['Text'])) { $error->addError($this->lang->words['UserPanel']['SupportTickets']['OpenTicket']['Messages']['MessageVoid'], 0); } if ($error->count[0] > 0) { $_error = "<strong>" . $this->lang->words['UserPanel']['SupportTickets']['OpenTicket']['Messages']['VoidMessage'] . "<strong><br />"; exit(showMessage($_error . "<br />" . $error->showError(0), 1)); } else { if ($this->settings['USERPANEL']['SUPPORT']['TICKETS']['LIMIT_OPEN'] > 0) { $this->DB->Arguments(USER_ACCOUNT); $this->DB->Query("SELECT 1 FROM dbo.CTM_Tickets WHERE Account = '%s' AND Status < 3"); if ($this->DB->CountRows() >= $this->settings['USERPANEL']['SUPPORT']['TICKETS']['LIMIT_OPEN']) { exit(showMessage($this->lang->words['UserPanel']['SupportTickets']['OpenTicket']['Messages']['LimitReached'], 2)); } } $current_id = $this->DB->Query("SELECT Id FROM dbo.CTM_Tickets ORDER BY Id DESC"); $current_id = $this->DB->FetchRow($current_id); $current_id = strlen($current_id[0]) < 1 ? 0 : $current_id[0]; $protocol = date("Y") . str_pad($current_id, 6, "1", STR_PAD_LEFT); if ($_POST['u_sendFile'] == 1) { if ($_POST['u_ready'] == 1) { $size = $this->settings['WEBDATA']['UPLOADS']['FILESIZE']['TICKET_ANNEX']; $dir = CTM_ROOT_PATH . $this->settings['WEBDATA']['UPLOADS']['DIRECTORY']['TICKET_ANNEX']; Uploadify::set("Filedata", $size, array("gif", "jpg", "jpeg", "png", "txt", "log"), $protocol, $dir, $session); exit("<script>startUpload('{$protocol}', '{$session}');</script>"); } } if ($_POST['u_sendFile'] == 1) { $data = unserialize(base64_decode($_POST['u_fileUploaded'])); $annex = $data['parsed_file_name']; if (!$data) { exit(showMessage($this->lang->words['UserPanel']['SupportTickets']['OpenTicket']['Messages']['AnnexError'], 2)); } elseif ($data['error_no'] == 2) { $this->lang->setArguments("UserPanel,SupportTickets,OpenTicket,Messages,ErrorFormat", "<b>JPEG</b>, <b>GIF</b>, <b>PNG</b>, <b>TXT/LOG</b>"); exit(showMessage($this->lang->words['UserPanel']['SupportTickets']['OpenTicket']['Messages']['ErrorFormat'], 2)); } elseif ($data['error_no'] == 3) { $this->lang->setArguments("UserPanel,ChangeAvatar,Messages,ErrorSize", "<b>" . $data['max_file_size'] . "</b>"); exit(showMessage($this->lang->words['UserPanel']['SupportTickets']['OpenTicket']['Messages']['ErrorSize'], 2)); } elseif ($data['error_no'] != 0) { exit(showMessage($this->lang->words['UserPanel']['SupportTickets']['OpenTicket']['Messages']['AnnexError'], 2)); } } $columns_insert = array("Account" => USER_ACCOUNT, "Character" => $_POST['Character'], "Protocol" => $protocol, "Status" => 0, "Subject" => htmlEncode($_POST['Subject']), "Departament" => intval($_GET['departament']), "Date" => time(), "Text" => htmlEncode(nl2br(strip_tags($_POST['Text']))), "Annex" => $annex); //$this->DB->ForceDataType("Protocol", "integer"); $this->DB->ForceDataType("Status", "integer"); $this->DB->ForceDataType("Departament", "integer"); $this->DB->ForceDataType("Date", "integer"); $this->DB->ForceDataType("Annex", empty($annex) ? "null" : "string"); $this->DB->Insert("CTM_Tickets", $columns_insert); $this->WriteLog(array("option" => "Support Tickets", "character" => false, "data" => array("Protocol: " . $protocol, "Subject: " . strip_tags($_POST['Subject']), "Departament: " . $this->settings['USERPANEL']['SUPPORT']['TICKETS']['DEPARTAMENTS'][intval($_GET['departament'])], "Character: " . $_POST['Character'], "Annex: " . (!empty($annex) ? $annex : "None")))); exit(showMessage(sprintf($this->lang->words['UserPanel']['SupportTickets']['OpenTicket']['Messages']['Success'], $protocol), 3)); } } $GLOBALS['userpanel']['support_tickets']['open_ticket']['departament'] = !is_null($_GET['departament']) ? $_GET['departament'] : $this->URLData[3]; $GLOBALS['userpanel']['support_tickets']['open_ticket']['characters'] = array(); $this->DB->Arguments(USER_ACCOUNT); $this->DB->Query("SELECT Name FROM " . MUGEN_CORE . ".dbo.Character WHERE AccountID = '%s'", $find_characters_q); if ($this->DB->CountRows($find_characters_q) > 0) { while ($find_characters = $this->DB->FetchObject($find_characters_q)) { $GLOBALS['userpanel']['support_tickets']['open_ticket']['characters'][] = $find_characters->Name; } } return $this->LoadPage("option_supportTickets_open_form", true); } break; default: if ($_GET['showticket']) { $GLOBALS['userpanel']['support_tickets']['auto_load_ticket'] = $_GET['showticket']; } elseif (strstr($this->URLData[2], "showticket-")) { $GLOBALS['userpanel']['support_tickets']['auto_load_ticket'] = str_replace("showticket-", NULL, $this->URLData[2]); } break; } }
/** * Private: Validating Accounts * Manage the validating accounts * * @return void */ public function loadValidatingAccounts() { if ($_GET['write'] == true) { switch ($_POST['Action']) { case "approve": $count = 0; if (count($_POST) > 0) { foreach ($_POST as $key => $value) { if (substr($key, 0, 9) == "account__" && $value == 1) { $account = substr($key, 9); $this->MuLib('Member')->UpdateAccount($key, array("info" => array("bloc_code" => 0, "MemberStatus" => 0))); $this->DB->Arguments($account); $this->DB->Delete("CTM_ValidatingAccounts", "Account = '%s'"); $count++; } } } if ($count > 0) { $GLOBALS['result_command'] = sprintf($this->lang->words['Members']['Accounts']['ValidatingAccounts']['Messages']['Success']['Approve'], $count); $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 3); } else { $GLOBALS['result_command'] = $this->lang->words['Members']['Accounts']['ValidatingAccounts']['Messages']['SelectAccount']; $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 2); } break; case "resend_email": $success = 0; $error = 0; if (count($_POST) > 0) { foreach ($_POST as $key => $value) { if (substr($key, 0, 9) == "account__" && $value == 1) { $account = substr($key, 9); $this->DB->Arguments($account); $this->DB->Query("SELECT * FROM dbo.CTM_ValidatingAccounts WHERE Account = '%s'", $data_q); if ($this->DB->CountRows($data_q) > 0) { $user_info = $this->MuLib('Member')->Load($account, array("info" => "fpas_ques,fpas_answ")); $data_info = $this->DB->FetchArray($data_q); $this->email->arguments = array("NAME" => htmlEncode(utf8_decode($data_info['Name'])), "LOGIN" => $data_info['Account'], "EMAIL" => $data_info['Mail'], "SECURE_QUESTION" => htmlEncode(utf8_decode($user_info['info']['fpas_ques'])), "SECURE_ANSWER" => htmlEncode(utf8_decode($user_info['info']['fpas_answ'])), "VALIDATION_LINK" => $data_info['Id'], "VALIDATION_CODE" => $data_info['ConfirmCode'], "SYSTEM_LINK" => gerateFullLink("?/register/confirm")); $this->email->LoadTemplate("RegisterNewMember"); $this->email->GetMailContent($mail); $this->mailer->AddAddress($data_info['Mail'], utf8_decode($data_info['Name'])); $this->mailer->SetSubject($mail['subject']); $this->mailer->SetBody($mail['content']); if ($this->mailer->SendMail() == true) { $success++; } else { $error++; } } else { $error++; } } } } if ($success > 0 || $error > 0) { $GLOBALS['result_command'] = sprintf($this->lang->words['Members']['Accounts']['ValidatingAccounts']['Messages']['Success']['ResendEmail'], $success, $error); $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 3); } else { $GLOBALS['result_command'] = $this->lang->words['Members']['Accounts']['ValidatingAccounts']['Messages']['SelectAccount']; $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 2); } break; case "delete": $count = 0; if (count($_POST) > 0) { foreach ($_POST as $key => $value) { if (substr($key, 0, 9) == "account__" && $value == 1) { $account = substr($key, 9); $this->MuLib('Member')->DeleteAccount($account); $count++; } } } if ($count > 0) { $GLOBALS['result_command'] = sprintf($this->lang->words['Members']['Accounts']['ValidatingAccounts']['Messages']['Success']['Delete'], $count); $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 3); } else { $GLOBALS['result_command'] = $this->lang->words['Members']['Accounts']['ValidatingAccounts']['Messages']['SelectAccount']; $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 2); } break; } } $a = "dbo.CTM_ValidatingAccounts"; $m = MUACC_CORE . ".dbo.MEMB_INFO"; $GLOBALS['validating_accounts'] = array(); $query = $this->DB->Query("SELECT * FROM dbo.CTM_ValidatingAccounts WHERE Confirmed = 0 ORDER BY Id DESC"); if ($this->DB->CountRows($query) > 0) { while ($account = $this->DB->FetchObject($query)) { $GLOBALS['validating_accounts'][$account->Account] = array("name" => utf8_decode($account->Name), "mail" => $account->Mail, "code" => $account->ConfirmCode); } } }