Ejemplo n.º 1
0
 function __construct()
 {
     /**
      * authentication
      **/
     $auth = new WaxAuthDb(array("encrypt" => false, "db_table" => $this->auth_database_table, "session_key" => "wildfire_user_cookie"));
     $this->current_user = $auth->get_user();
     if ($this->current_user->usergroup == 30) {
         $this->is_admin = true;
     }
     /**
      * module setup
      **/
     $this->before_filter("all", "check_authorised", array("login"));
     $this->configure_modules();
     $this->all_modules = CMSApplication::get_modules(true);
     if (!array_key_exists($this->module_name, CMSApplication::get_modules())) {
         Session::add_message('This component is not registered with the application.');
         $this->redirect_to('/admin/home/index');
     }
     /**
      * model instanciation
      **/
     $this->cm_conf = CmsConfiguration::get("general");
     if ($this->model_class) {
         $this->model = new $this->model_class($this->cm_conf['campaign_monitor_ClientID']);
         $this->model_name = WXInflections::underscore($this->model_class);
     }
     $this->sub_links["create"] = "Create New " . $this->display_name;
     $this->sub_links["view_subscriber"] = "View Subscribers";
     $this->sub_links["view_segments"] = "View Segments";
     if (!($this->this_page = WaxUrl::get("page"))) {
         $this->this_page = 1;
     }
 }
Ejemplo n.º 2
0
 /** 
  * Construct method, initialises authentication, default model and menu items
  **/
 function __construct()
 {
     /**
      * authentication
      **/
     $auth = new WaxAuthDb(array("encrypt" => false, "db_table" => $this->auth_database_table, "session_key" => "wildfire_user_cookie"));
     $this->current_user = $auth->get_user();
     if ($this->current_user->usergroup == 30) {
         $this->is_admin = true;
     }
     /**
      * module setup
      **/
     $this->before_filter("all", "check_authorised", array("login"));
     $this->configure_modules();
     $this->all_modules = CMSApplication::get_modules(true, $this->current_user->usergroup);
     if (!array_key_exists($this->module_name, CMSApplication::get_modules())) {
         Session::add_message('This component is not registered with the application.');
         $this->redirect_to('/admin/home/index');
     }
     /**
      * model instanciation
      **/
     if ($this->model_class) {
         $this->model = new $this->model_class();
         $this->model_name = WXInflections::underscore($this->model_class);
         if (!$this->scaffold_columns && is_array($this->model->column_info())) {
             $this->scaffold_columns = array_keys($this->model->column_info());
         }
     }
     $this->sub_links["create"] = "Create New " . $this->display_name;
     if (!($this->this_page = WaxUrl::get("page"))) {
         $this->this_page = 1;
     }
 }
Ejemplo n.º 3
0
 /**
  * protected function that handles the actual db authentication check on first login
  * now also logs data regarding who has logged in
  * @return String url to redirect to
  **/
 protected function process_login()
 {
     $auth = new WaxAuthDb(array("db_table" => $this->model_name, "session_key" => "wildfire_user_cookie"));
     if ($auth->verify($_POST['username'], $_POST['password'])) {
         $log = new WildfireLog();
         $log->action = "login";
         $log->user = $auth->get_user();
         $log->time = date("Y-m-d H:i:s");
         $log->save();
         if ($this->authorised_redirect) {
             return $this->authorised_redirect;
         } else {
             return 'index';
         }
     } else {
         Session::add_message("Sorry, we can't find that username and password. Try again.");
         return $this->unauthorised_redirect;
     }
 }