Ejemplo n.º 1
0
 function indexAction()
 {
     $request = $this->getRequest();
     $tblSetting = new App_Model_Db_Table_Setting();
     $rowset = $tblSetting->find(1)->current();
     if ($request->isPost()) {
         $data = array('status' => $request->getPost('status'), 'frontend' => $request->getPost('frontend'), 'searchend' => $request->getPost('searchend'), 'logstat' => $request->getPost('logstat'), 'shortstat' => $request->getPost('shortstat'));
         $tblSetting->update($data, "id=1");
         $rowset = $tblSetting->find(1)->current();
         $this->view->assign('rowset', $rowset);
     }
     if ($rowset) {
         $this->view->assign('rowset', $rowset);
     }
 }
Ejemplo n.º 2
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()."'");
         */
     }
 }
Ejemplo n.º 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');
                 }
             }
         }
     }
 }
Ejemplo n.º 4
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');
                     }
                 }
             }
         }
     }
 }
Ejemplo n.º 5
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');
                 }
             }
         }
     }
 }
Ejemplo n.º 6
0
 function changeStatusAction()
 {
     $status = $this->_getParam('status') ? $this->_getParam('status') : '';
     switch ($status) {
         case 'online':
             $status = 0;
             break;
         case 'offline':
             $status = 1;
             break;
     }
     $tblSetting = new App_Model_Db_Table_Setting();
     $rowset = $tblSetting->find(1)->current();
     if ($rowset) {
         $rowset->status = $status;
         $rowset->save();
         $this->view->success = true;
     } else {
         $this->view->success = false;
     }
 }
Ejemplo n.º 7
0
 function preDispatch()
 {
     $this->_helper->layout->setLayout('layout-search-result');
     $zl = Zend_Registry::get('Zend_Locale');
     if ($zl->getLanguage() == "id") {
         $this->_status = "status:99";
     } else {
         $this->_status = "status:1";
     }
     // [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) {
             // it means that user offline other than admin
             $this->_redirect(ROOT_URL . '/' . $zl->getLanguage() . '/default/offline/temporary');
         } else {
             return;
         }
     }
 }
Ejemplo n.º 8
0
 function moveFolderAction()
 {
     $urlReferer = $_SERVER['HTTP_REFERER'];
     $r = $this->getRequest();
     $guid = explode(',', $r->getParam('guid'));
     if (is_array($guid)) {
         $sGuid = '';
         $sTitle = '';
         for ($i = 0; $i < count($guid); $i++) {
             $sGuid .= $guid[$i] . ';';
             $modelCatalog = App_Model_Show_Catalog::show()->getCatalogByGuid($guid[$i]);
             if ($modelCatalog['profileGuid'] == "klinik") {
                 $sTitle .= App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($guid[$i], "fixedCommentTitle") . ', ';
             } else {
                 $sTitle .= App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($guid[$i], "fixedTitle") . ', ';
             }
         }
         $guid = $sGuid;
     } else {
         $sTitle = '';
         if (!empty($guid)) {
             $modelCatalog = App_Model_Show_Catalog::show()->getCatalogByGuid($guid);
             if ($modelCatalog['profileGuid'] == "klinik") {
                 $sTitle .= App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($guid, "fixedCommentTitle") . ', ';
             } else {
                 $sTitle .= App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($guid, "fixedTitle");
             }
         }
     }
     $this->view->catalogTitle = $sTitle;
     $this->view->guid = $guid;
     $sourceNode = $r->getParam('sourceNode');
     $this->view->sourceNode = $sourceNode;
     $this->_helper->layout()->headerTitle = "Catalog Management: Move to Folder";
     if ($r->isPost()) {
         $sessHistory = new Zend_Session_Namespace('BROWSER_HISTORY');
         $urlReferer = $sessHistory->urlReferer;
         $guid = explode(',', $r->getParam('guid'));
         $req = $this->getRequest();
         $targetNode = $req->getParam('targetNode');
         $tblCatalog = new App_Model_Db_Table_Catalog();
         $queue = Zend_Registry::get(Bootstrap::NAME_ORDERQUEUE);
         if (is_array($guid)) {
             foreach ($guid as $tmpGuid) {
                 $rowset = $tblCatalog->find($tmpGuid);
                 if (count($rowset)) {
                     $row = $rowset->current();
                     $row->moveToFolder($sourceNode, $targetNode);
                     Zend_Registry::get('Zend_Log')->info('move multiple article:' . $tmpGuid . ' to folderGuid:' . $targetNode . ' dari ip:' . Pandamp_Lib_Formater::getHttpRealIp() . ' oleh:' . $this->_user->kopel);
                     $queue->addJob('Pandamp_Job_Catalog', ['guid' => $tmpGuid, 'folderGuid' => $targetNode, 'ip' => Pandamp_Lib_Formater::getHttpRealIp(), 'kopel' => $this->_user->kopel, 'lang' => $this->view->getLanguage()], false);
                 }
             }
         } else {
             $g = $r->getParam('guid');
             $rowset = $tblCatalog->find($g);
             if (count($rowset)) {
                 $row = $rowset->current();
                 $row->moveToFolder($sourceNode, $targetNode);
                 Zend_Registry::get('Zend_Log')->info('move article:' . $g . ' to folderGuid:' . $targetNode . ' dari ip:' . Pandamp_Lib_Formater::getHttpRealIp() . ' oleh:' . $this->_user->kopel);
                 $queue->addJob('Pandamp_Job_Catalog', ['guid' => $g, 'folderGuid' => $targetNode, 'ip' => Pandamp_Lib_Formater::getHttpRealIp(), 'kopel' => $this->_user->kopel, 'lang' => $this->view->getLanguage()], false);
             }
         }
         $tblSetting = new App_Model_Db_Table_Setting();
         $rowSetting = $tblSetting->find(1)->current();
         $un = unserialize($rowSetting->dataCache);
         if ($un != "") {
             if (!in_array($sourceNode, $un)) {
                 $un[] = $sourceNode;
             }
             $un = serialize($un);
         } else {
             $un = serialize([$sourceNode]);
         }
         $rowSetting->dataCache = $un;
         $rowSetting->save();
     }
     $sessHistory = new Zend_Session_Namespace('BROWSER_HISTORY');
     $sessHistory->urlReferer = $urlReferer;
     $this->view->urlReferer = $sessHistory->urlReferer;
 }