Ejemplo n.º 1
0
 public function authenticate()
 {
     $mapper = new Application_Model_UsersMapper();
     $checkUser = $mapper->fetchAll($this->_user);
     if (!$checkUser) {
         $newUser = new Application_Model_Users(array('user' => $this->_user));
         $result = $mapper->create($newUser);
     }
     return new Zend_Auth_Result(Zend_Auth_Result::SUCCESS, $this->_user);
 }
Ejemplo n.º 2
0
 public function init()
 {
     $this->_user = Zend_Auth::getInstance()->getIdentity();
     $user = new Application_Model_UsersMapper();
     $result = $user->fetchAll($this->_user);
     $this->view->user = $result->user;
     $this->_state = $result->state;
     $this->view->state = $result->state;
     $this->view->key = empty($result->key) ? '' : base64_decode($result->key);
     $this->view->secret = empty($result->secret) ? '' : base64_decode($result->secret);
     $this->view->chartId = empty($result->chart_id) ? '' : $result->chart_id;
     $siteOptions = array('default' => array('refresh', 'Default'), 'validation_error' => array('flash', 'Validation Error'), 'css_error' => array('file-text-o', 'CSS Error'), 'js_error' => array('file-code-o', 'JavsScript Error'), '404' => array('info-circle', '40x Error'), '500' => array('warning', '50x Error'), 'delay' => array('circle-o-notch fa-spin', 'Content Delay'), 'timeout' => array('spinner fa-spin', 'Timeout'), 'cookies' => array('globe', 'Cookies'), 'hosts_and_zones' => array('filter', 'Hosts & Zones'), 'chrome' => array('chrome', 'Chrome'), 'glimpse' => array('users', 'Glimpse'));
     $this->view->menu = $siteOptions;
 }
Ejemplo n.º 3
0
 public function init()
 {
     if (!Zend_Auth::getInstance()->hasIdentity()) {
         // If the user is logged in, we don't want to show the login form;
         // however, the logout action should still be available
         $this->_helper->redirector('index', 'login');
     }
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender(true);
     $this->_user = Zend_Auth::getInstance()->getIdentity();
     $this->view->user = $this->_user;
     $user = new Application_Model_UsersMapper();
     $result = $user->fetchAll($this->_user);
     $this->_k = $result->key;
     $this->_s = $result->secret;
     $this->_key = base64_decode($result->key);
     $this->_secret = base64_decode($result->secret);
 }
Ejemplo n.º 4
0
 public function testAction()
 {
     if (!$this->_getParam('testid')) {
         throw new Exception('No Test ID found!');
     }
     $site = new Application_Model_UsersMapper();
     $result = $site->fetchAll($this->_user);
     $t = new Catchpoint_Pull();
     $t->override = true;
     $t->key = $result['key'];
     $t->secret = $result['secret'];
     $myArray[] = $t->fetchData('performance/favoriteCharts/' . $result['cid'] . '/data?tests=' . $this->_getParam('testid'));
     $tests = array();
     foreach ($myArray as $m) {
         foreach ($m->summary->items as $a) {
             $tests[] = array('name' => $a->breakdown_1->name, 'dns' => round($a->synthetic_metrics[0] / 1000, 3), 'wait' => round($a->synthetic_metrics[1] / 1000, 3), 'load' => round($a->synthetic_metrics[2] / 1000, 3), 'bytes' => round($a->synthetic_metrics[3] / 1000000, 2), 'doc_complete' => round($a->synthetic_metrics[4] / 1000, 2), 'webpage_response' => round($a->synthetic_metrics[5] / 1000, 2), 'items' => round($a->synthetic_metrics[6], 0));
         }
     }
     $this->session = new Zend_Session_Namespace('Catchpoint');
     $this->session->userChart = $tests[0];
     $this->session->userDetails = array($this->_getParam('name'), $this->_getParam('job_title'), $this->_getParam('contact_number'));
     $this->view->testDetails = $tests[0];
 }