Example #1
0
 function index()
 {
     $this->load->model('marker');
     $randomWords = array('africa', 'animals', 'architecture', 'art', 'australia', 'autumn', 'baby', 'band', 'barcelona', 'beach', 'berlin', 'bird', 'birthday', 'black', 'blackandwhite', 'blue', 'boston', 'bw', 'california', 'cameraphone', 'camping', 'canada', 'canon', 'car', 'cat', 'chicago', 'china', 'christmas', 'church', 'city', 'clouds', 'color', 'concert', 'cute', 'dance', 'day', 'de', 'dog', 'england', 'europe', 'fall', 'family', 'festival', 'film', 'florida', 'flower', 'flowers', 'food', 'football', 'france', 'friends', 'fun', 'garden', 'germany', 'graffiti', 'green', 'halloween', 'hawaii', 'hiking', 'holiday', 'home', 'house', 'india', 'ireland', 'island', 'italia', 'italy', 'japan', 'july', 'kids', 'la', 'lake', 'landscape', 'light', 'live', 'london', 'macro', 'may', 'me', 'mexico', 'mountain', 'mountains', 'museum', 'music', 'nature', 'new', 'newyork', 'newyorkcity', 'night', 'nikon', 'nyc', 'ocean', 'old', 'paris', 'park', 'party', 'people', 'photo', 'photography', 'photos', 'portrait', 'red', 'river', 'rock', 'rome', 'san', 'sanfrancisco', 'scotland', 'sea', 'seattle', 'show', 'sky', 'snow', 'spain', 'spring', 'street', 'summer', 'sun', 'sunset', 'taiwan', 'texas', 'thailand', 'tokyo', 'toronto', 'tour', 'travel', 'tree', 'trees', 'trip', 'uk', 'urban', 'usa', 'vacation', 'vancouver', 'washington', 'water', 'wedding', 'white', 'winter', 'yellow', 'york', 'zoo');
     $emails = array('*****@*****.**', '*****@*****.**', '*****@*****.**');
     for ($i = 0; $i < count($emails); $i++) {
         $word1 = $randomWords[rand(0, count($randomWords))];
         $leetI = str_replace('i', '1', $word1);
         $leetE = str_replace('e', '3', $leetI);
         $word2 = ucfirst($randomWords[rand(0, count($randomWords) - 1)]);
         $hashed = md5($word2);
         $randSeed = substr($hashed, rand(0, strlen($hashed) - 1), 2);
         $pass = $leetE . $randSeed;
         $marker = new Marker();
         $marker->set('email', $emails[$i]);
         $marker->set('password', $marker->makePass($pass));
         $marker->create();
         echo 'marker email ' . $emails[$i] . ' with pass ' . $pass . '</br>';
         echo 'pass check ' . $marker->checkPass($pass) . '</br>' . '</br>';
     }
 }
Example #2
0
 /**
  * Creates new marker accounts from a list of emails and sends emails to new markers.
  *
  */
 function createmarkers()
 {
     if ($this->input->post('emails')) {
         $this->load->library('validation');
         $rules['emails'] = 'valid_emails|required';
         $fields['emails'] = 'referree emails';
         $this->validation->set_fields($fields);
         $this->validation->set_rules($rules);
         $this->validation->set_message('valid_emails', 'All email addresses entered into %s must be valid, seperated by commas');
         if ($this->validation->run() === TRUE) {
             $emails = explode(',', $this->input->post('emails'));
             $this->load->model('marker');
             $this->load->model('email');
             foreach ($emails as $email) {
                 $marker = new Marker();
                 $marker->setKey($email);
                 $password = $this->_createPassword();
                 $marker->set('password', $marker->makePass($password));
                 if ($marker->create()) {
                     $emailData['email'] = $email;
                     $emailData['password'] = $password;
                     $msg = $this->load->view('email/new_marker', $emailData, TRUE);
                     $subject = 'Next step in your application';
                     $emailToStore = new Email();
                     $emailToStore->set('sender', '*****@*****.**');
                     $emailToStore->set('receiver', $email);
                     $emailToStore->set('subject', $subject);
                     $emailToStore->set('message', $msg);
                     $emailToStore->create();
                     $viewData['messages'][] = "Successfully created marker account for {$email} with password {$password}";
                 } else {
                 }
             }
         }
     }
     if ($this->validation->error_string) {
         $viewData['errors'][] = $this->validation->error_string;
     }
     $viewData['token'] = $this->_token();
     $this->load->view('control/create_markers', $viewData);
 }
Example #3
0
 function index()
 {
     return;
     $this->load->model('marker');
     $emails = array('*****@*****.**', '*****@*****.**', '*****@*****.**');
     $words = array('dance', 'el3phant', 'cam3ra');
     $i = 1;
     foreach ($emails as $email) {
         $i++;
         if ($i > 2) {
             $i = 0;
         }
         $marker = new Marker();
         $pass = substr(uniqid(), 2, 2) . $words[$i];
         $marker->setKey($email);
         $newPass = $marker->makePass($pass);
         $marker->set('password', $newPass);
         $marker->create();
         echo '<br>Marker: ' . $email . '<br>Pass: ' . $pass;
     }
 }
Example #4
0
 function panel()
 {
     $this->load->model('marker');
     $this->load->model('assessment');
     $this->load->library('validation');
     $this->load->model('mark');
     $this->load->model('markerPref');
     // form submit names
     $updatePref = 'updatePref';
     $markerEmail = $this->session->userdata($this->_sessionAuthVar);
     $marker = new Marker();
     $marker->retrieve($markerEmail);
     $markerPref = new MarkerPref();
     $markerPref->retrieve($markerEmail);
     // do this first due to the hacky implementation - it will result in doubled validation
     // messages for every other form
     if ($this->_updatePref($marker, $markerPref)) {
         $viewData['checkpoints'][] = 'You have successfully updated your job update preferences';
     }
     // assessment fix required?
     $requireFix = array("*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**");
     $viewData['assessmentFix'] = false;
     if (in_array($this->_getUser(), $requireFix)) {
         $viewData['assessmentFix'] = true;
     }
     $this->load->model('assessmentFix');
     if ($viewData['assessmentFix']) {
         $assessmentFix = new AssessmentFix();
         $assessmentFix->setKey($this->_getUser());
         if ($assessmentFix->retrieve()) {
             $viewData['assessmentFix'] = false;
         }
     }
     if ($this->input->post('assessmentFix')) {
         if ($this->_checkToken()) {
             $this->load->library('validation');
             $rules['requireFix'] = 'required';
             $fields['requireFix'] = 'yes or no';
             $this->validation->set_rules($rules);
             $this->validation->set_fields($fields);
             if ($this->validation->run() === true) {
                 $assessmentFix = new AssessmentFix();
                 $assessmentFix->requireFix($this->input->post('requireFix'));
                 $assessmentFix->setKey($this->_getUser());
                 $assessmentFix->create();
                 $viewData['checkpoints'][] = 'You have registered for the assessment fix. You will paid a re-assessment bounty when you submit your assessment.';
                 $viewData['assessmentFix'] = false;
             }
         }
     }
     if ($this->input->post('changePassword')) {
         if ($this->_checkToken()) {
             $this->load->library('validation');
             $rules['currentPassword'] = '******';
             $rules['newPassword'] = '******';
             $rules['newPasswordRepeat'] = 'required|matches[newPassword]';
             $fields['currentPassword'] = '******';
             $fields['newPassword'] = '******';
             $fields['newPasswordRepeat'] = 'new password repeated';
             $this->validation->set_rules($rules);
             $this->validation->set_fields($fields);
             if ($this->validation->run() === true) {
                 $marker = new Marker();
                 $marker->setKey($this->_getUser());
                 $marker->retrieve();
                 if ($marker->get('password') === $marker->makePass($this->input->post('currentPassword'))) {
                     $marker->set('password', $marker->makePass($this->input->post('newPassword')));
                     $viewData['checkpoints'][] = 'You have successfully changed your password.';
                     $marker->update();
                 } else {
                     $viewData['errors'][] = 'You did not enter your current password correctly.';
                 }
             }
         }
     }
     $viewData['token'] = $this->_token();
     $viewData['markerPref'] = $markerPref;
     if ($this->session->flashdata('action')) {
         $viewData['checkpoints'][] = $this->session->flashdata('action');
     }
     $viewData['marker'] = $marker;
     $headData['js'][] = 'eb_ui';
     $viewData['assessment'] = false;
     $viewData[$updatePref] = $updatePref;
     if ($this->assessment->retrieve($marker->getKey())) {
         $viewData['assessment'] = true;
     }
     $this->load->view('html_head.php', $headData);
     $this->load->view('page_head.php', array('bodyId' => 'my account', 'userAuth' => @$this->session->userdata('email'), 'markerAuth' => @$this->session->userdata('markerEmail'), 'site_pages' => $this->config->item('site_pages')));
     $this->load->view('marker/panel', $viewData);
     $this->load->view('footer.php', array('site_base' => $this->config->item('base_url')));
 }