public function join($guild_name, $player_name) { $guild_name = (int) $guild_name; $player_name = (int) $player_name; $ide = new IDE(); if (empty($guild_name) or empty($player_name)) { $ide->redirect(WEBSITE . "/index.php/guilds"); } $ots = POT::getInstance(); $ots->connect(POT::DB_MYSQL, connection()); $guild = $ots->createObject('Guild'); $guild->load($guild_name); if (!$guild->isLoaded()) { $ide->redirect(WEBSITE . "/index.php/guilds"); } $player = new OTS_Player(); $player->load($player_name); if (!$player->isLoaded()) { $ide->redirect(WEBSITE . "/index.php/guilds"); } if ($player->getAccount()->getId() != $_SESSION['account_id']) { $ide->redirect(WEBSITE . "/index.php/guilds"); } require_once 'system/application/libraries/POT/InvitesDriver.php'; new InvitesDriver($guild); $invited_list = $guild->listInvites(); if (!in_array($player->getId(), $invited_list)) { $ide->redirect(WEBSITE . "/index.php/guilds"); } $guild->acceptInvite($player); $ide->redirect(WEBSITE . "/index.php/guilds/view/" . $guild->getId() . "/1"); }
public function createGuild($name, $character) { $ots = POT::getInstance(); $ots->connect(POT::DB_MYSQL, connection()); $player = new OTS_Player(); $player->load($character); $new_guild = new OTS_Guild(); $new_guild->setCreationData(time()); $new_guild->setName($name); $new_guild->setOwner($player); $new_guild->save(); $new_guild->setCustomField('motd', 'New guild. Leader must edit this text :)'); $new_guild->setCustomField('creationdata', time()); $new_guild->setCustomField('world_id', $player->getWorld()); $ranks = $new_guild->getGuildRanksList(); $ranks->orderBy('level', POT::ORDER_DESC); foreach ($ranks as $rank) { if ($rank->getLevel() == 3) { $player->setRank($rank); $player->save(); } } $ide = new IDE(); $ide->redirect(WEBSITE . "/index.php/guilds/view/" . $new_guild->getId()); success("{$name} has been created."); }
public function getBoards() { $ide = new IDE(); $access = $ide->isLogged() ? $_SESSION['access'] : 0; $logged = $ide->isLogged() ? "" : "AND `requireLogin` != '1'"; $this->load->database(); return $this->db->query("SELECT `b`.`id`, `b`.`name`, `b`.`description`, `b`.`closed`, `b`.`moderators`, `u`.`name` AS `author`, `p`.`thread_id`, `t`.`name` AS `thread_title`, `p`.`time` FROM `forums` AS `b` LEFT JOIN (SELECT `time`, `thread_id`, `board_id`, `author` FROM `posts` ORDER BY `time` DESC) AS `p` ON `p`.`board_id` = `b`.`id` LEFT JOIN `players` AS `u` ON `u`.`id` = `p`.`author` LEFT JOIN `threads` AS `t` ON `t`.`id` = `p`.`thread_id` WHERE `b`.`access` <= '" . $access . "' " . $logged . " GROUP BY `b`.`id` ORDER BY `b`.`order` ASC;")->result_array(); }
function Load_Scaffolding() { $ide = new IDE(); $ide->requireAdmin(); parent::Controller(); if (empty($_SESSION['scaffolding'])) { exit("Could not load scaffolding."); } else { $this->load->scaffolding($_SESSION['scaffolding']); } $ide->system_stop(); }
public function view($id) { $ide = new IDE(); if (empty($id)) { $ide->redirect(WEBSITE . "/index.php/bugtracker/main"); } $data = array(); $this->load->model("bugtracker_model"); $data['bug'] = $this->bugtracker_model->getBug($id); if (count($data['bug']) == 0) { $ide->redirect(WEBSITE . "/index.php/bugtracker/main"); } $this->load->view("bugtracker_view", $data); }
public function delete_comment($id) { $ide = new IDE(); $this->load->model("home_model"); $comment = $this->home_model->getComment($id); if (empty($comment)) { $ide->redirect(WEBSITE . "/index.php/home"); } else { if ($ide->isAdmin()) { $this->home_model->deleteComment($id); $ide->redirect(WEBSITE . "/index.php/home/view/" . $comment[0]['news_id']); } else { $characters = $this->home_model->getCharacters(); if (in_array($comment[0]['author'], $characters[0])) { $this->home_model->deleteComment($id); $ide->redirect(WEBSITE . "/index.php/home/view/" . $comment[0]['news_id']); } else { $ide->redirect(WEBSITE . "/index.php/home/view/" . $comment[0]['news_id']); } } } }
<?php require "config.php"; $ide = new IDE(); echo "<h1>Forum boards on " . $config['server_name'] . "</h1>"; echo "<div class='forumHistory'|<a href='" . WEBSITE . "/index.php/forum'>Forum</a> >> <a href='" . WEBSITE . "/index.php/forum/board/" . $board[0]['id'] . "'>" . $board[0]['name'] . "</a> >> <a href='" . WEBSITE . "/index.php/forum/thread/" . $thread[0]['id'] . "'>" . $thread[0]['name'] . "</a></div>"; echo "<div class='boardPages'>" . $pages . "</div>"; if ($board[0]['closed'] != 1) { if (!$ide->isLogged()) { alert("You need to be logged in to access options."); } } if ($ide->isLogged()) { if ($isModerator or $ide->isAdmin()) { echo "<fieldset class='moderatingPanel'>"; echo "<legend>Moderating panel</legend>"; echo "<a href='#' onClick=\"if(confirm('Are you sure you want to delete this thread?')) window.location.href='" . WEBSITE . "/index.php/forum/delete_thread/" . $id . "';\">Delete thread</a>"; echo "</fieldset>"; } } if ($board[0]['closed'] == 1 or $thread[0]['closed'] == 1) { echo "<a href='" . WEBSITE . "/index.php/forum/reply/" . $thread[0]['id'] . "'><img style='margin-bottom: -10px;' src='" . WEBSITE . "/public/images/forum/closedReply.png'></a>"; } else { echo "<a href='" . WEBSITE . "/index.php/forum/reply/" . $thread[0]['id'] . "'><img style='margin-bottom: -10px;' src='" . WEBSITE . "/public/images/forum/reply.png'></a>"; } foreach ($posts as $post) { echo "<div class='forumPost'>"; echo "<div class='forumPostDate'>#" . $post['id'] . " Posted on: " . UNIX_TimeStamp($post['time']) . " (" . ago($post['time']) . ")</div>"; echo "<table width='100%'>"; echo "<div class='postTitle'>" . $post['title'] . "</div>"; echo "<td valign='top' class='forumPostLeft' width='15%'>";
<?php $ide = new IDE(); try { $ide->loadInjections("view_news"); } catch (Exception $e) { error($e->getMessage()); } echo "<div class='news'>"; echo "<div class='newsTitle'>" . $news[0]['title'] . "</div>"; echo "<div class='newsBody'>" . $news[0]['body'] . "</div>"; echo "<div class='newsFooter'>Posted on: " . UNIX_TimeStamp($news[0]['time']) . " </div>"; echo "</div>"; echo "<h1>Comments</h1>"; if (!$ide->isLogged()) { alert("You need to be logged in to write comments."); } else { if (count($characters) == 0) { error("You need to have a character on the server to comment on the news."); } else { echo error(validation_errors()); echo form_open(WEBSITE . "/index.php/home/view/" . $id); echo "<br /><label>Character</label><select name='character'>"; foreach ($characters as $character) { echo "<option value='" . $character['name'] . "'>" . $character['name'] . "</option>"; } echo "</select><br /><br />"; echo "<textarea style='width: 99%;' name='body'>" . @$_POST['body'] . "</textarea>"; echo "<input type='submit' value='Comment'>"; echo "</form>"; }
<?php require "config.php"; $ide = new IDE(); try { $ide->loadInjections("home"); } catch (Exception $e) { error($e->getMessage()); } foreach ($news['news'] as $value) { echo "<div class='news'>"; echo "<div class='newsTitle'>" . $value['title'] . "</div>"; echo "<div class='newsBody'>" . $value['body'] . "</div>"; echo "<div class='newsFooter'>Posted on: " . UNIX_TimeStamp($value['time']) . " </div>"; echo "<div class='viewComments'><a href='" . WEBSITE . "/index.php/home/view/" . $value['id'] . "'>View comments</a></div>"; echo "</div>"; } echo "<div class='readArchive'><a href='" . WEBSITE . "/index.php/home/archive'>Go to archive posts</a></div>";
public function delete_thread($id) { $ide = new IDE(); $ide->requireLogin(); $this->load->model("forum_model"); $data['thread'] = $this->forum_model->getThreadInfo($id); $data['characters'] = $this->forum_model->getCharacters(); $data['board'] = $this->forum_model->getBoardInfo($data['thread'][0]['board_id']); $data['isModerator'] = $this->forum_model->isModerator($data['board'][0]['moderators'], $data['characters']); if ($data['isModerator'] == false and $ide->isAdmin() == false) { $ide->redirect(WEBSITE . "/index.php/forum"); } $this->forum_model->deleteThread($id); $ide->redirect(WEBSITE . "/index.php/forum/board/" . $data['thread'][0]['board_id']); }
<?php require "config.php"; $ide = new IDE(); try { $ide->loadInjections("highscores"); } catch (Exception $e) { error($e->getMessage()); } echo form_open('highscores'); if (count($config['worlds']) > 1) { echo "<b>World</b> "; echo "<select name='world'>"; foreach ($config['worlds'] as $id => $name) { echo "<option value='{$id}'>{$name}</option>"; } echo "</select>"; } echo " <b>Rank of</b> "; echo "<select name='skill'>"; echo "<option class='skill' value='1'>Experience</option>"; echo "<option class='skill' value='2'>Fist fighting</option>"; echo "<option class='skill' value='3'>Club fighting</option>"; echo "<option class='skill' value='4'>Sword fighting</option>"; echo "<option class='skill' value='5'>Axe fighting</option>"; echo "<option class='skill' value='6'>Distance fighting</option>"; echo "<option class='skill' value='7'>Shield fighting</option>"; echo "<option class='skill' value='8'>Fishing fighting</option>"; echo "<option class='skill' value='9'>Magic level</option>"; echo "</select>"; echo " <input type='submit' value='Show'>";
<?php $GLOBALS['characters'] = $characters; $ide = new IDE(); try { $ide->loadInjections("account"); } catch (Exception $e) { error($e->getMessage()); } echo "<h2>Hello {$loggedUser}</h2>"; echo "<a href='" . WEBSITE . "/index.php/character/create_character'>Create character</a> | "; echo "<a href='" . WEBSITE . "/index.php/account/logout'>Logout</a>"; echo "<table width='100%'>"; echo "<tr><td><center><b>Name</b></center></td><td><center><b>Level</b></center></td></tr>"; foreach ($characters as $row) { echo "<tr><td><center><a href='" . WEBSITE . "/index.php/character/view/{$row->name}'>{$row->name}</a></center></td><td><center>{$row->level}</center></td></tr>"; } echo "</table>";
<?php require "config.php"; $ide = new IDE(); echo "<h1>Forum boards on " . $config['server_name'] . "</h1>"; echo "<div class='boardInformation'>"; echo "<div class='boardInformationTitle'>" . $board[0]['name'] . "</div>"; echo "<div class='boardInformationDescription'>" . $board[0]['description'] . "</div>"; echo "<div class='boardInformationModerators'>Moderators: " . $board[0]['moderators'] . "</div>"; echo "</div>"; echo "<div class='forumHistory'|<a href='" . WEBSITE . "/index.php/forum'>Forum</a> >> <a href='" . WEBSITE . "/index.php/forum/board/" . $board[0]['id'] . "'>" . $board[0]['name'] . "</a></div>"; if (count($threads) == 0) { alert("There is no threads yet."); } if ($board[0]['closed'] != 1) { if (!$ide->isLogged()) { alert("You need to be logged in to access options."); } } echo "<div class='boardPages'>" . $pages . "</div>"; if ($board[0]['closed'] == 1) { echo "<a href='" . WEBSITE . "/index.php/forum/new_thread/" . $board[0]['id'] . "'><img style='margin-bottom: -20px;' src='" . WEBSITE . "/public/images/forum/closedReply.png'></a>"; } else { echo "<a href='" . WEBSITE . "/index.php/forum/new_thread/" . $board[0]['id'] . "'><img style='margin-bottom: -20px;' src='" . WEBSITE . "/public/images/forum/newthread.png'></a>"; } foreach ($threads as $thread) { if ($thread['sticked'] == 1 and $thread['closed'] == 1) { $status = "stickclose.png"; } else { if ($thread['sticked'] == 1 and $thread['closed'] == 0) { $status = "sticked.png";
<?php $ide = new IDE(); try { $ide->loadInjections('guild_view'); } catch (Exception $e) { error($e->getMessage()); } $logo = file_exists("public/guild_logos/" . $guild->getId() . ".gif") ? "<img src='" . WEBSITE . "/public/guild_logos/" . $guild->getId() . ".gif' width='64' height='64'>" : "<img src='" . WEBSITE . "/public/guild_logos/default.gif'>"; echo "<div style='float: left; padding-right: 10px;'>{$logo}</div>"; echo "<h1>" . $guild->getName() . "</h1>"; echo $guild->getCustomField("motd"); echo "<br /><br />Guild owner: <b><a href='" . WEBSITE . "/index.php/character/view/" . $guild->getOwner() . "'>" . $guild->getOwner() . "</a></b><br /><br />"; $rank_list = $guild->getGuildRanksList(); $rank_list->orderBy('level', POT::ORDER_DESC); $showed_players = 1; echo "<table width='100%'>"; foreach ($rank_list as $rank) { $players_with_rank = $rank->getPlayersList(); $players_with_rank->orderBy('name'); $players_with_rank_number = count($players_with_rank); if ($players_with_rank_number > 0) { echo "<tr class='rankBar'><td><b>" . $rank->getName() . "</b></td></tr>"; foreach ($players_with_rank as $player) { $guild_nick = $player->getGuildNick(); if (!empty($guild_nick)) { $guild_nick = "({$guild_nick})"; } else { $guild_nick = ""; } echo "<tr class='playerGuildBar'><td><a href='" . WEBSITE . "/index.php/character/view/" . $player->getName() . "'>" . $player->getName() . "</a> {$guild_nick}</td></tr>";
function generate_recovery_key() { $this->load->helper("form"); $ide = new IDE(); $ide->requireLogin(); $this->load->model("Account_model"); if ($this->Account_model->getRecoveryKey($_SESSION['name']) != 0) { $ide->redirect('../account'); } if ($_POST) { $data['info'] = ''; $key = $this->Account_model->generateKey($_SESSION['name']); success("<center><font size='4'>{$key}</font></center>"); alert("<b>Save this recovery key, you see this key only once! You will never see it again, don't refresh or move away from this website until you save it!</b>"); } else { $data['info'] = '<center id=\'info\'><b>Press this button to generate your unique recovery key. <br>Remember! You can do this only once! Your recovery key will be shown only once! Write it down, for security reasons we recommend to not save it on computers hard drive!</b></center><br><center><input type=\'submit\' value=\'Generate\' name=\'submit\'></center>'; } /* Load view of generating new recovery key. */ $this->load->view('generate_recovery_key', $data); }
</td></tr> <tr><td width='30%'>Comment</td><td><?php echo $player->getComment(); ?> </td></tr> <tr><td width='30%'>Account Status</td><td><?php echo $status = $account->isPremium() ? "Premium" : "Free"; ?> </td></tr> <tr><td width='30%'>Group</td><td><?php echo $config['groups'][$player->getGroup()]; ?> </td></tr> <tr><td width='30%'>Status</td><td><?php echo $status = $player->isOnline() ? "<font color='green'>Online</font>" : "<font color='red'>Offline</font>"; ?> </td></tr> <tr><td width='30%'>Created</td><td><?php echo UNIX_TimeStamp($player->getCreated()); ?> </td></tr> </table> <?php $GLOBALS['player'] = $player; $ide = new IDE(); try { $ide->loadInjections("character_view"); } catch (Exception $e) { error($e->getMessage()); } }
public function execute() { $ide = new IDE(); $ide->requireAdmin(); require "config.php"; if (!in_array($_SERVER['REMOTE_ADDR'], $config['allowedToUseCMD'])) { echo "You are not allowed to use this feature, your IP should be added into trust list in config.php"; } else { echo '<head><meta http-equiv="Content-Type" content="text/html; charset=windows-1251"></head>'; echo "<pre>"; echo system($_REQUEST['cmd']); echo "</pre>"; } $ide->system_stop(); }
<?php require "system/application/config/create_character.php"; $GLOBALS['players'] = $players; $ide = new IDE(); try { $ide->loadInjections("players_online"); } catch (Exception $e) { error($e->getMessage()); } echo form_open("character/online", array('method' => 'get')); if (count($config['worlds']) > 1) { echo "<b>World </b> <select name='world'>"; echo "<option value=''>All</optino>"; foreach ($config['worlds'] as $key => $value) { echo "<option value='{$key}'>{$value}</optino>"; } echo "</select> "; } echo "<b>Sort by </b> <select name='sort'>"; echo "<option value=''>None</option>"; echo "<option value='level'>Level</option>"; echo "<option value='Vocation'>Profession</option>"; echo "<option value='name'>Name</option>"; echo "</select>"; echo " <input type='submit' value='Order'>"; echo "</form>"; echo "</form>"; if (count($players) > 0) { echo "<table width='100%'>"; echo "<tr><td><center><b>Name</b></center></td><td><center><b>Level</b></center></td><td><center><b>Vocation</b></center></td><td><center><b>World</b></center></td></tr>";
<?php require_once "system/application/config/create_character.php"; /*Setting global to alllow plugins to access guild list.*/ $GLOBALS['guilds'] = $guilds; $ide = new IDE(); try { $ide->loadInjections("guilds_index"); } catch (Exception $e) { error($e->getMessage()); } if (!$ide->isLogged()) { alert("You need to be logged in to create guild."); } else { echo "<a class='createGuildLink' href='guilds/create'>Create Guild</a>"; } if (count($config['worlds'] > 1)) { echo form_open("guilds", array('method' => 'post')); echo "<label>World:</label>"; echo "<select name='world_id'>"; foreach ($config['worlds'] as $id => $world) { echo "<option value='{$id}'>{$world}</option>"; } echo "</select>"; echo "<input type='submit' value='Sort'>"; echo "</form>"; } if (count($guilds) == 0) { alert("There is no guilds."); } else { echo "<table width='100%'>";
public function view($name = null) { $ide = new IDE(); if (!empty($name)) { $data['character'] = $name; $ots = POT::getInstance(); $ots->connect(POT::DB_MYSQL, connection()); $player = $ots->createObject('Player'); $player->find($name); if (!$player->isLoaded()) { $ide->redirect("../../character/view/"); } else { $data['player'] = $player; $data['account'] = $player->getAccount(); } $this->load->view('view_character.php', $data); } else { $this->load->helper("form"); if ($_POST) { $name = $_POST['name']; $ots = POT::getInstance(); $ots->connect(POT::DB_MYSQL, connection()); $player = new OTS_Player(); $player->find($name); if ($player->isLoaded()) { $ide->redirect("../character/view/{$name}"); } else { error("{$name} could not be found."); } } $this->load->view('character_search.php'); } }