Пример #1
0
 public function admin()
 {
     if (!isset($this->sets['admin'])) {
         $this->sets['admin'] = new CMS_Navigation3_LinkSet();
     }
     CMS_Admin::build_embedded_admin_menu($this->sets['admin']);
     return $this->sets['admin'];
 }
Пример #2
0
 static function initialize($config = array())
 {
     foreach ($config as $key => $value) {
         self::${$key} = $value;
     }
     CMS::add_component(self::$name, new CMS_Factory_Mapper());
     CMS_Admin::menu(self::$admin_menu_title, CMS::admin_path('factory'), 'puzzle.png');
 }
Пример #3
0
 static function initialize($config = array())
 {
     foreach ($config as $key => $value) {
         self::${$key} = $value;
     }
     if (self::$disabled) {
         return;
     }
     CMS::add_component(self::$name, new CMS_Stockroom_Router());
     CMS_Admin::menu(self::$admin_menu_title, CMS::admin_path('stockroom'), 'bookshelf.png');
 }
Пример #4
0
 protected function get_var_value($name)
 {
     $site = false;
     if ($m = Core_Regexps::match_with_results('{^(.+)/([^/]+)$}', $name)) {
         $name = trim($m[1]);
         $site = trim($m[2]);
         if ($site == '*') {
             $site = CMS_Admin::site();
         }
     }
     return CMS::vars()->get($name, $site);
 }
Пример #5
0
 static function initialize($config = array())
 {
     self::options($config);
     CMS::add_component(self::$options['component']['name'], Core::make(self::$options['component']['mapper']));
     CMS_Admin::menu('lang:_vars:title', CMS::admin_path('vars'), 'hammer-screwdriver.png');
 }
Пример #6
0
 /**
  */
 static function build_embedded_admin_menu($set)
 {
     if (self::$embedded_admin_menu_builded) {
         return;
     }
     self::$embedded_admin_menu_builded = true;
     $components = array_flip(CMS::$component_names);
     foreach ($components as $class => $name) {
         if (class_exists($class)) {
             if (method_exists($class, 'embedded_admin_menu')) {
                 call_user_func(array($class, 'embedded_admin_menu'), $set);
             }
         }
     }
 }
Пример #7
0
 protected function map_for_id($parent_id, $component = '')
 {
     $site = CMS_Admin::get_site();
     $full = CMS::$globals['full'] ? false : 0;
     return $this->map_find_dir($parent_id, $site, $component, $full)->select();
 }
Пример #8
0
 public function create($data)
 {
     $item = CMS::vars()->db()->make_entity();
     $code = trim($data['code']);
     $title = trim($data['title']);
     if ($code == '') {
         $code = 'var' . time();
     }
     if ($title == '') {
         $title = $this->title();
     }
     $item->vartype = $this->type();
     $item->site = CMS_Admin::get_site();
     $item->parent_id = (int) $data['parent_id'];
     $item->code = $code;
     $item->title = $title;
     $item->component = '';
     return $item;
 }
Пример #9
0
 protected function process_component_config($config_name = 'component')
 {
     $config = $this->config($config_name);
     // TODO: split to methods
     if (isset($config->admin_menu)) {
         $menu = (object) $config->admin_menu;
         CMS_Admin::menu($menu->caption, $menu->path, $menu->items, $menu->icon);
     }
     if (isset($config->templates)) {
         $helpers = $config->templates['helpers'];
         Templates_HTML::use_helpers($helpers);
     }
     if (isset($config->field_types)) {
         $types = $config->field_types;
         foreach ($types as $name => $class) {
             CMS::field_type($name, $class);
         }
     }
     if (isset($config->commands)) {
         $commands = $config->commands;
         foreach ($commands as $chapter => $data) {
             $args = array_merge(array($chapter, $data['name'], $data['callback']), isset($data['args']) ? $data['args'] : array());
             call_user_func_array(array('CMS', 'add_command'), $args);
         }
     }
     if (isset($config->insertions)) {
         $insertions = $config->insertions;
         foreach ($insertions as $ins) {
             $args = array_merge(array($ins['class']), $ins['names']);
             call_user_func_array(array('CMS', 'register_insertions'), $args);
         }
     }
     if (isset($config->events)) {
         $events = $config->events;
         foreach ($events as $name => $callback) {
             Events::add_listener($name, $callback);
         }
     }
     if (isset($config->orm)) {
         $orm = $config->orm;
         foreach ($orm as $name => $class) {
             CMS::orm()->submapper($name, $class);
         }
     }
 }
Пример #10
0
Файл: FS.php Проект: techart/tao
 protected function path($name = false)
 {
     $path = self::$dir;
     $site = CMS::admin() ? CMS_Admin::site() : CMS::site();
     if ($site != '__') {
         $path .= "/{$site}";
     }
     if ($name) {
         $name = trim(str_replace('.', '/', $name));
         $path .= "/{$name}";
     }
     return $path;
 }
Пример #11
0
 protected static function auth_parms($mp, $client)
 {
     $auth_parms = array();
     if ($mp) {
         if (is_string($mp)) {
             $mp = explode(',', $mp);
         }
         if (Core_Types::is_iterable($mp)) {
             foreach ($mp as $_mp) {
                 $_mp = trim($_mp);
                 if ($_mp != '') {
                     $_v = true;
                     if ($m = Core_Regexps::match_with_results('{^([^=]+)=(.+)$}', $_mp)) {
                         $_mp = trim($m[1]);
                         $_v = trim($m[2]);
                     }
                     if ($_mp == 'lang') {
                         CMS::site_set_lang($_v);
                     }
                     if ($_mp == 'admin_sites') {
                         $_asites = explode('|', $_v);
                         $_v = array();
                         $_las = '__';
                         foreach ($_asites as $_asite) {
                             $_asite = trim($_asite);
                             if ($_asite != '') {
                                 $_v[$_asite] = $_asite;
                                 $_las = $_asite;
                             }
                         }
                         if (CMS::admin()) {
                             if (!isset($_v[CMS_Admin::site()])) {
                                 header("location: /cms-actions/subsite/{$_las}");
                                 die;
                             }
                         }
                     }
                     CMS::$globals[$_mp] = $_v;
                     $auth_parms[$_mp] = $_v;
                 }
             }
         }
         if ($client) {
             CMS::$globals['full'] = false;
         }
     }
     return $auth_parms;
 }