public function load() { parent::load(); $this->selectedTabIndex = isset($_GET['t']) && is_numeric($_GET['t']) && 0 <= intval($_GET['t']) && intval($_GET['t']) <= 5 ? intval($_GET['t']) : 0; if ($this->selectedTabIndex == 0) { } }
public function load() { parent::load(); $this->selectedTabIndex = isset($_GET['t']) && is_numeric($_GET['t']) && 0 <= intval($_GET['t']) && intval($_GET['t']) <= 2 ? intval($_GET['t']) : 0; if ($this->selectedTabIndex == 0) { $this->packageIndex = isset($_GET['id']) && is_numeric($_GET['id']) && 0 < intval($_GET['id']) && intval($_GET['id']) <= sizeof($this->appConfig['plus']['packages']) ? intval($_GET['id']) - 1 : 0 - 1; } else { if ($this->selectedTabIndex == 2 && isset($_GET['a'], $_GET['k']) && $_GET['k'] == $this->data['update_key'] && $this->plusTable[intval($_GET['a'])]['cost'] <= $this->data['gold_num'] && !$this->isGameTransientStopped() && !$this->isGameOver()) { switch (intval($_GET['a'])) { case 0: case 1: case 2: case 3: case 4: $taskType = constant("QS_PLUS" . (intval($_GET['a']) + 1)); $newTask = new QueueTask($taskType, $this->player->playerId, $this->plusTable[intval($_GET['a'])]['time'] * 86400); if (0 < intval($_GET['a'])) { } $newTask->villageId = ""; $newTask->tag = $this->plusTable[intval($_GET['a'])]['cost']; $this->queueModel->addTask($newTask); break; case 5: case 7: $this->queueModel->finishTasks($this->player->playerId, $this->plusTable[intval($_GET['a'])]['cost'], intval($_GET['a']) == 7); } } } }
public function load() { parent::load(); if (intval($this->data['create_nvil']) == 0 || $this->player->isSpy) { $this->redirect("village1.php"); } else { $this->globalModel->resetNewVillageFlag($this->player->playerId); } }
public function load() { parent::load(); $allianceId = intval($this->data['alliance_id']); if ($allianceId == 0 || !$this->hasAllianceSetRoles() || !isset($_GET['uid'])) { exit(0); } else { $uid = intval($_GET['uid']); $m = new AllianceModel(); $this->allianceData = $m->getAllianceData($allianceId); if (!$this->isMemberOfAlliance($uid)) { exit(0); } else { if ($this->isPost()) { $roleName = isset($_POST['a_titel']) ? $_POST['a_titel'] : ""; if (trim($roleName) == "") { $roleName = "."; } $roleNumber = 0; if (isset($_POST['e1'])) { $roleNumber |= ALLIANCE_ROLE_SETROLES; } if (isset($_POST['e2'])) { $roleNumber |= ALLIANCE_ROLE_REMOVEPLAYER; } if (isset($_POST['e3'])) { $roleNumber |= ALLIANCE_ROLE_EDITNAMES; } if (isset($_POST['e4'])) { $roleNumber |= ALLIANCE_ROLE_EDITCONTRACTS; } if (isset($_POST['e5'])) { $roleNumber |= ALLIANCE_ROLE_SENDMESSAGE; } if (isset($_POST['e6'])) { $roleNumber |= ALLIANCE_ROLE_INVITEPLAYERS; } $m->setPlayerAllianceRole($uid, $roleName, $roleNumber); } $row = $m->getPlayerAllianceRole($uid); if ($row == NULL) { exit(0); } else { $this->playerName = $row['name']; $alliance_roles = trim($row['alliance_roles']); if ($alliance_roles == "") { $this->playerRoles = array("name" => "", "roles" => 0); } else { list($rolesNumber, $roleName) = explode(" ", $alliance_roles, 2); $this->playerRoles = array("name" => $roleName == "." ? "" : $roleName, "roles" => $rolesNumber); } $m->dispose(); } } } }
public function load() { parent::load(); if (intval($this->data['new_gnews']) == 0 || $this->player->isSpy) { $this->redirect("village1.php"); } else { $m = new NewsModel(); $this->siteNews = $m->getGlobalSiteNews(); $m->dispose(); } }
public function load() { parent::load(); if (isset($_GET['url']) && !empty($_GET['url'])) { $advID = base64_decode(mysql_real_escape_string(trim($_GET['url']))); if ($advID != "") { $m = new AdvertisingModel(); $url = $m->GoToBanner($advID); $m->dispose(); $this->redirect($url); } } }
public function load() { parent::load(); $this->Filter = new FilterWordsModel(); $m = new ChatModel(); if ($this->isPost() && isset($_POST['text'])) { $text = stripslashes(htmlspecialchars(trim($_POST['text']))); if ($text != "") { $m->SendToChat($this->data['name'], $this->player->playerId, $text); } } $m->DeleteOldChat(); $this->chats = $m->GetFromChat(); $m->dispose(); }
public function load() { parent::load(); if (!$this->data['active_plus_account']) { exit(0); } else { $this->saved = FALSE; if ($this->isPost() && isset($_POST['notes'])) { $this->data['notes'] = $_POST['notes']; $m = new NotesModel(); $m->changePlayerNotes($this->player->playerId, $this->data['notes']); $m->dispose(); $this->saved = TRUE; } } }
public function load() { parent::load(); $this->Filter = new FilterWordsModel(); $m = new ChatModel(); $this->chats = $m->GetFromChat(); $storCtat = array(); while ($this->chats->next()) { $text = $this->Filter->FilterWords($this->chats->row['text']); $storCtat[$this->chats->row['ID']] = array(date("g:i A", $this->chats->row['date']), $this->chats->row['username'], $text, $this->chats->row['userid']); } ksort($storCtat); foreach ($storCtat as $ChatLine) { echo "<div class=\"msgln\">(" . $ChatLine[0] . ") <b><a href=\"profile.php?uid=" . $ChatLine[3] . "\" target=\"_blank\">" . $ChatLine[1] . "</a></b>: " . $ChatLine[2] . "<br></div>"; } $m->dispose(); }
public function load() { parent::load(); if ($this->data['player_type'] != PLAYERTYPE_ADMIN) { exit(0); } else { $m = new NewsModel(); $this->saved = FALSE; if ($this->isPost() && isset($_POST['news'])) { $this->siteNews = $_POST['news']; $this->saved = TRUE; $m->setGlobalPlayerNews($this->siteNews); } else { $this->siteNews = $m->getGlobalSiteNews(); } $m->dispose(); } }
public function load() { parent::load(); $this->msgText = ""; $this->isAdmin = $this->data['player_type'] == PLAYERTYPE_ADMIN; if (!$this->isAdmin) { exit(0); } else { $this->villageId = isset($_GET['avid']) ? intval($_GET['avid']) : 0; if ($this->villageId <= 0) { exit(0); } else { $m = new ResourcesModel(); if ($this->isPost()) { $r1 = isset($_POST['r1']) && 0 <= intval($_POST['r1']) ? intval($_POST['r1']) : 0 - 1; $r2 = isset($_POST['r2']) && 0 <= intval($_POST['r2']) ? intval($_POST['r2']) : 0 - 1; $r3 = isset($_POST['r3']) && 0 <= intval($_POST['r3']) ? intval($_POST['r3']) : 0 - 1; $r4 = isset($_POST['r4']) && 0 <= intval($_POST['r4']) ? intval($_POST['r4']) : 0 - 1; $m->updateVillageResources($this->villageId, array("1" => $r1, "2" => $r2, "3" => $r3, "4" => $r4)); $this->msgText = data_saved; } $row = $m->getVillageData($this->villageId); if ($row == NULL || intval($row['player_id']) == 0 || $row['is_oasis']) { exit(0); } else { $this->villageName = $row['village_name']; $this->playerName = $row['player_name']; $this->resources = array(); $elapsedTimeInSeconds = $row['elapsedTimeInSeconds']; $r_arr = explode(",", $row['resources']); foreach ($r_arr as $r_str) { $r2 = explode(" ", $r_str); $prate = floor($r2[4] * (1 + $r2[5] / 100)) - ($r2[0] == 4 ? $row['crop_consumption'] : 0); $current_value = floor($r2[1] + $elapsedTimeInSeconds * ($prate / 3600)); if ($r2[2] < $current_value) { $current_value = $r2[2]; } $this->resources[$r2[0]] = array("current_value" => $current_value, "store_max_limit" => $r2[2], "store_init_limit" => $r2[3], "prod_rate" => $r2[4], "prod_rate_percentage" => $r2[5], "calc_prod_rate" => $prate); } $m->dispose(); } } } }
public function load() { parent::load(); $this->pageIndex = isset($_GET['p']) && is_numeric($_GET['p']) ? intval($_GET['p']) : 0; $m = new FriendsModel(); $rowsCount = $m->getFriendsCount($this->player->playerId); $this->pageCount = 0 < $rowsCount ? ceil($rowsCount / $this->pageSize) : 1; if (isset($_GET['DFid']) && !empty($_GET['DFid'])) { $FriendID = mysql_real_escape_string(trim($_GET['DFid'])); if ($FriendID != "") { $m->DeleteFriend($FriendID, $this->player->playerId); $m->dispose(); $this->redirect("friends.php"); } } else { if (isset($_GET['CFid']) && !empty($_GET['CFid'])) { $ConfirmID = mysql_real_escape_string(trim($_GET['CFid'])); if ($ConfirmID != "") { $m->ConfirmInvitation($ConfirmID, $this->player->playerId); $m->dispose(); $this->redirect("friends.php"); } } else { if ($this->isPost()) { $post = array(); $post['playerId1'] = $this->player->playerId; $post['myname'] = $this->data['name']; $post['playerName'] = isset($_POST['playerName']) && $_POST['playerName'] != "" ? trim($_POST['playerName']) : trim($_POST['playerName']); if ($post['playerName'] != "") { $m->SendInvitation($post); } else { echo "<pre> Error : Wrong name"; } $m->dispose(); } $this->friends = $m->GetFriends($this->player->playerId, $this->pageIndex, $this->pageSize); $m->dispose(); } } }
public function load() { parent::load(); $this->pageIndex = isset($_GET['p']) && is_numeric($_GET['p']) ? intval($_GET['p']) : 0; $this->isAdmin = $this->data['player_type'] == PLAYERTYPE_ADMIN; if (!$this->isAdmin) { exit(0); } else { $m = new BadWordsModel(); $rowsCount = $m->getBadWordsCount(); $this->pageCount = 0 < $rowsCount ? ceil($rowsCount / $this->pageSize) : 1; if (isset($_GET['Dword']) && !empty($_GET['Dword'])) { $wordID = mysql_real_escape_string(trim($_GET['Dword'])); if ($wordID != "") { $m->DeleteBadWords($wordID); $m->dispose(); $this->redirect("badwords.php"); } } else { if ($this->isPost()) { $i = 0; while ($i < count($_POST['words'])) { $words = mysql_real_escape_string(trim($_POST['words'][$i])); if ($words == "") { continue; } $this->BadWords[] = $words; ++$i; } $m->addBadWords($this->BadWords); $m->dispose(); $this->redirect("badwords.php"); } else { $this->BadWords = $m->GetBadWords($this->pageIndex, $this->pageSize); $m->dispose(); } } } }
public function load() { parent::load(); $this->pageIndex = isset($_GET['p']) && is_numeric($_GET['p']) ? intval($_GET['p']) : 0; $this->isAdmin = $this->data['player_type'] == PLAYERTYPE_ADMIN; if (!$this->isAdmin) { exit(0); } else { $m = new AdvertisingModel(); $rowsCount = $m->getAdvertisingCount(); $this->pageCount = 0 < $rowsCount ? ceil($rowsCount / $this->pageSize) : 1; if (isset($_GET['DAdv']) && !empty($_GET['DAdv'])) { $advID = mysql_real_escape_string(trim($_GET['DAdv'])); if ($advID != "") { $m->DeleteAdvertising($advID); $m->dispose(); $this->redirect("advertising.php"); } } else { if ($this->isPost()) { $post = array(); $type = isset($_POST['do']) && $_POST['do'] != "add" ? "edit" : "add"; $post['name'] = "SPSLink.NET"; $post['url'] = isset($_POST['url']) && $_POST['url'] != "" ? mysql_real_escape_string(trim($_POST['url'])) : "http://www.spslink.net"; $post['cat'] = isset($_POST['cat']) && $_POST['cat'] != "" ? mysql_real_escape_string(trim($_POST['cat'])) : "1"; $post['image'] = isset($_POST['image']) && $_POST['image'] != "" ? mysql_real_escape_string(trim($_POST['image'])) : "assets/default/img/characters.png"; $ext = strtolower(end(explode(".", mysql_real_escape_string(trim($post['image']))))); $post['type'] = $ext == "swf" ? "flash" : "image"; $post['ID'] = isset($_POST['ID']) && $_POST['ID'] != "" ? mysql_real_escape_string(trim($_POST['ID'])) : 0; $m->Advertising($post, $type); $m->dispose(); $this->redirect("advertising.php"); } else { $this->Advertisings = $m->GetAdvertisings($this->pageIndex, $this->pageSize); $m->dispose(); } } } }
public function load() { parent::load(); $this->msgText = ""; $this->isAdmin = $this->data['player_type'] == PLAYERTYPE_ADMIN; if (!$this->isAdmin) { exit(0); } else { $this->villageId = isset($_GET['avid']) ? intval($_GET['avid']) : 0; if ($this->villageId <= 0) { exit(0); } else { $m = new TroopsModel(); if ($this->isPost()) { //update troops if (isset($_POST['hero'])) { $row = $m->getVillageData($this->villageId); $m->updatehero($_POST['hero'], $row['player_id']); } $m->updateTroops($_POST, $this->villageId); $this->msgText = data_saved; //$this->redirect('troops.php?avid='.$this->villageId); } $row = $m->getVillageData($this->villageId); if ($row == NULL || intval($row['player_id']) == 0 || $row['is_oasis']) { exit(0); } else { $t_arr = explode("|", $row['troops_num']); //var_dump($t_arr); foreach ($t_arr as $t_str) { $t2_arr = explode(":", $t_str); $t2_arr = explode(",", $t2_arr[1]); //var_dump($t2_arr); $this->troops = $t2_arr; } } } } }
public function load() { parent::load(); $this->Filter = new FilterWordsModel(); if (isset($_GET['action']) && $_GET['action'] == "chatheartbeat") { $this->chatHeartbeat(); } if (isset($_GET['action']) && $_GET['action'] == "sendchat") { $this->sendChat(); } if (isset($_GET['action']) && $_GET['action'] == "closechat") { $this->closeChat(); } if (isset($_GET['action']) && $_GET['action'] == "startchatsession") { $this->startChatSession(); } if (!isset($_SESSION['chatHistory'])) { $_SESSION['chatHistory'] = array(); } if (!isset($_SESSION['openChatBoxes'])) { $_SESSION['openChatBoxes'] = array(); } }
public function load() { parent::load(); if ($this->isPost()) { if (!isset($_POST['a1']) || intval($_POST['a1']) != 1 && intval($_POST['a1']) != 2 && intval($_POST['a1']) != 3 && intval($_POST['a1']) != 7 && intval($_POST['a1']) != 6) { $this->errorText = war_sim_noattack; } else { if (!isset($_POST['ktyp']) || intval($_POST['ktyp']) != 1 && intval($_POST['ktyp']) != 2) { $this->errorText = war_sim_nobattletype; } else { if (!isset($_POST['a2']) || sizeof($_POST['a2']) == 0) { $this->errorText = war_sim_nodefense; } else { foreach ($_POST['a2'] as $tribeId => $v) { if ($tribeId != 1 && $tribeId != 2 && $tribeId != 3 && $tribeId != 4 && $tribeId != 7 && $tribeId != 6) { $this->errorText = war_sim_nodefense2; } } $this->troopsMetadata = $this->gameMetadata['troops']; $this->showTroopsTable = TRUE; $this->showWarResult = FALSE; if (!isset($_POST['t1'])) { return; } $m = new WarBattleModel(); if (isset($_POST['h_off_bonus1']) && 0 < intval($_POST['h_off_bonus1'])) { $this->showWarResult = TRUE; } $troops = array(); $troopsPower = array(); foreach ($_POST['t1'] as $tribeId => $troopArray) { foreach ($troopArray as $tid => $tnum) { if (0 < $tnum) { $this->showWarResult = TRUE; } $troops[$tid] = intval($tnum); $troopsPower[$tid] = 0; } } if (!$this->showWarResult) { return; } $peopleCount = isset($_POST['ew1']) ? intval($_POST['ew1']) : 0; $heroLevel = isset($_POST['h_off_bonus1']) ? intval($_POST['h_off_bonus1']) : 0; $wringerPower = isset($_POST['kata']) ? intval($_POST['kata']) : 0; $attackTroops = $m->_getTroopWithPower($troops, $troopsPower, TRUE, $heroLevel, $peopleCount, $wringerPower, 0); $peopleCount = isset($_POST['ew2']) ? intval($_POST['ew2']) : 0; $wallLevel = isset($_POST['wall1']) ? intval($_POST['wall1']) : 0; $totalDefensePower = 0; $defenseTroops = array(); foreach ($_POST['t2'] as $tribeId => $troopArray) { $troops = array(); $troopsPower = array(); foreach ($troopArray as $tid => $tnum) { $troops[$tid] = intval($tnum); $troopsPower[$tid] = isset($_POST['f2'], $_POST['f2'][$tribeId]) && isset($_POST['f2'][$tribeId][$tid]) ? intval($_POST['f2'][$tribeId][$tid]) : 0; } $defenseTroops[$tribeId] = $m->_getTroopWithPower($troops, $troopsPower, FALSE, 0, $peopleCount, 0, $wallLevel); $totalDefensePower += $defenseTroops[$tribeId]['total_power']; } $this->warResult = $m->getWarResult($attackTroops, $defenseTroops, $totalDefensePower, isset($_POST['ktyp']) && intval($_POST['ktyp']) == 2); $m->dispose(); } } } } }
public function load() { parent::load(); $this->myData['name'] = $this->data['name']; $this->myData['avatar'] = $this->data['avatar']; $this->myData['id'] = $this->player->playerId; $this->pageIndex = isset($_GET['p']) && is_numeric($_GET['p']) ? intval($_GET['p']) : 0; $this->uid = isset($_GET['uid']) && 0 < intval($_GET['uid']) ? intval($_GET['uid']) : $this->player->playerId; $m = new SNprofileModel(); $rowsCount = $m->getNewsCount($this->uid); $this->pageCount = 0 < $rowsCount ? ceil($rowsCount / $this->pageSize) : 1; $this->userData = $m->getuserData($this->uid); $friendId = array(); $listRows = $m->getFriendsList($this->player->playerId); while ($listRows->next()) { $id = $listRows->row['playerid1'] == $this->player->playerId ? $listRows->row['playerid2'] : $listRows->row['playerid1']; $name = $listRows->row['playerid1'] == $this->player->playerId ? $listRows->row['playername2'] : $listRows->row['playername1']; $frienddata = $m->getFriendData($id); $this->friendList[] = array($id, $name, $frienddata['avatar'], $frienddata['last_login_sec']); $friendId[] = $id; } $this->isFriend = in_array($this->uid, $friendId) || $this->uid == $this->player->playerId ? TRUE : FALSE; if (isset($_GET['DNid']) && !empty($_GET['DNid'])) { $NewsID = mysql_real_escape_string(trim($_GET['DNid'])); if ($NewsID != "") { if ($this->myData['id'] == $this->uid) { $m->DeleteNews($NewsID, $this->player->playerId); } $m->dispose(); $this->redirect("snprofile.php?uid=" . $this->uid); } } else { if (isset($_GET['DCid']) && !empty($_GET['DCid'])) { $CommentID = mysql_real_escape_string(trim($_GET['DCid'])); if ($CommentID != "") { $m->DeleteComment($CommentID, $this->player->playerId); $m->dispose(); $this->redirect("snprofile.php?uid=" . $this->uid); } } else { if ($this->isPost()) { $post = array(); if (isset($_GET['do']) && $_GET['do'] == "News") { $post['userid'] = $this->uid; $post['message'] = isset($_POST['news']) && $_POST['news'] != "" ? trim($_POST['news']) : ""; $post['image'] = isset($_POST['image']) && $_POST['image'] != "" ? trim($_POST['image']) : ""; $post['url'] = isset($_POST['url']) && $_POST['url'] != "" ? trim($_POST['url']) : ""; $post['youtube'] = isset($_POST['youtube']) && $_POST['youtube'] != "" ? trim($_POST['youtube']) : ""; if ($this->uid == $this->player->playerId && $post['message'] != "") { $m->SendNews($post); } } else { $post['to_userid'] = $this->uid; $post['userid'] = intval($this->player->playerId); $post['username'] = $this->data['name']; $post['comment'] = isset($_POST['comment']) && $_POST['comment'] != "" ? trim($_POST['comment']) : ""; $post['topicid'] = isset($_POST['topicid']) && $_POST['topicid'] != "" ? trim($_POST['topicid']) : ""; if ($post['to_userid'] != 0 && $post['comment'] != "" && $post['userid'] != 0 && $this->isFriend) { $m->SendComment($post); } } $m->dispose(); $this->redirect("snprofile.php?uid=" . $this->uid); } else { $News = $m->GetNews($this->uid, $this->pageIndex, $this->pageSize); $k = 0; while ($News->next()) { $Comments = $m->GetComments($News->row['ID']); $this->topics[$k]['news'] = $News->row; while ($Comments->next()) { $this->topics[$k]['news']['comment'][] = $Comments->row; } ++$k; } $m->dispose(); } } } }
public function load() { parent::load(); $this->selectedTabIndex = isset($_GET['t']) && is_numeric($_GET['t']) && 0 <= intval($_GET['t']) && intval($_GET['t']) <= 11 ? intval($_GET['t']) : 0; $this->isAdmin = $this->data['player_type'] == PLAYERTYPE_ADMIN; $this->_tb = isset($_GET['tb']) ? intval($_GET['tb']) : 0; $m = new StatisticsModel(); $this->tatarRaised = $m->tatarRaised(); if ($this->selectedTabIndex == 11 && !$this->tatarRaised) { $this->selectedTabIndex = 0; } $this->selectedRank = 0; if ($this->selectedTabIndex == 0) { if ($this->isPost() && isset($_POST['rank']) && isset($_POST['name'])) { if (trim($_POST['name']) != "") { $this->selectedRank = intval($m->getPlayerRankByName(trim($_POST['name']), $this->_tb)); } else { if (0 < intval($_POST['rank'])) { $this->selectedRank = intval($_POST['rank']); } } } else { if (!isset($_GET['p'])) { $this->selectedRank = 0 < $this->_tb && $this->data['tribe_id'] != $this->_tb ? 1 : intval($m->getPlayerRankById($this->player->playerId, $this->_tb)); } } if ($this->isAdmin && !$this->isPost()) { if (isset($_GET['_cs']) && 0 < intval($_GET['_cs'])) { $m->togglePlayerStatus(intval($_GET['_cs'])); $this->adminActionMessage = statistics_p_playerstatusch; } else { if (isset($_GET['_dp']) && 0 < intval($_GET['_dp'])) { if ($m->getPlayerType(intval($_GET['_dp'])) == PLAYERTYPE_NORMAL) { $qm = new QueueJobModel(); $qm->deletePlayer(intval($_GET['_dp'])); $this->adminActionMessage = statistics_p_playerdeleted; } } else { if (isset($_GET['_gd']) && 0 < intval($_GET['_gd']) && isset($_GET['_g']) && 0 <= intval($_GET['_g'])) { $m->setPlayerGold(intval($_GET['_gd']), intval($_GET['_g'])); $this->adminActionMessage = statistics_p_goldwaschanged; } } } } } else { if ($this->selectedTabIndex == 1) { if ($this->isPost() && isset($_POST['rank']) && isset($_POST['name'])) { if (trim($_POST['name']) != "") { $this->selectedRank = intval($m->getAllianceRankByName(trim($_POST['name']))); } else { if (0 < intval($_POST['rank'])) { $this->selectedRank = intval($_POST['rank']); } } } else { if (!isset($_GET['p'])) { $this->selectedRank = intval($m->getAllianceRankById(intval($this->data['alliance_id']))); } } } else { if ($this->selectedTabIndex == 2) { if ($this->isPost() && isset($_POST['rank']) && isset($_POST['name'])) { if (trim($_POST['name']) != "") { $this->selectedRank = intval($m->getVillageRankByName(trim($_POST['name']))); } else { if (0 < intval($_POST['rank'])) { $this->selectedRank = intval($_POST['rank']); } } } else { if (!isset($_GET['p'])) { $this->selectedRank = intval($m->getVillageRankById($this->data['selected_village_id'])); } } } else { if ($this->selectedTabIndex == 3) { if ($this->isPost() && isset($_POST['rank']) && isset($_POST['name'])) { if (trim($_POST['name']) != "") { $this->selectedRank = intval($m->getHeroRankByName(trim($_POST['name']))); } else { if (0 < intval($_POST['rank'])) { $this->selectedRank = intval($_POST['rank']); } } } else { if (!isset($_GET['p'])) { $this->selectedRank = intval($m->getHeroRankById($this->player->playerId)); } } } else { if ($this->selectedTabIndex == 6 || $this->selectedTabIndex == 7) { if ($this->isPost() && isset($_POST['rank']) && isset($_POST['name'])) { if (trim($_POST['name']) != "") { $this->selectedRank = intval($m->getPlayersPointsByName(trim($_POST['name']), $this->selectedTabIndex == 6)); } else { if (0 < intval($_POST['rank'])) { $this->selectedRank = intval($_POST['rank']); } } } else { if (!isset($_GET['p'])) { $this->selectedRank = intval($m->getPlayersPointsById($this->player->playerId, $this->selectedTabIndex == 6)); } } } else { if ($this->selectedTabIndex == 9 || $this->selectedTabIndex == 10) { if ($this->isPost() && isset($_POST['rank']) && isset($_POST['name'])) { if (trim($_POST['name']) != "") { $this->selectedRank = intval($m->getAlliancePointsRankByName(trim($_POST['name']), $this->selectedTabIndex == 9)); } else { if (0 < intval($_POST['rank'])) { $this->selectedRank = intval($_POST['rank']); } } } else { if (!isset($_GET['p'])) { $this->selectedRank = intval($m->getAlliancePointsRankById(intval($this->data['alliance_id']), $this->selectedTabIndex == 9)); } } } } } } } } if ($this->selectedTabIndex == 0) { $rowsCount = $m->getPlayerListCount($this->_tb); $this->pageCount = 0 < $rowsCount ? ceil($rowsCount / $this->pageSize) : 1; $this->pageIndex = 0 < $this->selectedRank ? floor(($this->selectedRank - 1) / $this->pageSize) : isset($_GET['p']) && is_numeric($_GET['p']) ? intval($_GET['p']) : 0; if ($this->pageCount <= $this->pageIndex) { $this->pageIndex = $this->pageCount - 1; $this->selectedRank = 0 - 1; } $this->dataList = $m->getPlayerList($this->pageIndex, $this->pageSize, $this->_tb); } else { if ($this->selectedTabIndex == 1) { $rowsCount = $m->getAllianceListCount(); $this->pageCount = 0 < $rowsCount ? ceil($rowsCount / $this->pageSize) : 1; $this->pageIndex = 0 < $this->selectedRank ? floor(($this->selectedRank - 1) / $this->pageSize) : isset($_GET['p']) && is_numeric($_GET['p']) ? intval($_GET['p']) : 0; if ($this->pageCount <= $this->pageIndex) { $this->pageIndex = $this->pageCount - 1; $this->selectedRank = 0 - 1; } $this->dataList = $m->getAlliancesList($this->pageIndex, $this->pageSize); } else { if ($this->selectedTabIndex == 2) { $rowsCount = $m->getVillageListCount(); $this->pageCount = 0 < $rowsCount ? ceil($rowsCount / $this->pageSize) : 1; $this->pageIndex = 0 < $this->selectedRank ? floor(($this->selectedRank - 1) / $this->pageSize) : isset($_GET['p']) && is_numeric($_GET['p']) ? intval($_GET['p']) : 0; if ($this->pageCount <= $this->pageIndex) { $this->pageIndex = $this->pageCount - 1; $this->selectedRank = 0 - 1; } $this->dataList = $m->getVillagesList($this->pageIndex, $this->pageSize); } else { if ($this->selectedTabIndex == 3) { $rowsCount = $m->getHeroListCount(); $this->pageCount = 0 < $rowsCount ? ceil($rowsCount / $this->pageSize) : 1; $this->pageIndex = 0 < $this->selectedRank ? floor(($this->selectedRank - 1) / $this->pageSize) : isset($_GET['p']) && is_numeric($_GET['p']) ? intval($_GET['p']) : 0; if ($this->pageCount <= $this->pageIndex) { $this->pageIndex = $this->pageCount - 1; $this->selectedRank = 0 - 1; } $this->dataList = $m->getHerosList($this->pageIndex, $this->pageSize); } else { if ($this->selectedTabIndex == 4) { $this->generalData = $m->getGeneralSummary(); } else { if ($this->selectedTabIndex == 6 || $this->selectedTabIndex == 7) { $rowsCount = $m->getPlayersPointsListCount(); $this->pageCount = 0 < $rowsCount ? ceil($rowsCount / $this->pageSize) : 1; $this->pageIndex = 0 < $this->selectedRank ? floor(($this->selectedRank - 1) / $this->pageSize) : isset($_GET['p']) && is_numeric($_GET['p']) ? intval($_GET['p']) : 0; if ($this->pageCount <= $this->pageIndex) { $this->pageIndex = $this->pageCount - 1; $this->selectedRank = 0 - 1; } $this->dataList = $m->getPlayersPointsList($this->pageIndex, $this->pageSize, $this->selectedTabIndex == 6); } else { if ($this->selectedTabIndex == 9 || $this->selectedTabIndex == 10) { $rowsCount = $m->getAlliancePointsListCount(); $this->pageCount = 0 < $rowsCount ? ceil($rowsCount / $this->pageSize) : 1; $this->pageIndex = 0 < $this->selectedRank ? floor(($this->selectedRank - 1) / $this->pageSize) : isset($_GET['p']) && is_numeric($_GET['p']) ? intval($_GET['p']) : 0; if ($this->pageCount <= $this->pageIndex) { $this->pageIndex = $this->pageCount - 1; $this->selectedRank = 0 - 1; } $this->dataList = $m->getAlliancePointsList($this->pageIndex, $this->pageSize, $this->selectedTabIndex == 9); } else { if ($this->selectedTabIndex == 5 || $this->selectedTabIndex == 8) { if ($this->selectedTabIndex == 5) { } $this->top10Result = array("URL" => $this->selectedTabIndex == 5 ? "profile.php?uid=" : "alliance.php?id=", "TARGETNAME" => $this->selectedTabIndex == 5 ? $this->data['name'] : $this->data['alliance_name'], "TARGETID" => $this->selectedTabIndex == 5 ? $this->player->playerId : intval($this->data['alliance_id']), "TARGEPOINT_ATTACK" => $this->selectedTabIndex == 5 ? $this->data['week_attack_points'] : $m->getAlliancePoint(intval($this->data['alliance_id']), "week_attack_points"), "TARGEPOINT_DEFENSE" => $this->selectedTabIndex == 5 ? $this->data['week_defense_points'] : $m->getAlliancePoint(intval($this->data['alliance_id']), "week_defense_points"), "TARGEPOINT_DEV" => $this->selectedTabIndex == 5 ? $this->data['week_dev_points'] : $m->getAlliancePoint(intval($this->data['alliance_id']), "week_dev_points"), "TARGEPOINT_THIEF" => $this->selectedTabIndex == 5 ? $this->data['week_thief_points'] : $m->getAlliancePoint(intval($this->data['alliance_id']), "week_thief_points"), "ATTACK" => $m->getTop10($this->selectedTabIndex == 5, "week_attack_points"), "DEFENSE" => $m->getTop10($this->selectedTabIndex == 5, "week_defense_points"), "DEV" => $m->getTop10($this->selectedTabIndex == 5, "week_dev_points"), "THIEF" => $m->getTop10($this->selectedTabIndex == 5, "week_thief_points")); } else { if ($this->selectedTabIndex == 11) { $this->dataList = $m->getTatarVillagesList(); } } } } } } } } } $m->dispose(); }
public function load() { parent::load(); $this->sendMail = TRUE; $this->isInbox = TRUE; $this->viewOnly = FALSE; $this->showFriendPane = FALSE; $this->errorText = ""; $this->showList = !(isset($_GET['t']) && is_numeric($_GET['t']) && intval($_GET['t']) == 1); $this->selectedTabIndex = isset($_GET['t']) && is_numeric($_GET['t']) && 1 <= intval($_GET['t']) && intval($_GET['t']) <= 2 ? intval($_GET['t']) : 0; $this->friendList = array(); $friends_player_ids = trim($this->data['friend_players']); if ($friends_player_ids != "") { $friends_player_ids = explode("\n", $friends_player_ids); foreach ($friends_player_ids as $friend) { list($playerId, $playerName) = explode(" ", $friend); $this->friendList[$playerId] = $playerName; } } $m = new MessageModel(); if (!$this->isPost()) { if (isset($_GET['uid']) && is_numeric($_GET['uid']) && 0 < intval($_GET['uid'])) { $this->receiver = $m->getPlayerNameById(intval($_GET['uid'])); $this->showList = FALSE; $this->selectedTabIndex = 1; } else { if (isset($_GET['id']) && is_numeric($_GET['id']) && 0 < intval($_GET['id'])) { $result = $m->getMessage($this->player->playerId, intval($_GET['id'])); if ($result->next()) { $this->viewOnly = TRUE; $this->showList = FALSE; $this->isInbox = $result->row['to_player_id'] == $this->player->playerId; $this->sendMail = !$this->isInbox; $this->receiver = $this->isInbox ? $result->row['from_player_name'] : $result->row['to_player_name']; $this->subject = $result->row['msg_title']; $this->body = $this->getFilteredText($result->row['msg_body']); $this->messageDate = $result->row['mdate']; $this->messageTime = $result->row['mtime']; $this->selectedTabIndex = $this->isInbox ? 0 : 2; if ($this->isInbox && !$result->row['is_readed'] && !$this->player->isSpy) { $m->markMessageAsReaded($this->player->playerId, intval($_GET['id'])); --$this->data['new_mail_count']; } } else { $this->showList = TRUE; $this->selectedTabIndex = 0; } $result->free(); } } } else { if (isset($_POST['sm'])) { $this->receiver = trim($_POST['an']); $this->subject = trim($_POST['be']); $this->body = $_POST['message']; if (trim($this->receiver) == "") { $this->showList = FALSE; $this->selectedTabIndex = 1; $this->errorText = messages_p_noreceiver . "<p></p>"; $m->dispose(); } else { if (trim($this->body) == "") { $this->showList = FALSE; $this->selectedTabIndex = 1; $this->errorText = messages_p_nobody . "<p></p>"; $m->dispose(); } else { if (strtolower(trim($this->receiver)) == "[ally]" && 0 < intval($this->data['alliance_id']) && $this->hasAllianceSendMessageRole()) { $pids = trim($m->getAlliancePlayersId(intval($this->data['alliance_id']))); if ($pids != "") { if ($this->subject == "") { $this->subject = messages_p_emptysub; } $arr = explode(",", $pids); foreach ($arr as $apid) { if ($apid == $this->player->playerId) { continue; } $m->sendMessage($this->player->playerId, $this->data['name'], $apid, $m->getPlayerNameById($apid), $this->subject, $this->body); } $this->showList = TRUE; $this->selectedTabIndex = 2; } } else { $receiverPlayerId = $m->getPlayerIdByName($this->receiver); if (0 < intval($receiverPlayerId)) { if ($receiverPlayerId == $this->player->playerId) { $this->showList = FALSE; $this->selectedTabIndex = 1; $this->errorText = "<b>" . messages_p_noloopback . "</b><p></p>"; } else { if ($this->subject == "") { $this->subject = messages_p_emptysub; } $m->sendMessage($this->player->playerId, $this->data['name'], $receiverPlayerId, $this->receiver, $this->subject, $this->body); $this->showList = TRUE; $this->selectedTabIndex = 2; } } else { $this->showList = FALSE; $this->selectedTabIndex = 1; $this->errorText = messages_p_notexists . " <b>" . $this->receiver . "</b><p></p>"; } } } } } else { if (isset($_POST['fm'])) { $this->receiver = trim($_POST['an']); $this->subject = trim($_POST['be']); $this->body = $_POST['message']; $this->showList = FALSE; $this->selectedTabIndex = 1; $this->showFriendPane = TRUE; if ($_POST['fm'] != "" && is_numeric($_POST['fm'])) { $playerId = intval($_POST['fm']); if (0 < $playerId && isset($this->friendList[$playerId])) { unset($this->friendList[$playerId]); } } else { if (isset($_POST['mfriends'])) { foreach ($_POST['mfriends'] as $friendName) { $friendName = trim($friendName); if ($friendName == "") { continue; } $playerId = intval($m->getPlayerIdByName($friendName)); if (0 < $playerId && !isset($this->friendList[$playerId]) && $playerId != $this->player->playerId) { $this->friendList[$playerId] = $friendName; } } } } $friends = ""; foreach ($this->friendList as $k => $v) { if ($friends != "") { $friends .= "\n"; } $friends .= $k . " " . $v; } $m->saveFriendList($this->player->playerId, $friends); } else { if (isset($_POST['rm'])) { $this->receiver = trim($_POST['an']); $this->subject = trim($_POST['be']); $this->body = PHP_EOL . PHP_EOL . "_________________________________" . PHP_EOL . text_from_lang . " " . $this->receiver . ":" . PHP_EOL . PHP_EOL . $_POST['message']; preg_match("/^(RE)\\^?([0-9]*):([\\w\\W]*)\$/", $this->subject, $matches); if (sizeof($matches) == 4) { $this->subject = "RE^" . ($matches[2] + 1) . ":" . $matches[3]; } else { $this->subject = "RE: " . $this->subject; } $this->showList = FALSE; $this->selectedTabIndex = 1; } else { if (isset($_POST['dm']) && isset($_POST['dm'])) { foreach ($_POST['dm'] as $messageId) { if ($m->deleteMessage($this->player->playerId, $messageId)) { --$this->data['new_mail_count']; } } } } } } } if ($this->showList) { $rowsCount = $m->getMessageListCount($this->player->playerId, $this->selectedTabIndex == 0); $this->pageCount = 0 < $rowsCount ? ceil($rowsCount / $this->pageSize) : 1; $this->pageIndex = isset($_GET['p']) && is_numeric($_GET['p']) && intval($_GET['p']) < $this->pageCount ? intval($_GET['p']) : 0; $this->dataList = $m->getMessageList($this->player->playerId, $this->selectedTabIndex == 0, $this->pageIndex, $this->pageSize); if (0 < $this->data['new_mail_count']) { $this->data['new_mail_count'] = $m->syncMessages($this->player->playerId); } } $m->dispose(); }
public function load() { parent::load(); if (isset($_GET['l']) && !$this->data['active_plus_account']) { exit(0); } else { $this->largeMap = isset($_GET['l']) && $this->data['active_plus_account']; $this->viewFile = $this->largeMap ? "map2.phtml" : "map.phtml"; if ($this->largeMap) { $this->layoutViewFile = "layout" . DIRECTORY_SEPARATOR . "popup.phtml"; } $this->rad = $this->largeMap ? 6 : 3; $map_size = $this->setupMetadata['map_size']; $this->x = $this->data['rel_x']; $this->y = $this->data['rel_y']; $m = new MapModel(); $this->contractsAllianceId = array(); if (0 < intval($this->data['alliance_id'])) { $cont = trim($m->getContractsAllianceId($this->data['alliance_id'])); if ($cont != "") { $_arr = explode(",", $cont); foreach ($_arr as $contractAllianceId) { list($aid, $pendingStatus) = $contractAllianceId; $this->contractsAllianceId[$aid] = $pendingStatus; } } } $_x = $this->data['rel_x']; $_y = $this->data['rel_y']; if ($this->isPost()) { $_x = intval($_POST['mxp']); $_y = intval($_POST['myp']); } else { if (isset($_GET['id']) && is_numeric($_GET['id'])) { $m_vid = intval($_GET['id']); if ($m_vid < 1) { $m_vid = 1; } $_x = floor(($m_vid - 1) / $map_size); $_y = $m_vid - ($_x * $map_size + 1); } } $map_matrix = $this->__getVillageMatrix($map_size, $_x, $_y, $this->rad); $map_matrix_arr = explode("|", $map_matrix); $matrixStr = $map_matrix_arr[0]; $matrixStrArray = explode(",", $matrixStr); $this->directionsMatrix = explode(",", $map_matrix_arr[1]); $result = $m->getVillagesMatrix($matrixStr); while ($result->next()) { $this->matrixSet[$result->row['id']] = array("vid" => $result->row['id'], "x" => $result->row['rel_x'], "y" => $result->row['rel_y'], "image_num" => $result->row['image_num'], "player_id" => $result->row['player_id'], "tribe_id" => $result->row['tribe_id'], "alliance_id" => $result->row['alliance_id'], "player_name" => $result->row['player_name'], "village_name" => $result->row['village_name'], "alliance_name" => $result->row['alliance_name'], "people_count" => $result->row['people_count'], "is_oasis" => $result->row['is_oasis'], "field_maps_id" => $result->row['field_maps_id']); } $i = 0; $this->json = ""; $sjson = ""; $sortedArray = array(); foreach ($matrixStrArray as $vid) { $mapItem = $this->matrixSet[$vid]; $sortedArray[] = $mapItem; if ($sjson != "") { $sjson .= ","; } $sjson .= sprintf("[%s,%s,%s,\"%s\",\"%s\",%s,%s", $mapItem['vid'], $mapItem['x'], $mapItem['y'], $this->getCssClassNameByItem($mapItem), $this->getMapAreaTitle($mapItem), $mapItem['player_id'] != "" ? 1 : 0, $mapItem['is_oasis']); if ($mapItem['player_id'] != "") { $sjson .= sprintf(",%s,%s,\"%s\",\"%s\",\"%s\"", $mapItem['tribe_id'], $mapItem['people_count'], htmlspecialchars(str_replace("\\", "\\\\", $mapItem['player_name'])), htmlspecialchars(str_replace("\\", "\\\\", $mapItem['village_name'])), htmlspecialchars(str_replace("\\", "\\\\", $mapItem['alliance_name']))); } else { if (!$mapItem['is_oasis']) { $sjson .= "," . $mapItem['field_maps_id']; } } $sjson .= "]"; if (++$i % ($this->rad * 2 + 1) == 0) { if ($this->json != "") { $this->json .= ","; } $this->json .= "[" . $sjson . "]"; $sjson = ""; } } $this->json = "[" . $this->json . "]"; $this->matrixSet = $sortedArray; $centerIndex = 2 * ($this->rad + 1) * $this->rad; $this->x = $this->matrixSet[$centerIndex]['x']; $this->y = $this->matrixSet[$centerIndex]['y']; $this->stepDirectionsMatrix = array($this->matrixSet[$centerIndex - $this->rad * 2 - 1]['vid'], $this->matrixSet[$centerIndex + 1]['vid'], $this->matrixSet[$centerIndex + $this->rad * 2 + 1]['vid'], $this->matrixSet[$centerIndex - 1]['vid']); $m->dispose(); if ($this->isCallback()) { echo $this->getClientScript(); exit(0); } } }
public function load() { parent::load(); }
public function load() { parent::load(); $this->msgText = ""; $this->giveid = $this->player->playerId; }