public function before() { parent::before(); I18n::lang('ru'); Cookie::$salt = 'eqw67dakbs'; Session::$default = 'cookie'; //$this->cache = Cache::instance('file'); $this->session = Session::instance(); $this->auth = Auth::instance(); $this->user = $this->auth->get_user(); // $captcha = Captcha::instance(); // Подключаем стили и скрипты $this->template->styles = array(); $this->template->scripts = array(); //Вывод в шаблон $this->template->title = null; $this->template->site_name = null; $this->template->description = null; $this->template->page_title = null; //Подключаем главный шаблон $this->template->main = null; $this->template->userarea = null; $this->template->top_menu = View::factory('v_top_menu'); $this->template->manufactures = null; $this->template->left_categories = null; $this->template->slider_banner = null; $this->template->block_left = array(); $this->template->block_center = array(); $this->template->block_right = array(); $this->template->block_footer = null; }
/** * * Initializes configs for the APP to run */ public static function initialize() { /** * Load all the configs from DB */ //Change the default cache system, based on your config /config/cache.php Cache::$default = Core::config('cache.default'); //is not loaded yet in Kohana::$config Kohana::$config->attach(new ConfigDB(), FALSE); //overwrite default Kohana init configs. Kohana::$base_url = Core::config('general.base_url'); //enables friendly url @todo from config Kohana::$index_file = FALSE; //cookie salt for the app Cookie::$salt = Core::config('auth.cookie_salt'); /* if (empty(Cookie::$salt)) { // @TODO missing cookie salt : add warning message } */ // -- i18n Configuration and initialization ----------------------------------------- I18n::initialize(Core::config('i18n.locale'), Core::config('i18n.charset')); //Loading the OC Routes // if (($init_routes = Kohana::find_file('config','routes'))) // require_once $init_routes[0];//returns array of files but we need only 1 file //faster loading require_once APPPATH . 'config/routes.php'; //getting the selected theme, and loading options Theme::initialize(); }
/** * Provides test data for test_get() * * @return array */ public function provider_get() { // setUp is called after the provider so we need to specify a // salt here in order to use it in the provider Cookie::$salt = $this->_default_salt; return array(array('foo', Cookie::salt('foo', 'bar') . '~bar', 'bar'), array('bar', Cookie::salt('foo', 'bar') . '~bar', NULL), array(NULL, Cookie::salt('foo', 'bar') . '~bar', NULL)); }
/** * Application initialization * - Loads the plugins * - Sets the cookie configuration */ public static function init() { // Set defaule cache configuration Cache::$default = Kohana::$config->load('site')->get('default_cache'); try { $cache = Cache::instance()->get('dummy' . rand(0, 99)); } catch (Exception $e) { // Use the dummy driver Cache::$default = 'dummy'; } // Load the plugins Swiftriver_Plugins::load(); // Add the current default theme to the list of modules $theme = Swiftriver::get_setting('site_theme'); if (isset($theme) and $theme != "default") { Kohana::modules(array_merge(array('themes/' . $theme->value => THEMEPATH . $theme->value), Kohana::modules())); } // Clean up unset($active_plugins, $theme); // Load the cookie configuration $cookie_config = Kohana::$config->load('cookie'); Cookie::$httponly = TRUE; Cookie::$salt = $cookie_config->get('salt', Swiftriver::DEFAULT_COOKIE_SALT); Cookie::$domain = $cookie_config->get('domain') or ''; Cookie::$secure = $cookie_config->get('secure') or FALSE; Cookie::$expiration = $cookie_config->get('expiration') or 0; // Set the default site locale I18n::$lang = Swiftriver::get_setting('site_locale'); }
/** * * Initializes configs for the APP to run */ public static function initialize() { //enables friendly url Kohana::$index_file = FALSE; //temporary cookie salt in case of exception Cookie::$salt = 'cookie_oc_temp'; //Change the default cache system, based on your config /config/cache.php Cache::$default = Core::config('cache.default'); //loading configs from table config //is not loaded yet in Kohana::$config Kohana::$config->attach(new ConfigDB(), FALSE); //overwrite default Kohana init configs. Kohana::$base_url = Core::config('general.base_url'); //cookie salt for the app Cookie::$salt = Core::config('auth.cookie_salt'); // i18n Configuration and initialization I18n::initialize(Core::config('i18n.locale'), Core::config('i18n.charset')); //Loading the OC Routes require_once APPPATH . 'config/routes.php'; //getting the selected theme, and loading options Theme::initialize(); //run crontab if (core::config('general.cron') == TRUE) { Cron::run(); } }
/** * Provides test data for test_get() * * @return array */ public function provider_get() { return array( array('foo', Cookie::salt('foo', 'bar').'~bar', 'bar'), array('bar', Cookie::salt('foo', 'bar').'~bar', NULL), array(NULL, Cookie::salt('foo', 'bar').'~bar', NULL), ); }
public static function set($name, $value, $lifetime = NULL) { if ($lifetime === NULL) { $lifetime = Cookie::$expiration; } if ($lifetime !== 0) { $lifetime += static::_time(); } $value = Cookie::salt($name, $value) . "~" . $value; return static::_setcookie($name, $value, $lifetime, Cookie::$path, Cookie::$domain, Cookie::$secure, Cookie::$httponly); }
public static function set($name, $value, $expiration = null) { if ($expiration === null) { $expiration = Cookie::$expiration; } if ($expiration !== 0) { $expiration += time(); } $value = Cookie::salt($name, $value) . '~' . $value; return setcookie($name, $value, $expiration, Cookie::$path, Cookie::$domain, Cookie::$secure, Cookie::$httponly); }
/** * Sets a signed cookie. Note that all cookie values must be strings and no * automatic serialization will be performed! * * @param string name of cookie * @param string value of cookie * @param integer lifetime in seconds * @return boolean */ public static function set($name, $value, $expiration = NULL) { if ($expiration === NULL) { // Use the default expiration $expiration = Cookie::$expiration; } if ($expiration !== 0) { // The expiration is expected to be a UNIX timestamp $expiration += time(); } // Add the salt to the cookie value $value = Cookie::salt($name, $value) . '~' . $value; return setcookie($name, $value, $expiration, Cookie::$path, Cookie::$domain, Cookie::$secure, Cookie::$httponly); }
public static function set($name, $value, $lifetime = null, $domain = null) { if ($lifetime === null) { $lifetime = Cookie::$expiration; } if ($lifetime !== 0) { $lifetime += time(); } if ($domain !== null) { Cookie::$domain = $domain; } $value = Cookie::salt($name, $value) . '~' . $value; return setcookie($name, $value, $lifetime, Cookie::$path, Cookie::$domain, Cookie::$secure, Cookie::$httponly); }
/** * Prepares the Kohana_Reponse object for * caching to nginx. This requires the object * to be flattened to a standard HTTP response * including full headers. * * // Creates a full HTTP valid response * $this->_create_nginx_cache($response); * * @param Kohana_Response response * @return string */ protected function _create_nginx_cache(Kohana_Response $response) { // Create empty cache buffer $cache = ''; // Generate HTTP header foreach ($response->headers as $key => $value) { $cache .= "{$key}: {$value}\n"; } // Check for HTTPS and secure cookie setting if (empty($_SERVER['HTTPS']) and !Cookie::$secure) { // Get the response cookies $cookies = $response->get_cookies(); // Generate cookies foreach ($cookies as $name => $value) { $cache .= 'Set-Cookie: ' . $name . '=' . Cookie::salt($name, $value['value']) . '~' . $value['value'] . '; expires: ' . gmdate('D, d M Y H:i:s T', $value['expiration']) . '; path: ' . Cookie::$path . '; domain: ' . Cookie::$domain . (Cookie::$httponly ? '; httpOnly' : '') . "\n"; } } // Create HTTP body $cache .= "\n" . $response->body; return $cache; }
public function before() { parent::before(); I18n::lang('ru'); Cookie::$salt = 'eqw67dakbs'; Session::$default = 'cookie'; // $this->cache = Cache::instance('file'); $this->session = Session::instance(); $this->auth = Auth::instance(); $this->user = $this->auth->get_user(); //Вывод в шаблон $this->template->title = ''; $this->template->page_title = ''; // Подключаем стили и скрипты $this->template->styles = array(); $this->template->scripts = array(); //Подключаем блоки $this->template->admin_menu = null; $this->template->admin_info = null; $this->template->block_left = null; $this->template->block_center = null; $this->template->block_right = null; }
/** * 设置Cookie * * @param string $name Cookie名称 * @param string $value Cookie值 * @param integer $expiration 过期时间(单位:秒) * @return boolean * @uses Cookie::salt */ public static function set($key, $value, $expiration = NULL, $path = '/', $domain = null) { if (headers_sent()) { return false; } if (!self::$config) { self::$config = C('cookie'); } if ($value == '') { $expiration = TIME - 86400; } else { if ($expiration === NULL) { $expiration = self::$config['expiration']; } elseif ($expiration !== 0) { $expiration += TIME; } } $_COOKIE[$key] = $value; $secure = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 1 : 0; // Value加盐 $value = Cookie::salt($key, $value) . '~' . $value; return setcookie(self::$config['prefix'] . $key, base64_encode($value), $expiration, $path, $domain, $secure); }
* - 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()); /** * Enable modules. Modules are referenced by a relative or absolute path. */ Kohana::modules(array('auth' => MODPATH . 'auth', 'database' => MODPATH . 'database', 'orm' => MODPATH . 'orm')); if (Kohana::$environment === Kohana::DEVELOPMENT) { Database::$default = 'dev'; } else {
*/ 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('cache' => MODPATH . 'cache', 'database' => MODPATH . 'database', 'image' => MODPATH . 'image', 'orm' => MODPATH . 'orm', 'paypal' => MODPATH . 'paypal', 'kandler' => MODPATH . 'kandler', 'email' => MODPATH . 'email', 'pagination' => MODPATH . 'pagination', 'sitemap' => MODPATH . 'sitemap', 'amazon' => MODPATH . 'amazon')); /** * Cache */ Kohana::$caching = TRUE; Cache::$default = 'apc'; /** * Set the routes. Each route must have a minimum of a name, a URI and a set of * defaults for the URI. */ // Default route Route::set('default', '(<controller>(/<action>(/<id>)))')->defaults(array('controller' => 'ads', 'action' => 'home')); // Error route Route::set('error', 'error/<action>(/<message>)', array('action' => '[0-9]++', 'message' => '.+'))->defaults(array('controller' => 'error_handler')); /** * Cookie configuration settings */ Cookie::$salt = 'ASJ12094X:F?!*!*AD'; Cookie::$expiration = Date::MONTH; Cookie::$httponly = TRUE; Cookie::$secure = isset($_SERVER["HTTPS"]); Cookie::$domain = '.gowork.at';
* * 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' => '/')); /** * 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 * defaults for the URI. */ Route::set('default', '(<controller>(/<action>(/<id>)))')->defaults(array('controller' => 'home', 'action' => 'index')); Cookie::$salt = 'JFILD&)($#hjsp8y3hF';
define('PUBLIC_URL', BASE_URL . 'public/'); /** * Set the default time zone. * * @see http://kohanaframework.org/guide/using.configuration * @see http://php.net/timezones */ date_default_timezone_set(DEFAULT_TIMEZONE); /** * Cookie Salt * @see http://kohanaframework.org/3.3/guide/kohana/cookies * * If you have not defined a cookie salt in your Cookie class then * uncomment the line below and define a preferrably long salt. */ Cookie::$salt = COOKIE_SALT; /** * Set the default session type */ Session::$default = SESSION_TYPE; /** * Enable modules. Modules are referenced by a relative or absolute path. */ Kohana::modules(array('users' => MODPATH . 'users', 'kodicms' => MODPATH . 'kodicms', 'assets' => MODPATH . 'assets', 'cache' => MODPATH . 'cache', 'database' => MODPATH . 'database', 'logs' => MODPATH . 'logs', 'auth' => MODPATH . 'auth', 'orm' => MODPATH . 'orm', 'oauth' => MODPATH . 'oauth', 'minion' => MODPATH . 'minion', 'pagination' => MODPATH . 'pagination', 'email' => MODPATH . 'email', 'email_queue' => MODPATH . 'email_queue', 'filesystem' => MODPATH . 'filesystem', 'image' => MODPATH . 'image', 'scheduler' => MODPATH . 'scheduler', 'snippet' => MODPATH . 'snippet', 'pages' => MODPATH . 'pages', 'page_parts' => MODPATH . 'page_parts', 'tags' => MODPATH . 'tags', 'widget' => MODPATH . 'widget', 'reflinks' => MODPATH . 'reflinks', 'elfinder' => MODPATH . 'elfinder', 'api' => MODPATH . 'api', 'navigation' => MODPATH . 'navigation', 'breadcrumbs' => MODPATH . 'breadcrumbs', 'behavior' => MODPATH . 'behavior', 'plugins' => MODPATH . 'plugins', 'datasource' => MODPATH . 'datasource', 'search' => MODPATH . 'search', 'sidebar' => MODPATH . 'sidebar', 'update' => MODPATH . 'update', 'captcha' => MODPATH . 'captcha', 'dashboard' => MODPATH . 'dashboard')); Kohana::$config->attach(new Config_Database()); Observer::notify('modules::after_load'); Kohana::$log->attach(new Log_Database('logs')); Route::set('user', ADMIN_DIR_NAME . '/<action>(?next=<next_url>)', array('action' => '(login|logout|forgot)'))->defaults(array('controller' => 'login')); Route::set('templates', ADMIN_DIR_NAME . '/(<controller>(/<action>(/<id>)))', array('controller' => '(layout|snippet)', 'id' => '.*'))->defaults(array('controller' => 'index', 'action' => 'index')); Route::set('downloader', '(' . ADMIN_DIR_NAME . '/)download/<path>', array('path' => '.*'))->defaults(array('directory' => 'system', 'controller' => 'download', 'action' => 'index')); Route::set('backend', ADMIN_DIR_NAME . '(/<controller>(/<action>(/<id>)))')->defaults(array('controller' => 'dashboard', 'action' => 'index'));
* * - 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 */ Kohana::init(array('base_url' => '/dupari.com/', 'index_file' => FALSE)); /** * 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', 'userguide' => MODPATH . 'userguide')); /** * Set the routes. Each route must have a minimum of a name, a URI and a set of * defaults for the URI. */ Cookie::$salt = 'dupari'; Route::set('auth', 'cgi-bin(/<controller>(/<action>(/<par1>(<par2>))))')->defaults(array('directory' => 'Auth', 'controller' => 'auth', 'action' => 'index')); Route::set('default', '(<controller>(/<action>(/<par1>(<par2>))))')->defaults(array('controller' => 'welcome', 'action' => 'index'));
* 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 */ Kohana::init(array('errors' => true, 'base_url' => '/', 'index_file' => false)); Cookie::$salt = 'asdahsdfzfcsEERfAf'; Cookie::$httponly = TRUE; Cookie::$expiration = Date::WEEK; /** * 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('oauth' => MODPATH . 'oauth', 'cache' => MODPATH . 'cache', 'database' => MODPATH . 'database', 'image' => MODPATH . 'image', 'minion' => MODPATH . 'minion', 'orm' => MODPATH . 'orm', 'unittest' => MODPATH . 'unittest')); require APPPATH . 'routes' . EXT;
*/ Kohana::init(array('base_url' => '/', 'index_file' => FALSE)); /** * 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('database' => MODPATH . 'database', 'pagination' => MODPATH . 'pagination')); /** * Cookie Salt * @see http://kohanaframework.org/3.3/guide/kohana/cookies * * If you have not defined a cookie salt in your Cookie class then * uncomment the line below and define a preferrably long salt. */ Cookie::$salt = "r832rn233"; /** * Set the routes. Each route must have a minimum of a name, a URI and a set of * defaults for the URI. */ Route::set('search', '<action>', array('action' => 'search'))->defaults(array('controller' => 'Basic', 'action' => 'search')); Route::set('menu', '<action>', array('action' => 'list_services|pricelist|regulations|charter|goals_and_objectives|structure|general_information|population|vacancies|nocorruption|quality|contacts|employees|questionnaire'))->defaults(array('controller' => 'Menu')); Route::set('pagination_forum', 'forum(/<page>)', array('page' => '[0-9]+'))->defaults(array('controller' => 'Menu', 'action' => 'forum')); Route::set('page_news', 'news(/<id>.html)', array('id' => '.+'))->defaults(array('controller' => 'Menu', 'action' => 'news')); Route::set('default', '(<controller>(/<action>(/<id>)))')->defaults(array('controller' => 'Basic', 'action' => 'index'));
// Set default language I18n::lang(Kohana::$config->load('locale.language')); /* * ------------------------------------------------------------ * Logs * ------------------------------------------------------------ */ // Attach the file write to logging. Multiple writers are supported. Kohana::$log->attach(new Log_File(APPPATH . 'logs')); /* * ------------------------------------------------------------ * Cookies & Session * ------------------------------------------------------------ */ // Set cookie salt Cookie::$salt = Kohana::$config->load('cookie.salt'); // Set default session type Session::$default = Kohana::$config->load('session.type'); /* * ------------------------------------------------------------ * Backend Directory * ------------------------------------------------------------ */ // Define it here allows access from routes & modules define('BACKEND_DIR_NAME', 'backend'); /* * ------------------------------------------------------------ * Load default routes * ------------------------------------------------------------ */ require APPPATH . 'config' . DIRECTORY_SEPARATOR . 'routes' . EXT;
*/ Kohana::init(array('base_url' => '/', 'index_file' => FALSE)); /** * 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', 'cache' => MODPATH . 'cache', 'database' => MODPATH . 'database', 'image' => MODPATH . 'image', 'orm' => MODPATH . 'orm', 'cms' => MODPATH . 'cms')); /** * Set the routes. Each route must have a minimum of a name, a URI and a set of * defaults for the URI. */ Route::set('default', '(<controller>(/<action>(/<id>)))')->defaults(array('controller' => 'welcome', 'action' => 'index')); /** * Cookie Salt * @see http://kohanaframework.org/3.2/guide/kohana/cookies * * If you have not defined a cookie salt in your Cookie class then * Uncomment the line below and define a salt for the Cookie. */ // Cookie::$salt = NULL; Cookie::$salt = 'pavelpo'; //if(Kohana::$environment == Kohana::DEVELOPMENT){ // Auth::instance()->force_login('pavel'); //}
* - 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 */ Kohana::init(array('base_url' => '/kohana/')); /** * 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()); Cookie::$salt = 'vFkdZeP74127asfNT'; // Please don't change this option at the work site Cookie::$expiration = 1209600; // 1209600 - 2 weeks /** * Enable modules. Modules are referenced by a relative or absolute path. */ Kohana::modules(array('parsers' => MODPATH . 'parsers')); /** * Cookie Salt * @see http://kohanaframework.org/3.3/guide/kohana/cookies * * If you have not defined a cookie salt in your Cookie class then * uncomment the line below and define a preferrably long salt. */ // Cookie::$salt = NULL;
* @link http://www.php.net/manual/function.spl-autoload-call * @link http://www.php.net/manual/var.configuration#unserialize-callback-func */ ini_set('unserialize_callback_func', 'spl_autoload_call'); /** * Set the mb_substitute_character to "none" * * @link http://www.php.net/manual/function.mb-substitute-character.php */ mb_substitute_character('none'); // -- Configuration and initialization ----------------------------------------- /** * Set the default language */ I18n::lang('en-us'); Cookie::$salt = '284e5f_15d5a'; 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'])); } /** * Initialize Kohana, setting the default options.
*/ # copy config/init.php.default to config/init.php Kohana::init(include APPPATH . 'config/init.php'); /** * 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()); /** * Cookie config. */ $cookie = Kohana::$config->load('cookie'); Cookie::$salt = $cookie->salt; Cookie::$expiration = $cookie->expiration; Cookie::$domain = $cookie->domain; Cookie::$path = $cookie->path; Cookie::$secure = $cookie->secure; Cookie::$httponly = $cookie->httponly; /** * Enable modules. Modules are referenced by a relative or absolute path. */ Kohana::modules(array()); /** * Set the routes. Each route must have a minimum of a name, a URI and a set of * defaults for the URI. */ Route::set('api', '<directory>(/<controller>(/<action>(/<params>)))', array('params' => '.*', 'directory' => '(v1|v2)'))->defaults(array('controller' => 'defaults', 'action' => 'index', 'directory' => 'v1')); Route::set('join', 'join')->defaults(array('controller' => 'auth', 'action' => 'join'));
* 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 */ Kohana::init(array('base_url' => '/', 'index_file' => FALSE, 'charset' => 'utf-8')); Cookie::$salt = '284e6f15a'; /** * 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', 'cache' => MODPATH . 'cache', 'database' => MODPATH . 'database', 'orm' => MODPATH . 'orm', 'captcha' => MODPATH . 'captcha', 'guestid' => MODPATH . 'guestid')); /** * Set the routes. Each route must have a minimum of a name, a URI and a set of * defaults for the URI.
*/ 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')); Route::set('content', 'content/<id>(/<seo_title>)', array('id' => '[\\d]+'))->defaults(array('controller' => 'Content', 'action' => 'index')); Route::set('avatar', 'user/avatar/<id>.jpg', array('id' => '[\\d]+'))->defaults(array('controller' => 'User', 'action' => 'avatar')); Route::set('dashboard', 'dashboard(/<id>)', array('id' => '[\\d]+'))->defaults(array('controller' => 'Dashboard', 'action' => 'index')); Route::set('lostpw', 'lostpw(/<restore_key>)')->defaults(array('controller' => 'user', 'action' => 'lostpw')); Route::set('admin', 'admin(/<controller>(/<action>(/<id>)))')->defaults(array('controller' => 'admin_admin', 'action' => 'index')); Route::set('feedback', 'feedback')->defaults(array('controller' => 'feedback', 'action' => 'index')); Route::set('user_register', 'register')->defaults(array('controller' => 'user', 'action' => 'register')); Route::set('user_login', 'login(/<state>)')->defaults(array('controller' => 'user', 'action' => 'login')); Route::set('user_logout', 'logout')->defaults(array('controller' => 'user', 'action' => 'logout'));
Kohana::init(array('base_url' => '/', 'index_file' => false)); /** * 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', 'image' => MODPATH . 'image', 'orm' => MODPATH . 'orm')); /** * Cookie Salt * @see http://kohanaframework.org/3.3/guide/kohana/cookies * * If you have not defined a cookie salt in your Cookie class then * uncomment the line below and define a preferrably long salt. */ Cookie::$salt = 'sanin'; /** * Set the routes. Each route must have a minimum of a name, a URI and a set of * defaults for the URI. */ Route::set('ajax', 'ajax(/<action>(/<id>))')->defaults(array('controller' => 'ajax')); Route::set('auth', '<action>', array('action' => 'login|logout|register'))->defaults(array('directory' => 'index', 'controller' => 'auth')); Route::set('page', '<path>.html', array('path' => '[a-zA-Z0-9_/]+'))->defaults(array('controller' => 'page', 'action' => 'index', 'directory' => 'index')); Route::set('admin', 'admin(/<controller>(/<action>(/<id>)))')->defaults(array('controller' => 'main', 'action' => 'index', 'directory' => 'admin')); Route::set('module', 'module(/<controller>(/<param>))', array('param' => '.+'))->defaults(array('action' => 'index', 'directory' => 'module')); Route::set('default', '(<controller>(/<action>(/<id>)))')->defaults(array('controller' => 'start', 'action' => 'index', 'directory' => 'index'));
* 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()); // preload configs Kohana::$config->load('constants'); Kohana::$config->load('app'); Kohana::$config->load('install'); Kohana::$config->load('database'); /** * Enable modules. Modules are referenced by a relative or absolute path. */ Cookie::$salt = 'jg2389h1sank5n1238asdw'; Kohana::modules(array('auth' => MODPATH . 'auth', 'profilertoolbar' => MODPATH . 'profilertoolbar', 'database' => MODPATH . 'database', 'orm' => MODPATH . 'orm')); /** * Set the routes. Each route must have a minimum of a name, a URI and a set of * defaults for the URI. */ Helper::set_language(); if (!Route::cache()) { Route::set('error', 'system/error(/<message>)', array('message' => '.+'))->defaults(array('directory' => 'system', 'controller' => 'error', 'action' => 'index')); // Системные контроллеры // Route::set( 'system', '<directory>-<controller>-<action>(/<id>)', array( // 'directory' => '(ajax|action)', // 'controller' => '[A-Za-z\_]+', // 'action' => '[A-Za-z\_]+', // 'id' => '.+', // ) )->defaults( array(
* * 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 */ Kohana::init(array('base_url' => '/', 'index_file' => FALSE, 'profile' => Kohana::$environment !== Kohana::PRODUCTION, 'caching' => Kohana::$environment === Kohana::PRODUCTION, 'cache_life' => 3600 * 24)); define('DONT_USE_CACHE', Kohana::$environment !== Kohana::PRODUCTION); define('FTP_UPLOAD', dirname(DOCROOT) . DIRECTORY_SEPARATOR . 'ftp_upload'); Cookie::$salt = 'btmem5sgcy4ydcu0j0fss1qwu7jx2aqm7wtrh4kf5v'; Route::$preview_salt = '10c4323c4f563c54a149ddbfdfc5c8eb' . date('y-m-d F l'); /** * 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', 'cache' => MODPATH . 'cache', 'database' => MODPATH . 'database', 'image' => MODPATH . 'image', 'orm' => MODPATH . 'orm', 'captcha' => MODPATH . 'captcha', 'acl' => MODPATH . 'wouterrr/acl', 'a1' => MODPATH . 'wouterrr/a1', 'a2' => MODPATH . 'wouterrr/a2', 'kohana-sitemap' => MODPATH . 'kohana-sitemap', 'greor-core' => MODPATH . 'greor/core', 'greor-email' => MODPATH . 'greor/email', 'greor-thumb' => MODPATH . 'greor/thumb', 'greor-orm-helper' => MODPATH . 'greor/orm-helper', 'greor-main' => MODPATH . 'greor/main')); Ku_Dir::$default_dir_chmod = 0775;