コード例 #1
0
ファイル: module.php プロジェクト: EGArian/sarkesh
 protected function module_main()
 {
     //get menus from all plugins
     $menu = (array) null;
     $plugins = db\orm::find('plugins', 'enable=1');
     foreach ($plugins as $plugin) {
         //now get all menus from plugins
         $PluginName = '\\core\\plugin\\' . $plugin->name;
         $PluginObject = new $PluginName();
         if (method_exists($PluginObject, 'core_menu')) {
             $plugin_menu = call_user_func(array($PluginObject, 'core_menu'));
             foreach ($plugin_menu as $mnu) {
                 array_push($menu, $mnu);
             }
         }
     }
     //now $menu is 2d array with plugins menu
     //show action
     //check for that plugin is set
     if (!isset($_GET['p'])) {
         $_GET['p'] = 'core';
     }
     //check for that action is set
     if (!isset($_GET['a'])) {
         $_GET['a'] = 'default';
     }
     //now going to do action
     $router = new core\router($_GET['p'], $_GET['a']);
     $plugin_content = $router->show_content(false);
     $obj_users = new plugin\users();
     $user_info = $obj_users->get_info();
     $content = $this->module_load(array(_('Administrator:') . $plugin_content[0], $this->view_main($menu, $plugin_content[1], $user_info)));
     return $content;
 }
コード例 #2
0
ファイル: controller.php プロジェクト: EGArian/sarkesh
 public function main()
 {
     //first check for permission
     if ($this->users->is_logedin() && $this->users->has_permission('core_admin_panel')) {
         //check for that user come from login process
         if ($_GET['p'] == 'users' && $_GET['a'] == 'login') {
             //user come from login process and now should jump to default administrator page
             core\router::jump_page(core\general::create_url(array('service', '1', 'plugin', 'administrator', 'action', 'main', 'p', 'administrator', 'a', 'dashboard')));
         } else {
             //going to show content
             return $this->module_main();
         }
     } elseif (!$this->users->is_logedin()) {
         //user do not has any permission to access  to administrator area
         if ($_GET['p'] == 'users' && $_GET['a'] == 'login') {
             //show login page
             return $this->module_login_page();
         } else {
             //jump to login page
             core\router::jump_page(core\general::create_url(array('service', '1', 'plugin', 'administrator', 'action', 'main', 'p', 'users', 'a', 'login')));
         }
     } elseif ($this->users->has_permission('core_admin_panel') != true) {
         return $this->module_no_permission();
     }
 }
コード例 #3
0
 public static function set_position($position)
 {
     if (self::$blocks == null) {
         //load all blocks data from database
         $db = new db\mysql();
         $query_string = "SELECT b.name AS 'b.name',";
         $query_string .= "b.position AS 'b.position', b.permissions AS 'b.permissions', ";
         $query_string .= "b.pages AS 'b.pages', b.show_header AS 'b.show_header', b.plugin AS 'b.plugin', p.id AS 'p.id', p.name AS 'p.name', b.rank FROM blocks b INNER JOIN plugins p ON b.plugin = p.id ORDER BY b.rank DESC;";
         $db->do_query($query_string);
         self::$blocks = $db->get_array();
         self::$plugin = new core\plugin();
     }
     //search blocks for position matched
     //if add 'MAIN' to cls_router::show_content that's show like main content that come with url
     //and if add 'BLOCK' tag , sarkesh show that content like block
     //and if Send 'NONE' sarkesh do not show that(just run without view
     foreach (self::$blocks as $block) {
         if ($block['b.position'] == $position) {
             //going to process block
             if ($block['p.name'] == 'administrator') {
                 //going to show content;
                 $obj_router = new core\router();
                 $obj_router->show_content();
             } else {
                 //checking that plugin is enabled
                 if (self::$plugin->is_enabled($block['p.name'])) {
                     $ClassName = '\\core\\plugin\\' . $block['p.name'];
                     $plugin = new $ClassName();
                     //run action method for show block
                     //all blocks name should be like  'blk_blockname'
                     $content = call_user_func(array($plugin, $block['b.name']), $position);
                     echo self::show_block($content[0], $content[1], 'BLOCK');
                 }
             }
         }
     }
 }
コード例 #4
0
ファイル: module.php プロジェクト: EGArian/sarkesh
 protected function module_logout($e = '')
 {
     $this->validator->delete('USERS_LOGIN');
     //if this action requested by content mode jump user to home page
     if ($e == 'content') {
         core\router::jump_page(SiteDomain);
     } else {
         //jump page with events controller
         $e['RV']['URL'] = SiteDomain;
     }
     return $e;
 }