function delete($id)
 {
     $service = $this->Service->find('all', array('conditions' => array('category_id' => $id, 'Service.history_status' => 1)));
     if (empty($service)) {
         $data = $this->Category->read(null, $id);
         if ($this->Category->delete($id)) {
             unset($data['Category']['id']);
             $data['Category']['history_status'] = 2;
             $data['Category']['name'] = $data['Category']['name'] . '-bk' . substr(md5(microtime()), rand(0, 26), 5);
             $this->Category->create();
             if ($this->Category->save($data)) {
                 $history['History']['plugin'] = 'accounting';
                 $history['History']['controller'] = 'Categories';
                 $history['History']['action'] = 'view';
                 $history['History']['history_id'] = $this->Category->id;
                 $history['History']['action_status'] = __('Delete');
                 $history['History']['user_modified'] = $this->Session->read('Auth.User.id');
                 $history['History']['date_modified'] = gmdate('Y-m-d H:i:s');
                 $this->History->save($history);
             } else {
                 prd($this->Category->validationErrors);
             }
             $this->Session->setFlash('The category with id: ' . $id . ' has been deleted.');
             $this->redirect(array('action' => 'index'));
         }
     } else {
         $this->Session->setFlash('The category has service belonging to that.');
         $this->redirect(array('action' => 'index'));
     }
 }
Exemple #2
0
 public function SavePost($dataForm)
 {
     //echo "hello"; exit();
     global $mySession;
     $db = new Db();
     prd($dataForm);
     $db->save(BLOG_POST, $dataForm);
     return 1;
 }
Exemple #3
0
 function getTagcontent($tag, $msg)
 {
     $tagstart = preg_quote("{" . $tag . "}", "%");
     $tagend = preg_quote("{/" . $tag . "}", "5");
     $expression = "/(?<=" . $tagstart . ")(.*)*(?=" . $tagend . ")/msU";
     $expression = "(?<=" . $tagstart . ")(.*)(?=" . $tagend . ")";
     preg_match_all("%" . $expression . "%msU", $msg, $matches);
     if (isset($matches[0]) && isset($matches[0][0])) {
         return $matches[0][0];
     } else {
         return "";
     }
     prd($matches);
 }
 /**
  * Index method
  *
  * @return void
  */
 public function index()
 {
     $event = $this->Events->newEntity();
     if ($this->request->is('post')) {
         $user = $this->Events->patchEntity($event, $this->request->data);
         prd($user);
     }
     /* $eventTable = TableRegistry::get('Events');
        $events = $eventTable->newEntity();
        if($this->request->is('post')) {
         $eventTable->save($this->request->data);  
        }*/
     $this->set(compact('event'));
     $this->set('_serialize', ['event']);
 }
 public function edit($id = null)
 {
     $this->Company->id = $id;
     if (!$this->Company->exists()) {
         throw new NotFoundException(__('Invalid company'));
     }
     $data = $this->Company->read();
     if ($this->request->is('post') || $this->request->is('put')) {
         $diff = array_diff($this->request->data['Company'], $data['Company']);
         if (!empty($diff)) {
             $this->request->data['Company']['history_link'] = 0;
         }
         // prd($diff);
         if (isset($this->request->data['Company']['logo'])) {
             if (isset($this->request->data['full_file_name'])) {
                 $file = new File(UPLOAD_PATH . DS . $this->request->data['full_file_name']);
                 if ($file->exists()) {
                     $file->delete();
                 }
             }
             $this->request->data['Company']['logo'] = json_encode($this->request->data['Company']['logo']);
         }
         if (isset($this->request->data['delete_file']) && !isset($this->request->data['Company']['logo'])) {
             $file = new File(UPLOAD_PATH . DS . $this->request->data['full_file_name']);
             if ($file->exists()) {
                 $file->delete();
             }
             $this->request->data['Company']['logo'] = '[]';
         }
         if ($this->Company->save($this->request->data)) {
             //save history
             if (!empty($diff)) {
                 //update ratecard
                 $status = '';
                 if (in_array('ratecard_id', array_keys($diff))) {
                     $status .= __('Change ratecard');
                     //save old ratecard
                     $old_ratecard = $this->Ratecard->read(null, $data['Company']['ratecard_id']);
                     $old_ratecard_client = json_decode($old_ratecard['Ratecard']['clients'], true);
                     if (!empty($old_ratecard_client)) {
                         if (isset($old_ratecard_client[array_search($id, $old_ratecard_client)])) {
                             unset($old_ratecard_client[array_search($id, $old_ratecard_client)]);
                         }
                     }
                     $old_ratecard['Ratecard']['clients'] = json_encode(array_values($old_ratecard_client));
                     $this->Ratecard->save($old_ratecard);
                     //save new ratecard
                     $new_ratecard = $this->Ratecard->read(null, $this->request->data['Company']['ratecard_id']);
                     $new_ratecard_client = json_decode($new_ratecard['Ratecard']['clients'], true);
                     $new_ratecard_client[] = $id;
                     $new_ratecard['Ratecard']['clients'] = json_encode($new_ratecard_client);
                     $this->Ratecard->save($new_ratecard);
                 }
                 if (in_array('contact_number', array_keys($diff))) {
                     $status .= empty($status) ? __('Change contact no') : ', ' . __('Change contact no');
                 }
                 if (in_array('website', array_keys($diff))) {
                     $status .= empty($status) ? __('Change website') : ', ' . __('Change website');
                 }
                 if (empty($status)) {
                     $status = __('Change info');
                 }
                 unset($data['Company']['id']);
                 $data['Company']['history_status'] = 2;
                 $data['Company']['history_link'] = $id;
                 $data['Company']['name'] = $data['Company']['name'] . '-bk' . substr(md5(microtime()), rand(0, 26), 5);
                 $this->Company->create();
                 $this->Company->disablePermissionable('Company');
                 if ($this->Company->save($data)) {
                     $history['History']['plugin'] = 'company';
                     $history['History']['controller'] = 'Companies';
                     $history['History']['action'] = 'view';
                     $history['History']['history_id'] = $this->Company->id;
                     $history['History']['action_status'] = $status;
                     $history['History']['original_id'] = $id;
                     $history['History']['user_modified'] = $this->Session->read('Auth.User.id');
                     $history['History']['date_modified'] = gmdate('Y-m-d H:i:s');
                     $this->History->save($history);
                 } else {
                     prd($this->Company->validationErrors);
                 }
             }
             $this->Session->setFlash(__('The company has been saved'));
             return $this->redirect(array('action' => 'index'));
         }
         $this->Session->setFlash(__('The company could not be saved. Please, try again.'));
     } else {
         $this->request->data = $data;
     }
 }
Exemple #6
0
 function edit()
 {
     global $mainframe, $Itemid;
     $mUser = $this->getModel('user');
     $tUser = $mUser->table;
     $userId = JRequest::getVar('userId', 0);
     $tUser->load($userId);
     DT_Session::set('register.Event.eventId', $tUser->eventId);
     $userObj = $tUser->getObjData();
     $user = DTrCommon::objectToArray($userObj);
     $user['process'] = 'change';
     if (isset($_POST['formsubmit'])) {
         $data = $_POST['User'];
         if (DT_Session::get('register.User.members')) {
             $memtot = DTrCommon::cntMemtotInSession(DT_Session::get('register.User.members'));
         } else {
             $memtot = DT_Session::get('register.User.memtot');
         }
         $user['fields'] = $_POST['Field'];
         $user['memtot'] = $memtot;
         if (DT_Session::get('register.User.members')) {
             $temp = array();
             foreach (DT_Session::get('register.User.members') as $key => $member) {
                 if (isset($member['remove']) && $member['remove']) {
                 } else {
                     $temp[$key] = $member;
                 }
             }
             $user['members'] = $temp;
         }
         DT_Session::set('register.User', $user);
         DT_Session::set('register.User.process', 'change');
         //unset($_SESSION['DTregister']['register']['members']);
         $mainframe->redirect("index.php?option=com_dtregister&Itemid=" . $Itemid . "&controller=user&task=confirm");
         pr($_POST);
         prd($user);
     } else {
         if (!DT_Session::get('register.User')) {
             DT_Session::set('register.User', $user);
             DT_Session::set('register.Event.eventId', $tUser->eventId);
         }
     }
     $eventId = $tUser->eventId;
     $this->view->assign('header_eventId', $eventId);
     // pr(DTrCommon::objectToArray($userObj));
     // pr($user);
     $type = $tUser->type == 'I' ? 'I' : 'B';
     $tUser->TableEvent->duplicate_check = false;
     $this->view->assign('form', $tUser->TableEvent->form($type, (array) $tUser, false, 'frmcart', true));
     $tUser->TableEvent->load($eventId);
     $this->view->assign('tEvent', $tUser->TableEvent);
     $this->view->assign('mUser', $mUser);
     $this->display();
 }
 public function delete($id)
 {
     $this->Quotation->id = $id;
     $data = $this->Quotation->read();
     if ($data['Quotation']['status'] != '6') {
         $this->Session->setFlash(__('Only deleted expired cost estimate'));
         return $this->redirect(array('action' => 'index'));
     } else {
         if ($this->Quotation->delete($id)) {
             unset($data['Quotation']['id']);
             $data['Quotation']['history_status'] = 2;
             $data['Quotation']['estimate_number'] = $data['Quotation']['estimate_number'] . '-bk' . substr(md5(microtime()), rand(0, 26), 5);
             $this->Quotation->create();
             if ($this->Quotation->saveAll($data)) {
                 $history['History']['plugin'] = 'accounting';
                 $history['History']['controller'] = 'Quotations';
                 $history['History']['action'] = 'view';
                 $history['History']['history_id'] = $this->Quotation->id;
                 $history['History']['action_status'] = __('Delete');
                 $history['History']['user_modified'] = $this->Session->read('Auth.User.id');
                 $history['History']['date_modified'] = gmdate('Y-m-d H:i:s');
                 $this->History->save($history);
             } else {
                 prd($this->Quotation->validationErrors);
             }
             $this->Session->setFlash(__('Quotation deleted'));
             return $this->redirect(array('action' => 'index'));
         }
     }
 }
Exemple #8
0
 function add()
 {
     global $mainframe, $Itemid, $now;
     $userId = JRequest::getVar('userId', 0);
     $mMember = $this->getModel('member');
     $tMember = $mMember->table;
     $tUser = $this->getModel('user')->table;
     $tUser->load($userId);
     $tEvt = $this->getModel('event')->table;
     $tEvt->load($tUser->eventId);
     $eventId = $tUser->eventId;
     $memtot = DT_Session::get('register.User.memtot');
     if ($memtot >= $tEvt->max_group_size) {
         $mainframe->redirect("index.php?option=com_dtregister&controller=member&userId=" . $userId . "&Itemid=" . $Itemid, JText::_('DT_MAX_GROUP_SIZE_REACHED'));
     }
     if (isset($_POST['formsubmit'])) {
         $min = $tEvt->min_group_size == "" ? 2 : $tEvt->min_group_size;
         $data = $_POST['Member'];
         $data['fields'] = JRequest::getVar('Field', array(), null, 'array');
         $data['created'] = $now->toMySQL();
         $members = DT_Session::get('register.User.members');
         $members[] = $data;
         DT_Session::set('register.User.members', $members);
         $memtot = DT_Session::get('register.User.memtot');
         $memtot++;
         DT_Session::set('register.User.memtot', $memtot);
         $mainframe->redirect("index.php?option=com_dtregister&controller=member&userId=" . $userId . "&Itemid=" . $Itemid);
         pr($tUser->TableFee);
         prd($fee);
         die;
     }
     $type = 'M';
     $this->view->assign('header_eventId', $eventId);
     $this->view->assign('form', $tUser->TableEvent->form($type, array(), false, 'frmcart', false));
     $this->view->assign('userId', $userId);
     $this->display();
 }
 function process()
 {
     $this->setFields();
     $fields = $this->formatfields();
     $this->url;
     $ch = curl_init($this->url);
     if ($this->godaddy_hosting) {
         curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
         curl_setopt($ch, CURLOPT_PROXY, "http://proxy.shr.secureserver.net:3128");
     }
     curl_setopt($ch, CURLOPT_HEADER, 0);
     // set to 0 to eliminate header info from response
     //curl_setopt($ch, CURLOPT_VERBOSE, 1);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     // Returns response data instead of TRUE(1)
     curl_setopt($ch, CURLOPT_POSTFIELDS, rtrim($fields, "& "));
     // use HTTP POST to send form data
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
     // uncomment this line if you get no gateway response. ###
     $resp = curl_exec($ch);
     //execute post and get results
     $this->response = $resp;
     $this->parseResponse();
     if ($this->responseParts[0] == 1) {
         $this->transactionId = $this->responseParts[6];
         DT_Session::set('register.payment.transactionId', $this->transactionId);
         return true;
     } else {
         $res = $this->responseParts;
         switch ($res[0]) {
             case 1:
                 $this->errorMsg = JText::_('DT_PAYMENT_SUCCESSFUL') . '<br />';
                 $this->errorMsg .= JText::_('DT_AUTHORIZATION_CODE') . ': ' . $res[4] . '<br />';
                 $this->errorMsg .= JText::_('DT_AMOUNT') . ': ' . $res[9] . '<br />';
                 $this->errorMsg .= JText::_('TRANS_ID') . ': ' . $res[6] . '<br />';
                 $this->errorMsg .= JText::_('DT_INVOICE_NUMBER') . ': ' . $res[7] . '<br /><br />';
                 break;
             case 2:
                 if ($res[2] == 2 || $res[2] == 4) {
                     $this->errorMsg = JText::_('DT_PAYMENT_DECLINED');
                     $this->errorMsg .= JText::_('DT_REASON') . ": " . $res[3] . "<br />";
                 }
                 break;
             case 3:
                 $this->errorMsg = $res[3];
                 echo JText::_('DT_REASON') . ": ";
                 switch ($res[2]) {
                     case 5:
                         $this->errorMsg = JText::_('DT_AMOUNT_NOT_VALID');
                         break;
                     case 6:
                     case 37:
                         $this->errorMsg = JText::_('DT_CARD_NUMBER_INVALID');
                         break;
                     case 7:
                         $this->errorMsg = JText::_('DT_EXP_DATE_INVALID');
                         break;
                     case 11:
                         $this->errorMsg = JText::_('DT_DUPLICATE_TRANSACTION');
                         break;
                     case 13:
                         $this->errorMsg = JText::_('DT_API_LOGIN_INVALID');
                         break;
                     case 17:
                     case 28:
                         $this->errorMsg = JText::_('DT_MERCHANT_NOT_CONFIGURED');
                         break;
                     case 19:
                     case 20:
                     case 21:
                     case 22:
                     case 23:
                     case 25:
                     case 26:
                     case 57:
                     case 58:
                     case 59:
                     case 60:
                     case 61:
                     case 62:
                     case 63:
                         $this->errorMsg = JText::_('DT_ERROR_OCCURRED');
                         $this->errorMsg .= '<a href="' . JRoute::_('index.php?option=com_dtregister&Itemid=' . $Itemid, $xhtml_url) . '">' . JText::_('DT_CLICK_HERE') . '</a>';
                         break;
                     case 27:
                         $this->errorMsg = JText::_('DT_AUTH_AVS_MISMATCH');
                         break;
                     case 34:
                     case 35:
                     case 38:
                     case 43:
                         $this->errorMsg = JText::_('DT_AUTH_MERCH_SETUP_PROCESSOR');
                         break;
                     case 49:
                         $this->errorMsg = JText::_('DT_AUTH_MAX_ALLOWED');
                         break;
                     case 50:
                         $this->errorMsg = JText::_('DT_AUTH_TRANS_SETTLE_REFUNDED');
                         break;
                     case 54:
                         $this->errorMsg = JText::_('DT_AUTH_REF_TRANS');
                         break;
                     case 55:
                         $this->errorMsg = JText::_('DT_AUTH_SUM_CREDIT_REF_TRANS');
                         break;
                     case 56:
                         $this->errorMsg = JText::_('DT_AUTH_ECHECK_ONLY');
                         break;
                     case 66:
                         $this->errorMsg = JText::_('DT_AUTH_SECURITY_GUIDELINES');
                         break;
                     case 68:
                         $this->errorMsg = JText::_('DT_AUTH_XVERSION_INVALID');
                         break;
                     case 69:
                         $this->errorMsg = JText::_('DT_AUTH_XTYPE_INVALID');
                         break;
                     case 78:
                         $this->errorMsg = JText::_('DT_AUTH_XCARD_FAILED');
                         break;
                 }
                 break;
         }
         switch ($res[38]) {
             case 'N':
                 $this->errorMsg = JText::_('DT_AUTH_CC_CODE_MISMATCH');
                 break;
             case 'P':
                 $this->errorMsg = JText::_('DT_AUTH_CC_NOT_PROCESSED');
                 break;
             case 'S':
                 $this->errorMsg = JText::_('DT_AUTH_CC_CODE_NOT_PRESENT');
                 break;
             case 'U':
                 $this->errorMsg = JText::_('DT_AUTH_ISSUER_NOT_PROCESS');
                 break;
         }
         echo $this->errorMsg;
         return false;
     }
     prd($resp);
 }
 function testcontroller()
 {
     // is_anyregistration  is fine .
     $eventTable = $this->getModel('event')->table;
     $eventTable->load(101);
     $oldrepetitions = $eventTable->getrepetions();
     $data = array('data' => array('event' => array('user_id' => '', 'title' => 'Testing Still', 'category' => '', 'location_id' => '', 'publish' => '0', 'timeformat' => '1', 'dtstart' => '2011-03-31', 'dtstarttime' => '09:28 PM', 'dtend' => '2011-03-31', 'dtendtime' => '10:28 PM', 'email' => '*****@*****.**', 'repeatType' => 'weekly', 'rpinterval' => '1', 'countselector' => 'count', 'rpcount' => '3', 'rpuntil' => '', 'weekdays' => array(0 => '3'), 'monthdays' => '', 'monthdayselector' => 'monthweekdays', 'registration_type' => 'individual', 'group_registration_type' => 'detail', 'public' => '1', 'max_registrations' => '0', 'min_group_size' => '2', 'max_group_size' => '0', 'startdate' => '0000-00-00', 'starttime' => '12:00 AM', 'cut_off_date' => '0000-00-00', 'cut_off_time' => '12:00 AM', 'waiting_list' => '0', 'article_id' => '', 'detail_itemid' => '0', 'detail_link_show' => '0', 'show_registrant' => '0', 'prevent_duplication' => '1', 'usetimecheck' => '0', 'excludeoverlap' => '0', 'usercreation' => '0', 'imagepath' => '', 'payment_id' => '1', 'partial_payment' => '0', 'partial_amount' => '', 'partial_minimum_amount' => '', 'tax_enable' => '0', 'tax_amount' => '0.00', 'discount_type' => '0', 'discount_amount' => '0.00', 'bird_discount_type' => '0', 'bird_discount_amount' => '', 'bird_discount_date' => '0000-00-00', 'bird_discount_time' => '12:00 AM', 'latefee' => '0.00', 'latefeedate' => '0000-00-00', 'latefeetime' => '12:00 AM', 'use_discountcode' => '0', 'topmsg' => '', 'event_describe_set' => '0', 'event_describe' => '', 'thanksmsg_set' => '0', 'thanksmsg' => '', 'pay_later_thk_msg_set' => '0', 'pay_later_thk_msg' => '', 'terms_conditions_set' => '0', 'terms_conditions_msg' => '', 'thksmsg_set' => '0', 'thksmsg' => '', 'admin_notification_set' => '0', 'admin_notification' => '', 'partial_payment_enable' => '0', 'cancel_refund_status' => '0', 'edit_fee' => '0', 'change_date' => '', 'change_time' => '12:00 AM', 'cancel_enable' => '0', 'cancel_date' => '', 'cancel_time' => '12:00 AM', 'changefee_enable' => '0', 'changefee_type' => '1', 'changefee' => '0.00', 'cancelfee_enable' => '0', 'cancelfee_type' => '1', 'cancelfee' => '0.00', 'slabId' => '101'), 'group' => array(0 => array('member' => '1', 'amount' => '0.00'), 1 => array('member' => '0', 'type' => 'per_person', 'amount' => '0.00'), 2 => array('member' => '0', 'type' => 'per_person', 'amount' => '0.00'), 3 => array('member' => '0', 'type' => 'per_person', 'amount' => '0.00'), 4 => array('member' => '0', 'type' => 'per_person', 'amount' => '0.00'), 5 => array('member' => '0', 'type' => 'per_person', 'amount' => '0.00'), 6 => array('member' => '0', 'type' => 'per_person', 'amount' => '0.00'), 7 => array('member' => '0', 'type' => 'per_person', 'amount' => '0.00'), 8 => array('member' => '0', 'type' => 'per_person', 'amount' => '0.00'), 9 => array('member' => '0', 'type' => 'per_person', 'amount' => '0.00'), 10 => array('member' => '0', 'type' => 'per_person', 'amount' => '0.00'), 11 => array('member' => '0', 'type' => 'per_person', 'amount' => '0.00'), 12 => array('member' => '0', 'type' => 'per_person', 'amount' => '0.00'), 13 => array('member' => '0', 'type' => 'per_person', 'amount' => '0.00'), 14 => array('member' => '0', 'type' => 'per_person', 'amount' => '0.00'), 15 => array('member' => '0', 'type' => 'per_person', 'amount' => '0.00'), 16 => array('member' => '0', 'type' => 'per_person', 'amount' => '0.00'), 17 => array('member' => '0', 'type' => 'per_person', 'amount' => '0.00'), 18 => array('member' => '0', 'type' => 'per_person', 'amount' => '0.00'), 19 => array('member' => '0', 'type' => 'per_person', 'amount' => '0.00'), 20 => array('member' => '0', 'type' => 'per_person', 'amount' => '0.00'), 21 => array('member' => '0', 'type' => 'per_person', 'amount' => '0.00'), 22 => array('member' => '0', 'type' => 'per_person', 'amount' => '0.00'), 23 => array('member' => '0', 'type' => 'per_person', 'amount' => '0.00'), 24 => array('member' => '0', 'type' => 'per_person', 'amount' => '0.00'), 25 => array('member' => '0', 'type' => 'per_person', 'amount' => '0.00'), 26 => array('member' => '0', 'type' => 'per_person', 'amount' => '0.00'), 27 => array('member' => '0', 'type' => 'per_person', 'amount' => '0.00'), 28 => array('member' => '0', 'type' => 'per_person', 'amount' => '0.00'), 29 => array('member' => '0', 'type' => 'per_person', 'amount' => '0.00'), 30 => array('member' => '0', 'type' => 'per_person', 'amount' => '0.00')), 'discountcode' => array(0 => '3', 1 => '4'), 'field' => array(1 => array('showed' => '-1', 'required' => '0', 'group_behave' => '2'), 2 => array('showed' => '-1', 'required' => '1', 'group_behave' => '3'), 3 => array('showed' => '-1', 'required' => '1', 'group_behave' => '3'), 13 => array('showed' => '-1', 'required' => '1', 'group_behave' => '1'), 12 => array('showed' => '-1', 'required' => '1', 'group_behave' => '1'), 4 => array('showed' => '-1', 'required' => '0', 'group_behave' => '1'), 5 => array('showed' => '-1', 'required' => '0', 'group_behave' => '1'), 6 => array('showed' => '-1', 'required' => '1', 'group_behave' => '3'), 7 => array('showed' => '-1', 'required' => '0', 'group_behave' => '3'), 8 => array('showed' => '-1', 'required' => '0', 'group_behave' => '1'), 9 => array('showed' => '-1', 'required' => '0', 'group_behave' => '2'), 10 => array('showed' => '-1', 'required' => '1', 'group_behave' => '3'), 11 => array('showed' => '-1', 'required' => '0', 'group_behave' => '3'), 21 => array('showed' => '-1', 'required' => '0'), 20 => array('showed' => '-1', 'required' => '0', 'group_behave' => '1'), 17 => array('showed' => '-1', 'required' => '0', 'group_behave' => '1'), 27 => array('showed' => '-1', 'required' => '0', 'group_behave' => '1'), 32 => array('showed' => '-1', 'required' => '0', 'group_behave' => '1'), 33 => array('showed' => '-1', 'required' => '0', 'group_behave' => '1'), 34 => array('showed' => '-1', 'required' => '0', 'group_behave' => '2'), 42 => array('showed' => '-1', 'required' => '0'), 38 => array('showed' => '-1', 'required' => '0', 'group_behave' => '1'))), 'articlesection' => '', 'articlecategory' => '', 'option' => 'com_dtregister', 'controller' => 'event', 'task' => 'save');
     $data = $data['data'];
     prd($eventTable->validDateChange($data));
     //$this->validDateChange();
     //prd($eventTable->is_anyregistration($oldrepetitions));
 }
Exemple #11
0
 function add()
 {
     global $mainframe;
     $userId = JRequest::getVar('userId', 0);
     $mMember = $this->getModel('member');
     $tMember = $mMember->table;
     $tUser = $this->getModel('user')->table;
     if (isset($_POST['formsubmit'])) {
         $data = $_POST['Member'];
         $data['fields'] = JRequest::getVar('Field', array(), null, 'array');
         $tMember->save($data);
         $tUser->load($userId);
         $tUser->memtot++;
         $tUser->save_field('memtot', $tUser->memtot);
         $fee = $tUser->calculateFee();
         $fee->paid_amount = $tUser->TableFee->paid_amount;
         $tUser->TableFee->save((array) $fee);
         $mainframe->redirect("index.php?option=com_dtregister&controller=member&userId=" . $userId);
         pr($tUser->TableFee);
         prd($fee);
         die;
     }
     $tUser->load($userId);
     $type = 'M';
     JToolBarHelper::save('add', JText::_('DT_SAVE'));
     JToolBarHelper::divider();
     JToolBarHelper::cancel('cancel', JText::_('DT_CLOSE'));
     $this->view->assign('form', $tUser->TableEvent->form($type, array(), false, 'adminForm', false));
     $this->view->assign('userId', $userId);
     $this->display();
 }
 function saveorder()
 {
     global $mainframe, $Itemid;
     $row = $this->getModel('event')->table;
     $cid = JRequest::getVar('cid', array(0), 'request', 'array');
     $order = JRequest::getVar('order', array(0), '', 'array');
     $total = count($cid);
     pr($order);
     if (is_array($order)) {
         foreach ($order as $slabId => $ordering) {
             $row->load($slabId);
             if ($row->ordering != $ordering && $row->parent_id == 0) {
                 $row->ordering = $ordering;
                 // prd($row->store());
                 unset($row->repetition);
                 $row->store();
                 if ($row->getError() != "") {
                     JError::raiseError(500, $row->getError());
                     prd($row);
                     exit;
                 }
             }
         }
     }
     $mainframe->redirect("index.php?option=" . DTR_COM_COMPONENT . "&controller=eventmanage&Itemid={$Itemid}");
 }
Exemple #13
0
 function afterpayment()
 {
     prd($_REQUEST);
     $this->transactionId = $_REQUEST['ewayTrxnReference'];
     DT_Session::set('register.payment.transactionId', $this->transactionId);
     $this->confirmNum = $_SESSION['register']['billingInfo']['confirmNum'];
     unset($_SESSION['register']['billingInfo']['confirmNum']);
 }
 public function printreceiptAction()
 {
     $this->_helper->layout->disableLayout();
     error_reporting(0);
     $orderId = $this->_getParam("order");
     $ordersMapper = new Application_Model_OrdersMapper();
     $orderDetail = $ordersMapper->getOrderById($orderId);
     $orderItemsMapper = new Application_Model_OrderItemsMapper();
     $orderItems = $orderItemsMapper->getOrderItemByOrderId($orderId);
     prd($orderDetail);
     if (empty($orderDetail)) {
         echo "Order Not Found";
         die;
     }
     $arr = array('one', 'two', 'three', 'four', 'five');
     $html = "<div style='background:red;color:black;'>";
     foreach ($arr as $value) {
         $html .= $value . '<br />';
     }
     $html .= "</div>";
     echo $html;
     prd($orderDetail);
     ///$this->view->orderDetail = $orderDetail;
     // $this->view->orderItems = $orderItems;
     exit;
 }
 public function forgetPassword($name, $email, $link)
 {
     $mail_content = $this->getMailContent('FORGOT_PASSWORD');
     if (is_array($mail_content) && !empty($mail_content)) {
         $UserName = ucwords($name);
         $UserEmail = strtolower($email);
         $mail_refined_content = $mail_content['message'];
         $mail_refined_content = str_replace('{{receiver}}', $UserName, $mail_refined_content);
         $mail_refined_content = str_replace('{{email}}', $UserEmail, $mail_refined_content);
         $mail_refined_content = str_replace('{{link}}', $link, $mail_refined_content);
         // prd($mail_refined_content);
         // $admin_email = strtolower(Configure::read('Site.email'));
         App::uses('CakeEmail', 'Network/Email');
         $cake_email = new CakeEmail();
         $cake_email->config('smtp');
         $cake_email->to($UserEmail);
         $cake_email->from(array('*****@*****.**' => 'Meocart'));
         $cake_email->replyTo("*****@*****.**", "Meocart Team");
         $cake_email->subject($mail_content['subject']);
         $cake_email->template('default', 'default');
         $cake_email->emailFormat('html');
         $cake_email->viewVars(array('content' => $mail_refined_content));
         try {
             $cake_email->send();
         } catch (Exception $e) {
             return false;
         }
         return true;
     }
     if (is_array($emailData) && !empty($emailData)) {
         $from = Configure::read('Site.email');
         $title = trim($emailData['title']);
         $subject = trim($emailData['subject']);
         $message = trim($emailData['message']);
         $myLink = '<a class="" href="' . $link . '">' . $emailData['link_title'] . '</a>';
         //$myLink=$this->mailButtion($link,$mail_content['link_title']);
         $dummy_arg = array("{{receiver}}", "{{link}}");
         $real_arg = array($name, $myLink);
         $newmessage = str_replace($dummy_arg, $real_arg, $message);
         if (Configure::read('Site.is_development_mode')) {
             prd($newmessage);
         }
         $response = $this->__SendMail($email, $subject, $newmessage, $from);
         return $response;
         //$mail_refined_content = str_replace('{{receiver}}',$name,$message);
         //$mail_refined_content = str_replace('{{link}}',$myLink,$message);
         //$this->__SendMail($email,$subject,$mail_refined_content,$from,$mail_content['id']);
     }
 }
Exemple #16
0
 function clear($path)
 {
     $session =& JFactory::getSession();
     $DTregister =& $session->get('DTH', 'null', 'dtregister');
     $namespace = "__default";
     if ($path != "") {
         $pathElements = explode(".", $path);
         $pathdata = $DTregister;
         $str = "['__default']['DTH']";
         $str = "";
         if ($pathdata == "" || $pathdata == "null") {
             return;
         }
         foreach ($pathElements as $key => $e) {
             if (!isset($pathdata[$e])) {
                 //$eval = "unset(\$DTregister$str);";
                 //eval($eval);
                 return;
             }
             if ($pathdata[$e] === "") {
                 prd('good');
                 return;
             }
             $pathdata = $pathdata[$e];
             $str .= "['" . $e . "']";
         }
         // unset(${'DTregister'.$str});
         $eval = "unset(\$DTregister{$str});";
         eval($eval);
     } else {
         //pr('session cleared');
         //$session->clear('DTH','dtregisterdup');
     }
 }
Exemple #17
0
// pre($result);
// pre($result->getId());
// pre($result->getId(true));
// // // update
// $qb->update(['old' => 100])->where('id > ?', [30])->limit(1);
// $qb->update(['old' => 100])->where('id > ?', [30])->orderBy('id DESC')->limit(1);
// pre($qb->toString());
// pre($qb->execute());
// // delete
// $qb->delete()->where('id > ?', [30])->limit(1);
// $qb->delete()->where('id > ?', [30])->orderBy('id DESC')->limit(1);
// $qb->delete()->where('id > ?', [30])->orderBy('id', $qb::OP_DESC)->limit(1);
// $qb->delete()->whereBetween('id', [931,932])->limit(10);
// $qb->delete()->where('id in(?)', [[931,932]])->limit(10);
// pre($qb->toString());
// pre($qb->execute());
// $qb->select('id,name');
// $qb->whereLessThan('id', 30);
// $qb->whereGreaterThan('id', 20);
// $qb->whereLessThanEqual('id', 30, 'OR');
// $qb->whereGreaterThanEqual('id', 20);
// $qb->whereExists(
//     (new QueryBuilder($db->getLink(), 'foo'))
//         ->select('*')
//         ->where('y > ?')
//     , [10]);
// $qb->whereExists('select * from foo where y > ?', [10]);
// $qb->whereExists('select * from foo where y < ?', [20], 'OR');
prd($qb->toString());
pre($qb);
// pre($db);
 public function notify($id)
 {
     if ($this->request->is('post') || $this->request->is('put')) {
         if (isset($this->request->data['Ratecard']['client'])) {
             $subject = $this->Session->read('Sendmail_title');
             $this->Session->delete('Sendmail_title');
             if (empty($subject)) {
                 $subject = 'Update ratecard';
             }
             if ((int) $this->Session->read('id_ratecard_delete') > 0) {
                 $id = $this->Session->read('id_ratecard_delete');
                 $this->Ratecard->id = $id;
                 $data = $this->Ratecard->read(null, $id);
                 //delete session
                 $this->Session->delete('id_ratecard_delete');
                 if ($this->Ratecard->delete()) {
                     unset($data['Ratecard']['id']);
                     $data['Ratecard']['history_status'] = 2;
                     $data['Ratecard']['name'] = $data['Ratecard']['name'] . ' (bk' . substr(md5(microtime()), rand(0, 26), 5) . ')';
                     //print_r($data);die('aa');
                     $this->Ratecard->create();
                     if ($this->Ratecard->save($data)) {
                         $history['History']['plugin'] = 'accounting';
                         $history['History']['controller'] = 'Ratecards';
                         $history['History']['action'] = 'view';
                         $history['History']['history_id'] = $this->Ratecard->id;
                         $history['History']['action_status'] = __('Delete');
                         $history['History']['user_modified'] = $this->Session->read('Auth.User.id');
                         $history['History']['date_modified'] = gmdate('Y-m-d H:i:s');
                         $this->History->save($history);
                     } else {
                         prd($this->Ratecard->validationErrors);
                     }
                     $this->RatecardService->deleteAll(array('RatecardService.ratecard_id' => $id));
                     $default_card = $this->Ratecard->find('first', array('conditions' => array('Ratecard.id' => Configure::read('Settings.Company.DefaultRatecard'))));
                     $this->Company->updateAll(array('Company.ratecard_id' => Configure::read('Settings.Company.DefaultRatecard')), array('Company.ratecard_id' => $id));
                     $this->Session->setFlash(__('Ratecard deleted'));
                     $subject = 'Ratecard deleted';
                 }
             }
             $clients_email = $this->User->find('list', array('fields' => 'User.id, User.email', 'conditions' => array('User.id' => array_keys($this->request->data['Ratecard']['client']))));
             $arr_options = array('to' => $clients_email, 'subject' => $subject, 'viewVars' => array('content' => $this->request->data['Ratecard']['content_notify']));
             $this->_sendemail($arr_options);
         }
         return $this->redirect(array('action' => 'index'));
         // print_r($this->request->data);die;
     }
     $clients = $this->User->find('list', array('fields' => 'User.id, User.name', 'joins' => array(array('table' => 'company_companies', 'alias' => 'Company', 'type' => 'LEFT', 'conditions' => array('Company.id = User.company_id')), array('table' => 'accounting_ratecards', 'alias' => 'Ratecard', 'type' => 'LEFT', 'conditions' => array('Ratecard.id = Company.ratecard_id')), array('table' => 'accounting_ratecard_services', 'alias' => 'Ratecard_Service', 'type' => 'LEFT', 'conditions' => array('Ratecard.id = Ratecard_Service.ratecard_id')), array('table' => 'users_groups', 'alias' => 'UsersGroup', 'type' => 'LEFT', 'conditions' => array('UsersGroup.user_id = User.id'))), 'conditions' => array('Ratecard_Service.ratecard_id' => $id, 'User.active' => 1, 'UsersGroup.group_id' => (int) Configure::read('Settings.Company.DefaultGroupId')), 'group' => 'User.id', 'order' => array('User.name' => 'asc')));
     if (empty($clients)) {
         $this->Session->setFlash(__('Not Found Client'), 'warning');
         return $this->redirect(array('action' => 'index'));
     } else {
         $this->set('clients', $clients);
     }
 }
Exemple #19
0
<?php

include 'inc.php';
$autoload = (require __DIR__ . '/../src/Autoload.php');
$autoload->register();
use Oppa\Logger;
$logger = new Logger();
$logger->setLevel(Logger::ALL);
$logger->setDirectory(__DIR__ . '/../.logs');
$result = $logger->log(Logger::INFO, 'log...');
prd($result);
 function delete($id)
 {
     $links = $this->Enquiry->find('all', array('conditions' => array('marketing_advertising_links_id' => $id)));
     if (empty($links)) {
         $data = $this->AdvertisingLink->read(null, $id);
         $data['AdvertisingLink']['history_status'] = 2;
         $data['AdvertisingLink']['history_link'] = -1;
         if ($this->AdvertisingLink->save($data)) {
             $history['History']['plugin'] = 'marketing';
             $history['History']['controller'] = 'advertisingLinks';
             $history['History']['action'] = 'view';
             $history['History']['history_id'] = $id;
             $history['History']['action_status'] = __('Delete');
             $history['History']['user_modified'] = $this->Session->read('Auth.User.id');
             $history['History']['date_modified'] = gmdate('Y-m-d H:i:s');
             $this->History->save($history);
             $this->Session->setFlash('The advertising link with id: ' . $id . ' has been deleted.');
             $this->redirect(array('plugin' => 'marketing', 'controller' => 'advertisingLinks', 'action' => 'index'));
         } else {
             prd($this->AdvertisingLink->validationErrors);
         }
     } else {
         $this->Session->setFlash('There are enquiries associated with the Link.');
         $this->redirect(array('plugin' => 'marketing', 'controller' => 'advertisingLinks', 'action' => 'index'));
     }
 }
Exemple #21
0
 function get_user_ids()
 {
     $user_ids = $this->get_users_test();
     prd($user_ids);
     $where = "";
     if (count($user_ids)) {
         $where = " userId in (" . implode(",", $user_ids) . ") ";
     }
     $users = $this->TableUser->find($where);
     $members = $this->memberusers($user_ids);
     pr($users);
     prd($members);
     // $this->renamefields();
     // $this->waiting();
     $userdata = array();
     $usersRemoveData = array(0);
     /*
     if (is_array($users)) 
     foreach($users as $user){
         $userfield =  array();
     	$userfield['user_id'] = $user->userId;
     	
     	if (is_array($this->fieldmapByName)) 
     	foreach($this->fieldmapByName as $field_name => $field){
     	   if(isset($this->UserFldsTodefault[$field_name])){ // default field
     	 
     		    if(isset($user->{$this->UserFldsTodefault[$field_name]}) && $user->{$this->UserFldsTodefault[$field_name]} != "" ){
     		       $userfield['field_id'] = $field->id;
     		       $userfield['value'] = $user->{$this->UserFldsTodefault[$field_name]};
     			   $userdata[] = $userfield;
     			   $usersRemoveData[] = $user->userId ;
     	        }elseif(isset($user->{$field_name}) && $user->{$field_name} != ""){
     				
     			  $userfield['field_id'] = $field->id;
     				$userfield['value'] = $this->getFieldValue($field,$user->{$field_name});
     				$userdata[] = $userfield;
     				$usersRemoveData[] = $user->userId;
     				
     		    }
     		   
     	   }else{ //custom default field
     		    
     			if(isset($user->{$field_name}) && $user->{$field_name} != ""){
     			  $userfield['field_id'] = $field->id;
     				$userfield['value'] = $this->getFieldValue($field,$user->{$field_name});
     				$userdata[] = $userfield;
     				$usersRemoveData[] = $user->userId;
     				
     		    }
     			
     	   }
     	  	
     	}
     	
     }
     if(count($usersRemoveData)){
     	
     	$query = "delete from #__dtregister_user_field_values where user_id in (".implode(",",$usersRemoveData).") ";
     	$this->TableEvent->rawquery($query);
     	echo $this->TableEvent->_db->getErrorMsg();
     	
     }
     */
     //$this->TableUser->TableUserfield->truncate();
     // $this->TableUser->TableUserfield->saveAll_migration($userdata);
     // $this->updatememtot();
     // $this->updatestatus($user_ids);
     // $this->membertable($user_ids);
     // $this->fee($user_ids);
 }
Exemple #22
0
 public function actionCancel()
 {
     //The token of the cancelled payment typically used to cancel the payment within your application
     prd($_REQUEST);
     $token = $_GET['token'];
     $result = array('status' => 'cancel', 'token' => $token);
     $this->saveOrders(3, $result);
     Yii::app()->session['cartItems'] = array();
     Yii::app()->session['cartId'] = '';
     $this->redirect('cancel');
 }
Exemple #23
0
$Set->add('a');
prd($Set->toArray());
die;
require_once dirname(dirname(__FILE__)) . '/EventCache.php';
require_once dirname(dirname(__FILE__)) . '/EventCacheInst.php';
$E = new EventCacheInst(array('app' => 'testapp', 'trackEvents' => false, 'adapter' => 'EventCacheAdapterApc'));
#$E->flush();
//
//$E->delete('test');
//$lijst = $E->read('test');
//if (empty($lijst)) {
//	$lijst = array();
//}
//$lijst[] = 'test';
//$E->write('test', $lijst);
//prd($E->read('test'));
apc_clear_cache('user');
$E->delete('b');
$E->write('b', '1');
$E->delete('b');
$E->listAdd('b', 'kevin');
$E->listAdd('b', 'jp');
$lijst = $E->getList('lijst');
prd(compact('lijst'));
$E->ulistSet('ulijst', 'naam1', 'kevin');
$E->ulistSet('ulijst', 'naam2', 'jp');
$E->ulistSet('ulijst', 'num1', 123);
$E->ulistSet('ulijst', 'num2', 234);
$ulijst = $E->getUlist('ulijst');
prd(compact('ulijst'));
 /**
  * admin_check_nic method
  *
  * @return void
  */
 public function admin_check_nic()
 {
     $this->loadModel('Viewer');
     $this->Viewer->recursive = -1;
     $opts['conditions'] = array('User.active' => 1);
     $users = $this->User->find('all', $opts);
     $fake_users = array();
     $x = 0;
     foreach ($users as $user) {
         $skipped = $this->Viewer->findSkipped($user['User']['id']);
         if ($skipped == false) {
             $real = $this->Viewer->checkNicValidity($user['User']['id']);
             if ($real == false) {
                 $fake_users[$x] = $user['User'];
                 $x++;
             }
             //prd($real);
         }
     }
     prd($fake_users);
 }
 function edit($id)
 {
     $this->Event->id = $id;
     $data = $this->Event->read();
     if ($this->request->is('post') || $this->request->is('put')) {
         $this->request->data['Event']['start_date'] = sqlFormatDate($this->request->data['Event']['start_date']);
         $this->request->data['Event']['end_date'] = sqlFormatDate($this->request->data['Event']['end_date']);
         if (strtotime($this->request->data['Event']['end_date']) < strtotime($this->request->data['Event']['start_date'])) {
             $this->Session->setFlash('End date cannot be earlier than start date!');
         } else {
             $diff = array_diff($this->data['Event'], $data['Event']);
             if (!empty($diff)) {
                 $this->request->data['Event']['history_link'] = 0;
             }
             if ($this->Event->save($this->request->data)) {
                 //save history
                 if (!empty($diff)) {
                     $status = '';
                     if (in_array('name', array_keys($diff))) {
                         $status .= empty($status) ? __('Change name') : ', ' . __('Change name');
                     }
                     if (in_array('start_date', array_keys($diff))) {
                         $status .= empty($status) ? __('Change start date') : ', ' . __('Change start date');
                     }
                     if (in_array('end_date', array_keys($diff))) {
                         $status .= empty($status) ? __('Change end date') : ', ' . __('Change end date');
                     }
                     unset($data['Event']['id']);
                     $data['Event']['history_status'] = 2;
                     $data['Event']['history_link'] = $id;
                     $data['Event']['name'] = $data['Event']['name'] . '-bk' . substr(md5(microtime()), rand(0, 26), 5);
                     $this->Event->create();
                     $this->Event->disablePermissionable('Event');
                     if ($this->Event->save($data)) {
                         $history['History']['plugin'] = 'marketing';
                         $history['History']['controller'] = 'Events';
                         $history['History']['action'] = 'view';
                         $history['History']['history_id'] = $this->Event->id;
                         $history['History']['action_status'] = $status;
                         $history['History']['original_id'] = $id;
                         $history['History']['user_modified'] = $this->Session->read('Auth.User.id');
                         $history['History']['date_modified'] = gmdate('Y-m-d H:i:s');
                         $this->History->save($history);
                     } else {
                         prd($this->Event->validationErrors);
                     }
                 }
                 $this->Session->setFlash('Your event has been updated.');
                 $this->redirect(array('action' => 'index'));
             }
         }
     } else {
         $data['Event']['start_date'] = formatDate($data['Event']['start_date']);
         if (strtotime($data['Event']['end_date']) != 0) {
             $data['Event']['end_date'] = formatDate($data['Event']['end_date']);
         } else {
             $data['Event']['end_date'] = "";
         }
         $this->request->data = $data;
     }
     if (empty($this->data)) {
     } else {
         $data = $this->data;
     }
 }
 function delete($id)
 {
     $links = $this->AdvertisingLink->find('all', array('conditions' => array('marketing_channels_id' => $id, 'AdvertisingLink.history_status' => 1)));
     if (empty($links)) {
         $data = $this->Channel->read(null, $id);
         $data['Channel']['history_status'] = 2;
         $data['Channel']['history_link'] = -1;
         if ($this->Channel->save($data)) {
             $history['History']['plugin'] = 'marketing';
             $history['History']['controller'] = 'Channels';
             $history['History']['action'] = 'view';
             $history['History']['history_id'] = $id;
             $history['History']['action_status'] = __('Delete');
             $history['History']['user_modified'] = $this->Session->read('Auth.User.id');
             $history['History']['date_modified'] = gmdate('Y-m-d H:i:s');
             $this->History->save($history);
             $this->Session->setFlash('The channel with id: ' . $id . ' has been deleted.');
             $this->redirect(array('action' => 'index'));
         } else {
             prd($this->Channel->validationErrors);
         }
     } else {
         $this->Session->setFlash('The channel has links belonging to that.');
         $this->redirect(array('action' => 'index'));
     }
 }
 public function delete($id = null)
 {
     $this->Service->id = $id;
     if (!$this->Service->exists()) {
         throw new NotFoundException(__('Invalid product/service'));
     }
     $data = $this->Service->read(null, $id);
     if ($this->Service->delete()) {
         $this->RatecardService->deleteAll(array('RatecardService.service_id' => $id));
         unset($data['Service']['id']);
         $data['Service']['history_status'] = 2;
         $data['Service']['name'] = $data['Service']['name'] . ' (bk' . substr(md5(microtime()), rand(0, 26), 5) . ')';
         //print_r($data);die('aa');
         $this->Service->create();
         if ($this->Service->save($data)) {
             $history['History']['plugin'] = 'accounting';
             $history['History']['controller'] = 'Services';
             $history['History']['action'] = 'view';
             $history['History']['history_id'] = $this->Service->id;
             $history['History']['action_status'] = __('Delete');
             $history['History']['user_modified'] = $this->Session->read('Auth.User.id');
             $history['History']['date_modified'] = gmdate('Y-m-d H:i:s');
             $this->History->save($history);
         } else {
             prd($this->Service->validationErrors);
         }
         $this->Session->setFlash(__('Product/Service deleted'));
         return $this->redirect(array('action' => 'index'));
     }
     $this->Session->setFlash(__('Product/Service was not deleted'));
     return $this->redirect(array('action' => 'index'));
 }
Exemple #28
0
 function process()
 {
     $this->setFields();
     $fields = $this->formatfields();
     $this->url;
     $ch = curl_init($this->url);
     if ($this->godaddy_hosting) {
         curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
         curl_setopt($ch, CURLOPT_PROXY, "http://proxy.shr.secureserver.net:3128");
     }
     curl_setopt($ch, CURLOPT_HEADER, 0);
     // set to 0 to eliminate header info from response
     //curl_setopt($ch, CURLOPT_VERBOSE, 1);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     // Returns response data instead of TRUE(1)
     curl_setopt($ch, CURLOPT_POSTFIELDS, rtrim($fields, "& "));
     // use HTTP POST to send form data
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
     // uncomment this line if you get no gateway response. ###
     $resp = curl_exec($ch);
     //execute post and get results
     $this->response = $resp;
     $this->parseResponse();
     if ($this->responseParts['success'] == 'A') {
         $this->transactionId = $gatewaydata['TransactionID'];
         DT_Session::set('register.payment.transactionId', $this->transactionId);
         return true;
     } else {
         echo $this->responseParts['message'];
         return false;
     }
     prd($resp);
 }
 function get_transaction_detail()
 {
     global $godaddy_hosting;
     $ewayurl = "?CustomerID=" . $this->myCustomerID;
     $ewayurl .= "&UserName="******"&AccessPaymentCode=" . $_REQUEST['AccessPaymentCode'];
     $spacereplace = str_replace(" ", "%20", $ewayurl);
     $posturl = "https://au.ewaygateway.com/Result/{$spacereplace}";
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, $posturl);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($ch, CURLOPT_HEADER, 1);
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
     if ($godaddy_hosting) {
         $proxy_tunnel_flag = defined('CURL_PROXY_TUNNEL_FLAG') && strtoupper(CURL_PROXY_TUNNEL_FLAG) == 'FALSE' ? false : true;
         curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, $proxy_tunnel_flag);
         curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
         curl_setopt($ch, CURLOPT_PROXY, "http://proxy.shr.secureserver.net:3128");
     }
     $response = curl_exec($ch);
     if (curl_errno($ch)) {
         echo 'Curl error: ' . curl_error($ch);
         die;
         return false;
     } else {
         $status = Eway::fetch_data($response, '<TrxnStatus>', '</TrxnStatus>');
         if (strtolower($status) == 'false') {
             return false;
         } else {
         }
         $transaction_id = Eway::fetch_data($response, '<TrxnNumber>', '</TrxnNumber>');
         return $transaction_id;
     }
     echo "<pre>";
     echo htmlentities($response);
     prd($response);
     die;
 }
 public function view($id)
 {
     $data = $this->Brief->read(null, $id);
     $created_by = $this->User->read(null, $data['Brief']['user_created']);
     $this->set('created_by', $created_by);
     if (!empty($data['Brief']['attached_files'])) {
         $attached_files = json_decode($data['Brief']['attached_files'], true);
         $this->set('attached_files', $attached_files);
     }
     $allVersions = $this->Brief->find('all', array('conditions' => array('random_key' => $data['Brief']['random_key']), 'order' => 'version desc'));
     if ($this->request->is(array('post', 'put'))) {
         if (trim($this->request->data['Brief']['text_approved']) != $data['Brief']['approval_key']) {
             $this->Session->setFlash(__('Approval key incorrect'), 'danger');
             $this->redirect(array('action' => 'view', $id));
         }
         if ($this->Session->read('Auth.User.id') == $data['Brief']['user_created']) {
             $data['Brief']['status'] = 1;
         } else {
             $data['Brief']['status'] = 3;
         }
         if ($this->Brief->save($data)) {
             $this->Session->setFlash(__('Approved brief'));
             $this->redirect(array('action' => 'edit', $id));
         } else {
             prd($this->Brief->validationErrors);
         }
     }
     $this->set('allVersions', $allVersions);
     $this->set('data', $data);
 }