protected function _postDelete() { $modelUserFinance = new App_Model_Db_Table_UserFinance(); $modelUserFinance->delete("userId='" . $this->kopel . "'"); $modelUserInvoice = new App_Model_Db_Table_Invoice(); $modelUserInvoice->delete("uid='" . $this->kopel . "'"); $acl = Pandamp_Acl::manager(); $acl->deleteUser($this->username); $modelOrder = new App_Model_Db_Table_Order(); $fetchOrder = $modelOrder->fetchAll("userId='" . $this->kopel . "'"); foreach ($fetchOrder as $rowOrder) { $rowOrder->delete(); } $registry = Zend_Registry::getInstance(); $config = $registry->get(Pandamp_Keys::REGISTRY_APP_OBJECT); $cdn = $config->getOption('cdn'); $sDir = $cdn['static']['dir']['photo']; //$sDir = ROOT_DIR.DIRECTORY_SEPARATOR.'uploads'.DIRECTORY_SEPARATOR.'photo'; try { if (file_exists($sDir . "/" . $this->kopel . ".gif")) { unlink($sDir . "/" . $this->kopel . ".gif"); } if (file_exists($sDir . "/" . $this->kopel . ".jpg")) { unlink($sDir . "/" . $this->kopel . ".jpg"); } if (file_exists($sDir . "/" . $this->kopel . ".jpeg")) { unlink($sDir . "/" . $this->kopel . ".jpeg"); } if (file_exists($sDir . "/" . $this->kopel . ".png")) { unlink($sDir . "/" . $this->kopel . ".png"); } } catch (Exception $e) { } }
function viewFolderKu() { $time_start = microtime(true); $parentGuid = $this->_node; $columns = 4; $acl = Pandamp_Acl::manager(); $auth = Zend_Auth::getInstance(); if (!$auth->hasIdentity()) { echo "You aren't login"; } $identity = $auth->getIdentity(); $packageId = $identity->packageId; $username = $identity->username; $aReturn = App_Model_Show_AroGroup::show()->getUserGroup($packageId); $tblFolder = new App_Model_Db_Table_Folder(); $rowsetFolder = App_Model_Show_Folder::show()->fetchChildren($parentGuid); $num_rows = count($rowsetFolder); $rows = ceil($num_rows / $columns); if ($num_rows < $columns) { $columns = $num_rows; } if ($num_rows == 0) { } $in = 0; $data = array(); foreach ($rowsetFolder as $rowFolder) { if ($aReturn['name'] == "Master" || $aReturn['name'] == "Super Admin") { $content = 'all-access'; } else { $content = $rowFolder['type']; } if ($acl->getPermissionsOnContent('', $aReturn['name'], $content)) { if ($rowFolder['title'] == "Kategori" || $rowFolder['title'] == "Peraturan" || $rowFolder['title'] == "Putusan") { $title = "<font color=red><b>" . $rowFolder['title'] . "</b></font>"; } else { $title = $rowFolder['title']; } $data[$in][0] = $title; $data[$in][1] = $rowFolder['description']; $data[$in][2] = $rowFolder['guid']; $data[$in][3] = ''; } else { continue; } $in++; } $this->view->rows = $rows; $this->view->columns = $columns; $this->view->data = $data; $this->view->numberOfFolders = $num_rows; $this->view->node = $parentGuid; if ($parentGuid != 'root') { $rowCurrentNode = $tblFolder->find($parentGuid)->current(); $this->view->currentNodeTitle = $rowCurrentNode->title; } else { $this->view->currentNodeTitle = 'ROOT'; } $time_end = microtime(true); $time = $time_end - $time_start; }
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()."'"); */ } }
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'); } } } }
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'); } } } } }
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'); } } } } } }
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; } } } }
public function viewAction() { $itemGuid = $this->_getParam('guid') ? $this->_getParam('guid') : ''; $start = $this->_getParam('start') ? $this->_getParam('start') : 0; $end = $this->_getParam('limit') ? $this->_getParam('limit') : 10; $aclAdapter = Pandamp_Acl::manager(); $aGroups = $aclAdapter->getGroups(); $aTmp = array(); $aTmp['totalCount'] = count($aGroups); for ($i = 0; $i < count($aGroups); $i++) { $aTmp['privilege'][$i]['guid'] = $aGroups[$i]['id']; $aTmp['privilege'][$i]['group'] = $aGroups[$i]['value']; $aPerms = $aclAdapter->getPermissionsOnContent(null, $aGroups[$i]['value'], $itemGuid); if (count($aPerms) == 0) { $aTmp['privilege'][$i]['perms']['create'] = 0; $aTmp['privilege'][$i]['perms']['delete'] = 0; $aTmp['privilege'][$i]['perms']['read'] = 0; $aTmp['privilege'][$i]['perms']['update'] = 0; } else { for ($ii = 0; $ii < count($aPerms); $ii++) { $aTmp['privilege'][$i]['perms'][$aPerms[$ii]] = 1; } } } echo Zend_Json::encode($aTmp); }
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 aclCheck($section, $aco, $axoSectionValue = false, $axoValue = false) { $auth = Zend_Auth::getInstance(); if (!$auth->hasIdentity()) { return false; } $identity = $auth->getIdentity(); $username = $identity->username; $acl = Pandamp_Acl::manager(); return $acl->checkAcl($section, $aco, 'user', $username, $axoSectionValue, $axoValue); }
public function groupTree(array $selected = NULL) { // get group information $acl = Pandamp_Acl::manager(); $params = $acl->optionsAroGroups(); $_html_result = ''; foreach ($params as $_key => $_val) { $_html_result .= $this->html_options_optoutput($_key, $_val, $selected); } return $_html_result; }
public function isUserOrRoleAllowed($user, $module, $controller, $action = null) { if ($action != null) { $action = strtolower($action); } $resource = strtolower($module . ':' . $controller); $acl = Pandamp_Acl::manager(); if ($acl->checkAcl('action', 'all', 'user', $user->username, 'content', 'all-access') || $acl->checkAcl($resource, $action, 'user', $user->username, false, false)) { return true; } return false; }
public function fetchChildrenAction() { $parentGuid = $this->_getParam('node') ? $this->_getParam('node') : ''; $node = $this->_getParam('parentGuid'); $tblFolder = new Pandamp_Modules_Dms_Folder_Model_Folder(); $tblCatalogFolder = new Pandamp_Modules_Dms_Catalog_Model_CatalogFolder(); $modelAroGroup = new Pandamp_Modules_Identity_Group_Folder_AroGroup(); $auth = Zend_Auth::getInstance(); if (!$auth->hasIdentity()) { echo "You aren't login"; } $packageId = $auth->getIdentity()->packageId; // get group information $acl = Pandamp_Acl::manager(); //$aReturn = $acl->getUserGroupIds(Zend_Auth::getInstance()->getIdentity()->username); $aReturn = $modelAroGroup->getUserGroup($packageId); if (!empty($parentGuid)) { $aJson = array(); $rowset = $tblFolder->fetchChildren($parentGuid); $i = 0; foreach ($rowset as $row) { if ($aReturn['name'] == "Master" || $aReturn['name'] == "Super Admin") { $content = 'all-access'; } else { $content = $row->type; } if ($acl->getPermissionsOnContent('', $aReturn['name'], $content)) { if ($row->title == "Kategori" || $row->title == "Peraturan" || $row->title == "Putusan") { $title = "<font color=red><b>" . $row->title . "</b></font>"; } else { $title = $row->title; } $aJson[$i]['text'] = $title; //. ' ('.$tblCatalogFolder->countCatalogsInFolderAndChildren($row->guid).')'; $aJson[$i]['id'] = $row->guid; $checkLeaf = $tblFolder->fetchAll("path like '%{$row->guid}%'"); if ($checkLeaf->count() > 0) { $aJson[$i]['leaf'] = 0; $aJson[$i]['cls'] = 'folder'; } else { $aJson[$i]['leaf'] = 1; $aJson[$i]['cls'] = 'leaf'; } } else { continue; } $i++; } echo $json = Zend_Json::encode($aJson); } }
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']; }
public function profile($profile = null) { $auth = Zend_Auth::getInstance(); $packageId = $auth->getIdentity()->packageId; $zl = Zend_Registry::get("Zend_Locale"); $lang = $zl->getLanguage(); $acl = Pandamp_Acl::manager(); $modelAroGroup = App_Model_Show_AroGroup::show(); $tblProfile = new App_Model_Db_Table_Profile(); $row = $tblProfile->fetchAll(); $select_profile = "<select name=\"pg\" id=\"pg\" class=\"form-control\" style=\"width: 60%;\">\n"; if ($profile) { $rowProfile = $tblProfile->find($profile)->current(); $select_profile .= "<option value='{$rowProfile->guid}' selected>{$rowProfile->title}</option>"; $select_profile .= "<option value =''>Choose:</option>"; } else { $select_profile .= "<option value ='' selected>Choose:</option>"; } foreach ($row as $rowset) { $aReturn = $modelAroGroup->getUserGroup($packageId); if ($aReturn['name'] == "Master" || $aReturn['name'] == "Super Admin") { $content = 'all-access'; } else { $content = $rowset->profileType; } if ($profile and $rowset->guid == $rowProfile->guid) { continue; } else { if ($lang == 'en') { $select_profile .= "<option value='{$rowset->guid}'>{$rowset->title}</option>"; } else { if ($acl->getPermissionsOnContent('', $aReturn['name'], $content)) { $select_profile .= "<option value='{$rowset->guid}'>{$rowset->title}</option>"; } else { continue; } } } } $select_profile .= "</select>\n\n"; return $select_profile; }
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; } } } }
function isAllowedAction() { $this->_helper->layout->disableLayout(); $this->_helper->viewRenderer->setNoRender(TRUE); $acl = Pandamp_Acl::manager(); // if ($acl->isAllowed('seyimut','all','aclist')) // echo 'ALLOWED'; // else // echo 'NO ACCESS'; // $aReturn = $acl->getUserGroupIds('zapatista'); // if ($acl->getPermissionsOnContent('', $aReturn[1], 'membership')) // echo 'ALLOWED'; // else // echo 'NO ACCESS'; if ($acl->checkAcl('action', 'all', 'user', 'nurul-cs2', 'content', 'aclist')) { echo 'ALLOWED'; } else { echo 'NO ACCESS'; } }
protected function _postDelete() { $tblUserDetail = new Pandamp_Modules_Identity_User_Model_UserDetail(); $rowsetUserDetail = $tblUserDetail->fetchAll("uid='{$this->guid}'"); foreach ($rowsetUserDetail as $row) { // delete $row->delete(); } //delete from table KutuUserInvoice $tblInvoice = new Pandamp_Modules_Payment_Invoice_Model_Invoice(); $tblInvoice->delete("uid='{$this->kopel}'"); //delete from table KutuUserAccessLog $tblUserLog = new Pandamp_Modules_Identity_Log_Model_Log(); $tblUserLog->delete("user_id='{$this->guid}'"); //delete from ACL $aclMan = Pandamp_Acl::manager(); $aclMan->deleteUser($this->username); // delete physical user folder define by guid $sDir = ROOT_DIR . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . 'images' . DIRECTORY_SEPARATOR . $this->guid; try { $this->removeRessource($sDir); } catch (Exception $e) { throw new Exception($e); } $sDir = ROOT_DIR . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . 'photo'; try { if (file_exists($sDir . "/" . $this->guid . ".gif")) { unlink($sDir . "/" . $this->guid . ".gif"); } if (file_exists($sDir . "/" . $this->guid . ".jpg")) { unlink($sDir . "/" . $this->guid . ".jpg"); } if (file_exists($sDir . "/" . $this->guid . ".jpeg")) { unlink($sDir . "/" . $this->guid . ".jpeg"); } if (file_exists($sDir . "/" . $this->guid . ".png")) { unlink($sDir . "/" . $this->guid . ".png"); } } catch (Exception $e) { } }
/** * Get Tree * * @param string $folderGuid * @param string $sGuid * @param int $level * @return void */ protected function _traverseFolder($folderGuid, $sGuid, $level, array $attributes) { $acl = Pandamp_Acl::manager(); $auth = Zend_Auth::getInstance(); $group = $auth->getIdentity()->name; $rowSet = App_Model_Show_Folder::show()->fetchChildren($folderGuid); $sGuid = ''; foreach ($rowSet as $row) { if ($group == "Master" || $group == "Super Admin") { $content = 'all-access'; } else { $content = $row['type']; } if ($acl->getPermissionsOnContent('', $group, $content)) { $selected = isset($attributes['selected']) && in_array($row['guid'], $attributes['selected']) ? ' checked="checked"' : ''; $checkBox = '<div>' . str_repeat('-----', $level) . ' <input type="checkbox" name="' . $attributes['name'] . '" value="' . $row['guid'] . '"' . $selected . ' />' . $row['title'] . '</div>' . self::EOL; $sGuid .= $checkBox . $this->_traverseFolder($row['guid'], '', $level + 1, $attributes); } } return $sGuid; }
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; } } } }
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'); } } }
function detailAction() { $catalogGuid = $this->_getParam('guid') ? $this->_getParam('guid') : ''; $node = $this->_getParam('node') ? $this->_getParam('node') : ''; $npts = $this->_getParam('npts') ? $this->_getParam('npts') : ''; $nprt = $this->_getParam('nprt') ? $this->_getParam('nprt') : ''; if ($node) { $fd = $node; } if ($npts) { $fd = $npts; } if ($nprt) { $fd = $nprt; } $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; $modelCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog(); $modelCatalogAttribute = new Pandamp_Modules_Dms_Catalog_Model_CatalogAttribute(); $decorator = new Pandamp_BeanContext_Decorator($modelCatalog); $rowset = $decorator->getCatalogByGuidAsEntity($catalogGuid); if (isset($rowset)) { $modelAsset = new Pandamp_Modules_Dms_Catalog_Model_AssetSetting(); $rowAsset = $modelAsset->find($catalogGuid)->current(); if ($rowAsset) { $rowAsset->valueInt = $rowAsset->valueInt + 1; } else { $rowAsset = $modelAsset->fetchNew(); $rowAsset->guid = $catalogGuid; $rowAsset->detail = $fd; $rowAsset->application = $rowset->getProfile(); $rowAsset->part = "MOST_READABLE_DATACENTER"; $rowAsset->valueInt = 1; $rowAsset->valueText = 'pusatdata'; } $rowAsset->save(); $auth = Zend_Auth::getInstance(); if ($rowset->getProfile() == 'kutu_putusan') { if (!$auth->hasIdentity()) { $this->_redirect($loginUrl); } } $rowsetCatalogAttributeJenis = $modelCatalogAttribute->getCatalogAttributeValue($rowset->getId(), 'prtJenis'); if (!empty($rowsetCatalogAttributeJenis)) { if ($rowsetCatalogAttributeJenis == 'Undang-Undang ' || $rowsetCatalogAttributeJenis == "uu" || $rowsetCatalogAttributeJenis == "pp" || $rowsetCatalogAttributeJenis == "Peraturan Pemerintah" || $rowsetCatalogAttributeJenis == "konstitusi") { } else { if (!$auth->hasIdentity()) { $this->_redirect($loginUrl . '?returnTo=' . $sReturn); //$this->_redirect($loginUrl); } else { $username = $auth->getIdentity()->username; $acl = Pandamp_Acl::manager(); $aReturn = $acl->getUserGroupIds($username); //print_r($aReturn[1]);die; if (isset($aReturn[0])) { if ($aReturn[0] == "member_gratis") { $this->_helper->redirector('restricted', "browser", 'hold'); } } } } } $this->view->catalogGuid = $catalogGuid; $this->view->node = $node; $this->view->npts = $npts; $this->view->nprt = $nprt; } }
private function _isStoreClosed() { $auth = Zend_Auth::getInstance(); if (!$auth->hasIdentity()) { } else { $username = $auth->getIdentity()->username; $acl = Pandamp_Acl::manager(); if ($acl->checkAcl("site", 'all', 'user', $username, false, false)) { return 0; } } return $this->_configStore['isClosed']; }
function associateAction() { if (!Pandamp_Controller_Action_Helper_IsAllowed::isAllowed('membership', 'all')) { $this->_redirect(ROOT_URL . '/' . $this->_zl->getLanguage() . '/error/restricted'); } $this->_helper->layout->setLayout('layout-customer-credential'); $r = $this->getRequest(); if ($r->isPost()) { $newGroup = $r->getParam('aro_groups'); $id = $r->getParam('id'); $oldUser = App_Model_Show_User::show()->getUserById($id); $groupName = App_Model_Show_AroGroup::show()->getUserGroup($newGroup); $package = App_Model_Show_AroGroup::show()->getUserGroup($oldUser['packageId']); $notes = date("Y-m-d h:i:s") . " - Changed package " . $package['name'] . " TO " . $groupName['name']; $notes = $oldUser['notes'] ? $oldUser['notes'] . "\n" . $notes : $notes; $data = array('packageId' => $newGroup, 'notes' => $notes, 'modifiedDate' => date("Y-m-d h:i:s"), 'modifiedBy' => Zend_Auth::getInstance()->getIdentity()->username); $modelUser = new App_Model_Db_Table_User(); $modelUser->update($data, "kopel='" . $id . "'"); $dataUserDetail = array('userId' => $oldUser['kopel'], 'packageId' => $oldUser['packageId'], 'promotionId' => $oldUser['promotionId'], 'educationId' => $oldUser['educationId'], 'expenseId' => $oldUser['expenseId'], 'paymentId' => $oldUser['paymentId'], 'businessTypeId' => $oldUser['businessTypeId'], 'periodeId' => $oldUser['periodeId'], 'activationDate' => $oldUser['activationDate'], 'createdDate' => $oldUser['createdDate'], 'createdBy' => $oldUser['createdBy'], 'modifiedDate' => $oldUser['modifiedDate'], 'modifiedBy' => $oldUser['modifiedBy'], 'isActive' => $oldUser['isActive'], 'isContact' => $oldUser['isContact']); $modelUserDetail = new App_Model_Db_Table_UserDetail(); $modelUserDetail->insert($dataUserDetail); $username = $r->getParam('username'); $acl = Pandamp_Acl::manager(); $acl->deleteUser($username); //$acl->removeUserFromGroup($username, $oldUser['packageId']); $acl->addUser($username, $groupName['name']); //$acl->addUserToGroup($username, $groupName['name']); $this->view->message = "Package was sucessfully changed."; } $id = $this->_getParam("id"); $user = App_Model_Show_User::show()->getUserById($id); if ($user) { $acl = Pandamp_Acl::manager(); $role = $acl->getUserGroupIds($user['username']); //print_r($role); $this->view->UserRoles = $role; $this->view->user = $user; } }
public function payconfirmyesAction() { $this->_helper->viewRenderer->setNoRender(TRUE); //print_r($this->_request->getParams()); $id = $this->_request->getParam('orderId'); $tblOrder = new App_Model_Db_Table_Order(); $tblHistory = new App_Model_Db_Table_OrderHistory(); $tblConfirm = new App_Model_Db_Table_PaymentConfirmation(); $rowOrder = $tblOrder->find($id)->current(); if ($rowOrder->paymentMethodNote == 'membership') { $oldUser = App_Model_Show_User::show()->getUserById($rowOrder->userId); $oldpackage = App_Model_Show_AroGroup::show()->getUserGroup($oldUser['packageId']); $newGroup = App_Model_Show_AroGroup::show()->getUserGroup($rowOrder->note); $notes = date("Y-m-d h:i:s") . " - Changed package " . $oldpackage['name'] . " TO " . $newGroup['name']; $notes = $oldUser['notes'] ? $oldUser['notes'] . "\n" . $notes : $notes; $dataUser = array('packageId' => $rowOrder->note, 'notes' => $notes, 'modifiedDate' => date("Y-m-d h:i:s"), 'modifiedBy' => Zend_Auth::getInstance()->getIdentity()->username); $modelUser = new App_Model_Db_Table_User(); $dataUserDetail = array('userId' => $oldUser['kopel'], 'packageId' => $oldUser['packageId'], 'promotionId' => $oldUser['promotionId'], 'educationId' => $oldUser['educationId'], 'expenseId' => $oldUser['expenseId'], 'paymentId' => $oldUser['paymentId'], 'businessTypeId' => $oldUser['businessTypeId'], 'periodeId' => $oldUser['periodeId'], 'activationDate' => $oldUser['activationDate'], 'createdDate' => $oldUser['createdDate'], 'createdBy' => $oldUser['createdBy'], 'modifiedDate' => $oldUser['modifiedDate'], 'modifiedBy' => $oldUser['modifiedBy'], 'isActive' => $oldUser['isActive'], 'isContact' => $oldUser['isContact']); $modelUserDetail = new App_Model_Db_Table_UserDetail(); $modelUserDetail->insert($dataUserDetail); $acl = Pandamp_Acl::manager(); $acl->deleteUser($oldUser['username']); $acl->addUser($oldUser['username'], $newGroup['name']); $tblInvoice = new App_Model_Db_Table_Invoice(); $where = $tblInvoice->getAdapter()->quoteInto("uid=?", $rowOrder->userId); $rowInvoice = $tblInvoice->fetchRow($where); if ($rowInvoice) { $rowInvoice->invoiceConfirmDate = date("Y-m-d"); $rowInvoice->isPaid = 'Y'; // get expiration date $temptime = time(); $temptime = Pandamp_Lib_Formater::DateAdd('m', $oldUser['paymentId'], $temptime); $rowInvoice->expirationDate = strftime('%Y-%m-%d', $temptime); $rowInvoice->save(); $dataUser['periodeId'] = 3; } $modelUser->update($dataUser, "kopel='" . $rowOrder->userId . "'"); } //select payment date from paymentconfirmation $date = $tblConfirm->fetchAll("orderId = " . $id . " AND confirmed = 0"); $data['paymentDate'] = $date[0]->paymentDate; //update order $data['orderStatus'] = 3; $tblOrder->update($data, "orderId = " . $id); //update paymentconfirmation $dataConfirm['confirmed'] = 1; $tblConfirm->update($dataConfirm, "orderId = " . $id); //add history $dataHistory = $tblHistory->fetchNew(); //history data $dataHistory['orderId'] = $id; $dataHistory['orderStatusId'] = 3; $dataHistory['dateCreated'] = date('Y-m-d'); $dataHistory['userNotified'] = 1; $dataHistory['note'] = 'confirmed'; $dataHistory->save(); //mailer //$this->Mailer($id, 'user-confirm', 'user'); $mod = new App_Model_Store_Mailer(); $mod->sendReceiptToUser($id, ucwords($date[0]->paymentMethod)); //redirect to confirmation page $this->_redirect($this->view->serverUrl() . '/' . $this->view->getLanguage() . '/store/confirm'); }
public function signup($aData) { $row = $this->save($aData); //Must also assign assign user as group:member_free $acl = Pandamp_Acl::manager(); $acl->addUserToGroup($row->username, "member_gratis"); if ($row->packageId == 27) { } elseif ($row->packageId == 26) { } else { $mailcontent = $this->getMailContent('konfirmasi email gratis'); $this->_writeConfirmFreeEmail($mailcontent, $row->fullName, $row->username, $aData['password'], $row->guid, $row->email, 'gratis'); } }
/** * _writeConfirmFreeEmail * @return JSON */ function _writeConfirmFreeEmail($mailcontent, $fullname, $username, $password, $guid, $email, $package = '') { $obj = new Pandamp_Crypt_Password(); $aclMan = Pandamp_Acl::manager(); $mailcontent = str_replace('$fullname', $fullname, $mailcontent); $mailcontent = str_replace('$username', $username, $mailcontent); $mailcontent = str_replace('$password', $password, $mailcontent); $mailcontent = str_replace('$guid', $guid, $mailcontent); $mailcontent = str_replace('$package', $package, $mailcontent); $mail_body = $mailcontent; // parse ini_file $config = new Zend_Config_Ini(CONFIG_PATH . '/mail.ini', 'mail'); $mailAttempt = $this->add_mail($config->mail->sender->support->email, $email, $username, $config->mail->sender->support->name, $mail_body); // try to save mail before send if ($mailAttempt) { $sendAttempt = $this->send_mail(); if ($sendAttempt) { $message = "Please check your email at {$email}!"; // update user $tblUser = new App_Model_Db_Table_User(); $rowUser = $tblUser->find($obj->decryptPassword($guid))->current(); if ($rowUser) { $rowUser->isEmailSent = 'Y'; $rowUser->save(); } } else { $message = "Error send mail but register user successfully!<br>Please contact our customer service for more information"; } } else { $message = "Error saving mail!"; } return $message; }
public function getPermissionContent($catId) { $category = $this->view->getFolder($catId); $auth = Zend_Auth::getInstance(); if ($auth->getIdentity()->name == "Master" || $auth->getIdentity()->name == "Super Admin") { $content = 'all-access'; } else { $content = $category->type; } $acl = Pandamp_Acl::manager(); if ($acl->getPermissionsOnContent('', $auth->getIdentity()->name, $content)) { return true; } return false; }
function registerAction() { $tblCatalog = new App_Model_Db_Table_Catalog(); $rowset = $tblCatalog->fetchRow("shortTitle='halaman-depan-login' AND status=99"); if (!empty($rowset)) { $fixedContent = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($rowset->guid, 'fixedContent'); } else { $fixedContent = ''; } $this->view->content = $fixedContent; $this->view->identity = 'Register'; $sReturn = "http://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; $sReturn = base64_encode($sReturn); $this->view->login = $sReturn; $r = $this->getRequest(); if ($r->isPost()) { $username = $r->getParam('username'); $password = $r->getParam('password'); $email = $r->getParam('email'); $package = $r->getParam('aro_groups'); $obj = new Pandamp_Crypt_Password(); $data = array('kopel' => $this->generateKopel(), 'username' => $username, 'password' => $obj->encryptPassword($password), 'email' => $email, 'packageId' => $package, 'createdDate' => date('Y-m-d h:i:s'), 'createdBy' => $username); $modelUser = new App_Model_Db_Table_User(); $modelUser->insert($data); $this->updateKopel(); $acl = Pandamp_Acl::manager(); $acl->addUser($username, "Member Free"); } }
function transformMigrationUser($value) { if ($value["birthday"] == "1970-01-01" || $value["birthday"] == "") { $birthday = "0000-00-00"; } else { $birthday = $value["birthday"]; } $groupName = $this->getGroupName($value['packageId']); $acl = Pandamp_Acl::manager(); $groupId = $acl->getGroupIds($groupName); $data = array('kopel' => $this->generateKopel(), 'username' => $value['username'], 'password' => $value['password'], 'fullName' => $value['fullName'] ? $value['fullName'] : '', 'birthday' => $birthday, 'phone' => $value['phone'] ? $value['phone'] : '', 'fax' => $value['fax'] ? $value['fax'] : '', 'gender' => $value['gender'], 'email' => $value['email'], 'company' => $value['company'] ? $value['company'] : '', 'address' => $value['address'] ? $value['address'] : '', 'state' => 7, 'countryId' => 'ID', 'newArticle' => $value['newArticle'], 'weeklyList' => $value['weeklyList'], 'monthlyList' => $value['monthlyList'], 'packageId' => $groupId, 'promotionId' => $value['promotionId'], 'educationId' => $value['educationId'], 'expenseId' => $value['expenseId'], 'paymentId' => $value['paymentId'], 'businessTypeId' => $value['businessTypeId'], 'periodeId' => $value['periodeId'], 'activationDate' => $value['activationDate'], 'isEmailSent' => $value['isEmailSent'], 'isEmailSentOver' => $value['isEmailSentOver'], 'createdDate' => $value['createdDate'], 'createdBy' => $value['createdBy'], 'modifiedDate' => $value['updatedDate'] ? $value['updatedDate'] : '', 'modifiedBy' => $value['updatedBy'] ? $value['updatedBy'] : '', 'isActive' => $value['isActive'], 'isContact' => $value['isContact']); return $data; }