/** * Initialize the Plugin Manager callbacks */ public static function init() { // load language load_plugin_textdomain('yii_embed', false, basename(YII_EMBED_PATH) . '/languages'); // runs when plugin is activated register_activation_hook(YII_EMBED_PATH . 'yii_embed.php', 'YiiEmbed::activation'); // runs on plugin deactivation register_deactivation_hook(YII_EMBED_PATH . 'yii_embed.php', 'YiiEmbed::deactivation'); // setup admin pages if (is_admin()) { require_once YII_EMBED_PATH . 'includes/YiiEmbedAdmin.php'; YiiEmbedAdmin::init(); } // create Yii app if (YII_EMBED_YII_VERSION) { require_once YII_EMBED_PATH . 'includes/Yii.php'; // create application Yii::createApplication('YiiEmbedApplication', YII_EMBED_PATH . 'app/config/main.php'); // add output buffer for clientScript ob_start('YiiEmbed::renderClientScript'); // handle yii controller add_filter('template_redirect', 'YiiEmbed::runController'); // register scripts self::registerScripts(); } }
/** * Populates Yii::app() with a new application * The application will be destroyed on tearDown() automatically. * @param array $config The application configuration, if needed * @param string $appClass name of the application class to create */ protected function mockApplication($config = [], $appClass = '\\CWebApplication') { if (Yii::app() !== null) { $this->destroyApplication(); } Yii::createApplication($appClass, \CMap::mergeArray(['id' => 'testapp', 'basePath' => __DIR__], $config)); }
public function getUserAdapter() { Yii::import('wiki.components.auth.*'); if ($this->_userAdapter === null) { $this->_userAdapter = Yii::createApplication($this->userAdapter); } return $this->_userAdapter; }
use application\modules\message\core\wx\Factory; use application\modules\message\core\wx\WxApi; use application\modules\user\model\UserBinding; // 程序根目录路径 define('PATH_ROOT', dirname(__FILE__) . '/../../'); $defines = PATH_ROOT . '/system/defines.php'; define('TIMESTAMP', time()); define('YII_DEBUG', true); define('CALLBACK', true); $yii = PATH_ROOT . '/library/yii.php'; $mainConfig = (require_once PATH_ROOT . '/system/config/common.php'); require_once $defines; require_once $yii; require_once '../login.php'; Yii::setPathOfAlias('application', PATH_ROOT . DIRECTORY_SEPARATOR . 'system'); Yii::createApplication('application\\core\\components\\Application', $mainConfig); // 接收的参数 $msgSignature = rawurldecode(Env::getRequest('msgSignature')); $timestamp = rawurldecode(Env::getRequest('timestamp')); $aeskey = WxApi::getInstance()->getAeskey(); $echoStr = rawurldecode(Env::getRequest('echoStr')); if (strcmp($msgSignature, md5($aeskey . $timestamp)) != 0) { Env::iExit('access denied'); } if (!empty($echoStr)) { WxApi::getInstance()->resetCorp(); Env::iExit($echoStr); } // 接收信息处理 $result = trim(file_get_contents("php://input"), " \t\n\r"); // 解析
<?php // change the following paths if necessary $yii = dirname(__FILE__) . '/../../../protected/extensions/yii-environment/Environment.php'; $config = dirname(__FILE__) . '/../../../protected//config/main.php'; // remove the following lines when in production mode defined('YII_DEBUG') or define('YII_DEBUG', true); // specify how many levels of call stack should be shown in each log message defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL', 0); require_once $yii; require dirname(__FILE__) . '/../../../protected/components/UcenterApplication.php'; Yii::createApplication('UcenterApplication', $config)->run();
<?php defined('YII_DEBUG') or define('YII_DEBUG', true); defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL', 3); // Setting application base paths for configuration and framework $yiiFramework = dirname(__FILE__) . '/vendor/framework/yii.php'; $globalConfiguration = dirname(__FILE__) . '/app/app.php'; $globalApplication = dirname(__FILE__) . '/protected/application/Application.php'; // Require yii framework to start the application // Require configuration and base web application require_once $globalConfiguration; require_once $yiiFramework; require_once $globalApplication; // Run the web application Yii::createApplication('Application', $globalConfiguration)->run(); Yii::import('application.vendors.*');
* feasible for technical reasons, the Appropriate Legal Notices must display the words * "Copyright Zurmo Inc. 2015. All rights reserved". ********************************************************************************/ require_once 'version.php'; if (is_file('commercialVersion.php')) { require_once 'commercialVersion.php'; } require_once 'roots.php'; // Debug is used per instance. if (is_file(INSTANCE_ROOT . '/protected/config/debug.php')) { $debug = INSTANCE_ROOT . '/protected/config/debug.php'; } else { $debug = INSTANCE_ROOT . '/protected/config/debugDIST.php'; } // Runtime path is used per instance. $runtimePath = INSTANCE_ROOT . '/protected/runtime'; // The config is used per instance. $config = INSTANCE_ROOT . '/protected/config/main.php'; // Yii is used from the common source. $yii = COMMON_ROOT . '/../yii/framework/yii.php'; // WebApplication is used from the common source. $webApplication = COMMON_ROOT . '/protected/core/components/WebApplication.php'; require_once $debug; require_once $yii; require_once $webApplication; $webApplication = Yii::createApplication('WebApplication', $config); if (file_exists($runtimePath)) { $webApplication->setRuntimePath($runtimePath); } $webApplication->run(); exit;
* * You can contact Zurmo, Inc. with a mailing address at 27 North Wacker Drive * Suite 370 Chicago, IL 60606. or at email address contact@zurmo.com. * * The interactive user interfaces in original and modified versions * of this program must display Appropriate Legal Notices, as required under * Section 5 of the GNU Affero General Public License version 3. * * In accordance with Section 7(b) of the GNU Affero General Public License version 3, * these Appropriate Legal Notices must retain the display of the Zurmo * logo and Zurmo copyright notice. If the display of the logo is not reasonably * feasible for technical reasons, the Appropriate Legal Notices must display the words * "Copyright Zurmo Inc. 2013. All rights reserved". ********************************************************************************/ require_once 'testRoots.php'; require_once 'TestConfigFileUtils.php'; TestConfigFileUtils::configureConfigFiles(); $debug = INSTANCE_ROOT . '/protected/config/debugTest.php'; $yiit = COMMON_ROOT . "/../yii/framework/yiit.php"; $config = INSTANCE_ROOT . "/protected/config/test.php"; require_once COMMON_ROOT . "/version.php"; require_once COMMON_ROOT . "/protected/modules/install/utils/InstallUtil.php"; require_once COMMON_ROOT . "/protected/core/utils/ZurmoPasswordSecurityUtil.php"; InstallUtil::setZurmoTokenAndWriteToPerInstanceFile(INSTANCE_ROOT, 'perInstanceTest.php'); ZurmoPasswordSecurityUtil::setPasswordSaltAndWriteToPerInstanceFile(INSTANCE_ROOT, 'perInstanceTest.php'); require_once $debug; require_once $yiit; require_once COMMON_ROOT . '/protected/core/components/WebApplication.php'; require_once COMMON_ROOT . '/protected/tests/WebTestApplication.php'; Yii::createApplication('WebTestApplication', $config);
if (isset($_GET['init']) && $_GET['init']) { // 初始化ibos核心 // 定义驱动引擎 define('ENGINE', 'LOCAL'); // TODO,上线记得删除此行 define('YII_DEBUG', FALSE); $yii = PATH_ROOT . '/library/yii.php'; $ibosApplication = PATH_ROOT . '/system/core/components/ICApplication.php'; require_once $yii; require_once $ibosApplication; $commonConfig = (require CONFIG_PATH . 'common.php'); // 由于模块安装之间的依赖性,需要用到dashboard的一些组件,所以得加载进来 $dashboardImport = array('application.modules.dashboard.model.*', 'application.modules.dashboard.utils.*'); $commonConfig['import'] = array_merge($commonConfig['import'], $dashboardImport); unset($commonConfig['preload']); Yii::createApplication('ICApplication', $commonConfig); } $updataLockFile = PATH_ROOT . './data/updateSQL.lock'; // 是否已升级过 if (file_exists($updataLockFile)) { $errorMsg = $lang['UpdateSQL locked'] . str_replace(PATH_ROOT, '', $updataLockFile); include 'errorInfo.php'; exit; } if (!isset($_GET['step'])) { $step = 'prepare'; } else { $step = $_GET['step']; } $ibos1ConfigFile = CONFIG_PATH_IBOS1 . 'config_global.php'; $ibos2ConfigFile = CONFIG_PATH . 'config.php';
class StandaloneApplication extends CWebApplication { public function onBeginRequest($event) { return; } public function onEndRequest($event) { return; } public function processRequest() { return; } } Yii::createApplication('StandaloneApplication', $root . $conf['config'])->run(); Yii::app()->user; // the only thing we need from yii // we need to remove the autoloader of yii otherwise the kcfinder autoloader doesn't work spl_autoload_unregister(array('YiiBase', 'autoload')); function CheckAuthentication() { return Yii::app()->user->id > 0; } /** This file is part of KCFinder project * * @desc Base configuration file * @package KCFinder * @version 3.12 * @author Pavel Tzonkov <*****@*****.**> * @copyright 2010-2014 KCFinder Project
public static function createConsoleApplication($config=null) { return Yii::createApplication('EConsoleApplication',$config); }
<?php /** * Entry point script for backend. * * @author: antonio ramirez <*****@*****.**> * @author: mark safronov <*****@*****.**> */ # Loading project default init code for all entry points. require __DIR__ . '/../../common/bootstrap.php'; # Setting up the frontend-specific aliases Yii::setPathOfAlias('backend', ROOT_DIR . '/backend'); Yii::setPathOfAlias('www', ROOT_DIR . '/backend/www'); # As we are using BootstrapFilter to include Booster, we have to define 'bootstrap' alias ourselves # Note that we are binding to Composer-installed version of YiiBooster Yii::setPathOfAlias('bootstrap', ROOT_DIR . '/vendor/clevertech/yii-booster/src'); Yii::setPathOfAlias('yiistrap', ROOT_DIR . '/vendor/yiistrap'); # We use our custom-made WebApplication component as base class for backend app. require_once ROOT_DIR . '/backend/components/BackendWebApplication.php'; # For obvious reasons, backend entry point is constructed of specialised WebApplication and config Yii::createApplication('BackendWebApplication', ROOT_DIR . '/backend/config/main.php')->run();
/** * * @param \Symfony\Component\BrowserKit\Request $request * * @return \Symfony\Component\BrowserKit\Response */ public function doRequest($request) { $this->headers = array(); $_COOKIE = array_merge($_COOKIE, $request->getCookies()); $_SERVER = array_merge($_SERVER, $request->getServer()); $_FILES = $this->remapFiles($request->getFiles()); $_REQUEST = $this->remapRequestParameters($request->getParameters()); $_POST = $_GET = array(); if (strtoupper($request->getMethod()) == 'GET') { $_GET = $_REQUEST; } else { $_POST = $_REQUEST; } // Parse url parts $uriPath = trim(parse_url($request->getUri(), PHP_URL_PATH), '/'); $uriQuery = ltrim(parse_url($request->getUri(), PHP_URL_QUERY), '?'); $scriptName = trim(parse_url($this->url, PHP_URL_PATH), '/'); if (!empty($uriQuery)) { $uriPath .= "?{$uriQuery}"; parse_str($uriQuery, $params); foreach ($params as $k => $v) { $_GET[$k] = $v; } } // Add script name to request if none if (strpos($uriPath, $scriptName) === false) { $uriPath = "/{$scriptName}/{$uriPath}"; } // Add forward slash if not exists if (strpos($uriPath, '/') !== 0) { $uriPath = "/{$uriPath}"; } $_SERVER['REQUEST_METHOD'] = strtoupper($request->getMethod()); $_SERVER['REQUEST_URI'] = $uriPath; /** * Hack to be sure that CHttpRequest will resolve route correctly */ $_SERVER['SCRIPT_NAME'] = "/{$scriptName}"; $_SERVER['SCRIPT_FILENAME'] = $this->appPath; ob_start(); \Yii::setApplication(null); \Yii::createApplication($this->appSettings['class'], $this->appSettings['config']); $app = \Yii::app(); // disabling logging. Logs slow down test execution if ($app->hasComponent('log')) { foreach ($app->getComponent('log')->routes as $route) { $route->enabled = false; } } if ($app->hasComponent('session')) { // disable regenerate id in session $app->setComponent('session', Stub::make('CHttpSession', ['regenerateID' => false])); } $app->onEndRequest->add([$this, 'setHeaders']); $app->run(); if ($app->hasComponent('db')) { // close connection $app->getDb()->setActive(false); // cleanup metadata cache $property = new \ReflectionProperty('CActiveRecord', '_md'); $property->setAccessible(true); $property->setValue([]); } $content = ob_get_clean(); $headers = $this->getHeaders(); $statusCode = 200; foreach ($headers as $header => $val) { if ($header == 'Location') { $statusCode = 302; } } $response = new Response($content, $statusCode, $this->getHeaders()); return $response; }
<?php # This is the entry point for console application. # # We do not use the built-in `yiic.php` because of our own class including order. require_once __DIR__ . '/../common/bootstrap.php'; # Our own boilerplate for ConsoleApplication require_once ROOT_DIR . '/console/components/ConsoleApplication.php'; require_once ROOT_DIR . '/vendor/clio/src/Clio/Console.php'; Yii::setPathOfAlias('yiistrap', ROOT_DIR . '/vendor/yiistrap'); Yii::setPathOfAlias('backend', ROOT_DIR . '/backend'); # fix for fcgi defined('STDIN') or define('STDIN', fopen('php://stdin', 'r')); /** @var ConsoleApplication $app */ $app = Yii::createApplication('ConsoleApplication', ROOT_DIR . '/console/config/main.php'); $app->commandRunner->addCommands(YII_PATH . '/cli/commands'); $app->commandRunner->addCommands(@getenv('YII_CONSOLE_COMMANDS')); $app->run();
switch ($error['type']) { case E_ERROR: case E_CORE_ERROR: case E_COMPILE_ERROR: case E_USER_ERROR: $isError = true; break; } } if ($isError) { date_default_timezone_set('Europe/Ljubljana'); if (defined("THREAD") && defined("THREAD_TYPE")) { print date("d.m.Y H:i:s") . " :: " . THREAD_TYPE . " Thread :: " . str_pad(THREAD, 3, "0", STR_PAD_LEFT) . " :: Script execution halted ({$error['message']})\n"; } else { print date("d.m.Y H:i:s") . " :: Script execution halted ({$error['message']})\n"; } if (defined("THREAD") && defined("THREAD_TYPE")) { require_once dirname(__FILE__) . '/../common/lib/Net/Gearman/Client.php'; print date("d.m.Y H:i:s") . " :: " . THREAD_TYPE . " Thread :: " . str_pad(THREAD, 3, "0", STR_PAD_LEFT) . " :: Starting workers restart...\n"; $set = new Net_Gearman_Set(); $task = new Net_Gearman_Task("Worker_Restarter", 1); $task->type = Net_Gearman_Task::JOB_BACKGROUND; $set->addTask($task); $client = new Net_Gearman_Client(array('127.0.0.1:4730')); $client->runSet($set); } } } register_shutdown_function('thread_shutdown'); Yii::createApplication("WorkerApplication", $config)->run();
} else { if (!is_dir(BASEPATH . $application_folder . '/')) { exit("Your application folder path does not appear to be set correctly. Please open the following file and correct this: " . SELF); } define('APPPATH', BASEPATH . $application_folder . '/'); } if (file_exists(APPPATH . 'config' . DIRECTORY_SEPARATOR . 'config.php')) { $aSettings = (include APPPATH . 'config' . DIRECTORY_SEPARATOR . 'config.php'); } else { $aSettings = array(); } if (isset($aSettings['config']['debug']) && $aSettings['config']['debug'] > 0) { define('YII_DEBUG', true); error_reporting(E_ALL); } else { define('YII_DEBUG', false); error_reporting(0); } /* * -------------------------------------------------------------------- * LOAD THE BOOTSTRAP FILE * -------------------------------------------------------------------- * * And away we go... * */ require_once BASEPATH . 'yii' . EXT; require_once APPPATH . 'core/LSYii_Application' . EXT; Yii::createApplication('LSYii_Application', APPPATH . 'config/config' . EXT)->run(); /* End of file index.php */ /* Location: ./index.php */
if ($i) { $basepath = realpath($basepath); $loader = @(include $basepath . '/vendor/autoload.php'); } defined('BASE_PATH') || define('BASE_PATH', $basepath); if (!$loader) { throw new RuntimeException('vendor/autoload.php could not be found. Did you run `php composer.phar install`?'); } $loader->add('YiiMigrate\\', __DIR__); $env = getenv('YIIMIGRATE_ENV'); if ($env) { $env = "-{$env}"; } else { $env = ''; } $config = @(include "{$basepath}/config/migration{$env}.php"); if (!$config) { throw new RuntimeException("Migration config in {$basepath}/config/migration.php not found, please use {$currentpath}/config/migration.php-default to create one"); } $config['commandMap'] = array('migrate' => array('class' => '\\YiiMigrate\\AMigrateCommand', 'migrationPath' => 'application.migrations', 'migrationTable' => 'tbl_migration', 'connectionID' => 'db', 'templateFile' => isset($config['templateFile']) ? $basepath . '/' . $config['templateFile'] : $currentpath . '/migrations/template.phptpl')); $config['basePath'] = $basepath . '/' . (isset($config['migrationsPath']) ? $config['migrationsPath'] : '.'); unset($config['migrationsPath']); unset($config['templateFile']); defined('STDIN') || define('STDIN', fopen('php://stdin', 'r')); defined('YII_DEBUG') || define('YII_DEBUG', true); require_once $basepath . '/vendor/yiisoft/yii/framework/yii.php'; $loader->setUseIncludePath($basepath . '/cli/commands'); $app = Yii::createApplication('YiiMigrate\\AConsoleApplication', $config); $app->commandRunner->addCommands($currentpath . '/cli/commands'); array_splice($_SERVER['argv'], 1, 0, 'migrate'); $app->run();
die ('This script can only be run on PHP version 5.3.0 or later! Your version: '.PHP_VERSION.'<br />'); /* * -------------------------------------------------------------------- * LOAD THE BOOTSTRAP FILE * -------------------------------------------------------------------- * * And away we go... * */ require_once BASEPATH . 'yii' . EXT; require_once APPPATH . 'core/LSYii_Application' . EXT; $config = require_once(APPPATH . 'config/internal' . EXT); if (!file_exists(APPPATH . 'config/config' . EXT)) { // If Yii can not start due to unwritable runtimePath, present an error $runtimePath = $config['runtimePath']; if (!is_dir($runtimePath) || !is_writable($runtimePath)) { // @@TODO: present html page styled like the installer die (sprintf('%s should be writable by the webserver (766 or 776).', $runtimePath)); } } Yii::createApplication('LSYii_Application', $config)->run(); /* End of file index.php */ /* Location: ./index.php */
<?php require dirname(__FILE__) . '/../../vendor/autoload.php'; /* // change the following paths if necessary $yiic = dirname(__FILE__) . '/../../vendor/yiisoft/yii/framework/yiic.php'; $config = dirname(__FILE__) . '/config/console.php'; // remove the following lines when in production mode defined('YII_DEBUG') or define('YII_DEBUG',true); // specify how many levels of call stack should be shown in each log message defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3); require_once($yiic); * */ $yii = dirname(__FILE__) . '/../../vendor/yiisoft/yii/framework/yii.php'; require_once $yii; require_once dirname(__FILE__) . '/components/ConsoleApplication.php'; $config = dirname(__FILE__) . '/config/console.php'; Yii::createApplication('ConsoleApplication', $config)->run();
* index.php * * @author: antonio ramirez <*****@*****.**> * Date: 7/22/12 * Time: 11:13 AM */ defined('YII_DEBUG') or define('YII_DEBUG', true); //defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3); // On dev display all errors if (YII_DEBUG) { error_reporting(-1); ini_set('display_errors', true); } date_default_timezone_set('UTC'); chdir(dirname(__FILE__) . '/../..'); require_once 'common/lib/Yii/yii.php'; require_once 'common/components/WebApplication.php'; require_once 'common/lib/global.php'; $app = Yii::createApplication('WebApplication', require 'backend/config/main.php'); /* please, uncomment the following if you are using ZF library */ /* Yii::import('common.extensions.EZendAutoloader', true); EZendAutoloader::$prefixes = array('Zend'); EZendAutoloader::$basePath = Yii::getPathOfAlias('common.lib') . DIRECTORY_SEPARATOR; Yii::registerAutoloader(array("EZendAutoloader", "loadClass"), true); */ $app->run(); /* uncomment if you wish to debug your resulting config */ /* echo '<pre>' . dump($config) . '</pre>'; */
<?php /** * Entry point for the frontend. * * @author: antonio ramirez <*****@*****.**> * @author: mark safronov <*****@*****.**> */ # Loading project default init code for all entry points. require __DIR__ . '/../../common/bootstrap.php'; # Setting up the frontend-specific aliases Yii::setPathOfAlias('frontend', ROOT_DIR . '/frontend'); Yii::setPathOfAlias('www', ROOT_DIR . '/frontend/www'); # As we are using BootstrapFilter to include Booster, we have to define 'bootstrap' alias ourselves # Note that we are binding to Composer-installed version of YiiBooster Yii::setPathOfAlias('bootstrap', ROOT_DIR . '/vendor/clevertech/yii-booster/src'); Yii::setPathOfAlias('yiistrap', ROOT_DIR . '/vendor/yiistrap'); # We use our custom-made WebApplication component as base class for frontend app. require_once ROOT_DIR . '/frontend/components/FrontendWebApplication.php'; # For obvious reasons, backend entry point is constructed of specialised WebApplication and config Yii::createApplication('FrontendWebApplication', ROOT_DIR . '/frontend/config/main.php')->run();
} return; } else { // приложение по умолчанию if (defined('YGIN_NEED_INSTALL') && YGIN_NEED_INSTALL) { $config = (require dirname(__FILE__) . '/ygin/modules/install/config/install.php'); } else { $config = (require dirname(__FILE__) . '/ygin/config/mainConfig.php'); } require_once dirname(__FILE__) . '/ygin/components/DaWebApplication.php'; $applicationClass = 'DaWebApplication'; } } if ($local != null) { $config = CMap::mergeArray($config, $local); } //print_r($config);exit; // Для того чтобы лучше был автокомплит class Yii extends YiiBase { /** * @static * @return BaseApplication */ public static function app() { return parent::app(); } } Yii::createApplication($applicationClass, $config)->run();
defined('CRAFT_CONFIG_PATH') || define('CRAFT_CONFIG_PATH', $frontConfigPath); } else { defined('CRAFT_CONFIG_PATH') || define('CRAFT_CONFIG_PATH', CRAFT_BASE_PATH . 'config/'); } defined('CRAFT_PLUGINS_PATH') || define('CRAFT_PLUGINS_PATH', CRAFT_BASE_PATH . 'plugins/'); defined('CRAFT_STORAGE_PATH') || define('CRAFT_STORAGE_PATH', CRAFT_BASE_PATH . 'storage/'); defined('CRAFT_TEMPLATES_PATH') || define('CRAFT_TEMPLATES_PATH', CRAFT_BASE_PATH . 'templates/'); defined('CRAFT_TRANSLATIONS_PATH') || define('CRAFT_TRANSLATIONS_PATH', CRAFT_BASE_PATH . 'translations/'); defined('CRAFT_ENVIRONMENT') || define('CRAFT_ENVIRONMENT', 'console'); /** * Yii command line script file configured for Craft. */ // fix for fcgi defined('STDIN') or define('STDIN', fopen('php://stdin', 'r')); require_once dirname(__FILE__) . '/../../framework/yii.php'; require_once CRAFT_APP_PATH . 'Craft.php'; require_once CRAFT_APP_PATH . 'Info.php'; // Guzzle makes use of these PHP constants, but they aren't actually defined in some compilations of PHP. // See http://it.blog.adclick.pt/php/fixing-php-notice-use-of-undefined-constant-curlopt_timeout_ms-assumed-curlopt_timeout_ms/ defined('CURLOPT_TIMEOUT_MS') || define('CURLOPT_TIMEOUT_MS', 155); defined('CURLOPT_CONNECTTIMEOUT_MS') || define('CURLOPT_CONNECTTIMEOUT_MS', 156); // Load up Composer's files require CRAFT_APP_PATH . 'vendor/autoload.php'; // Disable the PHP include path Yii::$enableIncludePath = false; require_once dirname(__FILE__) . '/ConsoleApp.php'; Yii::setPathOfAlias('app', CRAFT_APP_PATH); Yii::setPathOfAlias('plugins', CRAFT_PLUGINS_PATH); $app = Yii::createApplication('Craft\\ConsoleApp', $configPath); $app->commandRunner->addCommands(Craft\Craft::getPathOfAlias('application.consolecommands.*')); $app->run();
{ if (!is_string($text)) { $text = var_export($text, 1); } print iconv('UTF-8', 'CP866', $text); } $securePath = dirname(__FILE__) . '/../config.secure.json'; if (!file_exists($securePath)) { print 'Secure file is missed'; return; } $secure = json_decode(file_get_contents($securePath), 1); $yii = dirname(__FILE__) . '/../vendor/yiisoft/yii/framework/yii.php'; $config = dirname(__FILE__) . '/config/console.php'; $staticConfig = dirname(__FILE__) . '/config/static_config.php'; $config = (require_once $config); $staticConfig = (require_once $staticConfig); require_once dirname(__FILE__) . '/merge.php'; $config = array_merge_config($staticConfig, $config); defined('STDIN') or define('STDIN', fopen('php://stdin', 'r')); defined('YII_DEBUG') or define('YII_DEBUG', true); require_once $yii; if (isset($config)) { $app = Yii::createApplication('CConsoleApplication', $config); $app->commandRunner->addCommands(YII_PATH . '/cli/commands'); } else { $app = Yii::createApplication('CConsoleApplication', array('basePath' => dirname(__FILE__) . '/cli')); } /** @var $app CConsoleApplication */ Yii::setPathOfAlias('vendor', dirname(__FILE__) . '/../vendor'); $app->run();
<?php /* // change the following paths if necessary $yiic=dirname(__FILE__).'/vendors/yii/yiic.php'; $config=dirname(__FILE__).'/config/console.php'; require_once($yiic); */ $config = dirname(__FILE__) . '/config/console.php'; defined('STDIN') or define('STDIN', fopen('php://stdin', 'r')); defined('YII_DEBUG') or define('YII_DEBUG', true); require_once dirname(__FILE__) . '/vendors/yii/yii.php'; require_once dirname(__FILE__) . '/components/HConsoleApplication.php'; $app = Yii::createApplication('HConsoleApplication', $config); Yii::setPathOfAlias('webroot', realpath(dirname(__FILE__) . '/..')); // Add Yii Commands $app->commandRunner->addCommands(YII_PATH . '/cli/commands'); $app->run();
<?php defined('YII_DEBUG') or define('YII_DEBUG', true); defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL', 3); // On dev display all errors if (YII_DEBUG) { error_reporting(-1); ini_set('display_errors', true); header("Access-Control-Allow-Origin: *"); } date_default_timezone_set('Europe/Moscow'); chdir(dirname(__FILE__) . '/../..'); $root = dirname(__FILE__) . '/..'; $common = $root . '/../common'; $config = 'api/config/main.php'; require_once 'common/components/Yii.php'; require_once 'common/components/WebApplication.php'; require_once 'common/lib/global.php'; require_once 'common/packages/packages.php'; require_once 'common/components/shortcuts.php'; $app = Yii::createApplication('WebApplication', $config)->run();
} else { Ibos::app()->setting->set("cache/" . $cache["name"], $value); } } } define("ENGINE", "LOCAL"); define("PATH_ROOT", dirname(__FILE__) . "/../../"); $defines = PATH_ROOT . "/system/defines.php"; defined("TIMESTAMP") || define("TIMESTAMP", time()); $yii = PATH_ROOT . "/library/yii.php"; $config = PATH_ROOT . "/system/config/common.php"; $ibosApplication = PATH_ROOT . "/system/core/components/ICApplication.php"; require_once $defines; require_once $yii; require_once $ibosApplication; $ibos = Yii::createApplication("ICApplication", $config); $im = Setting::model()->fetchSettingValueByKey("im"); $im = unserialize($im); $imCfg = $im["qq"]; $cid = filter_input(INPUT_GET, "company_id", FILTER_SANITIZE_STRING); $openId = filter_input(INPUT_GET, "open_id", FILTER_SANITIZE_STRING); $hashskey = filter_input(INPUT_GET, "hashskey", FILTER_SANITIZE_STRING); $hashkey = filter_input(INPUT_GET, "hashkey", FILTER_SANITIZE_STRING); $returnurl = filter_input(INPUT_GET, "returnurl", FILTER_SANITIZE_STRING); if (empty($openId) || empty($hashskey) || empty($cid)) { exit("参数错误"); } $uid = UserBinding::model()->fetchUidByValue(StringUtil::filterCleanHtml($openId), "bqq"); if ($uid) { $checkCId = strcmp($imCfg["id"], $cid) == 0; $properties = array("company_id" => $cid, "company_token" => $imCfg["token"], "app_id" => $imCfg["appid"], "client_ip" => EnvUtil::getClientIp());
<?php // change the following paths if necessary //$yii=dirname(__FILE__).'/vendor/yiisoft/yii/framework/yii.php'; $config = dirname(__FILE__) . '/../protected/config/main.php'; defined('YII_DEBUG') or define('YII_DEBUG', true); defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL', 3); define('ROOT_DIR', realpath(__DIR__ . '/../')); define('WEB_DIR', ROOT_DIR . '/web'); define('VENDOR_DIR', ROOT_DIR . '/protected/vendor'); require_once VENDOR_DIR . '/autoload.php'; # Some global aliases Yii::setPathOfAlias('root', ROOT_DIR); Yii::setPathOfAlias('web', WEB_DIR); Yii::setPathOfAlias('vendor', VENDOR_DIR); Yii::setPathOfAlias('bootstrap', VENDOR_DIR . '/clevertech/yii-booster/src'); //Yii::setPathOfAlias('currency.CurrencyModule', ROOT_DIR . '/modules/currency/CurrencyModule.php'); require_once ROOT_DIR . '/protected/components/MyWebApplication.php'; //var_dump(include($config));die(); $app = Yii::createApplication('MyWebApplication', $config); $app->run(); //require_once($yii); //Yii::createWebApplication($config)->run();
<?php require __DIR__ . '/../server/bootstrap.php'; // Запуск приложения $config = Yii::getPathOfAlias('app.config.main') . '.php'; Yii::createApplication('\\app\\components\\WebApplication', $config)->run();
protected function mockApplication($config = array(), $appClass = 'TestApplication') { static $defaultConfig = array('basePath' => __DIR__); Yii::createApplication($appClass, CMap::mergeArray($defaultConfig, $config)); }