Ejemplo n.º 1
0
 protected function module_main()
 {
     //get menus from all plugins
     $menu = (array) null;
     $plugins = cls_orm::find('plugins', 'enable=1');
     foreach ($plugins as $plugin) {
         //now get all menus from plugins
         if (method_exists($plugin->name, 'core_menu')) {
             $plugin_menu = call_user_func(array($plugin->name, '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 cls_router($_GET['p'], $_GET['a']);
     $plugin_content = $router->show_content(false);
     $obj_users = new 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;
 }
Ejemplo n.º 2
0
 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
             cls_router::jump_page(cls_general::create_url(array('service', '1', 'plugin', 'core', 'action', 'main', 'p', 'core', '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
             cls_router::jump_page(cls_general::create_url(array('service', '1', 'plugin', 'core', 'action', 'main', 'p', 'users', 'a', 'login')));
         }
     } elseif ($this->users->has_permission('core_admin_panel') != true) {
         return $this->module_no_permission();
     }
 }
Ejemplo n.º 3
0
 public function btn_signup_onclick($e)
 {
     //if this action requested by content mode i should reject that
     if ($e == 'content') {
         cls_router::jump_page(SiteDomain);
     }
     //check input
     if ($e['txt_username']['VALUE'] == '' || $e['txt_email']['VALUE'] == '' || $e['txt_password']['VALUE'] == '' || $e['txt_repassword']['VALUE'] == '') {
         //invalid field
         $e['RV']['MODAL'] = cls_page::show_block(_('Message'), _('Please fill out all the field that are marked with an asterisk (*).'), 'MODAL', 'type-warning');
         return $e;
     } else {
         return $this->module_btn_signup_onclick($e);
     }
 }
Ejemplo n.º 4
0
 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') {
         cls_router::jump_page(SiteDomain);
     } else {
         //jump page with events controller
         $e['RV']['URL'] = SiteDomain;
     }
     return $e;
 }
Ejemplo n.º 5
0
    //going to run sarkesh!
    include_once "./config.php";
    //LOAD INC Files
    //set error reporting
    // ERROR_REPORTING defined in config file
    error_reporting(ERROR_REPORTING);
    //include core difines
    require_once AppPath . 'core/defines.php';
    require_once AppPath . 'core/inc/localize.php';
    #include functions
    require_once "./core/functions/render.php";
    // config and setup cls_orm // RedBeanphp
    cls_orm::run();
    //check for that want work with services or normal use
    if (isset($_REQUEST['service'])) {
        #run system in service mode
        $obj_router = new cls_router();
        $obj_router->run_service();
    } elseif (isset($_REQUEST['control'])) {
        #run system in service mode
        $obj_router = new cls_router();
        $obj_router->run_control();
    } else {
        #load system in gui normal mode
        require_once "./core/inc/load.php";
    }
} else {
    // configure file not found
    // going to start system setup
    echo "system setup...";
}
Ejemplo n.º 6
0
 public static function set_position($position)
 {
     if (self::$blocks == null) {
         //load all blocks data from database
         $db = new cls_database();
         $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 cls_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'] == 'core') {
                 //going to show content;
                 $obj_router = new cls_router();
                 $obj_router->show_content();
             } else {
                 //checking that plugin is enabled
                 if (self::$plugin->is_enabled($block['p.name'])) {
                     $plugin = new $block['p.name']();
                     //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');
                 }
             }
         }
     }
 }