/** * Preps the application for running, then runs it. If this function is called more than once, an E_USER_ERROR is triggered. * * @param string $root_dir The path to the root of the installation. * @return void */ function StartCurator() { static $did_start = false; // set up the exit status. $exit_status = 0; // make sure this is only run once. if ($did_start === false) { $autoload = Autoload::singleton(); // configure the autoloader. try { $autoload->setBaseDir(CURATOR_APP_DIR); $autoload->register(); } catch (\Exception $e) { Console::stderr('** Could not register the autoloader:'); Console::stderr(' ' . $e->getMessage()); die; } // once the autoloader is in place, we are started up. $did_start = true; try { $app = new Application(); $exit_status = $app->run(); } catch (\Exception $e) { Console::stderr('** Could not run the application:'); Console::stderr(' ' . $e->getMessage()); die; } } else { // if we are called again, bail. trigger_error('StartCurator called after already being called.', E_USER_ERROR); } // send the status back. return $exit_status; }
/** * Starts Bengine. * * @return Game */ public function run() { parent::run(); // Update last activity Core::getQuery()->update("user", array("last" => TIME, "db_lock" => TIME), "userid = ?", array(Core::getUser()->userid)); if ($planetid = Core::getRequest()->getPOST("planetid")) { Core::getUser()->set("curplanet", $planetid); } Hook::event("GameStart"); self::loadResearch(); self::setPlanet(); self::setEventHandler(); self::getEH()->init(); self::getPlanet()->getProduction()->addProd(); self::globalTPLAssigns(); // Asteroid event (Once per week). $first = mt_rand(0, 100); $second = mt_rand(0, 100); if ($first == 42 && $second == 49 && Core::getUser()->get("asteroid") < TIME - 604800) { $data["metal"] = mt_rand(1, Core::getOptions()->get("MAX_ASTEROID_SIZE")) * 1000; $data["silicon"] = mt_rand(1, $data["metal"] / 1000) * 1000; $data["galaxy"] = self::getPlanet()->getData("galaxy"); $data["system"] = self::getPlanet()->getData("system"); $data["position"] = self::getPlanet()->getData("position"); $data["planet"] = self::getPlanet()->getData("planetname"); Hook::event("GameAsteroidEvent", array(&$data)); Core::getQuery()->update("user", array("asteroid" => TIME), "userid = ?", array(Core::getUser()->get("userid"))); $what = self::getPlanet()->getData("ismoon") ? "moonid" : "planetid"; Core::getDB()->query("UPDATE " . PREFIX . "galaxy SET metal = metal + ?, silicon = silicon + ? WHERE " . $what . " = ?", array($data["metal"], $data["silicon"], self::getPlanet()->getPlanetId())); new Bengine_Game_AutoMsg(22, Core::getUser()->get("userid"), TIME, $data); Core::getUser()->rebuild(); } $this->dispatch(); return $this; }
public function __construct($message, $code) { Log::add($message . 'URI: ' . $_SERVER['REQUEST_URI'], $code); if (!DEV) { switch ($code) { case 500: Fw_Request::setGet('hard_controller', 'err'); Fw_Request::setGet('hard_action', 'error' . $code); $error_app = new Application(); $error_app->run(); die; break; case 404: default: Fw_Request::setGet('hard_controller', 'err'); Fw_Request::setGet('hard_action', 'error' . $code); $error_app = new Application(); $error_app->run(); die; break; } } $code = 0; parent::__construct($message); }
/** * Runs the community application. * * @return Comm */ public function run() { parent::run(); Hook::event("CommStart"); define("LANG", Core::getLang()->getOpt("langcode") . "/"); Core::getLang()->load("Registration"); self::setCMS(); self::initUniverses(); self::initLanguage(); Core::getTPL()->addHTMLHeaderFile("lib/jquery.js", "js"); Core::getTPL()->addHTMLHeaderFile("lib/bootstrap.js", "js"); Core::getTPL()->addHTMLHeaderFile("main.js", "js"); Core::getTPL()->addHTMLHeaderFile("sign.js", "js"); Core::getTPL()->addHTMLHeaderFile("style.css", "css"); Core::getTPL()->assign("containerClass", "content"); Core::getTPL()->addLoop("headerMenu", self::getCMS()->getMenu("h")); $userCheck = sprintf(Core::getLanguage()->getItem("USER_CHECK"), Core::getOptions()->get("MIN_USER_CHARS"), Core::getOptions()->get("MAX_USER_CHARS")); $passwordCheck = sprintf(Core::getLanguage()->getItem("PASSWORD_CHECK"), Core::getOptions()->get("MIN_PASSWORD_LENGTH"), Core::getOptions()->get("MAX_PASSWORD_LENGTH")); Core::getTPL()->assign("userCheck", $userCheck); Core::getTPL()->assign("passwordCheck", $passwordCheck); Core::getTPL()->assign("uniSelection", self::getUnisAsOptionList()); Hook::event("CommTemplateAssign"); $this->dispatch(); Hook::event("CommEnd"); return $this; }
/** * Begins execution of the plugin. * * Since everything within the plugin is registered via hooks, * then kicking off the plugin from this point in the file does * not affect the page life cycle. * * @since 1.0.0 */ function run() { /** * The core plugin class that is used to define internationalization, * admin-specific hooks, and public-facing site hooks. */ $plugin = new Application(); $plugin->run(); }
public static function run() { header('Content-type: text/html; charset=utf-8'); defined('DEBUG') || define('DEBUG', false); self::setConst(); self::createAppDir(); self::importFile(); Application::run(); }
function run() { try { Application::run(); } catch (TaintException $exc) { $this->handleTaint($exc); } catch (AccessDeniedException $exc) { $this->handleAccessDenied($exc); } }
/** * Runs the community application. * * @return void */ public function run() { parent::run(); Core::getUser()->removeTheme(); Core::getTPL()->addHTMLHeaderFile("admin.css", "css"); Core::getLang()->load(array("AI_Global")); $menu = new Bengine_Admin_Menu(); Core::getTPL()->addLoop("menu", $menu->getMenu()); $this->dispatch(); return; }
public static function run() { //定义常用的常量 self::setConst(); //加载核心文件 self::loadFile(); //创建应用目录 self::createDir(); //运行项目 Application::run(); }
public function testRun() { $settings = $this->prophesize('asylgrp\\workbench\\Settings')->reveal(); $dependencies = $this->prophesize('asylgrp\\workbench\\DI\\Container'); $dependencies->middlewares()->willReturn([function ($request, $response) { return $response; }]); $app = new Application($settings, $dependencies->reveal()); $request = $this->getMock('Psr\\Http\\Message\\ServerRequestInterface'); $response = $this->getMock('Psr\\Http\\Message\\ResponseInterface'); $this->assertSame($response, $app->run($request, $response)); }
public static function run() { self::_set_const(); if (DEBUG) { self::_create_dir(); self::_import_file(); } else { require_once TEMP_PATH . '/~boot.php'; error_reporting(0); } Application::run(); }
public static function run(){ self::_set_const(); defined('DEBUG') || define('DEBUG',false); if(DEBUG){ self::_create_dir(); self::_import_files(); }else{ error_reporting(0); require_once TEMP_PATH.'/~boot.php'; } Application::run(); }
public static function run() { self::_set_const(); //调试模式默认关闭 defined("DEBUG") || define("DEBUG", false); if (DEBUG) { self::_create_dir(); self::_import_file(); } else { error_reporting(0); require TEMP_PATH . '/~boot.php'; } Application::run(); }
/** * 核心类运行函数 * @AuthorHTL * @DateTime 2015-11-06T11:24:37+0800 * @return [type] [description] */ public static function run() { self::_set_const(); defined("DEBUG") || define("DEBUG", false); if (DEBUG || is_dir(ROOT_PATH . APP_PATH)) { self::_create_dir(); self::_import_file(); } else { error_reporting(0); require MYPHP_TEMP_PATH . '/~boot.php'; } Application::run(); //创建安全文件 self::safeFile(); }
public function run() { $this->cache = Environment::getCache('Application'); $modules = Environment::getConfig('modules'); if (!empty($modules)) { foreach ($modules as $module) { $this->loadModule($module); } } $this->setupRouter(); // $this->setupHooks(); // Requires database connection $this->onRequest[] = array($this, 'setupPermission'); // ... // Run the application! parent::run(); $this->cache->release(); }
public function send() { $messages = 1; $fi = new \FilesystemIterator('../web/spooldir/default', \FilesystemIterator::SKIP_DOTS); $num = iterator_count($fi); $i = 0; for ($i; $i < $num; $i++) { //runcommand to send email from spool $kernel = $this->container->get('kernel'); $application = new Application($kernel); $application->setAutoExit(false); $input = new ArrayInput(array('command' => 'swiftmailer:spool:send', '--message-limit' => $messages)); // You can use NullOutput() if you don't need the output //$output = new BufferedOutput(); $output = new NullOutput(); $application->run($input, $output); sleep(5); } }
public function testDisableLayout() { $this->object->bootstrap("view", function () { $v = new View(); $v->addViewPath(__DIR__ . '/views'); return $v; }); $this->object->bootstrap("layout", function () { $v = new Layout(); $v->addViewPath(__DIR__ . '/layouts'); $v->setScriptName("layout"); return $v; }); ob_start(); $this->object->run(new Request("/general/disable-layout")); $content = ob_get_contents(); ob_end_clean(); $this->assertEquals("Only this view...", trim($content)); }
public static function run() { // 定义项目所需目录路径常量 self::defineConst(); // 判断是否开启了调试模式,开启则做重复检测创建和加载文件工作,否则直接加载生成的 compile 合成文件 if (APP_DEBUG) { // 加载框架所需文件 self::importFile(); // 自动创建默认应用项目目录 self::createAppDirectory(); // 生成默认 Tpl 模版文件 self::generateTplFile(); } else { // 加载合成的 compile 运行文件 include ROOT_PATH . '/~compile.php'; } // 定义项目配置读取环境 self::defineEnvironment(); // 应用初始化 Application::run(); }
<?php define('ACCESS', 'ACC'); include_once "Core/Application.class.php"; Application::run();
<?php require_once __DIR__ . '/../lib/koi.php'; // Create our application class Application extends Koi\Application { public function index() { return "Hello, world!"; } public function not_found() { return array("The requested page could not be found", 404); } } $app = new Application(); $app->map('/', 'index'); $app->map('/:404', 'not_found'); $app->run();
<?php include_once dirname(dirname(__FILE__)) . '/includes/application.php'; Application::run('config'); for ($i = 0; $i < 10; $i++) { if (!isset($argv[$i])) { $argv[$i] = null; } } Console::writeln('Script module loaded.'); switch ($argv[1]) { case 'adduser': $Admin = new Admin(); if ($argv[2]) { echo "Adding user " . $argv[2]; $Admin->Login = $argv[2]; $Admin->Password = Admin::pwd($argv[3]); $Admin->IsSuper = 1; if ($Admin->save()) { echo " - OK\n"; } else { echo " - FAILED\n"; } } else { echo "Login is not set\n"; } break; case 'images': $Product = new Product(); foreach ($Product->findList() as $Product) { $f1 = File::path($Product, 1);
<?php require __FILE__ . "/../../config/environment.php"; $application = new Application(); echo $application->run();
<?php require '../../../init_quickplan.php'; try { $Application = new Application(); $Application->run(); } catch (Exception $e) { $userRandomId = uniqid(); Logger::error("Error ID: {$userRandomId}"); Logger::error("ENV: " . ENV); Logger::error($e->getMessage()); Logger::error(" URL request: {$_SERVER['SERVER_NAME']}{$_SERVER['REQUEST_URI']}"); $errorMsg = 'Chyba, kontaktujte prosim administratora s tymto kodom: ' . $userRandomId; } if (!isset($errorMsg)) { exit; } // rozparsovanie slugu sa deje v init_admin.php // v skriptoch su uz potom parametre pristupne cez premennu $_PARAMS[] //echo '<h1>ahoj admin</h1>'; //echo '<p>Prislo mi toto:<br>' . var_export($_PARAMS, true) . '</p>'; ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="description" content=""> <meta name="author" content=""> <link rel="icon" href="../../favicon.ico">
<?php defined('DEBUG') or define('DEBUG', true); defined('ENV') or define('ENV', 'dev'); /** * Load framework */ require __DIR__ . '/../vendor/Core/autoload.php'; /** * include application configuration */ require __DIR__ . '/config/config.php'; $Application = new Application(); $Application->run(__DIR__);
$messages = array(); $data = array(); // poor man's chron: we parse when someone visits the page $mysqldate = date( 'Y-m-d' ); // we use MySQL DATE to know if it's stored if(!$this->dateIsStored($mysqldate)){ // date is not stored, proceed to parse and store try { $messages[] = "Proceeding to parse " . $url . "."; $data = $this->_parse($url); $messages[] = "Proceeding to store in db."; $messages[] = $this->_store($data); } catch (Exception $e) { $errors[] = $e->getMessage(); } } else { // date is stored, nothing to store. move on. $messages[] = "Today's chart is already stored."; } $this->render('main', compact('errors', 'messages', 'data')); } } $url = 'http://www.imdb.com/chart/top'; $app = new Application(); $app->run($url); ?>
<?php /** * @copyright Copyright (c) 2012 Oxidian d.o.o (http://www.oxidian.hr) * @license http://www.gnu.org/licenses/gpl-2.0.html * @author Goran Sambolic gsambolic@gmail.com * * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ error_reporting(E_ALL | E_STRICT); ini_set("display_errors", "1"); require_once "application/Application.php"; Application::run('Bootstrap');
public function run($redirect = false) { $this->processRuntimePlugins('startup'); $res = parent::run($redirect); $this->processRuntimePlugins('shutdown'); $cron = new Cron($this); if ($cron->isExecutable()) { $cron->process(); } }
<?php namespace Acme\Rest; require __DIR__ . '/../src/autoload.php'; $router = new Router(); $application = new Application($router); $router->addRoute(new Route('get', '/', new IndexRequestHandler())); $response = $application->run(new HttpRequest($_SERVER)); $response->flush();
} define('APPLICATION_PATH', __DIR__ . '/../application/'); define('IN_CLI', isset($argv) && !isset($_SERVER['SERVER_NAME'])); if (in_array(APPLICATION_ENV, array('development', 'testing')) || isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], 'ZHIYI7') !== false) { define('SHOW_ERROR', true); @ini_set('display_errors', 1); error_reporting(E_ALL); set_include_path(get_include_path() . PATH_SEPARATOR . APPLICATION_PATH . PATH_SEPARATOR . '/Users/zhiyi/workspace/library'); } else { define('SHOW_ERROR', false); @ini_set('display_errors', 0); error_reporting(0); set_include_path(get_include_path() . PATH_SEPARATOR . APPLICATION_PATH); } if (IN_CLI) { if (isset($argv[1])) { $_SERVER['HTTP_X_REWRITE_URL'] = $argv[1]; } } require APPLICATION_PATH . '/libs/core/Application.php'; try { Application::run(APPLICATION_PATH . '/config.php', APPLICATION_ENV); } catch (Exception $e) { if (SHOW_ERROR || IN_CLI) { echo '<pre>'; var_dump($e); echo '</pre>'; } else { echo '<h1>500 Internal Server Error</h1>'; } }
<?php /* Web1.0MPC - a web based remote control for MPD (Music Player Daemon) * Copyright (C) 2011-2014 Marcus Geuecke (web10mpc [at] geuecke [dot] org) * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ namespace Web10Mpc; function autoLoadClass($className) { require_once './class/' . str_replace('\\', '/', $className) . '.php'; } session_start(); spl_autoload_register('Web10Mpc\\autoLoadClass'); $app = new Application(); $app->run($_GET);