public function indexAction()
 {
     // action body
     //create sesesion
     $session_search_user = new Zend_Session_Namespace('search_user');
     if (empty($session_search_user->limit)) {
         $session_search_user->limit = Application_Form_FrmNavigation::getLimit();
         $session_search_user->active = -1;
         $session_search_user->user_type = -1;
         $session_search_user->txtsearch = '';
         $session_search_user->lock();
     }
     //start page nevigation
     $limit = $session_search_user->limit;
     $start = $this->getRequest()->getParam('limit_satrt', 0);
     $db_user = new Application_Model_DbTable_DbUsers();
     $this->view->activelist = $this->activelist;
     $this->view->active = $session_search_user->active;
     $this->view->user_typelist = $this->user_typelist;
     $this->view->user_type = $session_search_user->user_type;
     if ($this->getRequest()->isPost()) {
         $user_seach_data = $this->getRequest()->getPost();
         //set session when submit
         $session_search_user->unlock();
         $session_search_user->limit = $user_seach_data['rows_per_page'];
         $session_search_user->active = $user_seach_data['active'];
         $session_search_user->user_type = $user_seach_data['user_type'];
         $session_search_user->txtsearch = $user_seach_data['txtsearch'];
         $session_search_user->lock();
         //set value for display
         $this->view->txtsearch = $user_seach_data['txtsearch'];
         $this->view->active = $user_seach_data['active'];
         $this->view->user_type = $user_seach_data['user_type'];
         $limit = $user_seach_data['rows_per_page'];
         $users = $db_user->getUserListBy($user_seach_data, $start, $limit);
         $record_count = $db_user->getUserListTotal($user_seach_data);
     } else {
         if ($session_search_user->active > -1 || $session_search_user->user_type > -1 || !empty($session_search_user->txtsearch)) {
             $user_seach_data = array('active' => $session_search_user->active, 'user_type' => $session_search_user->user_type, 'txtsearch' => $session_search_user->txtsearch);
             $users = $db_user->getUserListBy($user_seach_data, $start, $limit);
             $record_count = $db_user->getUserListTotal($user_seach_data);
         } else {
             $users = $db_user->getUserList($start, $limit);
             $record_count = $db_user->getUserListTotal();
         }
     }
     $result = array();
     $row_num = $start;
     foreach ($users as $i => $user) {
         $result[$i] = array('num' => ++$row_num, 'name' => $user['name'], 'id' => $user['id'], 'user_name' => $user['user_name'], 'active' => $this->activelist[$user['active']], 'user_type' => $this->user_typelist[$user['user_type']]);
     }
     $this->view->userlist = Zend_Json::encode($result);
     $page = new Application_Form_FrmNavigation(self::REDIRECT_URL, $start, $limit, $record_count);
     $page->init(self::REDIRECT_URL, $start, $limit, $record_count);
     $this->view->nevigation = $page->navigationPage();
     $this->view->rows_per_page = $page->getRowsPerPage($limit, 'frmlist_users');
     $this->view->result_row = $page->getResultRows();
 }
 public function indexAction()
 {
     // action body
     //create sesesion
     $session_search_agent = new Zend_Session_Namespace('search_agent');
     if (empty($session_search_agent->limit)) {
         $session_search_agent->limit = Application_Form_FrmNavigation::getLimit();
         $session_search_agent->active = -1;
         $session_search_agent->province = -1;
         $session_search_agent->txtsearch = '';
         $session_search_agent->lock();
     }
     //start page nevigation
     $limit = $session_search_agent->limit;
     $start = $this->getRequest()->getParam('limit_satrt', 0);
     $pro = new Application_Model_DbTable_DbProvinces();
     $this->view->provincelist = $pro->getProvinceList();
     $this->view->province = $session_search_agent->province;
     $db_agent = new Application_Model_DbTable_DbAgents();
     $this->view->activelist = $this->activelist;
     $this->view->active = $session_search_agent->active;
     if ($this->getRequest()->isPost()) {
         $agent_seach_data = $this->getRequest()->getPost();
         //set session when submit
         $session_search_agent->unlock();
         $session_search_agent->limit = $agent_seach_data['rows_per_page'];
         $session_search_agent->active = $agent_seach_data['active'];
         $session_search_agent->province = $agent_seach_data['province'];
         $session_search_agent->txtsearch = $agent_seach_data['txtsearch'];
         $session_search_agent->lock();
         $this->view->province = $agent_seach_data['province'];
         $this->view->txtsearch = $agent_seach_data['txtsearch'];
         $this->view->active = $agent_seach_data['active'];
         $limit = $session_search_agent->limit;
         $agents = $db_agent->getAgentListBy($agent_seach_data, $start, $limit);
         $record_count = $db_agent->getAgentListTotal($agent_seach_data);
     } else {
         if (!empty($session_search_agent->txtsearch) || $session_search_agent->active > -1 || $session_search_agent->province > -1) {
             $agent_seach_data = array('active' => $session_search_agent->active, 'province' => $session_search_agent->province, 'txtsearch' => $session_search_agent->txtsearch);
             $agents = $db_agent->getAgentListBy($agent_seach_data, $start, $limit);
             $record_count = $db_agent->getAgentListTotal($agent_seach_data);
         } else {
             $agents = $db_agent->getAgentList($start, $limit);
             $record_count = $db_agent->getAgentListTotal();
         }
     }
     $result = array();
     $row_num = $start;
     foreach ($agents as $i => $agent) {
         $result[$i] = array('num' => ++$row_num, 'id' => $agent['id'], 'tel' => $agent['tel'], 'name' => $agent['name'], 'proname' => $agent['proname'], 'khan' => $agent['khan'], 'sangkat' => $agent['sangkat'], 'block' => $agent['block']);
     }
     $this->view->agentlist = Zend_Json::encode($result);
     $page = new Application_Form_FrmNavigation(self::REDIRECT_URL, $start, $limit, $record_count);
     $page->init(self::REDIRECT_URL, $start, $limit, $record_count);
     $this->view->nevigation = $page->navigationPage();
     $this->view->rows_per_page = $page->getRowsPerPage($limit, 'frmlist_agent');
     $this->view->result_row = $page->getResultRows();
 }
 /**
  * When the user actually submits their otp, this authenticates it.
  */
 public function submitAction()
 {
     $this->disableLayout();
     $this->disableView();
     Zend_Session::start();
     $mfaSession = new Zend_Session_Namespace('Mfa_Temp_User');
     $user = $mfaSession->Dao;
     if (!isset($user) || !$user) {
         echo JsonComponent::encode(array('status' => 'error', 'message' => 'Session has expired, refresh and try again'));
         return;
     }
     $otpDevice = $this->Mfa_Otpdevice->getByUser($user);
     if (!$otpDevice) {
         throw new Zend_Exception('User does not have an OTP device');
     }
     $token = $this->getParam('token');
     try {
         $valid = $this->ModuleComponent->Otp->authenticate($otpDevice, $token);
     } catch (Zend_Exception $exc) {
         $this->getLogger()->crit($exc->getMessage());
         echo JsonComponent::encode(array('status' => 'error', 'message' => $exc->getMessage()));
         return;
     }
     if ($valid) {
         session_start();
         $authUser = new Zend_Session_Namespace('Auth_User');
         $authUser->setExpirationSeconds(60 * Zend_Registry::get('configGlobal')->session->lifetime);
         $authUser->Dao = $user;
         $authUser->lock();
         $this->getLogger()->debug(__METHOD__ . ' Log in : ' . $user->getFullName());
         echo JsonComponent::encode(array('status' => 'ok'));
     } else {
         echo JsonComponent::encode(array('status' => 'error', 'message' => 'Incorrect token'));
     }
 }
Exemple #4
0
 /**
  * Defined by spl ArrayObject.
  * Here we are redefining the action to point to the session namespace
  * 
  * @param string $index
  * @return bool
  */
 public function offsetSet($index, $newval)
 {
     if (self::$_session->isLocked()) {
         self::$_session->unLock();
     }
     self::getSession()->{$index} = $newval;
     self::$_session->lock();
 }
 public function indexAction()
 {
     $this->_helper->layout()->disableLayout();
     ///sopharat disablelayout to display login
     $tr = Application_Form_FrmLanguages::getCurrentlanguage();
     if ($this->getRequest()->isPost()) {
         $formdata = $this->getRequest()->getPost();
         $db_user = new Application_Model_DbTable_DbUsers();
         $email = $formdata['txt_email'];
         $password = $formdata['txt_password'];
         if ($db_user->checkEmail($email)) {
             if ($db_user->userAuthenticate($email, $password)) {
                 $user_id = $db_user->getUserID($email);
                 $user_info = $db_user->getUserInfo($user_id);
                 $arr_acl = $db_user->getArrAcl($user_info['user_type_id']);
                 //in case user have no right to access any module of the system
                 if (!$arr_acl) {
                     $this->view->msg = $tr->translate('LOGIN_FAIL_NO_MODULE');
                 } else {
                     $session_user = new Zend_Session_Namespace('auth');
                     $session_user->unlock();
                     $session_user->user_id = $user_id;
                     $session_user->fullname = $user_info['fullname'];
                     $session_user->user_name = $user_info['username'];
                     $session_user->level = $user_info['user_type_id'];
                     $session_user->user_type = $user_info['user_type'];
                     $session_user->location_id = $user_info['LocationId'];
                     $session_user->email = $email;
                     for ($i = 0; $i < count($arr_acl); $i++) {
                         $arr_module[$i] = $arr_acl[$i]['module'];
                     }
                     $arr_module = array_unique($arr_module);
                     $session_user->arr_acl = $arr_acl;
                     $session_user->arr_module = $arr_module;
                     $session_user->lock();
                     //echo $session_user->user_name;sales/sales-order
                     //echo $session_user->user_id=$user_id;exit();
                     //$_url=($arr_acl[0]!=='')? '/'.$arr_acl[0]['module']:'/default/index/home' ;//before
                     //$_url=($arr_acl[0]!=='')? '/default/index/dashboad':'/default/index/home' ;//after
                     //print_r($arr_acl[0]);
                     //exit();
                     //$this->_redirect("/sales/sales-order");
                     $_url = $arr_acl[0] !== '' ? '/default/index/dashboad' : '/sales/sales-order';
                     //after
                     $this->_redirect($_url);
                 }
             } elseif (!$db_user->checkStatusByEmail($email)) {
                 $this->view->msg = $tr->translate('LOGIN_FAIL_COMFIRM');
             } else {
                 $this->view->msg = $tr->translate('LOGIN_FAIL');
             }
         } else {
             $this->view->msg = $tr->translate('EMAIL_NOT');
         }
     }
 }
 public function indexAction()
 {
     // action body
     $session_language = new Zend_Session_Namespace('language');
     $lang = $this->getRequest()->getParam('ln');
     $session_language->unlock();
     $session_language->language = $lang;
     $session_language->lock();
     $this->_redirect($_SERVER['HTTP_REFERER']);
     //$this->_response->setRedirect( $_SERVER['HTTP_REFERER'])->sendResponse();
     //exit();
 }
Exemple #7
0
 public function indexAction()
 {
     // action body
     try {
         $db_tran = new Application_Model_DbTable_DbGlobal();
         //create sesesion
         $session_transfer = new Zend_Session_Namespace('search_acl');
         if (empty($session_transfer->limit)) {
             $session_transfer->limit = Application_Form_FrmNavigation::getLimit();
             $session_transfer->lock();
         }
         $sql = "SELECT `acl_id`,`module`,`controller`,`action`,`status` FROM rsv_acl_acl";
         if ($this->getRequest()->isPost()) {
             $formdata = $this->getRequest()->getPost();
             $session_transfer->unlock();
             $session_transfer->limit = $formdata['rows_per_page'];
             $session_transfer->lock();
         }
         //start page nevigation
         $limit = $session_transfer->limit;
         $start = $this->getRequest()->getParam('limit_satrt', 0);
         $result = $db_tran->getGlobalDbListBy($sql, $start, $limit);
         $record_count = $db_tran->getGlobalDbListTotal($sql);
         $row_num = $start;
         if (empty($result)) {
             $result = array('err' => 1, 'msg' => 'មិន​ទាន់​មាន​ទន្និន័យ​នូវ​ឡើយ​ទេ!');
         }
         //print_r($result); exit;
         $this->view->list = Zend_Json::encode($result);
         $page = new Application_Form_FrmNavigation(self::REDIRECT_URL, $start, $limit, $record_count);
         $page->init(self::REDIRECT_URL, $start, $limit, $record_count);
         $this->view->nevigation = $page->navigationPage();
         $this->view->rows_per_page = $page->getRowsPerPage($limit, 'frmlist');
         $this->view->result_row = $page->getResultRows();
     } catch (Exception $e) {
     }
 }
 public function returnAction()
 {
     $request = $this->getRequest();
     $form = new Application_Form_Returns();
     if ($this->getRequest()->isPost()) {
         if ($form->isValid($request->getPost())) {
             // if form is valid, then save submitted data in a session
             $addRadioFormNamespace = new Zend_Session_Namespace('data');
             $addRadioFormNamespace->postData = $form->getValues();
             $addRadioFormNamespace->lock();
             // redirect to the second stage
             //return $this->_redirect('radio-application/confirm');
         } else {
         }
     }
     $this->view->form = $form;
 }
Exemple #9
0
 /**
  * When a user logs in, if they have an OTP device we want to override the normal behavior of writing
  * them to the session, and instead write a temporary session entry that will be moved to the expected
  * place only after they successfully pass the OTP challenge.
  */
 public function authIntercept($params)
 {
     $user = $params['user'];
     /** @var Mfa_OtpdeviceModel $otpDeviceModel */
     $otpDeviceModel = MidasLoader::loadModel('Otpdevice', $this->moduleName);
     $otpDevice = $otpDeviceModel->getByUser($user);
     if ($otpDevice) {
         // write temp user into session for asynchronous confirmation
         Zend_Session::start();
         $userSession = new Zend_Session_Namespace('Mfa_Temp_User');
         $userSession->setExpirationSeconds(60 * min(10, Zend_Registry::get('configGlobal')->session->lifetime));
         // "limbo" state should invalidate after 10 minutes
         $userSession->Dao = $user;
         $userSession->lock();
         $resp = JsonComponent::encode(array('dialog' => '/mfa/login/dialog', 'title' => 'Enter One-Time Password', 'options' => array('width' => 250)));
         return array('override' => true, 'response' => $resp);
     } else {
         return array();
     }
 }
Exemple #10
0
 public function Login($username, $pass)
 {
     $this->conn = new StoredConnections(false);
     $query = "call selectSalt('" . $username . "')";
     $salt = $this->conn->result($query);
     if (!is_array($salt)) {
         $this->test->type = "error";
         $this->test->info = "nouser";
         Zend_Session::destroy(true);
         return $this->test;
     }
     $pasWithSalt = $pass . $salt[0][0];
     $hash = sha1($pasWithSalt);
     $query = "call   selectLoginUser('" . $username . "','" . $hash . "')";
     $loginData = $this->conn->result($query);
     if (!is_array($loginData)) {
         $this->test->type = "error";
         $this->test->info = "nouser";
         Zend_Session::destroy(true);
         return $this->test;
     }
     if ($loginData[0][1] == 0) {
         $this->test->type = "error";
         $this->test->info = "nouser";
         Zend_Session::destroy(true);
         return $this->test;
     }
     $databaseInfo = new Zend_Session_Namespace('DatabaseInfo');
     $databaseInfo->unsetAll();
     $databaseInfo->setExpirationSeconds(2666);
     $databaseInfo->remoteIp = $_SERVER['REMOTE_ADDR'];
     $userData = array();
     $userData[0] = $loginData[0][0];
     $userData[1] = $loginData[0][1];
     $databaseInfo->userData = $userData;
     $databaseInfo->lock();
     $this->test->type = "ok";
     return $this->test;
 }
Exemple #11
0
 public function changepasswordAction()
 {
     // action body
     if ($this->getRequest()->isPost()) {
         $session_user = new Zend_Session_Namespace('auth');
         $pass_data = $this->getRequest()->getPost();
         if ($pass_data['password'] == $session_user->pwd) {
             $db_user = new Application_Model_DbTable_DbUsers();
             try {
                 $db_user->changePassword($pass_data['new_password'], $session_user->user_id);
                 $session_user->unlock();
                 $session_user->pwd = $pass_data['new_password'];
                 $session_user->lock();
                 Application_Form_FrmMessage::Sucessfull('ការផ្លាស់ប្តូរដោយជោគជ័យ', self::REDIRECT_URL);
             } catch (Exception $e) {
                 Application_Form_FrmMessage::message('ការផ្លាស់ប្តូរត្រូវបរាជ័យ');
             }
         } else {
             Application_Form_FrmMessage::message('ការផ្លាស់ប្តូរត្រូវបរាជ័យ');
         }
     }
 }
Exemple #12
0
 /**
  * test unsetAll keys in default namespace; expect namespace will contain no keys
  *
  * @return void
  */
 public function testUnsetAllNamespace()
 {
     $s = new Zend_Session_Namespace('somenamespace');
     $result = '';
     foreach ($s->getIterator() as $key => $val) {
         $result .= "{$key} === {$val};";
     }
     $this->assertTrue(empty($result), "tearDown failure, found keys in 'somenamespace' namespace: '{$result}'");
     $s->a = 'apple';
     $s->lock();
     $s->unlock();
     $s->p = 'papaya';
     $s->c = 'cherry';
     $s = new Zend_Session_Namespace('somenamespace');
     $result = '';
     foreach ($s->getIterator() as $key => $val) {
         $result .= "{$key} === {$val};";
     }
     $this->assertTrue($result === 'a === apple;p === papaya;c === cherry;', "unsetAll() setup for test failed: '{$result}'");
     $s->unsetAll();
     $result = '';
     foreach ($s->getIterator() as $key => $val) {
         $result .= "{$key} === {$val};";
     }
     $this->assertTrue(empty($result), "unsetAll() did not remove keys from namespace: '{$result}'");
 }
Exemple #13
0
if (empty($_GET['key']) || empty($_GET['iv'])) {
    //No key exists...we have a problem
    $loggers['audit']->error('Attempted access to student read-only session without key.');
    header('location: https://' . URL_PHP . '/error-external.php?eid=R9001');
    exit;
}
$student = mcrypt_decrypt(MCRYPT_BLOWFISH, hash('md5', HASH_GENERATION_RANDOM_STRING), base64_decode($_GET['key']), MCRYPT_MODE_ECB, base64_decode($_GET['iv']));
$student = unserialize($student);
$log_in = $model->validateUserForReadOnlySession($student);
if (!$log_in) {
    //No student found...we have a problem
    $loggers['audit']->warning("Attempted access to student read-only session for invalid student {$student['student_num']}.");
    header('location: https://' . URL_PHP . '/error-external.php?eid=R9002');
    exit;
}
$loggers['audit']->info('Student read-only session initiated.');
$SESSION = new \Zend_Session_Namespace('student', true);
foreach ($log_in as $key => $value) {
    $SESSION->{$key} = $value;
}
$SESSION->logged_in = md5(uniqid(microtime()) . $_SERVER['REMOTE_ADDR'] . $_SERVER['HTTP_USER_AGENT']);
$SESSION->user_id = $student['student_num'];
if ($SESSION->corr_lang == "E") {
    $SESSION->corr_lang = "en-CA";
} elseif ($SESSION->corr_lang == "F") {
    $SESSION->corr_lang = "fr-CA";
}
$SESSION->read_only = 1;
$SESSION->lock();
header('location:dashboard.php');
die;
Exemple #14
0
 public function changepasswordAction()
 {
     // action body
     if ($this->getRequest()->isPost()) {
         $session_user = new Zend_Session_Namespace('auth');
         $pass_data = $this->getRequest()->getPost();
         if ($pass_data['password'] == $session_user->pwd) {
             $db_user = new Application_Model_DbTable_DbUsers();
             try {
                 $db_user->changePassword($pass_data['new_password'], $session_user->user_id);
                 $session_user->unlock();
                 $session_user->pwd = $pass_data['new_password'];
                 $session_user->lock();
                 Application_Form_FrmMessage::Sucessfull('ការផ្លាស់ប្�ូរដោយជោគជ�យ', self::REDIRECT_URL);
             } catch (Exception $e) {
                 Application_Form_FrmMessage::message('ការផ្លាស់ប្�ូរ�្រូវបរាជ�យ');
             }
         } else {
             Application_Form_FrmMessage::message('ការផ្លាស់ប្�ូរ�្រូវបរាជ�យ');
         }
     }
 }
 public function indexAction()
 {
     try {
         $db_tran = new Application_Model_DbTable_Dbpsc();
         //create sesesion
         $session_capital = new Zend_Session_Namespace('search_capital');
         if (empty($session_capital->limit)) {
             $session_capital->limit = Application_Form_FrmNavigation::getLimit();
             $session_capital->type_money = -1;
             $session_capital->staff_name = -1;
             $session_capital->from_date = date('Y-m-d');
             $session_capital->to_date = date('Y-m-d');
             $session_capital->lock();
         }
         //start page nevigation
         $limit = $session_capital->limit;
         $start = $this->getRequest()->getParam('limit_satrt', 0);
         $this->view->from_date = $session_capital->from_date;
         $this->view->to_date = $session_capital->to_date;
         $this->view->staff = $session_capital->staff;
         $cur = new Application_Model_DbTable_DbCurrencies();
         $this->view->currencylist = $cur->getCurrencyList();
         $this->view->type_money = $session_capital->type_money;
         if ($this->getRequest()->isPost()) {
             $formdata = $this->getRequest()->getPost();
             $session_capital->unlock();
             $session_capital->limit = $formdata['rows_per_page'];
             $session_capital->type_money = $formdata['type_money'];
             $session_capital->staff_name = $formdata['staff_name'];
             $session_capital->from_date = $formdata['from_date'];
             $session_capital->to_date = $formdata['to_date'];
             $session_capital->lock();
             $this->view->type_money = $formdata['type_money'];
             $this->view->staff_name = $formdata['staff_name'];
             $this->view->from_date = $session_capital->from_date;
             $this->view->to_date = $session_capital->to_date;
             $limit = $session_capital->limit;
         } else {
             $formdata = array('from_date' => $session_capital->from_date, 'to_date' => $session_capital->to_date, 'type_money' => $session_capital->type_money, 'staff_name' => $session_capital->staff_name);
         }
         $trans = $db_tran->getPscAmountListBy($formdata, $start, $limit);
         $record_count = $db_tran->getAllPscList($formdata);
         $result = array();
         $row_num = $start;
         if (!empty($trans)) {
             foreach ($trans as $i => $tran) {
                 $expired = '';
                 $is_expired = 0;
                 $volum = Application_Model_DbTable_DbGlobal::CurrencyOption($tran['currency_type'], $tran['volum']);
                 $result[$i] = array('num' => ++$row_num, 'id' => $tran['id'], 'staff_name' => $tran['staff_name'], 'currency_type' => $this->curr_type[$tran['currency_type']], 'volum' => number_format($volum) . ' ' . $this->curr_type[$tran['currency_type']], 'psc_amount' => $tran['psc_amount'] . " សន្លឹក", 'total_amount' => number_format($volum * $tran['psc_amount']) . ' ' . $this->curr_type[$tran['currency_type']], 'note' => $tran['note'], 'date' => date_format(date_create($tran['date']), "d/m/Y"), 'img' => $tran['id']);
             }
         } else {
             $result = array('err' => 1, 'msg' => 'មិន​ទាន់​មាន​ទន្និន័យ​នូវ​ឡើយ​ទេ!');
         }
         $this->view->tranlist = Zend_Json::encode($result);
         $page = new Application_Form_FrmNavigation(self::REDIRECT_URL, $start, $limit, $record_count);
         $page->init(self::REDIRECT_URL, $start, $limit, $record_count);
         $this->view->nevigation = $page->navigationPage();
         $this->view->rows_per_page = $page->getRowsPerPage($limit, 'frmlist_mt');
         $this->view->result_row = $page->getResultRows();
         $usr_mod = new Application_Model_DbTable_DbUsers();
         $user_list = $usr_mod->getUserListSelect();
         array_unshift($user_list, array('id' => '-1', "name" => "ជ្រើសរើសឈ្មោះបុគ្គលិក"));
         $this->view->users = $user_list;
         $session_user = new Zend_Session_Namespace('auth');
         $this->view->user_name = $session_user->last_name . ' ' . $session_user->first_name;
         $db_keycode = new Application_Model_DbTable_DbKeycode();
         $this->view->keycode = $db_keycode->getKeyCodeMiniInv();
         $this->view->rpt_list = $db_tran->countAllStaffpcsAmount($formdata);
         $this->view->curr_type = $this->curr_typesimble;
     } catch (Exception $e) {
     }
 }
 public function indexAction()
 {
     try {
         $db_tran = new Application_Model_DbTable_DbKbank();
         //create sesesion
         $search_kbank = new Zend_Session_Namespace('search_kbank');
         if (empty($search_kbank->limit)) {
             $search_kbank->limit = Application_Form_FrmNavigation::getLimit();
             $search_kbank->type_money = -1;
             $search_kbank->txtsearch = "";
             $search_kbank->from_date = date('Y-m-d');
             $search_kbank->to_date = date('Y-m-d');
             $search_kbank->sender = -1;
             $search_kbank->lock();
         }
         //start page nevigation
         $limit = $search_kbank->limit;
         $start = $this->getRequest()->getParam('limit_satrt', 0);
         $this->view->from_date = $search_kbank->from_date;
         $this->view->to_date = $search_kbank->to_date;
         $this->view->sender_id = $search_kbank->sender;
         $cur = new Application_Model_DbTable_DbCurrencies();
         $this->view->currencylist = $cur->getCurrencyList();
         $this->view->type_money = $search_kbank->type_money;
         $this->view->statuslist = $this->statuslist;
         $this->view->txtsearch = $search_kbank->txtsearch;
         if ($this->getRequest()->isPost()) {
             $formdata = $this->getRequest()->getPost();
             // 				print_r($formdata);
             $search_kbank->unlock();
             $search_kbank->txtsearch = $formdata['txt_search'];
             $search_kbank->limit = $formdata['rows_per_page'];
             $search_kbank->type_money = $formdata['type_money'];
             $search_kbank->from_date = $formdata['from_date'];
             $search_kbank->to_date = $formdata['to_date'];
             $search_kbank->sender = $formdata['sender'];
             $search_kbank->lock();
             $this->view->txtsearch = $formdata['txt_search'];
             $this->view->type_money = $formdata['type_money'];
             $this->view->sender_id = $formdata['sender'];
             $this->view->from_date = $search_kbank->from_date;
             $this->view->to_date = $search_kbank->to_date;
             $limit = $search_kbank->limit;
             $trans = $db_tran->getTransactionListBy($formdata, $start, $limit);
             $record_count = $db_tran->getTransactionListTotal($formdata);
         } else {
             $formdata = array('txt_search' => $search_kbank->txtsearch, 'tran_type' => $search_kbank->tran_type, 'from_date' => $search_kbank->from_date, 'to_date' => $search_kbank->to_date, 'type_money' => $search_kbank->type_money, 'sender' => $search_kbank->sender);
             $trans = $db_tran->getTransactionListBy($formdata, $start, $limit);
             $record_count = $db_tran->getTransactionListTotal($formdata);
         }
         $result = array();
         $row_num = $start;
         if (!empty($trans)) {
             foreach ($trans as $i => $tran) {
                 $expired = '';
                 $is_expired = 0;
                 $amount = $tran['symbol'] . ' ' . number_format($tran['money_inaccount']);
                 $sub_agent = empty($tran['subname']) ? "" : "(" . $tran['subname'] . ")";
                 $inc_no = sprintf("%'010s", $tran['invoice']);
                 $current_date = $search_kbank->to_date;
                 $current_date = date_format(date_create($current_date), "d/m/Y");
                 if ($current_date >= date_format(date_create($tran['end_date']), "d/m/Y")) {
                     $expired = $current_date - date_format(date_create($tran['end_date']), "d/m/Y");
                     if ($expired == 0) {
                         $expired = 'ថ្ងៃនេះ';
                     } else {
                         $expired .= ' ថ្ងៃ';
                     }
                     $is_expired = 1;
                 }
                 $result[$i] = array('num' => ++$row_num, 'id' => $tran['id'], 'sender_name' => $tran['sender_name'], 'tel' => $tran['tel'], 'account_no' => $tran['acc_no'], 'invoice' => $tran['invoice'], 'amount' => $amount, 'start_date' => date_format(date_create($tran['start_date']), "d/m/Y"), 'expired_date' => date_format(date_create($tran['end_date']), "d/m/Y"), 'amount_month' => $tran['amount_month'] . ' ' . $this->pay_term[$tran['pay_term']], 'amount_expired' => $expired, 'is_expired' => $is_expired, 'is_extend' => $tran["is_extend"] == 1 ? "ពន្យា" : "ផ្ញើរ");
             }
         } else {
             $result = array('err' => 1, 'msg' => 'មិន​ទាន់​មាន​ទន្និន័យ​នូវ​ឡើយ​ទេ!');
         }
         $this->view->tranlist = Zend_Json::encode($result);
         $page = new Application_Form_FrmNavigation(self::REDIRECT_URL, $start, $limit, $record_count);
         $page->init(self::REDIRECT_URL, $start, $limit, $record_count);
         $this->view->nevigation = $page->navigationPage();
         $this->view->rows_per_page = $page->getRowsPerPage($limit, 'frmlist_mt');
         $this->view->result_row = $page->getResultRows();
         $sender = new Application_Model_DbTable_DbSender();
         $_sender = $sender->getAllSenderKbank();
         array_unshift($_sender, array('id' => '-1', "name" => "ជ្រើសរើសឈ្មោះអ្នកផ្ញើរ"));
         $this->view->sender = $_sender;
     } catch (Exception $e) {
     }
 }
 public function indexAction()
 {
     try {
         $db_tran = new Application_Model_DbTable_DbKbank();
         //create sesesion
         $session_withdraw = new Zend_Session_Namespace('search_withdraw');
         if (empty($session_withdraw->limit)) {
             $session_withdraw->limit = Application_Form_FrmNavigation::getLimit();
             $session_withdraw->type_money = -1;
             $session_withdraw->sender = -1;
             $session_withdraw->txtsearch = "";
             $session_withdraw->from_date = date('Y-m-d');
             $session_withdraw->to_date = date('Y-m-d');
             $session_withdraw->lock();
         }
         //start page nevigation
         $limit = $session_withdraw->limit;
         $start = $this->getRequest()->getParam('limit_satrt', 0);
         $this->view->from_date = $session_withdraw->from_date;
         $this->view->to_date = $session_withdraw->to_date;
         $this->view->sender_id = $session_withdraw->sender;
         $cur = new Application_Model_DbTable_DbCurrencies();
         $this->view->currencylist = $cur->getCurrencyList();
         $this->view->type_money = $session_withdraw->type_money;
         $this->view->txtsearch = $session_withdraw->txtsearch;
         if ($this->getRequest()->isPost()) {
             $formdata = $this->getRequest()->getPost();
             // 				print_r($formdata);
             $session_withdraw->unlock();
             $session_withdraw->txtsearch = $formdata['txt_search'];
             $session_withdraw->limit = $formdata['rows_per_page'];
             $session_withdraw->type_money = $formdata['type_money'];
             $session_withdraw->sender = $formdata['sender'];
             $session_withdraw->from_date = $formdata['from_date'];
             $session_withdraw->to_date = $formdata['to_date'];
             $session_withdraw->lock();
             $this->view->txtsearch = $formdata['txt_search'];
             $this->view->type_money = $formdata['type_money'];
             $this->view->sender_id = $formdata['sender'];
             $this->view->from_date = $session_withdraw->from_date;
             $this->view->to_date = $session_withdraw->to_date;
             $limit = $session_withdraw->limit;
             $trans = $db_tran->getTranWithDrawListBy($formdata, $start, $limit);
             $record_count = $db_tran->getTranWithDrawListTotal($formdata);
         } else {
             $formdata = array('txt_search' => $session_withdraw->txtsearch, 'tran_type' => $session_withdraw->tran_type, 'from_date' => $session_withdraw->from_date, 'to_date' => $session_withdraw->to_date, 'type_money' => $session_withdraw->type_money, 'sender' => $session_withdraw->sender);
             $trans = $db_tran->getTranWithDrawListBy($formdata, $start, $limit);
             $record_count = $db_tran->getTranWithDrawListTotal($formdata);
         }
         $result = array();
         $row_num = $start;
         if (!empty($trans)) {
             foreach ($trans as $i => $tran) {
                 $expired = '';
                 $is_expired = 0;
                 $result[$i] = array('num' => ++$row_num, 'id' => $tran['id'], 'sender_name' => $tran['sender_name'], 'tel' => $tran['tel'], 'account_no' => $tran['acc_no'], 'invoice' => $tran['invoice'], 'amount_dollar' => $tran['wd_amountdollar'] . " \$", 'amount_bath' => $tran['wd_amountbath'] . " B", 'amount_riel' => $tran['wd_amountriel'] . " R", 'create_date' => date_format(date_create($tran['create_date']), "d/m/Y"));
             }
         } else {
             $result = array('err' => 1, 'msg' => 'មិន​ទាន់​មាន​ទន្និន័យ​នូវ​ឡើយ​ទេ!');
         }
         $this->view->tranlist = Zend_Json::encode($result);
         $page = new Application_Form_FrmNavigation(self::REDIRECT_URL, $start, $limit, $record_count);
         $page->init(self::REDIRECT_URL, $start, $limit, $record_count);
         $this->view->nevigation = $page->navigationPage();
         $this->view->rows_per_page = $page->getRowsPerPage($limit, 'frmlist_mt');
         $this->view->result_row = $page->getResultRows();
         $sender = new Application_Model_DbTable_DbSender();
         $_sender = $sender->getAllSenderKbank();
         array_unshift($_sender, array('id' => '-1', "name" => "បន្ថែមឈ្មោះអ្នកផ្ញើរ"));
         $this->view->sender = $_sender;
         $cur = new Application_Model_DbTable_DbCurrencies();
     } catch (Exception $e) {
     }
 }
Exemple #18
0
 /**
  * http://stackoverflow.com/questions/3479336/why-is-there-no-translation-for-the-language-en-us
  * http://stackoverflow.com/questions/1875851/application-wide-locales-with-gettext-and-zend-translate
  * Enter description here ...
  * @throws Exception
  */
 public function initLanguage()
 {
     $config = Zend_Registry::get('config');
     try {
         if (!Zend_Session::isStarted()) {
             Zend_Session::start();
         }
         $languageSession = new Zend_Session_Namespace('language');
     } catch (Zend_Session_Exception $e) {
     }
     $lang = $this->_request->getParam('lang');
     if ($lang == null) {
         if (!isset($languageSession->current_lang)) {
             $lang = $config['site']['language'];
             if ($languageSession->isLocked()) {
                 $languageSession->unlock();
             }
             $languageSession->current_lang = $lang;
         } else {
             $lang = $languageSession->current_lang;
         }
     } else {
         if ($languageSession->isLocked()) {
             $languageSession->unlock();
         }
         $languageSession->current_lang = $lang;
     }
     $languageSession->setExpirationSeconds(1 * 60 * 60 * 12);
     $languageSession->lock();
     $this->view->lang = $lang;
     Zend_Registry::set('lang', $lang);
     $options = array('separator' => '=');
     try {
         $p_module = $this->_request->getModuleName();
         // get language file
         $languageDir = PATH_PROJECT . $config['site']['language_dir'] . $lang . DIRECTORY_SEPARATOR;
         $languageModuleDir = $languageDir . $p_module . DIRECTORY_SEPARATOR;
         $translate = new Zend_Translate('ini', $languageDir . "{$lang}.ini", "{$lang}", $options);
         $translate->getAdapter()->addTranslation($languageModuleDir . "module.lang.ini", "{$lang}", $options);
         //store translate object to the registry
         Zend_Registry::set('Zend_Translate', $translate);
         $this->view->translate = $translate;
     } catch (Exception $e) {
         throw new Exception($e->getMessage());
     }
 }
 public function editUserAccessAction()
 {
     $id = $this->getRequest()->getParam('id');
     if (!$id) {
         $id = 0;
     }
     $session = new Zend_Session_Namespace('auth');
     $session->user_type_id = $id;
     $session->lock();
     $form = new RsvAcl_Form_FrmUserAccess();
     //echo "it works"; exit;
     $db = new RsvAcl_Model_DbTable_DbUserAccess();
     $sql = "select user_type_id, user_type  from rms_acl_user_type where user_type_id=" . $id;
     $rs = $db->getUserAccessInfo($sql);
     //print_r($rs); exit;
     //Sophen add here
     //to assign project list in view
     $db_acl = new Application_Model_DbTable_DbGlobal();
     $sqlNotParentId = "SELECT user_type_id FROM `rms_acl_user_type` WHERE `parent_id` =" . $id;
     $notParentId = $db_acl->getGlobalDb($sqlNotParentId);
     $usernotparentid = $notParentId[0]['user_type_id'];
     //print $usernotparentid; exit;
     if ($id == 1) {
         $sql_acl = "select acl.acl_id,CONCAT(acl.module,'/', acl.controller,'/', acl.action) AS user_access from rms_acl_acl as acl";
     }
     if (!$usernotparentid) {
         $sql_acl = "SELECT acl.acl_id, CONCAT(acl.module,'/', acl.controller,'/', acl.action) AS user_access, acl.status FROM rms_acl_user_access AS ua \n\t\t\t\t\tINNER JOIN rms_acl_user_type AS ut ON (ua.user_type_id = ut.user_type_id)\n\t\t\t\t\tINNER JOIN rms_acl_acl AS acl ON (acl.acl_id = ua.acl_id) WHERE ua.user_type_id =" . $id;
     } else {
         $sql_acl = "SELECT acl.acl_id, CONCAT(acl.module,'/', acl.controller,'/', acl.action) AS user_access, acl.status FROM rms_acl_user_access AS ua \n\t\t\t\t\tINNER JOIN rms_acl_user_type AS ut ON (ua.user_type_id = ut.parent_id)\n\t\t\t\t\tINNER JOIN rms_acl_acl AS acl ON (acl.acl_id = ua.acl_id) WHERE ua.user_type_id =" . $id;
     }
     //print $sql_acl; exit;
     $acl_name = $db_acl->getGlobalDb($sql_acl);
     //print_r($acl_name); exit;
     if ($acl_name != '') {
         $form->setAcl($acl_name);
     }
     Application_Model_Decorator::setForm($form, $rs);
     $this->view->form = $form;
     $rows = array();
     for ($i = 1; $i <= $form->getPlus(); $i++) {
         $rows[] = array($i, $form->getElement('acl_id_' . $i)->getLabel(), $form->getElement('acl_id_' . $i));
     }
     $list = new Application_Form_Frmlist();
     $tr = Application_Form_FrmLanguages::getCurrentlanguage();
     $columns = array($tr->translate('URL'), $tr->translate('STATUS'));
     $this->view->form_layout = $list->getCheckList('radio', $columns, $rows);
     $this->view->id = $id;
     if ($this->getRequest()->isPost()) {
         $post = $this->getRequest()->getPost();
         //if($rs[0]['']==$post['username']){
         $db_user = new RsvAcl_Model_DbTable_DbUserType();
         print_r($post);
         exit;
         //print $rs[0]['user_type_id']; exit;
         $db_user->updateUserTypeAccess($post['user_type'], $rs[0]['user_type_id']);
         $db->assignAcl($post, $rs[0]['user_type_id'], $form->getPlus());
         //write log file
         $userLog = new Application_Model_Log();
         $userLog->writeUserLog($id);
         //End write log file
         //Application_Form_FrmMessage::message('One row affected!');
         Application_Form_FrmMessage::redirector('/rmsAcl/user-access/index');
         /*}else{
         			if(!$db->isUserExist($post['username'])){
         				$db->updateUser($post,$rs[0]['user_id']);
         				 //write log file 
         			        //$userLog= new RsvLogging_Model_RsvLogging();
         			    	//$userLog->writeUserLog($user_id);
         			     //End write log file
         				Application_Form_FrmMessage::message('One row affected!');
         				Application_Form_FrmMessage::redirector('/rmsAcl/user/index');						
         			}else {
         				Application_Form_FrmMessage::message('User had existed already');
         			}
         		}*/
     }
 }
Exemple #20
0
 /** Login action */
 public function loginAction()
 {
     $request = $this->getRequest();
     $this->Form->User->uri = $request->getRequestUri();
     $form = $this->Form->User->createLoginForm();
     $this->view->form = $this->getFormAsArray($form);
     $this->disableLayout();
     if ($this->_request->isPost()) {
         $this->disableView();
         $previousUri = $this->getParam('previousuri');
         if ($form->isValid($request->getPost())) {
             try {
                 $notifications = array();
                 // initialize first in case of exception
                 $notifications = Zend_Registry::get('notifier')->callback('CALLBACK_CORE_AUTHENTICATION', array('email' => $form->getValue('email'), 'password' => $form->getValue('password')));
             } catch (Zend_Exception $exc) {
                 $this->getLogger()->crit($exc->getMessage());
             }
             $authModule = false;
             foreach ($notifications as $user) {
                 if ($user) {
                     $userDao = $user;
                     $authModule = true;
                     break;
                 }
             }
             if (!$authModule) {
                 $userDao = $this->User->getByEmail($form->getValue('email'));
                 if ($userDao === false) {
                     echo JsonComponent::encode(array('status' => false, 'message' => 'Invalid email or password'));
                     return;
                 }
             }
             $instanceSalt = Zend_Registry::get('configGlobal')->password->prefix;
             $currentVersion = Zend_Registry::get('configDatabase')->version;
             // We have to have this so that an admin can log in to upgrade from version < 3.2.12 to >= 3.2.12.
             // Version 3.2.12 introduced the new password hashing and storage system.
             if (!$authModule && version_compare($currentVersion, '3.2.12', '>=')) {
                 $passwordHash = hash($userDao->getHashAlg(), $instanceSalt . $userDao->getSalt() . $form->getValue('password'));
                 $coreAuth = $this->User->hashExists($passwordHash);
             } elseif (!$authModule) {
                 $passwordHash = md5($instanceSalt . $form->getValue('password'));
                 $coreAuth = $this->User->legacyAuthenticate($userDao, $instanceSalt, $form->getValue('password'));
             }
             if ($authModule || $coreAuth) {
                 $notifications = Zend_Registry::get('notifier')->callback('CALLBACK_CORE_AUTH_INTERCEPT', array('user' => $userDao));
                 foreach ($notifications as $value) {
                     if ($value['override'] && $value['response']) {
                         echo $value['response'];
                         return;
                     }
                 }
                 if (!$authModule && version_compare($currentVersion, '3.2.12', '>=') && $userDao->getSalt() == '') {
                     $passwordHash = $this->User->convertLegacyPasswordHash($userDao, $form->getValue('password'));
                 }
                 $remember = $form->getValue('remerberMe');
                 if (!$this->isTestingEnv()) {
                     $date = new DateTime();
                     $interval = new DateInterval('P1M');
                     if (!$authModule && isset($remember) && $remember == 1) {
                         setcookie(MIDAS_USER_COOKIE_NAME, $userDao->getKey() . '-' . $passwordHash, $date->add($interval)->getTimestamp(), '/', $request->getHttpHost(), (int) Zend_Registry::get('configGlobal')->get('cookie_secure', 1) === 1, true);
                     } else {
                         setcookie(MIDAS_USER_COOKIE_NAME, null, $date->sub($interval)->getTimestamp(), '/', $request->getHttpHost(), (int) Zend_Registry::get('configGlobal')->get('cookie_secure', 1) === 1, true);
                         Zend_Session::start();
                         $user = new Zend_Session_Namespace('Auth_User');
                         $user->setExpirationSeconds(60 * Zend_Registry::get('configGlobal')->session->lifetime);
                         $user->Dao = $userDao;
                         $user->lock();
                     }
                 }
                 $this->getLogger()->debug(__METHOD__ . ' Log in : ' . $userDao->getFullName());
                 if (isset($previousUri) && !empty($previousUri) && !empty($this->view->webroot) && strpos($previousUri, 'logout') === false) {
                     $redirect = $previousUri;
                 } else {
                     $redirect = $this->view->webroot . '/feed?first=true';
                 }
                 echo JsonComponent::encode(array('status' => true, 'redirect' => $redirect));
             } else {
                 echo JsonComponent::encode(array('status' => false, 'message' => 'Invalid email or password'));
             }
         } else {
             echo JsonComponent::encode(array('status' => false, 'message' => 'Invalid email or password'));
         }
     }
     $this->view->allowPasswordReset = (int) Zend_Registry::get('configGlobal')->get('allow_password_reset', 0) === 1;
     $this->view->closeRegistration = (int) Zend_Registry::get('configGlobal')->get('closeregistration', 0) === 1;
 }
 public function postAction()
 {
     try {
         // Form is not posted correctly, we redirect to the previous page
         if (!$this->getRequest()->isPost()) {
             Flash::addItem(__("Requête invalide.", "s1b"));
             return HTTPHelper::redirectToReferer();
         }
         $groupId = $this->getParam("group_id", null);
         $imageUploadPath = $this->getImageUploadPath($groupId);
         $id = $this->getParam("id", null);
         // Check the form validity
         $form = new ChronicleForm($imageUploadPath, $id ? false : true);
         if (!$form->isValid($_POST)) {
             // Add the chronicle form to the view model
             $this->view->form = $form;
             // Add the group to the view model
             $group = GroupDao::getInstance()->get($groupId);
             $this->view->group = $group;
             // When form is not valid, we render the edit page
             return $this->render("edit");
         } else {
             // 1. If the form is valid, the image file has already been uploaded
             // 2. We add or update chronicle in database
             if ($form->getChronicleId()) {
                 // Get existing chronicle from database
                 $chronicle = ChronicleDao::getInstance()->get($form->getChronicleId());
             } else {
                 // create new chronicle
                 $chronicle = new Chronicle();
             }
             //
             // Set all chronicle members
             $this->setChronicleData($form, $chronicle);
             // Update chronicle if editing an existing one
             if ($form->getChronicleId()) {
                 ChronicleDao::getInstance()->update($chronicle);
             } else {
                 // And add a new chronicle if not
                 ChronicleDao::getInstance()->add($chronicle);
             }
             //
             // 4. We redirect to confirmation page
             $sessionData = new Zend_Session_Namespace(self::EDIT_CHRONICLE_NAMESPACE);
             $sessionData->chronicleId = $chronicle->getId();
             $sessionData->lock();
             $this->redirect("member/chronicle/confirmation");
         }
     } catch (\Exception $e) {
         Trace::addItem(sprintf("Une erreur s'est produite dans \"%s->%s\", TRACE : %s\"", get_class(), __FUNCTION__, $e->getTraceAsString()));
         $this->forward("error", "error", "default");
     }
 }
 public function indexAction()
 {
     // action body
     //Get Session User
     try {
         $db_owe = new Application_Model_DbTable_DbPayment();
         //create sesesion
         $session_transfer = new Zend_Session_Namespace('search_transfer');
         if (empty($session_transfer->limit)) {
             $session_transfer->limit = Application_Form_FrmNavigation::getLimit();
             $session_transfer->status = -1;
             $session_transfer->type_money = -1;
             $session_transfer->sender_name = "";
             $session_transfer->loan = -1;
             $session_transfer->province = -1;
             $session_transfer->agent = -1;
             $session_transfer->from_date = date('Y-m-d');
             $session_transfer->to_date = date('Y-m-d');
             $session_transfer->lock();
         }
         //start page nevigation
         $limit = $session_transfer->limit;
         $start = $this->getRequest()->getParam('limit_satrt', 0);
         $this->view->from_date = $session_transfer->from_date;
         $this->view->to_date = $session_transfer->to_date;
         $this->view->status = $session_transfer->status;
         $cur = new Application_Model_DbTable_DbCurrencies();
         $this->view->currencylist = $cur->getCurrencyList();
         $this->view->type_money = $session_transfer->type_money;
         $this->view->sender_name = $session_transfer->sender_name;
         $pro = new Application_Model_DbTable_DbProvinces();
         $this->view->provincelist = $pro->getProvinceList();
         //$this->view->province = $session_transfer->province;
         $agent = new Application_Model_DbTable_DbAgents();
         //$this->view->agentlist = $agent->getAgentListSelect();
         //$this->view->agent = $session_transfer->agent;
         if ($this->getRequest()->isPost()) {
             $formdata = $this->getRequest()->getPost();
             $session_transfer->unlock();
             $session_transfer->sender_name = $formdata['sender_name'];
             $session_transfer->limit = $formdata['rows_per_page'];
             $session_transfer->from_date = $formdata['from_date'];
             $session_transfer->to_date = $formdata['to_date'];
             $session_transfer->lock();
             $this->view->sender_name = $formdata['sender_name'];
             $this->view->from_date = $session_transfer->from_date;
             $this->view->to_date = $session_transfer->to_date;
             $limit = $session_transfer->limit;
             $result = $db_owe->getTransactionOweList($formdata, $start, $limit);
             $record_count = $db_owe->getTransactionOweListTotal($formdata);
         } else {
             $formdata = array('sender_name' => $session_transfer->sender_name, 'status' => $session_transfer->status, 'status_loan' => $session_transfer->loan, 'from_date' => $session_transfer->from_date, 'to_date' => $session_transfer->to_date, 'type_money' => $session_transfer->type_money);
             //print_r($formdata); exit();
             $result = $db_owe->getTransactionOweList($formdata, $start, $limit);
             $record_count = $db_owe->getTransactionOweListTotal($formdata);
         }
         $row_num = $start;
         //print_r($result);exit;
         if (!empty($result)) {
             $tra_id = '';
             foreach ($result as $i => $rs) {
                 $refund_dollar = 0;
                 $refund_bath = 0;
                 $refund_riel = 0;
                 $refund_txt = 'refund_dollar';
                 if ($rs["curency_type"] == 1) {
                     $refund_dollar = $rs["refund"];
                 } else {
                     if ($rs["curency_type"] == 2) {
                         $refund_bath = $rs["refund"];
                         $refund_txt = 'refund_bath';
                     } else {
                         $refund_riel = $rs["refund"];
                         $refund_txt = 'refund_riel';
                     }
                 }
                 //echo $tra_id."=".$rs["invoice_found"]."<br/><br/>";
                 if ($tra_id != $rs["invoice_found"]) {
                     $tra_id = $rs["invoice_found"];
                     $result_row[$tra_id] = array('num' => ++$row_num, "found_id" => $rs["invoice_found"], "invoice_found" => $rs["invoice_found"], "sender_name" => $rs["sender_name"], "refund_dollar" => $refund_dollar, "refund_bath" => $refund_bath, "refund_riel" => $refund_riel, "date_refund" => $rs["date_refund"]);
                     //print_r($result_row);echo "<br/> ***New <br/>";
                 } else {
                     $result_row[$tra_id][$refund_txt] = $rs["refund"];
                     //print_r($result_row);echo "<br/>***old<br/>";
                 }
             }
             $i = 0;
             foreach ($result_row as $val) {
                 $result_rows[$i] = $val;
                 $i++;
             }
             //print_r($result_rows);
             //     			exit;
             //     				//format amount
             //     				$amount = $tran['symbol'].' '.number_format($tran['amount']);
             //     				$sub_agent = (empty($tran['subname']))? "":"(".$tran['subname'].")";
             //     				$inc_no = sprintf("%'010s",  $tran['invoice_no']);
             //     				$result[$i] = array(
             //     						'num' => (++$row_num),
             //     						'id' => $tran['id'],
             //     						'amount' => $amount,
             //     						'agentname' => $tran['agentname'].$sub_agent,
             //     						'reciever_tel' => $tran['reciever_tel'],
             //     						'invoice_no'=> $inc_no,
             //     						'send_date'=> date_format(date_create($tran['send_date']), "d/m/Y"),
             //     						//'status'=> $this->statuslist[$tran['status']],
             //     						//'status_loan'=> $this->loanlist[$tran['status_loan']],
             //     						'sender_name'=>$tran['sender_name'],
             //     						'reciever_name'=>$tran['reciever_name']
             //     				);
             //     			}
         } else {
             $result_rows = array('err' => 1, 'msg' => 'មិន​ទាន់​មាន​ទន្និន័យ​នូវ​ឡើយ​ទេ!');
         }
         $this->view->tranlist = Zend_Json::encode($result_rows);
         $sender = new Application_Model_DbTable_DbSender();
         //$this->view->loanlist =($this->loanlist);
         //     		$this->view->senderlist = $sender->getAllSenderNameOwe();
         //     		print_r($sender->getAllSenderNameOwe());
         $page = new Application_Form_FrmNavigation(self::REDIRECT_URL, $start, $limit, $record_count);
         $page->init(self::REDIRECT_URL, $start, $limit, $record_count);
         $this->view->nevigation = $page->navigationPage();
         //print_r($limit);exit;
         $this->view->rows_per_page = $page->getRowsPerPage($limit, 'frmlist_mt');
         $this->view->result_row = $page->getResultRows();
         $sender = new Application_Model_DbTable_DbSender();
         $this->view->senderlist = $sender->getAllSenderNameFound();
     } catch (Exception $e) {
     }
 }
 public function changepasswordAction()
 {
     // action body
     if ($this->getRequest()->isPost()) {
         $session_user = new Zend_Session_Namespace('auth');
         $pass_data = $this->getRequest()->getPost();
         if ($pass_data['password'] == $session_user->pwd) {
             $db_user = new Application_Model_DbTable_DbUsers();
             try {
                 $db_user->changePassword($pass_data['new_password'], $session_user->user_id);
                 $session_user->unlock();
                 $session_user->pwd = $pass_data['new_password'];
                 $session_user->lock();
                 Application_Form_FrmMessage::Sucessfull('ពាក្យ​សំងាត់​នា​ពេល​បច្ចុប្បន្ន ​កែប្រែ ជោគ​ជ័យ', self::REDIRECT_URL);
             } catch (Exception $e) {
                 Application_Form_FrmMessage::message('ពាក្យ​សំងាត់​នា​ពេល​បច្ចុប្បន្ន ​កែប្រែ មិន ជោគ​ជ័យ');
             }
         } else {
             Application_Form_FrmMessage::message('ពាក្យ​សំងាត់​នា​ពេល​បច្ចុប្បន្ន ​មិន​ត្រឹម​ត្រូវ');
         }
     }
 }
 /**
  *
  */
 public function lock()
 {
     $this->lockStorage = parent::_namespaceGet($this->_namespace);
     parent::lock();
 }
 /**
  * 名前空間をロックする
  *
  * @access public
  */
 public function lock()
 {
     parent::lock();
 }
Exemple #26
0
 public function getSignedUserTwitterAccount()
 {
     $auth = Zend_Auth::getInstance();
     if (!$auth->hasIdentity()) {
         throw new Exception("Not signed in.");
     }
     $twitterInfo = new Zend_Session_Namespace('twitterInfo');
     if (!$twitterInfo->isLocked()) {
         $select = $this->_dbTable->select()->where("uid = ?", $auth->getIdentity());
         $row = $this->_dbAdapter->fetchRow($select);
         $twitterInfo->account = $row;
         $twitterInfo->setExpirationSeconds(86400);
         //we like fresh data
         $twitterInfo->lock();
     }
     return $twitterInfo->account;
 }