function send() { $mail = HTTP::_GP('mail', '', true); $errorMessages = array(); if (empty($mail)) { $errorMessages[] = t('passwordErrorMailEmpty'); } if (Config::get('capaktiv') === '1') { require_once 'includes/libs/reCAPTCHA/recaptchalib.php'; $resp = recaptcha_check_answer(Config::get('capprivate'), $_SERVER['REMOTE_ADDR'], $_REQUEST['recaptcha_challenge_field'], $_REQUEST['recaptcha_response_field']); if (!$resp->is_valid) { $errorMessages[] = t('registerErrorCaptcha'); } } if (!empty($errorMessages)) { $message = implode("<br>\r\n", $errorMessages); $this->printMessage($message, NULL, array(array('label' => t('passwordBack'), 'url' => 'index.php?page=lostPassword'))); } $userID = $GLOBALS['DATABASE']->getFirstCell("SELECT id FROM " . USERS . " WHERE universe = " . $GLOBALS['UNI'] . " AND email_2 = '" . $GLOBALS['DATABASE']->escape($mail) . "';"); if (empty($userID)) { $this->printMessage(t('passwordErrorUnknown'), NULL, array(array('label' => t('passwordBack'), 'url' => 'index.php?page=lostPassword'))); } $hasChanged = $GLOBALS['DATABASE']->getFirstCell("SELECT COUNT(*) FROM " . LOSTPASSWORD . " WHERE userID = " . $userID . " AND time > " . (TIMESTAMP - 86400) . " AND hasChanged = 0;"); if (!empty($hasChanged)) { $this->printMessage(t('passwordErrorOnePerDay'), NULL, array(array('label' => t('passwordBack'), 'url' => 'index.php?page=lostPassword'))); } $validationKey = md5(uniqid()); $MailRAW = $GLOBALS['LNG']->getTemplate('email_lost_password_validation'); $MailContent = str_replace(array('{USERNAME}', '{GAMENAME}', '{VALIDURL}'), array($mail, Config::get('game_name') . ' - ' . Config::get('uni_name'), HTTP_PATH . 'index.php?page=lostPassword&mode=newPassword&u=' . $userID . '&k=' . $validationKey), $MailRAW); require 'includes/classes/Mail.class.php'; Mail::send($mail, $mail, t('passwordValidMailTitle', Config::get('game_name')), $MailContent); $GLOBALS['DATABASE']->query("INSERT INTO " . LOSTPASSWORD . " SET userID = " . $userID . ", `key` = '" . $validationKey . "', time = " . TIMESTAMP . ", fromIP = '" . $_SERVER['REMOTE_ADDR'] . "';"); $this->printMessage(t('passwordValidMailSend'), NULL, array(array('label' => t('passwordNext'), 'url' => 'index.php'))); }
function show() { global $USER, $PLANET, $LNG, $UNI, $CONF, $resource, $pricelist; $mode = HTTP::_GP('y', ''); $table = ""; $range = $PLANET['hangar'] * 3 - 2; if ($range < 0) { $range = 0; } if ($mode == '1') { $cautare = $GLOBALS['DATABASE']->query("SELECT *from " . PLANETS . " where (`der_metal` >0 OR `der_crystal` >0) AND (`system` > '" . ($PLANET['system'] - $range) . "' AND `system` < '" . ($PLANET['system'] + $range) . "') AND `galaxy` = '" . $PLANET['galaxy'] . "' and `planet_type` = '1' AND universe = " . $UNI . " ;"); $table = "<tr><th>" . $LNG['debris_action_1'] . "</th><th>" . $LNG['debris_action_2'] . "</th><th>" . $LNG['debris_action_3'] . "</th><th>" . $LNG['debris_action_4'] . "</th><th>" . $LNG['debris_action_5'] . "</th><th>" . $LNG['debris_action_6'] . "\n\t\t\t</th></tr>"; //print_r($cautare); if ($GLOBALS['DATABASE']->numRows($cautare) > 0) { while ($GalaxyRowPlanet = $GLOBALS['DATABASE']->fetch_array($cautare)) { $GRecNeeded = min(ceil(($GalaxyRowPlanet['der_metal'] + $GalaxyRowPlanet['der_crystal']) / $pricelist[219]['capacity']), $PLANET[$resource[219]]); $table .= "<tr><td>" . $GalaxyRowPlanet['galaxy'] . "</td><td>" . $GalaxyRowPlanet['system'] . "</td><td>" . $GalaxyRowPlanet['planet'] . "</td><td>" . pretty_number($GalaxyRowPlanet['der_metal']) . "</td><td>" . pretty_number($GalaxyRowPlanet['der_crystal']) . "</td><td><a href='javascript:doit(8," . $GalaxyRowPlanet['id'] . ");'>" . $LNG['debris_action_6'] . "</a></td></tr>"; } } else { $table .= "<tr><td colspan='6'>" . $LNG['debris_action_7'] . "</td></tr>"; } } $this->tplObj->assign_vars(array('range' => $range, 'debris' => $table, 'user_maxfleetsettings' => $USER['settings_fleetactions'])); $this->display("page.finddebris.default.tpl"); }
private function _activeUser() { $validationID = HTTP::_GP('i', 0); $validationKey = HTTP::_GP('k', ''); $userData = $GLOBALS['DATABASE']->getFirstRow("SELECT * FROM " . USERS_VALID . " WHERE validationID = " . $validationID . " AND validationKey = '" . $GLOBALS['DATABASE']->escape($validationKey) . "';"); if (!isset($userData)) { $this->printMessage(t('vertifyNoUserFound')); } $GLOBALS['DATABASE']->query("DELETE FROM " . USERS_VALID . " WHERE validationID = " . $validationID . ";"); list($userID, $planetID) = PlayerUtil::createPlayer($userData['universe'], $userData['userName'], $userData['password'], $userData['email'], $userData['race'], $userData['language']); if (Config::get('mail_active', $userData['universe']) == 1) { require 'includes/classes/Mail.class.php'; $MailSubject = t('registerMailCompleteTitle', Config::get('game_name', $userData['universe'])); $MailRAW = $GLOBALS['LNG']->getTemplate('email_reg_done'); $MailContent = str_replace(array('{USERNAME}', '{GAMENAME}', '{GAMEMAIL}'), array($userData['email'], Config::get('game_name') . ' - ' . Config::get('uni_name'), Config::get('smtp_sendmail')), $MailRAW); try { Mail::send($userData['email'], $userData['userName'], $MailSubject, $MailContent); } catch (Exception $e) { // This mail is wayne. } } if (!empty($userData['referralID'])) { $GLOBALS['DATABASE']->query("UPDATE " . USERS . " SET\n\t\t\t`ref_id`\t= " . $userData['referralID'] . ",\n\t\t\t`ref_bonus`\t= 1\n\t\t\tWHERE\n\t\t\t`id`\t\t= " . $userID . ";"); } if (!empty($userData['externalAuthUID'])) { $GLOBALS['DATABASE']->query("INSERT INTO " . USERS_AUTH . " SET\n\t\t\t`id`\t\t= " . $userID . ",\n\t\t\t`account`\t= '" . $GLOBALS['DATABASE']->escape($userData['externalAuthUID']) . "',\n\t\t\t`mode`\t\t= '" . $GLOBALS['DATABASE']->escape($userData['externalAuthMethod']) . "';"); } $nameSender = t('registerWelcomePMSenderName'); $subject = t('registerWelcomePMSubject'); $message = t('registerWelcomePMText', Config::get('game_name', $userData['universe'])); SendSimpleMessage($userID, 1, TIMESTAMP, 1, $nameSender, $subject, $message); return array('userID' => $userID, 'userName' => $userData['userName'], 'planetID' => $planetID); }
function ShowTeamspeakPage() { global $LNG, $USER; $CONF = Config::getAll(NULL, $_SESSION['adminuni']); if ($_POST) { $config_before = array('ts_timeout' => $CONF['ts_timeout'], 'ts_modon' => $CONF['ts_modon'], 'ts_server' => $CONF['ts_server'], 'ts_tcpport' => $CONF['ts_tcpport'], 'ts_udpport' => $CONF['ts_udpport'], 'ts_version' => $CONF['ts_version'], 'ts_login' => $CONF['ts_login'], 'ts_password' => $CONF['ts_password'], 'ts_cron_interval' => $CONF['ts_cron_interval']); $ts_modon = isset($_POST['ts_on']) && $_POST['ts_on'] == 'on' ? 1 : 0; $ts_server = HTTP::_GP('ts_ip', ''); $ts_tcpport = HTTP::_GP('ts_tcp', 0); $ts_udpport = HTTP::_GP('ts_udp', 0); $ts_timeout = HTTP::_GP('ts_to', 0); $ts_version = HTTP::_GP('ts_v', 0); $ts_login = HTTP::_GP('ts_login', ''); $ts_password = HTTP::_GP('ts_password', '', true); $ts_cron_interval = HTTP::_GP('ts_cron', 0); $config_after = array('ts_timeout' => $ts_timeout, 'ts_modon' => $ts_modon, 'ts_server' => $ts_server, 'ts_tcpport' => $ts_tcpport, 'ts_udpport' => $ts_udpport, 'ts_version' => $ts_version, 'ts_login' => $ts_login, 'ts_password' => $ts_password, 'ts_cron_interval' => $ts_cron_interval); Config::update($config_after); $GLOBALS['DATABASE']->query("UPDATE " . CRONJOBS . " SET isActive = " . $ts_modon . ", `lock` = NULL, nextTime = 0 WHERE name = 'teamspeak';"); $CONF = Config::getAll(NULL, $_SESSION['adminuni']); $LOG = new Log(3); $LOG->target = 4; $LOG->old = $config_before; $LOG->new = $config_after; $LOG->save(); } $template = new template(); $template->assign_vars(array('se_save_parameters' => $LNG['se_save_parameters'], 'ts_tcpport' => $LNG['ts_tcpport'], 'ts_serverip' => $LNG['ts_serverip'], 'ts_version' => $LNG['ts_version'], 'ts_active' => $LNG['ts_active'], 'ts_settings' => $LNG['ts_settings'], 'ts_udpport' => $LNG['ts_udpport'], 'ts_timeout' => $LNG['ts_timeout'], 'ts_server_query' => $LNG['ts_server_query'], 'ts_sq_login' => $LNG['ts_login'], 'ts_sq_pass' => $LNG['ts_pass'], 'ts_lng_cron' => $LNG['ts_cron'], 'ts_to' => $CONF['ts_timeout'], 'ts_on' => $CONF['ts_modon'], 'ts_ip' => $CONF['ts_server'], 'ts_tcp' => $CONF['ts_tcpport'], 'ts_udp' => $CONF['ts_udpport'], 'ts_v' => $CONF['ts_version'], 'ts_login' => $CONF['ts_login'], 'ts_password' => $CONF['ts_password'], 'ts_cron' => $CONF['ts_cron_interval'])); $template->show('TeamspeakPage.tpl'); }
function show() { if (empty($_POST)) { HTTP::redirectTo('index.php'); } $db = Database::get(); $username = HTTP::_GP('username', '', UTF8_SUPPORT); $password = HTTP::_GP('password', '', true); $sql = "SELECT id, password FROM %%USERS%% WHERE universe = :universe AND username = :username;"; $loginData = $db->selectSingle($sql, array(':universe' => Universe::current(), ':username' => $username)); if (isset($loginData)) { $hashedPassword = PlayerUtil::cryptPassword($password); if ($loginData['password'] != $hashedPassword) { // Fallback pre 1.7 if ($loginData['password'] == md5($password)) { $sql = "UPDATE %%USERS%% SET password = :hashedPassword WHERE id = :loginID;"; $db->update($sql, array(':hashedPassword' => $hashedPassword, ':loginID' => $loginData['id'])); } else { HTTP::redirectTo('index.php?code=1'); } } $session = Session::create(); $session->userId = (int) $loginData['id']; $session->adminAccess = 0; $session->save(); HTTP::redirectTo('game.php'); } else { HTTP::redirectTo('index.php?code=1'); } }
function ShowDisclamerPage() { global $LNG; $config = Config::get(Universe::getEmulated()); if (!empty($_POST)) { $config_before = array('disclamerAddress' => $config->disclamerAddress, 'disclamerPhone' => $config->disclamerPhone, 'disclamerMail' => $config->disclamerMail, 'disclamerNotice' => $config->disclamerNotice); $disclaimerAddress = HTTP::_GP('disclaimerAddress', '', true); $disclaimerPhone = HTTP::_GP('disclaimerPhone', '', true); $disclaimerMail = HTTP::_GP('disclaimerMail', '', true); $disclaimerNotice = HTTP::_GP('disclaimerNotice', '', true); $config_after = array('disclamerAddress' => $disclaimerAddress, 'disclamerPhone' => $disclaimerPhone, 'disclamerMail' => $disclaimerMail, 'disclamerNotice' => $disclaimerNotice); foreach ($config_after as $key => $value) { $config->{$key} = $value; } $config->save(); $LOG = new Log(3); $LOG->target = 5; $LOG->old = $config_before; $LOG->new = $config_after; $LOG->save(); } $template = new template(); $template->loadscript('../base/jquery.autosize-min.js'); $template->execscript('$(\'textarea\').autosize();'); $template->assign_vars(array('disclaimerAddress' => $config->disclamerAddress, 'disclaimerPhone' => $config->disclamerPhone, 'disclaimerMail' => $config->disclamerMail, 'disclaimerNotice' => $config->disclamerNotice, 'se_server_parameters' => $LNG['mu_disclaimer'], 'se_save_parameters' => $LNG['se_save_parameters'], 'se_disclaimerAddress' => $LNG['se_disclaimerAddress'], 'se_disclaimerPhone' => $LNG['se_disclaimerPhone'], 'se_disclaimerMail' => $LNG['se_disclaimerMail'], 'se_disclaimerNotice' => $LNG['se_disclaimerNotice'])); $template->show('DisclamerConfigBody.tpl'); }
function ShowChatConfigPage() { global $LNG; $config = Config::get(Universe::getEmulated()); if (!empty($_POST)) { $config_before = array('chat_closed' => $config->chat_closed, 'chat_allowchan' => $config->chat_allowchan, 'chat_allowmes' => $config->chat_allowmes, 'chat_allowdelmes' => $config->chat_allowdelmes, 'chat_logmessage' => $config->chat_logmessage, 'chat_nickchange' => $config->chat_nickchange, 'chat_botname' => $config->chat_botname, 'chat_channelname' => $config->chat_channelname); $chat_allowchan = isset($_POST['chat_allowchan']) && $_POST['chat_allowchan'] == 'on' ? 1 : 0; $chat_allowmes = isset($_POST['chat_allowmes']) && $_POST['chat_allowmes'] == 'on' ? 1 : 0; $chat_allowdelmes = isset($_POST['chat_allowdelmes']) && $_POST['chat_allowdelmes'] == 'on' ? 1 : 0; $chat_logmessage = isset($_POST['chat_logmessage']) && $_POST['chat_logmessage'] == 'on' ? 1 : 0; $chat_nickchange = isset($_POST['chat_nickchange']) && $_POST['chat_nickchange'] == 'on' ? 1 : 0; $chat_closed = isset($_POST['chat_closed']) && $_POST['chat_closed'] == 'on' ? 1 : 0; $chat_channelname = HTTP::_GP('chat_channelname', '', true); $chat_botname = HTTP::_GP('chat_botname', '', true); $config_after = array('chat_closed' => $chat_closed, 'chat_allowchan' => $chat_allowchan, 'chat_allowmes' => $chat_allowmes, 'chat_allowdelmes' => $chat_allowdelmes, 'chat_logmessage' => $chat_logmessage, 'chat_nickchange' => $chat_nickchange, 'chat_botname' => $chat_botname, 'chat_channelname' => $chat_channelname); foreach ($config_after as $key => $value) { $config->{$key} = $value; } $config->save(); $LOG = new Log(3); $LOG->target = 3; $LOG->old = $config_before; $LOG->new = $config_after; $LOG->save(); } $template = new template(); $template->assign_vars(array('chat_closed' => $config->chat_closed, 'chat_allowchan' => $config->chat_allowchan, 'chat_allowmes' => $config->chat_allowmes, 'chat_logmessage' => $config->chat_logmessage, 'chat_nickchange' => $config->chat_nickchange, 'chat_botname' => $config->chat_botname, 'chat_channelname' => $config->chat_channelname, 'se_server_parameters' => $LNG['se_server_parameters'], 'se_save_parameters' => $LNG['se_save_parameters'], 'ch_closed' => $LNG['ch_closed'], 'ch_allowchan' => $LNG['ch_allowchan'], 'ch_allowmes' => $LNG['ch_allowmes'], 'ch_allowdelmes' => $LNG['ch_allowdelmes'], 'ch_logmessage' => $LNG['ch_logmessage'], 'ch_nickchange' => $LNG['ch_nickchange'], 'ch_botname' => $LNG['ch_botname'], 'ch_channelname' => $LNG['ch_channelname'])); $template->show('ChatConfigBody.tpl'); }
function CallOrder() { global $USER, $CONF, $UNI; $this->amount = HTTP::_GP('amount', 0); $this->cost = HTTP::_GP('cost', 0); if (!array_key_exists($this->amount, $this->pattern)) { message('NOT VALID VALUE', '?page=overview', 3); exit; } $this->cost = $this->pattern[$this->amount]; $validationKey = md5(uniqid('2m')); $GLOBALS['DATABASE']->query("INSERT INTO `uni1_paypal` (`id`, `player`, `amount`, `timestamp`, `price`) VALUES (NULL, '" . $USER['id'] . "', '" . $this->amount . "', '" . TIMESTAMP . "', '" . $this->cost . "');"); //SendSimpleMessage ( $USER['id'], $USER['id'], TIMESTAMP, 1, 'Payment Bot', 'To do', 'After the payment has been processed, if you didnt received your DM please send an ticket or an Private Message to "Admin"'); $this_p = new paypal_class(); $ID = $GLOBALS['DATABASE']->uniquequery("SELECT `id` FROM `uni1_paypal` WHERE `player` = '" . $USER['id'] . "' AND `amount` = '" . $this->amount . "' AND `timestamp` = '" . TIMESTAMP . "'"); $this_p->add_field('business', $this::MAIL); $this_p->add_field('return', 'https://' . $_SERVER['HTTP_HOST'] . '/game.php?page=paypal&i=' . $validationKey . ''); $this_p->add_field('cancel_return', 'https://' . $_SERVER['HTTP_HOST'] . '/ipn.php'); $this_p->add_field('notify_url', 'https://' . $_SERVER['HTTP_HOST'] . '/ipn.php'); $this_p->add_field('item_name', $this->amount . ' Credit-User(' . $USER['username'] . ').'); $this_p->add_field('item_number', $this->amount . '_credits'); $this_p->add_field('amount', $this->cost); //$this_p->add_field('action', $action); ? $this_p->add_field('currency_code', 'EUR'); $this_p->add_field('custom', $USER['id'] . ',' . $validationKey); $this_p->add_field('rm', '2'); //$this_p->dump_fields(); foreach ($this_p->fields as $name => $value) { $field[] = array('text' => '<input type="hidden" name="' . $name . '" value="' . $value . '">'); } $this->tplObj->assign_vars(array('fields' => $field)); $this->display('paypal_class.tpl'); }
function ShowDisclamerPage() { global $LNG, $USER; $CONF = Config::getAll(NULL, $_SESSION['adminuni']); if (!empty($_POST)) { $config_before = array('disclamerAddress' => $CONF['disclamerAddress'], 'disclamerPhone' => $CONF['disclamerPhone'], 'disclamerMail' => $CONF['disclamerMail'], 'disclamerNotice' => $CONF['disclamerNotice']); $disclamerAddress = HTTP::_GP('disclamerAddress', '', true); $disclamerPhone = HTTP::_GP('disclamerPhone', '', true); $disclamerMail = HTTP::_GP('disclamerMail', '', true); $disclamerNotice = HTTP::_GP('disclamerNotice', '', true); $config_after = array('disclamerAddress' => $disclamerAddress, 'disclamerPhone' => $disclamerPhone, 'disclamerMail' => $disclamerMail, 'disclamerNotice' => $disclamerNotice); Config::update($config_after); $CONF = Config::getAll(NULL, $_SESSION['adminuni']); $LOG = new Log(3); $LOG->target = 5; $LOG->old = $config_before; $LOG->new = $config_after; $LOG->save(); } $template = new template(); $template->loadscript('../base/jquery.autosize-min.js'); $template->execscript('$(\'textarea\').autosize();'); $template->assign_vars(array('disclamerAddress' => $CONF['disclamerAddress'], 'disclamerPhone' => $CONF['disclamerPhone'], 'disclamerMail' => $CONF['disclamerMail'], 'disclamerNotice' => $CONF['disclamerNotice'], 'se_server_parameters' => $LNG['mu_disclamer'], 'se_save_parameters' => $LNG['se_save_parameters'], 'se_disclamerAddress' => $LNG['se_disclamerAddress'], 'se_disclamerPhone' => $LNG['se_disclamerPhone'], 'se_disclamerMail' => $LNG['se_disclamerMail'], 'se_disclamerNotice' => $LNG['se_disclamerNotice'])); $template->show('DisclamerConfigBody.tpl'); }
function show() { global $PLANET, $LNG, $resource; $this->initTemplate(); $this->setWindow('popup'); $this->tplObj->loadscript('phalanx.js'); $Galaxy = HTTP::_GP('galaxy', 0); $System = HTTP::_GP('system', 0); $Planet = HTTP::_GP('planet', 0); if (!$this->allowPhalanx($Galaxy, $System)) { $this->printMessage($LNG['px_out_of_range']); } if ($PLANET[$resource[903]] < PHALANX_DEUTERIUM) { $this->printMessage($LNG['px_no_deuterium']); } $db = Database::get(); $sql = "UPDATE %%PLANETS%% SET deuterium = deuterium - :phalanxDeuterium WHERE id = :planetID;"; $db->update($sql, array(':phalanxDeuterium' => PHALANX_DEUTERIUM, ':planetID' => $PLANET['id'])); $sql = "SELECT id, name, id_owner FROM %%PLANETS%% WHERE universe = :universe\n\t\tAND galaxy = :galaxy AND system = :system AND planet = :planet AND :type;"; $TargetInfo = $db->selectSingle($sql, array(':universe' => Universe::current(), ':galaxy' => $Galaxy, ':system' => $System, ':planet' => $Planet, ':type' => 1)); if (empty($TargetInfo)) { $this->printMessage($LNG['px_out_of_range']); } require 'includes/classes/class.FlyingFleetsTable.php'; $fleetTableObj = new FlyingFleetsTable(); $fleetTableObj->setPhalanxMode(); $fleetTableObj->setUser($TargetInfo['id_owner']); $fleetTableObj->setPlanet($TargetInfo['id']); $fleetTable = $fleetTableObj->renderTable(); $this->assign(array('galaxy' => $Galaxy, 'system' => $System, 'planet' => $Planet, 'name' => $TargetInfo['name'], 'fleetTable' => $fleetTable)); $this->display('page.phalanx.default.tpl'); }
function ShowLogDetail() { global $LNG; $logid = HTTP::_GP('id', 0); $result = $GLOBALS['DATABASE']->getFirstRow("SELECT l.*, u_a.username as admin_username FROM " . LOG . " as l LEFT JOIN " . USERS . " as u_a ON u_a.id = l.admin WHERE l.id = " . $logid . ""); $data = unserialize($result['data']); $conf_before = array(); $conf_after = array(); foreach ($data[0] as $key => $i) { $conf_before[$key] = $i; } foreach ($data[1] as $key => $i) { $conf_after[$key] = $i; } $Wrapper = array('resource_multiplier' => $LNG['se_resources_producion_speed'], 'forum_url' => $LNG['se_forum_link'], 'game_speed' => $LNG['se_general_speed'], 'chat_socket_chatid_info' => $LNG['ch_socket_chatid_info'], 'chat_socket_port_info' => $LNG['ch_socket_port_info'], 'chat_socket_ip_info' => $LNG['ch_socket_ip_info'], 'chat_socket_host_info' => $LNG['ch_socket_host_info'], 'chat_socket_chatid' => $LNG['ch_socket_chatid'], 'chat_socket_port' => $LNG['ch_socket_port'], 'chat_socket_ip' => $LNG['ch_socket_ip'], 'chat_socket_host' => $LNG['ch_socket_host'], 'chat_socket_active' => $LNG['ch_socket_active'], 'chat_socket' => $LNG['ch_socket'], 'chat_closed' => $LNG['ch_closed'], 'chat_allowchan' => $LNG['ch_allowchan'], 'chat_allowmes' => $LNG['ch_allowmes'], 'chat_allowdelmes' => $LNG['ch_allowcelmes'], 'chat_logmessage' => $LNG['ch_logmessage'], 'chat_nickchange' => $LNG['ch_nickchange'], 'chat_botname' => $LNG['ch_botname'], 'chat_channelname' => $LNG['ch_channelname'], 'ts_modon' => $LNG['ts_active'], 'ts_server' => $LNG['ts_serverip'], 'ts_password' => $LNG['ts_pass'], 'ts_cron_interval' => $LNG['ts_cron'], 'stat_settings' => $LNG['cs_point_per_resources_used'], 'stat' => $LNG['cs_points_to_zero'], 'stat_update_time' => $LNG['cs_time_between_updates'], 'stat_level' => $LNG['cs_access_lvl'], 'capaktiv' => $LNG['se_recaptcha_active'], 'cappublic' => $LNG['se_recaptcha_public'], 'capprivate' => $LNG['se_recaptcha_private'], 'ga_key' => $LNG['se_google_key'], 'metal' => $LNG['tech'][901], 'crystal' => $LNG['tech'][902], 'deuterium' => $LNG['tech'][903], 'darkmatter' => $LNG['tech'][921], 'authattack' => $LNG['qe_authattack'], 'username' => $LNG['adm_username'], 'field_max' => $LNG['qe_fields']); foreach ($conf_before as $key => $val) { if ($key != 'universe') { if (isset($LNG['tech'][$key])) { $Element = $LNG['tech'][$key]; } elseif (isset($LNG['se_' . $key])) { $Element = $LNG['se_' . $key]; } elseif (isset($LNG[$key])) { $Element = $LNG[$key]; } elseif (isset($Wrapper[$key])) { $Element = $Wrapper[$key]; } else { $Element = $key; } $LogArray[] = array('Element' => $Element, 'old' => $Element == 'urlaubs_until' ? _date($LNG['php_tdformat'], $val) : (is_numeric($val) ? pretty_number($val) : $val), 'new' => $Element == 'urlaubs_until' ? _date($LNG['php_tdformat'], $conf_after[$key]) : (is_numeric($conf_after[$key]) ? pretty_number($conf_after[$key]) : $conf_after[$key])); } } $template = new template(); $template->assign_vars(array('LogArray' => $LogArray, 'admin' => $result['admin_username'], 'target' => $result['universe'], 'id' => $result['id'], 'time' => _date($LNG['php_tdformat'], $result['time'], $USER['timezone']), 'log_info' => $LNG['log_info'], 'log_admin' => $LNG['log_admin'], 'log_time' => $LNG['log_time'], 'log_target' => $LNG['log_universe'], 'log_id' => $LNG['log_id'], 'log_element' => $LNG['log_element'], 'log_old' => $LNG['log_old'], 'log_new' => $LNG['log_new'])); $template->show("LogDetail.tpl"); }
function view() { global $USER, $LNG; require 'includes/classes/BBCode.class.php'; $db = Database::get(); $ticketID = HTTP::_GP('id', 0); $sql = "SELECT a.*, t.categoryID, t.status FROM %%TICKETS_ANSWER%% a INNER JOIN %%TICKETS%% t USING(ticketID) WHERE a.ticketID = :ticketID ORDER BY a.answerID;"; $answerResult = $db->select($sql, array(':ticketID' => $ticketID)); $answerList = array(); if (empty($answerResult)) { $this->printMessage(sprintf($LNG['ti_not_exist'], $ticketID), array(array('label' => $LNG['sys_back'], 'url' => 'game.php?page=ticket'))); } $ticket_status = 0; foreach ($answerResult as $answerRow) { $answerRow['time'] = _date($LNG['php_tdformat'], $answerRow['time'], $USER['timezone']); $answerRow['message'] = BBCode::parse($answerRow['message']); $answerList[$answerRow['answerID']] = $answerRow; if (empty($ticket_status)) { $ticket_status = $answerRow['status']; } } $categoryList = $this->ticketObj->getCategoryList(); $this->assign(array('ticketID' => $ticketID, 'categoryList' => $categoryList, 'answerList' => $answerList, 'status' => $ticket_status)); $this->display('page.ticket.view.tpl'); }
function send() { $username = HTTP::_GP('username', '', UTF8_SUPPORT); $mail = HTTP::_GP('mail', '', true); $errorMessages = array(); if (empty($username)) { $errorMessages[] = t('passwordUsernameEmpty'); } if (empty($mail)) { $errorMessages[] = t('passwordErrorMailEmpty'); } if (!empty($errorMessages)) { $message = implode("<br>\r\n", $errorMessages); $this->printMessage($message, NULL, array(array('label' => t('passwordBack'), 'url' => 'index.php?page=lostPassword'))); } $userID = $GLOBALS['DATABASE']->getFirstCell("SELECT id FROM " . USERS . " WHERE universe = " . $GLOBALS['UNI'] . " AND username = '******'DATABASE']->escape($username) . "' AND email_2 = '" . $GLOBALS['DATABASE']->escape($mail) . "';"); if (empty($userID)) { $this->printMessage(t('passwordErrorUnknown'), NULL, array(array('label' => t('passwordBack'), 'url' => 'index.php?page=lostPassword'))); } $hasChanged = $GLOBALS['DATABASE']->getFirstCell("SELECT COUNT(*) FROM " . LOSTPASSWORD . " WHERE userID = " . $userID . " AND time > " . (TIMESTAMP - 86400) . " AND hasChanged = 0;"); if (!empty($hasChanged)) { $this->printMessage(t('passwordErrorOnePerDay'), NULL, array(array('label' => t('passwordBack'), 'url' => 'index.php?page=lostPassword'))); } $validationKey = md5(uniqid()); $MailRAW = $GLOBALS['LNG']->getTemplate('email_lost_password_validation'); $MailContent = str_replace(array('{USERNAME}', '{GAMENAME}', '{VALIDURL}', '{IP}', '{DATE}'), array($username, Config::get('game_name') . ' - ' . Config::get('uni_name'), HTTP_PATH . 'index.php?page=lostPassword&mode=newPassword&u=' . $userID . '&k=' . $validationKey, $_SERVER['REMOTE_ADDR'], date("m.d.y")), $MailRAW); require 'includes/classes/Mail.class.php'; $headers = "From: support@battle-fighter.org\r\n"; $headers .= "Reply-To: support@battle-fighter.org\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; mail($userData['mail'], t('passwordValidMailTitle', Config::get('game_name')), $MailContent, $headers); $GLOBALS['DATABASE']->query("INSERT INTO " . LOSTPASSWORD . " SET userID = " . $userID . ", `key` = '" . $validationKey . "', time = " . TIMESTAMP . ", fromIP = '" . $_SERVER['REMOTE_ADDR'] . "';"); $this->printMessage(t('passwordValidMailSend'), NULL, array(array('label' => t('passwordNext'), 'url' => 'index.php'))); }
function show() { global $LNG, $USER; $LNG->includeData(array('FLEET')); $this->setWindow('popup'); $db = Database::get(); $RID = HTTP::_GP('raport', ''); $sql = "SELECT raport,attacker,defender FROM %%RW%% WHERE rid = :reportID;"; $reportData = $db->selectSingle($sql, array(':reportID' => $RID)); if (empty($reportData)) { $this->printMessage($LNG['sys_raport_not_found']); } // empty is BC for pre r2484 $isAttacker = empty($reportData['attacker']) || in_array($USER['id'], explode(",", $reportData['attacker'])); $isDefender = empty($reportData['defender']) || in_array($USER['id'], explode(",", $reportData['defender'])); if (empty($reportData) || !$isAttacker && !$isDefender) { $this->printMessage($LNG['sys_raport_not_found']); } $combatReport = unserialize($reportData['raport']); if ($isAttacker && !$isDefender && $combatReport['result'] == 'r' && count($combatReport['rounds']) <= 2) { $this->printMessage($LNG['sys_raport_lost_contact']); } $combatReport['time'] = _date($LNG['php_tdformat'], $combatReport['time'], $USER['timezone']); $combatReport = $this->BCWrapperPreRev2321($combatReport); $this->assign(array('Raport' => $combatReport, 'pageTitle' => $LNG['sys_mess_attack_report'])); $this->display('shared.mission.raport.tpl'); }
function show() { global $LNG; $referralID = HTTP::_GP('ref', 0); if (!empty($referralID)) { $this->redirectTo('index.php?page=register&referralID=' . $referralID); } $universeSelect = array(); foreach (Universe::availableUniverses() as $uniId) { $config = Config::get($uniId); $universeSelect[$uniId] = $config->uni_name . ($config->game_disable == 0 ? $LNG['uni_closed'] : ''); } $Code = HTTP::_GP('code', 0); $loginCode = false; if (isset($LNG['login_error_' . $Code])) { $loginCode = $LNG['login_error_' . $Code]; } $config = Config::get(); $this->assign(array('universeSelect' => $universeSelect, 'code' => $loginCode, 'descHeader' => sprintf($LNG['loginWelcome'], $config->game_name), 'descText' => sprintf($LNG['loginServerDesc'], $config->game_name), 'loginInfo' => sprintf($LNG['loginInfo'], '<a href="index.php?page=rules">' . $LNG['menu_rules'] . '</a>'))); $screenshots = array(); $directoryIterator = new DirectoryIterator('styles/resource/images/login/screens/'); foreach ($directoryIterator as $fileInfo) { /** @var $fileInfo DirectoryIterator */ if (!$fileInfo->isFile()) { continue; } $thumbnail = 'styles/resource/images/login/screens/' . $fileInfo->getFilename(); if (file_exists('styles/resource/images/login/screens/thumbnails/' . $fileInfo->getFilename())) { $thumbnail = 'styles/resource/images/login/screens/thumbnails/' . $fileInfo->getFilename(); } $screenshots[] = array('path' => 'styles/resource/images/login/screens/' . $fileInfo->getFilename(), 'thumbnail' => $thumbnail); } $this->assign(array('screenshots' => $screenshots)); $this->display('page.index.default.tpl'); }
function show() { global $LNG, $USER, $PLANET, $resource, $reslist; $this->setWindow('popup'); $this->initTemplate(); $id = HTTP::_GP('id', 0); $PlanetsRAW = $GLOBALS['DATABASE']->query("SELECT * FROM " . PLANETS . " WHERE id = '" . $id . "';"); $PLANETS = array($PLANET); while ($CPLANET = $GLOBALS['DATABASE']->fetch_array($PlanetsRAW)) { $planetList['image'][$CPLANET['id']] = $CPLANET['image']; $planetList['coords'][$CPLANET['id']]['planet'] = $CPLANET['planet']; $planetList['field'][$CPLANET['id']]['current'] = $CPLANET['field_current']; $planetList['diameter'][$CPLANET['id']]['diameter'] = $CPLANET['diameter']; $planetList['field'][$CPLANET['id']]['max'] = CalculateMaxPlanetFields($CPLANET); $planetList['temperature'][$CPLANET['id']]['minimum'] = $CPLANET['temp_min']; $planetList['temperature'][$CPLANET['id']]['maximum'] = $CPLANET['temp_max']; $planetList['solar'][$CPLANET['id']]['solar'] = $CPLANET['solar_satelit']; foreach ($reslist['build'] as $elementID) { $planetList['build'][$elementID][$CPLANET['id']] = $CPLANET[$resource[$elementID]]; } foreach ($reslist['defense'] as $elementID) { $planetList['defense'][$elementID][$CPLANET['id']] = $CPLANET[$resource[$elementID]]; } } $this->tplObj->assign_vars(array('planetList' => $planetList)); $this->display('page.planetauction.info.tpl'); }
function show() { global $USER, $LNG; $order = HTTP::_GP('order', 'units'); $sort = HTTP::_GP('sort', 'desc'); $sort = strtoupper($sort) === "DESC" ? "DESC" : "ASC"; switch ($order) { case 'date': $key = '%%TOPKB%%.time ' . $sort; break; case 'units': default: $key = '%%TOPKB%%.units ' . $sort; break; } $db = Database::get(); $sql = "SELECT *, (\n\t\t\tSELECT DISTINCT\n\t\t\tIF(%%TOPKB_USERS%%.username = '', GROUP_CONCAT(%%USERS%%.username SEPARATOR ' & '), GROUP_CONCAT(%%TOPKB_USERS%%.username SEPARATOR ' & '))\n\t\t\tFROM %%TOPKB_USERS%%\n\t\t\tLEFT JOIN %%USERS%% ON uid = %%USERS%%.id\n\t\t\tWHERE %%TOPKB_USERS%%.rid = %%TOPKB%%.rid AND role = 1\n\t\t) as attacker,\n\t\t(\n\t\t\tSELECT DISTINCT\n\t\t\tIF(%%TOPKB_USERS%%.username = '', GROUP_CONCAT(%%USERS%%.username SEPARATOR ' & '), GROUP_CONCAT(%%TOPKB_USERS%%.username SEPARATOR ' & '))\n\t\t\tFROM %%TOPKB_USERS%% INNER JOIN %%USERS%% ON uid = id\n\t\t\tWHERE %%TOPKB_USERS%%.rid = %%TOPKB%%.`rid` AND `role` = 2\n\t\t) as defender\n\t\tFROM %%TOPKB%% WHERE universe = :universe ORDER BY " . $key . " LIMIT 100;"; $top = $db->select($sql, array(':universe' => Universe::current())); $TopKBList = array(); foreach ($top as $data) { $TopKBList[] = array('result' => $data['result'], 'date' => _date($LNG['php_tdformat'], $data['time'], $USER['timezone']), 'time' => TIMESTAMP - $data['time'], 'units' => $data['units'], 'rid' => $data['rid'], 'attacker' => $data['attacker'], 'defender' => $data['defender']); } $this->assign(array('TopKBList' => $TopKBList, 'sort' => $sort, 'order' => $order)); $this->display('page.battleHall.default.tpl'); }
public function show() { global $USER, $PLANET, $LNG; $this->tplObj->loadscript('flotten.js'); $targetGalaxy = HTTP::_GP('galaxy', 0); $targetSystem = HTTP::_GP('system', 0); $targetPlanet = HTTP::_GP('planet', 0); $targetType = HTTP::_GP('type', 0); $targetMission = HTTP::_GP('target_mission', 0); $fleetSpeed = HTTP::_GP('speed', 0); $fleetGroup = HTTP::_GP('fleet_group', 0); $token = HTTP::_GP('token', ''); if (!isset($_SESSION['fleet'][$token])) { FleetFunctions::GotoFleetPage(); } $fleetArray = $_SESSION['fleet'][$token]['fleet']; $db = Database::get(); $sql = "SELECT id, id_owner, der_metal, der_crystal FROM %%PLANETS%% WHERE universe = :universe AND galaxy = :targetGalaxy AND system = :targetSystem AND planet = :targetPlanet AND planet_type = '1';"; $targetPlanetData = $db->selectSingle($sql, array(':universe' => Universe::current(), ':targetGalaxy' => $targetGalaxy, ':targetSystem' => $targetSystem, ':targetPlanet' => $targetPlanet)); if ($targetType == 2 && $targetPlanetData['der_metal'] == 0 && $targetPlanetData['der_crystal'] == 0) { $this->printMessage($LNG['fl_error_empty_derbis'], array(array('label' => $LNG['sys_back'], 'url' => 'game.php?page=fleet1'))); } $MisInfo = array(); $MisInfo['galaxy'] = $targetGalaxy; $MisInfo['system'] = $targetSystem; $MisInfo['planet'] = $targetPlanet; $MisInfo['planettype'] = $targetType; $MisInfo['IsAKS'] = $fleetGroup; $MisInfo['Ship'] = $fleetArray; $MissionOutput = FleetFunctions::GetFleetMissions($USER, $MisInfo, $targetPlanetData); if (empty($MissionOutput['MissionSelector'])) { $this->printMessage($LNG['fl_empty_target'], array(array('label' => $LNG['sys_back'], 'url' => 'game.php?page=fleet1'))); } $GameSpeedFactor = FleetFunctions::GetGameSpeedFactor(); $MaxFleetSpeed = FleetFunctions::GetFleetMaxSpeed($fleetArray, $USER); $distance = FleetFunctions::GetTargetDistance(array($PLANET['galaxy'], $PLANET['system'], $PLANET['planet']), array($targetGalaxy, $targetSystem, $targetPlanet)); $duration = FleetFunctions::GetMissionDuration($fleetSpeed, $MaxFleetSpeed, $distance, $GameSpeedFactor, $USER); $consumption = FleetFunctions::GetFleetConsumption($fleetArray, $duration, $distance, $USER, $GameSpeedFactor); if ($consumption > $PLANET['deuterium']) { $this->printMessage($LNG['fl_not_enough_deuterium'], array(array('label' => $LNG['sys_back'], 'url' => 'game.php?page=fleetTable'))); } if (!FleetFunctions::CheckUserSpeed($fleetSpeed)) { FleetFunctions::GotoFleetPage(0); } $_SESSION['fleet'][$token]['speed'] = $MaxFleetSpeed; $_SESSION['fleet'][$token]['distance'] = $distance; $_SESSION['fleet'][$token]['targetGalaxy'] = $targetGalaxy; $_SESSION['fleet'][$token]['targetSystem'] = $targetSystem; $_SESSION['fleet'][$token]['targetPlanet'] = $targetPlanet; $_SESSION['fleet'][$token]['targetType'] = $targetType; $_SESSION['fleet'][$token]['fleetGroup'] = $fleetGroup; $_SESSION['fleet'][$token]['fleetSpeed'] = $fleetSpeed; if (!empty($fleet_group)) { $targetMission = 2; } $fleetData = array('fleetroom' => floatToString($_SESSION['fleet'][$token]['fleetRoom']), 'consumption' => floatToString($consumption)); $this->tplObj->execscript('calculateTransportCapacity();'); $this->assign(array('fleetdata' => $fleetData, 'consumption' => floatToString($consumption), 'mission' => $targetMission, 'galaxy' => $PLANET['galaxy'], 'system' => $PLANET['system'], 'planet' => $PLANET['planet'], 'type' => $PLANET['planet_type'], 'MissionSelector' => $MissionOutput['MissionSelector'], 'StaySelector' => $MissionOutput['StayBlock'], 'fl_dm_alert_message' => sprintf($LNG['fl_dm_alert_message'], $LNG['type_mission'][11], $LNG['tech'][921]), 'fl_continue' => $LNG['fl_continue'], 'token' => $token)); $this->display('page.fleetStep2.default.tpl'); }
function ShowFlyingFleetPage() { global $LNG; $id = HTTP::_GP('id', 0); if (!empty($id)) { $lock = HTTP::_GP('lock', 0); $GLOBALS['DATABASE']->query("UPDATE " . FLEETS . " SET `fleet_busy` = '" . $lock . "' WHERE `fleet_id` = '" . $id . "' AND `fleet_universe` = '" . Universe::getEmulated() . "';"); $SQL = $lock == 0 ? "NULL" : "'ADM_LOCK'"; $GLOBALS['DATABASE']->query("UPDATE " . FLEETS_EVENT . " SET `lock` = " . $SQL . " WHERE `fleetID` = " . $id . ";"); } $orderBy = "fleet_id"; $fleetResult = $GLOBALS['DATABASE']->query("SELECT \n\tfleet.*,\n\tevent.`lock`,\n\tCOUNT(event.fleetID) as error,\n\tpstart.name as startPlanetName,\n\tptarget.name as targetPlanetName,\n\tustart.username as startUserName,\n\tutarget.username as targetUserName,\n\tacs.name as acsName\n\tFROM " . FLEETS . " fleet\n\tLEFT JOIN " . FLEETS_EVENT . " event ON fleetID = fleet_id\n\tLEFT JOIN " . PLANETS . " pstart ON pstart.id = fleet_start_id\n\tLEFT JOIN " . PLANETS . " ptarget ON ptarget.id = fleet_end_id\n\tLEFT JOIN " . USERS . " ustart ON ustart.id = fleet_owner\n\tLEFT JOIN " . USERS . " utarget ON utarget.id = fleet_target_owner\n\tLEFT JOIN " . AKS . " acs ON acs.id = fleet_group\n\tWHERE fleet_universe = " . Universe::getEmulated() . "\n\tGROUP BY event.fleetID\n\tORDER BY " . $orderBy . ";"); $FleetList = array(); while ($fleetRow = $GLOBALS['DATABASE']->fetch_array($fleetResult)) { $shipList = array(); $shipArray = array_filter(explode(';', $fleetRow['fleet_array'])); foreach ($shipArray as $ship) { $shipDetail = explode(',', $ship); $shipList[$shipDetail[0]] = $shipDetail[1]; } $FleetList[] = array('fleetID' => $fleetRow['fleet_id'], 'lock' => !empty($fleetRow['lock']), 'count' => $fleetRow['fleet_amount'], 'error' => !$fleetRow['error'], 'ships' => $shipList, 'state' => $fleetRow['fleet_mess'], 'starttime' => _date($LNG['php_tdformat'], $fleetRow['start_time'], $USER['timezone']), 'arrivaltime' => _date($LNG['php_tdformat'], $fleetRow['fleet_start_time'], $USER['timezone']), 'stayhour' => round(($fleetRow['fleet_end_stay'] - $fleetRow['fleet_start_time']) / 3600), 'staytime' => $fleetRow['fleet_start_time'] !== $fleetRow['fleet_end_stay'] ? _date($LNG['php_tdformat'], $fleetRow['fleet_end_stay'], $USER['timezone']) : 0, 'endtime' => _date($LNG['php_tdformat'], $fleetRow['fleet_end_time'], $USER['timezone']), 'missionID' => $fleetRow['fleet_mission'], 'acsID' => $fleetRow['fleet_group'], 'acsName' => $fleetRow['acsName'], 'startUserID' => $fleetRow['fleet_owner'], 'startUserName' => $fleetRow['startUserName'], 'startPlanetID' => $fleetRow['fleet_start_id'], 'startPlanetName' => $fleetRow['startPlanetName'], 'startPlanetGalaxy' => $fleetRow['fleet_start_galaxy'], 'startPlanetSystem' => $fleetRow['fleet_start_system'], 'startPlanetPlanet' => $fleetRow['fleet_start_planet'], 'startPlanetType' => $fleetRow['fleet_start_type'], 'targetUserID' => $fleetRow['fleet_target_owner'], 'targetUserName' => $fleetRow['targetUserName'], 'targetPlanetID' => $fleetRow['fleet_end_id'], 'targetPlanetName' => $fleetRow['targetPlanetName'], 'targetPlanetGalaxy' => $fleetRow['fleet_end_galaxy'], 'targetPlanetSystem' => $fleetRow['fleet_end_system'], 'targetPlanetPlanet' => $fleetRow['fleet_end_planet'], 'targetPlanetType' => $fleetRow['fleet_end_type'], 'resource' => array(901 => $fleetRow['fleet_resource_metal'], 902 => $fleetRow['fleet_resource_crystal'], 903 => $fleetRow['fleet_resource_deuterium'], 921 => $fleetRow['fleet_resource_darkmatter'])); } $GLOBALS['DATABASE']->free_result($fleetResult); $template = new template(); $template->assign_vars(array('FleetList' => $FleetList)); $template->show('FlyingFleetPage.tpl'); }
function buy() { global $USER, $PLANET, $LNG, $UNI, $CONF, $resource, $pricelist; $mode = HTTP::_GP('immunity', ''); $fleets = $GLOBALS['DATABASE']->getFirstCell("SELECT COUNT(*) FROM " . FLEETS . " WHERE `fleet_owner` = " . $USER['id'] . " OR `fleet_target_owner` = " . $USER['id'] . ";"); if ($mode == '') { $this->printMessage('<span class="rouge">please select the option you want to purchase</span>', true, array('game.php?page=Immunity', 2)); } elseif ($mode == 'three') { if ($USER['darkmatter'] < 1) { $this->printMessage('<span class="rouge">You dont have enough credits to purchase this option</span>', true, array('game.php?page=Immunity', 2)); } elseif ($USER['next_immunity'] > TIMESTAMP) { $this->printMessage('<span class="rouge">Countdown is not finished</span>', true, array('game.php?page=Immunity', 2)); } if ($fleets != 0) { $this->printMessage("<span class='rouge'>Fleet mouvement!</span>", true, array('game.php?page=Immunity', 2)); die; } else { $USER['darkmatter'] -= 1; $GLOBALS['DATABASE']->query("Update " . USERS . " SET `immunity_until` = " . (TIMESTAMP + 60 * 60 * 24 * 3) . ", `next_immunity` = " . (TIMESTAMP + 10 * 60 * 60 * 24) . " WHERE `id` = " . $USER['id'] . " ;"); $GLOBALS['DATABASE']->query("INSERT INTO `uni1_achats_log` VALUES (null, '" . TIMESTAMP . "', '" . $USER['id'] . "', 'Immunity(3)', '1');"); $this->printMessage("<span class='vert'>You succesfully activated the immunity function on your account</span>", true, array('game.php?page=immunity', 3)); die; } } }
function view() { global $USER, $LNG, $TICKET; require_once 'includes/functions/BBCode.php'; $ticketID = HTTP::_GP('id', 0); $answerResult = $GLOBALS['DATABASE']->query("SELECT a.*, t.categoryID, t.status FROM " . TICKETS_ANSWER . " a INNER JOIN " . TICKETS . " t USING(ticketID) WHERE a.ticketID = " . $ticketID . " ORDER BY a.answerID;"); $answerList = array(); $rr = $USER['id']; $qtip = $GLOBALS['DATABASE']->query("SELECT `ownerID` FROM " . TICKETS . " WHERE ticketID = " . $ticketID . ";"); $row = $GLOBALS['DATABASE']->fetch_array($qtip); $ownercheck = $row['ownerID']; if ($GLOBALS['DATABASE']->numRows($answerResult) == 0) { $this->printMessage(sprintf($LNG['ti_not_exist'], $ticketID)); } if ($ownercheck != $USER['id'] && $USER['authlevel'] == 0) { $this->printMessage(sprintf($LNG['ebo_notadmin'], $ticketID)); } while ($answerRow = $GLOBALS['DATABASE']->fetch_array($answerResult)) { $subjecttest = $answerRow['subject']; $answerRow['time'] = _date($LNG['php_tdformat'], $answerRow['time'], $USER['timezone']); $answerRow['message'] = bbcode($answerRow['message']); $answerRow['userid'] = $answerRow['ownerID']; $answerList[$answerRow['answerID']] = $answerRow; $ticket_status = $answerRow['status']; } $GLOBALS['DATABASE']->free_result($answerResult); $categoryList = $this->ticketObj->getCategoryList(); $this->tplObj->assign_vars(array('subjecttest' => $subjecttest, 'ticketID' => $ticketID, 'categoryList' => $categoryList, 'answerList' => $answerList, 'status' => $ticket_status)); $this->display('page.ticket.view.tpl'); }
function show() { $method = HTTP::_GP('method', ''); $method = strtolower(str_replace(array('_', '\\', '/', '.', ""), '', $method)); $path = 'includes/classes/extauth/' . $method . '.class.php'; if (!file_exists($path)) { HTTP::redirectTo('index.php'); } $session = Session::create(); require 'includes/classes/extauth/externalAuth.interface.php'; require $path; $methodClass = ucwords($method) . 'Auth'; /** @var $authObj externalAuth */ $authObj = new $methodClass(); if (!$authObj->isActiveMode()) { $session->delete(); $this->redirectTo('index.php?code=5'); } if (!$authObj->isValid()) { $session->delete(); $this->redirectTo('index.php?code=4'); } $loginData = $authObj->getLoginData(); if (empty($loginData)) { $session->delete(); $this->redirectTo('index.php?page=register&externalAuth[account]=' . $authObj->getAccount() . '&externalAuth[method]=facebook'); } $session->userId = (int) $loginData['id']; $session->adminAccess = 0; $session->save(); $this->redirectTo("game.php"); }
function buy() { global $USER, $LNG, $THEME; $days = HTTP::_GP('planetcloak', ''); if ($days == '') { $this->printMessage('<span class="rouge">please select the option you want to purchase</span>', true, array('game.php?page=Planetcloak', 2)); } elseif ($days == 'one') { if ($USER['darkmatter'] < 1) { $this->printMessage('<span class="rouge">You dont have enough credits to purchase this option</span>', true, array('game.php?page=Planetcloak', 2)); } elseif ($USER['planet_cloak_countdown'] > TIMESTAMP) { $this->printMessage('<span class="rouge">Countdown is not finished</span>', true, array('game.php?page=Planetcloak', 2)); } else { $USER['darkmatter'] -= 1; $GLOBALS['DATABASE']->query("Update " . USERS . " SET `planet_cloak` = " . (TIMESTAMP + 24 * 60 * 60) . ", `planet_cloak_countdown` = " . (TIMESTAMP + 8 * 24 * 60 * 60) . " WHERE `id` = " . $USER['id'] . ";"); //$GLOBALS['DATABASE']->query("INSERT INTO uni1_planetcloak_log VALUES ('".$GLOBALS['DATABASE']->GetInsertID()."','".$USER['id']."','".TIMESTAMP."','1');"); $GLOBALS['DATABASE']->query("INSERT INTO `uni1_achats_log` VALUES (null, '" . TIMESTAMP . "', '" . $USER['id'] . "', 'Pcloak(1)', '1');"); $this->printMessage('<span class="vert">You succesfully activated planet cloak for 1 days</span>', true, array('game.php?page=Planetcloak', 2)); } } elseif ($days == 'seven') { if ($USER['darkmatter'] < 3) { $this->printMessage('<span class="rouge">You dont have enough credits to purchase this option</span>', true, array('game.php?page=Planetcloak', 2)); } elseif ($USER['planet_cloak_countdown'] > TIMESTAMP) { $this->printMessage('<span class="rouge">Countdown is not finished</span>', true, array('game.php?page=Planetcloak', 2)); } else { $USER['darkmatter'] -= 3; $GLOBALS['DATABASE']->query("Update " . USERS . " SET `planet_cloak` = " . (TIMESTAMP + 7 * 24 * 60 * 60) . ", `planet_cloak_countdown` = " . (TIMESTAMP + 37 * 24 * 60 * 60) . " WHERE `id` = " . $USER['id'] . ";"); //$GLOBALS['DATABASE']->query("INSERT INTO uni1_planetcloak_log VALUES ('".$GLOBALS['DATABASE']->GetInsertID()."','".$USER['id']."','".TIMESTAMP."','5');"); $GLOBALS['DATABASE']->query("INSERT INTO `uni1_achats_log` VALUES (null, '" . TIMESTAMP . "', '" . $USER['id'] . "', 'Pcloak(7)', '3');"); $this->printMessage('<span class="vert">You succesfully activated planet cloak for 7 days</span>', true, array('game.php?page=Planetcloak', 2)); } } $this->tplObj->assign_vars(array()); $this->display('page.planetcloak.default.tpl'); }
function send() { global $USER, $PLANET, $LNG, $UNI, $CONF, $resource, $pricelist, $reslist; $this->tplObj->loadscript("dmfleet.js"); if ($PLANET[$resource[21]] == 0) { $this->printMessage($LNG['bd_shipyard_required']); } $number = HTTP::_GP('count', 0); $shipID = HTTP::_GP('shipID', 0); $this->printMessage($shipID); $ChargeDM = array('defence' => array(401 => [0, 1], 402 => [0, 1], 403 => [0, 1], 404 => [0, 2], 405 => [0, 1], 406 => [0, 7], 410 => [0, 1125], 412 => [0, 650], 413 => [0, 1825], 414 => [0, 7000], 416 => [0, 18], 417 => [0, 24], 418 => [0, 160], 419 => [0, 3475], 420 => [0, 1], 421 => [0, 20], 422 => [0, 1369])); $price = $number * $ChargeDM['defence'][$shipID][1]; $isPossible = $GLOBALS['DATABASE']->getFirstCell("SELECT COUNT(*) FROM uni1_fleets WHERE fleet_target_owner = " . $USER['id'] . " AND fleet_end_stay < " . (TIMESTAMP + 90) . " AND fleet_mess = 0 AND fleet_mission = '1';"); if ($PLANET[$resource[21]] == 0) { $this->printMessage($LNG['bd_shipyard_required']); } elseif ($isPossible != 0) { $this->printMessage('you can not buy new defense when you have an incoming attack'); } elseif ($USER['instant_defense'] + $price > 500000000) { $this->printMessage('you exeeded the maximum buyable units for today (' . (500000000 - $USER['instant_defense']) . ' left)'); } elseif ($USER['darkmatter'] < $price) { $this->printMessage('you dont have enough darkmatter!'); } $PLANET[$resource[$shipID]] += $number; $GLOBALS['DATABASE']->query("UPDATE " . PLANETS . " SET " . $resource[$shipID] . " = " . $resource[$shipID] . " + " . $number . " where `id` = '" . $PLANET['id'] . "';"); $GLOBALS['DATABASE']->query("UPDATE " . USERS . " SET instant_defense = instant_defense + " . $price . " where `id` = '" . $USER['id'] . "';"); $USER['darkmatter'] -= $price; $this->printMessage('defense has been added on your planet'); }
function buy() { global $USER, $LNG, $THEME, $UNI; $days = HTTP::_GP('hide', 1); if ($days == 1) { if ($USER['planet_cloak_countdown'] > TIMESTAMP) { $this->printMessage($LNG['planetcloak_cntdown'], true, array('game.php?page=overview', 2)); } elseif ($USER['darkmatter'] < 500000) { $this->printMessage($LNG['gover_notres'], true, array('game.php?page=overview', 2)); } else { $USER['darkmatter'] -= 500000; $GLOBALS['DATABASE']->query("Update " . USERS . " SET `planet_cloak` = " . (TIMESTAMP + 3 * 24 * 60 * 60) . " WHERE `id` = " . $USER['id'] . " AND universe = " . $UNI . ";"); $GLOBALS['DATABASE']->query("Update " . USERS . " SET `planet_cloak_countdown` = " . (TIMESTAMP + 11 * 24 * 60 * 60) . " WHERE `id` = " . $USER['id'] . " AND universe = " . $UNI . ";"); $GLOBALS['DATABASE']->query("INSERT INTO uni1_planetcloak_log VALUES ('" . $GLOBALS['DATABASE']->GetInsertID() . "','" . $USER['id'] . "','" . TIMESTAMP . "','20000');"); $this->printMessage($LNG['planetcloak_activate_one'], true, array('game.php?page=overview', 2)); } } elseif ($days == 2) { if ($USER['planet_cloak_countdown'] > TIMESTAMP) { $this->printMessage($LNG['planetcloak_cntdown'], true, array('game.php?page=overview', 2)); } elseif ($USER['darkmatter'] < 2000000) { $this->printMessage($LNG['gover_notres'], true, array('game.php?page=overview', 2)); } else { $USER['darkmatter'] -= 2000000; $GLOBALS['DATABASE']->query("Update " . USERS . " SET `planet_cloak` = " . (TIMESTAMP + 14 * 24 * 60 * 60) . " WHERE `id` = " . $USER['id'] . " AND universe = " . $UNI . ";"); $GLOBALS['DATABASE']->query("Update " . USERS . " SET `planet_cloak_countdown` = " . (TIMESTAMP + 44 * 24 * 60 * 60) . " WHERE `id` = " . $USER['id'] . " AND universe = " . $UNI . ";"); $GLOBALS['DATABASE']->query("INSERT INTO uni1_planetcloak_log VALUES ('" . $GLOBALS['DATABASE']->GetInsertID() . "','" . $USER['id'] . "','" . TIMESTAMP . "','100000');"); $this->printMessage($LNG['planetcloak_activate_seven'], true, array('game.php?page=overview', 2)); } } $this->tplObj->assign_vars(array()); $this->display('page.planetcloak.default.tpl'); }
function show() { global $LNG, $USER; $LNG->includeData(array('FLEET')); $this->setWindow('popup'); $RID = HTTP::_GP('raport', ''); $raportData = $GLOBALS['DATABASE']->getFirstRow("SELECT raport,attacker,defender FROM " . RW . " WHERE rid = '" . $GLOBALS['DATABASE']->escape($RID) . "';"); if (empty($raportData)) { $this->printMessage($LNG['sys_raport_not_found']); } // empty is BC for pre r2484 $isAttacker = empty($raportData['attacker']) || in_array($USER['id'], explode(",", $raportData['attacker'])); $isDefender = empty($raportData['defender']) || in_array($USER['id'], explode(",", $raportData['defender'])); if (empty($raportData) || !$isAttacker && !$isDefender) { $this->printMessage($LNG['sys_raport_not_found']); } $CombatRaport = unserialize($raportData['raport']); if ($isAttacker && !$isDefender && $CombatRaport['result'] == 'r' && count($CombatRaport['rounds']) <= 2) { $this->printMessage($LNG['sys_raport_lost_contact']); } $CombatRaport['time'] = _date($LNG['php_tdformat'], $CombatRaport['time'], isset($USER['timezone']) ? $USER['timezone'] : Config::get('timezone')); $CombatRaport = $this->BCWrapperPreRev2321($CombatRaport); $this->tplObj->assign_vars(array('Raport' => $CombatRaport, 'pageTitle' => $LNG['sys_mess_attack_report'])); $this->display('shared.mission.raport.tpl'); }
function ShowNewsPage() { global $LNG, $USER; if ($_GET['action'] == 'send') { $edit_id = HTTP::_GP('id', 0); $title = $GLOBALS['DATABASE']->sql_escape(HTTP::_GP('title', '', true)); $text = $GLOBALS['DATABASE']->sql_escape(HTTP::_GP('text', '', true)); $query = $_GET['mode'] == 2 ? "INSERT INTO " . NEWS . " (`id` ,`user` ,`date` ,`title` ,`text`) VALUES ( NULL , '" . $USER['username'] . "', '" . TIMESTAMP . "', '" . $title . "', '" . $text . "');" : "UPDATE " . NEWS . " SET `title` = '" . $title . "', `text` = '" . $text . "', `date` = '" . TIMESTAMP . "' WHERE `id` = '" . $edit_id . "' LIMIT 1;"; $GLOBALS['DATABASE']->query($query); } elseif ($_GET['action'] == 'delete' && isset($_GET['id'])) { $GLOBALS['DATABASE']->query("DELETE FROM " . NEWS . " WHERE `id` = '" . HTTP::_GP('id', 0) . "';"); } $query = $GLOBALS['DATABASE']->query("SELECT * FROM " . NEWS . " ORDER BY id ASC"); while ($u = $GLOBALS['DATABASE']->fetch_array($query)) { $NewsList[] = array('id' => $u['id'], 'title' => $u['title'], 'date' => _date($LNG['php_tdformat'], $u['date'], $USER['timezone']), 'user' => $u['user'], 'confirm' => sprintf($LNG['nws_confirm'], $u['title'])); } $template = new template(); if ($_GET['action'] == 'edit' && isset($_GET['id'])) { $News = $GLOBALS['DATABASE']->getFirstRow("SELECT id, title, text FROM " . NEWS . " WHERE id = '" . $GLOBALS['DATABASE']->sql_escape($_GET['id']) . "';"); $template->assign_vars(array('mode' => 1, 'nws_head' => sprintf($LNG['nws_head_edit'], $News['title']), 'news_id' => $News['id'], 'news_title' => $News['title'], 'news_text' => $News['text'])); } elseif ($_GET['action'] == 'create') { $template->assign_vars(array('mode' => 2, 'nws_head' => $LNG['nws_head_create'])); } $template->assign_vars(array('NewsList' => $NewsList, 'button_submit' => $LNG['button_submit'], 'nws_total' => sprintf($LNG['nws_total'], count($NewsList)), 'nws_news' => $LNG['nws_news'], 'nws_id' => $LNG['nws_id'], 'nws_title' => $LNG['nws_title'], 'nws_date' => $LNG['nws_date'], 'nws_from' => $LNG['nws_from'], 'nws_del' => $LNG['nws_del'], 'nws_create' => $LNG['nws_create'], 'nws_content' => $LNG['nws_content'])); $template->show('NewsPage.tpl'); }
function ShowChatConfigPage() { global $LNG, $USER; $CONF = Config::getAll(NULL, 1); if (!empty($_POST)) { $config_before = array('chat_closed' => $CONF['chat_closed'], 'chat_allowchan' => $CONF['chat_allowchan'], 'chat_allowmes' => $CONF['chat_allowmes'], 'chat_allowdelmes' => $CONF['chat_allowdelmes'], 'chat_logmessage' => $CONF['chat_logmessage'], 'chat_nickchange' => $CONF['chat_nickchange'], 'chat_botname' => $CONF['chat_botname'], 'chat_channelname' => $CONF['chat_channelname']); $chat_allowchan = isset($_POST['chat_allowchan']) && $_POST['chat_allowchan'] == 'on' ? 1 : 0; $chat_allowmes = isset($_POST['chat_allowmes']) && $_POST['chat_allowmes'] == 'on' ? 1 : 0; $chat_allowdelmes = isset($_POST['chat_allowdelmes']) && $_POST['chat_allowdelmes'] == 'on' ? 1 : 0; $chat_logmessage = isset($_POST['chat_logmessage']) && $_POST['chat_logmessage'] == 'on' ? 1 : 0; $chat_nickchange = isset($_POST['chat_nickchange']) && $_POST['chat_nickchange'] == 'on' ? 1 : 0; $chat_closed = isset($_POST['chat_closed']) && $_POST['chat_closed'] == 'on' ? 1 : 0; $chat_channelname = HTTP::_GP('chat_channelname', '', true); $chat_botname = HTTP::_GP('chat_botname', '', true); $config_after = array('chat_closed' => $chat_closed, 'chat_allowchan' => $chat_allowchan, 'chat_allowmes' => $chat_allowmes, 'chat_allowdelmes' => $chat_allowdelmes, 'chat_logmessage' => $chat_logmessage, 'chat_nickchange' => $chat_nickchange, 'chat_botname' => $chat_botname, 'chat_channelname' => $chat_channelname); Config::update($config_after); $CONF = Config::getAll(NULL, 1); $LOG = new Log(3); $LOG->target = 3; $LOG->old = $config_before; $LOG->new = $config_after; $LOG->save(); } $template = new template(); $template->assign_vars(array('chat_closed' => $CONF['chat_closed'], 'chat_allowchan' => $CONF['chat_allowchan'], 'chat_allowmes' => $CONF['chat_allowmes'], 'chat_logmessage' => $CONF['chat_logmessage'], 'chat_nickchange' => $CONF['chat_nickchange'], 'chat_botname' => $CONF['chat_botname'], 'chat_channelname' => $CONF['chat_channelname'], 'se_server_parameters' => $LNG['se_server_parameters'], 'se_save_parameters' => $LNG['se_save_parameters'], 'ch_closed' => $LNG['ch_closed'], 'ch_allowchan' => $LNG['ch_allowchan'], 'ch_allowmes' => $LNG['ch_allowmes'], 'ch_allowdelmes' => $LNG['ch_allowdelmes'], 'ch_logmessage' => $LNG['ch_logmessage'], 'ch_nickchange' => $LNG['ch_nickchange'], 'ch_botname' => $LNG['ch_botname'], 'ch_channelname' => $LNG['ch_channelname'])); $template->show('ChatConfigBody.tpl'); }
function ShowUpdatePage() { global $LNG, $CONF; $template = new template(); $template->message('<p>This Site is currently under construction, because the update system brings somtimes inconsistent game installations.</p><p>Alternate update process: <a href="http://2moons.cc/b4-support/b7-installation-update-und-konvertierung/t1721-howto-update-your-2moons-game-with-private-modifications-without-edit-files-one-by-one/" target="blank"><u>2moons.cc Board</u></a></p><p>We apologize for any inconvenience.</p>'); exit; if (!function_exists('curl_init')) { $template = new template(); $template->message($LNG['up_need_curl']); } if (isset($_REQUEST['version'])) { $Temp = explode('.', $_REQUEST['version']); $Temp = array_map('intval', $Temp); if (count(GetLogs($Temp[2]), COUNT_RECURSIVE) > 8) { Config::update(array('VERSION' => $Temp[0] . '.' . $Temp[1] . '.' . $Temp[2])); } } $ACTION = HTTP::_GP('action', ''); switch ($ACTION) { case "download": DownloadUpdates(); break; case "check": CheckPermissions(); break; case "update": ExecuteUpdates(); break; default: DisplayUpdates(); break; } }
function comfirm() { global $USER, $PLANET, $LNG, $resource, $dpath, $reslist, $CONF; $population_301 = HTTP::_GP('population_301', 0); $population_302 = HTTP::_GP('population_302', 0); $population_303 = HTTP::_GP('population_303', 0); $population_304 = HTTP::_GP('population_304', 0); $population_305 = HTTP::_GP('population_305', 0); $population_306 = HTTP::_GP('population_306', 0); $population_307 = HTTP::_GP('population_307', 0); $population_308 = HTTP::_GP('population_308', 0); $cost_population_301 = $population_301 * 1; $cost_population_302 = $population_302 * 3; $cost_population_303 = $population_303 * 4; $cost_population_304 = $population_304 * 50; $cost_population_305 = $population_305 * 20; $cost_population_306 = $population_306 * 12; $cost_population_307 = $population_307 * 44; $cost_population_308 = $population_308 * 4; $MaxPoints = $PLANET['formation']; $TotalCost = $cost_population_301 + $cost_population_302 + $cost_population_303 + $cost_population_304 + $cost_population_305 + $cost_population_306 + $cost_population_307 + $cost_population_308; if ($TotalCost > $MaxPoints) { $this->printMessage("<span class='rouge'>Your barracks do not produce enough training unit to make these changes.</span>", true, array('game.php?page=immunity', 3)); } else { $GLOBALS['DATABASE']->query("Update " . PLANETS . " SET `civil_prod` = " . $population_301 . ", `technician_prod` = " . $population_302 . ", `scientist_prod` = " . $population_303 . ", `archaeologist_prod` = " . $population_304 . ", `diplomat_prod` = " . $population_305 . ", `soldier_prod` = " . $population_306 . ", `adv_soldier_prod` = " . $population_307 . ", `pilot_prod` = " . $population_308 . ", `formation_used` = " . $TotalCost . " WHERE `id` = " . $PLANET['id'] . " ;"); $this->printMessage("<span class='vert'>You succesfully edited your formation units production</span>", true, array('game.php?page=immunity', 3)); } }