예제 #1
0
 function displayErrors($errors)
 {
     foreach ($errors as $error) {
         vmError(vmText::sprintf('VMPAYMENT_SOFORT_ERROR_FROM', $error['message'], $error['field'], $error['code']));
         vmInfo(vmText::sprintf('VMPAYMENT_SOFORT_ERROR_FROM', $error['message'], $error['field'], $error['code']));
         if ($error['message'] == 401) {
             vmdebug('check you payment parameters: custom_id, project_id, api key');
         }
     }
 }
예제 #2
0
 function onCheckoutCheckDataPayment(VirtueMartCart $cart)
 {
     static $displayInfoMsg = true;
     if ($cart->BT) {
         if (empty($cart->BT['phone_1']) and empty($cart->BT['phone_2']) and $displayInfoMsg) {
             vmInfo(vmText::sprintf('VMPAYMENT_KLIKANDPAY_SUBSCRIBE_TEL_REQUIRED', JRoute::_('index.php?option=com_virtuemart&view=user&task=editaddresscheckout&addrtype=BT')));
             $return = false;
         }
     }
     $displayInfoMsg = false;
     return $return;
 }
 function checkManufacturer($categoryId = 0)
 {
     if ($categoryId > 0) {
         $db = JFactory::getDBO();
         $q = 'SELECT count(*)' . ' FROM #__virtuemart_manufacturers' . ' WHERE virtuemart_manufacturercategories_id = ' . $categoryId;
         $db->setQuery($q);
         $mCount = $db->loadResult();
         if ($mCount > 0) {
             vmInfo('COM_VIRTUEMART_REMOVE_IN_USE');
             return false;
         }
     }
     return true;
 }
 function getNewStatus($method)
 {
     vmInfo(JText::_('Paga+Tarde: Pedido en estado "Pending"'));
     if (isset($method->status_pending) and $method->status_pending != "") {
         return $method->status_pending;
     } else {
         // $StatutWhiteList = array('P','C','X','R','S','N');
         return 'P';
         //PENDING
         //return 'X';  //CANCELLED
         //return 'R';  //REFUNDED
         //return 'C';  //CONFIRMED
     }
 }
예제 #5
0
파일: paypal.php 프로젝트: SeventF/ikea.com
 /**
  * @param $cart
  * @param $order
  * @return bool|null
  */
 function plgVmConfirmedOrder($cart, $order)
 {
     if (!($method = $this->getVmPluginMethod($order['details']['BT']->virtuemart_paymentmethod_id))) {
         return NULL;
         // Another method was selected, do nothing
     }
     if (!$this->selectedThisElement($method->payment_element)) {
         return FALSE;
     }
     $session = JFactory::getSession();
     $return_context = $session->getId();
     $this->_debug = $method->debug;
     $this->logInfo('plgVmConfirmedOrder order number: ' . $order['details']['BT']->order_number, 'message');
     if (!class_exists('VirtueMartModelOrders')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.php';
     }
     if (!class_exists('VirtueMartModelCurrency')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'currency.php';
     }
     $address = isset($order['details']['ST']) ? $order['details']['ST'] : $order['details']['BT'];
     if (!class_exists('TableVendors')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'tables' . DS . 'vendors.php';
     }
     $vendorModel = VmModel::getModel('Vendor');
     $vendorModel->setId(1);
     $vendor = $vendorModel->getVendor();
     $vendorModel->addImages($vendor, 1);
     $this->getPaymentCurrency($method);
     $email_currency = $this->getEmailCurrency($method);
     $currency_code_3 = shopFunctions::getCurrencyByID($method->payment_currency, 'currency_code_3');
     $paymentCurrency = CurrencyDisplay::getInstance($method->payment_currency);
     $totalInPaymentCurrency = round($paymentCurrency->convertCurrencyTo($method->payment_currency, $order['details']['BT']->order_total, FALSE), 2);
     $cd = CurrencyDisplay::getInstance($cart->pricesCurrency);
     if ($totalInPaymentCurrency <= 0) {
         vmInfo(JText::_('VMPAYMENT_PAYPAL_PAYMENT_AMOUNT_INCORRECT'));
         return FALSE;
     }
     $merchant_email = $this->_getMerchantEmail($method);
     if (empty($merchant_email)) {
         vmInfo(JText::_('VMPAYMENT_PAYPAL_MERCHANT_EMAIL_NOT_SET'));
         return FALSE;
     }
     $quantity = 0;
     foreach ($cart->products as $key => $product) {
         $quantity = $quantity + $product->quantity;
     }
     $post_variables = array('cmd' => '_ext-enter', 'redirect_cmd' => '_xclick', 'upload' => '1', 'business' => $merchant_email, 'receiver_email' => $merchant_email, 'order_number' => $order['details']['BT']->order_number, "invoice" => $order['details']['BT']->order_number, 'custom' => $return_context, 'item_name' => JText::_('VMPAYMENT_PAYPAL_ORDER_NUMBER') . ': ' . $order['details']['BT']->order_number, "amount" => $totalInPaymentCurrency, "currency_code" => $currency_code_3, "address_override" => isset($method->address_override) ? $method->address_override : 0, "first_name" => $address->first_name, "last_name" => $address->last_name, "address1" => $address->address_1, "address2" => isset($address->address_2) ? $address->address_2 : '', "zip" => $address->zip, "city" => $address->city, "state" => isset($address->virtuemart_state_id) ? ShopFunctions::getStateByID($address->virtuemart_state_id, 'state_2_code') : '', "country" => ShopFunctions::getCountryByID($address->virtuemart_country_id, 'country_2_code'), "email" => $order['details']['BT']->email, "night_phone_b" => $address->phone_1, "return" => substr(JURI::root(false, ''), 0, -1) . JROUTE::_('index.php?option=com_virtuemart&view=pluginresponse&task=pluginresponsereceived&on=' . $order['details']['BT']->order_number . '&pm=' . $order['details']['BT']->virtuemart_paymentmethod_id . '&Itemid=' . JRequest::getInt('Itemid'), false), "notify_url" => substr(JURI::root(false, ''), 0, -1) . JROUTE::_('index.php?option=com_virtuemart&view=pluginresponse&task=pluginnotification&tmpl=component', false), "cancel_return" => substr(JURI::root(false, ''), 0, -1) . JROUTE::_('index.php?option=com_virtuemart&view=pluginresponse&task=pluginUserPaymentCancel&on=' . $order['details']['BT']->order_number . '&pm=' . $order['details']['BT']->virtuemart_paymentmethod_id . '&Itemid=' . JRequest::getInt('Itemid'), false), "ipn_test" => $method->debug, "rm" => '2', "bn" => "VirtueMart_Cart_PPA", "image_url" => JURI::root() . $vendor->images[0]->file_url, "no_shipping" => isset($method->no_shipping) ? $method->no_shipping : 0, "no_note" => "1");
     /*
      $i = 1;
      foreach ($cart->products as $key => $product) {
      $post_variables["item_name_" . $i] = substr(strip_tags($product->product_name), 0, 127);
      $post_variables["item_number_" . $i] = $i;
      $post_variables["amount_" . $i] = $cart->pricesUnformatted[$key]['salesPrice'];
      $post_variables["quantity_" . $i] = $product->quantity;
      $i++;
      }
      if ($cart->pricesUnformatted ['shipmentValue']) {
      $post_variables["item_name_" . $i] = JText::_('VMPAYMENT_PAYPAL_SHIPMENT_PRICE');
      $post_variables["item_number_" . $i] = $i;
      $post_variables["amount_" . $i] = $cart->pricesUnformatted ['shipmentValue'];
      $post_variables["quantity_" . $i] = 1;
      $i++;
      }
      if ($cart->pricesUnformatted ['paymentValue']) {
      $post_variables["item_name_" . $i] = JText::_('VMPAYMENT_PAYPAL_PAYMENT_PRICE');
      $post_variables["item_number_" . $i] = $i;
      $post_variables["amount_" . $i] = $cart->pricesUnformatted ['paymentValue'];
      $post_variables["quantity_" . $i] = 1;
      $i++;
      }
      if (!empty($order->cart->coupon)) {
      $post_variables["discount_amount_cart"] = $cart->pricesUnformatted['discountAmount'];
      }
     */
     // Prepare data that should be stored in the database
     $dbValues['order_number'] = $order['details']['BT']->order_number;
     $dbValues['payment_name'] = $this->renderPluginName($method, $order);
     $dbValues['virtuemart_paymentmethod_id'] = $cart->virtuemart_paymentmethod_id;
     $dbValues['paypal_custom'] = $return_context;
     $dbValues['cost_per_transaction'] = $method->cost_per_transaction;
     $dbValues['cost_percent_total'] = $method->cost_percent_total;
     $dbValues['payment_currency'] = $method->payment_currency;
     $dbValues['email_currency'] = $email_currency;
     $dbValues['payment_order_total'] = $totalInPaymentCurrency;
     $dbValues['tax_id'] = $method->tax_id;
     $this->storePSPluginInternalData($dbValues);
     $url = $this->_getPaypalUrlHttps($method);
     // add spin image
     $html = '<html><head><title>Redirection</title></head><body><div style="margin: auto; text-align: center;">';
     $html .= '<form action="' . "https://" . $url . '" method="post" name="vm_paypal_form"  accept-charset="UTF-8">';
     $html .= '<input type="submit"  value="' . JText::_('VMPAYMENT_PAYPAL_REDIRECT_MESSAGE') . '" />';
     $html .= '<input type="hidden" name="charset" value="utf-8">';
     foreach ($post_variables as $name => $value) {
         $html .= '<input type="hidden" name="' . $name . '" value="' . htmlspecialchars($value) . '" />';
     }
     $html .= '</form>';
     $html .= ' <script type="text/javascript">';
     $html .= ' document.vm_paypal_form.submit();';
     $html .= ' </script></body></html>';
     // 	2 = don't delete the cart, don't send email and don't redirect
     $cart->_confirmDone = FALSE;
     $cart->_dataValidated = FALSE;
     $cart->setCartIntoSession();
     JRequest::setVar('html', $html);
     /*
     
      $qstring = '?';
      foreach ($post_variables AS $k => $v) {
      $qstring .= ( empty($qstring) ? '' : '&')
      . urlencode($k) . '=' . urlencode($v);
      }
      // we can display the logo, or do the redirect
      $mainframe = JFactory::getApplication();
      $mainframe->redirect("https://" . $url . $qstring);
     
     
      return false; // don't delete the cart, don't send email
     */
 }
예제 #6
0
 public function checkPathCreateFolders($path)
 {
     $elements = explode(DS, $path);
     $examine = JPATH_ROOT;
     foreach ($elements as $piece) {
         $examine = $examine . DS . $piece;
         if (!JFolder::exists($examine)) {
             JFolder::create($examine);
             vmInfo('create folder for resized image ' . $examine);
         }
     }
 }
예제 #7
0
 /**
  * Update an order status
  *
  * @author Max Milbers
  */
 public function updatestatus()
 {
     $app = Jfactory::getApplication();
     $lastTask = vRequest::getCmd('last_task');
     /* Load the view object */
     $view = $this->getView('orders', 'html');
     if (!$this->getPermOrderStatus()) {
         vmInfo('Restricted');
         $view->display();
         return true;
     }
     /* Update the statuses */
     $model = VmModel::getModel('orders');
     if ($lastTask == 'updatestatus') {
         // single order is in POST but we need an array
         $order = array();
         $virtuemart_order_id = vRequest::getInt('virtuemart_order_id');
         $order[$virtuemart_order_id] = vRequest::getRequest();
         $result = $model->updateOrderStatus($order);
     } else {
         $result = $model->updateOrderStatus();
     }
     $msg = '';
     if ($result['updated'] > 0) {
         $msg = vmText::sprintf('COM_VIRTUEMART_ORDER_UPDATED_SUCCESSFULLY', $result['updated']);
     } else {
         if ($result['error'] == 0) {
             $msg .= vmText::_('COM_VIRTUEMART_ORDER_NOT_UPDATED');
         }
     }
     if ($result['error'] > 0) {
         $msg .= vmText::sprintf('COM_VIRTUEMART_ORDER_NOT_UPDATED_SUCCESSFULLY', $result['error'], $result['total']);
     }
     if ('updatestatus' == $lastTask) {
         $app->redirect('index.php?option=com_virtuemart&view=orders&task=edit&virtuemart_order_id=' . $virtuemart_order_id, $msg);
     } else {
         $app->redirect('index.php?option=com_virtuemart&view=orders', $msg);
     }
 }
예제 #8
0
 /**
  * Delete a stored card
  * To remove a card from the RealVault system
  */
 function updateStoredCards($card_ids)
 {
     $user = JFactory::getUser();
     $db = JFactory::getDBO();
     foreach ($card_ids as $card_id) {
         JLoader::import('joomla.plugin.helper');
         JPluginHelper::importPlugin('vmpayment');
         $app = JFactory::getApplication();
         $storedCC = $this->getStoredCCInfo($card_id);
         $updatedCCname = vRequest::getString('cc_name_' . $card_id);
         $updatedYear = vRequest::getInt('cc_expire_year_' . $card_id);
         $updatedMonth = vRequest::getInt('cc_expire_month_' . $card_id);
         $expDate = $this->explodeExpDate($storedCC['realex_hpp_api_saved_pmt_expdate']);
         if ($storedCC['realex_hpp_api_saved_pmt_name'] == $updatedCCname and $expDate['yy'] == $updatedYear and $expDate['mm'] == $updatedMonth) {
             continue;
         } else {
             $storedCC['realex_hpp_api_saved_pmt_name'] = $updatedCCname;
             $storedCC['realex_hpp_api_saved_pmt_expdate'] = $updatedMonth . $updatedYear;
         }
         $success = false;
         // the trigger will send the card-cancel-card to Releax
         $app->triggerEvent('plgVmOnRealexUpdateStoredCard', array('realex_hpp_api', $storedCC, &$success));
         if ($success) {
             $query = 'UPDATE  `' . $this->_tablename . '` SET `realex_hpp_api_saved_pmt_name`="' . $storedCC['realex_hpp_api_saved_pmt_name'] . '" , `realex_hpp_api_saved_pmt_expdate`="' . $storedCC['realex_hpp_api_saved_pmt_expdate'] . '" WHERE `id`=' . $card_id . ' AND `virtuemart_user_id`=' . $storedCC['virtuemart_user_id'];
             $db->setQuery($query);
             $db->query();
             vmInfo(vmText::sprintf('VMUSERFIELD_REALEX_HPP_API_CARD_UPDATED', $storedCC['realex_hpp_api_saved_pmt_name'], $storedCC['realex_hpp_api_saved_pmt_digits'], $updatedMonth, $updatedYear));
         } else {
             $vendorId = 1;
             $vendor_link = JRoute::_('index.php?option=com_virtuemart&view=vendor&layout=contact&virtuemart_vendor_id=' . $vendorId);
             vmInfo(vmText::sprintf('VMUSERFIELD_REALEX_HPP_API_CARD_NOT_UPDATED', $storedCC['realex_hpp_api_saved_pmt_name'], $storedCC['realex_hpp_api_saved_pmt_digits'], $updatedMonth, $updatedYear, $vendor_link));
         }
     }
 }
예제 #9
0
 function loadCountListContinue($q, $startLimit, $maxItems, $msg)
 {
     $continue = true;
     $this->_db->setQuery($q);
     if (!$this->_db->execute()) {
         vmError($msg . ' db error ' . $this->_db->getErrorMsg());
         vmError($msg . ' db error ' . $this->_db->getQuery());
         $entries = array();
         $continue = false;
     } else {
         $entries = $this->_db->loadAssocList();
         $count = count($entries);
         vmInfo($msg . ' found ' . $count . ' vm1 entries for migration ');
         $startLimit += $maxItems;
         if ($count < $maxItems) {
             $continue = false;
         }
     }
     return array($entries, $startLimit, $continue);
 }
예제 #10
0
	/**
	 * @param $cart
	 * @param $order
	 * @return bool|null
	 */
	function plgVmConfirmedOrder ($cart, $order) {

		if (!($method = $this->getVmPluginMethod ($order['details']['BT']->virtuemart_paymentmethod_id))) {
			return NULL; // Another method was selected, do nothing
		}
		if (!$this->selectedThisElement ($method->payment_element)) {
			return FALSE;
		}
		$session = JFactory::getSession ();
		$return_context = $session->getId ();
		$this->_debug = $method->debug;
		$this->logInfo ('plgVmConfirmedOrder order number: ' . $order['details']['BT']->order_number, 'message');

		if (!class_exists ('VirtueMartModelOrders')) {
			require(JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.php');
		}
		if (!class_exists ('VirtueMartModelCurrency')) {
			require(JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'currency.php');
		}

		$address = ((isset($order['details']['ST'])) ? $order['details']['ST'] : $order['details']['BT']);

		if (!class_exists ('TableVendors')) {
			require(JPATH_VM_ADMINISTRATOR . DS . 'table' . DS . 'vendors.php');
		}
		$vendorModel = VmModel::getModel ('Vendor');
		$vendorModel->setId (1);
		$vendor = $vendorModel->getVendor ();
		$vendorModel->addImages ($vendor, 1);
		$this->getPaymentCurrency ($method);
		$q = 'SELECT `currency_code_3` FROM `#__virtuemart_currencies` WHERE `virtuemart_currency_id`="' . $method->payment_currency . '" ';
		$db = JFactory::getDBO ();
		$db->setQuery ($q);
		$currency_code_3 = $db->loadResult ();

		$paymentCurrency = CurrencyDisplay::getInstance ($method->payment_currency);
		$totalInPaymentCurrency = round ($paymentCurrency->convertCurrencyTo ($method->payment_currency, $order['details']['BT']->order_total, FALSE), 2);
		$cd = CurrencyDisplay::getInstance ($cart->pricesCurrency);
		if ($totalInPaymentCurrency <= 0) {
			vmInfo (JText::_ ('VMPAYMENT_PAYPAL_PAYMENT_AMOUNT_INCORRECT'));
			return FALSE;
		}
		$merchant_email = $this->_getMerchantEmail ($method);
		if (empty($merchant_email)) {
			vmInfo (JText::_ ('VMPAYMENT_PAYPAL_MERCHANT_EMAIL_NOT_SET'));
			return FALSE;
		}

		$post_variables = Array(
			'cmd'              => '_ext-enter',
			'redirect_cmd'     => '_xclick',
			'upload'           => '1', //Indicates the use of third-party shopping cart
			'business'         => $merchant_email, //Email address or account ID of the payment recipient (i.e., the merchant).
			'receiver_email'   => $merchant_email, //Primary email address of the payment recipient (i.e., the merchant
			'order_number'     => $order['details']['BT']->order_number,
			"invoice"          => $order['details']['BT']->order_number,
			'custom'           => $return_context,
			'item_name'        => JText::_ ('VMPAYMENT_PAYPAL_ORDER_NUMBER') . ': ' . $order['details']['BT']->order_number,
			"amount"           => $totalInPaymentCurrency,
			"currency_code"    => $currency_code_3,
			/*
					 * 1 – L'adresse spécifiée dans les variables pré-remplies remplace l'adresse de livraison enregistrée auprès de PayPal.
					 * Le payeur voit l'adresse qui est transmise mais ne peut pas la modifier.
					 * Aucune adresse n'est affichée si l'adresse n'est pas valable
					 * (par exemple si des champs requis, tel que le pays, sont manquants) ou pas incluse.
					 * Valeurs autorisées : 0, 1. Valeur par défaut : 0
					 */
			"address_override" => isset($method->address_override) ? $method->address_override : 0, // 0 ??   Paypal does not allow your country of residence to ship to the country you wish to
			"first_name"       => $address->first_name,
			"last_name"        => $address->last_name,
			"address1"         => $address->address_1,
			"address2"         => isset($address->address_2) ? $address->address_2 : '',
			"zip"              => $address->zip,
			"city"             => $address->city,
			"state"            => isset($address->virtuemart_state_id) ? ShopFunctions::getStateByID ($address->virtuemart_state_id) : '',
			"country"          => ShopFunctions::getCountryByID ($address->virtuemart_country_id, 'country_2_code'),
			"email"            => $order['details']['BT']->email,
			"night_phone_b"    => $address->phone_1,
			"return"           => JROUTE::_ (JURI::root () . 'index.php?option=com_virtuemart&view=pluginresponse&task=pluginresponsereceived&on=' . $order['details']['BT']->order_number . '&pm=' . $order['details']['BT']->virtuemart_paymentmethod_id . '&Itemid=' . JRequest::getInt ('Itemid')),
			// Keep this line, needed when testing
			//"return" => JROUTE::_(JURI::root() . 'index.php?option=com_virtuemart&view=pluginresponse&task=pluginnotification&tmpl=component'),
			"notify_url"       => JROUTE::_ (JURI::root () . 'index.php?option=com_virtuemart&view=pluginresponse&task=pluginnotification&tmpl=component'),
			"cancel_return"    => JROUTE::_ (JURI::root () . 'index.php?option=com_virtuemart&view=pluginresponse&task=pluginUserPaymentCancel&on=' . $order['details']['BT']->order_number . '&pm=' . $order['details']['BT']->virtuemart_paymentmethod_id . '&Itemid=' . JRequest::getInt ('Itemid')),
			//"undefined_quantity" => "0",
			"ipn_test"         => $method->debug,
			"rm"               => '2', // the buyer’s browser is redirected to the return URL by using the POST method, and all payment variables are included
			//"pal" => "NRUBJXESJTY24",
			"image_url"        => JURI::root () . $vendor->images[0]->file_url,
			"no_shipping"      => isset($method->no_shipping) ? $method->no_shipping : 0,
			"no_note"          => "1");


		/*
			  $i = 1;
			  foreach ($cart->products as $key => $product) {
			  $post_variables["item_name_" . $i] = substr(strip_tags($product->product_name), 0, 127);
			  $post_variables["item_number_" . $i] = $i;
			  $post_variables["amount_" . $i] = $cart->pricesUnformatted[$key]['salesPrice'];
			  $post_variables["quantity_" . $i] = $product->quantity;
			  $i++;
			  }
			  if ($cart->pricesUnformatted ['shipmentValue']) {
			  $post_variables["item_name_" . $i] = JText::_('VMPAYMENT_PAYPAL_SHIPMENT_PRICE');
			  $post_variables["item_number_" . $i] = $i;
			  $post_variables["amount_" . $i] = $cart->pricesUnformatted ['shipmentValue'];
			  $post_variables["quantity_" . $i] = 1;
			  $i++;
			  }
			  if ($cart->pricesUnformatted ['paymentValue']) {
			  $post_variables["item_name_" . $i] = JText::_('VMPAYMENT_PAYPAL_PAYMENT_PRICE');
			  $post_variables["item_number_" . $i] = $i;
			  $post_variables["amount_" . $i] = $cart->pricesUnformatted ['paymentValue'];
			  $post_variables["quantity_" . $i] = 1;
			  $i++;
			  }
			  if (!empty($order->cart->coupon)) {
			  $post_variables["discount_amount_cart"] = $cart->pricesUnformatted['discountAmount'];
			  }
			 */

		// Prepare data that should be stored in the database
		$dbValues['order_number'] = $order['details']['BT']->order_number;
		$dbValues['payment_name'] = $this->renderPluginName ($method, $order);
		$dbValues['virtuemart_paymentmethod_id'] = $cart->virtuemart_paymentmethod_id;
		$dbValues['paypal_custom'] = $return_context;
		$dbValues['cost_per_transaction'] = $method->cost_per_transaction;
		$dbValues['cost_percent_total'] = $method->cost_percent_total;
		$dbValues['payment_currency'] = $method->payment_currency;
		$dbValues['payment_order_total'] = $totalInPaymentCurrency;
		$dbValues['tax_id'] = $method->tax_id;
		$this->storePSPluginInternalData ($dbValues);

		$url = $this->_getPaypalUrlHttps ($method);

		// add spin image
		$html = '<html><head><title>Redirection</title></head><body><div style="margin: auto; text-align: center;">';
		$html .= '<form action="' . "https://" . $url . '" method="post" name="vm_paypal_form" >';
		$html .= '<input type="submit"  value="' . JText::_ ('VMPAYMENT_PAYPAL_REDIRECT_MESSAGE') . '" />';
		foreach ($post_variables as $name => $value) {
			$html .= '<input type="hidden" name="' . $name . '" value="' . htmlspecialchars ($value) . '" />';
		}
		$html .= '</form></div>';
		$html .= ' <script type="text/javascript">';
		$html .= ' document.vm_paypal_form.submit();';
		$html .= ' </script></body></html>';

		// 	2 = don't delete the cart, don't send email and don't redirect
		$cart->_confirmDone = FALSE;
		$cart->_dataValidated = FALSE;
		$cart->setCartIntoSession ();
		JRequest::setVar ('html', $html);

		/*

			  $qstring = '?';
			  foreach ($post_variables AS $k => $v) {
			  $qstring .= ( empty($qstring) ? '' : '&')
			  . urlencode($k) . '=' . urlencode($v);
			  }
			  // we can display the logo, or do the redirect
			  $mainframe = JFactory::getApplication();
			  $mainframe->redirect("https://" . $url . $qstring);


			  return false; // don't delete the cart, don't send email
			 */
	}
예제 #11
0
 /**
  * @author Max Milbers
  * @param
  */
 function check()
 {
     if (!empty($this->_slugAutoName)) {
         $slugAutoName = $this->_slugAutoName;
         $slugName = $this->_slugName;
         if (in_array($slugAutoName, $this->_translatableFields)) {
             $checkTable = $this->_tbl . '_' . VMLANG;
         } else {
             $checkTable = $this->_tbl;
         }
         if (empty($this->{$slugName})) {
             // 				vmdebug('table check use _slugAutoName '.$slugAutoName.' '.$slugName);
             if (!empty($this->{$slugAutoName})) {
                 $this->{$slugName} = $this->{$slugAutoName};
             } else {
                 vmError('VmTable ' . $checkTable . ' Check not passed. Neither slug nor obligatory value at ' . $slugAutoName . ' for auto slug creation is given');
                 return false;
             }
         }
         //if (!class_exists('VmMediaHandler')) require(JPATH_VM_ADMINISTRATOR.DS.'helpers'.DS.'mediahandler.php');
         //vmdebug('check $slug before stringURLSafe',$this->$slugName);
         //$this->$slugName = vmFile::makeSafe( $this->$slugName );
         //$lang = JFactory::getLanguage();
         //$this->$slugName = $lang->transliterate($this->$slugName);
         if (JVM_VERSION === 1) {
             $this->{$slugName} = JFilterOutput::stringURLSafe($this->{$slugName});
         } else {
             $this->{$slugName} = JApplication::stringURLSafe($this->{$slugName});
         }
         $valid = $this->checkCreateUnique($checkTable, $slugName);
         if (!$valid) {
             return false;
         }
     }
     foreach ($this->_obkeys as $obkeys => $error) {
         if (empty($this->{$obkeys})) {
             if (empty($error)) {
                 $error = 'Serious error cant save ' . $this->_tbl . ' without ' . $obkeys;
             } else {
                 //	$error = get_class($this).' '.JText::_($error);
                 $error = get_class($this) . ' ' . $error;
             }
             $this->setError($error);
             vmError($error);
             return false;
         }
     }
     if ($this->_unique) {
         if (empty($this->_db)) {
             $this->_db = JFactory::getDBO();
         }
         foreach ($this->_unique_name as $obkeys => $error) {
             if (empty($this->{$obkeys})) {
                 // 					vmError(JText::sprintf('COM_VIRTUEMART_NON_UNIQUE_KEY',$this->$obkeys));
                 $this->setError($error);
                 vmError('Non unique ' . $this->_unique_name . ' ' . $error);
                 return false;
             } else {
                 $valid = $this->checkCreateUnique($this->_tbl, $obkeys);
                 if (!$valid) {
                     return false;
                 }
             }
         }
     }
     if (isset($this->virtuemart_vendor_id)) {
         $multix = Vmconfig::get('multix', 'none');
         //Lets check if the user is admin or the mainvendor
         if (!class_exists('Permissions')) {
             require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'permissions.php';
         }
         $virtuemart_vendor_id = false;
         if ($multix == 'none' and get_class($this) !== 'TableVmusers') {
             $this->virtuemart_vendor_id = 1;
         } else {
             $loggedVendorId = Permissions::getInstance()->isSuperVendor();
             $admin = Permissions::getInstance()->check('admin');
             $tbl_key = $this->_tbl_key;
             if (get_class($this) !== 'TableVmusers') {
                 $q = 'SELECT `virtuemart_vendor_id` FROM `' . $this->_tbl . '` WHERE `' . $this->_tbl_key . '`=' . $this->{$tbl_key};
                 $this->_db->setQuery($q);
                 $virtuemart_vendor_id = $this->_db->loadResult();
             } else {
                 $q = 'SELECT `virtuemart_vendor_id`,`user_is_vendor` FROM `' . $this->_tbl . '` WHERE `' . $this->_tbl_key . '`=' . $this->{$tbl_key};
                 $this->_db->setQuery($q);
                 $vmuser = $this->_db->loadRow();
                 if ($vmuser and count($vmuser) === 2) {
                     $virtuemart_vendor_id = $vmuser[0];
                     $user_is_vendor = $vmuser[1];
                     if ($multix == 'none') {
                         if (empty($user_is_vendor)) {
                             $this->virtuemart_vendor_id = 0;
                         } else {
                             $this->virtuemart_vendor_id = 1;
                         }
                         return true;
                     } else {
                         if (!$admin) {
                             $this->virtuemart_vendor_id = $loggedVendorId;
                             return true;
                         }
                     }
                 }
             }
             if (!$admin and !empty($virtuemart_vendor_id) and !empty($loggedVendorId) and $loggedVendorId != $virtuemart_vendor_id) {
                 //vmWarn('COM_VIRTUEMART_NOT_SAME_VENDOR',$loggedVendorId,$virtuemart_vendor_id
                 //vmWarn('Stop try to hack this store, you got logged');
                 vmdebug('Hacking attempt stopped, logged vendor ' . $loggedVendorId . ' but data belongs to ' . $virtuemart_vendor_id);
                 return false;
             } else {
                 if (!$admin) {
                     if ($virtuemart_vendor_id) {
                         $this->virtuemart_vendor_id = $virtuemart_vendor_id;
                         vmdebug('Non admin is storing using loaded vendor_id');
                     } else {
                         //No id is stored, even users are allowed to use for the storage and vendorId, no change
                     }
                 } else {
                     if (!empty($virtuemart_vendor_id) and $loggedVendorId != $virtuemart_vendor_id) {
                         vmInfo('Admin with vendor id ' . $loggedVendorId . ' is using for storing vendor id ' . $this->virtuemart_vendor_id);
                         vmdebug('Admin with vendor id ' . $loggedVendorId . ' is using for storing vendor id ' . $this->virtuemart_vendor_id);
                         $this->virtuemart_vendor_id = $virtuemart_vendor_id;
                     }
                 }
             }
         }
         //tables to consider for multivendor
         //if(get_class($this)!== 'TableOrders' and get_class($this)!== 'TableInvoices' and get_class($this)!== 'TableOrder_items'){
     }
     return true;
 }
예제 #12
0
 function getCartAddress($cart, &$type, $STsameAsBT = true)
 {
     if (VMKLARNA_SHIPTO_SAME_AS_BILLTO) {
         $st = $cart->BT;
         $type = 'BT';
         if ($STsameAsBT and $cart->ST and !$cart->STsameAsBT) {
             vmInfo(JText::_('VMPAYMENT_KLARNA_SHIPTO_SAME_AS_BILLTO'));
             $cart->STsameAsBT = 1;
             $cart->setCartIntoSession();
         }
     } elseif ($cart->BT == 0 or empty($cart->BT)) {
         $st = $cart->BT;
         $type = 'BT';
     } else {
         $st = $cart->ST;
         $type = 'ST';
     }
     return $st;
 }
예제 #13
0
 private function checkShipmentMethodsConfigured()
 {
     //For the selection of the shipment method we need the total amount to pay.
     $shipmentModel = VmModel::getModel('Shipmentmethod');
     $shipments = $shipmentModel->getShipments();
     if (empty($shipments)) {
         $text = '';
         if (!class_exists('Permissions')) {
             require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'permissions.php';
         }
         if (Permissions::getInstance()->check("admin,storeadmin")) {
             $uri = JFactory::getURI();
             $link = $uri->root() . 'administrator/index.php?option=com_virtuemart&view=shipmentmethod';
             $text = JText::sprintf('COM_VIRTUEMART_NO_SHIPPING_METHODS_CONFIGURED_LINK', '<a href="' . $link . '">' . $link . '</a>');
         }
         vmInfo('COM_VIRTUEMART_NO_SHIPPING_METHODS_CONFIGURED', $text);
         $tmp = 0;
         $this->assignRef('found_shipment_method', $tmp);
         return false;
     }
     return true;
 }
예제 #14
0
파일: config.php 프로젝트: romuland/khparts
 /**
  *
  * @author Oscar van Eijk
  * @author Max Milbers
  */
 function readConfigFile($returnDangerousTools)
 {
     $_datafile = JPATH_VM_ADMINISTRATOR . DS . 'virtuemart.cfg';
     if (!file_exists($_datafile)) {
         if (file_exists(JPATH_VM_ADMINISTRATOR . DS . 'virtuemart_defaults.cfg-dist')) {
             if (!class_exists('JFile')) {
                 require JPATH_VM_LIBRARIES . DS . 'joomla' . DS . 'filesystem' . DS . 'file.php';
             }
             JFile::copy('virtuemart_defaults.cfg-dist', 'virtuemart.cfg', JPATH_VM_ADMINISTRATOR);
         } else {
             JError::raiseWarning(500, 'The data file with the default configuration could not be found. You must configure the shop manually.');
             return FALSE;
         }
     } else {
         vmInfo('Taking config from file');
     }
     $_section = '[CONFIG]';
     $_data = fopen($_datafile, 'r');
     $_configData = array();
     $_switch = FALSE;
     while ($_line = fgets($_data)) {
         $_line = trim($_line);
         if (strpos($_line, '#') === 0) {
             continue;
             // Commentline
         }
         if ($_line == '') {
             continue;
             // Empty line
         }
         if (strpos($_line, '[') === 0) {
             // New section, check if it's what we want
             if (strtoupper($_line) == $_section) {
                 $_switch = TRUE;
                 // Ok, right section
             } else {
                 $_switch = FALSE;
             }
             continue;
         }
         if (!$_switch) {
             continue;
             // Outside a section or inside the wrong one.
         }
         if (strpos($_line, '=') !== FALSE) {
             $pair = explode('=', $_line);
             if (isset($pair[1])) {
                 if (strpos($pair[1], 'array:') !== FALSE) {
                     $pair[1] = substr($pair[1], 6);
                     $pair[1] = explode('|', $pair[1]);
                 }
                 // if($pair[0]!=='offline_message' && $pair[0]!=='dateformat'){
                 if ($pair[0] !== 'offline_message') {
                     $_line = $pair[0] . '=' . serialize($pair[1]);
                 } else {
                     $_line = $pair[0] . '=' . base64_encode(serialize($pair[1]));
                 }
                 if ($returnDangerousTools && $pair[0] == 'dangeroustools') {
                     vmdebug('dangeroustools' . $pair[1]);
                     if ($pair[1] == "0") {
                         return FALSE;
                     } else {
                         return TRUE;
                     }
                 }
             } else {
                 $_line = $pair[0] . '=';
             }
             $_configData[] = $_line;
         }
     }
     fclose($_data);
     if (!$_configData) {
         return FALSE;
         // Nothing to do
     } else {
         return $_configData;
     }
 }
예제 #15
0
 public function display($tpl = null)
 {
     $show_prices = VmConfig::get('show_prices', 1);
     if ($show_prices == '1') {
         if (!class_exists('calculationHelper')) {
             require VMPATH_ADMIN . DS . 'helpers' . DS . 'calculationh.php';
         }
     }
     $this->assignRef('show_prices', $show_prices);
     if (!class_exists('shopFunctionsF')) {
         require VMPATH_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php';
     }
     $document = JFactory::getDocument();
     $app = JFactory::getApplication();
     $pathway = $app->getPathway();
     if (!class_exists('VmImage')) {
         require VMPATH_ADMIN . DS . 'helpers' . DS . 'image.php';
     }
     // set search and keyword
     if ($keyword = vRequest::getString('keyword', false)) {
         //uword('keyword', false, ' ,-,+,.,_')) {
         $pathway->addItem($keyword);
         //$title .=' ('.$keyword.')';
     }
     //$search = vRequest::uword('keyword', null);
     $this->searchcustom = '';
     $this->searchCustomValues = '';
     //if (!empty($keyword)) {
     $this->getSearchCustom();
     $search = $keyword;
     /*} else {
     			$keyword ='';
     			$search = NULL;
     		}*/
     $this->assignRef('keyword', $keyword);
     $this->assignRef('search', $search);
     $menus = $app->getMenu();
     $menu = $menus->getActive();
     if (!empty($menu->id)) {
         ShopFunctionsF::setLastVisitedItemId($menu->id);
     } else {
         if ($itemId = vRequest::getInt('Itemid', false)) {
             ShopFunctionsF::setLastVisitedItemId($itemId);
         }
     }
     $virtuemart_manufacturer_id = vRequest::getInt('virtuemart_manufacturer_id', -1);
     if ($virtuemart_manufacturer_id === -1 and !empty($menu->query['virtuemart_manufacturer_id'])) {
         $virtuemart_manufacturer_id = $menu->query['virtuemart_manufacturer_id'];
         vRequest::setVar('virtuemart_manufacturer_id', $virtuemart_manufacturer_id);
     }
     $this->categoryId = vRequest::getInt('virtuemart_category_id', -1);
     if ($this->categoryId === -1 and !empty($menu->query['virtuemart_category_id'])) {
         $this->categoryId = $menu->query['virtuemart_category_id'];
         vRequest::setVar('virtuemart_category_id', $this->categoryId);
     } else {
         if ($this->categoryId === -1 and $virtuemart_manufacturer_id === -1) {
             $this->categoryId = ShopFunctionsF::getLastVisitedCategoryId();
         }
     }
     $this->setCanonicalLink($tpl, $document, $this->categoryId, $virtuemart_manufacturer_id);
     if (($this->categoryId === -1 or $this->categoryId === 0) and $virtuemart_manufacturer_id) {
         $this->categoryId = 0;
         $catType = 'manufacturer';
         $this->setCanonicalLink($tpl, $document, $virtuemart_manufacturer_id, $catType);
     }
     $categoryModel = VmModel::getModel('category');
     $productModel = VmModel::getModel('product');
     if ($this->categoryId === -1) {
         $this->categoryId = 0;
     }
     $vendorId = 1;
     $category = $categoryModel->getCategory($this->categoryId);
     if (!isset($menu->query['showproducts'])) {
         $menu->query['showproducts'] = 1;
     }
     $this->showproducts = vRequest::getInt('showproducts', $menu->query['showproducts']);
     if (!empty($category)) {
         $vendorId = $category->virtuemart_vendor_id;
         if ($this->showproducts) {
             //if(empty($category->category_layout) or $category->category_layout != 'categories') {
             // Load the products in the given category
             $ids = $productModel->sortSearchListQuery(TRUE, $this->categoryId);
             $this->perRow = empty($category->products_per_row) ? VmConfig::get('products_per_row', 3) : $category->products_per_row;
             $this->vmPagination = $productModel->getPagination($this->perRow);
             $ratingModel = VmModel::getModel('ratings');
             $this->showRating = $ratingModel->showRating();
             $productModel->withRating = $this->showRating;
             $this->orderByList = $productModel->getOrderByList($this->categoryId);
             $this->products = $productModel->getProducts($ids);
             //$products = $productModel->getProductsInCategory($this->categoryId);
             $imgAmount = VmConfig::get('prodimg_browse', 1);
             $productModel->addImages($this->products, $imgAmount);
             if ($this->products) {
                 $currency = CurrencyDisplay::getInstance();
                 $this->assignRef('currency', $currency);
                 $display_stock = VmConfig::get('display_stock', 1);
                 $showCustoms = VmConfig::get('show_pcustoms', 1);
                 if ($display_stock or $showCustoms) {
                     if (!$showCustoms) {
                         foreach ($this->products as $i => $productItem) {
                             $productItem->stock = $productModel->getStockIndicator($productItem);
                         }
                     } else {
                         shopFunctionsF::sortLoadProductCustomsStockInd($this->products, $productModel);
                     }
                 }
                 // add javascript for price and cart, need even for quantity buttons, so we need it almost anywhere
                 vmJsApi::jPrice();
             }
             // Add feed links
             if ($this->showproducts and $this->products && VmConfig::get('feed_cat_published', 0) == 1) {
                 $link = '&format=feed&limitstart=';
                 $attribs = array('type' => 'application/rss+xml', 'title' => 'RSS 2.0');
                 $document->addHeadLink(JRoute::_($link . '&type=rss', FALSE), 'alternate', 'rel', $attribs);
                 $attribs = array('type' => 'application/atom+xml', 'title' => 'Atom 1.0');
                 $document->addHeadLink(JRoute::_($link . '&type=atom', FALSE), 'alternate', 'rel', $attribs);
             }
             $user = JFactory::getUser();
             $this->showBasePrice = (vmAccess::manager() or vmAccess::isSuperVendor());
         }
         //No redirect here, for category id = 0 means show ALL categories! note by Max Milbers
         if (!empty($this->categoryId) and $this->categoryId !== -1 and (empty($category->slug) or !$category->published)) {
             if (empty($category->slug)) {
                 vmInfo(vmText::_('COM_VIRTUEMART_CAT_NOT_FOUND'));
             } else {
                 if ($category->virtuemart_id !== 0 and !$category->published) {
                     vmInfo('COM_VIRTUEMART_CAT_NOT_PUBL', $category->category_name, $this->categoryId);
                 }
             }
             //Fallback
             $categoryLink = '';
             if ($category->category_parent_id) {
                 $categoryLink = '&view=category&virtuemart_category_id=' . $category->category_parent_id;
             } else {
                 $last_category_id = shopFunctionsF::getLastVisitedCategoryId();
                 if (!$last_category_id or $this->categoryId == $last_category_id) {
                     $last_category_id = vRequest::getInt('virtuemart_category_id', false);
                 }
                 if ($last_category_id and $this->categoryId != $last_category_id) {
                     $categoryLink = '&view=category&virtuemart_category_id=' . $last_category_id;
                 }
             }
             if (VmConfig::get('handle_404', 1)) {
                 $app->redirect(JRoute::_('index.php?option=com_virtuemart' . $categoryLink . '&error=404', FALSE));
             } else {
                 JError::raise(E_ERROR, '404', 'Not found');
             }
             return;
         }
         shopFunctionsF::setLastVisitedCategoryId($this->categoryId);
         shopFunctionsF::setLastVisitedManuId($virtuemart_manufacturer_id);
         // Add the category name to the pathway
         if ($category->parents) {
             foreach ($category->parents as $c) {
                 $pathway->addItem(strip_tags(vmText::_($c->category_name)), JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_category_id=' . $c->virtuemart_category_id, FALSE));
             }
         }
         $catImgAmount = VmConfig::get('catimg_browse', 1);
         $categoryModel->addImages($category, $catImgAmount);
         if (!isset($menu->query['showcategory'])) {
             $menu->query['showcategory'] = 1;
         }
         $this->showcategory = vRequest::getInt('showcategory', $menu->query['showcategory']);
         //$this->showcategory = vRequest::getInt('showcategory',true);
         if ($this->showcategory) {
             //if($category->category_layout == 'categories' or ($this->categoryId >0 and $virtuemart_manufacturer_id <1)){
             $category->children = $categoryModel->getChildCategoryList($vendorId, $this->categoryId, $categoryModel->getDefaultOrdering(), $categoryModel->_selectedOrderingDir);
             $categoryModel->addImages($category->children, $catImgAmount);
         } else {
             $category->children = false;
         }
         if (VmConfig::get('enable_content_plugin', 0)) {
             shopFunctionsF::triggerContentPlugin($category, 'category', 'category_description');
         }
         $metadesc = '';
         $metakey = '';
         $metarobot = '';
         if (isset($menu->params)) {
             $metadesc = $menu->params->get('menu-meta_description');
             $metakey = $menu->params->get('menu-meta_keywords');
             $metarobot = $menu->params->get('robots');
         }
         if ($category->metadesc) {
             $metadesc = $category->metadesc;
         }
         if ($category->metakey) {
             $metakey = $category->metakey;
         }
         if ($category->metarobot) {
             $metarobot = $category->metarobot;
         }
         $document->setDescription($metadesc);
         $document->setMetaData('keywords', $metakey);
         $document->setMetaData('robots', $metarobot);
         if ($app->getCfg('MetaAuthor') == '1' and !empty($category->metaauthor)) {
             $document->setMetaData('author', $category->metaauthor);
         }
         if (empty($category->category_template)) {
             $category->category_template = VmConfig::get('categorytemplate');
         }
         if (!empty($menu->query['categorylayout'])) {
             //if(!empty($menu->query['categorylayout']) and $menu->query['virtuemart_category_id']==$this->categoryId){
             $category->category_layout = $menu->query['categorylayout'];
         }
         $productsLayout = VmConfig::get('productsublayout', 'products');
         if (empty($productsLayout)) {
             $productsLayout = 'products';
         }
         $this->productsLayout = empty($menu->query['productsublayout']) ? $productsLayout : $menu->query['productsublayout'];
         shopFunctionsF::setVmTemplate($this, $category->category_template, 0, $category->category_layout);
     } else {
         //Backward compatibility
         if (!isset($category)) {
             $category = new stdClass();
             $category->category_name = '';
             $category->category_description = '';
             $category->haschildren = false;
         }
     }
     $this->assignRef('category', $category);
     // Set the titles
     if (!empty($category->customtitle)) {
         $title = strip_tags($category->customtitle);
     } elseif (!empty($category->category_name)) {
         $title = strip_tags($category->category_name);
     } else {
         $title = $this->setTitleByJMenu($app);
     }
     $title = vmText::_($title);
     if (vRequest::getInt('error')) {
         $title .= ' ' . vmText::_('COM_VIRTUEMART_PRODUCT_NOT_FOUND');
     }
     if (!empty($keyword)) {
         $title .= ' (' . strip_tags(htmlspecialchars_decode($keyword)) . ')';
     }
     if ($virtuemart_manufacturer_id > 0 and !empty($this->products[0])) {
         $title .= ' ' . $this->products[0]->mf_name;
     }
     $document->setTitle($title);
     // Override Category name when viewing manufacturers products !IMPORTANT AFTER page title.
     if ($virtuemart_manufacturer_id > 0 and !empty($this->products[0]) and isset($category->category_name)) {
         $category->category_name = $this->products[0]->mf_name;
     }
     if ($app->getCfg('MetaTitle') == '1') {
         $document->setMetaData('title', $title);
     }
     parent::display($tpl);
 }
예제 #16
0
 function plgVmOnPaymentResponseReceived(&$html)
 {
     if (!class_exists('VirtueMartCart')) {
         require VMPATH_SITE . DS . 'helpers' . DS . 'cart.php';
     }
     if (!class_exists('shopFunctionsF')) {
         require VMPATH_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php';
     }
     if (!class_exists('VirtueMartModelOrders')) {
         require VMPATH_ADMIN . DS . 'models' . DS . 'orders.php';
     }
     $virtuemart_paymentmethod_id = JRequest::getInt('pm', 0);
     $order_number = JRequest::getString('on', 0);
     if (!($method = $this->getVmPluginMethod($virtuemart_paymentmethod_id))) {
         return NULL;
         // Another method was selected, do nothing
     }
     if (!$this->selectedThisElement($method->payment_element)) {
         return NULL;
     }
     if (!($virtuemart_order_id = VirtueMartModelOrders::getOrderIdByOrderNumber($order_number))) {
         return NULL;
     }
     $db = JFactory::getDBO();
     $_q = 'SELECT * FROM `' . $this->_tablename . '` ' . 'WHERE `virtuemart_order_id` = ' . $virtuemart_order_id;
     $db->setQuery($_q);
     if (!($paymentData = $db->loadObject())) {
         // JError::raiseWarning(500, $db->getErrorMsg());
     }
     vmdebug('HEIDELPAY paymentdata', $paymentData);
     if ($paymentData->processing_result == "NOK") {
         vmError('VMPAYMENT_HEIDELPAY_PAYMENT_FAILED', 'VMPAYMENT_HEIDELPAY_PAYMENT_FAILED');
         vmError(" - " . $paymentData->comment, " - " . $paymentData->comment);
     } else {
         vmInfo('VMPAYMENT_HEIDELPAY_PAYMENT_SUCESS');
         $html = "<h3>" . vmText::sprintf('VMPAYMENT_HEIDELPAY_ORDER_NR') . ': ' . $order_number . " </h3>";
         $tmpkom = preg_replace("/\\(-/", '<a href="', $paymentData->comment);
         $tmpkom = preg_replace('/-\\)/', '" target="_blank">Barcode runterladen</a>', $tmpkom);
         $html .= $tmpkom;
         //delete basket only on success
         $cart = VirtueMartCart::getCart();
         $cart->emptyCart();
     }
     // if payment is in test mode
     if ($paymentData->transaction_mode != "LIVE") {
         vmInfo('VMPAYMENT_HEIDELPAY_PAYMENT_TESTMODE');
     }
     $orgSecret = $this->createSecretHash($order_number, $method->HEIDELPAY_SECRET);
     $order['comments'] = "";
     if ($virtuemart_order_id && $paymentData->created_on == '0000-00-00 00:00:00') {
         $order['customer_notified'] = 0;
         $order['order_status'] = $this->getStatus($method, $paymentData->processing_result);
         $modelOrder = VmModel::getModel('orders');
         $orderitems = $modelOrder->getOrder($virtuemart_order_id);
         $nb_history = count($orderitems['history']);
         if ($orderitems['history'][$nb_history - 1]->order_status_code != $order['order_status']) {
             if ($method->HEIDELPAY_CONFIRM_EMAIL == 1 or $method->HEIDELPAY_CONFIRM_EMAIL == 2 and $paymentData->processing_result == "ACK") {
                 $order['customer_notified'] = 1;
                 $order['comments'] = vmText::sprintf('VMPAYMENT_HEIDELPAY_EMAIL_SENT') . "<br />";
             }
             $order['comments'] .= $paymentData->comment;
             /*
              * Verify Payment response
              */
             if ($orgSecret != $paymentData->secret_hash) {
                 $order['customer_notified'] = 0;
                 $order['comments'] = "Hash verification error, suspecting manipulation. IP: " . $paymentData->response_ip;
                 $order['order_status'] = '';
             }
             $modelOrder->updateStatusForOneOrder($virtuemart_order_id, $order, TRUE);
         }
         $dbu = JFactory::getDBO();
         $_u = "UPDATE `" . $this->_tablename . "` " . "SET `created_on` = NOW() WHERE `virtuemart_order_id` = " . (int) $virtuemart_order_id;
         $dbu->setQuery($_u);
         $result = $dbu->execute();
     }
     return TRUE;
 }
예제 #17
0
 private function checkoutData($redirect = true)
 {
     $this->_redirect = $redirect;
     $this->_inCheckOut = true;
     $this->tosAccepted = JRequest::getInt('tosAccepted', $this->tosAccepted);
     $this->STsameAsBT = JRequest::getInt('STsameAsBT', $this->STsameAsBT);
     $this->customer_comment = JRequest::getVar('customer_comment', $this->customer_comment);
     $this->order_language = JRequest::getVar('order_language', $this->order_language);
     // no HTML TAGS but permit all alphabet
     $value = preg_replace('@<[\\/\\!]*?[^<>]*?>@si', '', $this->customer_comment);
     //remove all html tags
     $value = (string) preg_replace('#on[a-z](.+?)\\)#si', '', $value);
     //replace start of script onclick() onload()...
     $value = trim(str_replace('"', ' ', $value), "'");
     $this->customer_comment = (string) preg_replace('#^\'#si', '', $value);
     //replace ' at start
     $this->cartData = $this->prepareCartData();
     $this->prepareCartPrice();
     if (empty($this->tosAccepted)) {
         $userFieldsModel = VmModel::getModel('Userfields');
         //$required = $userFieldsModel->getIfRequired('agreed');
         $agreed = $userFieldsModel->getUserfield('agreed', 'name');
         //vmdebug('my new getUserfieldbyName',$agreed->default,$agreed->required);
         if (!empty($agreed->required) and empty($agreed->default) and !empty($this->BT)) {
             $redirectMsg = null;
             // JText::_('COM_VIRTUEMART_CART_PLEASE_ACCEPT_TOS');
             vmInfo('COM_VIRTUEMART_CART_PLEASE_ACCEPT_TOS', 'COM_VIRTUEMART_CART_PLEASE_ACCEPT_TOS');
             return $this->redirecter('index.php?option=com_virtuemart&view=cart', $redirectMsg);
         } else {
             if ($agreed->default) {
                 $this->tosAccepted = $agreed->default;
             }
         }
     }
     if (($this->selected_shipto = JRequest::getVar('shipto', null)) !== null) {
         JModel::addIncludePath(JPATH_VM_ADMINISTRATOR . DS . 'models');
         $userModel = JModel::getInstance('user', 'VirtueMartModel');
         $stData = $userModel->getUserAddressList(0, 'ST', $this->selected_shipto);
         $stData = get_object_vars($stData[0]);
         if ($this->validateUserData('ST', $stData)) {
             $this->ST = $stData;
         }
     }
     if (count($this->products) == 0) {
         return $this->redirecter('index.php?option=com_virtuemart', JText::_('COM_VIRTUEMART_CART_NO_PRODUCT'));
     } else {
         foreach ($this->products as $product) {
             $redirectMsg = $this->checkForQuantities($product, $product->quantity);
             if (!$redirectMsg) {
                 return $this->redirecter('index.php?option=com_virtuemart&view=cart', $redirectMsg);
             }
         }
     }
     // Check if a minimun purchase value is set
     if (($redirectMsg = $this->checkPurchaseValue()) != null) {
         return $this->redirecter('index.php?option=com_virtuemart&view=cart', $redirectMsg);
     }
     //$this->prepareAddressDataInCart();
     //But we check the data again to be sure
     if (empty($this->BT)) {
         $redirectMsg = '';
         return $this->redirecter('index.php?option=com_virtuemart&view=user&task=editaddresscheckout&addrtype=BT', $redirectMsg);
     } else {
         $redirectMsg = self::validateUserData();
         if (!$redirectMsg) {
             return $this->redirecter('index.php?option=com_virtuemart&view=user&task=editaddresscheckout&addrtype=BT', '');
         }
     }
     if ($this->STsameAsBT !== 0) {
         $this->ST = $this->BT;
     } else {
         //Only when there is an ST data, test if all necessary fields are filled
         if (!empty($this->ST)) {
             $redirectMsg = self::validateUserData('ST');
             if (!$redirectMsg) {
                 return $this->redirecter('index.php?option=com_virtuemart&view=user&task=editaddresscheckout&addrtype=ST', '');
             }
         }
     }
     if (VmConfig::get('oncheckout_only_registered', 0)) {
         $currentUser = JFactory::getUser();
         if (empty($currentUser->id)) {
             $redirectMsg = JText::_('COM_VIRTUEMART_CART_ONLY_REGISTERED');
             return $this->redirecter('index.php?option=com_virtuemart&view=user&task=editaddresscheckout&addrtype=BT', $redirectMsg);
         }
     }
     vmdebug('ValidateCouponCode ValidateCouponCode ValidateCouponCode', $this->couponCode);
     // Test Coupon
     if (!empty($this->couponCode)) {
         //$prices = $this->getCartPrices();
         if (!class_exists('CouponHelper')) {
             require JPATH_VM_SITE . DS . 'helpers' . DS . 'coupon.php';
         }
         if (!in_array($this->couponCode, $this->_triesValidateCoupon)) {
             $this->_triesValidateCoupon[] = $this->couponCode;
         }
         if (count($this->_triesValidateCoupon) < 8) {
             $redirectMsg = CouponHelper::ValidateCouponCode($this->couponCode, $this->pricesUnformatted['salesPrice']);
         } else {
             $redirectMsg = JText::_('COM_VIRTUEMART_CART_COUPON_TOO_MANY_TRIES');
         }
         if (!empty($redirectMsg)) {
             $this->couponCode = '';
             $this->getCartPrices();
             $this->setCartIntoSession();
             return $this->redirecter('index.php?option=com_virtuemart&view=cart', $redirectMsg);
         }
     }
     $redirectMsg = '';
     //Test Shipment and show shipment plugin
     if (empty($this->virtuemart_shipmentmethod_id)) {
         return $this->redirecter('index.php?option=com_virtuemart&view=cart&task=edit_shipment', $redirectMsg);
     } else {
         if (!class_exists('vmPSPlugin')) {
             require JPATH_VM_PLUGINS . DS . 'vmpsplugin.php';
         }
         JPluginHelper::importPlugin('vmshipment');
         //Add a hook here for other shipment methods, checking the data of the choosed plugin
         $dispatcher = JDispatcher::getInstance();
         $retValues = $dispatcher->trigger('plgVmOnCheckoutCheckDataShipment', array($this));
         //vmdebug('plgVmOnCheckoutCheckDataShipment CART', $retValues);
         foreach ($retValues as $retVal) {
             if ($retVal === true) {
                 break;
                 // Plugin completed succesfull; nothing else to do
             } elseif ($retVal === false) {
                 // Missing data, ask for it (again)
                 return $this->redirecter('index.php?option=com_virtuemart&view=cart&task=edit_shipment', $redirectMsg);
                 // 	NOTE: inactive plugins will always return null, so that value cannot be used for anything else!
             }
         }
     }
     //Test Payment and show payment plugin
     if ($this->pricesUnformatted['salesPrice'] > 0.0) {
         if (empty($this->virtuemart_paymentmethod_id)) {
             return $this->redirecter('index.php?option=com_virtuemart&view=cart&task=editpayment', $redirectMsg);
         } else {
             if (!class_exists('vmPSPlugin')) {
                 require JPATH_VM_PLUGINS . DS . 'vmpsplugin.php';
             }
             JPluginHelper::importPlugin('vmpayment');
             //Add a hook here for other payment methods, checking the data of the choosed plugin
             $dispatcher = JDispatcher::getInstance();
             $retValues = $dispatcher->trigger('plgVmOnCheckoutCheckDataPayment', array($this));
             foreach ($retValues as $retVal) {
                 if ($retVal === true) {
                     break;
                     // Plugin completed succesful; nothing else to do
                 } elseif ($retVal === false) {
                     // Missing data, ask for it (again)
                     return $this->redirecter('index.php?option=com_virtuemart&view=cart&task=editpayment', $redirectMsg);
                     // 	NOTE: inactive plugins will always return null, so that value cannot be used for anything else!
                 }
             }
         }
     }
     //Show cart and checkout data overview
     $this->_inCheckOut = false;
     if ($this->_blockConfirm) {
         return $this->redirecter('index.php?option=com_virtuemart&view=cart', '');
     } else {
         $this->_dataValidated = true;
         $this->setCartIntoSession();
         return true;
     }
 }
예제 #18
0
 private function checkoutData($redirect = true)
 {
     $this->_redirect = $redirect;
     $this->_inCheckOut = true;
     $this->setCartIntoSession();
     session_write_close();
     session_start();
     $this->tosAccepted = JRequest::getInt('tosAccepted', $this->tosAccepted);
     $this->STsameAsBT = JRequest::getInt('STsameAsBT', $this->STsameAsBT);
     $this->order_language = JRequest::getVar('order_language', $this->order_language);
     $this->getFilterCustomerComment();
     $this->cartData = $this->prepareCartData();
     $this->prepareCartPrice();
     if (count($this->products) == 0) {
         return $this->redirecter('index.php?option=com_virtuemart', JText::_('COM_VIRTUEMART_CART_NO_PRODUCT'));
     } else {
         foreach ($this->products as $product) {
             $redirectMsg = $this->checkForQuantities($product, $product->quantity);
             if (!$redirectMsg) {
                 return $this->redirecter('index.php?option=com_virtuemart&view=cart', $redirectMsg);
             }
         }
     }
     // Check if a minimun purchase value is set
     if (($redirectMsg = $this->checkPurchaseValue()) != null) {
         return $this->redirecter('index.php?option=com_virtuemart&view=cart', $redirectMsg);
     }
     $validUserDataBT = self::validateUserData();
     if (!isset($this->tosAccepted)) {
         $userFieldsModel = VmModel::getModel('Userfields');
         $agreed = $userFieldsModel->getUserfield('agreed', 'name');
         $this->tosAccepted = $agreed->default;
     }
     if (empty($this->tosAccepted)) {
         $userFieldsModel = VmModel::getModel('Userfields');
         $agreed = $userFieldsModel->getUserfield('agreed', 'name');
         if (empty($this->tosAccepted) and !empty($agreed->required) and $validUserDataBT !== -1) {
             $redirectMsg = null;
             // JText::_('COM_VIRTUEMART_CART_PLEASE_ACCEPT_TOS');
             $this->tosAccepted = false;
             vmInfo('COM_VIRTUEMART_CART_PLEASE_ACCEPT_TOS');
             return $this->redirecter('index.php?option=com_virtuemart&view=cart', $redirectMsg);
         }
     }
     if ($validUserDataBT !== true) {
         //Important, we can have as result -1,false and true.
         return $this->redirecter('index.php?option=com_virtuemart&view=user&task=editaddresscheckout&addrtype=BT', '');
     }
     if ($this->STsameAsBT !== 0) {
         if ($this->_confirmDone) {
             $this->ST = $this->BT;
         } else {
             $this->ST = 0;
         }
     } else {
         if (($this->selected_shipto = JRequest::getVar('shipto', null)) !== null) {
             JModel::addIncludePath(JPATH_VM_ADMINISTRATOR . DS . 'models');
             $userModel = JModel::getInstance('user', 'VirtueMartModel');
             $stData = $userModel->getUserAddressList(0, 'ST', $this->selected_shipto);
             $stData = get_object_vars($stData[0]);
             if ($this->validateUserData('ST', $stData) != -1 and $this->validateUserData('ST', $stData) > 0) {
                 $this->ST = $stData;
             }
         }
         //Only when there is an ST data, test if all necessary fields are filled
         $validUserDataST = self::validateUserData('ST');
         if ($validUserDataST !== true) {
             return $this->redirecter('index.php?option=com_virtuemart&view=user&task=editaddresscheckout&addrtype=ST', '');
         }
     }
     if (VmConfig::get('oncheckout_only_registered', 0)) {
         $currentUser = JFactory::getUser();
         if (empty($currentUser->id)) {
             $redirectMsg = JText::_('COM_VIRTUEMART_CART_ONLY_REGISTERED');
             return $this->redirecter('index.php?option=com_virtuemart&view=user&task=editaddresscheckout&addrtype=BT', $redirectMsg);
         }
     }
     //vmdebug('ValidateCouponCode ValidateCouponCode ValidateCouponCode',$this->couponCode);
     // Test Coupon
     if (!empty($this->couponCode)) {
         //$prices = $this->getCartPrices();
         if (!class_exists('CouponHelper')) {
             require JPATH_VM_SITE . DS . 'helpers' . DS . 'coupon.php';
         }
         if (!in_array($this->couponCode, $this->_triesValidateCoupon)) {
             $this->_triesValidateCoupon[] = $this->couponCode;
         }
         if (count($this->_triesValidateCoupon) < 8) {
             $redirectMsg = CouponHelper::ValidateCouponCode($this->couponCode, $this->pricesUnformatted['salesPrice']);
         } else {
             $redirectMsg = JText::_('COM_VIRTUEMART_CART_COUPON_TOO_MANY_TRIES');
         }
         if (!empty($redirectMsg)) {
             $this->couponCode = '';
             $this->getCartPrices();
             $this->setCartIntoSession();
             return $this->redirecter('index.php?option=com_virtuemart&view=cart', $redirectMsg);
         }
     }
     $redirectMsg = '';
     //Test Shipment and show shipment plugin
     if (empty($this->virtuemart_shipmentmethod_id)) {
         return $this->redirecter('index.php?option=com_virtuemart&view=cart&task=edit_shipment', $redirectMsg);
     } else {
         if ($this->virtuemart_shipmentmethod_id != JRequest::getInt('virtuemart_shipmentmethod_id', $this->virtuemart_shipmentmethod_id)) {
             $obj = new VirtueMartControllerCart();
             $obj->setshipment();
             return $this->redirecter('index.php?option=com_virtuemart&view=cart', $redirectMsg);
         } else {
             if (!class_exists('vmPSPlugin')) {
                 require JPATH_VM_PLUGINS . DS . 'vmpsplugin.php';
             }
             JPluginHelper::importPlugin('vmshipment');
             //Add a hook here for other shipment methods, checking the data of the choosed plugin
             $dispatcher = JDispatcher::getInstance();
             $retValues = $dispatcher->trigger('plgVmOnCheckoutCheckDataShipment', array($this));
             //vmdebug('plgVmOnCheckoutCheckDataShipment CART', $retValues);
             foreach ($retValues as $retVal) {
                 if ($retVal === true) {
                     break;
                     // Plugin completed succesfull; nothing else to do
                 } elseif ($retVal === false) {
                     // Missing data, ask for it (again)
                     return $this->redirecter('index.php?option=com_virtuemart&view=cart&task=edit_shipment', $redirectMsg);
                     // 	NOTE: inactive plugins will always return null, so that value cannot be used for anything else!
                 }
             }
         }
     }
     //Test Payment and show payment plugin
     if ($this->pricesUnformatted['salesPrice'] > 0.0) {
         if (empty($this->virtuemart_paymentmethod_id)) {
             return $this->redirecter('index.php?option=com_virtuemart&view=cart&task=editpayment', $redirectMsg);
         } else {
             if ($this->virtuemart_paymentmethod_id != JRequest::getInt('virtuemart_paymentmethod_id', $this->virtuemart_paymentmethod_id)) {
                 vmdebug('checkoutData $this->virtuemart_paymentmethod_id not equal request', $this->virtuemart_paymentmethod_id);
                 $obj = new VirtueMartControllerCart();
                 $obj->setpayment();
                 return $this->redirecter('index.php?option=com_virtuemart&view=cart', $redirectMsg);
             } else {
                 if (!class_exists('vmPSPlugin')) {
                     require JPATH_VM_PLUGINS . DS . 'vmpsplugin.php';
                 }
                 JPluginHelper::importPlugin('vmpayment');
                 //Add a hook here for other payment methods, checking the data of the choosed plugin
                 $dispatcher = JDispatcher::getInstance();
                 $retValues = $dispatcher->trigger('plgVmOnCheckoutCheckDataPayment', array($this));
                 foreach ($retValues as $retVal) {
                     if ($retVal === true) {
                         break;
                         // Plugin completed succesful; nothing else to do
                     } elseif ($retVal === false) {
                         // Missing data, ask for it (again)
                         vmdebug('checkoutData payment plugin is missing data, trigger plgVmOnCheckoutCheckDataPayment', $this->virtuemart_paymentmethod_id);
                         return $this->redirecter('index.php?option=com_virtuemart&view=cart&task=editpayment', $redirectMsg);
                         // 	NOTE: inactive plugins will always return null, so that value cannot be used for anything else!
                     }
                 }
             }
         }
     }
     //Show cart and checkout data overview
     $this->_inCheckOut = false;
     if ($this->_blockConfirm) {
         $this->_dataValidated = false;
         $this->setCartIntoSession();
         return $this->redirecter('index.php?option=com_virtuemart&view=cart', '');
     } else {
         $this->_dataValidated = true;
         $this->setCartIntoSession();
         return true;
     }
 }
예제 #19
0
 /**
  *
  */
 public function massxref($layoutName)
 {
     JRequest::checkToken() or jexit('Invalid Token, in ' . JRequest::getWord('task'));
     $cids = JRequest::getVar('virtuemart_product_id', array(), '', 'ARRAY');
     JArrayHelper::toInteger($cids);
     if (empty($cids)) {
         $session = JFactory::getSession();
         $cids = unserialize($session->get('vm_product_ids', '', 'vm'));
     } else {
         $session = JFactory::getSession();
         $session->set('vm_product_ids', serialize($cids), 'vm');
     }
     if (!empty($cids)) {
         $q = 'SELECT `product_name` FROM `#__virtuemart_products_' . VMLANG . '` ';
         $q .= ' WHERE `virtuemart_product_id` IN (' . implode(',', $cids) . ')';
         $db = JFactory::getDbo();
         $db->setQuery($q);
         $productNames = $db->loadResultArray();
         vmInfo('COM_VIRTUEMART_PRODUCT_XREF_NAMES', implode(', ', $productNames));
     }
     $this->addViewPath(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'views');
     $document = JFactory::getDocument();
     $viewType = $document->getType();
     $view = $this->getView($this->_cname, $viewType);
     $view->setLayout($layoutName);
     $this->display();
 }
예제 #20
0
파일: default.php 프로젝트: sergy444/joomla
* @copyright Copyright (c) 2004 - 2010 VirtueMart Team. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* VirtueMart is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* @version $Id: default.php 6307 2012-08-07 07:39:45Z alatak $
*/
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');
AdminUIHelper::startAdminArea($this);
//$finfo = finfo_open(FILEINFO_MIME);
if (class_exists('finfo')) {
    $finfo = new finfo(FILEINFO_MIME);
} else {
    vmInfo('The function finfo should be activated on the server');
    $finfo = false;
}
?>
		<table class="adminlist" cellspacing="0" cellpadding="0">
		<thead>
		<tr>
			<th>
				<?php 
echo JText::_('COM_VIRTUEMART_LOG_FILENAME');
?>
			</th>
			<th>
				<?php 
echo JText::_('COM_VIRTUEMART_LOG_FILEINFO');
?>
예제 #21
0
 /**
  * Notifies the customer that the Order Status has been changed
  *
  * @author RolandD, Christopher Roussel, Valérie Isaksen, Max Milbers
  *
  */
 private function notifyCustomer($virtuemart_order_id, $newOrderData = 0)
 {
     // 		vmdebug('notifyCustomer', $newOrderData);
     if (isset($newOrderData['customer_notified']) && $newOrderData['customer_notified'] == 0) {
         return true;
     }
     if (!class_exists('shopFunctionsF')) {
         require JPATH_VM_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php';
     }
     //Important, the data of the order update mails, payments and invoice should
     //always be in the database, so using getOrder is the right method
     $orderModel = VmModel::getModel('orders');
     $order = $orderModel->getOrder($virtuemart_order_id);
     $payment_name = $shipment_name = '';
     if (!class_exists('vmPSPlugin')) {
         require JPATH_VM_PLUGINS . DS . 'vmpsplugin.php';
     }
     JPluginHelper::importPlugin('vmshipment');
     JPluginHelper::importPlugin('vmpayment');
     $dispatcher = JDispatcher::getInstance();
     $returnValues = $dispatcher->trigger('plgVmOnShowOrderFEShipment', array($order['details']['BT']->virtuemart_order_id, $order['details']['BT']->virtuemart_shipmentmethod_id, &$shipment_name));
     $returnValues = $dispatcher->trigger('plgVmOnShowOrderFEPayment', array($order['details']['BT']->virtuemart_order_id, $order['details']['BT']->virtuemart_paymentmethod_id, &$payment_name));
     $order['shipmentName'] = $shipment_name;
     $order['paymentName'] = $payment_name;
     if ($newOrderData != 0) {
         //We do not really need that
         $vars['newOrderData'] = (array) $newOrderData;
     }
     $vars['orderDetails'] = $order;
     //$vars['includeComments'] = JRequest::getVar('customer_notified', array());
     //I think this is misleading, I think it should always ask for example $vars['newOrderData']['doVendor'] directly
     //Using this function garantue us that it is always there. If the vendor should be informed should be done by the plugins
     //We may add later something to the method, defining this better
     $vars['url'] = 'url';
     if (!isset($vars['doVendor'])) {
         if (!isset($newOrderData['doVendor'])) {
             $vars['doVendor'] = false;
         } else {
             $vars['doVendor'] = $newOrderData['doVendor'];
         }
     }
     $virtuemart_vendor_id = 1;
     $vendorModel = VmModel::getModel('vendor');
     $vendor = $vendorModel->getVendor($virtuemart_vendor_id);
     $vars['vendor'] = $vendor;
     $vendorEmail = $vendorModel->getVendorEmail($virtuemart_vendor_id);
     $vars['vendorEmail'] = $vendorEmail;
     /*
     		$path = VmConfig::get('forSale_path',0);
     		$orderstatusForInvoice = VmConfig::get('inv_os','C');
     		$pdfInvoice = VmConfig::get('pdf_invoice', 1); // backwards compatible
     */
     // florian : added if pdf invoice are enabled
     //if  ($this->getInvoiceNumber( $order['details']['BT']->virtuemart_order_id ) ){
     $invoiceNumberDate = array();
     if ($orderModel->createInvoiceNumber($order['details']['BT'], $invoiceNumberDate)) {
         $orderstatusForInvoice = VmConfig::get('inv_os', array());
         if (!is_array($orderstatusForInvoice)) {
             $orderstatusForInvoice = array($orderstatusForInvoice);
         }
         // for backward compatibility 2.0.8e
         $pdfInvoice = (int) VmConfig::get('pdf_invoice', 0);
         // backwards compatible
         $force_create_invoice = JRequest::getInt('create_invoice', 0);
         //TODO we need an array of orderstatus
         if (in_array($order['details']['BT']->order_status, $orderstatusForInvoice) or $pdfInvoice == 1 or $force_create_invoice == 1) {
             if (!shopFunctions::InvoiceNumberReserved($invoiceNumberDate[0])) {
                 if (!class_exists('VirtueMartControllerInvoice')) {
                     require_once JPATH_VM_SITE . DS . 'controllers' . DS . 'invoice.php';
                 }
                 $controller = new VirtueMartControllerInvoice(array('model_path' => JPATH_VM_SITE . DS . 'models', 'view_path' => JPATH_VM_SITE . DS . 'views'));
                 $vars['mediaToSend'][] = $controller->checkStoreInvoice($order);
             }
         }
     }
     // Send the email
     if (shopFunctionsF::renderMail('invoice', $order['details']['BT']->email, $vars, null, $vars['doVendor'])) {
         $string = 'COM_VIRTUEMART_NOTIFY_CUSTOMER_SEND_MSG';
     } else {
         $string = 'COM_VIRTUEMART_NOTIFY_CUSTOMER_ERR_SEND';
     }
     vmInfo(JText::_($string, false) . ' ' . $order['details']['BT']->first_name . ' ' . $order['details']['BT']->last_name . ', ' . $order['details']['BT']->email);
     return true;
 }
예제 #22
0
파일: oos.php 프로젝트: Pashkinz92/oos
 function plgVmConfirmedOrder($cart, $order)
 {
     outToLog('PAYMENT: plgVmConfirmedOrder -> start');
     if (!($method = $this->getVmPluginMethod($order['details']['BT']->virtuemart_paymentmethod_id))) {
         return null;
         // Another method was selected, do nothing
     }
     if (!$this->selectedThisElement($method->payment_element)) {
         return false;
     }
     $session = JFactory::getSession();
     $return_context = $session->getId();
     $order_number = $order['details']['BT']->order_number;
     $this->logInfo('plgVmConfirmedOrder order number: ' . $order_number, 'message');
     if (!class_exists('VirtueMartModelOrders')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.php';
     }
     if (!class_exists('VirtueMartModelCurrency')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'currency.php';
     }
     if (!class_exists('TableVendors')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'table' . DS . 'vendors.php';
     }
     $vendorModel = VmModel::getModel('Vendor');
     $vendorModel->setId(1);
     $vendor = $vendorModel->getVendor();
     $vendorModel->addImages($vendor, 1);
     $this->getPaymentCurrency($method);
     $paymentCurrency = CurrencyDisplay::getInstance($method->payment_currency);
     $totalInPaymentCurrency = round($paymentCurrency->convertCurrencyTo($method->payment_currency, $order['details']['BT']->order_total, false), 2);
     if ($totalInPaymentCurrency <= 0) {
         vmInfo(JText::_('PLG_OOS_VM2_ERROR_1'));
         return false;
     }
     $merchant_id = $this->_getMerchantID($method);
     $merchant_key = $this->_getSecretWord($method);
     $url_success = $this->_getUrlSuccess($method);
     $url_fail = $this->_getUrlFail($method);
     if (empty($merchant_id)) {
         vmInfo(JText::_('PLG_OOS_VM2_ERROR_2'));
         return false;
     }
     $dbValues['order_number'] = $order_number;
     $dbValues['payment_name'] = $this->renderPluginName($method, $order);
     $dbValues['virtuemart_paymentmethod_id'] = $cart->virtuemart_paymentmethod_id;
     $dbValues['oos_custom'] = $return_context;
     $dbValues['cost_per_transaction'] = $method->cost_per_transaction;
     $dbValues['cost_percent_total'] = $method->cost_percent_total;
     $dbValues['payment_currency'] = $method->payment_currency;
     $dbValues['payment_order_total'] = $totalInPaymentCurrency;
     $dbValues['tax_id'] = $method->tax_id;
     $this->storePSPluginInternalData($dbValues);
     $url = $method->url_pay_page;
     outToLog('PAYMRNT: plgVmConfirmedOrder -> send to OOS: $merchant_key = ' . $merchant_key . ' order_number = ' . $order_number . ' totalInPaymentCurrency= ' . $totalInPaymentCurrency . ' url_pay_page = ' . $url);
     $message = array("amount" => $totalInPaymentCurrency, "details" => "Проверка оплаты через OOS", "customerRating" => "5", "customerAccount" => "joomla_user", "orderId" => $order_number, "successUrl" => $url_success, "failUrl" => $url_fail, "paymentMethod" => "", "customerPhone" => "+79210000000", "customerEmail" => "*****@*****.**", "customerComment" => "", "data" => array("user" => "+79210000000", "debug" => "1"));
     $messageText = json_encode($message);
     $http_params = array("marketPlace" => $merchant_id, "message" => base64_encode($messageText), "signature" => hash('sha256', $messageText . $merchant_key));
     $virtuemart_order_id = VirtueMartModelOrders::getOrderIdByOrderNumber($order_number);
     $html = '<html><head><title>Redirection to OOS</title></head><body><div style="margin: auto; text-align: center;">';
     $html .= '<form action="' . $url . '" method="post" name="vm_oos_form">';
     $html .= '<p>';
     $html .= '<input name="marketPlace" value=' . $http_params["marketPlace"] . '>';
     $html .= '</p>';
     $html .= '<p>';
     $html .= '<input name="message" value=' . $http_params["message"] . '>';
     $html .= '</p>';
     $html .= '<p>';
     $html .= '<input name="signature" value=' . $http_params["signature"] . '>';
     $html .= '</p>';
     $html .= '<p>';
     $html .= '<input type=submit value="Перейти на платёжную страницу OOS">';
     $html .= '</p>';
     $html .= '</form></div>';
     $html .= '<script type="text/javascript">';
     $html .= 'document.vm_oos_form.submit();';
     $html .= '</script></body></html>';
     $html .= '</body></html>';
     $modelOrder = VmModel::getModel('orders');
     $order['customer_notified'] = 1;
     $order['order_status'] = $method->status_pending;
     outToLog('PAYMENT: plgVmConfirmedOrder - virtuemart_order_id = ' . $virtuemart_order_id);
     $modelOrder->updateStatusForOneOrder($virtuemart_order_id, $order, true);
     $cart->_confirmDone = false;
     $cart->_dataValidated = false;
     $cart->setCartIntoSession();
     JRequest::setVar('html', $html);
     /******* ******/
 }
예제 #23
0
 private function checkShipmentMethodsConfigured()
 {
     //For the selection of the shipment method we need the total amount to pay.
     $shipmentModel = VmModel::getModel('Shipmentmethod');
     $shipments = $shipmentModel->getShipments();
     if (empty($shipments)) {
         $text = '';
         $user = JFactory::getUser();
         if ($user->authorise('core.admin', 'com_virtuemart') or $user->authorise('core.manage', 'com_virtuemart') or VmConfig::isSuperVendor()) {
             $uri = JFactory::getURI();
             $link = $uri->root() . 'administrator/index.php?option=com_virtuemart&view=shipmentmethod';
             $text = vmText::sprintf('COM_VIRTUEMART_NO_SHIPPING_METHODS_CONFIGURED_LINK', '<a href="' . $link . '" rel="nofollow">' . $link . '</a>');
         }
         vmInfo('COM_VIRTUEMART_NO_SHIPPING_METHODS_CONFIGURED', $text);
         $tmp = 0;
         $this->assignRef('found_shipment_method', $tmp);
         $this->cart->virtuemart_shipmentmethod_id = 0;
         return false;
     }
     return true;
 }
예제 #24
0
 /**
  * The type of the media determines the used path for storing them
  *
  * @author Max Milbers
  * @param string $type type of the media, allowed values product, category, shop, vendor, manufacturer, forSale
  */
 public function getMediaUrlByView($type)
 {
     //the problem is here, that we use for autocreatoin the name of the model, here products
     //But for storing we use the product to build automatically the table out of it (product_medias)
     $choosed = false;
     if ($type == 'product' || $type == 'products') {
         $relUrl = VmConfig::get('media_product_path');
         $choosed = true;
     } else {
         if ($type == 'category' || $type == 'categories') {
             $relUrl = VmConfig::get('media_category_path');
             $choosed = true;
         } else {
             if ($type == 'shop') {
                 $relUrl = VmConfig::get('media_path');
                 $choosed = true;
             } else {
                 if ($type == 'vendor' || $type == 'vendors') {
                     $relUrl = VmConfig::get('media_vendor_path');
                     $choosed = true;
                 } else {
                     if ($type == 'manufacturer' || $type == 'manufacturers') {
                         $relUrl = VmConfig::get('media_manufacturer_path');
                         $choosed = true;
                     } else {
                         if ($type == 'forSale' || $type == 'file_is_forSale') {
                             if (!class_exists('shopFunctionsF')) {
                                 require VMPATH_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php';
                             }
                             $relUrl = shopFunctions::checkSafePath();
                             if ($relUrl) {
                                 $choosed = true;
                                 $this->file_is_forSale = 1;
                             }
                         }
                     }
                 }
             }
         }
     }
     if ($choosed && empty($relUrl)) {
         $link = JURI::root() . 'administrator/index.php?option=com_virtuemart&view=config';
         vmInfo('COM_VIRTUEMART_MEDIA_NO_PATH_TYPE', $type, $link);
         //Todo add general media_path to config
         //$relUrl = VmConfig::get('media_path');
         $relUrl = 'images/stories/virtuemart/';
         $this->setRole = true;
         // 		} else if(!$choosed and empty($relUrl) and $this->file_is_forSale==0){
     } else {
         if (!$choosed and empty($relUrl)) {
             vmWarn('COM_VIRTUEMART_MEDIA_CHOOSE_TYPE', $this->file_title);
             // 	vmError('Ignore this message, when it appears while the media synchronisation process, else report to http://forum.virtuemart.net/index.php?board=127.0 : cant create media of unknown type, a programmers error, used type ',$type);
             $relUrl = 'images/stories/virtuemart/typeless/';
             $this->setRole = true;
         } else {
             if (!$choosed and $this->file_is_forSale == 1) {
                 $relUrl = '';
                 $this->setRole = false;
             }
         }
     }
     return $relUrl;
 }
예제 #25
0
 /**
  * Add, change or drop userfields
  *
  * @param string $_act Action: ADD, DROP or CHANGE (synonyms available, see the switch cases)
  * @param string $_col Column name
  * @param string $_type fieldtype
  * @param string $_col2 Second Column name
  * @return boolean True on success
  * @author Oscar van Eijk
  *
  * stAn - note: i disabled deleting of user data when a column (shopper field) is deleted. If a deletion of specific user or order is needed, it can be done separatedly
  * The column if not set with $_col2 will be renamed to ORIGINALNAME_DELETED_{timestamp()} and depending on mysql version it's definition will change
  */
 function _modifyColumn($_act, $_col, $_type = '', $_col2 = '')
 {
     $_sql = 'ALTER TABLE `' . $this->_tbl . '` ';
     $_check_act = strtoupper(substr($_act, 0, 3));
     //Check if a column is there
     //$columns = $this->_db->getTableColumns($this->_tbl);
     $columns = $this->showFullColumns('Field', 'Type', false);
     $res = array_key_exists($_col, $columns);
     if ($_check_act != 'ADD' and $_check_act != 'CRE') {
         if (!$res) {
             vmdebug('_modifyColumn Command was ' . $_check_act . ' column does not exist, changed to ADD');
             $_check_act = 'ADD';
         }
     } else {
         if ($res) {
             vmdebug('_modifyColumn Command was ' . $_check_act . ' column already exists, changed to MOD');
             $_check_act = 'UPD';
         }
     }
     switch ($_check_act) {
         case 'ADD':
         case 'CRE':
             // Create
             $_sql .= "ADD {$_col} {$_type} ";
             break;
         case 'DRO':
             // Drop
         // Drop
         case 'DEL':
             // Delete
             //stAn, i strongly do not recommend to delete customer information only because a field was deleted
             if (empty($_col2)) {
                 $_col2 = $_col . '_DELETED_' . time();
                 vmInfo('Be aware the column of table ' . $this->_tbl . ' is not deleted, only renamed to ' . $_col2);
             }
             if (!$this->isMysql51Plus()) {
                 if (empty($_type)) {
                     $_type = 'TEXT CHARACTER SET utf8';
                 }
             }
             // NOT NULL not allowed for deleted columns
             //$t_type = str_ireplace(' NOT ', '', $_type);
             $_sql .= "CHANGE {$_col} {$_col2} {$_type} ";
             //was: $_sql .= "DROP $_col ";
             break;
         case 'MOD':
             // Modify
         // Modify
         case 'UPD':
             // Update
         // Update
         case 'CHA':
             // Change
             if (empty($col2)) {
                 $_col2 = $_col;
             }
             // change type only
             $_sql .= "CHANGE {$_col} {$_col2} {$_type} ";
             break;
     }
     $this->_db->setQuery($_sql);
     $this->_db->execute();
     if ($this->_db->getErrorNum() != 0) {
         vmError(get_class($this) . '::modify table - ' . $this->_db->getErrorMsg() . '<br /> values: action ' . $_act . ', columname: ' . $_col . ', type: ' . $_type . ', columname2: ' . $_col2);
         return false;
     }
     vmdebug('_modifyColumn executed successfully ' . $_sql);
     return true;
 }
예제 #26
0
파일: product.php 프로젝트: lenard112/cms
 /**
  *
  */
 public function massxref($layoutName)
 {
     vRequest::vmCheckToken();
     $cids = vRequest::getInt('virtuemart_product_id');
     if (empty($cids)) {
         $session = JFactory::getSession();
         $cids = unserialize($session->get('vm_product_ids', '', 'vm'));
     } else {
         $session = JFactory::getSession();
         $session->set('vm_product_ids', serialize($cids), 'vm');
     }
     if (!empty($cids)) {
         $q = 'SELECT `product_name` FROM `#__virtuemart_products_' . VmConfig::$vmlang . '` ';
         $q .= ' WHERE `virtuemart_product_id` IN (' . implode(',', $cids) . ')';
         $db = JFactory::getDbo();
         $db->setQuery($q);
         $productNames = $db->loadColumn();
         vmInfo('COM_VIRTUEMART_PRODUCT_XREF_NAMES', implode(', ', $productNames));
     }
     $this->addViewPath(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'views');
     $document = JFactory::getDocument();
     $viewType = $document->getType();
     $view = $this->getView($this->_cname, $viewType);
     $view->setLayout($layoutName);
     $view->display();
 }
예제 #27
0
파일: user.php 프로젝트: lenard112/cms
 function removeAddress($virtuemart_userinfo_id)
 {
     $db = JFactory::getDBO();
     if (isset($virtuemart_userinfo_id) and $this->_id != 0) {
         //$userModel -> deleteAddressST();
         $q = 'DELETE FROM #__virtuemart_userinfos  WHERE virtuemart_user_id="' . $this->_id . '" AND virtuemart_userinfo_id="' . (int) $virtuemart_userinfo_id . '"';
         $db->setQuery($q);
         if ($db->execute()) {
             vmInfo('Address has been successfully deleted.');
             return true;
         }
     }
     return false;
 }
예제 #28
0
 function check()
 {
     $ok = TRUE;
     $notice = TRUE;
     if (empty($this->file_type) and empty($this->file_is_forSale)) {
         $ok = FALSE;
         vmError(tsmText::sprintf('com_tsmart_MEDIA_NO_TYPE'), $this->file_name);
     }
     if (!empty($this->file_url)) {
         if (function_exists('mb_strlen')) {
             $length = mb_strlen($this->file_url);
         } else {
             $length = strlen($this->file_url);
         }
         if ($length > 254) {
             vmError(JText::sprintf('com_tsmart_URL_TOO_LONG', $length));
         }
         if (strpos($this->file_url, '..') !== FALSE) {
             $ok = FALSE;
             vmError(tsmText::sprintf('com_tsmart_URL_NOT_VALID', $this->file_url));
         }
         if (empty($this->tsmart_media_id)) {
             $q = 'SELECT `tsmart_media_id`,`file_url` FROM `' . $this->_tbl . '` WHERE `file_url` = "' . $this->_db->escape($this->file_url) . '" ';
             $this->_db->setQuery($q);
             $unique_id = $this->_db->loadAssocList();
             $count = count($unique_id);
             if ($count !== 0) {
                 if ($count == 1) {
                     if (empty($this->tsmart_media_id)) {
                         $this->tsmart_media_id = $unique_id[0]['tsmart_media_id'];
                     } else {
                         vmError(tsmText::_('com_tsmart_MEDIA_IS_ALREADY_IN_DB'));
                         $ok = FALSE;
                     }
                 } else {
                     //      			vmError(vmText::_('com_tsmart_MEDIA_IS_DOUBLED_IN_DB'));
                     vmError(tsmText::_('com_tsmart_MEDIA_IS_DOUBLED_IN_DB'));
                     $ok = FALSE;
                 }
             }
         }
     } else {
         vmError(tsmText::_('com_tsmart_MEDIA_MUST_HAVE_URL'));
         $ok = FALSE;
     }
     if (empty($this->file_title) && !empty($this->file_name)) {
         $this->file_title = $this->file_name;
     }
     if (!empty($this->file_title)) {
         if (strlen($this->file_title) > 126) {
             vmError(tsmText::sprintf('com_tsmart_TITLE_TOO_LONG', strlen($this->file_title)));
         }
         $q = 'SELECT * FROM `' . $this->_tbl . '` ';
         $q .= 'WHERE `file_title`="' . $this->_db->escape($this->file_title) . '" AND `file_type`="' . $this->_db->escape($this->file_type) . '"';
         $this->_db->setQuery($q);
         $unique_id = $this->_db->loadAssocList();
         $tblKey = 'tsmart_media_id';
         if (!empty($unique_id)) {
             foreach ($unique_id as $item) {
                 if ($item['tsmart_media_id'] != $this->tsmart_media_id) {
                     $lastDir = substr($this->file_url, 0, strrpos($this->file_url, '/'));
                     $lastDir = substr($lastDir, strrpos($lastDir, '/') + 1);
                     if (!empty($lastDir)) {
                         $this->file_title = $this->file_title . '_' . $lastDir;
                     } else {
                         $this->file_title = $this->file_title . '_' . rand(1, 9);
                     }
                 }
             }
         }
     } else {
         vmError(tsmText::_('com_tsmart_MEDIA_MUST_HAVE_TITLE'));
         $ok = FALSE;
     }
     if (!empty($this->file_description)) {
         if (strlen($this->file_description) > 254) {
             vmError(tsmText::sprintf('com_tsmart_DESCRIPTION_TOO_LONG', strlen($this->file_description)));
         }
     }
     //		$app = JFactory::getApplication();
     //vmError('Checking '.$this->file_url);
     if (empty($this->file_mimetype)) {
         $rel_path = str_replace('/', DS, $this->file_url);
         //The function mime_content_type is deprecated, we may use
         /*function _mime_content_type($filename)
         			{
         				$result = new finfo();
         
         				if (is_resource($result) === true)
         				{
         					return $result->file($filename, FILEINFO_MIME_TYPE);
         				}
         
         				return false;
         			}
         			if (function_exists ('mime_content_type')) {
         				$ok = TRUE;
         				$app = JFactory::getApplication ();
         
         				if (!$this->file_is_forSale) {
         					$this->file_mimetype = mime_content_type (JPATH_ROOT . DS . $rel_path);
         				}
         				else {
         					$this->file_mimetype = mime_content_type ($rel_path);
         				}
         
         				if (!empty($this->file_mimetype)) {
         					if ($this->file_mimetype == 'directory') {
         						vmError ('cant store this media, is a directory ' . $rel_path);
         						return FALSE;
         					}
         					else {
         						if (strpos ($this->file_mimetype, 'corrupt') !== FALSE) {
         							vmError ('cant store this media, Document corrupt: Cannot read summary info ' . $rel_path);
         							return FALSE;
         						}
         					}
         				}
         				else {
         					vmError ('Couldnt resolve mime ' . $rel_path);
         					return FALSE;
         				}
         
         			}
         			else {*/
         if (!class_exists('JFile')) {
             require VMPATH_LIBS . DS . 'joomla' . DS . 'filesystem' . DS . 'file.php';
         }
         if (!$this->file_is_forSale) {
             $lastIndexOfSlash = strrpos($this->file_url, '/');
             $name = substr($this->file_url, $lastIndexOfSlash + 1);
             $file_extension = strtolower(JFile::getExt($name));
         } else {
             $lastIndexOfSlash = strrpos($this->file_url, DS);
             $name = substr($this->file_url, $lastIndexOfSlash + 1);
             $file_extension = strtolower(JFile::getExt($name));
         }
         if (empty($name)) {
             vmError(tsmText::_('com_tsmart_NO_MEDIA'));
         } elseif ($file_extension === 'jpg' or $file_extension === 'jpeg' or $file_extension === 'jpe') {
             $this->file_mimetype = 'image/jpeg';
         } elseif ($file_extension === 'gif') {
             $this->file_mimetype = 'image/gif';
         } elseif ($file_extension === 'png') {
             $this->file_mimetype = 'image/png';
         } elseif ($file_extension === 'bmp') {
             vmInfo(tsmText::sprintf('com_tsmart_MEDIA_SHOULD_NOT_BMP', $name));
             $notice = true;
         } elseif ($file_extension === 'mp3') {
             $this->file_mimetype = 'audio/mpeg';
         } elseif ($file_extension === 'ogg') {
             $this->file_mimetype = 'audio/ogg';
         } elseif ($file_extension === 'oga') {
             $this->file_mimetype = 'audio/vorbis';
         } elseif ($file_extension === 'wma') {
             $this->file_mimetype = 'audio-/x-ms-wma';
         } elseif ($file_extension === 'mp4' or $file_extension === 'mpe' or $file_extension === 'mpeg' or $file_extension === 'mpg' or $file_extension === 'mpga' or $file_extension === 'm2v') {
             $this->file_mimetype = 'video/mpeg';
         } elseif ($file_extension === 'avi') {
             $this->file_mimetype = 'video/x-msvideo';
         } elseif ($file_extension === 'qt' or $file_extension === 'mov') {
             $this->file_mimetype = 'video/quicktime';
         } elseif ($file_extension === 'wmv') {
             $this->file_mimetype = 'video/x-ms-wmv';
         } elseif ($file_extension === '3gp') {
             $this->file_mimetype = 'video/3gpp';
         } elseif ($file_extension === 'ogv') {
             $this->file_mimetype = 'video/ogg';
         } elseif ($file_extension === 'flv') {
             $this->file_mimetype = 'video/x-flv';
         } elseif ($file_extension === 'f4v') {
             $this->file_mimetype = 'video/x-f4v';
         } elseif ($file_extension === 'm4v') {
             $this->file_mimetype = 'video/x-m4v';
         } elseif ($file_extension === 'webm') {
             $this->file_mimetype = 'video/webm';
         } elseif ($file_extension === 'zip') {
             $this->file_mimetype = 'application/zip';
         } elseif ($file_extension === 'pdf') {
             $this->file_mimetype = 'application/pdf';
         } elseif ($file_extension === 'gz') {
             $this->file_mimetype = 'application/x-gzip';
         } elseif ($file_extension === 'exe') {
             $this->file_mimetype = 'application/octet-stream';
         } elseif ($file_extension === 'swf') {
             $this->file_mimetype = 'application/x-shockwave-flash';
         } elseif ($file_extension === 'doc') {
             $this->file_mimetype = 'application/msword';
         } elseif ($file_extension === 'docx') {
             $this->file_mimetype = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';
         } elseif ($file_extension === 'xls') {
             $this->file_mimetype = 'application/vnd.ms-excel';
         } elseif ($file_extension === 'xlsx') {
             $this->file_mimetype = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
         } elseif ($file_extension === 'ppt') {
             $this->file_mimetype = 'application/vnd.ms-powerpoint';
         } elseif ($file_extension === 'pptx') {
             $this->file_mimetype = 'application/vnd.openxmlformats-officedocument.presentationml.presentation';
         } elseif ($file_extension === 'txt') {
             $this->file_mimetype = 'text/plain';
         } elseif ($file_extension === 'rar') {
             $this->file_mimetype = 'application/x-rar-compressed';
         } else {
             vmInfo(tsmText::sprintf('com_tsmart_MEDIA_SHOULD_HAVE_MIMETYPE', $name));
             $notice = TRUE;
         }
         //}
     }
     //Nasty small hack, should work as long the word for default is in the language longer than 3 words and the first
     //letter should be always / or something like this
     //It prevents storing of the default path
     $a = trim(substr($this->file_url_thumb, 0, 4));
     $b = trim(substr(tsmText::_('com_tsmart_DEFAULT_URL'), 0, 4));
     if (strpos($a, $b) !== FALSE) {
         $this->file_url_thumb = null;
     }
     if ($ok) {
         return parent::check();
     } else {
         return FALSE;
     }
 }
예제 #29
0
 private function createPmtRefTable()
 {
     $db = JFactory::getDBO();
     $q = 'SELECT `extension_id` FROM `#__extensions` WHERE `folder` = "vmuserfield" and `state`="0" AND `element` = "' . $this->_name . '"';
     $db->setQuery($q);
     $extension_id = $db->loadResult();
     if (empty($extension_id)) {
         $app = JFactory::getApplication();
         $app->enqueueMessage(vmText::_('VMPAYMENT_REALEX_HPP_API_NO_PLUGIN_INSTALLED'));
         return;
     }
     // publish the plugin
     $q = "UPDATE  `#__extensions` SET  `enabled` =  '1' WHERE  `extension_id` =" . $extension_id;
     $db->setQuery($q);
     $db->execute();
     // is this plugin already
     $q = 'SELECT `virtuemart_userfield_id` FROM `#__virtuemart_userfields` WHERE `userfield_jplugin_id` = ' . $extension_id;
     $db->setQuery($q);
     $virtuemart_userfield_id = $db->loadResult();
     if (empty($virtuemart_userfield_id)) {
         //$app = JFactory::getApplication();
         //$app -> enqueueMessage(vmText::_('VMUSERFIELD_REALEX_NO_PLUGIN_ALREADY_INSTALLED'));
         $userFieldsModel = VmModel::getModel('UserFields');
         $data['virtuemart_userfield_id'] = 0;
         $data['published'] = 1;
         $data['userfield_jplugin_id'] = $extension_id;
         $data['required'] = 0;
         $data['account'] = 1;
         $data['shipment'] = 0;
         $data['registration'] = 0;
         $data['vNames'] = array();
         $data['vValues'] = array();
         $data['name'] = 'realex_hpp_api';
         $data['type'] = 'pluginrealex_hpp_api';
         $data['title'] = 'Payment means';
         $ret = $userFieldsModel->store($data);
         if (!$ret) {
             vmError(vmText::_('VMPAYMENT_REALEX_HPP_API_CREATE_USERFIELD_FAILED') . " " . $data['name'] . " " . $ret);
         } else {
             vmInfo(vmText::_('VMPAYMENT_REALEX_HPP_API_CREATE_USERFIELD_OK') . " " . $data['name']);
         }
     }
     JLoader::import('joomla.plugin.helper');
     JPluginHelper::importPlugin('vmuserfield');
     JFactory::getApplication()->triggerEvent('plgVmOnStoreInstallPluginTable', array('userfield', 'realex_hpp_api'));
 }
예제 #30
0
파일: redirect.php 프로젝트: lenard112/cms
 /**
  * @param bool $enqueueMessage
  * @return bool
  */
 public function validate($enqueueMessage = true)
 {
     if (!JFactory::getUser()->guest and $this->_method->realvault) {
         if ($storedCCs = $this->getStoredCCs(JFactory::getUser()->id)) {
             $saved_cc_selected = $this->customerData->getVar('saved_cc_selected');
             if ($this->customerData->getVar('selected_method') and empty($saved_cc_selected)) {
                 vmInfo('VMPAYMENT_REALEX_HPP_API_PLEASE_SELECT_OPTION');
                 return false;
             }
         }
     }
     return true;
 }