本文整理汇总了PHP中VmError函数的典型用法代码示例。如果您正苦于以下问题:PHP VmError函数的具体用法?PHP VmError怎么用?PHP VmError使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了VmError函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handleResponse
function handleResponse () {
if ($this->response) {
if ($this->response['ACK'] == 'Failure' || $this->response['ACK'] == 'FailureWithWarning') {
$error = '';
$public_error = '';
for ($i = 0; isset($this->response["L_ERRORCODE" . $i]); $i++) {
$error .= $this->response["L_ERRORCODE" . $i];
$message = isset($this->response["L_LONGMESSAGE" . $i]) ? $this->response["L_LONGMESSAGE" . $i] : $this->response["L_SHORTMESSAGE" . $i];
$error .= ": " . $message . "<br />";
}
if ($this->_method->debug) {
$public_error = $error;
}
$this->debugLog($this->response, 'handleResponse:', 'debug');
VmError($error, $public_error);
return false;
} elseif ($this->response['ACK'] == 'Success' || $this->response['ACK'] == 'SuccessWithWarning' || $this->response['TRANSACTIONID'] != NULL || $this->response['PAYMENTINFO_0_TRANSACTIONID'] != NULL) {
return true;
} else {
// Unexpected ACK type. Log response and inform the buyer that the
// transaction must be manually investigated.
$error = '';
$public_error = '';
$error = "Unexpected ACK type:" . $this->response['ACK'];
$this->debugLog($this->response, 'Unexpected ACK type:', 'debug');
if ($this->_method->debug) {
$public_error = $error;
}
VmError($error, $public_error);
return false;
}
}
}
示例2: __construct
/**
* @param $cData
* @param $shipTo
*/
function __construct($cData, $shipTo)
{
$this->shipTo = $shipTo;
$this->country = $cData['country_code'];
$this->country_code_3 = $cData['country_code_3'];
$this->currency = $cData['currency_code'];
$this->virtuemart_currency_id = $cData['virtuemart_currency_id'];
//$this->currency = $vendor_currency;
// Get EID and Secret
$this->eid = $cData['eid'];
$this->secret = $cData['secret'];
$this->lang = $cData['language_code'];
// Is Invoice enabled?
$this->enabled = TRUE;
// Set modes
$this->mode = $cData['mode'];
$this->ssl = KlarnaHandler::getKlarnaSSL($this->mode);
$this->web_root = JURI::base();
try {
$this->klarna = new Klarna_virtuemart();
$this->klarna->config($this->eid, $this->secret, $this->country, $this->lang, $this->currency, $this->mode, VMKLARNA_PC_TYPE, KlarnaHandler::getKlarna_pc_type(), $this->ssl);
} catch (Exception $e) {
VmError('klarna_payments', $e);
unset($this->klarna);
}
}
示例3: interpreteMathOp
/**
* This functions interprets the String that is entered in the calc_value_mathop field
* The first char is the signum of the function. The more this function can be enhanced
* maybe with function that works like operators, the easier it will be to make more complex disount/commission/profit formulas
* progressive, nonprogressive and so on.
*
* @copyright Copyright (c) 2009 VirtueMart Team. All rights reserved.
* @author Max Milbers
* @param $mathop String reprasentation of the mathematical operation, valid ('+','-','+%','-%')
* @param $value float The value that affects the price
* @param $currency int the currency which should be used
* @param $price float The price to calculate
*/
function interpreteMathOp($rule, $price)
{
$mathop = $rule['calc_value_mathop'];
$value = (double) $rule['calc_value'];
$currency = $rule['calc_currency'];
//$mathop, $value, $price, $currency='')
$coreMathOp = array('+', '-', '+%', '-%');
if (!$this->_revert) {
$plus = '+';
$minus = '-';
} else {
$plus = '-';
$minus = '+';
}
if (in_array($mathop, $coreMathOp)) {
$sign = substr($mathop, 0, 1);
$calculated = false;
if (strlen($mathop) == 2) {
$cmd = substr($mathop, 1, 2);
if ($cmd == '%') {
if (!$this->_revert) {
$calculated = $price * $value / 100.0;
} else {
if (!empty($value)) {
if ($sign == $plus) {
$calculated = abs($price / (1 - 100.0 / $value));
} else {
$calculated = abs($price / (1 + 100.0 / $value));
}
} else {
vmdebug('interpreteMathOp $value is empty ' . $rule['calc_name']);
}
// vmdebug('interpreteMathOp $price'.$price.' $value '.$value.' $sign '.$sign.' '.$plus.' $calculated '.$calculated);
}
}
} else {
if (strlen($mathop) == 1) {
$calculated = $this->_currencyDisplay->convertCurrencyTo($currency, $value);
}
}
// vmdebug('interpreteMathOp',$price,$calculated,$plus);
if ($sign == $plus) {
return $price + (double) $calculated;
} else {
if ($sign == $minus) {
return $price - (double) $calculated;
} else {
VmError('Unrecognised mathop ' . $mathop . ' in calculation rule found');
return $price;
}
}
} else {
JPluginHelper::importPlugin('vmcalculation');
$dispatcher = JDispatcher::getInstance();
//$calculated = $dispatcher->trigger('interpreteMathOp', array($this, $mathop, $value, $price, $currency,$this->_revert));
$calculated = $dispatcher->trigger('plgVmInterpreteMathOp', array($this, $rule, $price, $this->_revert));
//vmdebug('result of plgVmInterpreteMathOp',$calculated);
if ($calculated) {
foreach ($calculated as $calc) {
if ($calc) {
return $calc;
}
}
} else {
VmError('Unrecognised mathop ' . $mathop . ' in calculation rule found, seems you created this rule with plugin not longer accesible (deactivated, uninstalled?)');
return $price;
}
}
}
示例4: checkSafePath
static function checkSafePath($safePath = 0)
{
if ($safePath == 0) {
$safePath = VmConfig::get('forSale_path', 0);
if (self::$tested) {
return $safePath;
}
}
$warn = FALSE;
$uri = JFactory::getURI();
$configlink = $uri->root() . 'administrator/index.php?option=com_virtuemart&view=config';
VmConfig::loadJLang('com_virtuemart');
if (empty($safePath)) {
$warn = 'COM_VIRTUEMART_WARN_NO_SAFE_PATH_SET';
} else {
//jimport('joomla.filesystem.folder');
if (!class_exists('JFolder')) {
require_once JPATH_VM_LIBRARIES . DS . 'joomla' . DS . 'filesystem' . DS . 'folder.php';
}
$exists = JFolder::exists($safePath);
if (!$exists) {
$warn = 'COM_VIRTUEMART_WARN_SAFE_PATH_WRONG';
} else {
if (!is_writable($safePath)) {
VmConfig::loadJLang('com_virtuemart_config');
VmError('COM_VIRTUEMART_WARN_SAFE_PATH_NOT_WRITEABLE', vmText::_('COM_VIRTUEMART_ADMIN_CFG_MEDIA_FORSALE_PATH'), $safePath, $configlink);
} else {
if (!is_writable(self::getInvoicePath($safePath))) {
VmConfig::loadJLang('com_virtuemart_config');
VmError('COM_VIRTUEMART_WARN_SAFE_PATH_INV_NOT_WRITEABLE', vmText::_('COM_VIRTUEMART_ADMIN_CFG_MEDIA_FORSALE_PATH'), $safePath, $configlink);
}
}
}
}
if ($warn) {
$suggestedPath = shopFunctions::getSuggestedSafePath();
VmConfig::loadJLang('com_virtuemart_config');
VmWarn($warn, vmText::_('COM_VIRTUEMART_ADMIN_CFG_MEDIA_FORSALE_PATH'), $suggestedPath, $configlink);
return FALSE;
}
return $safePath;
}
示例5: getViewData
/**
* @param $product
* @return array|null
*/
private function getViewData($product)
{
if (!class_exists('KlarnaAPI')) {
require JPATH_VMKLARNAPLUGIN . DS . 'klarna' . DS . 'helpers' . DS . 'klarnaapi.php';
}
if (!class_exists('VirtueMartModelCurrency')) {
require VMPATH_ADMIN . DS . 'models' . DS . 'currency.php';
}
$price = $product->prices['salesPrice'];
$country = $this->cData['country'];
$lang = $this->cData['language_code'];
$types = array(KlarnaPClass::CAMPAIGN, KlarnaPClass::ACCOUNT, KlarnaPClass::FIXED);
try {
$kCheckout = new KlarnaAPI($country, $lang, 'part', $price, KlarnaFlags::PRODUCT_PAGE, $this->klarna_virtuemart, $types, $this->path);
} catch (Exception $e) {
VmDebug('getViewData', 'Error in ' . __METHOD__ . ': ' . $e->getMessage(), $e->getCode());
VmError($e->getMessage(), 'getViewData' . 'Error in ' . __METHOD__ . ': ' . $e->getMessage(), $e->getCode());
return NULL;
}
$kCheckout->setCurrency($this->cData['currency']);
// TODO : Not top to get setup values here!
$this->settings = $kCheckout->getSetupValues();
if ($price > 0 && count($kCheckout->aPClasses) > 0) {
$currencydisplay = CurrencyDisplay::getInstance();
$sMonthDefault = NULL;
$sTableHtml = "";
$monthTable = array();
// either in vendor's currency, or shipTo Currency
$countryCurrencyId = $this->cData['virtuemart_currency_id'];
$currency = CurrencyDisplay::getInstance($countryCurrencyId);
$fromCurrency = $currency->getCurrencyForDisplay();
//$paymentCurrency = CurrencyDisplay::getInstance($this->cart->paymentCurrency);
//$totalInPaymentCurrency = $paymentCurrency->priceDisplay( $this->cart->cartPrices['billTotal'],$this->cart->paymentCurrency) ;
//$currencyDisplay = CurrencyDisplay::getInstance($this->cart->pricesCurrency);
$i = 0;
foreach ($kCheckout->aPClasses as $pclass) {
if ($sMonthDefault === NULL || $pclass['monthlyCost'] < $sMonthDefault) {
$sMonthDefault = $currency->priceDisplay($pclass['monthlyCost'], $countryCurrencyId);
}
if ($pclass['pclass']->getType() == KlarnaPClass::ACCOUNT) {
$pp_title = tsmText::_('VMPAYMENT_KLARNA_PPBOX_ACCOUNT');
} else {
$pp_title = $pclass['pclass']->getMonths() . " " . tsmText::_('VMPAYMENT_KLARNA_PPBOX_TH_MONTH');
}
$pp_price = $currency->priceDisplay($pclass['monthlyCost'], $countryCurrencyId);
$monthTable[$i] = array('pp_title' => html_entity_decode($pp_title), 'pp_price' => $pp_price, 'country' => $country);
$i++;
}
$cd = CurrencyDisplay::getInstance($fromCurrency);
$aInputValues = array();
$aInputValues['defaultMonth'] = $sMonthDefault;
$aInputValues['monthTable'] = $monthTable;
$aInputValues['eid'] = $this->cData['eid'];
$aInputValues['country'] = KlarnaCountry::getCode($country);
if ($country == KlarnaCountry::DE) {
$aInputValues['asterisk'] = '*';
} else {
$aInputValues['asterisk'] = '';
}
return $aInputValues;
}
return NULL;
}
示例6: plgVmOnSelectCheckPayment
//.........这里部分代码省略.........
$klarnaData_payment = "klarna_speccamp";
$sessionKlarna->klarna_option = 'spec';
} else {
return NULL;
}
// Store payment_method_id so we can activate the
// right payment in case something goes wrong.
$sessionKlarna->virtuemart_payment_method_id = $cart->virtuemart_paymentmethod_id;
$sessionKlarna->klarna_paymentmethod = $klarnaData_paymentmethod;
$this->_getCartAddressCountryCode($cart, $country3, $countryId, 'country_3_code');
// $country2= strtolower($country2);
if (empty($country3)) {
$country3 = "SWE";
$countryId = ShopFunctions::getCountryIDByName($country3);
}
$cData = KlarnaHandler::countryData($method, strtoupper($country3));
$klarnaData = KlarnaHandler::getDataFromEditPayment();
$klarnaData['country'] = $cData['country_code'];
//$country = $cData['country_code']; //KlarnaHandler::convertCountry($method, $country2);
//$lang = $cData['language_code']; //KlarnaHandler::getLanguageForCountry($method, $country);
// Get the correct data
//Removes spaces, tabs, and other delimiters.
// If it is a swedish customer we use the information from getAddress
if (strtolower($cData['country_code']) == "se") {
if (empty($klarnaData['socialNumber'])) {
VmInfo('VMPAYMENT_KLARNA_MUST_VALID_PNO');
return false;
}
$swedish_addresses = klarnaHandler::getAddresses($klarnaData['socialNumber'], $cData, $method);
if (empty($swedish_addresses)) {
VmInfo('VMPAYMENT_KLARNA_NO_GETADDRESS');
return false;
}
//This example only works for GA_GIVEN.
foreach ($swedish_addresses as $address) {
if ($address->isCompany) {
$klarnaData['company_name'] = $address->getCompanyName();
} else {
$klarnaData['first_name'] = $address->getFirstName();
$klarnaData['last_name'] = $address->getLastName();
}
$klarnaData['street'] = $address->getStreet();
$klarnaData['zip'] = $address->getZipCode();
$klarnaData['city'] = $address->getCity();
$klarnaData['country'] = $address->getCountryCode();
$countryId = $klarnaData['virtuemart_country_id'] = shopFunctions::getCountryIDByName($klarnaData['country']);
}
foreach ($klarnaData as $key => $value) {
$klarnaData[$key] = mb_convert_encoding($klarnaData[$key], 'UTF-8', 'ISO-8859-1');
}
} elseif (!KlarnaHandler::checkDataFromEditPayment($klarnaData)) {
//VmInfo('VMPAYMENT_KLARNA_MISSING_DATA');
//return false;
}
$st = $this->getCartAddress($cart, $address_type, true);
if ($address_type == 'BT') {
$prefix = '';
} else {
$prefix = 'shipto_';
}
// Update the Shipping Address to what is specified in the register.
$update_data = array($prefix . 'address_type_name' => 'Klarna', $prefix . 'company' => $klarnaData['company_name'], $prefix . 'first_name' => $klarnaData['first_name'], $prefix . 'middle_name' => $st['middle_name'], $prefix . 'last_name' => $klarnaData['last_name'], $prefix . 'address_1' => $klarnaData['street'], $prefix . 'address_2' => $klarnaData['house_ext'], $prefix . 'house_no' => $klarnaData['house_no'], $prefix . 'zip' => html_entity_decode($klarnaData['zip']), $prefix . 'city' => $klarnaData['city'], $prefix . 'virtuemart_country_id' => $countryId, $prefix . 'state' => '', $prefix . 'phone_1' => $klarnaData['phone'], $prefix . 'phone_2' => $st['phone_2'], $prefix . 'fax' => $st['fax'], $prefix . 'birthday' => empty($klarnaData['birthday']) ? $st['birthday'] : $klarnaData['birthday'], $prefix . 'social_number' => empty($klarnaData['pno']) ? $klarnaData['socialNumber'] : $klarnaData['pno'], 'address_type' => $address_type);
if ($address_type == 'BT') {
$update_data['email'] = $klarnaData['email'];
}
// save address in cart if different
// if (false) {
$cart->saveAddressInCart($update_data, $update_data['address_type'], true);
//vmdebug('plgVmOnSelectCheckPayment $cart',$cart);
//vmInfo(JText::_('VMPAYMENT_KLARNA_ADDRESS_UPDATED_NOTICE'));
// }
//}
// Store the Klarna data in a session variable so
// we can retrevie it later when we need it
//$klarnaData['pclass'] = ($klarnaData_paymentmethod == 'klarna_invoice' ? -1 : intval(JRequest::getVar($kIndex . "paymentPlan")));
$klarnaData['pclass'] = $klarnaData_paymentmethod == 'klarna_invoice' ? -1 : intval(JRequest::getVar("klarna_paymentPlan"));
$sessionKlarna->KLARNA_DATA = $klarnaData;
// 2 letters small
//$settings = KlarnaHandler::getCountryData($method, $cart_country2);
try {
$address = new KlarnaAddr($klarnaData['email'], $klarnaData['phone'], "", $klarnaData['first_name'], $klarnaData['last_name'], '', $klarnaData['street'], $klarnaData['zip'], $klarnaData['city'], $klarnaData['country'], $klarnaData['house_no'], $klarnaData['house_ext']);
} catch (Exception $e) {
VmInfo($e->getMessage());
return false;
//KlarnaHandler::redirectPaymentMethod('message', $e->getMessage());
}
if (isset($errors) && count($errors) > 0) {
$msg = JText::_('VMPAYMENT_KLARNA_ERROR_TITLE_1');
foreach ($errors as $error) {
$msg .= "<li> -" . $error . "</li>";
}
$msg .= JText::_('VMPAYMENT_KLARNA_ERROR_TITLE_2');
unset($errors);
VmError($msg);
return false;
//KlarnaHandler::redirectPaymentMethod('error', $msg);
}
$session->set('Klarna', serialize($sessionKlarna), 'vm');
return true;
}
示例7: portLanguageFields
private function portLanguageFields()
{
$config = JFactory::getConfig();
$lang = $config->getValue('language');
$ok = false;
foreach ($this->tables as $table => $tblKey) {
if (microtime(true) - $this->starttime >= $this->maxScriptTime) {
vmWarn('language fields not copied, please rise execution time and do again');
return false;
}
vmTime('$portLanguageFields $table ' . $table);
$db = JFactory::getDBO();
$tableName = '#__virtuemart_' . $table;
$className = 'Table' . ucfirst($table);
// if(!class_exists($className)) require(JPATH_VM_ADMINISTRATOR.DS.'tables'.DS.$table.'.php');
$langTable = $this->getTable($table);
// $langTable = new $className($tableName,$tblKey,$db) ;
$query = 'SHOW COLUMNS FROM `' . $tableName . '` ';
$this->_db->setQuery($query);
$columns = $this->_db->loadResultArray(0);
// vmdebug('$portLanguageFields contains language fields ',$columns);
$translatableFields = $langTable->getTranslatableFields();
$translatableFields = array_intersect($translatableFields, $columns);
// if(in_array($translatableFields[0],$columns)){
if (count($translatableFields) > 1) {
$ok = true;
//approximatly 100 products take a 1 MB
$maxItems = $this->_getMaxItems('Language ' . $table);
$startLimit = 0;
$i = 0;
$continue = true;
while ($continue) {
$q = 'SELECT * FROM ' . $tableName . ' LIMIT ' . $startLimit . ',' . $maxItems;
$this->_db->setQuery($q);
$res = self::loadCountListContinue($q, $startLimit, $maxItems, 'port Language ' . $table);
$resultList = $res[0];
$startLimit = $res[1];
$continue = $res[2];
foreach ($resultList as $row) {
if (microtime(true) - $this->starttime >= $this->maxScriptTime) {
vmWarn('language fields not copied, please rise execution time and do again');
return false;
}
$db = JFactory::getDBO();
// $dummy = array($tblKey=>$row[$tblKey]);
// $langTable = new $className($tableName,$tblKey,$db) ;
$langTable = $this->getTable($table);
$langTable->bindChecknStore($row);
$errors = $langTable->getErrors();
if (!empty($errors)) {
foreach ($errors as $error) {
$this->setError($error);
vmError('portLanguageFields' . $error);
vmdebug('portLanguageFields table', $langTable);
}
$ok = false;
break;
}
}
}
//Okey stuff copied, now lets remove the old fields
if ($ok) {
vmdebug('I delete the columns ');
foreach ($translatableFields as $fieldname) {
if (in_array($fieldname, $columns)) {
vmdebug('I delete the column ' . $tableName . ' ' . $fieldname);
$this->_db->setQuery('ALTER TABLE `' . $tableName . '` DROP COLUMN `' . $fieldname . '` ');
if (!$this->_db->query()) {
VmError('portLanguageFields: Deleting of ' . $tableName . ' ' . $fieldname . ' failed. ' . $this->_db->getQuery());
} else {
vmdebug('I deleted the column ' . $this->_db->getQuery());
}
}
}
}
}
vmTime('$portLanguageFields $table ' . $table);
}
}
示例8: getKlarna_pc_type
/**
* @static
* @return null|string
*/
static function getKlarna_pc_type()
{
$safePath = VmConfig::get('forSale_path', '');
if ($safePath) {
return $safePath . "klarna/klarna.json";
} else {
$uri = JFactory::getURI();
$link = $uri->root() . 'administrator/index.php?option=com_virtuemart&view=config';
VmError(vmText::sprintf('VMPAYMENT_KLARNA_CANNOT_STORE_CONFIG', '<a href="' . $link . '">' . $link . '</a>', vmText::_('COM_VIRTUEMART_ADMIN_CFG_MEDIA_FORSALE_PATH')));
return NULL;
}
}
示例9: checkSafePath
static function checkSafePath($sPath = 0)
{
static $safePath = null;
if (isset($safePath)) {
return $safePath;
}
if ($sPath == 0) {
$safePath = VmConfig::get('forSale_path', 0);
} else {
$safePath = $sPath;
}
$warn = false;
$uri = JFactory::getURI();
VmConfig::loadJLang('com_virtuemart');
if (empty($safePath)) {
$warn = 'COM_VIRTUEMART_WARN_NO_SAFE_PATH_SET';
} else {
if (!class_exists('JFolder')) {
require_once VMPATH_LIBS . DS . 'joomla' . DS . 'filesystem' . DS . 'folder.php';
}
$exists = JFolder::exists($safePath);
if (!$exists) {
$warn = 'COM_VIRTUEMART_WARN_SAFE_PATH_WRONG';
} else {
if (!is_writable($safePath)) {
VmConfig::loadJLang('com_virtuemart_config');
vmdebug('checkSafePath $safePath not writeable ' . $safePath);
VmError(vmText::sprintf('COM_VIRTUEMART_WARN_SAFE_PATH_INV_NOT_WRITEABLE', vmText::_('COM_VIRTUEMART_ADMIN_CFG_MEDIA_FORSALE_PATH'), $safePath), vmText::sprintf('COM_VIRTUEMART_WARN_SAFE_PATH_INV_NOT_WRITEABLE', '', ''));
} else {
if (!is_writable(self::getInvoicePath($safePath))) {
VmConfig::loadJLang('com_virtuemart_config');
vmdebug('checkSafePath $safePath/invoice not writeable ' . addslashes($safePath));
VmError(vmText::sprintf('COM_VIRTUEMART_WARN_SAFE_PATH_INV_NOT_WRITEABLE', vmText::_('COM_VIRTUEMART_ADMIN_CFG_MEDIA_FORSALE_PATH'), $safePath), vmText::sprintf('COM_VIRTUEMART_WARN_SAFE_PATH_INV_NOT_WRITEABLE', '', ''));
}
}
}
}
if ($warn) {
$safePath = false;
$suggestedPath = shopFunctions::getSuggestedSafePath();
$suggestedPath2 = VMPATH_ADMIN . DS . self::generateRandomString(12) . DS;
VmConfig::loadJLang('com_virtuemart_config');
$configlink = $uri->root() . 'administrator/index.php?option=com_virtuemart&view=config';
VmError(vmText::sprintf($warn, vmText::_('COM_VIRTUEMART_ADMIN_CFG_MEDIA_FORSALE_PATH'), $suggestedPath, $configlink, $suggestedPath2));
}
return $safePath;
}
示例10: cancelReservation
/**
*
*/
function cancelReservation($order, $payments)
{
$rno = $this->getReservationNumber($payments);
if (!$rno) {
return;
// error already sent
}
$this->initKlarnaParams($this->method);
$klarna = new Klarna_virtuemart();
$klarna->config($this->merchantid, $this->sharedsecret, $this->country_code_3, NULL, $this->currency_code_3, $this->mode, VMKLARNA_PC_TYPE, KlarnaHandler::getKlarna_pc_type(), $this->ssl);
$modelOrder = VmModel::getModel('orders');
try {
$result = $klarna->cancelReservation($rno);
$info = vmText::sprintf('VMPAYMENT_KLARNACHECKOUT_RESERVATION_CANCELED', $rno);
VmInfo($info);
$history = array();
$history['customer_notified'] = 1;
//$history['order_status'] = $this->method->checkout_complete;
$history['comments'] = $info;
// $order['details']['BT']->order_number);
$modelOrder->updateStatusForOneOrder($order->virtuemart_paymentmethod_id, $history, TRUE);
$dbValues['order_number'] = $payments[0]->order_number;
$dbValues['payment_name'] = '';
$dbValues['virtuemart_paymentmethod_id'] = $payments[0]->virtuemart_paymentmethod_id;
$dbValues['action'] = 'cancelReservation';
$dbValues['klarna_status'] = 'cancelReservation';
$dbValues['data'] = $info;
$this->debugLog($dbValues, 'storePSPluginInternalData cancelReservation', 'debug');
$values = $this->storePSPluginInternalData($dbValues, $this->_tablepkey);
} catch (Exception $e) {
$error = $e->getMessage();
VmError($e->getMessage(), vmText::sprintf('VMPAYMENT_KLARNACHECKOUT_ERROR_OCCURRED', $this->method->payment_name));
$this->debugLog($e->getMessage(), 'cancelReservation', 'error');
return FALSE;
}
//$dbValues['data'] = $vm_invoice_name;
return true;
}
示例11: createEncryptFolder
private static function createEncryptFolder($folderName)
{
//$folderName = self::_getEncryptSafepath ();
$exists = JFolder::exists($folderName);
if ($exists) {
return TRUE;
}
$created = JFolder::create($folderName);
if ($created) {
return TRUE;
}
$uri = JFactory::getURI();
$link = $uri->root() . 'administrator/index.php?option=com_virtuemart&view=config';
VmError(vmText::sprintf('COM_VIRTUEMART_CANNOT_STORE_CONFIG', $folderName, '<a href="' . $link . '">' . $link . '</a>', vmText::_('COM_VIRTUEMART_ADMIN_CFG_MEDIA_FORSALE_PATH')));
return FALSE;
}
示例12: loadConfig
/**
* Loads the configuration and works as singleton therefore called static. The call using the program cache
* is 10 times faster then taking from the session. The session is still approx. 30 times faster then using the file.
* The db is 10 times slower then the session.
*
* Performance:
*
* Fastest is
* Program Cache: 1.5974044799805E-5
* Session Cache: 0.00016094612121582
*
* First config db load: 0.00052118301391602
* Parsed and in session: 0.001554012298584
*
* After install from file: 0.0040450096130371
* Parsed and in session: 0.0051419734954834
*
*
* Functions tests if alread loaded in program cache, session cache, database and at last the file.
*
* Load the configuration values from the database into a session variable.
* This step is done to prevent accessing the database for every configuration variable lookup.
*
* @author Max Milbers
* @param $force boolean Forces the function to load the config from the db
*/
public function loadConfig($force = false)
{
vmSetStartTime('loadConfig');
if (!$force) {
if (!empty(self::$_jpConfig) && !empty(self::$_jpConfig->_params)) {
// vmTime('loadConfig Program Cache','loadConfig');
return self::$_jpConfig;
}
/* else {
$session = JFactory::getSession();
$vmConfig = $session->get('vmconfig','','vm');
if(!empty($vmConfig)){
$params = unserialize($vmConfig);
if(!empty($params)) {
//This is our cache valid time, atm I use 5 minutes, that means that for exampel changes at the config
//have at least 5 minutes later an effect of a currently logged in user (shopper)
// 5 minutes until the config settings takes effect for OTHER users.
$app = JFactory::getApplication();
$cacheenabled = $app->getCfg('caching');
$cachetime = $app->getCfg('cachetime');
if(!empty($cacheenabled) and !empty($params['sctime']) and (microtime(true) - $params['sctime'])<$cachetime) {
$params['offline_message'] = base64_decode($params['offline_message']);
// $params['dateformat'] = base64_decode($params['dateformat']);
self::$_jpConfig = new VmConfig();
self::$_jpConfig->_params = $params;
self::$_jpConfig->set('vmlang',self::setdbLanguageTag());
vmTime('loadConfig Session','loadConfig');
return self::$_jpConfig;
} else {
// VmInfo('empty $params->sctime');
}
}
}
} */
}
self::$_jpConfig = new VmConfig();
$db = JFactory::getDBO();
$query = 'SHOW TABLES LIKE "%virtuemart_configs%"';
$db->setQuery($query);
$configTable = $db->loadResult();
// self::$_debug = true;
if (empty($configTable)) {
self::$_jpConfig->installVMconfig();
}
$install = 'no';
if (empty(self::$_jpConfig->_raw)) {
$query = ' SELECT `config` FROM `#__virtuemart_configs` WHERE `virtuemart_config_id` = "1";';
$db->setQuery($query);
self::$_jpConfig->_raw = $db->loadResult();
if (empty(self::$_jpConfig->_raw)) {
if (self::installVMconfig()) {
$install = 'yes';
$db->setQuery($query);
self::$_jpConfig->_raw = $db->loadResult();
self::$_jpConfig->_params = null;
} else {
VmError('Error loading configuration file', 'Error loading configuration file, please contact the storeowner');
}
}
}
$i = 0;
$pair = array();
if (!empty(self::$_jpConfig->_raw)) {
$config = explode('|', self::$_jpConfig->_raw);
foreach ($config as $item) {
$item = explode('=', $item);
if (!empty($item[1])) {
// if($item[0]!=='offline_message' && $item[0]!=='dateformat' ){
if ($item[0] !== 'offline_message') {
//.........这里部分代码省略.........
示例13: checkOrderStatus
public static function checkOrderStatus($settings, $mode, $klarna_invoice_no)
{
try {
$klarna = new Klarna_virtuemart();
$klarna->config($settings['eid'], $settings['secret'], $settings['country'], $settings['language'], $settings['currency'], $mode, VMKLARNA_PC_TYPE, KlarnaHandler::getKlarna_pc_type(), true);
vmdebug('checkOrderStatus', $klarna);
$os = $klarna->checkOrderStatus($klarna_invoice_no, 0);
} catch (Exception $e) {
$msg = $e->getMessage() . ' #' . $e->getCode() . ' </br>';
VmError($msg);
return $msg;
}
//$os = self::getStatusForCode($os);
return $os;
}