コード例 #1
0
ファイル: admin.php プロジェクト: mewsop/Ushahidi_Web
 public function __construct()
 {
     parent::__construct();
     // Load cache
     $this->cache = new Cache();
     // Load session
     $this->session = new Session();
     // Load database
     $this->db = new Database();
     $upgrade = new Upgrade();
     $this->auth = new Auth();
     $this->session = Session::instance();
     $this->auth->auto_login();
     if (!$this->auth->logged_in('login')) {
         url::redirect('login');
     }
     // Set Table Prefix
     $this->table_prefix = Kohana::config('database.default.table_prefix');
     //fetch latest release of ushahidi
     $this->release = $upgrade->_fetch_core_release();
     if (!empty($this->release)) {
         $this->template->version = $this->_get_release_version();
         $this->template->critical = $this->release->critical;
     }
     // Get Session Information
     $this->user = new User_Model($_SESSION['auth_user']->id);
     // Check if user has the right to see the admin panel
     if (admin::admin_access($this->user) == FALSE) {
         // This user isn't allowed in the admin panel
         url::redirect('/');
     }
     $this->template->admin_name = $this->user->name;
     // Retrieve Default Settings
     $this->template->site_name = Kohana::config('settings.site_name');
     $this->template->mapstraction = Kohana::config('settings.mapstraction');
     $this->template->api_url = Kohana::config('settings.api_url');
     // Javascript Header
     $this->template->map_enabled = FALSE;
     $this->template->flot_enabled = FALSE;
     $this->template->treeview_enabled = FALSE;
     $this->template->protochart_enabled = FALSE;
     $this->template->colorpicker_enabled = FALSE;
     $this->template->editor_enabled = FALSE;
     $this->template->js = '';
     $this->template->form_error = FALSE;
     // Initialize some variables for raphael impact charts
     $this->template->raphael_enabled = FALSE;
     $this->template->impact_json = '';
     // Generate main tab navigation list.
     $this->template->main_tabs = admin::main_tabs();
     // Generate sub navigation list (in default layout, sits on right side).
     $this->template->main_right_tabs = admin::main_right_tabs($this->user);
     $this->template->this_page = "";
     // Load profiler
     // $profiler = new Profiler;
 }
コード例 #2
0
ファイル: upgrade.php プロジェクト: Dirichi/Ushahidi_Web
 public function check_current_version()
 {
     //This is an AJAX call, so none of this fancy templating, just render the data
     $this->template = "";
     $this->auto_render = FALSE;
     // Disable profiler
     if (isset($this->profiler)) {
         $this->profiler->disable();
     }
     $view = View::factory('admin/current_version');
     $upgrade = new Upgrade();
     //fetch latest release of ushahidi
     $this->release = $upgrade->_fetch_core_release();
     if (!empty($this->release)) {
         $view->version = $this->_get_release_version();
         $view->critical = $this->release->critical;
     }
     $view->render(TRUE);
 }
コード例 #3
0
 public function __construct()
 {
     parent::__construct();
     // Load cache
     $this->cache = new Cache();
     // Load session
     $this->session = new Session();
     // Load database
     $this->db = new Database();
     $upgrade = new Upgrade();
     $this->auth = new Auth();
     $this->session = Session::instance();
     $this->auth->auto_login();
     if (!$this->auth->logged_in('login')) {
         url::redirect('login');
     }
     // Set Table Prefix
     $this->table_prefix = Kohana::config('database.default.table_prefix');
     //fetch latest release of ushahidi
     $this->release = $upgrade->_fetch_core_release();
     if (!empty($this->release)) {
         $this->template->version = $this->_get_release_version();
         $this->template->critical = $this->release->critical;
     }
     // Get Session Information
     $this->user = new User_Model($_SESSION['auth_user']->id);
     $this->template->admin_name = $this->user->name;
     //make sure the user is supposed to be here:
     $group_id = groups::get_user_group($this->user);
     if (!$group_id) {
         url::redirect(url::site() . 'admin/simplegroups/nogroup');
     }
     //Get Group Info
     $groups = ORM::factory("simplegroups_groups")->join("simplegroups_groups_users", "simplegroups_groups.id", "simplegroups_groups_users.simplegroups_groups_id")->where("simplegroups_groups_users.users_id", $this->user->id)->find_all();
     foreach ($groups as $group) {
         $this->group = $group;
         $this->template->group_name = $group->name;
         $this->template->group_logo = $group->logo;
     }
     // Retrieve Default Settings
     $this->template->site_name = Kohana::config('settings.site_name');
     $this->template->mapstraction = Kohana::config('settings.mapstraction');
     $this->template->api_url = Kohana::config('settings.api_url');
     // Javascript Header
     $this->template->map_enabled = FALSE;
     $this->template->flot_enabled = FALSE;
     $this->template->treeview_enabled = FALSE;
     $this->template->protochart_enabled = FALSE;
     $this->template->colorpicker_enabled = FALSE;
     $this->template->editor_enabled = FALSE;
     $this->template->js = '';
     $this->template->form_error = FALSE;
     // Initialize some variables for raphael impact charts
     $this->template->raphael_enabled = FALSE;
     $this->template->impact_json = '';
     // Generate main tab navigation list.
     $this->template->main_tabs = admin::main_tabs();
     // Generate sub navigation list (in default layout, sits on right side).
     $this->template->main_right_tabs = admin::main_right_tabs($this->user);
     $this->template->this_page = "";
     // Load profiler
     // $profiler = new Profiler;
 }