예제 #1
0
 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");
     }
 }
예제 #2
0
 public function login_saver()
 {
     if ($this->save_login == "no" || $this->save_login == "undefined") {
         if (isset($_COOKIE[$this->cookie_name])) {
             $expire = time() - 3600;
         } else {
             return;
         }
     } else {
         $expire = time() + 2592000;
     }
     $obj = new Pandamp_Crypt_Password();
     $cookie_str = $this->user . chr(31) . $obj->encryptPassword($this->user_pw);
     setcookie($this->cookie_name, $cookie_str, $expire, $this->cookie_path);
 }
예제 #3
0
 public function save($aData)
 {
     $gman = new Pandamp_Core_Guid();
     $guid = isset($aData['guid']) && !empty($aData['guid']) ? $aData['guid'] : $gman->generateGuid();
     //if not empty, there are 2 possibilities
     $tblUser = new Pandamp_Modules_Identity_User_Model_User();
     $row = $tblUser->fetchRow("guid='{$guid}'");
     if (empty($row)) {
         if (empty($aData['username'])) {
             throw new Zend_Exception('Username can not be EMPTY!');
         }
         if (empty($aData['password'])) {
             throw new Zend_Exception('Password can not be EMPTY!');
         }
         $row = $tblUser->createRow();
         if (isset($aData['password']) && !empty($aData['password'])) {
             $password = $aData['password'];
             $crypt = new Pandamp_Crypt_Password();
             $password = $crypt->encryptPassword($password);
             $row->password = $password;
         }
     }
     if (isset($aData['username']) && !empty($aData['username'])) {
         //check if username was already taken
         $username = $aData['username'];
         $tblUser = new Pandamp_Modules_Identity_User_Model_User();
         $rowUsername = $tblUser->fetchRow("username='******'");
         if ($rowUsername) {
             throw new Zend_Exception('Username exists');
         }
         $row->username = $aData['username'];
     }
     if (isset($aData['email'])) {
         $row->email = $aData['email'];
     }
     if (isset($aData['fullName'])) {
         $row->fullName = $aData['fullName'];
     }
     if (isset($aData['chkGender'])) {
         $row->gender = $aData['chkGender'] == 1 ? 'L' : 'P';
     }
     if (isset($aData['year'])) {
         $row->birthday = $aData['year'] . '-' . $aData['month'] . '-' . $aData['day'];
     }
     if (isset($aData['education'])) {
         $row->educationId = $aData['education'];
     }
     if (isset($aData['expense'])) {
         $row->expenseId = $aData['expense'];
     }
     if (isset($aData['company'])) {
         $row->company = $aData['company'];
     }
     if (isset($aData['businessType'])) {
         $row->businessTypeId = $aData['businessType'];
     }
     if (isset($aData['phone'])) {
         $row->phone = $aData['phone'];
     }
     if (isset($aData['fax'])) {
         $row->phone = $aData['fax'];
     }
     if (isset($aData['packageId'])) {
         $row->packageId = $aData['packageId'];
     }
     if (isset($aData['newArtikel']) && $aData['newArtikel'] == 1) {
         $row->newArticle = 'Y';
     } else {
         if (!isset($aData['email']) && !isset($aData['username'])) {
             $row->newArticle = 'N';
         }
     }
     if (isset($aData['newRegulation']) && $aData['newRegulation'] == 1) {
         $row->monthlyList = 'Y';
     } else {
         if (!isset($aData['email']) && !isset($aData['username'])) {
             $row->monthlyList = 'N';
         }
     }
     if (isset($aData['newWeeklyRegulation']) && $aData['newWeeklyRegulation'] == 1) {
         $row->weeklyList = 'Y';
     } else {
         if (!isset($aData['email']) && !isset($aData['username'])) {
             $row->weeklyList = 'N';
         }
     }
     $row->save();
     return $row;
 }
예제 #4
0
 function resetAction()
 {
     $this->_helper->layout->setLayout('layout-customer-credential');
     $this->_helper->viewRenderer->setNoRender(TRUE);
     $id = $this->_request->getParam('id') ? $this->_request->getParam('id') : '';
     $obj = new Pandamp_Crypt_Password();
     $modelUser = new App_Model_Db_Table_User();
     $row = $modelUser->find($id)->current();
     $newpass = Pandamp_Lib_Formater::randompassowrd();
     $to = $row->email;
     $row->password = $obj->encryptPassword($newpass);
     $subject = "Your new password for Hukumonline.com";
     $message = "Dear {$row->fullName},\n\n";
     $message .= "As you requested, your password has now been reset. Your new details are as follows:\n\n";
     $message .= "Username: "******"\n";
     $message .= "Password: "******"\n\n";
     $message .= "All the best,\n";
     $message .= "Hukumonline.com";
     $config = new Zend_Config_Ini(ROOT_DIR . '/app/configs/mail.ini', 'mail');
     $options = array('auth' => $config->mail->auth, 'username' => $config->mail->username, 'password' => $config->mail->password);
     $transport = new Zend_Mail_Transport_Smtp($config->mail->host, $options);
     $mail = new Zend_Mail();
     $mail->setBodyText($message);
     $mail->setFrom($config->mail->sender->support->email, $config->mail->sender->support->name);
     $mail->addTo($to, $row->fullName);
     $mail->setSubject($subject);
     try {
         $mailTransport = Pandamp_Application::getResource('mail');
         $mail->send($mailTransport);
         $row->save();
     } catch (Zend_Exception $e) {
         echo $e->getMessage();
         die;
     }
 }
예제 #5
0
 public function processAction()
 {
     $uid = $this->_getParam('id') ? $this->_getParam('id') : '';
     $ec = $this->_getParam('ec') ? $this->_getParam('ec') : '';
     $promotionCode = $this->_getParam('promotionCode') ? $this->_getParam('promotionCode') : '';
     $fullName = $this->_getParam('fullName') ? $this->_getParam('fullName') : '';
     $gender = $this->_getParam('chkGender') ? $this->_getParam('chkGender') : '';
     $month = $this->_getParam('month') ? $this->_getParam('month') : '';
     $day = $this->_getParam('day') ? $this->_getParam('day') : '';
     $year = $this->_getParam('year') ? $this->_getParam('year') : '';
     $education = $this->_getParam('education') ? $this->_getParam('education') : '';
     $expense = $this->_getParam('expense') ? $this->_getParam('expense') : '';
     $company = $this->_getParam('company') ? $this->_getParam('company') : '';
     $businessType = $this->_getParam('businessType') ? $this->_getParam('businessType') : '';
     $billing = $this->_getParam('billing') ? $this->_getParam('billing') : '';
     $phone = $this->_getParam('phone') ? $this->_getParam('phone') : '';
     $fax = $this->_getParam('fax') ? $this->_getParam('fax') : '';
     $payment = $this->_getParam('payment') ? $this->_getParam('payment') : '';
     $email = $this->_getParam('email') ? $this->_getParam('email') : '';
     $newArtikel = $this->_getParam('newArtikel') ? $this->_getParam('newArtikel') : '';
     $newRegulation = $this->_getParam('newRegulation') ? $this->_getParam('newRegulation') : '';
     $newWRegulation = $this->_getParam('newWeeklyRegulation') ? $this->_getParam('newWeeklyRegulation') : '';
     $iscontact = $this->_getParam('iscontact') ? $this->_getParam('iscontact') : '';
     $aro_groups = $this->_getParam('aro_groups') ? $this->_getParam('aro_groups') : '';
     $formater = new Pandamp_Core_Hol_User();
     $obj = new Pandamp_Crypt_Password();
     $aclMan = Pandamp_Acl::manager();
     // marketing					// bonus			// corporate		    // complete         // ilb               // ild
     if ($aro_groups == 27 || $aro_groups == 39 || $aro_groups == 37 || $aro_groups == 28 || $aro_groups == 29 || $aro_groups == 30) {
         // untuk member seperti corporate, complete, ilb, dan ild
         // field fullName, birthday, gender, education, expense
         // tidak disimpan
         $id = 1 + ($uid - 1);
         for ($x = 1; $x < $id; $x++) {
             $guid = $this->_getParam('guid' . $x) ? $this->_getParam('guid' . $x) : '';
             $username = $this->_getParam('username' . $x) ? $this->_getParam('username' . $x) : '';
             $password = $this->_getParam('password' . $x) ? $this->_getParam('password' . $x) : '';
             $tblUser = new Pandamp_Modules_Identity_User_Model_User();
             $rowUser = $tblUser->find($guid)->current();
             if (!empty($rowUser)) {
                 // $rowUser->username			= $username;
                 $rowUser->password = $obj->encryptPassword($password);
                 // $rowUser->fullName			= $fullName;
                 // $rowUser->birthday			= $year.'-'.$month.'-'.$day;
                 $rowUser->indexCol = $x;
                 $rowUser->billingAddress = $billing;
                 $rowUser->phone = $phone;
                 $rowUser->fax = $fax;
                 // $rowUser->gender			= ($gender == 1)? 'L' : 'P';
                 $rowUser->email = $email;
                 $rowUser->company = $company;
                 $rowUser->newArticle = $newArtikel == 1 ? 'Y' : 'N';
                 $rowUser->weeklyList = $newWRegulation == "1" ? 'Y' : 'N';
                 $rowUser->monthlyList = $newRegulation == 1 ? 'Y' : 'N';
                 $rowUser->isContact = $iscontact == $x ? 'Y' : 'N';
                 $rowUser->packageId = $aro_groups;
                 $rowUser->promotionId = $promotionCode;
                 // $rowUser->educationId		= $education;
                 // $rowUser->expenseId			= $expense;
                 $rowUser->paymentId = $payment;
                 $rowUser->businessTypeId = $businessType;
             } else {
                 $rowUser = $tblUser->fetchNew();
                 $rowUser->username = $username;
                 $rowUser->password = $obj->encryptPassword($password);
                 // $rowUser->fullName			= $fullName;
                 // $rowUser->birthday			= $year.'-'.$month.'-'.$day;
                 $rowUser->indexCol = $x;
                 $rowUser->billingAddress = $billing;
                 $rowUser->phone = $phone;
                 $rowUser->fax = $fax;
                 // $rowUser->gender			= ($gender == 1)? 'L' : 'P';
                 $rowUser->email = $email;
                 $rowUser->company = $company;
                 $rowUser->newArticle = $newArtikel == 1 ? 'Y' : 'N';
                 $rowUser->weeklyList = $newWRegulation == "1" ? 'Y' : 'N';
                 $rowUser->monthlyList = $newRegulation == 1 ? 'Y' : 'N';
                 $rowUser->isContact = $iscontact == $x ? 'Y' : 'N';
                 $rowUser->packageId = $aro_groups;
                 $rowUser->promotionId = $promotionCode;
                 // $rowUser->educationId		= $education;
                 // $rowUser->expenseId			= $expense;
                 $rowUser->paymentId = $payment;
                 $rowUser->businessTypeId = $businessType;
             }
             $rowUser->save();
         }
         // check!!if u want to send email confirmation?
         if ($ec == 1) {
             // check disc promo
             $disc = $formater->checkPromoValidation('Disc', $aro_groups, $promotionCode, $payment);
             // check total promo
             $total = $formater->checkPromoValidation('Total', $aro_groups, $promotionCode, $payment);
             // get mail content
             $mailcontent = $formater->getMailContent('konfirmasi-email-korporasi');
             // write confirm corporate email
             $formater->_writeConfirmCorporateEmail($mailcontent, $company, $payment, $disc, $total, $this->_getParam('username1'), base64_encode(Pandamp_Lib_Formater::get_user_id($this->_getParam('username1'))), $email);
         } else {
             // activate user account
             $aReturn = $aclMan->getGroupData($aro_groups);
             $aclMan->addUser($this->_getParam('username1'), $aReturn[2]);
         }
     } else {
         $guid = $this->_getParam('guid1') ? $this->_getParam('guid1') : '';
         $username = $this->_getParam('username1') ? $this->_getParam('username1') : '';
         $password = $this->_getParam('password1') ? $this->_getParam('password1') : '';
         $tblUser = new Pandamp_Modules_Identity_User_Model_User();
         $rowUser = $tblUser->find($guid)->current();
         if (!empty($rowUser)) {
             // $rowUser->username			= $username;
             $rowUser->password = $obj->encryptPassword($password);
             $rowUser->fullName = $fullName;
             $rowUser->birthday = $year . '-' . $month . '-' . $day;
             $rowUser->phone = $phone;
             $rowUser->fax = $fax;
             $rowUser->gender = $gender == 1 ? 'L' : 'P';
             $rowUser->email = $email;
             $rowUser->company = $company;
             $rowUser->newArticle = $newArtikel == 1 ? 'Y' : 'N';
             $rowUser->weeklyList = $newWRegulation == "1" ? 'Y' : 'N';
             $rowUser->monthlyList = $newRegulation == 1 ? 'Y' : 'N';
             $rowUser->packageId = $aro_groups;
             $rowUser->promotionId = $promotionCode;
             $rowUser->educationId = $education;
             $rowUser->expenseId = $expense;
             $rowUser->paymentId = $payment;
             $rowUser->businessTypeId = $businessType;
         } else {
             $rowUser = $tblUser->fetchNew();
             $rowUser->username = $username;
             $rowUser->password = $obj->encryptPassword($password);
             $rowUser->fullName = $fullName;
             $rowUser->birthday = $year . '-' . $month . '-' . $day;
             $rowUser->phone = $phone;
             $rowUser->fax = $fax;
             $rowUser->gender = $gender == 1 ? 'L' : 'P';
             $rowUser->email = $email;
             $rowUser->company = $company;
             $rowUser->newArticle = $newArtikel == 1 ? 'Y' : 'N';
             $rowUser->weeklyList = $newWRegulation == "1" ? 'Y' : 'N';
             $rowUser->monthlyList = $newRegulation == 1 ? 'Y' : 'N';
             $rowUser->packageId = $aro_groups;
             $rowUser->promotionId = $promotionCode;
             $rowUser->educationId = $education;
             $rowUser->expenseId = $expense;
             $rowUser->paymentId = $payment;
             $rowUser->businessTypeId = $businessType;
         }
         $guid = $rowUser->save();
         if ($ec == 1) {
             // individual
             if ($aro_groups == 26) {
                 // check disc promo
                 $disc = $formater->checkPromoValidation('Disc', $aro_groups, $promotionCode, $payment);
                 // check total promo
                 $total = $formater->checkPromoValidation('Total', $aro_groups, $promotionCode, $payment);
                 // get mail content
                 $mailcontent = $formater->getMailContent('konfirmasi-email-individual');
                 // write confirm individual email
                 $formater->_writeConfirmIndividualEmail($mailcontent, $fullName, $username, $password, $payment, $disc, $total, base64_encode(Pandamp_Lib_Formater::get_user_id($username)), $email);
             } else {
                 // get mail content
                 $mailcontent = $formater->getMailContent('konfirmasi email gratis');
                 // write confirm free email
                 $aReturn = $aclMan->getGroupData($aro_groups);
                 $formater->_writeConfirmFreeEmail($mailcontent, $fullName, $username, $password, base64_encode(Pandamp_Lib_Formater::get_user_id($username)), $email, $aReturn[2]);
             }
         } else {
             // activate user account
             $aReturn = $aclMan->getGroupData($aro_groups);
             $aclMan->addUser($username, $aReturn[2]);
         }
     }
     $this->view->success = true;
 }
예제 #6
0
 function transformRegister($value)
 {
     if (empty($value['username'])) {
         throw new Zend_Exception("Username empty!");
     }
     $obj = new Pandamp_Crypt_Password();
     $month = $value['month'] ? $value['month'] : '00';
     $day = $value['day'] ? $value['day'] : '00';
     $year = $value['year'] ? $value['year'] : '0000';
     $newArticle = isset($value['newArticle']) ? $value['newArticle'] : '';
     $newRegulation = isset($value['newRegulation']) ? $value['newRegulation'] : '';
     $newWRegulation = isset($value['newWeeklyRegulation']) ? $value['newWeeklyRegulation'] : '';
     $isContact = isset($value['iscontact']) ? $value['iscontact'] : '';
     if ($value['gender'] == 1) {
         $gender = 'L';
     } else {
         if ($value['gender'] == 2) {
             $gender = 'P';
         } else {
             $gender = 'N';
         }
     }
     $data = array('kopel' => $this->generateKopel(), 'username' => $value['username'], 'password' => $obj->encryptPassword($value['password']), 'fullName' => $value['fullname'] ? $value['fullname'] : '', 'birthday' => $year . '-' . $month . '-' . $day, 'phone' => $value['phone'] ? $value['phone'] : '', 'fax' => $value['fax'] ? $value['fax'] : '', 'gender' => $gender, 'email' => $value['email'], 'company' => $value['company'] ? $value['company'] : '', 'address' => $value['address'] ? $value['address'] : '', 'city' => $value['city'] ? $value['city'] : '', 'state' => $value['province'] ? $value['province'] : '', 'countryId' => $value['countryId'] ? $value['countryId'] : '', 'zip' => $value['zip'] ? $value['zip'] : '', 'indexCol' => 0, 'newArticle' => $newArticle == 1 ? 'Y' : 'N', 'weeklyList' => $newWRegulation == 1 ? 'Y' : 'N', 'monthlyList' => $newRegulation == 1 ? 'Y' : 'N', 'packageId' => $value['aro_groups'], 'promotionId' => $value['promotioncode'] ? $value['promotioncode'] : '', 'educationId' => $value['education'] ? $value['education'] : 0, 'expenseId' => $value['expense'] ? $value['expense'] : 0, 'paymentId' => $value['payment'] ? $value['payment'] : 0, 'trialInDays' => $value['trial'] ? $value['trial'] : 0, 'businessTypeId' => $value['businessType'] ? $value['businessType'] : 0, 'periodeId' => 1, 'createdDate' => date('Y-m-d H:i:s'), 'createdBy' => $value['createdBy'], 'isContact' => $isContact == 1 ? 'Y' : 'N', 'notes' => $value['notes']);
     return $data;
 }
예제 #7
0
 function authenticate()
 {
     $exception = null;
     if ($this->_tableName == '') {
         $exception = 'A table must be supplied for the Zend_Auth_Adapter_DbTable authentication adapter.';
     } elseif ($this->_identityColumn == '') {
         $exception = 'An identity column must be supplied for the Zend_Auth_Adapter_DbTable authentication adapter.';
     } elseif ($this->_credentialColumn == '') {
         $exception = 'A credential column must be supplied for the Zend_Auth_Adapter_DbTable authentication adapter.';
     } elseif ($this->_identity == '') {
         $exception = 'A value for the identity was not provided prior to authentication with Zend_Auth_Adapter_DbTable.';
     } elseif ($this->_credential === null) {
         $exception = 'A credential value was not provided prior to authentication with Zend_Auth_Adapter_DbTable.';
     }
     if (null !== $exception) {
         /**
          * @see Zend_Auth_Adapter_Exception
          */
         require_once 'Zend/Auth/Adapter/Exception.php';
         throw new Zend_Auth_Adapter_Exception($exception);
     }
     // create result array
     $authResult = array('code' => Zend_Auth_Result::FAILURE, 'identity' => $this->_identity, 'messages' => array());
     // build credential expression
     if (empty($this->_credentialTreatment) || strpos($this->_credentialTreatment, "?") === false) {
         $this->_credentialTreatment = '?';
     }
     $credentialExpression = new Zend_Db_Expr($this->_zendDb->quoteInto($this->_zendDb->quoteIdentifier($this->_credentialColumn) . ' = ' . $this->_credentialTreatment, $this->_credential) . ' AS zend_auth_credential_match');
     // get select
     /*$dbSelect = $this->_zendDb->select();
       $dbSelect->from($this->_tableName, array('*', $credentialExpression))
                ->where($this->_zendDb->quoteIdentifier($this->_identityColumn) . ' = ?', $this->_identity);*/
     // query for the identity
     try {
         //$resultIdentities = $this->_zendDb->fetchAll($dbSelect->__toString());
         //$resultIdentities = $this->_zendDb->fetchAll('Select kud.id, kud.packageId, ku.guid, ku.username, ku.password, ku.picture from '.$this->_tableName.' ku INNER JOIN KutuUserDetail kud ON ku.guid=kud.uid where ku.'.$this->_identityColumn. "='" .$this->_identity."' AND kud.isActive=1 ORDER BY kud.id DESC");
         $resultIdentities = $this->_zendDb->fetchAll('Select guid, kopel, username, password, packageId, picture, isContact from ' . $this->_tableName . ' where ' . $this->_identityColumn . "='" . $this->_identity . "' AND isActive=1");
     } catch (Exception $e) {
         /**
          * @see Zend_Auth_Adapter_Exception
          */
         require_once 'Zend/Auth/Adapter/Exception.php';
         throw new Zend_Auth_Adapter_Exception('The supplied parameters to Zend_Auth_Adapter_DbTable failed to ' . 'produce a valid sql statement, please check table and column names ' . 'for validity.');
     }
     if (count($resultIdentities) < 1) {
         $authResult['code'] = Zend_Auth_Result::FAILURE_IDENTITY_NOT_FOUND;
         $authResult['messages'][] = 'A record with the supplied identity could not be found or Not active.';
         return new Zend_Auth_Result($authResult['code'], $authResult['identity'], $authResult['messages']);
     }
     //        elseif (count($resultIdentities) > 1) {
     //            $authResult['code'] = Zend_Auth_Result::FAILURE_IDENTITY_AMBIGUOUS;
     //            $authResult['messages'][] = 'More than one record matches the supplied identity.';
     //            return new Zend_Auth_Result($authResult['code'], $authResult['identity'], $authResult['messages']);
     //        }
     $resultIdentity = $resultIdentities[0];
     $obj = new Pandamp_Crypt_Password();
     //        print_r(strtoupper(sha1($this->_credential)) ."==". $resultIdentity[$this->_credentialColumn]);exit();
     if (strtoupper(sha1($this->_credential)) == $resultIdentity[$this->_credentialColumn]) {
         $resultIdentity[$this->_credentialColumn] = $obj->encryptPassword($this->_credential);
         $this->_zendDb->update($this->_tableName, $resultIdentity, $this->_identityColumn . "='" . $this->_identity . "'");
         $authResult['code'] = -51;
         //Zend_Auth_Result::FAILURE_UNCATEGORIZED;
         $authResult['messages'][] = 'You account has been updated, please click [Sign in] again';
         return new Zend_Auth_Result($authResult['code'], $authResult['identity'], $authResult['messages']);
     }
     //if(!$this->_httpClient)
     if (true) {
         //if ($resultIdentity['zend_auth_credential_match'] != '1') {
         if (!$obj->matchPassword($this->_credential, $resultIdentity[$this->_credentialColumn])) {
             $authResult['code'] = Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID;
             $authResult['messages'][] = 'Supplied credential is invalid.';
             return new Zend_Auth_Result($authResult['code'], $authResult['identity'], $authResult['messages']);
         }
     }
     unset($resultIdentity['zend_auth_credential_match']);
     $this->_resultRow = $resultIdentity;
     if (false) {
         $authResult['code'] = -51;
         //Zend_Auth_Result::FAILURE_UNCATEGORIZED;
         $authResult['messages'][] = 'You already login';
         return new Zend_Auth_Result($authResult['code'], $authResult['identity'], $authResult['messages']);
     }
     $authResult['code'] = Zend_Auth_Result::SUCCESS;
     $authResult['messages'][] = 'Authentication successful.';
     return new Zend_Auth_Result($authResult['code'], $authResult['identity'], $authResult['messages']);
 }
예제 #8
0
 function signupAction()
 {
     $this->_helper->layout->setLayout('layout-hukumonlineid-daftar');
     $r = $this->getRequest();
     if ($r->isPost()) {
         $id = $r->getParam('id') ? $r->getParam('id') : '';
         $promotionCode = $r->getParam('promotionCode') ? $r->getParam('promotionCode') : '';
         $package = $r->getParam('paket') ? $r->getParam('paket') : '';
         $fullName = $r->getParam('fullName') ? $r->getParam('fullName') : '';
         $gender = $r->getParam('chkGender') ? $r->getParam('chkGender') : '';
         $month = $r->getParam('month') ? $r->getParam('month') : '';
         $day = $r->getParam('day') ? $r->getParam('day') : '';
         $year = $r->getParam('year') ? $r->getParam('year') : '';
         $education = $r->getParam('education') ? $r->getParam('education') : '';
         $expense = $r->getParam('expense') ? $r->getParam('expense') : '';
         $company = $r->getParam('company') ? $r->getParam('company') : '';
         $businessType = $r->getParam('businessType') ? $r->getParam('businessType') : '';
         $phone = $r->getParam('phone') ? $r->getParam('phone') : '';
         $fax = $r->getParam('fax') ? $r->getParam('fax') : '';
         $payment = $r->getParam('payment') ? $r->getParam('payment') : '';
         $email = $r->getParam('email') ? $r->getParam('email') : '';
         $newArtikel = $r->getParam('newArtikel') ? $r->getParam('newArtikel') : '';
         $newRegulation = $r->getParam('newRegulation') ? $r->getParam('newRegulation') : '';
         $newWRegulation = $r->getParam('newWeeklyRegulation') ? $r->getParam('newWeeklyRegulation') : '';
         $iscontact = $r->getParam('iscontact') ? $r->getParam('iscontact') : '';
         $obj = new Pandamp_Crypt_Password();
         $formater = new Pandamp_Core_Hol_User();
         $aclMan = Pandamp_Acl::manager();
         try {
             for ($x = 1; $x <= $id; $x++) {
                 $username = $r->getParam('username' . $x) ? $r->getParam('username' . $x) : '';
                 $password = $r->getParam('password' . $x) ? $r->getParam('password' . $x) : '';
                 $tblUser = new Pandamp_Modules_Identity_User_Model_User();
                 Zend_Db_Table::getDefaultAdapter()->beginTransaction();
                 $rowUser = $tblUser->fetchNew();
                 $rowUser->username = $username;
                 $rowUser->password = $obj->encryptPassword($password);
                 $rowUser->fullName = $fullName;
                 $rowUser->gender = $gender == 1 ? 'L' : 'P';
                 $rowUser->birthday = $year . '-' . $month . '-' . $day;
                 $rowUser->indexCol = $x;
                 $rowUser->phone = $phone;
                 $rowUser->fax = $fax;
                 $rowUser->email = $email;
                 $rowUser->company = $company;
                 $rowUser->newArticle = $newArtikel == 1 ? 'Y' : 'N';
                 $rowUser->weeklyList = $newWRegulation == "1" ? 'Y' : 'N';
                 $rowUser->monthlyList = $newRegulation == 1 ? 'Y' : 'N';
                 $rowUser->isContact = $iscontact == $x ? 'Y' : 'N';
                 $rowUser->packageId = $package;
                 $rowUser->promotionId = $promotionCode;
                 $rowUser->educationId = $education;
                 $rowUser->expenseId = $expense;
                 $rowUser->paymentId = $payment;
                 $rowUser->businessTypeId = $businessType;
                 $tblNumber = new Pandamp_Modules_Misc_Number_Model_GenerateNumber();
                 $rowset = $tblNumber->fetchRow();
                 $num = $rowset->user;
                 $totdigit = 5;
                 $num = strval($num);
                 $jumdigit = strlen($num);
                 $noinvoice = str_repeat("0", $totdigit - $jumdigit) . $num;
                 $rowset->user = $rowset->user += 1;
                 $tblNumber->update(array('user' => $rowset->user));
                 $rowUser->kopel = $noinvoice;
                 $rowUser->save();
                 Zend_Db_Table::getDefaultAdapter()->commit();
                 $aclMan->addUser($username, 'member_gratis');
             }
             switch ($package) {
                 case 25:
                     $mailcontent = $formater->getMailContent('konfirmasi email gratis');
                     $m = $formater->_writeConfirmFreeEmail($mailcontent, $fullName, $r->getParam('username1'), $r->getParam('password1'), base64_encode(Pandamp_Lib_Formater::get_user_id($r->getParam('username1'))), $email, 'gratis');
                     break;
                 case 26:
                     $disc = $formater->checkPromoValidation('Disc', $aclMan->getGroupIds('member_individual'), $promotionCode, $payment);
                     $total = $formater->checkPromoValidation('Total', $aclMan->getGroupIds('member_individual'), $promotionCode, $payment);
                     $mailcontent = $formater->getMailContent('konfirmasi-email-individual');
                     $m = $formater->_writeConfirmIndividualEmail($mailcontent, $fullName, $r->getParam('username1'), $r->getParam('password1'), $payment, $disc, $total, base64_encode(Pandamp_Lib_Formater::get_user_id($r->getParam('username1'))), $email);
                     break;
                 case 27:
                     $disc = $formater->checkPromoValidation('Disc', $aclMan->getGroupIds('member_corporate'), $promotionCode, $payment);
                     $total = $formater->checkPromoValidation('Total', $aclMan->getGroupIds('member_corporate'), $promotionCode, $payment);
                     $mailcontent = $formater->getMailContent('konfirmasi-email-korporasi');
                     $m = $formater->_writeConfirmCorporateEmail($mailcontent, $fullName, $company, $payment, $disc, $total, $r->getParam('username1'), base64_encode(Pandamp_Lib_Formater::get_user_id($r->getParam('username1'))), $email);
                     break;
             }
             $this->view->message = $m;
         } catch (Zend_Exception $e) {
             Zend_Db_Table::getDefaultAdapter()->rollBack();
             $this->view->message = $e->getMessage();
         }
     }
 }