/** * TODO: PHPDoc * * @return Nova_User_Model_Entity */ protected function _getUser() { if (is_null($this->_userModel)) { $this->_userModel = Nova::getSingleton('user/session')->getUser(); } return $this->_userModel; }
public function getUser() { if (is_null($this->_user)) { $this->_user = Nova::getSingleton('user/entity')->load($this->getUserId()); } return $this->_user; }
/** * MissionCaseStayAlly @todo description * * @global array $lang @see common.php * @param array $fleetRow @see common.php * @return bool true. */ function missionCaseStayAlly($fleetRow) { global $lang; $readConnection = Nova::getSingleton('core/database_connection_pool')->getConnection('core_read'); $startPlanet = $readConnection->select(array('name', 'id_owner'))->from($readConnection->getDeprecatedTable('planets'))->where('galaxy =?', $fleetRow['fleet_start_galaxy'])->where('system =?', $fleetRow['fleet_start_system'])->where('planet =?', $fleetRow['fleet_start_planet'])->query()->fetch(); $endPlanet = $readConnection->select(array('name', 'id_owner'))->from($readConnection->getDeprecatedTable('planets'))->where('galaxy =?', $fleetRow['fleet_end_galaxy'])->where('system =?', $fleetRow['fleet_end_system'])->where('planet =?', $fleetRow['fleet_end_planet'])->query()->fetch(); $fleetStartLink = GetStartAdressLink($fleetRow, ''); $fleetEndLink = GetTargetAdressLink($fleetRow, ''); if ($fleetRow['fleet_mess'] == 0) { if ($fleetRow['fleet_end_stay'] <= time()) { $readConnection->update($readConnection->getDeprecatedTable('fleets'), array('fleet_mess' => 1), array('fleet_id =?' => $fleetRow['fleet_id'])); } else { if ($fleetRow['fleet_start_time'] <= time()) { $message = sprintf($lang['sys_tran_mess_owner'], $endPlanet['name'], $fleetEndLink, $fleetRow['fleet_resource_metal'], $lang['Metal'], $fleetRow['fleet_resource_crystal'], $lang['Crystal'], $fleetRow['fleet_resource_deuterium'], $lang['Deuterium']); SendSimpleMessage($startPlanet['id_owner'], '', $fleetRow['fleet_start_time'], 5, $lang['sys_mess_tower'], $lang['sys_mess_transport'], $message); $message = sprintf($lang['sys_tran_mess_user'], $startPlanet['name'], $fleetStartLink, $endPlanet['name'], $fleetEndLink, $fleetRow['fleet_resource_metal'], $lang['Metal'], $fleetRow['fleet_resource_crystal'], $lang['Crystal'], $fleetRow['fleet_resource_deuterium'], $lang['Deuterium']); SendSimpleMessage($endPlanet['id_owner'], '', $fleetRow['fleet_start_time'], 5, $lang['sys_mess_tower'], $lang['sys_mess_transport'], $message); } } } else { if ($fleetRow['fleet_end_time'] <= time()) { $message = sprintf($lang['sys_tran_mess_back'], $startPlanet['name'], $fleetStartLink); SendSimpleMessage($startPlanet['id_owner'], '', $fleetRow['fleet_end_time'], 5, $lang['sys_mess_tower'], $lang['sys_mess_fleetback'], $message); RestoreFleetToPlanet($fleetRow, true); $readConnection->delete($readConnection->getDeprecatedTable('fleets'), array('fleet_id =?' => $fleetRow['fleet_id'])); } } return true; }
function DisplayGameSettingsPage() { global $lang, $game_config; includeLang('admin/settings'); if ($_POST) { $game_config_keys = array_keys($game_config); $game_config_old = $game_config; foreach ($_POST as $key => $value) { if (in_array($key, $game_config_keys)) { $key = mysql_real_escape_string($key); $value = mysql_real_escape_string($value); $game_config[$key] = $value == 'on' ? '1' : $value; } } $checkboxArray = array('game_disable', 'OverviewNewsFrame', 'OverviewExternChat', 'OverviewBanner', 'debug'); foreach ($checkboxArray as $checkbox) { if (is_null($_POST[$checkbox])) { $game_config[$checkbox] = '0'; } } $game_config_newValues = array_diff_assoc($game_config, $game_config_old); $readConnection = Nova::getSingleton('core/database_connection_pool')->getConnection('core_read'); foreach ($game_config_newValues as $key => $value) { $readConnection->update($readConnection->getDeprecatedTable('config'), array('config_value' => $value), array('config_name =?' => $key)); } AdminMessage($lang['GameSettings_SettingsChanged'], $lang['GameSettings_Success']); } else { $parse = $lang; foreach ($game_config as $key => $value) { $parse[$key] = $value; } $parse['closed'] = $game_config['game_disable'] == 1 ? " checked = 'checked' " : ""; $parse['newsframe'] = $game_config['OverviewNewsFrame'] == 1 ? " checked = 'checked' " : ""; $parse['chatframe'] = $game_config['OverviewExternChat'] == 1 ? " checked = 'checked' " : ""; $parse['googlead'] = $game_config['OverviewBanner'] == 1 ? " checked = 'checked' " : ""; $parse['debug'] = $game_config['debug'] == 1 ? " checked = 'checked' " : ""; $parse['bannerframe'] = $game_config['ForumBannerFrame'] == 1 ? " checked = 'checked' " : ""; $PageTPL = gettemplate('admin/options_body'); $Page = parsetemplate($PageTPL, $parse); display($Page, $lang['GameSettings_Title'], false, '', true); } return $Page; }
public function login($identity, $credential, $salt) { // TODO: dispatch event 'user.login.before' if ($this->isLoaded()) { return false; } $adapter = Nova::getModel('user/entity.authentication.adapter.password-stealth')->setIdentity($identity)->setCredential($credential)->setSalt($salt); $storage = Nova::getSingleton('user/session')->setUserModel($this); $result = Zend_Auth::getInstance()->setStorage($storage)->authenticate($adapter); var_dump($result); // TODO: dispatch event 'user.login.after' switch ($result->getCode()) { case Zend_Auth_Result::SUCCESS: // TODO: dispatch event 'user.login.success' $this->load($result->getIdentity(), 'username'); return true; case Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID: // TODO: I18n Nova::getSingleton('user/session')->addNotice('Wrong password.'); break; case Zend_Auth_Result::FAILURE_IDENTITY_AMBIGUOUS: case Zend_Auth_Result::FAILURE_IDENTITY_NOT_FOUND: // TODO: I18n Nova::getSingleton('user/session')->addNotice('User does not exist.'); break; case Zend_Auth_Result::FAILURE_UNCATEGORIZED: default: // TODO: I18n Nova::getSingleton('user/session')->addError('Could not connect, an error occured. Please contact admin.'); break; } foreach ($result->getMessages() as $message) { Nova::getSingleton('user/session')->addNotice($message); } // TODO: dispatch event 'user.login.failure' return false; }
require 'Zend/Loader/Autoloader.php'; $loader = Zend_Loader_Autoloader::getInstance(); $loader->registerNamespace('Legacies_'); /** * @deprecated * @todo */ //{{{ define('PHPEXT', include ROOT_PATH . 'extension.inc'); define('DEFAULT_SKINPATH', '../skins/xnova/'); define('TEMPLATE_DIR', realpath(ROOT_PATH . '/templates/')); define('TEMPLATE_NAME', 'OpenGame'); define('DEFAULT_LANG', 'fr_FR'); $dpath = DEFAULT_SKINPATH; //}}} $debug = Nova::getSingleton('core/debug'); /** * @deprecated */ // {{{ include ROOT_PATH . 'includes/constants.' . PHPEXT; include ROOT_PATH . 'includes/functions.' . PHPEXT; include ROOT_PATH . 'includes/unlocalised.' . PHPEXT; include ROOT_PATH . 'includes/todofleetcontrol.' . PHPEXT; include ROOT_PATH . 'language/' . DEFAULT_LANG . '/lang_info.cfg'; include ROOT_PATH . 'includes/vars.' . PHPEXT; include ROOT_PATH . 'includes/db.' . PHPEXT; include ROOT_PATH . 'includes/strings.' . PHPEXT; include ROOT_PATH . 'includes/databaseinfos.php'; include ROOT_PATH . 'includes/migrateinfo.php'; // }}}
/** * Create a new planet and insert it on the database * * @param int|string $galaxy * @param int|string $system * @param int|string $position * @param int|string $planetOwnerId * @param string $planetName * @param bool $homeWorld * * @return bool */ function CreateOnePlanetRecord($galaxy, $system, $position, $planetOwnerId, $planetName = '', $homeWorld = false) { global $lang, $game_config; /** * @var resource Get database link */ $readConnection = Nova::getSingleton('core/database_connection_pool')->getConnection('core_read'); $planetExist = $readConnection->select()->from($readConnection->getDeprecatedTable('planets'))->where('galaxy =?', $galaxy)->where('system =?', $system)->where('planet =?', $position)->query()->fetch(); if (!$planetExist) { $planet = PlanetSizeRandomiser($position, $homeWorld); $planet['metal'] = BUILD_METAL; $planet['crystal'] = BUILD_CRISTAL; $planet['deuterium'] = BUILD_DEUTERIUM; $planet['metal_perhour'] = $game_config['metal_basic_income']; $planet['crystal_perhour'] = $game_config['crystal_basic_income']; $planet['deuterium_perhour'] = $game_config['deuterium_basic_income']; $planet['metal_max'] = BASE_STORAGE_SIZE; $planet['crystal_max'] = BASE_STORAGE_SIZE; $planet['deuterium_max'] = BASE_STORAGE_SIZE; $planet['galaxy'] = $galaxy; $planet['system'] = $system; $planet['planet'] = $position; if ($position == 1 || $position == 2 || $position == 3) { $planetType = 'trocken'; $planetDesign = array('01', '02', '03', '04', '05', '06', '07', '08', '09', '10'); $planet['temp_min'] = rand(0, 100); $planet['temp_max'] = $planet['temp_min'] + 40; } elseif ($position == 4 || $position == 5 || $position == 6) { $planetType = 'dschjungel'; $planetDesign = array('01', '02', '03', '04', '05', '06', '07', '08', '09', '10'); $planet['temp_min'] = rand(-25, 75); $planet['temp_max'] = $planet['temp_min'] + 40; } elseif ($position == 7 || $position == 8 || $position == 9) { $planetType = 'normaltemp'; $planetDesign = array('01', '02', '03', '04', '05', '06', '07'); $planet['temp_min'] = rand(-50, 50); $planet['temp_max'] = $planet['temp_min'] + 40; } elseif ($position == 10 || $position == 11 || $position == 12) { $planetType = 'wasser'; $planetDesign = array('01', '02', '03', '04', '05', '06', '07', '08', '09'); $planet['temp_min'] = rand(-75, 25); $planet['temp_max'] = $planet['temp_min'] + 40; } elseif ($position == 13 || $position == 14 || $position == 15) { $planetType = 'eis'; $planetDesign = array('01', '02', '03', '04', '05', '06', '07', '08', '09', '10'); $planet['temp_min'] = rand(-100, 10); $planet['temp_max'] = $planet['temp_min'] + 40; } else { $planetType = 'wuesten'; $planetDesign = array('01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '00'); $planet['temp_min'] = rand(-120, 10); $planet['temp_max'] = $planet['temp_min'] + 40; } $planet['image'] = $planetType . 'planet' . $planetDesign[rand(0, count($planetDesign) - 1)]; $planet['planet_type'] = 1; $planet['id_owner'] = $planetOwnerId; $planet['last_update'] = new Zend_Db_Expr('UNIX_TIMESTAMP()'); $planet['name'] = $planetName == '' ? $lang['sys_colo_defaultname'] : $planetName; $readConnection->insert($readConnection->getDeprecatedTable('planets'), $planet); $planetId = $readConnection->lastInsertId($readConnection->getDeprecatedTable('planets')); $galaxyPosition = $readConnection->select()->from($readConnection->getDeprecatedTable('galaxy'), array('id' => 'id_planet'))->where('galaxy=?', $galaxy)->where('system=?', $system)->where('planet=?', $position)->query()->fetch(); if ($galaxyPosition) { $readConnection->update($readConnection->getDeprecatedTable('galaxy'), array('id_planet' => $planetId), array('id_planet =?', $galaxyPosition['id'])); } else { $data = array('galaxy' => $planet['galaxy'], 'system' => $planet['system'], 'planet' => $planet['planet'], 'id_planet' => $planetId); $readConnection->insert($readConnection->getDeprecatedTable('galaxy'), $data); } return $planetId; } else { return false; } }
if ($login['banaday'] <= time() & $login['banaday'] != '0') { doquery("UPDATE {{table}} SET `banaday` = '0', `bana` = '0', `urlaubs_modus` ='0' WHERE `username` = '{$login['username']}' LIMIT 1", 'users'); doquery("DELETE FROM {{table}} WHERE `who` = '{$login['username']}'", 'banned'); } if ($login) { if (intval($login['login_success'])) { if (isset($_POST["rememberme"])) { setCookie('nova-cookie', serialize(array('id' => $login['id'], 'key' => $login['login_rememberme'])), time() + 2592000); } $sql = <<<EOF UPDATE {{table}} AS users SET users.onlinetime=UNIX_TIMESTAMP() WHERE users.id={$login['id']} EOF; doquery($sql, 'users'); Nova::getSingleton('user/session')->setUserId($login['id']); $_SESSION['user_id'] = $login['id']; header("Location: frames.php"); exit(0); } else { message($lang['Login_FailPassword'], $lang['Login_Error']); } } else { message($lang['Login_FailUser'], $lang['Login_Error']); } } else { $parse = $lang; $Count = doquery('SELECT COUNT(DISTINCT users.id) AS `players` FROM {{table}} AS users WHERE users.authlevel < 3', 'users', true); $LastPlayer = doquery('SELECT users.`username` FROM {{table}} AS users ORDER BY `register_time` DESC LIMIT 1', 'users', true); $parse['last_user'] = $LastPlayer['username']; $PlayersOnline = doquery("SELECT COUNT(DISTINCT id) AS `onlinenow` FROM {{table}} AS users WHERE `onlinetime` > (UNIX_TIMESTAMP()-900) AND users.authlevel < 3", 'users', true);
$lang = array(); $IsUserChecked = false; define('DEFAULT_SKINPATH', 'skins/xnova/'); define('TEMPLATE_DIR', realpath(ROOT_PATH . '/templates/')); define('TEMPLATE_NAME', 'OpenGame'); define('DEFAULT_LANG', 'fr_FR'); $debug = Nova::getSingleton('core/debug'); include ROOT_PATH . 'includes/constants.php'; include ROOT_PATH . 'includes/functions.php'; include ROOT_PATH . 'includes/unlocalised.php'; include ROOT_PATH . 'includes/todofleetcontrol.php'; include ROOT_PATH . 'language/' . DEFAULT_LANG . '/lang_info.cfg'; include ROOT_PATH . 'includes/vars.php'; include ROOT_PATH . 'db/mysql.php'; include ROOT_PATH . 'includes/strings.php'; $readConnection = Nova::getSingleton('core/database_connection_pool')->getConnection('core_read'); if (!defined('DISABLE_IDENTITY_CHECK')) { //$Result = CheckTheUser($IsUserChecked); //$IsUserChecked = $Result['state']; //$user = $Result['record']; if ($game_config['game_disable'] && $user->getAuthlevel() < 2) { message(stripslashes($game_config['close_reason']), $game_config['game_name']); } } includeLang('system'); includeLang('tech'); if (!$user->getId() && !defined('DISABLE_IDENTITY_CHECK')) { header('HTTP/1.1 401 Unauthorized'); header('Location: login.php'); exit(0); }