Example #1
0
 public function __construct()
 {
     parent::__construct();
     parent::redirectIfLoggedOut();
     parent::redirectIfWebView();
     // Load user marks model
     $this->load->model('tags_model', 'tags');
 }
Example #2
0
 public function chromePing()
 {
     if ($this->logged_in !== true || parent::isChromeExtension() === false) {
         $this->data['errors'] = formatErrors(403);
     } else {
         $this->data['success'] = true;
     }
     $this->renderJSON();
 }
Example #3
0
 public function __construct()
 {
     parent::__construct();
     parent::redirectIfLoggedOut();
     // If we can't find a user id, get them out of here
     if (!isset($this->user_id) || !is_numeric($this->user_id)) {
         header('Location: /');
         exit;
     }
     // Set default success to false
     $this->data['success'] = false;
 }
Example #4
0
 public function __construct()
 {
     parent::__construct();
     parent::redirectIfLoggedOut();
     parent::redirectIfNotInternalAJAX();
     parent::redirectIfInvalidCSRF();
     // If we can't find a user id, get them out of here
     if (!isset($this->user_id) || !is_numeric($this->user_id)) {
         header('Location: /');
         exit;
     }
     // Set default success to false
     $this->data['success'] = false;
     // Load user model
     $this->load->model('users_model', 'user');
 }
Example #5
0
 public function user()
 {
     $email = isset($this->db_clean->email) ? $this->db_clean->email : null;
     $password = isset($this->clean->password) ? $this->clean->password : null;
     $this->data['success'] = false;
     $this->load->model('users_model', 'user');
     $user = $this->user->create(array('email' => $email, 'password' => $password, 'active' => '1'));
     // If good
     // Add user data to session
     // Set user id
     // Add defualt marks
     // Set redirect to /marks
     // Set default marks (can't really do this)
     if (isset($user->user_id)) {
         $this->sessionAddUser($user);
         // Set user id
         $this->user_id = $user->user_id;
         // Now add default marks to user account
         $default_marks = $this->config->item('new_account_links');
         if (!empty($default_marks)) {
             foreach ($default_marks as $title => $arr) {
                 $title = $this->db->escape_str($title);
                 $url = $this->db->escape_str($arr['url']);
                 $label_id = $this->db->escape_str($arr['label_id']);
                 $res = parent::addMark(array('url' => $url, 'title' => $title, 'label_id' => $label_id));
             }
         }
         // set redirect path
         $redirect = '/marks';
         $this->data['success'] = true;
         $this->data['email'] = $email;
     } else {
         $redirect = '/register';
         $this->setFlashMessage($user);
         foreach ($user as $error_code => $message) {
             $this->data['message'] = $message;
         }
     }
     // Redirect for web view or print for ajax call
     $this->figureView(null, $redirect);
 }
Example #6
0
 public function __construct()
 {
     parent::__construct();
     parent::redirectIfLoggedOut();
 }
Example #7
0
 public function __construct()
 {
     parent::__construct();
     parent::redirectIfNotInternalAJAX();
 }
Example #8
0
 public function __construct()
 {
     parent::__construct();
     parent::redirectIfNotCommandLine();
 }
Example #9
0
 public function total($what = 'marks', $start = null, $finish = null)
 {
     parent::redirectIfWebView();
     $method = 'total' . ucwords($what);
     if (method_exists($this, $method)) {
         $start = empty($start) ? 'today' : strtolower($start);
         $finish = empty($finish) ? 'tomorrrow' : strtolower($finish);
         $this->data['total'] = $this->{$method}($start, $finish);
         parent::renderJSON();
     } else {
         $this->data['errors'] = formatErrors(404);
     }
     parent::renderJSON();
 }
Example #10
0
 private function toggle($label_id = 0, $active = 0)
 {
     // Figure correct way to handle if no mark id
     if (empty($label_id) || !is_numeric($label_id)) {
         $this->data['errors'] = formatErrors(30);
     } else {
         $where = parent::isAdmin() === true ? "(labels.user_id IS NULL OR labels.user_id = '" . $this->user_id . "')" : "labels.user_id = '" . $this->user_id . "'";
         $label = $this->labels->update($where . " AND labels.label_id= '" . $label_id . "'", array('active' => $active));
         if ($label === false) {
             $this->data['errors'] = formatErrors(39);
         } else {
             $this->data['label'] = $label;
         }
     }
     // Figure view
     $this->figureView();
 }