/** * Verify security token * * @param string string token * @param int Transaction ID * @return bool */ public static function verifySecurityToken($token, $tId) { if (!Cart_Helper::isNonNegativeInt($tId, false)) { throw new Exception(Lang::txt('COM_CART_NO_TRANSACTION_FOUND')); } return md5(self::$securitySalt . $tId) == $token; }
/** * Set selected saved shipping addresses for this user * * @param int saved address ID * @return bool */ public function setSavedShippingAddress($saId) { // check if the address correct if (!Cart_Helper::isNonNegativeInt($saId)) { throw new Exception(Lang::txt('COM_CART_INCORRECT_SAVED_SHIPPING_ADDRESS')); } $sql = "SELECT * FROM `#__cart_saved_addresses` WHERE `saId` = " . $this->_db->quote($saId); $this->_db->setQuery($sql); $this->_db->query(); if ($this->_db->getNumRows() < 1) { throw new Exception(Lang::txt('COM_CART_INCORRECT_SAVED_SHIPPING_ADDRESS')); } $sql = "UPDATE `#__cart_transaction_info` ti, (SELECT * FROM `#__cart_saved_addresses` WHERE `saId` = " . $this->_db->quote($saId) . ") sa\n\t\t\t\tSET\n\t\t\t\tti.`tiShippingToFirst` = sa.`saToFirst`,\n\t\t\t\tti.`tiShippingToLast` = sa.`saToLast`,\n\t\t\t\tti.`tiShippingAddress` = sa.`saAddress`,\n\t\t\t\tti.`tiShippingCity` = sa.`saCity`,\n\t\t\t\tti.`tiShippingState` = sa.`saState`,\n\t\t\t\tti.`tiShippingZip` = sa.`saZip`\n\n\t\t\t\tWHERE ti.`tId` = {$this->cart->tId}"; $this->_db->setQuery($sql); $this->_db->query(); return true; }