本文整理匯總了PHP中Core::getConfig方法的典型用法代碼示例。如果您正苦於以下問題:PHP Core::getConfig方法的具體用法?PHP Core::getConfig怎麽用?PHP Core::getConfig使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Core
的用法示例。
在下文中一共展示了Core::getConfig方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: execute
function execute()
{
$connections = Core::getConfig('db');
$result = array();
foreach ($connections as $connect) {
$result[] = $connect;
}
$this->smarty->assign('connections', $result);
}
示例2: execute
function execute()
{
$domain = Core::getConfig('domain');
$domain_list = array();
foreach ($domain as $value) {
// $domain_list[] = array('name' => $value, 'status' => file_get_contents('http://'.$value.'/administrator/test_domain/') == 'ok' ? 1 : 0);
$domain_list[] = array('name' => $value);
}
$this->smarty->assign('domain_list', $domain_list);
$this->smarty->assign('route', Core::getConfigRoute());
}
示例3: indexAction
/**
* Shows the pillory.
*
* @return Bengine_Comm_Controller_Pillory
*/
public function indexAction()
{
Core::getTPL()->clearHTMLHeaderFiles();
Core::getTPL()->addHTMLHeaderFile("game.css", "css");
Core::getTPL()->addHTMLHeaderFile("lib/jquery.js", "js");
$result = Core::getQuery()->select("ban_u", array("banid"));
$pagination = new Pagination(Core::getConfig()->get("PILLORY_ITEMS_PER_PAGE"), $result->rowCount());
$pagination->setConfig("page_url", Core::getLang()->getOpt("langcode") . "/pillory/index/%d")->setConfig("main_element_class", "pagination center-table")->setMaxPagesToShow(Core::getConfig()->get("MAX_PILLORY_PAGES"))->setCurrentPage($this->getParam("1"))->setConfig("base_url", Core::getLang()->getOpt("langcode") . "/pillory");
Core::getTPL()->addLoop("bans", $this->getBans($pagination->getStart(), Core::getConfig()->get("PILLORY_ITEMS_PER_PAGE")));
$this->assign("pagination", $pagination);
return $this;
}
示例4: _execute
/**
* Executes all events that are queued, but max 1000 events.
*
* @return Bengine_Game_Cronjob_EventExecution
*/
protected function _execute()
{
require_once "Bengine/Game.php";
$raceConditionKey = Str::substring(md5(microtime(true)), 0, 16);
/* @var Bengine_Game_Model_Collection_Event $collection */
$collection = Application::getModel("game/event")->getCollection();
$collection->addRaceConditionFilter($raceConditionKey, Core::getConfig()->get("CRONJOB_MAX_EVENT_EXECUTION"));
$collection->executeAll();
if ($collection->count() > 0) {
Core::getQuery()->delete("events", "prev_rc = ?", null, null, array($raceConditionKey));
}
return $this;
}
示例5: indexAction
/**
* Index action.
*
* @return Bengine_Game_Controller_Resource
*/
protected function indexAction()
{
Hook::event("ShowResourcesBefore", array($this));
Core::getTPL()->addLoop("data", $this->data);
$productFactor = (double) Core::getConfig()->get("PRODUCTION_FACTOR");
$isMoon = (bool) Game::getPlanet()->getData("ismoon");
// Basic prod
$basicMetal = $isMoon ? 0 : Core::getOptions()->get("METAL_BASIC_PROD");
Core::getTPL()->assign("basicMetal", fNumber($basicMetal * $productFactor));
$basicSilicon = $isMoon ? 0 : Core::getOptions()->get("SILICON_BASIC_PROD");
Core::getTPL()->assign("basicSilicon", fNumber($basicSilicon * $productFactor));
$basicHydrogen = $isMoon ? 0 : Core::getOptions()->get("HYDROGEN_BASIC_PROD");
Core::getTPL()->assign("basicHydrogen", fNumber($basicHydrogen * $productFactor));
Core::getTPL()->assign("sats", Game::getPlanet()->getBuilding(Bengine_Game_Planet::SOLAR_SAT_ID));
if (Game::getPlanet()->getBuilding(Bengine_Game_Planet::SOLAR_SAT_ID) > 0) {
Core::getTPL()->assign("satsNum", fNumber(Game::getPlanet()->getBuilding(Bengine_Game_Planet::SOLAR_SAT_ID)));
$solarSatProduction = Game::getPlanet()->getBuildingProd("energy", Bengine_Game_Planet::SOLAR_SAT_ID);
Core::getTPL()->assign("satsProd", fNumber($solarSatProduction));
Core::getLang()->assign("prodPerSat", floor($solarSatProduction / Game::getPlanet()->getBuilding(Bengine_Game_Planet::SOLAR_SAT_ID)));
Core::getTPL()->assign("solar_satellite_prod", Game::getPlanet()->getData("solar_satellite_prod"));
}
// Storage capacity
Core::getTPL()->assign("storageMetal", fNumber(Game::getPlanet()->getStorage("metal") / 1000) . "k");
Core::getTPL()->assign("storageSilicon", fNumber(Game::getPlanet()->getStorage("silicon") / 1000) . "k");
Core::getTPL()->assign("sotrageHydrogen", fNumber(Game::getPlanet()->getStorage("hydrogen") / 1000) . "k");
// Total prod
Core::getTPL()->assign("totalMetal", fNumber(Game::getPlanet()->getProd("metal")));
Core::getTPL()->assign("totalSilicon", fNumber(Game::getPlanet()->getProd("silicon")));
Core::getTPL()->assign("totalHydrogen", fNumber(Game::getPlanet()->getProd("hydrogen")));
Core::getTPL()->assign("totalEnergy", fNumber(Game::getPlanet()->getEnergy()));
// Daily prod
Core::getTPL()->assign("dailyMetal", fNumber(Game::getPlanet()->getProd("metal") * 24));
Core::getTPL()->assign("dailySilicon", fNumber(Game::getPlanet()->getProd("silicon") * 24));
Core::getTPL()->assign("dailyHydrogen", fNumber(Game::getPlanet()->getProd("hydrogen") * 24));
// Weekly prod
Core::getTPL()->assign("weeklyMetal", fNumber(Game::getPlanet()->getProd("metal") * 168));
Core::getTPL()->assign("weeklySilicon", fNumber(Game::getPlanet()->getProd("silicon") * 168));
Core::getTPL()->assign("weeklyHydrogen", fNumber(Game::getPlanet()->getProd("hydrogen") * 168));
// Monthly prod
Core::getTPL()->assign("monthlyMetal", fNumber(Game::getPlanet()->getProd("metal") * 720));
Core::getTPL()->assign("monthlySilicon", fNumber(Game::getPlanet()->getProd("silicon") * 720));
Core::getTPL()->assign("monthlyHydrogen", fNumber(Game::getPlanet()->getProd("hydrogen") * 720));
$selectBox = "";
for ($i = 10; $i >= 0; $i--) {
$selectBox .= createOption($i * 10, $i * 10, 0);
}
Core::getTPL()->assign("selectProd", $selectBox);
Hook::event("ShowResourcesAfter");
$this->assign("updateAction", BASE_URL . "game/" . SID . "/Resource/Update");
return $this;
}
示例6: indexAction
/**
* Perfom log out proccess.
*
* @return Bengine_Game_Controller_Logout
*/
protected function indexAction()
{
Hook::event("DoLogout");
Core::getCache()->cleanUserCache(Core::getUser()->get("userid"));
Core::getQuery()->update("sessions", array("logged" => 0), "userid = ?", array(Core::getUser()->get("userid")));
if (Core::getConfig()->exists("SESSION_SAVING_DAYS")) {
$days = (int) Core::getConfig()->get("SESSION_SAVING_DAYS");
} else {
$days = self::SESSION_SAVING_DAYS;
}
$deleteTime = TIME - 86400 * $days;
Core::getQuery()->delete("sessions", "time < ?", null, null, array($deleteTime));
Game::unlock();
$this->redirect(BASE_URL);
return $this;
}
示例7: onFrontHtmlEnd
/**
* Show Google Analytics code.
*
* @return string
*/
public function onFrontHtmlEnd()
{
if (Core::getConfig()->get("GOOGLE_ANALYTICS_ACCOUNT")) {
return '<script type="text/javascript">
//<![CDATA[
var gaJsHost=(("https:"==document.location.protocol)?"https://ssl.":"http://www.");document.write(unescape("%3Cscript src=\'"+gaJsHost+"google-analytics.com/ga.js\' type=\'text/javascript\'%3E%3C/script%3E"));
//]]>
</script>
<script type="text/javascript">
//<![CDATA[
try{var pageTracker=_gat._getTracker("' . Core::getConfig()->get("GOOGLE_ANALYTICS_ACCOUNT") . '");pageTracker._trackPageview();}catch(err){}
//]]>
</script>';
}
return null;
}
示例8: sendReminders
/**
* Sends the reminder mails.
*
* @return Bengine_Game_Cronjob_Reminder
*/
protected function sendReminders()
{
$time = TIME - Core::getConfig()->get("REMINDER_MAIL_TIME") * 86400;
$select = new Recipe_Database_Select();
$select->from("user")->attributes(array("username", "email", "last"))->where("last < ?", $time);
$result = $select->getStatement();
Core::getLang()->load(array("Registration"));
foreach ($result->fetchAll() as $row) {
Core::getLang()->assign("username", $row["username"]);
Core::getLang()->assign("reminderLast", Date::timeToString(2, $row["last"]));
$template = new Recipe_Email_Template("reminder");
$mail = new Email(array($row["email"] => $row["username"]), Core::getLang()->get("REMINDER_MAIL_SUBJECT"));
$template->send($mail);
}
return $this;
}
示例9: getFiles
static function getFiles()
{
$files = File::readDirFiles(TEMP_DIR);
$config = Core::getConfig('temp');
$info = array();
foreach ($files as $name => $dir) {
$file = new File(TEMP_DIR . DS . $name);
$file_info = array();
$file_info['name'] = str_replace('.' . $file->extension, '', $file->name);
$file_info['size'] = $file->size;
$file_info['create'] = $file->create_date;
$file_info['info'] = array_key_exists($file_info['name'], $config) ? $config[$file_info['name']] : '[`Title file cache no information`]';
$info[] = $file_info;
}
return $info;
}
示例10: run
/**
* Starts the application.
*
* @return void
*/
public function run()
{
Hook::event("PreRun");
self::loadMeta();
Core::getTPL()->assign("charset", CHARACTER_SET);
Core::getTPL()->assign("langcode", Core::getLang()->getOpt("langcode"));
Core::getTPL()->assign("formaction", Core::getRequest()->getRequestedUrl());
$pageTitle = array();
if ($titlePrefix = Core::getConfig()->get("TITLE_PREFIX")) {
$pageTitle[] = $titlePrefix;
}
$pageTitle[] = Core::getConfig()->get("pagetitle");
if ($titleSuffix = Core::getConfig()->get("TITLE_SUFFIX")) {
$pageTitle[] = $titleSuffix;
}
Core::getTPL()->assign("pageTitle", implode(Core::getConfig()->get("TITLE_GLUE"), $pageTitle));
Hook::event("PostRun");
return;
}
示例11: removeInactiveUsers
/**
* Removes inactive users.
*
* @return Bengine_Game_Cronjob_RemoveInactiveUser
*/
protected function removeInactiveUsers()
{
$deleteTime = TIME - Core::getConfig()->get("USER_DELETE_TIME") * 86400;
$where = Core::getDB()->quoteInto("(u.last < ? OR (u.`delete` < '" . TIME . "' AND u.`delete` > '0')) AND ((u2g.usergroupid != '2' AND u2g.usergroupid != '4') OR u2g.usergroupid IS NULL)", $deleteTime);
$result = Core::getQuery()->select("user u", "u.userid", "LEFT JOIN " . PREFIX . "user2group u2g ON (u2g.userid = u.userid)", $where);
foreach ($result->fetchAll() as $row) {
$userid = $row["userid"];
$_result = Core::getQuery()->select("planet", array("planetid", "ismoon"), "", Core::getDB()->quoteInto("userid = ?", $userid));
foreach ($_result->fetchAll() as $_row) {
if (!$_row["ismoon"]) {
deletePlanet($_row["planetid"], $userid, false);
}
}
$_result->closeCursor();
$_result = Core::getQuery()->select("alliance", "aid", "", Core::getDB()->quoteInto("founder = ?", $userid));
if ($_row = $_result->fetchRow()) {
deleteAlliance($_row["aid"]);
}
$_result->closeCursor();
Core::getQuery()->delete("user", "userid = ?", null, null, array($userid));
}
$result->closeCursor();
return $this;
}
示例12: indexAction
/**
* Index action.
*
* @return Bengine_Game_Controller_Index
*/
protected function indexAction()
{
Core::getTPL()->addHTMLHeaderFile("lib/jquery.countdown.js", "js");
Core::getTPL()->addHTMLHeaderFile("lib/jquery.news.js", "js");
$this->buildingEvent = Game::getEH()->getCurPlanetBuildingEvent();
// Messages
$result = Core::getQuery()->select("message", "msgid", "", Core::getDB()->quoteInto("`receiver` = ? AND `read` = '0'", Core::getUser()->get("userid")));
$msgs = $result->rowCount();
$result->closeCursor();
Core::getTPL()->assign("unreadmsg", $msgs);
if ($msgs == 1) {
Core::getTPL()->assign("newMessages", Link::get("game/" . SID . "/MSG", Core::getLanguage()->getItem("F_NEW_MESSAGE")));
} else {
if ($msgs > 1) {
Core::getTPL()->assign("newMessages", Link::get("game/" . SID . "/MSG", sprintf(Core::getLanguage()->getItem("F_NEW_MESSAGES"), $msgs)));
}
}
// Fleet events
$fleetEvent = Game::getEH()->getFleetEvents();
$fe = array();
if ($fleetEvent) {
foreach ($fleetEvent as $f) {
$fe[$f["eventid"]] = $this->parseEvent($f);
if (!is_array($fe[$f["eventid"]])) {
unset($fe[$f["eventid"]]);
}
}
Hook::event("MainFleetEventsOutput", array(&$fe));
}
Core::getTPL()->addLoop("fleetEvents", $fe);
Core::getTPL()->assign("serverTime", Date::timeToString(1, TIME, "", false));
Core::getTPL()->assign("buildingEvent", $this->buildingEvent);
Core::getTPL()->assign("occupiedFields", Game::getPlanet()->getFields(true));
Core::getTPL()->assign("planetImage", Image::getImage("planets/" . Game::getPlanet()->getData("picture") . Core::getConfig()->get("PLANET_IMG_EXT"), Game::getPlanet()->getData("planetname"), "200px", "200px"));
Core::getTPL()->assign("freeFields", Game::getPlanet()->getMaxFields());
Core::getTPL()->assign("planetDiameter", fNumber(Game::getPlanet()->getData("diameter")));
Core::getTPL()->assign("planetNameLink", Link::get("game/" . SID . "/Index/PlanetOptions", Game::getPlanet()->getData("planetname")));
Core::getTPL()->assign("planetPosition", Game::getPlanet()->getCoords());
Core::getTPL()->assign("planetTemp", Game::getPlanet()->getData("temperature"));
Core::getTPL()->assign("points", Link::get("game/" . SID . "/Ranking", fNumber(floor(Core::getUser()->get("points")))));
// Points
$result = Core::getQuery()->select("user", "userid");
Core::getLang()->assign("totalUsers", fNumber($result->rowCount()));
$result->closeCursor();
$where = Core::getDB()->quoteInto("(`username` < ? AND `points` >= {points}) OR `points` > {points}", array(Core::getUser()->get("username")));
$where = str_replace("{points}", (double) Core::getUser()->get("points"), $where);
$result = Core::getQuery()->select("user", array("COUNT(`userid`)+1 AS rank"), "", $where, "", 1);
Core::getLang()->assign("rank", fNumber($result->fetchColumn()));
$result->closeCursor();
if (Game::getPlanet()->getData("moonid") > 0) {
if (Game::getPlanet()->getData("ismoon")) {
// Planet has moon
$where = Core::getDB()->quoteInto("g.galaxy = ? AND g.system = ? AND g.position = ?", array(Game::getPlanet()->getData("moongala"), Game::getPlanet()->getData("moonsys"), Game::getPlanet()->getData("moonpos")));
$result = Core::getQuery()->select("galaxy g", array("p.planetid", "p.planetname", "p.picture"), "LEFT JOIN " . PREFIX . "planet p ON (p.planetid = g.planetid)", $where);
} else {
// Planet of current moon
$where = Core::getDB()->quoteInto("g.galaxy = ? AND g.system = ? AND g.position = ?", array(Game::getPlanet()->getData("galaxy"), Game::getPlanet()->getData("system"), Game::getPlanet()->getData("position")));
$result = Core::getQuery()->select("galaxy g", array("p.planetid", "p.planetname", "p.picture"), "LEFT JOIN " . PREFIX . "planet p ON (p.planetid = g.moonid)", $where);
}
$row = $result->fetchRow();
$result->closeCursor();
Core::getTPL()->assign("moon", $row["planetname"]);
$img = Image::getImage("planets/" . $row["picture"] . Core::getConfig()->get("PLANET_IMG_EXT"), $row["planetname"], 50, 50);
Core::getTPL()->assign("moonImage", "<a title=\"" . $row["planetname"] . "\" class=\"goto pointer\" href=\"" . $row["planetid"] . "\">" . $img . "</a>");
} else {
Core::getTPL()->assign("moon", "");
Core::getTPL()->assign("moonImage", "");
}
// Current events
$research = Game::getEH()->getResearchEvent();
Core::getTPL()->assign("research", $research);
$shipyardMissions = Game::getEH()->getShipyardEvents();
Core::getTemplate()->assign("shipyardMissions", $shipyardMissions);
/* @var Bengine_Game_Model_Collection_News $news */
$news = Game::getCollection("game/news");
$news->addSortIndexOrder()->addEnabledFilter()->addLanguageFilter();
Core::getTPL()->addLoop("news", $news);
Hook::event("GameIndexAction");
return $this;
}
示例13: setDefaultLanguage
/**
* Sets the default language.
*
* @param mixed $langId Language code or id
*
* @return Recipe_Language_Importer
*/
public function setDefaultLanguage($langId)
{
if (!is_numeric($langId)) {
$result = Core::getQuery()->select("languages", array("languageid"), "", Core::getDB()->quoteInto("langcode = ?", $langId), "", "1");
if ($row = $result->fetchRow()) {
$langId = $row["languageid"];
}
}
if (is_numeric($langId)) {
Core::getConfig()->set("defaultlanguage", $langId);
}
return $this;
}
示例14: setGuestGroupId
/**
* Sets the guest group id.
*
* @param integer $guestGroupId Guest group id [optional]
*
* @return Recipe_User
*/
public function setGuestGroupId($guestGroupId = null)
{
if (is_null($guestGroupId)) {
$guestGroupId = Core::getConfig()->guestgroupid;
}
$this->guestGroupId = $guestGroupId;
return $this;
}
示例15: set_error_handler
global $config;
$classFile = $config["dirIntRoot"] . "assets/classes/{$class}.class.php";
if (file_exists($classFile)) {
include $classFile;
}
});
/*
set_error_handler(function($code, $text, $file, $row) {
echo "Code: " . $code;
echo "Text: " . $text;
echo "File: " . $file;
echo "Row: " . $row;
debug_print_backtrace();
});*/
if (!is_dir(Core::getConfig("tempDir"))) {
mkdir(Core::getConfig("tempDir"));
}
include $config["dirIntRoot"] . "assets/frameworks/smarty-3.1.27/Smarty.class.php";
$smarty = new Smarty();
Core::initSmarty($smarty);
PageManager::assignSmarty($smarty);
UserManager::initialize();
// Breadcrumbs
$baseDir = Core::GetConfig("dirRoot");
if (isset($_SERVER['REQUEST_URI'])) {
$uri = str_replace($baseDir, "", $_SERVER['REQUEST_URI']);
if (strpos($uri, "?") !== false) {
$uri = explode("?", $uri);
$uri = $uri[0];
}
$bc = explode("/", $uri);