コード例 #1
0
ファイル: base.php プロジェクト: raku/mykohana
 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;
 }
コード例 #2
0
ファイル: Base.php プロジェクト: boltogriz/kohana
 public function before()
 {
     parent::before();
     I18n::lang('ru');
     //Cookie::$salt = 'assfr423dsf';
     Session::$default = 'cookie';
     $this->cache = Cache::instance('file');
     $this->auth = Auth::instance();
     $this->user = $this->auth->get_user();
     $this->session = Session::instance();
     $site_name = Kohana::$config->load('myconf.site_name');
     $site_description = Kohana::$config->load('myconf.site_description');
     $footer = Kohana::$config->load('myconf.footer');
     //Вывод в шаблон
     $this->template->site_name = $site_name;
     $this->template->site_description = $site_description;
     $this->template->page_title = null;
     $this->template->page_footer = $footer;
     //Подключение стилий и скриптов
     $this->template->styles = array('');
     $this->template->scripts = array();
     //Подключаем блоки
     $this->template->block_left = null;
     $this->template->block_center = null;
     $this->template->block_right = null;
     $this->template->block_headerRight = null;
 }
コード例 #3
0
ファイル: auth.php プロジェクト: greor/satin-spb
 public function before()
 {
     Session::$default = 'admin';
     $template = $this->template;
     $this->template = NULL;
     parent::before();
     if ($this->auto_render === TRUE) {
         $this->template = View_Admin::factory($template);
     }
     $this->acl = A2::instance('admin/a2');
     $this->config = Kohana::$config->load($this->config)->as_array();
 }
コード例 #4
0
ファイル: Base.php プロジェクト: ruslankus/invoice-crm
 public function before()
 {
     parent::before();
     $this->auth = Auth::instance();
     $this->user = $this->auth->get_user();
     Session::$default = 'native';
     $this->session = Session::instance();
     // подключаем стили и скрипты
     $this->template->styles = array('media/css/jquery-ui-1.9.2.custom.css', 'media/css/bootstrap.min.css', 'media/css/datepicker.css', '/media/css/style.css');
     $this->template->scripts = array('media/js/jquery-1.8.3.js', 'media/js/bootstrap.min.js', 'media/js/bootstrap-datepicker.js', 'media/js/main.js');
     $this->template->center = null;
 }
コード例 #5
0
ファイル: website.php プロジェクト: paulcinelli/kohanajobs
 /**
  * @return  void
  */
 public function before()
 {
     parent::before();
     // Start a session
     Session::$default = 'database';
     Session::instance();
     // Try to log in a user by cookie
     Auth::instance()->auto_login();
     if ($this->auto_render) {
         // Initialize default values
         $this->template->title = 'KohanaJobs v2';
         $this->template->content = '';
     }
 }
コード例 #6
0
ファイル: uploader.php プロジェクト: greor/satin-spb
 public function before()
 {
     Session::$default = 'admin';
     parent::before();
     $this->acl = A2::instance('admin/a2');
     if (!$this->acl->logged_in() or empty($_FILES['upload'])) {
         Request::initial()->redirect(Route::url('error', array('action' => '403')));
     }
     $this->user = $this->acl->get_user();
     $this->site_id = (int) Session::instance()->get('SITE_ID');
     if (empty($this->site_id)) {
         $this->site_id = (int) $this->user->site_id;
     }
 }
コード例 #7
0
 public static function init()
 {
     if (isset(Kohana::$environment)) {
         self::$env = Kohana::$environment;
     }
     Cache::$default = 'default';
     Sourcemap_JS::add_packages(isset(Kohana::config('js')->packages) ? Kohana::config('js')->packages : array());
     //Sourcemap_JS::$bundle = self::$env == self::DEV ? false : true;
     Sourcemap_JS::$bundle = false;
     Sourcemap_JS::$minified = self::$env == self::DEV ? false : true;
     Sourcemap_JS::$bundle_path = 'assets/scripts/bundles/' . self::site() . '/';
     Sourcemap_CSS::$convert_less = self::$env == self::DEV ? false : true;
     // Use db for session storage
     Session::$default = 'database';
 }
コード例 #8
0
ファイル: base.php プロジェクト: raku/mykohana
 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;
 }
コード例 #9
0
ファイル: bootstrap.php プロジェクト: deraemons/deraemon-cms
Kohana::init(array('base_url' => '/', 'caching' => TRUE, 'profile' => FALSE, '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', 'codebench' => MODPATH . 'codebench', 'database' => MODPATH . 'database', 'image' => MODPATH . 'image', 'minion' => MODPATH . 'minion', 'unittest' => MODPATH . 'unittest', 'userguide' => MODPATH . 'userguide', 'cms' => MODPATH . 'cms', 'tbl' => MODPATH . 'tbl', 'tpl' => MODPATH . 'tpl', 'pgn' => MODPATH . 'pgn', 'notice' => MODPATH . 'notice', 'email' => MODPATH . 'email', 'mysqli' => MODPATH . 'mysqli'));
/**
 * Get settings
 */
// Kohx
$settings = (object) Tbl::factory('settings')->read()->as_array('key', 'value');
// Set timezoon
date_default_timezone_set($settings->timezoon);
Cookie::$salt = $settings->cooki_salt;
Cookie::$expiration = Cms_Helper::sec($settings->cooki_expiration);
Session::$default = 'database';
/**
 * Set the routes. Each route must have a minimum of a name, a URI and a set of
 * defaults for the URI.
 */
// Kohx
Cms_Route::write();
// Default
Route::set('default', '(<controller>(/<action>(/<id>)))')->defaults(array('controller' => 'home', 'action' => 'index'));
コード例 #10
0
ファイル: base.php プロジェクト: greor/satin-spb
 public function before()
 {
     Session::$default = 'admin';
     ORM_Base::$filter_mode = ORM_Base::FILTER_BACKEND;
     if ($this->auto_render === TRUE) {
         $template = $this->template;
         $this->template = NULL;
         parent::before();
         $this->template = View_Admin::factory($template);
     } else {
         parent::before();
     }
     $this->init();
 }
コード例 #11
0
ファイル: gleez.php プロジェクト: ultimateprogramer/cms
 /**
  * Runs the Gleez environment
  *
  * @uses  Gleez::_set_cookie
  * @uses  Route::set
  * @uses  Route::defaults
  * @uses  Config::load
  * @uses  I18n::initialize
  * @uses  Module::load_modules
  */
 public static function ready()
 {
     if (self::$_init) {
         // Do not allow execution twice
         return;
     }
     // Gleez is now initialized?
     self::$_init = TRUE;
     // Set default cookie salt and lifetime
     self::_set_cookie();
     // Check database config file exist or not
     Gleez::$installed = file_exists(APPPATH . 'config/database.php');
     if (Gleez::$installed) {
         // Database config reader and writer
         Kohana::$config->attach(new Config_Database());
     }
     if (Kohana::$environment !== Kohana::DEVELOPMENT) {
         Gleez_Exception::$error_view = 'errors/stack';
     }
     // Turn off notices and strict errors in production
     if (Kohana::$environment === Kohana::PRODUCTION) {
         // Turn off notices and strict errors
         error_reporting(E_ALL ^ E_NOTICE ^ E_STRICT);
     }
     // Initialize the locale from settings
     I18n::initialize();
     // Disable the kohana powered headers
     // @todo Remove it, use Gleez::$expose
     Kohana::$expose = FALSE;
     /**
      * If database.php doesn't exist, then we assume that the Gleez is not
      * properly installed and send to the installer.
      */
     if (!Gleez::$installed) {
         Session::$default = 'cookie';
         Gleez_Exception::$error_view = 'errors/error';
         // Static file serving (CSS, JS, images)
         Route::set('install/media', 'media(/<file>)', array('file' => '.+'))->defaults(array('controller' => 'install', 'action' => 'media', 'file' => NULL, 'directory' => 'install'));
         Route::set('install', '(install(/<action>))', array('action' => 'index|systemcheck|database|install|finalize'))->defaults(array('controller' => 'install', 'directory' => 'install'));
         return;
     }
     // Set the default session type
     Session::$default = Config::get('site.session_type');
     // Initialize Gleez modules
     Module::load_modules(FALSE);
     // Load the active theme(s)
     Theme::load_themes();
 }
コード例 #12
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', 'minion' => MODPATH . 'minion', 'auth' => MODPATH . 'auth', 'jam' => __DIR__ . '/../modules/jam', 'jam-auth' => __DIR__ . '/../modules/jam-auth', 'jam-monetary' => __DIR__ . '/../modules/jam-monetary', 'jam-closuretable' => __DIR__ . '/../modules/jam-closuretable', 'jam-locations' => __DIR__ . '/../modules/jam-locations', 'site-versions' => __DIR__ . '/..'));
Kohana::$config->load('database')->set('default', array('type' => 'MySQL', 'connection' => array('hostname' => 'localhost', 'database' => 'OpenBuildings/site-versions', 'username' => 'root', 'password' => '', 'persistent' => TRUE), 'table_prefix' => '', 'charset' => 'utf8', 'caching' => FALSE));
Kohana::$config->load('auth')->set('session_type', 'Auth_Test')->set('session_key', 'auth_user')->set('hash_key', '11111');
Kohana::$environment = Kohana::TESTING;
Session::$default = 'Auth_Test';
error_reporting(E_ALL ^ E_DEPRECATED);
コード例 #13
0
ファイル: logout.php プロジェクト: greor/satin-spb
 public function before()
 {
     $this->auto_render = FALSE;
     Session::$default = 'admin';
 }
コード例 #14
0
ファイル: bootstrap.php プロジェクト: raku/front-cms
 * - 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' => ''));
/**
 * 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());
// Sessions & Cookies
Session::$default = 'native';
/**
 * 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', 'email' => MODPATH . 'email'));
Kohana::$config->attach(new Config_Database(array('instance' => Kohana_Database::instance(), 'table_name' => 'config')));
/**
 * Set the routes. Each route must have a minimum of a name, a URI and a set of
 * defaults for the URI.
 */
// Админ роут по-умолчанию
Route::set('admin', 'admin(/<controller>(/<action>(/<id>)))', array('id' => '.+'))->defaults(array('directory' => 'admin', 'controller' => 'main', 'action' => 'index'));
// Если сайт оффлайн
Route::set('offline', 'offline')->defaults(array('directory' => 'site', 'controller' => 'main', 'action' => 'offline'));
// Обработчик ошибок
Route::set('error', 'error/<action>(/<message>)', array('action' => '[0-9]++', 'message' => '.+'))->defaults(array('controller' => 'error'));
コード例 #15
0
ファイル: bootstrap.php プロジェクト: NegoCore/negocore
/*
 * ------------------------------------------------------------
 * 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;
/*
 * ------------------------------------------------------------
コード例 #16
0
ファイル: init.php プロジェクト: ortodesign/cms
 *
 * @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'));
Route::set('system', '<directory>-<controller>-<action>(/<id>)', array('directory' => '(ajax|action|form)', 'controller' => '[A-Za-z\\_]+', 'action' => '[A-Za-z\\_]+', 'id' => '.+'));
Route::set('default', '(<page>)(<suffix>)', array('page' => '.*', 'suffix' => URL_SUFFIX))->defaults(array('controller' => 'front', 'action' => 'index', 'suffix' => URL_SUFFIX));
Observer::notify('system::init');
コード例 #17
0
ファイル: bootstrap.php プロジェクト: despark/kohana
/**
 * 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('jam' => MODPATH . 'jam', 'jam-auth' => MODPATH . 'jam-auth', 'auth' => MODPATH . 'auth', 'cache' => MODPATH . 'cache', 'database' => MODPATH . 'database', 'image' => MODPATH . 'image'));
/**
 * This is unique salt, which is auto-generated via a Composer script
 *
 * @var string
 */
Cookie::$salt = 'UNIQUE_COOKIE_SALT';
Image::$default_driver = 'Imagick';
Session::$default = 'cookie';
HTML::$windowed_urls = TRUE;
Kohana::$shutdown_errors = PHP_SAPI === 'cli' ? array() : array(E_PARSE, E_ERROR, E_USER_ERROR, E_COMPILE_ERROR);
/**
 * Example configuration of jam-resource.
 * Useful if you don't want to use PUT and DELETE HTTP methods in forms.
 *
 * @var array
 */
// Resource::$actions_map = array(
// 	'collection' => array(
// 		'index'  => 'get',
// 		'new' => array('get', 'post'),
// 	),
// 	'member'     => array(
// 		'show'   => array('get', 'post'),