/** * @return Zing_Authv2 */ public static function getInstance() { if (null === self::$_instance) { self::$_instance = new self(); } return self::$_instance; }
public function init() { try { if ($this->_getParam('action') == 'balance' || $this->_getParam('action') == 'time') { return; } $config = Zend_Registry::get('appconf'); $storageAdapter = new Zing_Auth_Storage_Session(array('host' => $config->authorization->storage->host, 'port' => $config->authorization->storage->port)); //$auth=new Zing_App_Auth(); // $auth->setStorage($storageAdapter); $auth = Zing_Authv2::getInstance(); $isLogged = false; if ($auth->isLogged()) { $isLogged = true; $identity = $auth->getIdentity(); if (!$this->checkUser($identity['username'])) { $isLogged = false; } else { $this->userID = $this->uName2uID($identity['username']); $this->view->userID = $this->userID; } } if (!$isLogged) { echo "<p style='text-align:center'>Bạn chưa đăng nhập nên bạn không được phép truy cập hệ thống Ví Zing Me</p>"; exit; } //loidcit,nhutnguyenhong,namnq,hung.vo,andqt83 if ($config->maintain->flag == '1' && ($this->userID == '15948941' || $this->userID == '11298436' || $this->userID == '3804482' || $this->userID == '487796' || $this->userID == '382344')) { } else { if ($config->maintain->flag == '1') { echo 'Hệ Thống ZingCredits đang được bảo trì. Mời bạn quay lại sau.'; die; } } $this->userAppCache = Zing_UserApp_Cache_Adapter::factory(); if ($this->_getParam('action') == 'billstatus' || $this->_getParam('action') == 'ufora') { return; } if ($this->_getParam('userID') == '') { //sure that this is first time user request this page ScriberPayment::sendLogStep1($this->userID, $this->_getParam("appID")); $this->parseTransaction(); } if (!Zend_Registry::isRegistered('logger')) { require_once ROOT_PATH . '/util/Logger.php'; $logger = Logger::getLogger(); Zend_Registry::set('logger', $logger); } $this->view->appInfo = $this->getAppInfo($this->_getParam("appID")); $this->view->actionName = $this->getRequest()->getActionName(); $this->_cache = Zing_Token_Cache_Adapter::factory(); } catch (Exception $e) { $this->redirectError(); } }
public function init() { try { $config = Zend_Registry::get('appconf'); $storageAdapter = new Zing_Auth_Storage_Session(array('host' => $config->authorization->storage->host, 'port' => $config->authorization->storage->port)); //$auth=new Zing_App_Auth(); // $auth->setStorage($storageAdapter); $auth = Zing_Authv2::getInstance(); if ($auth->isLogged()) { $identity = $auth->getIdentity(); $this->userID = $this->uName2uID($identity['username']); $this->view->userID = $this->userID; if (!$this->checkUser($identity['username'])) { echo "<p style='text-align:center'>Bạn không được phép truy cập hệ thống Ví Zing Me</p>"; exit; } } $this->loadConfig(ROOT_PATH . '/config/config.ini'); require_once ROOT_PATH . '/util/Logger.php'; try { $balance = new Balance(); $res = $balance->getBalance($this->userID); if ($res->code == 0) { $this->view->balance = $res->currentBalance; } else { if ($res->code == -3) { $this->view->balance = 0; } else { $this->view->errMsg = "fail"; } } } catch (Exception $e) { } } catch (Exception $e) { echo 'Hệ Thống Ví Zing Me đang được bảo trì. Mời bạn quay lại sau.'; die; } }