Beispiel #1
0
 /**
  * Init
  */
 public function init()
 {
     parent::init();
     if (access('Dev.*') && cogear()->config->development) {
         hook('done', array($this, 'finish'));
     }
 }
Beispiel #2
0
 /**
  * Initialize
  */
 public function init()
 {
     parent::init();
     foreach (cogear()->gears as $gear) {
         if (is_array($gear->access)) {
             foreach ($gear->access as $rule => $rights) {
                 $name = $gear->gear . '.' . $rule;
                 // Array of user roles
                 if (is_array($rights)) {
                     if (in_array(role(), $rights)) {
                         $this->rights->{$name} = TRUE;
                     } else {
                         $this->rights->{$name} = FALSE;
                     }
                 } else {
                     if (is_string($rights)) {
                         $callback = new Callback(array($gear, $rights));
                         if ($callback->check()) {
                             $this->rights->{$name} = $callback;
                         }
                     } elseif (is_bool($rights)) {
                         $this->rights->{$name} = $rights;
                     }
                 }
             }
         }
     }
 }
Beispiel #3
0
 /**
  * Init
  */
 public function init()
 {
     parent::init();
     if ($dsn = $this->get('database.dsn')) {
         $config = parse_url($dsn);
         if (isset($config['query'])) {
             parse_str($config['query'], $query);
             $config += $query;
         }
         if (!isset($config['host'])) {
             $config['host'] = 'localhost';
         }
         if (!isset($config['user'])) {
             $config['user'] = '******';
         }
         if (!isset($config['pass'])) {
             $config['pass'] = '';
         }
         if (!isset($config['prefix'])) {
             $config['prefix'] = $this->get('database.default_prefix', '');
         }
         $config['database'] = trim($config['path'], '/');
         $driver = 'Db_Driver_' . ucfirst($config['scheme']);
         if (!class_exists($driver)) {
             return Message::error(t('Database driver <b>%s</b> not found.', 'Database errors', ucfirst($config['scheme'])));
         }
         $this->driver = new $driver($config);
         $this->hook('done', array($this, 'showErrors'));
         $this->hook('debug', array($this, 'trace'));
         cogear()->db = $this->driver;
     } else {
         die('Couldn\'t connect to database.');
     }
 }
Beispiel #4
0
 /**
  * Init
  */
 public function init()
 {
     parent::init();
     $this->get = new Core_ArrayObject($_GET);
     $this->post = new Core_ArrayObject($_POST);
     $this->cookies = new Core_ArrayObject($_COOKIE);
 }
Beispiel #5
0
 /**
  * Init
  */
 public function init()
 {
     parent::init();
     $cogear = getInstance();
     Form::$types['file'] = 'Upload_Ajax_Form_File';
     Form::$types['image'] = 'Upload_Ajax_Form_Image';
 }
Beispiel #6
0
 /**
  * Init
  */
 public function init()
 {
     parent::init();
     if (Ajax::is()) {
         event('ajax.hashchange');
     }
 }
Beispiel #7
0
 /**
  * Init
  */
 public function init()
 {
     parent::init();
     hook('form.page-createdit.init', array($this, 'extendPageForm'));
     hook('Pages.showPage.after', array($this, 'attachCommentsToPage'));
     hook('stack.Page.info', array($this, 'extendPageInfo'));
     allow_role(array('comments post'), 100);
 }
Beispiel #8
0
 /**
  * Init
  */
 public function init()
 {
     $this->router->addRoute('users:maybe', array($this, 'users'));
     parent::init();
     $this->current = new User_Object();
     $this->current->init();
     new User_Menu();
     $this->getRoles();
 }
Beispiel #9
0
 /**
  * Init
  *
  * With inheritance
  */
 public function init()
 {
     $parent = $this->reflection->getParentClass();
     if ($parent->name != 'Gear' && $parent->name != 'Theme') {
         $theme = new $parent->name();
         $theme->init();
     }
     parent::init();
 }
Beispiel #10
0
 /**
  * Инициализация
  */
 public function init()
 {
     $config = config('database');
     $db = Db::factory('system', $config);
     if ($db->connect()) {
         parent::init();
         $this->object($db);
     }
 }
Beispiel #11
0
 /**
  * Init
  */
 public function init()
 {
     parent::init();
     $cogear = getInstance();
     $this->api = new Loginza_API();
     hook('form.user-login.result.before', array($this, 'hookUserForm'));
     hook('form.user-register.result.before', array($this, 'hookUserForm'));
     hook('form.user-profile.init', array($this, 'hookUserProfile'));
 }
Beispiel #12
0
 /**
  * Init
  */
 public function init()
 {
     parent::init();
     $cogear = getInstance();
     $cogear->router->addRoute(':index', array($this, 'index'), TRUE);
     $url = config('pages.url', Pages_Gear::DEFAULT_PAGE_URL);
     $cogear->router->addRoute(str_replace(array('.', '<id>', '<url>'), array('\\.', '(?P<id>\\d+)', '.+'), $url), array($this, 'catchPage'), TRUE);
     allow_role(array('pages create'), 100);
 }
Beispiel #13
0
 /**
  * Init
  */
 public function init()
 {
     parent::init();
     if (!class_exists('ZipArchive')) {
         error(t('Для того, чтобы система работа корректно, вам необходимо установить расширение ZIP для PHP или же использовать версию PHP выше 5.3.'));
     } else {
         //            $this->object(new ZipArchive());
     }
 }
Beispiel #14
0
 /**
  * Init
  */
 public function init()
 {
     $this->regions = new Core_ArrayObject();
     hook('gear.request', array($this, 'handleGearRequest'));
     if ($favicon = config('theme.favicon')) {
         hook('theme.head.meta.after', array($this, 'renderFavicon'));
     }
     parent::init();
 }
Beispiel #15
0
 /**
  * Init
  */
 public function init()
 {
     parent::init();
     Template::bindGlobal('meta', $this->info);
     title(t(config('site.name', SITE_URL)));
     hook('head', array($this, 'head'), 0);
     hook('menu.setActive', array($this, 'menuTitleHook'));
     hook('Pages.showPage.before', array($this, 'showObjectTitle'));
     hook('admin.gear.request', array($this, 'showObjectTitle'));
 }
Beispiel #16
0
 /**
  * Init
  */
 public function init()
 {
     parent::init();
     if ($this->status() == Gears::ENABLED) {
         $this->router->bind(':index', array($this, 'index'), TRUE);
         if (!check_route('^install')) {
             redirect(l('/install'));
         }
     }
 }
Beispiel #17
0
 /**
  * Initializer
  */
 public function init()
 {
     parent::init();
     if (access('Admin.*')) {
         new Menu_Auto(array('name' => 'admin', 'template' => 'Admin/templates/menu', 'render' => 'before'));
         css($this->folder . '/css/menu.css', 'head');
         js($this->folder . '/js/menu.js', 'head');
         if ('admin' == $this->router->getSegments(0)) {
             $this->bc = new Breadcrumb_Object(array('name' => 'admin.breadcrumb', 'title' => TRUE, 'titleActiveOnly' => FALSE, 'elements' => array(array('link' => l('/admin'), 'label' => icon('home') . ' ' . t('Панель управления')))));
         }
     }
 }
Beispiel #18
0
 /**
  * Init
  */
 public function init()
 {
     parent::init();
     if ($rules = $this->system_cache->read('access/rules', TRUE)) {
         $this->rules->adopt($rules);
     }
     if ($roles = $this->system_cache->read('access/roles', TRUE)) {
         $this->roles->adopt($roles);
     }
     $this->getRights();
     hook('exit', array($this, 'save'));
 }
Beispiel #19
0
 /**
  * Init
  */
 public function init()
 {
     parent::init();
     hook('menu.admin.sidebar', array($this, 'adminMenuLink'));
 }
Beispiel #20
0
 /**
  * Init
  */
 public function init()
 {
     parent::init();
     $cogear = getInstance();
 }
Beispiel #21
0
 /**
  * Initializer
  */
 public function init() {
     $cogear = getInstance();
     $this->settings->theme = 'Admin_Theme';
     parent::init();
     hook('user_cp.render.before', array($this, 'hookControlPanel'));
 }
Beispiel #22
0
 /**
  * Init
  */
 public function init()
 {
     parent::init();
     hook('form.render', array($this, 'showGoBackButton'));
 }
Beispiel #23
0
 /**
  * Initialization
  */
 public function init()
 {
     parent::init();
     $this->addPoint('system.begin');
     hook('done', array($this, 'finalPoint'));
 }
Beispiel #24
0
 /**
  * Init
  */
 public function init()
 {
     $this->router->addRoute(':index', array($this, 'index'), TRUE);
     parent::init();
     new Install_Menu();
 }
Beispiel #25
0
 /**
  * Init
  */
 public function init()
 {
     parent::init();
     hook('ignite', array($this, 'check'));
     $this->key = $this->keyGen();
 }
Beispiel #26
0
 /**
  * Init
  */
 public function init()
 {
     parent::init();
     Form::$types['editor'] = self::$editors[config('wysiwyg.editor', 'redactor')];
 }
Beispiel #27
0
 /**
  * Конструктор
  */
 public function init()
 {
     parent::init();
     //        bind_route('user/([^/]+)/posts:maybe', array($this, 'list_action'), TRUE);
     //        bind_route('user/([^/]+)/drafts:maybe', array($this, 'drafts_action'), TRUE);
 }
Beispiel #28
0
 /**
  * Init
  */
 public function init()
 {
     parent::init();
     Wysiwyg_Gear::$editors['elRTE'] = 'elRTE_Editor';
 }
Beispiel #29
0
 /**
  * Init
  */
 public function init()
 {
     parent::init();
     $this->object(new User_Object());
     $this->object()->init();
 }
Beispiel #30
0
 /**
  * Init
  */
 public function init() {
     parent::init();
     $cogear = getInstance();
     $this->setRules();
     $this->setRights();
 }