示例#1
0
 function headerAction()
 {
     $sReturn = "http://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
     $sReturn = base64_encode($sReturn);
     $identity = Pandamp_Application::getResource('identity');
     $loginUrl = $identity->loginUrl;
     $logoutUrl = $identity->logoutUrl;
     $signUp = $identity->signUp;
     $profile = $identity->profile;
     $this->view->loginUrl = $loginUrl . '?returnTo=' . $sReturn;
     $this->view->logoutUrl = $logoutUrl . '/' . $sReturn;
     $this->view->signUp = $signUp;
     $this->view->profile = $profile;
     //$loginUrl = $identity->loginUrl;
     //$logoutUrl = $identity->logoutUrl;
     //$signUp = $identity->signUp;
     //$this->view->loginUrl = ROOT_URL.'/helper/synclogin/generate/?returnTo='.$sReturn;
     //$this->view->logoutUrl = $logoutUrl.'/?returnTo='.$sReturn;
     //$this->view->signUp = $signUp;
     $r = $this->getRequest();
     $node = $r->getParam('node') ? $r->getParam('node') : 'root';
     $modelFolder = new Pandamp_Modules_Dms_Folder_Model_Folder();
     $rowset = $modelFolder->getMenu($node);
     //$this->view->rowset = $rowset;
     /**
      * fungsi rubrikasi di non aktifkan
      * July 12, 2011
      */
     $this->view->rowset = "";
     $query = $this->_getParam('cari') ? $this->_getParam('cari') : '';
     $category = $this->_getParam('a') ? $this->_getParam('a') : '';
     $this->_helper->layout()->searchQuery = $query;
     $this->_helper->layout()->categorySearchQuery = $category;
 }
示例#2
0
 function preDispatch()
 {
     $auth = Zend_Auth::getInstance();
     $identity = Pandamp_Application::getResource('identity');
     $loginUrl = $identity->loginUrl;
     $sReturn = "http://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
     $sReturn = base64_encode($sReturn);
     if (!$auth->hasIdentity()) {
         $this->_redirect($loginUrl . '?returnUrl=' . $sReturn);
     } else {
         $this->_user = $auth->getIdentity();
         $zl = Zend_Registry::get("Zend_Locale");
         $acl = Pandamp_Acl::manager();
         if (!$acl->checkAcl("site", 'all', 'user', $this->_user->username, false, false)) {
             //$this->_redirect(ROOT_URL.'/'.$zl->getLanguage().'/error/restricted');
             $this->_forward('restricted', 'error', 'admin', array('lang' => $zl->getLanguage()));
         }
         // [TODO] else: check if user has access to admin page and status website is online
         $tblSetting = new App_Model_Db_Table_Setting();
         $rowset = $tblSetting->find(1)->current();
         if ($rowset) {
             if ($rowset->status == 1 && $zl->getLanguage() == 'id' || $rowset->status == 2 && $zl->getLanguage() == 'en' || $rowset->status == 3) {
                 // it means that user offline other than admin
                 $aReturn = App_Model_Show_AroGroup::show()->getUserGroup($this->_user->packageId);
                 if (isset($aReturn['name'])) {
                     //if (($aReturn[1] !== "admin"))
                     if ($aReturn['name'] !== "Master" && $aReturn['name'] !== "Super Admin") {
                         $this->_forward('temporary', 'error', 'admin');
                     }
                 }
             }
         }
     }
 }
示例#3
0
 public function preProcessSession()
 {
     $identity = Pandamp_Application::getResource('identity');
     $loginUrl = $identity->loginUrl;
     $sReturn = "http://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
     $sReturn = base64_encode($sReturn);
     $auth = Zend_Auth::getInstance();
     if (!$auth->hasIdentity()) {
         $this->_redirect($loginUrl . '?returnUrl=' . $sReturn);
     } else {
         $this->_user = $auth->getIdentity();
         $zl = Zend_Registry::get("Zend_Locale");
         $acl = Pandamp_Acl::manager();
         if (!$acl->checkAcl("site", 'all', 'user', $this->_user->username, false, false)) {
             $this->_forward('restricted', 'error', 'admin', array('lang' => $zl->getLanguage()));
         }
         $tblSetting = new App_Model_Db_Table_Setting();
         $rowset = $tblSetting->find(1)->current();
         if ($rowset) {
             if ($rowset->status == 1 && $zl->getLanguage() == 'id' || $rowset->status == 2 && $zl->getLanguage() == 'en' || $rowset->status == 3) {
                 if ($this->_user->name !== "Master" && $this->_user->name !== "Super Admin") {
                     $this->_forward('temporary', 'error', 'admin');
                 }
             }
         }
     }
 }
示例#4
0
 function __construct()
 {
     $multidb = Pandamp_Application::getResource('multidb');
     $multidb->init();
     $config = $multidb->getDb('db2');
     $this->_db = $config;
 }
示例#5
0
 function preDispatch()
 {
     $this->_helper->layout->setLayout('layout-pusatdata');
     $auth = Zend_Auth::getInstance();
     $identity = Pandamp_Application::getResource('identity');
     $loginUrl = $identity->loginUrl;
     /*
     $multidb = Pandamp_Application::getResource('multidb');
     $multidb->init();
     
     $db = $multidb->getDb('db2');
     */
     $sReturn = "http://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
     $sReturn = base64_encode($sReturn);
     //$sso = new Pandamp_Session_Remote();
     //$user = $sso->getInfo();
     if (!$auth->hasIdentity()) {
         //$this->_forward('login','account','admin');
         $this->_redirect($loginUrl . '?returnUrl=' . $sReturn);
     } else {
         $this->_user = $auth->getIdentity();
         $zl = Zend_Registry::get("Zend_Locale");
         $acl = Pandamp_Acl::manager();
         if (!$acl->checkAcl("site", 'all', 'user', $this->_user->username, false, false)) {
             //$this->_redirect(ROOT_URL.'/'.$zl->getLanguage().'/error/restricted');
             $this->_forward('restricted', 'error', 'admin', array('lang' => $zl->getLanguage()));
         }
         // [TODO] else: check if user has access to admin page and status website is online
         $tblSetting = new App_Model_Db_Table_Setting();
         $rowset = $tblSetting->find(1)->current();
         if ($rowset) {
             if ($rowset->status == 1 && $zl->getLanguage() == 'id' || $rowset->status == 2 && $zl->getLanguage() == 'en' || $rowset->status == 3) {
                 // it means that user offline other than admin
                 $aReturn = App_Model_Show_AroGroup::show()->getUserGroup($this->_user->packageId);
                 if (isset($aReturn['name'])) {
                     //if (($aReturn[1] !== "admin"))
                     if ($aReturn['name'] !== "Master" && $aReturn['name'] !== "Super Admin") {
                         $this->_forward('temporary', 'error', 'admin');
                     }
                 }
             }
         }
         // check session expire
         /*
         $timeLeftTillSessionExpires = $_SESSION['__ZF']['Zend_Auth']['ENT'] - time();
         
         if (Pandamp_Lib_Formater::diff('now', $this->_user->dtime) > $timeLeftTillSessionExpires) {
         	$db->update('KutuUser',array('ses'=>'*'),"ses='".Zend_Session::getId()."'");
         	$flashMessenger = Zend_Controller_Action_HelperBroker::getStaticHelper('FlashMessenger');
         		        $flashMessenger->addMessage('Session Expired');
         		        $auth->clearIdentity();
         		        
         		        $this->_redirect($loginUrl.'?returnUrl='.$sReturn);     
         }
         
         $dat = Pandamp_Lib_Formater::now();
         $db->update('KutuUser',array('dtime'=>$dat),"ses='".Zend_Session::getId()."'");
         */
     }
 }
示例#6
0
 public function preDispatch()
 {
     $this->_helper->layout->setLayout('lte');
     $auth = Zend_Auth::getInstance();
     $identity = Pandamp_Application::getResource('identity');
     $loginUrl = $identity->loginUrl;
     $multidb = Pandamp_Application::getResource('multidb');
     $multidb->init();
     $db = $multidb->getDb('db2');
     $sReturn = "http://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
     $sReturn = base64_encode($sReturn);
     if (!$auth->hasIdentity()) {
         $this->_redirect($loginUrl . '?returnUrl=' . $sReturn);
     } else {
         $this->_user = $auth->getIdentity();
         $logoutUrl = $identity->logoutUrl;
         $this->_signOut = $logoutUrl . '/returnUrl/' . $sReturn;
         $zl = Zend_Registry::get("Zend_Locale");
         $acl = Pandamp_Acl::manager();
         if (!$acl->checkAcl("site", 'all', 'user', $this->_user->username, false, false)) {
             header(ROOT_URL . '/' . $zl->getLanguage() . '/error/restricted');
         }
         $tblSetting = new App_Model_Db_Table_Setting();
         $rowset = $tblSetting->find(1)->current();
         if ($rowset) {
             if ($rowset->status == 1 && $zl->getLanguage() == 'id' || $rowset->status == 2 && $zl->getLanguage() == 'en' || $rowset->status == 3) {
                 if ($this->_user->name !== "Master" && $this->_user->name !== "Super Admin") {
                     $this->_forward('temporary', 'error', 'admin');
                 }
             }
         }
     }
 }
 public function generateAction()
 {
     $this->_helper->layout->disableLayout();
     $req = $this->getRequest();
     $returnTo = $req->getParam('returnTo') ? $req->getParam('returnTo') : ROOT_URL;
     setcookie('returnMeTo', base64_decode($returnTo), null, '/');
     $flagSessionIdSent = false;
     if (isset($_GET['PHPSESSID']) && !empty($_GET['PHPSESSID'])) {
         $sessid = $_GET['PHPSESSID'];
         Zend_Session::setId($sessid);
         $flagSessionIdSent = true;
     }
     if ($flagSessionIdSent) {
         $saveHandlerManager = new Pandamp_Session_SaveHandler_Manager();
         $saveHandlerManager->setSaveHandler();
         Zend_Session::start();
         if (isset($_COOKIE['returnMeTo']) && !empty($_COOKIE['returnMeTo'])) {
             header("location: " . $_COOKIE['returnMeTo']);
             exit;
         }
     } else {
         $identity = Pandamp_Application::getResource('identity');
         $url = $identity->loginUrl;
         $sReturn = ROOT_URL . '/helper/synclogin/generate';
         $sReturn = base64_encode($sReturn);
         header("location: {$url}/?returnTo=" . $sReturn);
         exit;
     }
 }
示例#8
0
 function preDispatch()
 {
     $auth = Zend_Auth::getInstance();
     if (!$auth->hasIdentity()) {
         $sReturn = "http://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
         $sReturn = base64_encode($sReturn);
         $identity = Pandamp_Application::getResource('identity');
         $loginUrl = $identity->loginUrl;
         $this->_redirect($loginUrl . '?returnTo=' . $sReturn);
         //$this->_redirect(ROOT_URL.'/helper/synclogin/generate/?returnTo='.$sReturn);
     } else {
         // [TODO] else: check if user has access to admin page
         $username = $auth->getIdentity()->username;
         // get group information
         $acl = Pandamp_Acl::manager();
         $aReturn = $acl->getUserGroupIds($username);
         // [TODO] else: check if user has access to admin page and status website is online
         $tblSetting = new Pandamp_Modules_Misc_Setting_Model_Setting();
         $rowset = $tblSetting->find(1)->current();
         if ($rowset) {
             if ($rowset->status == 1) {
                 // it means that user offline other than admin
                 if (isset($aReturn[1])) {
                     if ($aReturn[1] !== "Master" && $aReturn[1] !== "Super Admin") {
                         $this->_forward('temporary', 'error', 'admin');
                     }
                 }
             } else {
                 return;
             }
         }
     }
 }
示例#9
0
 function preDispatch()
 {
     $this->_helper->layout->setLayout('layout-store');
     $this->_helper->layout->setLayoutPath(array('layoutPath' => ROOT_DIR . '/app/modules/hol-site/layouts'));
     Zend_Session::start();
     $sReturn = "http://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
     $sReturn = base64_encode($sReturn);
     $identity = Pandamp_Application::getResource('identity');
     $loginUrl = $identity->loginUrl;
     //$loginUrl = ROOT_URL.'/helper/synclogin/generate/?returnTo='.$sReturn;
     $auth = Zend_Auth::getInstance();
     if (!$auth->hasIdentity()) {
         $this->_redirect($loginUrl . '?returnTo=' . $sReturn);
         //$this->_redirect($loginUrl);
     } else {
         // [TODO] else: check if user has access to admin page
         $username = $auth->getIdentity()->username;
         $this->view->username = $username;
     }
     $userId = $auth->getIdentity()->guid;
     $this->_userId = $userId;
     $tblUserFinance = new Pandamp_Modules_Identity_UserFinance_Model_UserFinance();
     $this->_userInfo = $tblUserFinance->find($userId)->current();
     $storeConfig = Pandamp_Application::getOption('store');
     $this->_configStore = $storeConfig;
 }
示例#10
0
 function preDispatch()
 {
     $this->view->addHelperPath(ROOT_DIR . '/library/Pandamp/Controller/Action/Helper', 'Pandamp_Controller_Action_Helper');
     $auth = Zend_Auth::getInstance();
     if (!$auth->hasIdentity()) {
         $sReturn = "http://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
         $sReturn = base64_encode($sReturn);
         $identity = Pandamp_Application::getResource('identity');
         $loginUrl = $identity->loginUrl;
         $this->_redirect($loginUrl . '?returnTo=' . $sReturn);
         //$this->_redirect(ROOT_URL.'/helper/synclogin/generate/?returnTo='.$sReturn);
     } else {
         // [TODO] else: check if user has access to admin page
         $username = $auth->getIdentity()->username;
         // get group information
         $acl = Pandamp_Acl::manager();
         $aReturn = $acl->getUserGroupIds($username);
         if (isset($aReturn[1])) {
             //if ($aReturn[1] !== "admin")
             if ($aReturn[1] !== "Master" && $aReturn[1] !== "Super Admin") {
                 $this->_helper->redirector('restricted', "error", 'admin');
             }
         }
     }
 }
示例#11
0
 function reindexAction()
 {
     if (!Pandamp_Controller_Action_Helper_IsAllowed::isAllowed('indexing', 'all')) {
         die("You are not authorized to access this page.");
     }
     $indexing = Pandamp_Application::getResource('indexing');
     $indexing->reIndexCatalog();
 }
示例#12
0
 public function runJobAction()
 {
     $resource = Pandamp_Application::getOption('resources')['multidb'];
     $options = array('name' => self::NAME_ORDERQUEUE, 'driverOptions' => array('host' => $resource['db1']['host'], 'port' => '3306', 'username' => $resource['db1']['username'], 'password' => $resource['db1']['password'], 'dbname' => $resource['db1']['dbname'], 'type' => $resource['db1']['adapter']));
     include_once 'Pandamp/Job/Queue.php';
     $queue = new Pandamp_Job_Queue('Db', $options);
     $queue->runJobs();
 }
示例#13
0
 function preDispatch()
 {
     $this->_helper->layout->setLayout('layout-store-checkout');
     Zend_Session::start();
     $storeConfig = Pandamp_Application::getOption('store');
     $this->_configStore = $storeConfig;
     $sReturn = "http://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
     $sReturn = base64_encode($sReturn);
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $this->_user = $auth->getIdentity();
     }
 }
示例#14
0
 protected function checkExist($guid)
 {
     $multidb = Pandamp_Application::getResource('multidb');
     $multidb->init();
     $registry = Zend_Registry::getInstance();
     $application = Zend_Registry::get(Pandamp_Keys::REGISTRY_APP_OBJECT);
     $db = $multidb->getDb('db6');
     $db->setFetchMode(Zend_Db::FETCH_OBJ);
     $select = $db->select();
     $select->from($application->getOption('resources')['pio']['eventfield'], '*');
     $select->where("properties LIKE '%{$guid}%'");
     $row = $db->fetchRow($select);
     return $row;
 }
示例#15
0
 function headerAction()
 {
     $sReturn = "http://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
     $sReturn = base64_encode($sReturn);
     $identity = Pandamp_Application::getResource('identity');
     $loginUrl = $identity->loginUrl;
     $logoutUrl = $identity->logoutUrl;
     $signUp = $identity->signUp;
     $profile = $identity->profile;
     $this->view->loginUrl = $loginUrl . '?returnTo=' . $sReturn;
     $this->view->logoutUrl = $logoutUrl . '/' . $sReturn;
     $this->view->signUp = $signUp;
     $this->view->profile = $profile;
 }
示例#16
0
 function preDispatch()
 {
     $this->_helper->layout->setLayout('layout-store');
     Zend_Session::start();
     $sReturn = "http://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
     $sReturn = base64_encode($sReturn);
     $auth = Zend_Auth::getInstance();
     if (!$auth->hasIdentity()) {
         $identity = Pandamp_Application::getResource('identity');
         $loginUrl = $identity->loginUrl;
         $this->_redirect($loginUrl . '?returnTo=' . $sReturn);
     } else {
         $this->_user = $auth->getIdentity();
     }
 }
示例#17
0
 function preDispatch()
 {
     $this->_helper->layout->setLayout('layout-store');
     Zend_Session::start();
     $storeConfig = Pandamp_Application::getOption('store');
     $this->_configStore = $storeConfig;
     $sReturn = "http://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
     $sReturn = base64_encode($sReturn);
     $auth = Zend_Auth::getInstance();
     //        $sso = new Pandamp_Session_Remote();
     //        $user = $sso->getInfo();
     if (!$auth->hasIdentity()) {
         //            $this->_helper->redirector('login','account','identity',array('sReturn'=>$sReturn));
     } else {
         $this->_user = $auth->getIdentity();
     }
 }
示例#18
0
 function advancedAction()
 {
     $sReturn = "http://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
     $sReturn = base64_encode($sReturn);
     $identity = Pandamp_Application::getResource('identity');
     $loginUrl = $identity->loginUrl;
     $logoutUrl = $identity->logoutUrl;
     $signUp = $identity->signUp;
     $profile = $identity->profile;
     $this->view->loginUrl = $loginUrl . '?returnTo=' . $sReturn;
     $this->view->logoutUrl = $logoutUrl . '/' . $sReturn;
     $this->view->signUp = $signUp;
     $this->view->profile = $profile;
     if ($this->getRequest()->isPost()) {
         $value = $this->getRequest()->getPost();
         $this->_forward("advpost", "search", "dms", array('value' => $value));
     }
 }
示例#19
0
文件: Cli.php 项目: hukumonline/admin
 function preDispatch()
 {
     $indexing = new Zend_Config_Ini(APPLICATION_PATH . '/configs/application-cli.ini', 'indexing');
     $host = $indexing->solr->write->host;
     $port = $indexing->solr->write->port;
     //$this->_solr = new Apache_Solr_Service( 'nihki:sirkulasi@localhost', '8983' );
     $this->_solr = new Apache_Solr_Service($host, $port);
     $multidb = Pandamp_Application::getResource('multidb');
     $multidb->init();
     $this->db = $multidb->getDb('db1');
     $this->db2 = $multidb->getDb('db2');
     $this->db3 = $multidb->getDb('db3');
     $this->db4 = $multidb->getDb('db4');
     // @todo
     // untuk shortener
     //Zend_Registry::set('db4', $multidb->getDb('db3'));
     $this->flush();
 }
示例#20
0
 function indexAction()
 {
     $sReturn = "http://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
     $sReturn = base64_encode($sReturn);
     $identity = Pandamp_Application::getResource('identity');
     $logoutUrl = $identity->logoutUrl;
     //$logoutUrl = $identity->logoutUrl;
     $auth = Zend_Auth::getInstance();
     $packageId = $auth->getIdentity()->packageId;
     //$this->view->logoutUrl = $logoutUrl.'/'.$sReturn;
     $this->view->logoutUrl = $logoutUrl . '/' . $sReturn;
     // get group information
     $acl = Pandamp_Acl::manager();
     $modelAroGroup = new Pandamp_Modules_Identity_Group_Folder_AroGroup();
     //$aReturn = $acl->getUserGroupIds(Zend_Auth::getInstance()->getIdentity()->username);
     $aReturn = $modelAroGroup->getUserGroup($packageId);
     //$this->view->group = (isset($aReturn[1]))? $aReturn[1] : '-';
     $this->view->group = $aReturn['name'];
 }
示例#21
0
 function preDispatch()
 {
     $auth = Zend_Auth::getInstance();
     if (!$auth->hasIdentity()) {
         $sReturn = "http://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
         $sReturn = base64_encode($sReturn);
         $identity = Pandamp_Application::getResource('identity');
         $loginUrl = $identity->loginUrl;
         $this->_redirect($loginUrl . '?returnTo=' . $sReturn);
         //$this->_redirect(ROOT_URL.'/helper/synclogin/generate/?returnTo='.$sReturn);
     } else {
         // [TODO] else: check if user has access to admin page
         $username = $auth->getIdentity()->username;
         // get group information
         $acl = Pandamp_Acl::manager();
         $aReturn = $acl->getUserGroupIds($username);
         if (isset($aReturn[1])) {
             //if (($aReturn[1] !== "admin") && ($aReturn[1] !== "news_admin"))
             if ($aReturn[1] !== "Master" && $aReturn[1] !== "Super Admin" && $aReturn[1] !== "News Admin") {
                 echo "{success:false, error:'Page restricted!!'}";
                 die;
             }
         }
         // [TODO] else: check if user has access to admin page and status website is online
         $tblSetting = new Pandamp_Modules_Misc_Setting_Model_Setting();
         $rowset = $tblSetting->find(1)->current();
         if ($rowset) {
             if ($rowset->status == 1) {
                 // it means that user offline other than admin
                 if (isset($aReturn[1])) {
                     //if (($aReturn[1] !== "admin"))
                     if ($aReturn[1] !== "Master" && $aReturn[1] !== "Super Admin") {
                         echo "{success:false, error:'The page you are looking for is temporarily unavailable.<br/>Please try again later.'}";
                         die;
                     }
                 }
             } else {
                 return;
             }
         }
     }
 }
示例#22
0
 public function authenticate()
 {
     $registry = Zend_Registry::getInstance();
     $config = $registry->get(Pandamp_Keys::REGISTRY_APP_OBJECT);
     $config = Pandamp_Application::getResource('identity');
     $authAdapter = $config->authAdapter;
     $authAdapter->setIdentity($this->_identity)->setCredential($this->_credential);
     $auth = Zend_Auth::getInstance();
     $this->_authResult = $auth->authenticate($authAdapter);
     if ($this->_authResult->isValid()) {
         $data = $authAdapter->getResultRowObject();
         $auth->getStorage()->write($data);
         return $this->_authResult;
     } else {
         if ($this->_authResult->getCode() != -51) {
             Zend_Auth::getInstance()->clearIdentity();
         }
         return $this->_authResult;
     }
 }
示例#23
0
 public function authenticate()
 {
     $identity = Pandamp_Application::getResource('identity');
     $authAdapter = $identity->authAdapter;
     $authAdapter->setIdentity($this->_identity)->setCredential($this->_credential);
     $auth = Zend_Auth::getInstance();
     $this->_authResult = $auth->authenticate($authAdapter);
     if ($this->_authResult->isValid()) {
         // success : store database row to auth's storage
         $data = $authAdapter->getResultRowObject();
         $auth->getStorage()->write($data);
         return $this->_authResult;
     } else {
         if ($this->_authResult->getCode() != -51) {
             // failure : clear database row from session
             Zend_Auth::getInstance()->clearIdentity();
         }
         return $this->_authResult;
     }
 }
 function preDispatch()
 {
     $this->view->addHelperPath(ROOT_DIR . '/library/Pandamp/Controller/Action/Helper', 'Pandamp_Controller_Action_Helper');
     $auth = Zend_Auth::getInstance();
     if (!$auth->hasIdentity()) {
         $sReturn = "http://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
         $sReturn = base64_encode($sReturn);
         $identity = Pandamp_Application::getResource('identity');
         $loginUrl = $identity->loginUrl;
         $this->_redirect($loginUrl . '?returnTo=' . $sReturn);
         //$this->_redirect(ROOT_URL.'/helper/synclogin/generate/?returnTo='.$sReturn);
     } else {
         // [TODO] else: check if user has access to admin page
         $username = $auth->getIdentity()->username;
         $this->view->username = $username;
         $acl = Pandamp_Acl::manager();
         $aReturn = $acl->getUserGroupIds($username);
         if (isset($aReturn[1])) {
             if ($aReturn[1] !== "Master" && $aReturn[1] !== "Super Admin" && $aReturn[1] !== "Dc Admin" && $aReturn[1] !== "Dc Editor" && $aReturn[1] !== "Dc Coordinator" && $aReturn[1] !== "News Admin" && $aReturn[1] !== "News Editor" && $aReturn[1] !== "HolProject" && $aReturn[1] !== "Clinic Admin" && $aReturn[1] !== "Marketing") {
                 $this->_helper->redirector('restricted', "error", 'admin');
             }
         }
         // [TODO] else: check if user has access to admin page and status website is online
         $tblSetting = new Pandamp_Modules_Misc_Setting_Model_Setting();
         $rowset = $tblSetting->find(1)->current();
         if ($rowset) {
             if ($rowset->status == 1) {
                 // it means that user offline other than admin
                 if (isset($aReturn[1])) {
                     //if (($aReturn[1] !== "admin"))
                     if ($aReturn[1] !== "Master" && $aReturn[1] !== "Super Admin") {
                         $this->_forward('temporary', 'error', 'admin');
                     }
                 }
             } else {
                 return;
             }
         }
     }
 }
示例#25
0
 function preDispatch()
 {
     $this->_helper->layout->setLayout('layout-polling');
     $auth = Zend_Auth::getInstance();
     $identity = Pandamp_Application::getResource('identity');
     $sReturn = "http://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
     $sReturn = base64_encode($sReturn);
     //$sso = new Pandamp_Session_Remote();
     //$user = $sso->getInfo();
     if (!$auth->hasIdentity()) {
         //$this->_forward('login','account','admin');
         $loginUrl = $identity->loginUrl;
         $this->_redirect($loginUrl . '?returnUrl=' . $sReturn);
     } else {
         $this->_user = $auth->getIdentity();
         $acl = Pandamp_Acl::manager();
         if (!$acl->checkAcl("site", 'all', 'user', $this->_user->username, false, false)) {
             $zl = Zend_Registry::get("Zend_Locale");
             $this->_redirect(ROOT_URL . '/' . $zl->getLanguage() . '/error/restricted');
         }
     }
 }
示例#26
0
<?php

error_reporting(E_ALL | E_STRICT);
require_once "../../baseinit.php";
//ensure resource Session has/is initialized;
//$application->getBootstrap()->bootstrap('session');
//$application->getBootstrap()->getResource('session');
//require_once("Kutu/Application.php");
Pandamp_Application::getResource('session');
Pandamp_Application::getResource('multidb');
// THIS FILE TAKES INPUT FROM AJAX REQUESTS VIA JQUERY post AND get METHODS, THEN PASSES DATA TO JCART
// RETURNS UPDATED CART HTML BACK TO SUBMITTING PAGE
// INCLUDE JCART BEFORE SESSION START
include 'jcart.php';
// START SESSION
//session_start();
Zend_Session::start();
// INITIALIZE JCART AFTER SESSION START
$cart =& $_SESSION['jCart'];
if (!is_object($cart)) {
    $cart = new jCart();
}
// PROCESS INPUT AND RETURN UPDATED CART HTML
$cart->display_cart($jcart);
示例#27
0
 public function jCartIsItemSellable($catalogGuid)
 {
     //apakah pernah dibeli
     $hasBought = false;
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $bpm = new Pandamp_Core_Hol_Catalog();
         $hasBought = $bpm->isBoughtByUser($catalogGuid, $auth->getIdentity()->kopel);
     }
     if ($hasBought) {
         $aReturn['isError'] = true;
         $aReturn['message'] = 'You have bought this Item before. Please check your account.';
         $aReturn['code'] = 1;
         return $aReturn;
     }
     Pandamp_Application::getResource('multidb');
     require_once ROOT_DIR . '/app/models/Db/Table/Catalog.php';
     require_once ROOT_DIR . '/app/models/Db/Table/Rowset/CatalogAttribute.php';
     require_once ROOT_DIR . '/app/models/Db/Table/Row/Catalog.php';
     // if status=draft then return false
     $tblCatalog = new App_Model_Db_Table_Catalog();
     $rowCatalog = $tblCatalog->find($catalogGuid)->current();
     if ($rowCatalog) {
         if ($rowCatalog->status != 99) {
             $aReturn['isError'] = true;
             $aReturn['message'] = 'This item is not ready to be bought yet.';
             $aReturn['code'] = 1;
             return $aReturn;
         }
         // if price <= 0 then return false
         if ($rowCatalog->price <= 0) {
             $aReturn['isError'] = true;
             $aReturn['message'] = 'This item is for FREE.';
             $aReturn['code'] = 2;
             return $aReturn;
         }
         /*
         $tblRelatedItem = new Pandamp_Modules_Dms_Catalog_Model_RelatedItem();
         $where = "relatedGuid='$catalogGuid' AND relateAs='RELATED_FILE'";
         $rowsetRelatedItem = $tblRelatedItem->fetchAll($where);
         if(count($rowsetRelatedItem) > 0)
         {
             //check if the physical FILE is available in uploads directory.
             $flagFileFound = true;
         
             foreach($rowsetRelatedItem as $rowRelatedItem)
             {
                 $tblCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog();
                 $rowsetCatalogFile = $tblCatalog->find($rowRelatedItem->itemGuid);
         
                 $rowCatalogFile = $rowsetCatalogFile->current();
                 $rowsetCatAtt = $rowCatalogFile->findDependentRowsetCatalogAttribute();
         
                 $contentType = $rowsetCatAtt->findByAttributeGuid('docMimeType')->value;
                 $systemname = $rowsetCatAtt->findByAttributeGuid('docSystemName')->value;
                 $filename = $rowsetCatAtt->findByAttributeGuid('docOriginalName')->value;
         
                 if(true)
                 {
                     $parentGuid = $rowRelatedItem->relatedGuid;
                     $sDir1 = ROOT_DIR.DIRECTORY_SEPARATOR.'uploads'.DIRECTORY_SEPARATOR.'files'.DIRECTORY_SEPARATOR.$systemname;
                     $sDir2 = ROOT_DIR.DIRECTORY_SEPARATOR.'uploads'.DIRECTORY_SEPARATOR.'files'.DIRECTORY_SEPARATOR.$parentGuid.DIRECTORY_SEPARATOR.$systemname;
         
                     if(file_exists($sDir1))
                     {
                         //$flagFileFound = true;
                     }
                     else
                         if(file_exists($sDir2))
                         {
                                 //$flagFileFound = true;
                         }
                         else
                         {
                                 $flagFileFound = false;
                         }
                 }
             }
         
             if($flagFileFound)
             {
                 $aReturn['isError'] = false;
                 $aReturn['message'] = 'This item is SELLABLE.';
                 $aReturn['code'] = 99;
                 return $aReturn;
             }
             else
             {
                 $aReturn['isError'] = true;
                 $aReturn['message'] = 'We are Sorry. The document(s) you are requesting is still under review. Please check back later.';
                 $aReturn['code'] = 5;
                 return $aReturn;
             }
         
         }
         else
         {
             $aReturn['isError'] = true;
             $aReturn['message'] = 'We are Sorry. The document(s) you are requesting is still being prepared. Please check back later.';
             $aReturn['code'] = 5;
             return $aReturn;
         }
         */
     } else {
         $aReturn['isError'] = true;
         $aReturn['message'] = 'Can not find your selected item(s).';
         $aReturn['code'] = 10;
         return $aReturn;
     }
     //if ada record related document, but tidak ada dokumen fisik, then return false
     // if tidak ada record related document (blm ada dokumen/file diupload), then return false
     // if pernah dibeli user sebelumnya, then return false
 }
示例#28
0
 public function isBoughtByUser($catalogGuid, $userId)
 {
     $db = Pandamp_Application::getResource('db');
     $dbResult = $db->query("SELECT KOD.*, KO.datePurchased AS purchasingDate\r\n                                FROM\r\n                                KutuOrderDetail AS KOD,\r\n\t\t\t\t\t\t\t\tKutuOrder AS KO \r\n                                WHERE \r\n\t\t\t\t\t\t\t\t\tKO.orderId = KOD.orderId\r\n\t\t\t\t\t\t\t\tAND\r\n\t\t\t\t\t\t\t\t\tuserId = '{$userId}'\r\n\t\t\t\t\t\t\t\tAND\r\n\t\t\t\t\t\t\t\t\t(KO.orderStatus = 3 \r\n\t\t\t\t\t\t\t\t\tOR\r\n\t\t\t\t\t\t\t\t\tKO.orderStatus = 5)\r\n\t\t\t\t\t\t\t\tAND \r\n\t\t\t\t\t\t\t\t\titemId LIKE '{$catalogGuid}'");
     //LIMIT $offset, $limit");
     $aResult = $dbResult->fetchAll(Zend_Db::FETCH_ASSOC);
     //var_dump($aResult);
     //die();
     if (count($aResult) > 0) {
         return true;
     } else {
         return false;
     }
 }
示例#29
0
<?php

error_reporting(E_ALL | E_STRICT);
require_once "../baseinit.php";
Pandamp_Application::getResource('session');
Pandamp_Application::getResource('db');
$transidmerchant = $_GET['OrderNumber'];
$responseCode = $_GET['RESPONSECODE'];
$cardNumber = $_GET['CARDNUMBER'];
$bank = $_GET['BANK'];
$approvalCode = $_GET['APPROVALCODE'];
$result = strtoupper($_GET['RESULT']);
$tblOrder = new Pandamp_Modules_Payment_Order_Model_Order();
$rowOrder = $tblOrder->fetchRow("invoiceNumber='" . $transidmerchant . "' AND orderStatus=1");
$datenow = date('YmdHis');
if ($_SERVER['REMOTE_ADDR'] == "203.190.41.220") {
    if ($rowOrder > 0) {
        if ($result == "SUCCESS") {
            //$rowOrder->orderStatus = 14;
            $rowOrder->paymentDate = $datenow;
            $data = array('status' => 'notify', 'responseCode' => $responseCode, 'creditcard' => $cardNumber, 'bank' => $bank, 'approvalCode' => $approvalCode);
            $tblNsiapay = new Pandamp_Modules_Payment_Nsiapay_Model_Nsiapay();
            $tblNsiapay->update($data, "transidmerchant='" . $transidmerchant . "'");
            $tblNhis = new Pandamp_Modules_Payment_NsiapayHistory_Model_NsiapayHistory();
            $tblNhis->insert(array('orderId' => $rowOrder->orderId, 'paymentStatus' => 'notify', 'dateAdded' => date('YmdHis')));
            $response = "Continue";
        } else {
            //$rowOrder->orderStatus = 15;
            $rowOrder->paymentDate = $datenow;
            $response = "Stop";
        }
示例#30
0
 private function _checkAuth()
 {
     $sReturn = "http://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
     $sReturn = base64_encode($sReturn);
     $identity = Pandamp_Application::getResource('identity');
     $loginUrl = $identity->loginUrl;
     //$loginUrl = ROOT_URL.'/helper/synclogin/generate/?returnTo='.$sReturn;
     $auth = Zend_Auth::getInstance();
     $userId = $auth->getIdentity()->guid;
     if (!$auth->hasIdentity()) {
         //$this->_redirect($loginUrl);
         $this->_redirect($loginUrl . '?returnTo=' . $sReturn);
     } else {
         // [TODO] else: check if user has access to admin page
         $username = $auth->getIdentity()->username;
         $this->view->username = $username;
     }
     $tblUser = new Pandamp_Modules_Identity_User_Model_User();
     $this->_userDetailInfo = $tblUser->find($userId)->current();
     $tblUserFinance = new Pandamp_Modules_Identity_UserFinance_Model_UserFinance();
     $this->_userInfo = $tblUserFinance->find($userId)->current();
     if (empty($this->_userInfo)) {
         $finance = $tblUserFinance->fetchNew();
         $finance['userId'] = $userId;
         $finance->save();
         $this->_userInfo = $tblUserFinance->find($userId)->current();
     }
 }