示例#1
0
 *
 * @see  http://kohanaframework.org/guide/using.configuration
 * @see  http://php.net/setlocale
 */
setlocale(LC_ALL, 'en_US.utf-8');
/**
 * Enable the Kohana auto-loader.
 *
 * @see  http://kohanaframework.org/guide/using.autoloading
 * @see  http://php.net/spl_autoload_register
 */
spl_autoload_register(array('Kohana', 'auto_load'));
/**
* Set the production status by the domain.
*/
Kohana::$environment = ($_SERVER['HTTP_HOST'] !== 'dev.2do.me.uk' and $_SERVER['HTTP_HOST'] !== 'm.dev.2do.me.uk') ? Kohana::PRODUCTION : Kohana::DEVELOPMENT;
//Kohana::$environment = Kohana::PRODUCTION;
/**
 * Enable the Kohana auto-loader for unserialization.
 *
 * @see  http://php.net/spl_autoload_call
 * @see  http://php.net/manual/var.configuration.php#unserialize-callback-func
 */
ini_set('unserialize_callback_func', 'spl_autoload_call');
//-- Configuration and initialization -----------------------------------------
/**
 * Initialize Kohana, setting the default options.
 *
 * The following options are available:
 *
 * - string   base_url	  path, and optionally domain, of your application   NULL
示例#2
0
/**
 * Enable the Kohana auto-loader for unserialization.
 *
 * @see  http://php.net/spl_autoload_call
 * @see  http://php.net/manual/var.configuration.php#unserialize-callback-func
 */
ini_set('unserialize_callback_func', 'spl_autoload_call');

//-- Configuration and initialization -----------------------------------------

/**
 * Set Kohana::$environment if a 'KOHANA_ENV' environment variable has been supplied.
 */
if (getenv('KOHANA_ENV') !== FALSE)
{
	Kohana::$environment = getenv('KOHANA_ENV');
}

/**
 * Initialize Kohana, setting the default options.
 *
 * The following options are available:
 *
 * - string   base_url    path, and optionally domain, of your application   NULL
 * - string   index_file  name of your index file, usually "index.php"       index.php
 * - string   charset     internal character set used for input and output   utf-8
 * - string   cache_dir   set the internal cache directory                   APPPATH/cache
 * - boolean  errors      enable or disable error handling                   TRUE
 * - boolean  profile     enable or disable internal profiling               TRUE
 * - boolean  caching     enable or disable internal caching                 FALSE
 */
示例#3
0
 */
spl_autoload_register(array('Kohana', 'auto_load'));
/**
 * Enable the Kohana auto-loader for unserialization.
 *
 * @see  http://php.net/spl_autoload_call
 * @see  http://php.net/manual/var.configuration.php#unserialize-callback-func
 */
ini_set('unserialize_callback_func', 'spl_autoload_call');
//-- Configuration and initialization -----------------------------------------
/**
 * Set Kohana::$environment if $_ENV['KOHANA_ENV'] has been supplied.
 * 
 */
if (isset($_ENV['KOHANA_ENV'])) {
    Kohana::$environment = $_ENV['KOHANA_ENV'];
}
/**
 * Initialize Kohana, setting the default options.
 *
 * The following options are available:
 *
 * - string   base_url    path, and optionally domain, of your application   NULL
 * - string   index_file  name of your index file, usually "index.php"       index.php
 * - string   charset     internal character set used for input and output   utf-8
 * - string   cache_dir   set the internal cache directory                   APPPATH/cache
 * - boolean  errors      enable or disable error handling                   TRUE
 * - boolean  profile     enable or disable internal profiling               TRUE
 * - boolean  caching     enable or disable internal caching                 FALSE
 */
Kohana::init(array('base_url' => '/', 'index_file' => FALSE, 'errors' => FALSE));
示例#4
0
 * Set the default language
 */
I18n::lang('ru');
if (isset($_SERVER['SERVER_PROTOCOL'])) {
    // Replace the default protocol.
    HTTP::$protocol = $_SERVER['SERVER_PROTOCOL'];
}
/**
 * Set Kohana::$environment if a 'KOHANA_ENV' environment variable has been supplied.
 *
 * Note: If you supply an invalid environment name, a PHP warning will be thrown
 * saying "Couldn't find constant Kohana::<INVALID_ENV_NAME>"
 */
Kohana::$environment = Kohana::DEVELOPMENT;
if (isset($_SERVER['KOHANA_ENV'])) {
    Kohana::$environment = constant('Kohana::' . strtoupper($_SERVER['KOHANA_ENV']));
}
/**
 * Initialize Kohana, setting the default options.
 *
 * The following options are available:
 *
 * - string   base_url    path, and optionally domain, of your application   NULL
 * - string   index_file  name of your index file, usually "index.php"       index.php
 * - string   charset     internal character set used for input and output   utf-8
 * - string   cache_dir   set the internal cache directory                   APPPATH/cache
 * - integer  cache_life  lifetime, in seconds, of items cached              60
 * - boolean  errors      enable or disable error handling                   TRUE
 * - boolean  profile     enable or disable internal profiling               TRUE
 * - boolean  caching     enable or disable internal caching                 FALSE
 * - boolean  expose      set the X-Powered-By header                        FALSE
示例#5
0
 * Set the default locale.
 */
setlocale(LC_TIME, 'de_DE.utf-8', 'de_DE@euro', 'de_DE', 'de', 'ge', 'German', 'german', 'Germany', 'germany', 'deutsch', 'Deutsch', 'deu', 'deu_deu', '276', 'CTRY_GERMANY');
/**
 * Enable the Kohana auto-loader.
 */
spl_autoload_register(array('Kohana', 'auto_load'));
/**
 * Enable the Kohana auto-loader for unserialization.
 */
ini_set('unserialize_callback_func', 'spl_autoload_call');
// -- Configuration and initialization -----------------------------------------
// DEFAULT LANGUAGE
I18n::lang('de-DE');
// ENVIRONMENT
Kohana::$environment = $_SERVER['SERVER_NAME'] !== 'mtbo' ? Kohana::PRODUCTION : Kohana::DEVELOPMENT;
// INIT
Kohana::init(array('base_url' => '/', 'caching' => Kohana::$environment === Kohana::PRODUCTION, 'profile' => Kohana::$environment !== Kohana::PRODUCTION, 'index_file' => FALSE));
// LOGS
Kohana::$log->attach(new Log_File(APPPATH . 'logs'));
// CONFIGS
Kohana::$config->attach(new Config_File());
// MODULES
Kohana::modules(array('userguide' => MODPATH . 'userguide', 'helper' => MODPATH . 'helper', 'yubico' => MODPATH . 'yubico', 'recaptcha' => MODPATH . 'recaptcha', 'swiftmailer' => MODPATH . 'swiftmailer', 'auth' => MODPATH . 'auth', 'database' => MODPATH . 'database', 'image' => MODPATH . 'image', 'orm' => MODPATH . 'orm'));
Cookie::$salt = ')$Vpx,cwou34hvmp9(/KH§vmpöUZP§)zöä9=H//§%';
// ROUTES
Route::set('mediaresizer', 'media_resize/<path>.<extension>/<dimensions>', array('path' => '[A-Za-z0-9\\/]+', 'dimensions' => '[\\d]+x[\\d]+'))->defaults(array('controller' => 'Media', 'action' => 'resize'));
Route::set('places_today', 'places/neues')->defaults(array('controller' => 'Places', 'action' => 'neues'));
Route::set('places_read', 'places/<user>/<entry>/<seo>', array('entry' => '[\\d]+'))->defaults(array('controller' => 'Places', 'action' => 'show'));
Route::set('places_diary', 'places/diary/<user>/<diary_id>/<seo>(/<page>)', array('diary_id' => '[\\d]+', 'page' => '[\\d]+'))->defaults(array('controller' => 'Places', 'action' => 'index'));
Route::set('places', 'places/<user>(/<page>)', array('page' => '[\\d]+'))->defaults(array('controller' => 'Places', 'action' => 'index'));
示例#6
0
 * - string   base_url    path, and optionally domain, of your application   NULL
 * - string   index_file  name of your index file, usually "index.php"       index.php
 * - string   charset     internal character set used for input and output   utf-8
 * - string   cache_dir   set the internal cache directory                   APPPATH/cache
 * - integer  cache_life  lifetime, in seconds, of items cached              60
 * - boolean  errors      enable or disable error handling                   TRUE
 * - boolean  profile     enable or disable internal profiling               TRUE
 * - boolean  caching     enable or disable internal caching                 FALSE
 * - boolean  expose      set the X-Powered-By header                        FALSE
 */
if (in_array(@$_SERVER['SERVER_NAME'], array('127.0.0.1', 'fe80::1', '::1', 'localhost', '192.168.2.164', '192.168.0.123'))) {
    $init = array('base_url' => "/tizzy", 'index_file' => "index.php", 'errors' => TRUE, 'profile' => Kohana::$environment === Kohana::DEVELOPMENT);
    Kohana::$environment = Kohana::DEVELOPMENT;
} else {
    $init = array('base_url' => "/", 'index_file' => FALSE, 'errors' => TRUE, 'profile' => Kohana::$environment === Kohana::PRODUCTION);
    Kohana::$environment = Kohana::PRODUCTION;
}
Kohana::init($init);
/**
 * Setting Cookie::$salt
 */
Cookie::$salt = '29961408e9a1bbbf0456dd913a12d31fffa587cc';
/**
 * Attach the file write to logging. Multiple writers are supported.
 */
Kohana::$log->attach(new Log_File(APPPATH . 'logs'));
/**
 * Attach a file reader to config. Multiple readers are supported.
 */
Kohana::$config->attach(new Config_File());
/**
示例#7
0
 * Enable the Kohana auto-loader for unserialization.
 *
 * @see  http://php.net/spl_autoload_call
 * @see  http://php.net/manual/var.configuration.php#unserialize-callback-func
 */
ini_set('unserialize_callback_func', 'spl_autoload_call');
//-- Configuration and initialization -----------------------------------------
/**
 * Set the default language
 */
I18n::lang('en-us');
/**
 * Set Kohana::$environment if a 'KOHANA_ENV' environment variable has been supplied.
 */
if (getenv('KOHANA_ENV') !== false) {
    Kohana::$environment = constant('Kohana::' . strtoupper(getenv('KOHANA_ENV')));
}
/**
 * Initialize Kohana, setting the default options.
 *
 * The following options are available:
 *
 * - string   base_url    path, and optionally domain, of your application   NULL
 * - string   index_file  name of your index file, usually "index.php"       index.php
 * - string   charset     internal character set used for input and output   utf-8
 * - string   cache_dir   set the internal cache directory                   APPPATH/cache
 * - boolean  errors      enable or disable error handling                   TRUE
 * - boolean  profile     enable or disable internal profiling               TRUE
 * - boolean  caching     enable or disable internal caching                 FALSE
 */
Kohana::init(array('base_url' => '/', 'index_file' => false, 'caching' => !in_array(Kohana::$environment, array(Kohana::DEVELOPMENT, Kohana::TESTING))));
示例#8
0
 */
I18n::lang('ru');
if (isset($_SERVER['SERVER_PROTOCOL'])) {
    // Replace the default protocol.
    HTTP::$protocol = $_SERVER['SERVER_PROTOCOL'];
}
/**
 * Set Kohana::$environment if a 'KOHANA_ENV' environment variable has been supplied.
 *
 * Note: If you supply an invalid environment name, a PHP warning will be thrown
 * saying "Couldn't find constant Kohana::<INVALID_ENV_NAME>"
 */
if (isset($_SERVER['KOHANA_ENV'])) {
    Kohana::$environment = constant('Kohana::' . strtoupper($_SERVER['KOHANA_ENV']));
} else {
    Kohana::$environment = constant('Kohana::' . strtoupper(substr(strtolower($_SERVER['HTTP_HOST']), -4) == '.dev' ? 'DEVELOPMENT' : 'PRODUCTION'));
}
/**
 * Initialize Kohana, setting the default options.
 *
 * The following options are available:
 *
 * - string   base_url    path, and optionally domain, of your application   NULL
 * - string   index_file  name of your index file, usually "index.php"       index.php
 * - string   charset     internal character set used for input and output   utf-8
 * - string   cache_dir   set the internal cache directory                   APPPATH/cache
 * - integer  cache_life  lifetime, in seconds, of items cached              60
 * - boolean  errors      enable or disable error handling                   TRUE
 * - boolean  profile     enable or disable internal profiling               TRUE
 * - boolean  caching     enable or disable internal caching                 FALSE
 * - boolean  expose      set the X-Powered-By header                        FALSE
示例#9
0
 * @see  http://php.net/spl_autoload_register
 */
spl_autoload_register(array('Kohana', 'auto_load'));
/**
 * Enable the Kohana auto-loader for unserialization.
 *
 * @see  http://php.net/spl_autoload_call
 * @see  http://php.net/manual/var.configuration.php#unserialize-callback-func
 */
ini_set('unserialize_callback_func', 'spl_autoload_call');
//-- Configuration and initialization -----------------------------------------
/**
 * Set if the application is in development (FALSE)
 * or if the application is in production (TRUE).
 */
Kohana::$environment = constant('Kohana::' . strtoupper(Arr::get($_SERVER, 'KOHANA_ENV', 'PRODUCTION')));
/**
 * Display errors only when in development.
 */
ini_set('display_errors', Kohana::$environment != Kohana::PRODUCTION);
if (Kohana::$environment == Kohana::PRODUCTION) {
    error_reporting(E_ALL ^ E_NOTICE);
}
/**
 * Initialize Kohana, setting the default options.
 *
 * The following options are available:
 *
 * - string   base_url	path, and optionally domain, of your application   NULL
 * - string   index_file  name of your index file, usually "index.php"	   index.php
 * - string   charset	 internal character set used for input and output   utf-8
示例#10
0
 * @see  http://php.net/manual/var.configuration.php#unserialize-callback-func
 */
ini_set('unserialize_callback_func', 'spl_autoload_call');
// -- Configuration and initialization -----------------------------------------
/**
 * Set the default language
 */
I18n::lang('en-us');
/**
 * Set Kohana::$environment if a 'KOHANA_ENV' environment variable has been supplied.
 *
 * Note: If you supply an invalid environment name, a PHP warning will be thrown
 * saying "Couldn't find constant Kohana::<INVALID_ENV_NAME>"
 */
if (isset($_SERVER['KOHANA_ENV'])) {
    define('ENVIRONMENT', Kohana::$environment = constant('Kohana::' . strtoupper($_SERVER['KOHANA_ENV'])));
}
/**
 * configure environment constants
 */
require_once 'configuration/configure.php';
/**
 * Initialize Kohana, setting the default options.
 *
 * The following options are available:
 *
 * - string   base_url    path, and optionally domain, of your application   NULL
 * - string   index_file  name of your index file, usually "index.php"       index.php
 * - string   charset     internal character set used for input and output   utf-8
 * - string   cache_dir   set the internal cache directory                   APPPATH/cache
 * - boolean  errors      enable or disable error handling                   TRUE
示例#11
0
文件: bootstrap.php 项目: nergal/2mio
 * @see  http://kohanaframework.org/guide/using.autoloading
 * @see  http://php.net/spl_autoload_register
 */
spl_autoload_register(array('Kohana', 'auto_load'));
/**
 * Set Kohana::$environment if a 'KOHANA_ENV' environment variable has been supplied.
 *
 * Note: If you supply an invalid environment name, a PHP warning will be thrown
 * saying "Couldn't find constant Kohana::<INVALID_ENV_NAME>"
 */
if (isset($_SERVER['KOHANA_ENV'])) {
    $env = 'Kohana::' . strtoupper($_SERVER['KOHANA_ENV']);
    Kohana::$environment = constant($env);
} elseif (defined('KOHANA_ENV')) {
    $env = 'Kohana::' . strtoupper(KOHANA_ENV);
    Kohana::$environment = constant($env);
}
if (Kohana::$environment === Kohana::DEVELOPMENT) {
    $config = array('timezone' => 'Europe/Kiev', 'locale' => 'ru_RU.utf-8', 'language' => 'ru', 'caching' => FALSE, 'profile' => TRUE, 'errors' => TRUE, 'charset' => 'utf-8', 'modules' => 'apis/twitter, asset, auth, cache, beanstalk, database, demo, event, image, mailer, oauth, orm, orm-mptt, pagination, plater, resizer, unittest, sso, libs, jelly, jelly-auth', 'cache_dir' => APPPATH . 'cache', 'logdir' => APPPATH . '../etc/logs/application', 'salt' => 'nd79Y!cPDG!SuWV$rWT8uHdJk%*T2ve84%#&9GCwN6c^5Hbj54^P$Ckx!8RH');
    if (PHP_SAPI != 'cli') {
        $config['modules'] .= ', devbar';
    }
} elseif (Kohana::$environment === Kohana::TESTING) {
    $config = array('timezone' => 'Europe/Kiev', 'locale' => 'en_US', 'language' => 'en-us', 'caching' => TRUE, 'profile' => FALSE, 'errors' => FALSE, 'charset' => 'utf-8', 'modules' => 'apis/twitter, asset, auth, cache, beanstalk, database, demo, event, image, mailer, oauth, orm, orm-mptt, pagination, plater, resizer, sso, libs, jelly, jelly-auth', 'cache_dir' => APPPATH . 'cache', 'logdir' => FALSE, 'salt' => '22sjmFA%$3uUb3d7AKG82A^unxGkdvMR9!5*47czjRWFFDBz!Bb@Q7Epf5^b');
} else {
    $config = array('timezone' => 'Europe/Kiev', 'locale' => 'ru_RU.utf-8', 'language' => 'ru', 'caching' => TRUE, 'profile' => FALSE, 'errors' => FALSE, 'charset' => 'utf-8', 'modules' => 'apis/twitter, asset, auth, cache, beanstalk, database, event, image, mailer, oauth, orm, orm-mptt, pagination, plater, resizer, sso, libs', 'cache_dir' => APPPATH . 'cache', 'logdir' => APPPATH . '../etc/logs/application', 'salt' => '6wGwxJmevA$r92e5ZNmCK#C4UeET#$J2x%tA4E&R2HV8R5pvv^BtA@sjdT3f');
}
/**
 * Set the default time zone.
 *
 * @see  http://kohanaframework.org/guide/using.configuration
示例#12
0
 * @see  http://php.net/timezones
 */
date_default_timezone_set('America/Chicago');
/**
 * Enable the Kohana auto-loader.
 *
 * @see  http://docs.kohanaphp.com/features/autoloading
 * @see  http://php.net/spl_autoload_register
 */
spl_autoload_register(array('Kohana', 'auto_load'));
/**
 * Set the environment status by the domain.
 */
if (strpos($_SERVER['HTTP_HOST'], 'kohanaphp.com') !== FALSE) {
    // We are live!
    Kohana::$environment = 'live';
    // Turn off notices and strict errors
    error_reporting(E_ALL ^ E_NOTICE ^ E_STRICT);
}
/**
 * Initialize Kohana, setting the default options.
 *
 * The following options are available:
 *
 * - string   base_url    path, and optionally domain, of your application   NULL
 * - string   index_file  name of your index file, usually "index.php"       index.php
 * - string   charset     internal character set used for input and output   utf-8
 * - string   cache_dir   set the internal cache directory                   APPPATH/cache
 * - boolean  errors      enable or disable error handling                   TRUE
 * - boolean  profile     enable or disable internal profiling               TRUE
 * - boolean  caching     enable or disable internal caching                 FALSE
示例#13
0
/**
 * Enable the Kohana auto-loader for unserialization.
 *
 * @see  http://php.net/spl_autoload_call
 * @see  http://php.net/manual/var.configuration.php#unserialize-callback-func
 */
ini_set('unserialize_callback_func', 'spl_autoload_call');
//-- Configuration and initialization -----------------------------------------
/**
 * Set Kohana::$environment if $_ENV['KOHANA_ENV'] has been supplied.
 * 
 */
if (getenv('SOURCEMAP_ENV')) {
    Kohana::$environment = getenv('SOURCEMAP_ENV');
} else {
    Kohana::$environment = Sourcemap::PRODUCTION;
}
/**
 * Initialize Kohana, setting the default options.
 *
 * The following options are available:
 *
 * - string   base_url    path, and optionally domain, of your application   NULL
 * - string   index_file  name of your index file, usually "index.php"       index.php
 * - string   charset     internal character set used for input and output   utf-8
 * - string   cache_dir   set the internal cache directory                   APPPATH/cache
 * - boolean  errors      enable or disable error handling                   TRUE
 * - boolean  profile     enable or disable internal profiling               TRUE
 * - boolean  caching     enable or disable internal caching                 FALSE
 */
Kohana::init(array('cache_dir' => CACHEPATH, 'index_file' => ''));
示例#14
0
/*
 * Load and configure Kohana Core
 */
if (!defined('KOHANA_START_TIME')) {
    define('KOHANA_START_TIME', microtime(TRUE));
}
if (!defined('KOHANA_START_MEMORY')) {
    define('KOHANA_START_MEMORY', memory_get_usage());
}
require SYSPATH . 'classes/Kohana/Core' . EXT;
require SYSPATH . 'classes/Kohana' . EXT;
require DOCROOT . 'vendor/autoload.php';
spl_autoload_register(array('Kohana', 'auto_load'));
ini_set('unserialize_callback_func', 'spl_autoload_call');
I18n::lang(KOHANA_LANG);
Kohana::$environment = constant('Kohana::' . strtoupper(KOHANA_ENVIRONMENT));
/*
 * Try to create log directory.
 */
$cache_dir = APPPATH . 'cache';
if (!file_exists($cache_dir)) {
    // Create directory, after the precedent of Kohana_Core::init();
    mkdir($cache_dir, 0755, TRUE) or die('Unable to make directory ' . $cache_dir);
    chmod($cache_dir, 0755);
}
/**
 * Shutdown for CLI, can be removed when http://dev.kohanaframework.org/issues/4537 is resolved.
 */
if (PHP_SAPI == 'cli') {
    register_shutdown_function(function () {
        if (Kohana::$errors and $error = error_get_last() and in_array($error['type'], Kohana::$shutdown_errors)) {
示例#15
0
    /**
     * Update selected database
     *
     * @throws Exception On unknown database configuration
     */
    public function action_update()
    {
        $this->db_name = $this->request->param('database', NULL);
        if (!$this->db_name) {
            self::display('Please select the database to perform update on dbupdate/update/[testing|default].', 'red');
            return;
        }
        switch ($this->db_name) {
            case 'dev':
                Kohana::$environment = Kohana::DEVELOPMENT;
                break;
            case 'test':
                Kohana::$environment = Kohana::TESTING;
                break;
            case 'prod':
                Kohana::$environment = Kohana::PRODUCTION;
                break;
            default:
                throw new Exception('Unknown database.');
        }
        while (TRUE) {
            $this->setup();
            self::display();
            self::display('Current DB version is ' . ($this->current_version ?: 'NULL') . '. Latest version is ' . $this->latest_version . ".\n");
            self::display('z) Update to latest version considering applied versions.
c) See description of new versions.
m) Mark as applied
r) Run specific migration (advanced)
d) Create skeleton version file.
x) Exit

Choose option ==> ', FALSE);
            $input = trim(fgets(STDIN));
            switch ($input) {
                case 'x':
                    return;
                    break;
                case 'z':
                    // Update to a version considering applied migrations
                    $this->apply_migrations();
                    return;
                    break;
                case 'c':
                    self::display();
                    $not_applied = $this->get_not_applied_versions();
                    foreach ($not_applied as $version => $file) {
                        require_once $file;
                        $class = 'C' . $version;
                        $c = new $class();
                        self::display('Version ' . $version . ': ' . $c->desc . "\n");
                        foreach ($c->sqls as $sql) {
                            self::display(trim($sql));
                        }
                        self::display();
                        self::display('-------------------------------------------------');
                    }
                    break;
                    // Create skeleton file for next version
                // Create skeleton file for next version
                case 'd':
                    $resp = Request::factory('/dbupdate/skel')->execute();
                    self::display($resp . '');
                    break;
                case 'm':
                    $this->mark_applied();
                    break;
                case 'r':
                    self::display("\nApply migration (ENTER to exit) ==> ", FALSE);
                    $input = trim(fgets(STDIN));
                    if ($input !== '') {
                        $versions = $this->get_versions();
                        if (array_key_exists($input, $versions)) {
                            $this->apply_migrations(array($input => $versions[$input]));
                        } else {
                            self::display("\nMigration: " . $input . ' does not exist!', 'red');
                        }
                    }
                    break;
            }
        }
    }
示例#16
0
I18n::lang('en-us');
/**
 * Set Kohana::$environment if a 'KOHANA_ENV' environment variable has been supplied.
 *
 * Note: If you supply an invalid environment name, a PHP warning will be thrown
 * saying "Couldn't find constant Kohana::<INVALID_ENV_NAME>"
 */
switch (Arr::get($_SERVER, 'SERVER_ADDR')) {
    case Arr::get($_SERVER, 'REMOTE_ADDR'):
        Kohana::$environment = KOHANA::TESTING;
        break;
    default:
        Kohana::$environment = KOHANA::PRODUCTION;
        break;
}
Kohana::$environment = KOHANA::PRODUCTION;
/**
 * Initialize Kohana, setting the default options.
 *
 * The following options are available:
 *
 * - string   base_url    path, and optionally domain, of your application   NULL
 * - string   index_file  name of your index file, usually "index.php"       index.php
 * - string   charset     internal character set used for input and output   utf-8
 * - string   cache_dir   set the internal cache directory                   APPPATH/cache
 * - boolean  errors      enable or disable error handling                   TRUE
 * - boolean  profile     enable or disable internal profiling               TRUE
 * - boolean  caching     enable or disable internal caching                 FALSE
 */
Kohana::init(array('base_url' => '/', 'index_file' => false, 'errors' => true, 'profiling' => Kohana::$environment == KOHANA::DEVELOPMENT, 'caching' => Kohana::$environment == KOHANA::PRODUCTION));
/**
示例#17
0
 * @see  http://php.net/spl_autoload_call
 * @see  http://php.net/manual/var.configuration.php#unserialize-callback-func
 */
ini_set('unserialize_callback_func', 'spl_autoload_call');
// -- Configuration and initialization -----------------------------------------
/**
 * Set the default language
 */
I18n::lang('en-us');
/**
 * Set Kohana::$environment if a 'KOHANA_ENV' environment variable has been supplied.
 *
 * Note: If you supply an invalid environment name, a PHP warning will be thrown
 * saying "Couldn't find constant Kohana::<INVALID_ENV_NAME>"
 */
Kohana::$environment = isset($_SERVER['KOHANA_ENV']) ? constant('Kohana::' . strtoupper($_SERVER['KOHANA_ENV'])) : Kohana::PRODUCTION;
/**
 * Initialize Kohana, setting the default options.
 *
 * The following options are available:
 *
 * - string   base_url    path, and optionally domain, of your application   NULL
 * - string   index_file  name of your index file, usually "index.php"       index.php
 * - string   charset     internal character set used for input and output   utf-8
 * - string   cache_dir   set the internal cache directory                   APPPATH/cache
 * - boolean  errors      enable or disable error handling                   TRUE
 * - boolean  profile     enable or disable internal profiling               TRUE
 * - boolean  caching     enable or disable internal caching                 FALSE
 */
Kohana::init(array('base_url' => '/', 'index_file' => FALSE, 'errors' => Kohana::$environment !== Kohana::PRODUCTION, 'caching' => Kohana::$environment === Kohana::PRODUCTION));
Kohana::$log->attach(new Log_File(APPPATH . 'logs'));
示例#18
0
 * Enable the Kohana auto-loader for unserialization.
 *
 * @see  http://php.net/spl_autoload_call
 * @see  http://php.net/manual/var.configuration.php#unserialize-callback-func
 */
ini_set('unserialize_callback_func', 'spl_autoload_call');
//-- Configuration and initialization -----------------------------------------
/**
 * Set Kohana::$environment if $_ENV['KOHANA_ENV'] has been supplied.
 * 
 */
if (isset($_ENV['KOHANA_ENV'])) {
    Kohana::$environment = $_ENV['KOHANA_ENV'];
} else {
    if (isset($_SERVER['KOHANA_ENV'])) {
        Kohana::$environment = $_SERVER['KOHANA_ENV'];
    }
}
/**
 * Initialize Kohana, setting the default options.
 *
 * The following options are available:
 *
 * - string   base_url	  path, and optionally domain, of your application   NULL
 * - string   index_file  name of your index file, usually "index.php"	     index.php
 * - string   charset	  internal character set used for input and output   utf-8
 * - string   cache_dir   set the internal cache directory		     APPPATH/cache
 * - boolean  errors	  enable or disable error handling		     TRUE
 * - boolean  profile	  enable or disable internal profiling		     TRUE
 * - boolean  caching	  enable or disable internal caching		     FALSE
 */
示例#19
0
文件: bootstrap.php 项目: azuya/Wi3
/**
 * Enable the Kohana auto-loader for unserialization.
 *
 * @see  http://php.net/spl_autoload_call
 * @see  http://php.net/manual/var.configuration.php#unserialize-callback-func
 */
ini_set('unserialize_callback_func', 'spl_autoload_call');
//-- Configuration and initialization -----------------------------------------
/**
 * Safe settings for Cookies, so that they are only accessed through HTTP, and not by javascript (prevents XSS to a certain extent)
 */
//Cookie::$httponly = TRUE; // Unfortunately, the ACL doesn't like this when in an AJAX call... Real weird, but anyways...!
/**
 * Set the environment string by the domain (defaults to Kohana::DEVELOPMENT).
 */
Kohana::$environment = ($_SERVER['SERVER_NAME'] !== 'localhost' and $_SERVER['SERVER_NAME'] !== '127.0.0.1') ? Kohana::PRODUCTION : Kohana::DEVELOPMENT;
/**
 * Initialize Kohana based on the environment, setting the default options.
 *
 * The following options are available:
 *
 * - string   base_url    path, and optionally domain, of your application   NULL
 * - string   index_file  name of your index file, usually "index.php"       index.php
 * - string   charset     internal character set used for input and output   utf-8
 * - string   cache_dir   set the internal cache directory                   APPPATH/cache
 * - boolean  errors      enable or disable error handling                   TRUE
 * - boolean  profile     enable or disable internal profiling               TRUE
 * - boolean  caching     enable or disable internal caching                 FALSE
 */
Kohana::init(array('base_url' => substr($_SERVER["PHP_SELF"], 0, strpos($_SERVER["PHP_SELF"], "index.php")), 'index_file' => FALSE, 'profile' => Kohana::$environment !== Kohana::PRODUCTION, 'caching' => FALSE));
/**
示例#20
0
<?php

defined('SYSPATH') or die('No direct script access.');
$_SERVER['REMOTE_ADDR'] == '127.0.0.1' ? Kohana::$environment = Kohana::DEVELOPMENT : (Kohana::$environment = Kohana::PRODUCTION);
//Kohana::$environment = Kohana::PRODUCTION;
// Псевдоним URL для входа админку
define('ADMIN', 'admin');
// Разделитель в заголовке окна браузера
define('SEPARATOR', ' – ');
// Тире для отступа в <select>
define('NDASH_SELECT', '&ndash;&nbsp;&nbsp;');
define('MDASH_SELECT', '&mdash;&nbsp;&nbsp;');
// Папка для загрузки
define('UPLOAD_DIR', DOCROOT . 'uploads' . DS);
define('UPLOAD_URL', '/uploads/');
// Bootstrap config
return ['modules' => ['cms_settings' => APPPATH . 'modules/settings', 'cms_dashboard' => APPPATH . 'modules/dashboard', 'cms_home' => APPPATH . 'modules/home', 'cms_user' => APPPATH . 'modules/user', 'cms_shop' => APPPATH . 'modules/shop', 'cms_blog' => APPPATH . 'modules/blog', 'cms_publications' => APPPATH . 'modules/publications', 'cms_tags' => APPPATH . 'modules/tags', 'cms_contact' => APPPATH . 'modules/contact', 'cms_static' => APPPATH . 'modules/static', 'auth' => MODPATH . 'auth', 'cache' => MODPATH . 'cache', 'database' => MODPATH . 'database', 'orm' => MODPATH . 'orm', 'pagination' => MODPATH . 'pagination'], 'init' => ['server_name' => $_SERVER['REMOTE_ADDR'] == '127.0.0.1' ? 'http://amkocms.dev' : 'http://amkocms.kosmopoisk.ks.ua', 'base_url' => '/', 'index_file' => false, 'cache_dir' => APPPATH . 'cache', 'cache_life' => Date::MINUTE * 10, 'errors' => Kohana::$environment !== Kohana::PRODUCTION, 'profile' => Kohana::$environment !== Kohana::PRODUCTION, 'caching' => Kohana::$environment === Kohana::PRODUCTION, 'expose' => false], 'cookie' => ['salt' => '123ihiXHmQBtYElxQvtIrgDmuNCQOcPQhE9vlZ9457ZZxYjEjqJbP7z65ILGDGA', 'expiration' => Date::WEEK, 'domain' => null, 'path' => '/', 'httponly' => false, 'secure' => false], 'encrypt' => 'hakunamatata'];
示例#21
0
 * - string   base_url    path, and optionally domain, of your application   NULL
 * - string   index_file  name of your index file, usually "index.php"       index.php
 * - string   charset     internal character set used for input and output   utf-8
 * - string   cache_dir   set the internal cache directory                   APPPATH/cache
 * - integer  cache_life  lifetime, in seconds, of items cached              60
 * - boolean  errors      enable or disable error handling                   TRUE
 * - boolean  profile     enable or disable internal profiling               TRUE
 * - boolean  caching     enable or disable internal caching                 FALSE
 * - boolean  expose      set the X-Powered-By header                        FALSE
 */
//COOKIE settings
Cookie::$salt = 'Shugar123';
Cookie::$expiration = Date::WEEK;
// Время жизни cookie — неделя
//Development activate
Kohana::$environment = Kohana::DEVELOPMENT;
Kohana::init(array('base_url' => 'http://palto66.ru', 'index_file' => FALSE, 'charset' => 'utf-8', 'profile' => Kohana::$environment === Kohana::DEVELOPMENT, 'caching' => Kohana::$environment === Kohana::PRODUCTION));
/**
 * Attach the file write to logging. Multiple writers are supported.
 */
Kohana::$log->attach(new Log_File(APPPATH . 'logs'));
/**
 * Attach a file reader to config. Multiple readers are supported.
 */
Kohana::$config->attach(new Config_File());
/**
 * Enable modules. Modules are referenced by a relative or absolute path.
 */
Kohana::modules(array('auth' => MODPATH . 'auth', 'database' => MODPATH . 'database', 'orm' => MODPATH . 'orm'));
/**
 * Set the routes. Each route must have a minimum of a name, a URI and a set of
示例#22
0
 * @see  http://docs.kohanaphp.com/about.configuration
 * @see  http://php.net/timezones
 */
date_default_timezone_set('Europe/London');
/**
 * Set the default locale.
 *
 * @see  http://docs.kohanaphp.com/about.configuration
 * @see  http://php.net/setlocale
 */
setlocale(LC_ALL, 'en_GB.utf-8');
/**
 * Set the production status by the ip address.
 */
define('IN_PRODUCTION', $_SERVER['SERVER_ADDR'] !== '127.0.0.1');
Kohana::$environment = 'development';
//Kohana::$environment = 'deploy';
/**
 * Enable the Kohana auto-loader.
 *
 * @see  http://docs.kohanaphp.com/about.autoloading
 * @see  http://php.net/spl_autoload_register
 */
spl_autoload_register(array('Kohana', 'auto_load'));
/**
 * Enable the Kohana auto-loader for unserialization.
 *
 * @see  http://php.net/spl_autoload_call
 * @see  http://php.net/manual/var.configuration.php#unserialize-callback-func
 */
ini_set('unserialize_callback_func', 'spl_autoload_call');
示例#23
0
ini_set('unserialize_callback_func', 'spl_autoload_call');
// -- Configuration and initialization -----------------------------------------
// Autoload Composer Packages
require __DIR__ . '/../vendor/autoload.php';
/**
 * Set the default language
 */
I18n::lang('en-us');
/**
 * Set Kohana::$environment if a 'KOHANA_ENV' environment variable has been supplied.
 *
 * Note: If you supply an invalid environment name, a PHP warning will be thrown
 * saying "Couldn't find constant Kohana::<INVALID_ENV_NAME>"
 */
if (isset($_SERVER["KOHANA_ENV"])) {
    Kohana::$environment = constant("Kohana::" . strtoupper($_SERVER["KOHANA_ENV"]));
}
/**
 * Initialize Kohana, setting the default options.
 *
 * The following options are available:
 *
 * - string   base_url    path, and optionally domain, of your application   NULL
 * - string   index_file  name of your index file, usually "index.php"       index.php
 * - string   charset     internal character set used for input and output   utf-8
 * - string   cache_dir   set the internal cache directory                   APPPATH/cache
 * - boolean  errors      enable or disable error handling                   TRUE
 * - boolean  profile     enable or disable internal profiling               TRUE
 * - boolean  caching     enable or disable internal caching                 FALSE
 */
Kohana::init(array('base_url' => '', 'profile' => TRUE, 'index_file' => FALSE, 'caching' => TRUE, 'errors' => TRUE));
示例#24
0
<?php

spl_autoload_register(function ($class) {
    $file = __DIR__ . DIRECTORY_SEPARATOR . 'classes' . DIRECTORY_SEPARATOR . str_replace('_', '/', $class) . '.php';
    if (is_file($file)) {
        require_once $file;
    }
});
require_once __DIR__ . '/../vendor/autoload.php';
Kohana::modules(array('database' => MODPATH . 'database', 'jam' => __DIR__ . '/../modules/jam', 'jam-closuretable' => __DIR__ . '/../modules/jam-closuretable', 'template-module' => __DIR__ . '/..'));
Kohana::$config->load('database')->set('default', array('type' => 'PDO', 'connection' => array('dsn' => 'mysql:dbname=test-jam-locations;host=127.0.0.1', 'username' => 'root', 'password' => '', 'persistent' => TRUE), 'table_prefix' => '', 'charset' => 'utf8', 'caching' => FALSE));
Kohana::$environment = Kohana::TESTING;
示例#25
0
I18n::lang('en-us');
/**
 * Add response message for HTTP 422
 */
Kohana_Response::$messages[422] = 'Unprocessable Entity';
/**
 * Set Kohana::$environment if a 'KOHANA_ENV' environment variable has been supplied.
 *
 * Note: If you supply an invalid environment name 'development' will be used instead
 */
if (($env = getenv('KOHANA_ENV')) === FALSE or defined('Kohana::' . strtoupper($env)) === FALSE) {
    $env = 'development';
}
// Ignoring code standards error about constant case
// @codingStandardsIgnoreStart
Kohana::$environment = constant('Kohana::' . strtoupper($env));
// @codingStandardsIgnoreEnd
/**
 * Attach a file reader to config. Multiple readers are supported.
 */
Kohana::$config = new Config();
Kohana::$config->attach(new Config_File());
/**
 * Attach the environment specific configuration file reader to config
 */
Kohana::$config->attach(new Config_File('config/environments/' . $env));
/**
 * Initialize Kohana, setting the default options.
 */
Kohana::init(Kohana::$config->load('init')->as_array());
/**
示例#26
0
 * Set Kohana::$environment if a 'GLEEZ_ENV' environment variable has been supplied.
 *
 * @todo In the future Kohana::$environment should be moved to Gleez Core as Gleez::$environment
 *
 * @link https://github.com/gleez/cms/wiki/Apache
 * @link https://github.com/gleez/cms/wiki/Nginx
 */
if (isset($_SERVER['GLEEZ_ENV'])) {
    // Get environment variable from $_SERVER, .htaccess, apache.conf, nginx.conf, etc.
    $env = 'Kohana::' . strtoupper($_SERVER['GLEEZ_ENV']);
} elseif (get_cfg_var('GLEEZ_ENV')) {
    // Get environment variable from php.ini or from ini_get('user_ini.filename')
    $env = 'Kohana::' . strtoupper(get_cfg_var('GLEEZ_ENV'));
}
if (isset($env)) {
    defined($env) and Kohana::$environment = constant($env);
    unset($env);
}
/**
 * Initialize Kohana, setting the default options.
 *
 * The following options are available:
 *
 * - string   base_url    path, and optionally domain, of your application   NULL
 * - string   index_file  name of your index file, usually "index.php"       index.php
 * - string   charset     internal character set used for input and output   utf-8
 * - string   cache_dir   set the internal cache directory                   APPPATH/cache
 * - boolean  errors      enable or disable error handling                   TRUE
 * - boolean  profile     enable or disable internal profiling               TRUE
 * - boolean  caching     enable or disable internal caching                 FALSE
 * - boolean  autolocale  enable or disable autodetect locale                TRUE
示例#27
0
    // Replace the default protocol.
    HTTP::$protocol = $_SERVER['SERVER_PROTOCOL'];
}
/**
 * Set Kohana::$environment if a 'KOHANA_ENV' environment variable has been supplied.
 *
 * Note: If you supply an invalid environment name, a PHP warning will be thrown
 * saying "Couldn't find constant Kohana::<INVALID_ENV_NAME>"
 */
/**
 * 设置运行环境,可以为PRODUCTION、STAGING、TESTING、DEVELOPMENT中的任一个,默认为DEVELOPMENT
 */
if (!isset($_SERVER['ENVIRONMENT'])) {
    $_SERVER['ENVIRONMENT'] = 'development';
}
Kohana::$environment = constant('Kohana::' . strtoupper($_SERVER['ENVIRONMENT']));
/**
 * Initialize Kohana, setting the default options.
 *
 * The following options are available:
 *
 * - string   base_url    path, and optionally domain, of your application   NULL
 * - string   index_file  name of your index file, usually "index.php"       index.php
 * - string   charset     internal character set used for input and output   utf-8
 * - string   cache_dir   set the internal cache directory                   APPPATH/cache
 * - integer  cache_life  lifetime, in seconds, of items cached              60
 * - boolean  errors      enable or disable error handling                   TRUE
 * - boolean  profile     enable or disable internal profiling               TRUE
 * - boolean  caching     enable or disable internal caching                 FALSE
 * - boolean  expose      set the X-Powered-By header                        FALSE
 */