Пример #1
0
 public function checkfastlinkAction()
 {
     $request = $this->getRequest();
     $fastlink = $request->getParam('id');
     $link_exist = Fastlinks::findbyCode($fastlink);
     if (count($link_exist) > 0) {
         echo 1;
     } else {
         echo 0;
     }
     die;
 }
Пример #2
0
 public function linkAction()
 {
     $request = $this->getRequest();
     $NS = new Zend_Session_Namespace('Default');
     try {
         $code = $request->getParam('id');
         $link = Fastlinks::findbyCode($code);
         $auth = Zend_Auth::getInstance();
         $auth->setStorage(new Zend_Auth_Storage_Session('default'));
         if (!empty($link[0]['controller'])) {
             $customer = Customers::find($link[0]['customer_id']);
             //TODO: GUEST - ALE - 20130516: remove access for disabled customers
             if (isset($customer) && in_array($customer['status_id'], array(Statuses::id("active", "customers"), Statuses::id("disabled", "customers")))) {
                 $NS->customer = $customer;
                 Fastlinks::updateVisits($link[0]['fastlink_id']);
                 $this->_helper->redirector($link[0]['action'], $link[0]['controller'], 'default', json_decode($link[0]['params'], true));
             } else {
                 header('location: /customer/login');
                 die;
             }
         } else {
             header('location: /customer/login');
             die;
         }
     } catch (Exception $e) {
         echo $e->getMessage();
         die;
     }
 }
Пример #3
0
 public function linkAction()
 {
     $request = $this->getRequest();
     try {
         $code = $request->getParam('id');
         $keypass = $request->getParam('keypass');
         $link = Fastlinks::findbyCode($code);
         $auth = Zend_Auth::getInstance();
         if (!empty($link[0]['controller']) && !empty($link[0]['action'])) {
             $adapter = new Shineisp_Auth_Adapter_Secretkey(Doctrine_Manager::connection()->getTable("AdminUser"), "email");
             $adapter->setIdentity($keypass);
             $adapter->setType('operator');
             $auth->setStorage(new Zend_Auth_Storage_Session('admin'));
             $auth->authenticate($adapter);
             // Check if the credentials are set in the Operator profile or the credentials are set in the ISP profile
             if ($auth->hasIdentity()) {
                 Fastlinks::updateVisits($link[0]['fastlink_id']);
                 Shineisp_Commons_Utilities::log("Login: The user has been logged in correctly from " . $_SERVER['REMOTE_ADDR'], "login.log");
                 $this->_helper->redirector($link[0]['action'], $link[0]['controller'], 'admin', json_decode($link[0]['params'], true));
             } else {
                 // Check if the credentials are set in the Isp profile
                 $adapter->setType('isp');
                 $auth->setStorage(new Zend_Auth_Storage_Session('admin'));
                 $auth->authenticate($adapter);
                 if ($auth->hasIdentity()) {
                     Fastlinks::updateVisits($link[0]['fastlink_id']);
                     Shineisp_Commons_Utilities::log("Login: The user has been logged in correctly from " . $_SERVER['REMOTE_ADDR'], "login.log");
                     $this->_helper->redirector($link[0]['action'], $link[0]['controller'], 'admin', json_decode($link[0]['params'], true));
                 } else {
                     $auth->clearIdentity();
                     header('location: /admin');
                     die;
                 }
             }
         } else {
             $auth->clearIdentity();
             header('location: /admin');
             die;
         }
     } catch (Exception $e) {
         echo $e->getMessage();
         die;
     }
 }