예제 #1
0
 public function load()
 {
     //$this->clear();
     if (!class_exists('vmCrypt')) {
         require VMPATH_ADMIN . DS . 'helpers' . DS . 'vmcrypt.php';
     }
     $session = JFactory::getSession();
     $sessionData = $session->get('paypal', 0, 'vm');
     if (!empty($sessionData)) {
         $data = (object) json_decode($sessionData, true);
         $this->_selected_method = $data->selected_method;
         // card information
         $this->_cc_type = $data->cc_type;
         $this->_cc_number = vmCrypt::decrypt($data->cc_number);
         $this->_cc_cvv = vmCrypt::decrypt($data->cc_cvv);
         $this->_cc_expire_month = $data->cc_expire_month;
         $this->_cc_expire_year = $data->cc_expire_year;
         $this->_cc_valid = $data->cc_valid;
         //Customer settings
         $this->_autobilling_max_amount = $data->autobilling_max_amount;
         //PayPal Express
         $this->_token = $data->token;
         $this->_payer_id = $data->payer_id;
         $this->_first_name = $data->first_name;
         $this->_last_name = $data->last_name;
         $this->_payer_email = $data->payer_email;
         //			$this->_txn_id = $data->txn_id;
         //			$this->_txn_type = $data->txn_type;
         //			$this->_payment_status = $data->payment_status;
         //			$this->_pending_reason = $data->pending_reason;
         $this->save();
         return $data;
     }
 }
예제 #2
0
 /**
  * Retrieve the detail record for the current $id if the data has not already been loaded.
  *
  * @author RickG
  */
 function getShipment()
 {
     if (empty($this->_data[$this->_id])) {
         $this->_data[$this->_id] = $this->getTable('shipmentmethods');
         $this->_data[$this->_id]->load((int) $this->_id);
         if (empty($this->_data[$this->_id]->virtuemart_vendor_id)) {
             if (!class_exists('VirtueMartModelVendor')) {
                 require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'vendor.php';
             }
             $this->_data[$this->_id]->virtuemart_vendor_id = VirtueMartModelVendor::getLoggedVendor();
         }
         if ($this->_data[$this->_id]->shipment_jplugin_id) {
             JPluginHelper::importPlugin('vmshipment');
             $dispatcher = JDispatcher::getInstance();
             $retValue = $dispatcher->trigger('plgVmDeclarePluginParamsShipment', array($this->_data[$this->_id]->shipment_element, $this->_data[$this->_id]->shipment_jplugin_id, &$this->_data[$this->_id]));
         }
         if ($this->_data[$this->_id]->getCryptedFields()) {
             if (!class_exists('vmCrypt')) {
                 require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'vmcrypt.php';
             }
             if (isset($this->_data[$this->_id]->modified_on)) {
                 $date = JFactory::getDate($this->_data[$this->_id]->modified_on);
                 $date = $date->toUnix();
             } else {
                 $date = 0;
             }
             foreach ($this->_data[$this->_id]->getCryptedFields() as $field) {
                 if (isset($this->_data[$this->_id]->{$field})) {
                     $this->_data[$this->_id]->{$field} = vmCrypt::decrypt($this->_data[$this->_id]->{$field}, $date);
                 }
             }
         }
         // 			vmdebug('$$this->_data getShipment',$this->_data);
         //if(!empty($this->_id)){
         /* Add the shipmentcarreir shoppergroups */
         $q = 'SELECT `virtuemart_shoppergroup_id` FROM #__virtuemart_shipmentmethod_shoppergroups WHERE `virtuemart_shipmentmethod_id` = "' . $this->_id . '"';
         $this->_db->setQuery($q);
         $this->_data[$this->_id]->virtuemart_shoppergroup_ids = $this->_db->loadResultArray();
         #
         if (empty($this->_data[$this->_id]->virtuemart_shoppergroup_ids)) {
             $this->_data[$this->_id]->virtuemart_shoppergroup_ids = 0;
         }
         //}
     }
     return $this->_data[$this->_id];
 }
예제 #3
0
 private function getRetourParams($cryptedParams)
 {
     if (!class_exists('vmCrypt')) {
         require VMPATH_ADMIN . DS . 'helpers' . DS . 'vmcrypt.php';
     }
     $cryptedParams = base64_decode($cryptedParams);
     $params = vmCrypt::decrypt($cryptedParams);
     $paramsArray = explode(":", $params);
     $retourParams['virtuemart_paymentmethod_id'] = $paramsArray[0];
     $retourParams['order_number'] = $paramsArray[1];
     $retourParams['context'] = $paramsArray[2];
     return $retourParams;
 }
예제 #4
0
파일: vmtable.php 프로젝트: sergy444/joomla
 /**
  * Technic to inject params as table attributes
  * @author Max Milbers
  * $TableJoins array of table names to add and left join to find ID
  */
 function load($oid = null, $overWriteLoadName = 0, $andWhere = 0, $tableJoins = array(), $joinKey = 0)
 {
     if ($overWriteLoadName !== 0) {
         $k = $overWriteLoadName;
     } else {
         $k = $this->_pkey;
     }
     if ($oid !== null) {
         $this->{$k} = $oid;
     } else {
         $oid = $this->{$k};
     }
     if ($oid === null) {
         $oid = 0;
     } else {
         if (empty($oid)) {
             if (!empty($this->_xParams)) {
                 foreach ($this->_varsToPushParam as $key => $v) {
                     if (!isset($this->{$key})) {
                         $this->{$key} = $v[0];
                     }
                 }
             }
             return $this;
         }
     }
     //Version load the tables using JOIN
     if ($this->_translatable) {
         $mainTable = $this->_tbl;
         $langTable = $this->_tbl . '_' . $this->_langTag;
         $select = 'SELECT `' . $mainTable . '`.* ,`' . $langTable . '`.* ';
         $from = ' FROM `' . $mainTable . '` INNER JOIN `' . $langTable . '` using (`' . $this->_tbl_key . '`)';
     } else {
         $mainTable = $this->_tbl;
         $select = 'SELECT `' . $mainTable . '`.* ';
         $from = ' FROM `' . $mainTable . '` ';
     }
     if (count($tableJoins)) {
         if (!$joinKey) {
             $joinKey = $this->_tbl_key;
         }
         foreach ($tableJoins as $tableId => $table) {
             $select .= ',`' . $table . '`.`' . $tableId . '` ';
             $from .= ' LEFT JOIN `' . $table . '` on `' . $table . '`.`' . $joinKey . '`=`' . $mainTable . '`.`' . $joinKey . '`';
         }
     }
     //the cast to int here destroyed the query for keys like virtuemart_userinfo_id, so no cast on $oid
     // $query = $select.$from.' WHERE '. $mainTable .'.`'.$this->_tbl_key.'` = "'.$oid.'"';
     if ($andWhere === 0) {
         $andWhere = '';
     }
     $query = $select . $from . ' WHERE `' . $mainTable . '`.`' . $k . '` = "' . $oid . '" ' . $andWhere;
     $hashVarsToPush = '';
     if (!empty($this->_xParams)) {
         $hashVarsToPush = serialize($this->_varsToPushParam);
     }
     $hash = md5($oid . $select . $k . $andWhere . $hashVarsToPush);
     if (isset(self::$_cache['l'][$hash])) {
         //vmdebug('Resturn cached '.$this->_pkey.' '.$this->_slugAutoName.' '.$oid);
         $this->bind(self::$_cache['l'][$hash]);
         return self::$_cache['l'][$hash];
     } else {
         //vmdebug('loading '.$this->_pkey.' '.$this->_slugAutoName.' '.$oid);
     }
     $db = $this->getDBO();
     $db->setQuery($query);
     $result = $db->loadAssoc();
     if ($result) {
         $this->bind($result);
         if (!empty($this->_xParams)) {
             //Maybe better to use for $this an &
             self::bindParameterable($this, $this->_xParams, $this->_varsToPushParam);
         }
         if (count($tableJoins)) {
             foreach ($tableJoins as $tableId => $table) {
                 if (isset($result[$tableId])) {
                     $this->{$tableId} = $result[$tableId];
                 }
             }
         }
     } else {
         $params = JComponentHelper::getParams('com_languages');
         $defaultLang = $params->get('site', 'en-GB');
         //use default joomla
         $defaultLang = strtolower(strtr($defaultLang, '-', '_'));
         if ($defaultLang != $this->_langTag and Vmconfig::$langCount > 1) {
             $this->_ltmp = $this->_langTag;
             $this->_langTag = $defaultLang;
             $this->load($oid, $overWriteLoadName, $andWhere, $tableJoins, $joinKey);
         }
     }
     if ($this->_cryptedFields) {
         if (!class_exists('vmCrypt')) {
             require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'vmcrypt.php';
         }
         if (isset($this->modified_on)) {
             $timestamp = strtotime($this->modified_on);
             $date = $timestamp;
         } else {
             $date = 0;
         }
         if ($this->_cryptedFields) {
             if (!class_exists('vmCrypt')) {
                 require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'vmcrypt.php';
             }
             if (isset($this->modified_on)) {
                 $timestamp = strtotime($this->modified_on);
                 $date = $timestamp;
             } else {
                 $date = 0;
             }
             foreach ($this->_cryptedFields as $field) {
                 if (isset($this->{$field})) {
                     $this->{$field} = vmCrypt::decrypt($this->{$field}, $date);
                 }
             }
         }
     }
     if ($this->_ltmp) {
         $this->_langTag = $this->_ltmp;
         $this->_ltmp = false;
     }
     self::$_cache['l'][$hash] = $this->loadFieldValues(false);
     return self::$_cache['l'][$hash];
 }
예제 #5
0
 /**
  * Todo, works only for small stores, we need a new solution there with a bit filtering
  * For example by time, if already shopper, and a simple search
  * @return object list of users
  */
 function getUserList()
 {
     $cart = $this->cart;
     $result = false;
     if ($this->allowChangeShopper) {
         $this->adminID = JFactory::getSession()->get('vmAdminID', false);
         if ($this->adminID) {
             if (!class_exists('vmCrypt')) {
                 require VMPATH_ADMIN . DS . 'helpers' . DS . 'vmcrypt.php';
             }
             $this->adminID = vmCrypt::decrypt($this->adminID);
         }
         $superVendor = VmConfig::isSuperVendor($this->adminID);
         if ($superVendor) {
             $uModel = VmModel::getModel('user');
             $result = $uModel->getSwitchUserList($superVendor, $this->adminID);
         }
     }
     //vmdebug('my user list ',$result);
     if (!$result) {
         $this->allowChangeShopper = false;
     }
     return $result;
 }
예제 #6
0
 /**
  * Save the user info. The saveData function don't use the userModel store function for anonymous shoppers, because it would register them.
  * We make this function private, so we can do the tests in the tasks.
  *
  * @author Max Milbers
  * @author Valérie Isaksen
  *
  * @param boolean Defaults to false, the param is for the userModel->store function, which needs it to determine how to handle the data.
  * @return String it gives back the messages.
  */
 private function saveData($cartObj)
 {
     $mainframe = JFactory::getApplication();
     $msg = '';
     $data = vRequest::getPost(FILTER_SANITIZE_STRING);
     $register = isset($_REQUEST['register']);
     $userModel = VmModel::getModel('user');
     $currentUser = JFactory::getUser();
     if (empty($data['address_type'])) {
         $data['address_type'] = vRequest::getCmd('addrtype', 'BT');
     }
     if ($cartObj) {
         if ($cartObj->_fromCart or $cartObj->getInCheckOut()) {
             if (!class_exists('VirtueMartCart')) {
                 require VMPATH_SITE . DS . 'helpers' . DS . 'cart.php';
             }
             $cart = VirtueMartCart::getCart();
             $prefix = '';
             if ($data['address_type'] == 'STaddress' || $data['address_type'] == 'ST') {
                 $prefix = 'shipto_';
                 vmdebug('Storing user ST prefix ' . $prefix);
             }
             $cart->saveAddressInCart($data, $data['address_type'], true, $prefix);
         }
     }
     if (isset($data['vendor_accepted_currencies'])) {
         // Store multiple selectlist entries as a ; separated string
         if (array_key_exists('vendor_accepted_currencies', $data) && is_array($data['vendor_accepted_currencies'])) {
             $data['vendor_accepted_currencies'] = implode(',', $data['vendor_accepted_currencies']);
         }
         $data['vendor_store_name'] = vRequest::getHtml('vendor_store_name');
         $data['vendor_store_desc'] = vRequest::getHtml('vendor_store_desc');
         $data['vendor_terms_of_service'] = vRequest::getHtml('vendor_terms_of_service');
         $data['vendor_letter_css'] = vRequest::getHtml('vendor_letter_css');
         $data['vendor_letter_header_html'] = vRequest::getHtml('vendor_letter_header_html');
         $data['vendor_letter_footer_html'] = vRequest::getHtml('vendor_letter_footer_html');
     }
     if ($data['address_type'] == 'ST' and !$currentUser->guest) {
         $ret = $userModel->storeAddress($data);
         if ($cartObj and !empty($ret)) {
             $cartObj->selected_shipto = $ret;
             $cartObj->setCartIntoSession();
         }
     } else {
         if ($currentUser->guest == 1 and ($register or !$cartObj)) {
             if ($this->checkCaptcha('index.php?option=com_virtuemart&view=user&task=editaddresscart&addrtype=BT') == FALSE) {
                 $msg = vmText::_('PLG_RECAPTCHA_ERROR_INCORRECT_CAPTCHA_SOL');
                 if ($cartObj and $cartObj->_fromCart) {
                     $this->redirect(JRoute::_('index.php?option=com_virtuemart&view=user&task=editaddresscart&addrtype=BT'), $msg);
                 } else {
                     if ($cartObj and $cartObj->getInCheckOut()) {
                         $this->redirect(JRoute::_('index.php?option=com_virtuemart&view=user&task=editaddresscheckout&addrtype=BT'), $msg);
                     } else {
                         $this->redirect(JRoute::_('index.php?option=com_virtuemart&view=user&task=edit&addrtype=BT'), $msg);
                     }
                 }
                 return $msg;
             }
         }
         if ($currentUser->guest != 1 or !$cartObj or $currentUser->guest == 1 and $register) {
             $switch = false;
             if ($currentUser->guest == 1 and $register) {
                 $userModel->setId(0);
                 $adminID = JFactory::getSession()->get('vmAdminID', false);
                 if ($adminID) {
                     if (!class_exists('vmCrypt')) {
                         require VMPATH_ADMIN . DS . 'helpers' . DS . 'vmcrypt.php';
                     }
                     $adminID = vmCrypt::decrypt($adminID);
                     $adminIdUser = JFactory::getUser($adminID);
                     if ($adminIdUser->authorise('core.admin', 'com_virtuemart') or $adminIdUser->authorise('vm.user', 'com_virtuemart')) {
                         $superUser = VmConfig::isSuperVendor($adminID);
                         if ($superUser > 1) {
                             $data['vendorId'] = $superUser;
                         }
                         $switch = true;
                     }
                 }
             }
             if (!class_exists('VirtueMartCart')) {
                 require VMPATH_SITE . DS . 'helpers' . DS . 'cart.php';
             }
             $cart = VirtueMartCart::getCart();
             if (!empty($cart->vendorId) and $cart->vendorId != 1) {
                 $data['vendorId'] = $cart->vendorId;
             }
             $ret = $userModel->store($data);
             if ($switch) {
                 //and VmConfig::get ('oncheckout_change_shopper')){
                 //update session
                 $current = JFactory::getUser($ret['newId']);
                 $session = JFactory::getSession();
                 $session->set('user', $current);
             }
         }
         if ($currentUser->guest == 1 and ($register or !$cartObj)) {
             $msg = is_array($ret) ? $ret['message'] : $ret;
             $usersConfig = JComponentHelper::getParams('com_users');
             $useractivation = $usersConfig->get('useractivation');
             if (is_array($ret) and $ret['success'] and !$useractivation) {
                 // Username and password must be passed in an array
                 $credentials = array('username' => $ret['user']->username, 'password' => $ret['user']->password_clear);
                 $return = $mainframe->login($credentials);
             } else {
                 if (VmConfig::get('oncheckout_only_registered', 0)) {
                     $layout = vRequest::getCmd('layout', 'edit');
                     $this->redirect(JRoute::_('index.php?option=com_virtuemart&view=user&layout=' . $layout, FALSE), $msg);
                 }
             }
         }
     }
     return $msg;
 }
예제 #7
0
 public function manager($view = 0)
 {
     if (empty($view)) {
         $view = $this->_name;
     }
     if (!isset(self::$_manager[$view])) {
         if (JFactory::getApplication()->isSite()) {
             $adminId = JFactory::getSession()->get('vmAdminID', null);
             if ($adminId) {
                 if (!class_exists('vmCrypt')) {
                     require VMPATH_ADMIN . DS . 'helpers' . DS . 'vmcrypt.php';
                 }
                 $adminId = vmCrypt::decrypt($adminId);
             }
             $user = JFactory::getUser($adminId);
             $vendorIdUser = VmConfig::isSuperVendor($user->id);
         } else {
             $user = JFactory::getUser();
         }
         if ($user->authorise('core.admin') or $user->authorise('core.admin', 'com_virtuemart') or ($user->authorise('core.manage', 'com_virtuemart') or $user->authorise('vm.manage', 'com_virtuemart')) and $user->authorise('vm.' . $view, 'com_virtuemart')) {
             self::$_manager[$view] = true;
         } else {
             self::$_manager[$view] = false;
         }
     }
     return self::$_manager[$view];
 }
예제 #8
0
파일: helper.php 프로젝트: lenard112/cms
 function getMd($cryptedMd)
 {
     if (!class_exists('vmCrypt')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'vmCrypt.php';
     }
     $decryptedMd = vmCrypt::decrypt($cryptedMd);
     $md = unserialize($decryptedMd);
     return $md;
 }
예제 #9
0
 function _getAuthorizeNetFromSession()
 {
     if (!class_exists('vmCrypt')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'vmcrypt.php';
     }
     $session = JFactory::getSession();
     $authorizenetSession = $session->get('authorizenet', 0, 'vm');
     if (!empty($authorizenetSession)) {
         $authorizenetData = (object) json_decode($authorizenetSession, true);
         $this->_cc_type = $authorizenetData->cc_type;
         $this->_cc_number = vmCrypt::decrypt($authorizenetData->cc_number);
         $this->_cc_cvv = vmCrypt::decrypt($authorizenetData->cc_cvv);
         $this->_cc_expire_month = $authorizenetData->cc_expire_month;
         $this->_cc_expire_year = $authorizenetData->cc_expire_year;
         $this->_cc_valid = $authorizenetData->cc_valid;
     }
 }
예제 #10
0
    /**
     * Checks if user is admin or has vendorId=1,
     * if superadmin, but not a vendor it gives back vendorId=1 (single vendor, but multiuser administrated)
     *
     * @author Mattheo Vicini
     * @author Max Milbers
     */
    public static function isSuperVendor($adminId = null)
    {
        if (!isset(self::$_virtuemart_vendor_id[$adminId])) {
            self::$_virtuemart_vendor_id[$adminId] = 0;
            if (empty($adminId)) {
                $adminId = JFactory::getSession()->get('vmAdminID', null);
                if ($adminId) {
                    if (!class_exists('vmCrypt')) {
                        require VMPATH_ADMIN . DS . 'helpers' . DS . 'vmcrypt.php';
                    }
                    $adminId = vmCrypt::decrypt($adminId);
                }
                $user = JFactory::getUser($adminId);
            } else {
                $user = JFactory::getUser($adminId);
            }
            if (!empty($user->id)) {
                $q = 'SELECT `virtuemart_vendor_id` FROM `#__virtuemart_vmusers` `au`
				WHERE `au`.`virtuemart_user_id`="' . $user->id . '" AND `au`.`user_is_vendor` = "1" ';
                $db = JFactory::getDbo();
                $db->setQuery($q);
                $virtuemart_vendor_id = $db->loadResult();
                if ($virtuemart_vendor_id) {
                    self::$_virtuemart_vendor_id[$adminId] = $virtuemart_vendor_id;
                } else {
                    if ($user->authorise('core.admin', 'com_virtuemart') or self::get('multix', 'none') == 'none' and $user->authorise('core.manage', 'com_virtuemart')) {
                        self::$_virtuemart_vendor_id[$adminId] = 1;
                    }
                }
            }
            if (empty(self::$_virtuemart_vendor_id[$adminId])) {
                vmdebug('Not a vendor');
            }
        }
        return self::$_virtuemart_vendor_id[$adminId];
    }
예제 #11
0
 public static function isFEmanager($task = null)
 {
     $adminId = JFactory::getSession()->get('vmAdminID', null);
     if ($adminId) {
         if (!class_exists('vmCrypt')) {
             require VMPATH_ADMIN . DS . 'helpers' . DS . 'vmcrypt.php';
         }
         $adminId = vmCrypt::decrypt($adminId);
     }
     $user = JFactory::getUser($adminId);
     if ($user->authorise('vm.manage', 'com_virtuemart') or $user->authorise('core.admin', 'com_virtuemart') or $user->authorise('core.manage', 'com_virtuemart')) {
         if (isset($task)) {
             if ($user->authorise($task, 'com_virtuemart')) {
                 return $user->id;
             }
         } else {
             return $user->id;
         }
     }
     return false;
 }
예제 #12
0
파일: cart.php 프로젝트: cybershocik/Darek
 public function getManager()
 {
     $adminID = JFactory::getSession()->get('vmAdminID', false);
     if ($adminID) {
         if (!class_exists('vmCrypt')) {
             require VMPATH_ADMIN . DS . 'helpers' . DS . 'vmcrypt.php';
         }
         $adminID = vmCrypt::decrypt($adminID);
         return JFactory::getUser($adminID);
     } else {
         return JFactory::getUser();
     }
 }
예제 #13
0
 function check()
 {
     if (empty($this->order_number)) {
         if (!class_exists('VirtueMartModelOrders')) {
             require VMPATH_ADMIN . DS . 'models' . DS . 'orders.php';
         }
         $this->order_number = VirtueMartModelOrders::generateOrderNumber((string) time());
     }
     if (empty($this->order_pass)) {
         $this->order_pass = '******' . substr(md5((string) time() . $this->order_number), 0, 5);
     }
     $adminID = JFactory::getSession()->get('vmAdminID', false);
     if ($adminID) {
         if (!class_exists('vmCrypt')) {
             require VMPATH_ADMIN . DS . 'helpers' . DS . 'vmcrypt.php';
         }
         $adminID = vmCrypt::decrypt($adminID);
         $this->created_by = $adminID;
     }
     return parent::check();
 }
예제 #14
0
 function decryptFields()
 {
     if (!class_exists('vmCrypt')) {
         require VMPATH_ADMIN . DS . 'helpers' . DS . 'vmcrypt.php';
     }
     if (isset($this->modified_on) and $this->modified_on != '0000-00-00 00:00:00') {
         $date = JFactory::getDate($this->modified_on);
         $date = $date->toUnix();
     } else {
         if (isset($this->created_on) and $this->created_on != '0000-00-00 00:00:00') {
             $date = JFactory::getDate($this->created_on);
             $date = $date->toUnix();
         } else {
             $date = 0;
         }
     }
     foreach ($this->_cryptedFields as $field) {
         if (isset($this->{$field})) {
             $this->{$field} = vmCrypt::decrypt($this->{$field}, $date);
             vmdebug($this->_tbl . ' Field ' . $field . ' encrypted = ' . $this->{$field});
         }
     }
 }
예제 #15
0
 /**
  * Retrieve the detail record for the current $id if the data has not already been loaded.
  *
  * @author RickG
  */
 function getShipment($id = 0)
 {
     if (!empty($id)) {
         $this->_id = (int) $id;
     }
     if (empty($this->_cache[$this->_id])) {
         $this->_cache[$this->_id] = $this->getTable('shipmentmethods');
         $this->_cache[$this->_id]->load((int) $this->_id);
         if (empty($this->_cache[$this->_id]->virtuemart_vendor_id)) {
             if (!class_exists('VirtueMartModelVendor')) {
                 require VMPATH_ADMIN . DS . 'models' . DS . 'vendor.php';
             }
             $this->_cache[$this->_id]->virtuemart_vendor_id = VirtueMartModelVendor::getLoggedVendor();
         }
         if ($this->_cache[$this->_id]->shipment_jplugin_id) {
             JPluginHelper::importPlugin('vmshipment');
             $dispatcher = JDispatcher::getInstance();
             $blind = 0;
             $retValue = $dispatcher->trigger('plgVmDeclarePluginParamsShipmentVM3', array(&$this->_cache[$this->_id]));
         }
         if (!empty($this->_cache[$this->_id]->_varsToPushParam)) {
             VmTable::bindParameterable($this->_cache[$this->_id], 'shipment_params', $this->_cache[$this->_id]->_varsToPushParam);
         }
         //We still need this, because the table is already loaded, but the keys are set later
         if ($this->_cache[$this->_id]->getCryptedFields()) {
             if (!class_exists('vmCrypt')) {
                 require VMPATH_ADMIN . DS . 'helpers' . DS . 'vmcrypt.php';
             }
             if (isset($this->_cache[$this->_id]->modified_on)) {
                 $date = JFactory::getDate($this->_cache[$this->_id]->modified_on);
                 $date = $date->toUnix();
             } else {
                 $date = 0;
             }
             foreach ($this->_cache[$this->_id]->getCryptedFields() as $field) {
                 if (isset($this->_cache[$this->_id]->{$field})) {
                     $this->_cache[$this->_id]->{$field} = vmCrypt::decrypt($this->_cache[$this->_id]->{$field}, $date);
                 }
             }
         }
         /* Add the shipmentcarreir shoppergroups */
         $q = 'SELECT `virtuemart_shoppergroup_id` FROM #__virtuemart_shipmentmethod_shoppergroups WHERE `virtuemart_shipmentmethod_id` = "' . $this->_id . '"';
         $this->_db->setQuery($q);
         $this->_cache[$this->_id]->virtuemart_shoppergroup_ids = $this->_db->loadColumn();
         if (empty($this->_cache[$this->_id]->virtuemart_shoppergroup_ids)) {
             $this->_cache[$this->_id]->virtuemart_shoppergroup_ids = 0;
         }
     }
     return $this->_cache[$this->_id];
 }
예제 #16
0
 public static function getBgManagerId()
 {
     if (!isset(self::$_cuId)) {
         $cuId = JFactory::getSession()->get('vmAdminID', null);
         //echo $cuId;
         if ($cuId) {
             if (!class_exists('vmCrypt')) {
                 require VMPATH_ADMIN . DS . 'helpers' . DS . 'vmcrypt.php';
             }
             $cuId = vmCrypt::decrypt($cuId);
             if (empty($cuId)) {
                 $cuId = null;
             }
         }
         self::$_cuId = $cuId;
     }
     return self::$_cuId;
 }
예제 #17
0
 function getMd($cryptedMd)
 {
     if (!class_exists('vmCrypt')) {
         require VMPATH_ADMIN . DS . 'helpers' . DS . 'vmcrypt.php';
     }
     $decryptedMd = vmCrypt::decrypt($cryptedMd);
     $md = json_decode($decryptedMd, true);
     return $md;
 }
예제 #18
0
 function encryptFields()
 {
     if (!class_exists('vmCrypt')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'vmcrypt.php';
     }
     if (isset($this->modified_on)) {
         $date = JFactory::getDate($this->modified_on);
         $date = $date->toUnix();
     } else {
         $date = 0;
     }
     foreach ($this->_cryptedFields as $field) {
         if (isset($this->{$field})) {
             $this->{$field} = vmCrypt::decrypt($this->{$field}, $date);
         }
     }
 }
예제 #19
0
 public static function isFEmanager($task = FALSE)
 {
     static $c = array();
     if (!isset($c[$task])) {
         $c[$task] = false;
         $adminId = JFactory::getSession()->get('vmAdminID', null);
         if ($adminId) {
             if (!class_exists('vmCrypt')) {
                 require VMPATH_ADMIN . DS . 'helpers' . DS . 'vmcrypt.php';
             }
             $adminId = vmCrypt::decrypt($adminId);
         }
         $user = JFactory::getUser($adminId);
         if ($user->authorise('vm.manage', 'com_virtuemart') or $user->authorise('core.admin', 'com_virtuemart') or $user->authorise('core.manage', 'com_virtuemart')) {
             if (!empty($task)) {
                 if ($user->authorise($task, 'com_virtuemart')) {
                     $c[$task] = $user->id;
                 }
             } else {
                 $c[$task] = $user->id;
             }
         }
     }
     vmdebug('isFEmanager return ' . $c[$task], $c);
     return $c[$task];
 }