本文整理汇总了PHP中_date函数的典型用法代码示例。如果您正苦于以下问题:PHP _date函数的具体用法?PHP _date怎么用?PHP _date使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_date函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show
function show()
{
global $USER, $LNG, $reslist;
$db = Database::get();
$sql = "SELECT elementID, level, userID, username\n\t\tFROM %%USERS%%\n\t\tINNER JOIN %%RECORDS%% ON userID = id\n\t\tWHERE universe = :universe;";
$recordResult = $db->select($sql, array(':universe' => Universe::current()));
$defenseList = array_fill_keys($reslist['defense'], array());
$fleetList = array_fill_keys($reslist['fleet'], array());
$researchList = array_fill_keys($reslist['tech'], array());
$buildList = array_fill_keys($reslist['build'], array());
foreach ($recordResult as $recordRow) {
if (in_array($recordRow['elementID'], $reslist['defense'])) {
$defenseList[$recordRow['elementID']][] = $recordRow;
} elseif (in_array($recordRow['elementID'], $reslist['fleet'])) {
$fleetList[$recordRow['elementID']][] = $recordRow;
} elseif (in_array($recordRow['elementID'], $reslist['tech'])) {
$researchList[$recordRow['elementID']][] = $recordRow;
} elseif (in_array($recordRow['elementID'], $reslist['build'])) {
$buildList[$recordRow['elementID']][] = $recordRow;
}
}
require_once 'includes/classes/Cronjob.class.php';
$this->assign(array('defenseList' => $defenseList, 'fleetList' => $fleetList, 'researchList' => $researchList, 'buildList' => $buildList, 'update' => _date($LNG['php_tdformat'], Cronjob::getLastExecutionTime('statistic'), $USER['timezone'])));
$this->display('page.records.default.tpl');
}
示例2: CreateUTF8Banner
public function CreateUTF8Banner($data)
{
global $LNG;
$image = imagecreatefromjpeg($this->source);
$date = _date($LNG['php_dateformat'], TIMESTAMP);
$Font = $data['ttf_file'];
if (!file_exists($Font)) {
$this->BannerError('TTF Font missing!');
}
// Colors
$color = imagecolorallocate($image, 255, 255, 225);
$shadow = imagecolorallocate($image, 33, 33, 33);
$total = $data['wons'] + $data['loos'] + $data['draws'];
$quote = $total != 0 ? $data['wons'] / $total * 100 : 0;
// Username
imagettftext($image, 20, 0, 20, 31, $shadow, $Font, $data['username']);
imagettftext($image, 20, 0, 20, 30, $color, $Font, $data['username']);
imagettftext($image, 16, 0, 250, 31, $shadow, $Font, $data['game_name']);
imagettftext($image, 16, 0, 250, 30, $color, $Font, $data['game_name']);
imagettftext($image, 11, 0, 20, 60, $shadow, $Font, $LNG['ub_rank'] . ': ' . $data['total_rank']);
imagettftext($image, 11, 0, 20, 59, $color, $Font, $LNG['ub_rank'] . ': ' . $data['total_rank']);
imagettftext($image, 11, 0, 20, 81, $shadow, $Font, $LNG['ub_points'] . ': ' . html_entity_decode(shortly_number($data['total_points'])));
imagettftext($image, 11, 0, 20, 80, $color, $Font, $LNG['ub_points'] . ': ' . html_entity_decode(shortly_number($data['total_points'])));
imagettftext($image, 11, 0, 250, 60, $shadow, $Font, $LNG['ub_fights'] . ': ' . html_entity_decode(shortly_number($total, 0)));
imagettftext($image, 11, 0, 250, 59, $color, $Font, $LNG['ub_fights'] . ': ' . html_entity_decode(shortly_number($total, 0)));
imagettftext($image, 11, 0, 250, 81, $shadow, $Font, $LNG['ub_quote'] . ': ' . html_entity_decode(shortly_number($quote, 2)) . '%');
imagettftext($image, 11, 0, 250, 80, $color, $Font, $LNG['ub_quote'] . ': ' . html_entity_decode(shortly_number($quote, 2)) . '%');
if (!isset($_GET['debug'])) {
HTTP::sendHeader('Content-type', 'image/jpg');
}
ImageJPEG($image);
imagedestroy($image);
}
示例3: ShowFlyingFleetPage
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');
}
示例4: show
function show()
{
global $CONF, $LNG, $PLANET, $USER, $db, $resource, $UNI;
$code = isset($_GET['code']) ? $_GET['code'] : null;
$quer = $GLOBALS['DATABASE']->query("SELECT *FROM `uni1_allopass_log` where `code` = '" . $code . "' ;");
if ($GLOBALS['DATABASE']->numRows($quer) < 1) {
$this->printMessage("We are proceeding the payment, do not quit this page. <br> you wil be redirected in 5 seconds", true, array('game.php?page=allo&code=' . $code . '', 5));
die;
}
$query = $GLOBALS['DATABASE']->query("SELECT transac, date, orderid, reference_paid, credits FROM `uni1_allopass_log` where `code` = '" . $code . "' ;");
$query = $GLOBALS['DATABASE']->fetch_array($query);
$INFO1 = $GLOBALS['DATABASE']->uniquequery("SELECT * FROM `uni1_users` WHERE `id` = " . $USER['id'] . ";");
if ($INFO1['lp_points'] == 0) {
$text = 0;
}
if ($INFO1['lp_points'] > 0) {
$text = 0;
}
if ($INFO1['lp_points'] >= 125) {
$text = 5;
}
if ($INFO1['lp_points'] >= 625) {
$text = 10;
}
if ($INFO1['lp_points'] >= 2500) {
$text = 15;
}
if ($INFO1['lp_points'] >= 7000) {
$text = 20;
}
$this->tplObj->assign_vars(array('transac' => $query['transac'], 'code' => $code, 'date' => str_replace(' ', ' ', _date($LNG['php_tdformat'], $query['date']), $USER['timezone']), 'orderid' => $query['orderid'], 'total' => $query['reference_paid'], 'credits' => pretty_number($query['credits'] + $query['credits'] / 100 * $text)));
$this->display('page.allo.order.tpl');
}
示例5: show
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');
}
示例6: ShowMultiIPPage
function ShowMultiIPPage()
{
global $LNG;
switch ($_GET['action']) {
case 'known':
$GLOBALS['DATABASE']->query("INSERT INTO " . MULTI . " SET userID = " . (int) $_GET['id'] . ";");
HTTP::redirectTo("admin.php?page=multiips");
break;
case 'unknown':
$GLOBALS['DATABASE']->query("DELETE FROM " . MULTI . " WHERE userID = " . (int) $_GET['id'] . ";");
HTTP::redirectTo("admin.php?page=multiips");
break;
}
$Query = $GLOBALS['DATABASE']->query("SELECT id, username, email, register_time, onlinetime, user_lastip, IFNULL(multiID, 0) as isKnown FROM " . USERS . " LEFT JOIN " . MULTI . " ON userID = id WHERE `universe` = '" . Universe::getEmulated() . "' AND user_lastip IN (SELECT user_lastip FROM " . USERS . " WHERE `universe` = '" . Universe::getEmulated() . "' GROUP BY user_lastip HAVING COUNT(*)>1) ORDER BY user_lastip, id ASC;");
$IPs = array();
while ($Data = $GLOBALS['DATABASE']->fetch_array($Query)) {
if (!isset($IPs[$Data['user_lastip']])) {
$IPs[$Data['user_lastip']] = array();
}
$Data['register_time'] = _date($LNG['php_tdformat'], $Data['register_time']);
$Data['onlinetime'] = _date($LNG['php_tdformat'], $Data['onlinetime']);
$IPs[$Data['user_lastip']][$Data['id']] = $Data;
}
$template = new template();
$template->assign_vars(array('multiGroups' => $IPs));
$template->show('MultiIPs.tpl');
}
示例7: view
function view()
{
global $THEME, $LNG, $USER;
$MessCategory = HTTP::_GP('messcat', 100);
$page = HTTP::_GP('site', 1);
$this->initTemplate();
$this->setWindow('ajax');
$MessageList = array();
$MesagesID = array();
if ($MessCategory == 999) {
$MessageCount = $GLOBALS['DATABASE']->getFirstCell("SELECT COUNT(*) FROM " . MESSAGES . " WHERE message_sender = " . $USER['id'] . " AND message_type != 50;");
$maxPage = max(1, ceil($MessageCount / MESSAGES_PER_PAGE));
$page = max(1, min($page, $maxPage));
$MessageResult = $GLOBALS['DATABASE']->query("SELECT message_id, message_time, CONCAT(username, ' [',galaxy, ':', system, ':', planet,']') as message_from, message_subject, message_sender, message_type, message_unread, message_text FROM " . MESSAGES . " INNER JOIN " . USERS . " ON id = message_owner WHERE message_sender = " . $USER['id'] . " AND message_type != 50 ORDER BY message_time DESC LIMIT " . ($page - 1) * MESSAGES_PER_PAGE . ", " . MESSAGES_PER_PAGE . ";");
} else {
$MessageCount = $GLOBALS['DATABASE']->getFirstCell("SELECT COUNT(*) FROM " . MESSAGES . " WHERE message_owner = " . $USER['id'] . ($MessCategory != 100 ? " AND message_type = " . $MessCategory : "") . ";");
$maxPage = max(1, ceil($MessageCount / MESSAGES_PER_PAGE));
$page = max(1, min($page, $maxPage));
$MessageResult = $GLOBALS['DATABASE']->query("SELECT message_id, message_time, message_from, message_subject, message_sender, message_type, message_unread, message_text FROM " . MESSAGES . " WHERE message_owner = " . $USER['id'] . ($MessCategory != 100 ? " AND message_type = " . $MessCategory : "") . " ORDER BY message_time DESC LIMIT " . ($page - 1) * MESSAGES_PER_PAGE . ", " . MESSAGES_PER_PAGE . ";");
}
while ($MessageRow = $GLOBALS['DATABASE']->fetch_array($MessageResult)) {
$MesagesID[] = $MessageRow['message_id'];
$MessageList[] = array('id' => $MessageRow['message_id'], 'time' => _date($LNG['php_tdformat'], $MessageRow['message_time'], $USER['timezone']), 'from' => $MessageRow['message_from'], 'subject' => $MessageRow['message_subject'], 'sender' => $MessageRow['message_sender'], 'type' => $MessageRow['message_type'], 'unread' => $MessageRow['message_unread'], 'text' => $MessageRow['message_text']);
}
if (!empty($MesagesID) && $MessCategory != 999) {
$GLOBALS['DATABASE']->query("UPDATE " . MESSAGES . " SET message_unread = 0 WHERE message_id IN (" . implode(',', $MesagesID) . ") AND message_owner = " . $USER['id'] . ";");
}
$GLOBALS['DATABASE']->free_result($MessageResult);
$this->tplObj->assign_vars(array('MessID' => $MessCategory, 'MessageCount' => $MessageCount, 'MessageList' => $MessageList, 'page' => $page, 'maxPage' => $maxPage));
$this->display('page.messages.view.tpl');
}
示例8: ShowNewsPage
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');
}
示例9: run
function run()
{
global $LNG;
$config = Config::get(ROOT_UNI);
if ($config->mail_active == 1) {
/** @var $langObjects Language[] */
$langObjects = array();
require 'includes/classes/Mail.class.php';
$sql = 'SELECT `id`, `username`, `lang`, `email`, `onlinetime`, `timezone`, `universe`
FROM %%USERS%% WHERE `inactive_mail` = 0 AND `onlinetime` < :time;';
$inactiveUsers = Database::get()->select($sql, array(':time' => TIMESTAMP - $config->del_user_sendmail * 24 * 60 * 60));
foreach ($inactiveUsers as $user) {
if (!isset($langObjects[$user['lang']])) {
$langObjects[$user['lang']] = new Language($user['lang']);
$langObjects[$user['lang']]->includeData(array('L18N', 'INGAME', 'PUBLIC', 'CUSTOM'));
}
$userConfig = Config::get($user['universe']);
$LNG = $langObjects[$user['lang']];
$MailSubject = sprintf($LNG['spec_mail_inactive_title'], $userConfig->game_name . ' - ' . $userConfig->uni_name);
$MailRAW = $LNG->getTemplate('email_inactive');
$MailContent = str_replace(array('{USERNAME}', '{GAMENAME}', '{LASTDATE}', '{HTTPPATH}'), array($user['username'], $userConfig->game_name . ' - ' . $userConfig->uni_name, _date($LNG['php_tdformat'], $user['onlinetime'], $user['timezone']), HTTP_PATH), $MailRAW);
Mail::send($user['email'], $user['username'], $MailSubject, $MailContent);
$sql = 'UPDATE %%USERS%% SET `inactive_mail` = 1 WHERE `id` = :userId;';
Database::get()->update($sql, array(':userId' => $user['id']));
}
}
}
示例10: show
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');
}
示例11: show
function show()
{
global $LNG;
$referralID = HTTP::_GP('ref', 0);
if (!empty($referralID)) {
$this->redirectTo('promo.php?referralID=' . $referralID);
}
$universeSelect = array();
$uniAllConfig = Config::getAll('universe');
foreach ($uniAllConfig as $uniID => $uniConfig) {
$universeSelect[$uniID] = $uniConfig['uni_name'] . ($uniConfig['game_disable'] == 0 ? t('uni_closed') : '');
}
$Code = HTTP::_GP('code', 0);
$loginCode = false;
if (isset($LNG['login_error_' . $Code])) {
$loginCode = $LNG['login_error_' . $Code];
}
$referralUniversum = 0;
$referralUserID = 0;
if (Config::get('ref_active')) {
$referralUserID = HTTP::_GP('ref', 0);
if (!empty($referralUserID)) {
$referralUniversum = $GLOBALS['DATABASE']->getFirstRow("SELECT universe FROM " . USERS . " WHERE id = " . $referralUserID . ";");
if (!isset($referralUniversum)) {
$referralUniversum = 0;
$referralUserID = 0;
}
}
}
$newsResult = $GLOBALS['DATABASE']->query("SELECT id, date, title, text, user, catID FROM " . NEWS . " ORDER BY id DESC;");
$newsList = array();
while ($newsRow = $GLOBALS['DATABASE']->fetchArray($newsResult)) {
$newsList[] = array('id' => $newsRow['id'], 'title' => $newsRow['title'], 'from' => t('news_from', _date(t('php_tdformat'), $newsRow['date']), $newsRow['user']), 'text' => substr($newsRow['text'], 0, 160) . "...", 'date' => _date($LNG['php_tdformat'], $newsRow['date'], $newsRow['user']), 'image' => 'images/' . $newsRow['catID'] . '.jpg');
}
$topicsResult = $GLOBALS['DATABASE']->query("SELECT tid, title, last_post, topic_firstpost, title_seo FROM forum_topics WHERE tdelete_time = '0' ORDER BY last_post DESC LIMIT 5;");
$topicsList = array();
while ($topicsRow = $GLOBALS['DATABASE']->fetchArray($topicsResult)) {
$topicsList[] = array('id' => $topicsRow['tid'], 'title' => $topicsRow['title'], 'topic_firstpost' => $topicsRow['topic_firstpost'], 'title_seo' => $topicsRow['title_seo'], 'date' => _date($LNG['php_tdformat'], $topicsRow['last_post'], 1));
}
$uniResult = $GLOBALS['DATABASE']->query("SELECT users_amount, COUNT(DISTINCT inac.id) as inactive, COUNT(planet.id) as planet\n\tFROM " . CONFIG . " conf\n\tLEFT JOIN " . USERS . " as inac ON uni = inac.universe AND inac.onlinetime < " . (TIMESTAMP - INACTIVE) . "\n\tLEFT JOIN " . PLANETS . " as planet ON uni = planet.universe\n\tGROUP BY conf.uni, inac.universe, planet.universe\n\tORDER BY uni ASC;");
while ($uniRow = $GLOBALS['DATABASE']->fetch_array($uniResult)) {
$users_amount = $uniRow['users_amount'];
$active = $uniRow['users_amount'] - $uniRow['inactive'];
}
$uniInfo = $GLOBALS['DATABASE']->query("SELECT users_amount, COUNT(DISTINCT inac.id) as inactive, COUNT(planet.id) as planet\n\tFROM " . CONFIG . " conf\n\tLEFT JOIN " . USERS . " as inac ON uni = inac.universe AND inac.register_time > " . (TIMESTAMP - 30 * 24 * 60 * 60) . "\n\tLEFT JOIN " . PLANETS . " as planet ON uni = planet.universe\n\tGROUP BY conf.uni, inac.universe, planet.universe\n\tORDER BY uni ASC;");
while ($uniRaw = $GLOBALS['DATABASE']->fetch_array($uniInfo)) {
$users_amount = $uniRaw['users_amount'];
$new_member = $uniRaw['inactive'];
}
$uniHof = $GLOBALS['DATABASE']->query("SELECT COUNT(rid) as inactive\n\tFROM " . TOPKB . " WHERE time > " . (TIMESTAMP - 24 * 60 * 60) . "\n\tORDER BY units DESC LIMIT 100;");
while ($uniHaf = $GLOBALS['DATABASE']->fetch_array($uniHof)) {
$total_hof = $uniHaf['inactive'];
}
$this->assign(array('referralUserID' => $referralUserID, 'referralUniversum' => $referralUniversum, 'universeSelect' => $universeSelect, 'topicsList' => $topicsList, 'code' => $loginCode, 'descHeader' => t('loginWelcome', Config::get('game_name')), 'descText' => t('loginServerDesc', Config::get('game_name')), 'newsList' => $newsList, 'users_amount' => $users_amount, 'active' => $active, 'new_member' => $new_member, 'total_hof' => $total_hof, 'loginInfo' => t('loginInfo', '<a href="index.php?page=rules">' . t('menu_rules') . '</a>')));
$this->render('page.index.default.tpl');
}
示例12: show
function show()
{
$newsResult = $GLOBALS['DATABASE']->query("SELECT date, title, text, user FROM " . NEWS . " ORDER BY id DESC;");
$newsList = array();
while ($newsRow = $GLOBALS['DATABASE']->fetchArray($newsResult)) {
$newsList[] = array('title' => $newsRow['title'], 'from' => t('news_from', _date(t('php_tdformat'), $newsRow['date']), $newsRow['user']), 'text' => makebr($newsRow['text']));
}
$this->assign(array('newsList' => $newsList));
$this->render('page.news.default.tpl');
}
示例13: ShowMessageListPage
function ShowMessageListPage()
{
global $LNG;
$page = HTTP::_GP('side', 1);
$type = HTTP::_GP('type', 100);
$sender = HTTP::_GP('sender', '', UTF8_SUPPORT);
$receiver = HTTP::_GP('receiver', '', UTF8_SUPPORT);
$dateStart = HTTP::_GP('dateStart', array());
$dateEnd = HTTP::_GP('dateEnd', array());
$perSide = 50;
$messageList = array();
$userWhereSQL = '';
$dateWhereSQL = '';
$countJoinSQL = '';
$categories = $LNG['mg_type'];
unset($categories[999]);
$dateStart = array_filter($dateStart, 'is_numeric');
$dateEnd = array_filter($dateEnd, 'is_numeric');
$useDateStart = count($dateStart) == 3;
$useDateEnd = count($dateEnd) == 3;
if ($useDateStart && $useDateEnd) {
$dateWhereSQL = ' AND message_time BETWEEN ' . mktime(0, 0, 0, (int) $dateStart['month'], (int) $dateStart['day'], (int) $dateStart['year']) . ' AND ' . mktime(23, 59, 59, (int) $dateEnd['month'], (int) $dateEnd['day'], (int) $dateEnd['year']);
} elseif ($useDateStart) {
$dateWhereSQL = ' AND message_time > ' . mktime(0, 0, 0, (int) $dateStart['month'], (int) $dateStart['day'], (int) $dateStart['year']);
} elseif ($useDateStart) {
$dateWhereSQL = ' AND message_time < ' . mktime(23, 59, 59, (int) $dateEnd['month'], (int) $dateEnd['day'], (int) $dateEnd['year']);
}
if (!empty($sender)) {
$countJoinSQL .= ' LEFT JOIN ' . USERS . ' as us ON message_sender = us.id';
$userWhereSQL .= ' AND us.username = "' . $GLOBALS['DATABASE']->escape($sender) . '"';
}
if (!empty($receiver)) {
$countJoinSQL .= ' LEFT JOIN ' . USERS . ' as u ON message_owner = u.id';
$userWhereSQL .= ' AND u.username = "' . $GLOBALS['DATABASE']->escape($receiver) . '"';
}
if ($type != 100) {
$MessageCount = $GLOBALS['DATABASE']->getFirstCell("SELECT COUNT(*) FROM " . MESSAGES . $countJoinSQL . " WHERE message_type = " . $type . " AND message_universe = " . Universe::getEmulated() . $dateWhereSQL . $userWhereSQL . ";");
} else {
$MessageCount = $GLOBALS['DATABASE']->getFirstCell("SELECT COUNT(*) FROM " . MESSAGES . $countJoinSQL . " WHERE message_universe = " . Universe::getEmulated() . $dateWhereSQL . $userWhereSQL . ";");
}
$maxPage = max(1, ceil($MessageCount / $perSide));
$page = max(1, min($page, $maxPage));
$sqlLimit = ($page - 1) * $perSide . ", " . ($perSide - 1);
if ($type == 100) {
$messageRaw = $GLOBALS['DATABASE']->query("SELECT u.username, us.username as senderName, m.* \n\t\tFROM " . MESSAGES . " as m \n\t\tLEFT JOIN " . USERS . " as u ON m.message_owner = u.id \n\t\tLEFT JOIN " . USERS . " as us ON m.message_sender = us.id\n\t\tWHERE m.message_universe = " . Universe::getEmulated() . "\n\t\t" . $dateWhereSQL . "\n\t\t" . $userWhereSQL . "\n\t\tORDER BY message_time DESC, message_id DESC\n\t\tLIMIT " . $sqlLimit . ";");
} else {
$messageRaw = $GLOBALS['DATABASE']->query("SELECT u.username, us.username as senderName, m.* \n\t\tFROM " . MESSAGES . " as m\n\t\tLEFT JOIN " . USERS . " as u ON m.message_owner = u.id\n\t\tLEFT JOIN " . USERS . " as us ON m.message_sender = us.id\n\t\tWHERE m.message_type = " . $type . " AND message_universe = " . Universe::getEmulated() . "\n\t\t" . $dateWhereSQL . "\n\t\t" . $userWhereSQL . "\n\t\tORDER BY message_time DESC, message_id DESC\n\t\tLIMIT " . $sqlLimit . ";");
}
while ($messageRow = $GLOBALS['DATABASE']->fetch_array($messageRaw)) {
$messageList[$messageRow['message_id']] = array('sender' => empty($messageRow['senderName']) ? $messageRow['message_from'] : $messageRow['senderName'] . ' (ID: ' . $messageRow['message_sender'] . ')', 'receiver' => $messageRow['username'] . ' (ID: ' . $messageRow['message_owner'] . ')', 'subject' => $messageRow['message_subject'], 'text' => $messageRow['message_text'], 'type' => $messageRow['message_type'], 'time' => str_replace(' ', ' ', _date($LNG['php_tdformat'], $messageRow['message_time']), $USER['timezone']));
}
$template = new template();
$template->assign_vars(array('categories' => $categories, 'maxPage' => $maxPage, 'page' => $page, 'messageList' => $messageList, 'type' => $type, 'dateStart' => $dateStart, 'dateEnd' => $dateEnd, 'sender' => $sender, 'receiver' => $receiver));
$template->show('MessageList.tpl');
}
示例14: show
public function show()
{
global $USER, $LNG, $CONF;
if ($USER['urlaubs_modus'] == 1) {
$this->tplObj->assign_vars(array('vacationUntil' => _date($LNG['php_tdformat'], $USER['urlaubs_until'], $USER['timezone']), 'delete' => $USER['db_deaktjava'], 'canVacationDisbaled' => $USER['urlaubs_until'] < TIMESTAMP));
$this->display('page.settings.vacation.tpl');
} else {
$this->tplObj->assign_vars(array('Selectors' => array('timezones' => get_timezone_selector(), 'Sort' => array(0 => $LNG['op_sort_normal'], 1 => $LNG['op_sort_koords'], 2 => $LNG['op_sort_abc']), 'SortUpDown' => array(0 => $LNG['op_sort_up'], 1 => $LNG['op_sort_down']), 'Skins' => Theme::getAvalibleSkins(), 'lang' => $LNG->getAllowedLangs(false)), 'adminProtection' => $USER['authattack'], 'fblink' => $USER['fblink'], 'sirena' => $USER['alarm_volume'], 'userAuthlevel' => $USER['authlevel'], 'changeNickTime' => $USER['uctime'] + USERNAME_CHANGETIME - TIMESTAMP, 'username' => $USER['username'], 'email' => $USER['email'], 'permaEmail' => $USER['email_2'], 'userLang' => $USER['lang'], 'theme' => substr($USER['dpath'], 13, -1), 'planetSort' => $USER['planet_sort'], 'planetOrder' => $USER['planet_sort_order'], 'spycount' => $USER['spio_anz'], 'fleetActions' => $USER['settings_fleetactions'], 'timezone' => $USER['timezone'], 'delete' => $USER['db_deaktjava'], 'queueMessages' => $USER['hof'], 'galaxySpy' => $USER['settings_esp'], 'galaxyBuddyList' => $USER['settings_bud'], 'galaxyMissle' => $USER['settings_mis'], 'galaxyMessage' => $USER['settings_wri'], 'blockPM' => $USER['settings_blockPM'], 'userid' => $USER['id'], 'ref_active' => Config::get('ref_active')));
$this->display('page.settings.default.tpl');
}
}
示例15: historique
function historique()
{
global $USER, $PLANET, $LNG, $UNI, $CONF, $resource, $pricelist;
$messageList = '';
$messageRaw = $GLOBALS['DATABASE']->query("SELECT * \n\t\tFROM uni1_reward_log WHERE rewardUserId = " . $USER['id'] . " AND rewardTime > " . (TIMESTAMP - 15 * 24 * 60 * 60) . " \n\t\tORDER BY rewardTime DESC\n\t\t;");
while ($messageRow = $GLOBALS['DATABASE']->fetch_array($messageRaw)) {
$messageList[$messageRow['rewardIdLog']] = array('date' => str_replace(' ', ' ', _date($LNG['php_tdformat'], $messageRow['rewardTime']), $USER['timezone']), 'rewardPrice' => $messageRow['rewardPrice'], 'rewardIdLog' => $messageRow['rewardIdLog'], 'rewardCode' => $this->redeemCode($messageRow['rewardIdLog']));
}
$this->tplObj->assign_vars(array('messageList' => $messageList));
$this->display("page.reward2.historique.tpl");
}