Exemplo 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;
 }
Exemplo n.º 2
0
 protected function module_do_upload()
 {
     //first get active stronge divices
     $places = cls_orm::findOne('file_places', 'state=1');
     //WARRNING : THIS PART WAS DEVELOPED ONLY FOR LOCAL STRONGE AND SOME OTHER LIKE FTP AND CLOUD NOT DEVELOPED.
     //I TRY TO DEVELOP THIS PARD IN BETA VERSION
     if ($places->class_name == 'files_local') {
         //firs check for that file with this name is exists before
         $exist = file_exists($places->options . $_FILES["uploads"]["name"]);
         while ($exist) {
             $number = rand(0, 99999999999999);
             $_FILES["uploads"]["name"] = $number . $_FILES["uploads"]["name"];
             $exist = file_exists($places->options . $_FILES["uploads"]["name"]);
         }
         //file stored in local server
         //access to file is like local address
         try {
             move_uploaded_file($_FILES["uploads"]["tmp_name"], $places->options . $_FILES["uploads"]["name"]);
             $file_info = cls_orm::dispense('files');
             $file_info->name = $_FILES["uploads"]["name"];
             $file_info->place = $places->id;
             $file_info->address = SiteDomain . $places->options . $_FILES["uploads"]["name"];
             $file_info->date = time();
             $file_info->user = '******';
             $file_info->size = $_FILES["uploads"]["size"];
             //Save and return file id for proccess in javascript function
             return cls_orm::store($file_info);
         } catch (Exception $e) {
             // -1 means upload was not successful
             return -1;
         }
     }
 }
Exemplo n.º 3
0
 protected function module_get_info($username = '')
 {
     //first check for that what type of user info you want
     if ($username == '') {
         //you want user information that now in loged in
         if ($this->is_logedin()) {
             $id = $this->validator->get_id('USERS_LOGIN');
             if (cls_orm::count('users', 'login_key = ?', array($id)) != 0) {
                 return cls_orm::findOne('users', 'login_key = ?', array($id));
             }
         } else {
             //user is guest
             return null;
         }
     } else {
         //check for username and return back information if exists
         if (cls_orm::count('users', 'username = ?', array($username)) != 0) {
             return cls_orm::findOne('users', 'login_key = ?', array($username));
         } else {
             //username not found
             return 0;
         }
     }
 }
Exemplo n.º 4
0
    session_start();
}
if (file_exists("./config.php")) {
    //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