コード例 #1
0
ファイル: paypalexp.php プロジェクト: cuongnd/etravelservice
 function __construct($method, $paypalPlugin)
 {
     parent::__construct($method, $paypalPlugin);
     //Set the credentials
     if ($this->_method->sandbox) {
         $this->api_login_id = $this->_method->sandbox_api_login_id;
         if ($this->_method->authentication == 'signature') {
             $this->api_signature = trim($this->_method->sandbox_api_signature);
             $this->api_certificate = '';
         } else {
             $this->api_signature = '';
             $this->api_certificate = trim($this->_method->sandbox_api_certificate);
         }
         $this->api_password = trim($this->_method->sandbox_api_password);
         $this->merchant_email = trim($this->_method->sandbox_merchant_email);
     } else {
         $this->api_login_id = trim($this->_method->api_login_id);
         $this->api_signature = trim($this->_method->api_signature);
         $this->api_certificate = trim($this->_method->api_certificate);
         $this->api_password = trim($this->_method->api_password);
         $this->merchant_email = trim($this->_method->paypal_merchant_email);
     }
     if (!$this->ExpCredentialsValid() or !$this->isAacceleratedOnboardingValid()) {
         $text = tsmText::sprintf('VMPAYMENT_PAYPAL_CREDENTIALS_NOT_SET', $this->_method->payment_name, $this->_method->virtuemart_paymentmethod_id);
         vmError($text, $text);
     }
     if (empty($this->_method->expected_maxamount)) {
         $text = tsmText::sprintf('VMPAYMENT_PAYPAL_PARAMETER_REQUIRED', tsmText::_('VMPAYMENT_PAYPAL_EXPECTEDMAXAMOUNT'), $this->_method->payment_name, $this->_method->virtuemart_paymentmethod_id);
         vmError($text, $text);
     }
 }
コード例 #2
0
 function __construct($method, $paypalPlugin)
 {
     parent::__construct($method, $paypalPlugin);
     //Set the credentials
     if ($this->_method->sandbox) {
         $this->api_login_id = trim($this->_method->sandbox_api_login_id);
         $this->api_signature = trim($this->_method->sandbox_api_signature);
         $this->api_password = trim($this->_method->sandbox_api_password);
         $this->payflow_partner = trim($this->_method->sandbox_payflow_partner);
         $this->payflow_vendor = trim($this->_method->sandbox_payflow_vendor);
     } else {
         $this->api_login_id = trim($this->_method->api_login_id);
         $this->api_signature = trim($this->_method->api_signature);
         $this->api_password = trim($this->_method->api_password);
     }
     if (empty($this->api_login_id) || empty($this->api_signature) || empty($this->api_password)) {
         $text = tsmText::sprintf('VMPAYMENT_PAYPAL_CREDENTIALS_NOT_SET', $this->_method->payment_name, $this->_method->virtuemart_paymentmethod_id);
         vmError($text, $text);
     }
     if (empty($this->_method->payflow_partner) or empty($this->_method->sandbox_payflow_partner)) {
         $sandbox = "";
         if ($this->_method->sandbox) {
             $sandbox = 'SANDBOX_';
         }
         $text = tsmText::sprintf('VMPAYMENT_PAYPAL_PARAMETER_REQUIRED', tsmText::_('VMPAYMENT_PAYPAL_' . $sandbox . 'PAYFLOW_PARTNER'), $this->_method->payment_name, $this->_method->virtuemart_paymentmethod_id);
         vmError($text);
     }
 }
コード例 #3
0
ファイル: sofort.php プロジェクト: cuongnd/etravelservice
 function displayErrors($errors)
 {
     foreach ($errors as $error) {
         vmError(tsmText::sprintf('VMPAYMENT_SOFORT_ERROR_FROM', $error['message'], $error['field'], $error['code']));
         vmInfo(tsmText::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');
         }
     }
 }
コード例 #4
0
 /**
  * Notify customers product is back in stock
  *
  * @author RolandD
  * @author Christopher Rouseel
  * @todo Add Itemid
  * @todo Do something if the mail cannot be send
  * @todo Update mail from
  * @todo Get the from name/email from the vendor
  */
 public function notifyList($tsmart_product_id, $subject = '', $mailbody = '', $max_number = 0)
 {
     if (!$tsmart_product_id) {
         return FALSE;
     }
     //sanitize id
     $tsmart_product_id = (int) $tsmart_product_id;
     $max_number = (int) $max_number;
     if (!class_exists('shopFunctionsF')) {
         require VMPATH_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php';
     }
     $vars = array();
     $waiting_users = $this->getWaitingusers($tsmart_product_id);
     /* Load the product details */
     $db = JFactory::getDbo();
     $q = "SELECT l.product_name,product_in_stock FROM `#__tsmart_products_" . tsmConfig::$vmlang . "` l\n\t\t\t\tJOIN `#__tsmart_products` p ON p.tsmart_product_id=l.tsmart_product_id\n\t\t\t   WHERE p.tsmart_product_id = " . $tsmart_product_id;
     $db->setQuery($q);
     $item = $db->loadObject();
     $vars['productName'] = $item->product_name;
     /*
     if ($item->product_in_stock <= 0) {
     	return FALSE;
     }
     */
     $url = JURI::root() . 'index.php?option=com_tsmart&view=productdetails&tsmart_product_id=' . $tsmart_product_id;
     $vars['link'] = '<a href="' . $url . '">' . $item->product_name . '</a>';
     if (empty($subject)) {
         $subject = tsmText::sprintf('com_tsmart_PRODUCT_WAITING_LIST_EMAIL_SUBJECT', $item->product_name);
     }
     $vars['subject'] = $subject;
     $vars['mailbody'] = $mailbody;
     $tsmart_vendor_id = 1;
     $vendorModel = tmsModel::getModel('vendor');
     $vendor = $vendorModel->getVendor($tsmart_vendor_id);
     $vendorModel->addImages($vendor);
     $vars['vendor'] = $vendor;
     $vars['vendorAddress'] = shopFunctions::renderVendorAddress($tsmart_vendor_id);
     $vendorEmail = $vendorModel->getVendorEmail($tsmart_vendor_id);
     $vars['vendorEmail'] = $vendorEmail;
     $i = 0;
     foreach ($waiting_users as $waiting_user) {
         $vars['user'] = $waiting_user->name;
         if (shopFunctionsF::renderMail('productdetails', $waiting_user->notify_email, $vars, 'productdetails')) {
             $db->setQuery('UPDATE #__tsmart_waitingusers SET notified=1 WHERE tsmart_waitinguser_id=' . $waiting_user->tsmart_waitinguser_id);
             $db->execute();
             $i++;
         }
         if (!empty($max_number) && $i >= $max_number) {
             break;
         }
     }
     return TRUE;
 }
コード例 #5
0
ファイル: subscribe.php プロジェクト: cuongnd/etravelservice
 function getOrderHistory($paybox_data, $order, $payments)
 {
     $amountInCurrency = vmPSPlugin::getAmountInCurrency($order['details']['BT']->order_total, $order['details']['BT']->order_currency);
     $order_history['comments'] = tsmText::sprintf('VMPAYMENT_' . $this->plugin_name . '_PAYMENT_STATUS_CONFIRMED_RECURRING', $amountInCurrency['display'], $order['details']['BT']->order_number);
     $amountInCurrency = vmPSPlugin::getAmountInCurrency($paybox_data['M'] * 0.01, $order['details']['BT']->order_currency);
     $order_history['comments'] .= "<br />" . tsmText::sprintf('VMPAYMENT_' . $this->plugin_name . '_PAYMENT_STATUS_CONFIRMED_RECURRING_2', $amountInCurrency['display']);
     $order_history['comments'] .= "<br />" . tsmText::_('VMPAYMENT_' . $this->plugin_name . '_RESPONSE_S') . ' ' . $paybox_data['S'];
     $subscribe_comment = '';
     $order_history['customer_notified'] = true;
     $order_history['comments'] .= $subscribe_comment;
     $order_history['recurring'] = $subscribe_comment;
     $order_history['order_status'] = $this->_method->status_success_subscribe;
     return $order_history;
 }
コード例 #6
0
 /**
  * if synchronous, then should not update order status
  * @param $order
  * @param $payments
  */
 function onNotificationUpdateOrderHistory($order, $payments)
 {
     if ($this->_currentMethod->authorization_mode_erp_disabled == 'automatic_synchronous') {
         return;
     }
     $order_history = array();
     $amazonState = "";
     $reasonCode = "";
     if ($this->amazonData->isSetCaptureDetails()) {
         $details = $this->amazonData->getCaptureDetails();
         if ($details->isSetCaptureStatus()) {
             $status = $details->getCaptureStatus();
             if ($status->isSetState()) {
                 $amazonState = $status->getState();
             } else {
                 // TODO THIS IS AN ERROR
             }
             if ($status->isSetReasonCode()) {
                 $reasonCode = $status->getReasonCode();
             }
         }
         // default value
         $order_history['customer_notified'] = 1;
         if ($amazonState == 'Completed') {
             $order_history['order_status'] = $this->_currentMethod->status_capture;
             $order_history['comments'] = tsmText::_('VMPAYMENT_AMAZON_COMMENT_STATUS_CAPTURE_NOTIFICATION');
         } elseif ($amazonState == 'Declined') {
             if ($reasonCode == 'AmazonRejected') {
                 $order_history['order_status'] = $this->_currentMethod->status_cancel;
             } elseif ($reasonCode == 'ProcessingFailure') {
                 // TODO  retry the Capture again if in Open State, and then call the capture again
                 $order_history['order_status'] = $this->_currentMethod->status_cancel;
             }
             $order_history['comments'] = tsmText::sprintf('VMPAYMENT_AMAZON_COMMENT_STATUS_CAPTURE_DECLINED', $reasonCode);
         } elseif ($amazonState == 'Pending') {
             $order_history['order_status'] = $this->_currentMethod->status_orderconfirmed;
             $order_history['comments'] = tsmText::_('VMPAYMENT_AMAZON_COMMENT_STATUS_CAPTURE_PENDING');
             $order_history['customer_notified'] = 0;
         } elseif ($amazonState == 'Closed') {
             // keep old status
             $order_history['customer_notified'] = 0;
             $order_history['order_status'] = $order['details']['BT']->order_status;
             $order_history['comments'] = tsmText::sprintf('VMPAYMENT_AMAZON_COMMENT_STATUS_CAPTURE_CLOSED', $reasonCode);
         }
         $order_history['amazonState'] = $amazonState;
         $orderModel = tmsModel::getModel('orders');
         $orderModel->updateStatusForOneOrder($order['details']['BT']->virtuemart_order_id, $order_history, false);
     }
 }
コード例 #7
0
ファイル: hotel.php プロジェクト: cuongnd/etravelservice
 /**
  * We want to allow html so we need to overwrite some request data
  *
  * @author Max Milbers
  */
 function save($data = 0)
 {
     $input = JFactory::getApplication()->input;
     $data = $input->getArray();
     $model = tmsModel::getModel($this->_cname);
     $id = $model->store($data);
     $msg = 'failed';
     if (!empty($id)) {
         $msg = tsmText::sprintf('com_tsmart_STRING_SAVED', $this->mainLangKey);
         $type = 'message';
     } else {
         $type = 'error';
     }
     $redir = 'index.php?option=com_tsmart&view=hotel';
     $this->setRedirect($redir, $msg, $type);
 }
コード例 #8
0
ファイル: paypalapi.php プロジェクト: cuongnd/etravelservice
 function __construct($method, $paypalPlugin)
 {
     parent::__construct($method, $paypalPlugin);
     //Set the credentials
     if ($this->_method->sandbox) {
         $this->api_login_id = trim($this->_method->sandbox_api_login_id);
         $this->api_signature = trim($this->_method->sandbox_api_signature);
         $this->api_password = trim($this->_method->sandbox_api_password);
     } else {
         $this->api_login_id = trim($this->_method->api_login_id);
         $this->api_signature = trim($this->_method->api_signature);
         $this->api_password = trim($this->_method->api_password);
     }
     if (empty($this->api_login_id) || empty($this->api_signature) || empty($this->api_password)) {
         $text = tsmText::sprintf('VMPAYMENT_PAYPAL_CREDENTIALS_NOT_SET', $this->_method->payment_name, $this->_method->virtuemart_paymentmethod_id);
         vmError($text, $text);
     }
 }
コード例 #9
0
ファイル: paypalstd.php プロジェクト: cuongnd/etravelservice
 function __construct($method, $paypalPlugin)
 {
     parent::__construct($method, $paypalPlugin);
     //Set the credentials
     if ($this->_method->sandbox) {
         $this->merchant_email = $this->_method->sandbox_merchant_email;
     } else {
         $this->merchant_email = $this->_method->paypal_merchant_email;
     }
     if (empty($this->merchant_email)) {
         $sandbox = "";
         if ($this->_method->sandbox) {
             $sandbox = 'SANDBOX_';
         }
         $text = tsmText::sprintf('VMPAYMENT_PAYPAL_PARAMETER_REQUIRED', tsmText::_('VMPAYMENT_PAYPAL_' . $sandbox . 'MERCHANT'), $this->_method->payment_name, $this->_method->virtuemart_paymentmethod_id);
         vmError($text, $text);
         return FALSE;
     }
 }
コード例 #10
0
ファイル: recurring.php プロジェクト: cuongnd/etravelservice
 function getOrderHistory($paybox_data, $order, $payments)
 {
     $amountInCurrency = vmPSPlugin::getAmountInCurrency($order['details']['BT']->order_total, $order['details']['BT']->order_currency);
     $order_history['comments'] = tsmText::sprintf('VMPAYMENT_' . $this->plugin_name . '_PAYMENT_STATUS_CONFIRMED_RECURRING', $amountInCurrency['display'], $order['details']['BT']->order_number);
     $amountInCurrency = vmPSPlugin::getAmountInCurrency($paybox_data['M'] * 0.01, $order['details']['BT']->order_currency);
     $order_history['comments'] .= "<br />" . tsmText::sprintf('VMPAYMENT_' . $this->plugin_name . '_PAYMENT_STATUS_CONFIRMED_RECURRING_2', $amountInCurrency['display']);
     $order_history['comments'] .= "<br />" . tsmText::_('VMPAYMENT_' . $this->plugin_name . '_RESPONSE_S') . ' ' . $paybox_data['S'];
     $recurring_comment = '';
     $payment = $payments[0];
     $recurring = json_decode($payment->recurring);
     if (count($payments) == 1) {
         $recurring_comment .= "<br />" . tsmText::sprintf('VMPAYMENT_' . $this->plugin_name . '_COMMENT_RECURRING_INFO', $payment->recurring_number, $payment->recurring_periodicity);
         $recurring_comment .= "<br />" . tsmText::_('VMPAYMENT_' . $this->plugin_name . '_COMMENT_NEXT_DEADLINES');
         $recurring_comment .= $this->getOrderRecurringTerms($payment, $order, 1);
         $status_success = 'status_success_' . $this->_method->debit_type;
         $order_history['order_status'] = $this->_method->{$status_success};
     } else {
         $nbRecurringDone = $this->getNbRecurringDone($payments);
         $this->debugLog('getNbRecurringDone:' . $nbRecurringDone, 'getOrderHistoryRecurring', 'debug', false);
         if ($nbRecurringDone < $payment->recurring_number) {
             $recurring_comment .= $this->getOrderRecurringTerms($payment, $order, $nbRecurringDone);
             $order_history['order_status'] = $this->_method->status_success_recurring;
         } else {
             $order_history['order_status'] = $this->_method->status_success_recurring_end;
         }
         $this->debugLog('Next status:' . $order_history['order_status'], 'getOrderHistoryRecurring', 'debug', false);
         $index_mont = "PBX_2MONT" . $nbRecurringDone;
         $index_date = "PBX_DATE" . $nbRecurringDone;
         //$text_mont = vmText::_('VMPAYMENT_'.$this->plugin_name.'_PAYMENT_RECURRING_2MONT') ;
         //$text_date = vmText::_('VMPAYMENT_'.$this->plugin_name.'_PAYMENT_RECURRING_DATE');
         //$recurring_comment .= "<br />" . $text_date . " " . $recurring->$index_date . " ";
         $amountInCurrency = vmPSPlugin::getAmountInCurrency($recurring->{$index_mont} * 0.01, $order['details']['BT']->order_currency);
         //$recurring_comment .= $text_mont . " " . $amountInCurrency['display'];
         $recurring_comment .= "<br />" . $recurring->{$index_date} . " " . $amountInCurrency['display'];
     }
     $order_history['customer_notified'] = true;
     $order_history['comments'] .= $recurring_comment;
     $order_history['recurring'] = $recurring_comment;
     return $order_history;
 }
コード例 #11
0
 function onNotificationUpdateOrderHistory($order, $payments)
 {
     $order_history = array();
     $amazonState = "";
     $reasonCode = "";
     if (!$this->amazonData->isSetRefundDetails()) {
         $this->debugLog('NO isSetRefundDetails' . __FUNCTION__ . var_export($this->amazonData, true), 'error');
         return;
     }
     $details = $this->amazonData->getRefundDetails();
     if (!$details->isSetRefundStatus()) {
         $this->debugLog('NO isSetRefundStatus' . __FUNCTION__ . var_export($this->amazonData, true), 'error');
         return;
     }
     $status = $details->getRefundStatus();
     if (!$status->isSetState()) {
         $this->debugLog('NO isSetState' . __FUNCTION__ . var_export($this->amazonData, true), 'error');
         return;
     }
     $amazonState = $status->getState();
     if ($status->isSetReasonCode()) {
         $reasonCode = $status->getReasonCode();
     }
     // default value
     $order_history['customer_notified'] = 1;
     if ($amazonState == 'Completed') {
         $order_history['order_status'] = $this->_currentMethod->status_refunded;
         $order_history['comments'] = tsmText::_('VMPAYMENT_AMAZON_COMMENT_STATUS_REFUND_COMPLETED');
     } elseif ($amazonState == 'Declined') {
         $order_history['customer_notified'] = 0;
         $order_history['comments'] = tsmText::sprintf('VMPAYMENT_AMAZON_COMMENT_STATUS_REFUND_DECLINED', $reasonCode);
         $order_history['order_status'] = $order['details']['BT']->order_status;
     } elseif ($amazonState == 'Pending') {
         $order_history['comments'] = tsmText::_('VMPAYMENT_AMAZON_COMMENT_STATUS_REFUND_PENDING');
         $order_history['order_status'] = $this->_currentMethod->status_orderconfirmed;
     }
     $orderModel = tmsModel::getModel('orders');
     $orderModel->updateStatusForOneOrder($order['details']['BT']->virtuemart_order_id, $order_history, false);
     return $amazonState;
 }
コード例 #12
0
ファイル: edit.php プロジェクト: cuongnd/etravelservice
* @version $Id: edit.php 8802 2015-03-18 17:12:44Z Milbo $
*/
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');
AdminUIHelper::startAdminArea($this);
?>

<form action="index.php" method="post" name="adminForm" id="adminForm">

<div class="col50">
	<fieldset>
<?php 
/*	<legend><?php echo vmText::_('com_tsmart_STATE_DETAILS'); ?></legend> */
?>
	<legend><?php 
echo JHtml::_('link', 'index.php?option=com_tsmart&view=state&tsmart_country_id=' . $this->tsmart_country_id, tsmText::sprintf('com_tsmart_STATE_COUNTRY', $this->country_name) . ' ' . tsmText::_('com_tsmart_DETAILS'));
?>
</legend>
	<table class="admintable">
		<?php 
echo VmHTML::row('input', 'com_tsmart_STATE_NAME', 'state_name', $this->state->state_name, 'class="required" size="50"');
echo VmHTML::row('booleanlist', 'com_tsmart_PUBLISHED', 'published', $this->state->published);
?>
		<tr>
		<td width="110" class="key">
				<label for="tsmart_worldzone_id">
					<?php 
echo tsmText::_('com_tsmart_WORLDZONE');
?>
				</label>
			</td>
コード例 #13
0
<?php

/**
*
* Layout for the shopping cart, look in mailshopper for more details
*
* @package	VirtueMart
* @subpackage Cart
* @author Max Milbers, Valerie Isaksen
*
* @link http://www.tsmart.net
* @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.
*
*/
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');
echo tsmText::sprintf('COM_VIRTUEMART_CART_NOTIFY_MAIL_RAW', $this->productName, $this->url);
if (!empty($this->orderDetails['details']['BT']->customer_note)) {
    echo "\n" . tsmText::sprintf('COM_VIRTUEMART_CART_MAIL_VENDOR_SHOPPER_QUESTION', $this->orderDetails['details']['BT']->customer_note);
}
echo "\n";
コード例 #14
0
		</div>
		<input type="text" class="inputbox" id="product_availability" name="rised_availability" value="<?php 
echo tsmConfig::get('rised_availability');
?>
"/>
		<span class="icon-nofloat vmicon vmicon-16-info tooltip" title="<?php 
echo '<b>' . tsmText::_('com_tsmart_AVAILABILITY') . '</b><br/ >' . tsmText::_('com_tsmart_PRODUCT_FORM_AVAILABILITY_TOOLTIP1');
?>
"></span>

		<div class="clr"></div>
		<?php 
echo JHtml::_('list.images', 'image', tsmConfig::get('rised_availability'), " ", $this->imagePath);
?>
		<span class="icon-nofloat vmicon vmicon-16-info tooltip" title="<?php 
echo '<b>' . tsmText::_('com_tsmart_AVAILABILITY') . '</b><br/ >' . tsmText::sprintf('com_tsmart_PRODUCT_FORM_AVAILABILITY_TOOLTIP2', $this->imagePath);
?>
"></span>

		<div class="clr"></div>
		<img border="0" id="imagelib" alt="<?php 
echo tsmText::_('com_tsmart_PREVIEW');
?>
" name="imagelib" src="<?php 
if (tsmConfig::get('rised_availability')) {
    echo JURI::root(true) . $this->imagePath . tsmConfig::get('rised_availability');
}
?>
"/>
	</fieldset>
	<fieldset>
コード例 #15
0
 /**
  * Handles the upload process of a media, sets the mime_type, when success
  *
  * @author Max Milbers
  * @param string $urlfolder relative url of the folder where to store the media
  * @return name of the uploaded file
  */
 static function uploadFile($urlfolder, &$obj, $overwrite = false)
 {
     if (empty($urlfolder) or strlen($urlfolder) < 2) {
         vmError('Not able to upload file, give path/url empty/too short ' . $urlfolder . ' please correct path in your tsmart config');
         return false;
     }
     if (!class_exists('JFile')) {
         require VMPATH_LIBS . DS . 'joomla' . DS . 'filesystem' . DS . 'file.php';
     }
     $media = vRequest::getFiles('upload');
     if (empty($media) or !isset($media['error'])) {
         vmError('Recieved no data for upload', 'Recieved no data for upload');
         vmdebug('no data in uploadFile ', $_FILES);
         return false;
     }
     $app = JFactory::getApplication();
     switch ($media['error']) {
         case 0:
             $path_folder = str_replace('/', DS, $urlfolder);
             //Sadly it does not work to upload unicode files,
             // the � for example is stored on windows as ä, this seems to be a php issue (maybe a config setting)
             /*	$dotPos = strrpos($media['name'],'.');
             				$safeMediaName = vmFile::makeSafe( $media['name'] );
             				if($dotPos!==FALSE){
             					$mediaPure = substr($media['name'],0,$dotPos);
             					$mediaExtension = strtolower(substr($media['name'],$dotPos));
             				}
             			*/
             $safeMediaName = vmFile::makeSafe($media['name']);
             $media['name'] = $safeMediaName;
             $mediaPure = JFile::stripExt($media['name']);
             $mediaExtension = strtolower(JFile::getExt($media['name']));
             if (empty($mediaExtension)) {
                 vmError('Invalid media; no extension ' . $media['name']);
                 return false;
             }
             if (!$overwrite) {
                 $i = 0;
                 while (file_exists(VMPATH_ROOT . DS . $path_folder . $mediaPure . '.' . $mediaExtension) and $i < 20) {
                     $mediaPure = $mediaPure . rand(1, 9);
                     $i++;
                 }
             }
             $media['name'] = $obj->file_name = $mediaPure . '.' . $mediaExtension;
             $type = exif_imagetype($media['tmp_name']);
             if ($type) {
                 vmdebug('Recognised image');
                 if (!self::checkMediaType($type, $mediaExtension)) {
                     vmError('Invalid media, image type does not fit to extension ' . $media['name']);
                     return false;
                 }
             } else {
                 if (!vmAccess::manager('media.potdang')) {
                     $m2ext = self::getMime2ExtArray();
                     $realMime = self::getMimeType($media['tmp_name']);
                     vmdebug('Uploading file $realMime', $realMime, $m2ext);
                     if (isset($m2ext[$realMime])) {
                         //if($rExt = array_search($realMime,$m2ext)!==false){
                         $rExt = $m2ext[$realMime];
                         $hless = self::getSafeExt2MimeArray();
                         vmdebug('Recognised nonimage, not safe ext', $rExt, $hless);
                         //$rExt = $hless[$realMime];
                         if (!isset($hless[$rExt])) {
                             vmError('Invalid media type, you are not allowed to upload this file, file type does not fit to mime ' . $media['name']);
                             return false;
                         } else {
                             vmdebug('Uploading file ', $hless[$rExt]);
                         }
                     } else {
                         return false;
                     }
                 }
             }
             if ($obj->file_is_forSale == 0) {
                 JFile::upload($media['tmp_name'], VMPATH_ROOT . DS . $path_folder . $media['name']);
             } else {
                 JFile::upload($media['tmp_name'], $path_folder . $media['name']);
             }
             $obj->file_mimetype = $media['type'];
             $obj->media_published = 1;
             $app->enqueueMessage(tsmText::sprintf('com_tsmart_FILE_UPLOAD_OK', VMPATH_ROOT . DS . $path_folder . $media['name']));
             return $media['name'];
         case 1:
             //uploaded file exceeds the upload_max_filesize directive in php.ini
             $app->enqueueMessage(tsmText::sprintf('com_tsmart_PRODUCT_FILES_ERR_UPLOAD_MAX_FILESIZE', $media['name'], $media['tmp_name']), 'warning');
             break;
         case 2:
             //uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the html form
             $app->enqueueMessage(tsmText::sprintf('com_tsmart_PRODUCT_FILES_ERR_MAX_FILE_SIZE', $media['name'], $media['tmp_name']), 'warning');
             break;
         case 3:
             //uploaded file was only partially uploaded
             $app->enqueueMessage(tsmText::sprintf('com_tsmart_PRODUCT_FILES_ERR_PARTIALLY', $media['name'], $media['tmp_name']), 'warning');
             break;
         case 4:
             //no file was uploaded
             //$vmLogger->warning( "You have not selected a file/image for upload." );
             break;
         default:
             //a default error, just in case!  :)
             //$vmLogger->warning( "There was a problem with your upload." );
             break;
     }
     return false;
 }
コード例 #16
0
ファイル: paypal.php プロジェクト: cuongnd/etravelservice
 protected function validateIpnContent($paypal_data)
 {
     $test_ipn = array_key_exists('test_ipn', $paypal_data) ? $paypal_data['test_ipn'] : 0;
     if ($test_ipn == 1) {
         //return true;
     }
     $paypal_data = $_POST;
     // Paypal wants to open the socket in SSL
     $port = 443;
     $paypal_url = $this->_getPaypalURL('ssl://', false);
     $paypal_url_header = $this->_getPaypalURL('', false);
     $protocol = 'ssl://';
     /*
      * Before we can trust the contents of the message, we must first verify that the message came from PayPal.
      * To verify the message, we must send back the contents in the exact order they
      *  were received and precede it with the command _notify-validate,
      */
     // read the post from PayPal system and add 'cmd'
     $post_msg = 'cmd=_notify-validate';
     if (function_exists('get_magic_quotes_gpc')) {
         $get_magic_quotes_exists = true;
     }
     foreach ($paypal_data as $key => $value) {
         if ($get_magic_quotes_exists == true && get_magic_quotes_gpc() == 1) {
             $value = str_replace('\\r\\n', "QQLINEBREAKQQ", $value);
             $value = urlencode(stripslashes($value));
             $value = str_replace("QQLINEBREAKQQ", "\r\n", $value);
         } else {
             $value = urlencode($value);
         }
         $post_msg .= "&{$key}={$value}";
     }
     $header = "POST /cgi-bin/webscr HTTP/1.1\r\n";
     $header .= "User-Agent: PHP/" . phpversion() . "\r\n";
     $header .= "Referer: " . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . @$_SERVER['QUERY_STRING'] . "\r\n";
     $header .= "Server: " . $_SERVER['SERVER_SOFTWARE'] . "\r\n";
     $header .= "Host: " . $paypal_url_header . ":" . $port . "\r\n";
     $header .= "Content-Type: application/x-www-form-urlencoded\r\n";
     $header .= "Content-Length: " . strlen($post_msg) . "\r\n";
     //$header .= "Accept: */*\r\n\r\n";
     $header .= "Connection: close\r\n\r\n";
     $fps = fsockopen($paypal_url, $port, $errno, $errstr, 30);
     $valid_ipn = false;
     if (!$fps) {
         $this->debugLog(tsmText::sprintf('VMPAYMENT_PAYPAL_ERROR_POSTING_IPN', $errstr, $errno), 'validateIpnContent', 'error', false);
     } else {
         $return = fputs($fps, $header . $post_msg);
         if ($return === false) {
             $this->debugLog("FALSE", 'validateIpnContent FPUTS', 'error', false);
             return FALSE;
         }
         $res = '';
         while (!feof($fps)) {
             $res .= fgets($fps, 1024);
         }
         fclose($fps);
         // Inspect IPN validation result and act accordingly
         $valid_ipn = strstr($res, "VERIFIED");
         if (!$valid_ipn) {
             if (strstr($res, "INVALID")) {
                 $errorInfo = array("paypal_data" => $paypal_data, 'post_msg' => $post_msg, 'paypal_res' => $res);
                 $this->debugLog($errorInfo, tsmText::_('VMPAYMENT_PAYPAL_ERROR_IPN_VALIDATION'), 'error', false);
             } else {
                 $this->debugLog(tsmText::_('VMPAYMENT_PAYPAL_ERROR_IPN_VALIDATION') . ": NO ANSWER FROM PAYPAL", 'validateIpnContent', 'error', false);
             }
         }
     }
     $this->debugLog('valid_ipn: ' . $valid_ipn, 'validateIpnContent', 'debug', false);
     return $valid_ipn;
 }
コード例 #17
0
ファイル: orders.php プロジェクト: cuongnd/etravelservice
 /**
  * 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 = tmsModel::getModel('orders');
     if ($lastTask == 'updatestatus') {
         // single order is in POST but we need an array
         $order = array();
         $tsmart_order_id = vRequest::getInt('tsmart_order_id');
         $order[$tsmart_order_id] = vRequest::getRequest();
         $result = $model->updateOrderStatus($order);
     } else {
         $result = $model->updateOrderStatus();
     }
     $msg = '';
     if ($result['updated'] > 0) {
         $msg = tsmText::sprintf('com_tsmart_ORDER_UPDATED_SUCCESSFULLY', $result['updated']);
     } else {
         if ($result['error'] == 0) {
             $msg .= tsmText::_('com_tsmart_ORDER_NOT_UPDATED');
         }
     }
     if ($result['error'] > 0) {
         $msg .= tsmText::sprintf('com_tsmart_ORDER_NOT_UPDATED_SUCCESSFULLY', $result['error'], $result['total']);
     }
     if ('updatestatus' == $lastTask) {
         $app->redirect('index.php?option=com_tsmart&view=orders&task=edit&tsmart_order_id=' . $tsmart_order_id, $msg);
     } else {
         $app->redirect('index.php?option=com_tsmart&view=orders', $msg);
     }
 }
コード例 #18
0
ファイル: medias.php プロジェクト: cuongnd/etravelservice
 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;
     }
 }
コード例 #19
0
ファイル: user.php プロジェクト: cuongnd/etravelservice
 public function getSwitchUserList($superVendor = null, $adminID = false)
 {
     if (!isset($superVendor)) {
         $superVendor = vmAccess::isSuperVendor();
     }
     $result = false;
     if ($superVendor) {
         $db = JFactory::getDbo();
         $search = vRequest::getUword('usersearch', '');
         if (!empty($search)) {
             $search = ' WHERE (`name` LIKE "%' . $search . '%" OR `username` LIKE "%' . $search . '%" OR `customer_number` LIKE "%' . $search . '%")';
         } else {
             if ($superVendor != 1) {
                 $search = ' WHERE vu.tsmart_vendor_id = ' . $superVendor . ' ';
             }
         }
         $q = 'SELECT ju.`id`,`name`,`username` FROM `#__users` as ju';
         if ($superVendor != 1 or !empty($search)) {
             $q .= ' LEFT JOIN #__tsmart_vmusers AS vmu ON vmu.tsmart_user_id = ju.id';
             if ($superVendor != 1) {
                 $q .= ' LEFT JOIN #__tsmart_vendor_users AS vu ON vu.tsmart_user_id = ju.id';
                 $search .= ' AND ( vmu.user_is_vendor = 0 OR (vmu.tsmart_vendor_id) IS NULL)';
             }
         }
         $current = JFactory::getUser();
         $hiddenUserID = $adminID ? $adminID : $current->id;
         if (!empty($search)) {
             $search .= ' AND ju.id!= "' . $hiddenUserID . '" ';
         } else {
             $q .= ' WHERE ju.id!= "' . $hiddenUserID . '" ';
         }
         $q .= $search . ' ORDER BY `name` LIMIT 0,10000';
         $db->setQuery($q);
         $result = $db->loadObjectList();
         if ($result) {
             foreach ($result as $k => $user) {
                 $result[$k]->displayedName = $user->name . '&nbsp;&nbsp;( ' . $user->username . ' )';
             }
         } else {
             $result = array();
         }
         if ($adminID) {
             $user = JFactory::getUser($adminID);
             if ($current->id != $user->id) {
                 $toAdd = new stdClass();
                 $toAdd->id = $user->id;
                 $toAdd->name = $user->name;
                 $toAdd->username = $user->username;
                 $toAdd->displayedName = tsmText::sprintf('com_tsmart_RETURN_TO', $user->name, $user->username);
                 array_unshift($result, $toAdd);
             }
         }
         $toAdd = new stdClass();
         $toAdd->id = 0;
         $toAdd->name = '';
         $toAdd->username = '';
         $toAdd->displayedName = '-' . tsmText::_('com_tsmart_REGISTER') . '-';
         array_unshift($result, $toAdd);
     }
     return $result;
 }
コード例 #20
0
ファイル: invoice.php プロジェクト: cuongnd/etravelservice
 function getInvoicePDF($orderDetails = 0, $viewName = 'invoice', $layout = 'invoice', $format = 'html', $force = false)
 {
     // 		$force = true;
     $path = tsmConfig::get('forSale_path', 0);
     if (empty($path)) {
         vmError('No path set to store invoices');
         return false;
     } else {
         $path .= shopFunctionsF::getInvoiceFolderName() . DS;
         if (!file_exists($path)) {
             vmError('Path wrong to store invoices, folder invoices does not exist ' . $path);
             return false;
         } else {
             if (!is_writable($path)) {
                 vmError('Cannot store pdf, directory not writeable ' . $path);
                 return false;
             }
         }
     }
     $orderModel = tmsModel::getModel('orders');
     $invoiceNumberDate = array();
     if (!$orderModel->createInvoiceNumber($orderDetails['details']['BT'], $invoiceNumberDate)) {
         return false;
     }
     if (!empty($invoiceNumberDate[0])) {
         $invoiceNumber = $invoiceNumberDate[0];
     } else {
         $invoiceNumber = FALSE;
     }
     if (!$invoiceNumber or empty($invoiceNumber)) {
         vmError('Cant create pdf, createInvoiceNumber failed');
         return 0;
     }
     if (shopFunctionsF::InvoiceNumberReserved($invoiceNumber)) {
         return 0;
     }
     //$path .= preg_replace('/[^A-Za-z0-9_\-\.]/', '_', 'vm'.$layout.'_'.$invoiceNumber.'.pdf');
     $path .= shopFunctionsF::getInvoiceName($invoiceNumber, $layout) . '.pdf';
     if (file_exists($path) and !$force) {
         return $path;
     }
     //We come from the be, so we need to load the FE language
     tsmConfig::loadJLang('com_virtuemart', true);
     $this->addViewPath(VMPATH_SITE . DS . 'views');
     $view = $this->getView($viewName, $format);
     $this->writeJs = false;
     $view->addTemplatePath(VMPATH_SITE . DS . 'views' . DS . $viewName . DS . 'tmpl');
     if (!class_exists('VmTemplate')) {
         require VMPATH_SITE . DS . 'helpers' . DS . 'vmtemplate.php';
     }
     $template = VmTemplate::loadVmTemplateStyle();
     $templateName = VmTemplate::setTemplate($template);
     if (!empty($templateName)) {
         $TemplateOverrideFolder = JPATH_SITE . DS . "templates" . DS . $templateName . DS . "html" . DS . "com_virtuemart" . DS . "invoice";
         if (file_exists($TemplateOverrideFolder)) {
             $view->addTemplatePath($TemplateOverrideFolder);
         }
     }
     $view->invoiceNumber = $invoiceNumberDate[0];
     $view->invoiceDate = $invoiceNumberDate[1];
     $view->orderDetails = $orderDetails;
     $view->uselayout = $layout;
     $view->showHeaderFooter = false;
     $vendorModel = tmsModel::getModel('vendor');
     $virtuemart_vendor_id = 1;
     //We could set this automatically by the vendorId stored in the order.
     $vendor = $vendorModel->getVendor($virtuemart_vendor_id);
     $metadata = array('title' => tsmText::sprintf('COM_VIRTUEMART_INVOICE_TITLE', $vendor->vendor_store_name, $view->invoiceNumber, $orderDetails['details']['BT']->order_number), 'keywords' => tsmText::_('COM_VIRTUEMART_INVOICE_CREATOR'));
     return VmPdf::createVmPdf($view, $path, 'F', $metadata);
 }
コード例 #21
0
 /**
  * Notify customer
  *
  * @author Seyi Awofadeju
  */
 public function notifycustomer()
 {
     $data = vRequest::getPost();
     $model = tmsModel::getModel('waitinglist');
     if (!$model->adduser($data)) {
         $this->setRedirect(JRoute::_('index.php?option=com_virtuemart&view=productdetails&layout=notify&virtuemart_product_id=' . $data['virtuemart_product_id'], FALSE), $msg);
     } else {
         $msg = tsmText::sprintf('COM_VIRTUEMART_STRING_SAVED', tsmText::_('COM_VIRTUEMART_CART_NOTIFY'));
         $this->setRedirect(JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=' . $data['virtuemart_product_id'], FALSE), $msg);
     }
 }
コード例 #22
0
ファイル: padded.php プロジェクト: cuongnd/etravelservice
* @copyright Copyright (c) 2013 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: cart.php 2551 2010-09-30 18:52:40Z milbo $
*/
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');
echo '<a class="continue_link" href="' . $this->continue_link . '" >' . tsmText::_('COM_VIRTUEMART_CONTINUE_SHOPPING') . '</a>';
echo '<a class="showcart floatright" href="' . $this->cart_link . '">' . tsmText::_('COM_VIRTUEMART_CART_SHOW') . '</a>';
if ($this->products) {
    foreach ($this->products as $product) {
        if ($product->quantity > 0) {
            echo '<h4>' . tsmText::sprintf('COM_VIRTUEMART_CART_PRODUCT_ADDED', $product->product_name, $product->quantity) . '</h4>';
        } else {
            if (!empty($product->errorMsg)) {
                echo '<div>' . $product->errorMsg . '</div>';
            }
        }
    }
}
if (tsmConfig::get('popup_rel', 1)) {
    //VmConfig::$echoDebug=true;
    if ($this->products and is_array($this->products) and count($this->products) > 0) {
        $product = reset($this->products);
        $customFieldsModel = tmsModel::getModel('customfields');
        $product->customfields = $customFieldsModel->getCustomEmbeddedProductCustomFields($product->allIds, 'R');
        $customFieldsModel->displayProductCustomfieldFE($product, $product->customfields);
        if (!empty($product->customfields)) {
コード例 #23
0
ファイル: paybox.php プロジェクト: cuongnd/etravelservice
 /**
  * @param $paybox_data
  * @param $order
  * @return mixed
  */
 function getOrderHistory($paybox_data, $order, $payments)
 {
     $amountInCurrency = vmPSPlugin::getAmountInCurrency($paybox_data['M'] * 0.01, $order['details']['BT']->order_currency);
     $order_history['comments'] = tsmText::sprintf('VMPAYMENT_' . $this->plugin_name . '_PAYMENT_STATUS_CONFIRMED', $amountInCurrency['display'], $order['details']['BT']->order_number);
     $order_history['comments'] .= "<br />" . tsmText::_('VMPAYMENT_' . $this->plugin_name . '_RESPONSE_S') . ' ' . $paybox_data['S'];
     $order_history['customer_notified'] = true;
     $status_success = 'status_success_' . $this->_method->debit_type;
     $order_history['order_status'] = $this->_method->{$status_success};
     return $order_history;
 }
コード例 #24
0
 static function _getCustomPrice($customPrice, $currency, $calculator)
 {
     if ((double) $customPrice) {
         $price = strip_tags($currency->priceDisplay($calculator->calculateCustomPriceWithTax($customPrice)));
         if ($customPrice > 0) {
             $price = "+" . $price;
         }
     } else {
         $price = $customPrice === '' ? '' : tsmText::sprintf('com_tsmart_CART_PRICE_FREE', $currency->getSymbol());
     }
     return $price;
 }
コード例 #25
0
ファイル: view.html.php プロジェクト: cuongnd/etravelservice
 static function displayLinkToParent($product_parent_id)
 {
     $db = JFactory::getDBO();
     $db->setQuery(' SELECT * FROM `#__tsmart_products_' . tsmConfig::$vmlang . '` as l JOIN `#__tsmart_products` using (`tsmart_product_id`) WHERE `tsmart_product_id` = ' . $product_parent_id);
     if ($parent = $db->loadObject()) {
         $result = tsmText::sprintf('com_tsmart_LIST_CHILDREN_FROM_PARENT', htmlentities($parent->product_name));
         echo JHtml::_('link', JRoute::_('index.php?view=product&product_parent_id=' . $product_parent_id . '&option=com_tsmart'), $parent->product_name, array('title' => $result));
     }
 }
コード例 #26
0
		</div>
		<div class="dcc_choices">
			<div class="dcc_choice">
				<input class="dcc_offer_btn vm-button" name="dcc_choice" id="dcc_choice_1" type="radio" value="1">
				<label for="dcc_choice_1">
					<?php 
    echo tsmText::sprintf('VMPAYMENT_REALEX_HPP_API_DCC_PAY_OWN_CURRENCY_YES', $this->getCardHolderAmount($viewData['dccinfo']->cardholderamount), $viewData['dccinfo']->cardholdercurrency);
    ?>
				</label>
			</div>
			<div class="dcc_choice">
				<input class="dcc_offer_btn vm-button" name="dcc_choice" id="dcc_choice_0" type="radio" value="0"
				       checked="checked"> <label for="dcc_choice_0">
					<?php 
    echo tsmText::sprintf('VMPAYMENT_REALEX_HPP_API_DCC_PAY_OWN_CURRENCY_NO', $this->getCardHolderAmount($viewData['dccinfo']->merchantamount), $viewData['dccinfo']->merchantcurrency);
    ?>
				</label>
			</div>
		</div>

	</div>
<?php 
}
if ($viewData['integration'] == 'remote') {
    ?>
	<?php 
    if (!$viewData['dccinfo']) {
        ?>
		<?php 
        if ($viewData['offer_save_card']) {
コード例 #27
0
ファイル: notify.php プロジェクト: cuongnd/etravelservice
 * is derivative of works licensed under the GNU General Public License or
 * other free or open source software licenses.
 * @version $Id: default_reviews.php 5428 2012-02-12 04:41:22Z electrocity $
 */
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');
// Implement Joomla's form validation
JHTML::_('behavior.formvalidation');
?>
<div class="vm-wrap">
  <h1><?php 
echo tsmText::_('COM_VIRTUEMART_CART_NOTIFY');
?>
</h1>
  <p><?php 
echo tsmText::sprintf('COM_VIRTUEMART_CART_NOTIFY_DESC', $this->product->product_name);
?>
</p>
  <form class="form-validate" method="post" action="<?php 
echo JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=' . $this->product->virtuemart_product_id . '&virtuemart_category_id=' . $this->product->virtuemart_category_id, FALSE);
?>
" name="notifyform" id="notifyform">
    <label for="notify_email" class="vm-nodisplay"><?php 
echo tsmText::_('COM_VIRTUEMART_EMAIL');
?>
</label>
    <input class="required validate-email" id="notify_email" type="email" name="notify_email" value="<?php 
echo $this->user->email;
?>
" placeholder="<?php 
echo tsmText::_('COM_VIRTUEMART_EMAIL');
コード例 #28
0
ファイル: view.html.php プロジェクト: cuongnd/etravelservice
 /**
  * renderMailLayout
  *
  * @author Max Milbers
  * @author Valerie Isaksen
  */
 public function renderMailLayout($doVendor, $recipient)
 {
     $this->useSSL = tsmConfig::get('useSSL', 0);
     $this->useXHTML = true;
     $userFieldsModel = tmsModel::getModel('UserFields');
     $userFields = $userFieldsModel->getUserFields();
     $this->userFields = $userFieldsModel->getUserFieldsFilled($userFields, $this->user->userInfo);
     if (tsmConfig::get('order_mail_html')) {
         $mailFormat = 'html';
         $lineSeparator = "<br />";
     } else {
         $mailFormat = 'raw';
         $lineSeparator = "\n";
     }
     $virtuemart_vendor_id = 1;
     $vendorModel = tmsModel::getModel('vendor');
     $vendor = $vendorModel->getVendor($virtuemart_vendor_id);
     $vendorModel->addImages($vendor);
     $vendor->vendorFields = $vendorModel->getVendorAddressFields();
     $this->assignRef('vendor', $vendor);
     if (!$doVendor) {
         $this->subject = tsmText::sprintf('COM_VIRTUEMART_NEW_SHOPPER_SUBJECT', $this->user->username, $this->vendor->vendor_store_name);
         $tpl = 'mail_' . $mailFormat . '_reguser';
     } else {
         $this->subject = tsmText::sprintf('COM_VIRTUEMART_VENDOR_NEW_SHOPPER_SUBJECT', $this->user->username, $this->vendor->vendor_store_name);
         $tpl = 'mail_' . $mailFormat . '_regvendor';
     }
     $this->assignRef('recipient', $recipient);
     $this->vendorEmail = $vendorModel->getVendorEmail($this->vendor->virtuemart_vendor_id);
     $this->layoutName = $tpl;
     $this->setLayout($tpl);
     $this->isMail = true;
     parent::display();
 }
コード例 #29
0
    function addStandardEditViewCommandsNoValidate($id = 0, $object = null)
    {
        $view = vRequest::getCmd('view', vRequest::getCmd('controller', 'tsmart'));
        if (!class_exists('JToolBarHelper')) {
            require JPATH_ADMINISTRATOR . DS . 'includes' . DS . 'toolbar.php';
        }
        JToolBarHelper::divider();
        if (vmAccess::manager($view . '.edit')) {
            JToolBarHelper::save();
            JToolBarHelper::apply();
        }
        JToolBarHelper::cancel();
        //self::showHelp();
        //self::showACLPref($view);
        if ($view != 'shipmentmethod' and $view != 'paymentmethod' and $view != 'media') {
            $validate = true;
        } else {
            $validate = false;
        }
        $this->addJsJoomlaSubmitButtonNoValidate($validate);
        $editView = vRequest::getCmd('view', vRequest::getCmd('controller', ''));
        $params = JComponentHelper::getParams('com_languages');
        $selectedLangue = $params->get('site', 'en-GB');
        $this->lang = strtolower(strtr($selectedLangue, '-', '_'));
        // Get all the published languages defined in Language manager > Content
        $allLanguages = JLanguageHelper::getLanguages();
        foreach ($allLanguages as $jlang) {
            $languagesByCode[$jlang->lang_code] = $jlang;
        }
        // only add if ID and view not null
        if ($editView and $id and count(tsmConfig::get('active_languages')) > 1) {
            if ($editView == 'user') {
                $editView = 'vendor';
            }
            jimport('joomla.language.helper');
            $this->lang = vRequest::getVar('vmlang', $this->lang);
            // list of languages installed in #__extensions (may be more than the ones in the Language manager > Content if the user did not added them)
            $languages = JLanguageHelper::createLanguageList($selectedLangue, constant('VMPATH_ROOT'), true);
            $activeVmLangs = tsmConfig::get('active_languages');
            $flagCss = "";
            foreach ($languages as $k => &$joomlaLang) {
                if (!in_array($joomlaLang['value'], $activeVmLangs)) {
                    unset($languages[$k]);
                } else {
                    $key = $joomlaLang['value'];
                    if (!isset($languagesByCode[$key])) {
                        $img = substr($key, 0, 2);
                        //We try a fallback
                        vmdebug('com_tsmart_MISSING_FLAG', $img, $joomlaLang['text']);
                    } else {
                        $img = $languagesByCode[$key]->image;
                    }
                    $image_flag = VMPATH_ROOT . "/media/mod_languages/images/" . $img . ".gif";
                    $image_flag_url = JURI::root() . "media/mod_languages/images/" . $img . ".gif";
                    if (!file_exists($image_flag)) {
                        vmerror(tsmText::sprintf('com_tsmart_MISSING_FLAG', $image_flag, $joomlaLang['text']));
                    } else {
                        $flagCss .= "td.flag-" . $key . ",.flag-" . $key . "{background: url( " . $image_flag_url . ") no-repeat 0 0; padding-left:20px !important;}\n";
                    }
                }
            }
            JFactory::getDocument()->addStyleDeclaration($flagCss);
            $this->langList = JHtml::_('select.genericlist', $languages, 'vmlang', 'class="inputbox" style="width:176px;"', 'value', 'text', $selectedLangue, 'vmlang');
            if ($editView == 'product') {
                $productModel = tmsModel::getModel('product');
                $childproducts = $productModel->getProductChilds($id) ? $productModel->getProductChilds($id) : '';
            }
            $token = vRequest::getFormToken();
            $j = '
			jQuery(function($) {
				var oldflag = "";
				$("select#vmlang").chosen().change(function() {
					langCode = $(this).find("option:selected").val();
					flagClass = "flag-"+langCode;
					jQuery.ajax({
						type: "GET",
						cache: false,
        				dataType: "json",
        				url: "index.php?option=com_tsmart&view=translate&task=paste&format=json&lg="+langCode+"&id=' . $id . '&editView=' . $editView . '&' . $token . '=1",
    				}).done(
						function(data) {
							var items = [];

							var theForm = document.forms["adminForm"];
							if(typeof theForm.vmlang==="undefined"){
							 	var input = document.createElement("input");
								input.type = "hidden";
								input.name = "vmlang";
								input.value = langCode;
								theForm.appendChild(input);
							} else {
								theForm.vmlang.value = langCode;
							}
							if (data.fields !== "error" ) {
								if (data.structure == "empty") alert(data.msg);
								$.each(data.fields , function(key, val) {
									cible = jQuery("#"+key);
									if (oldflag !== "") cible.parent().removeClass(oldflag)
									var tmce_ver = 0;
									if(typeof window.tinyMCE!=="undefined"){
										var tmce_ver=window.tinyMCE.majorVersion;
									}
									if (tmce_ver>="4") {
										if (cible.parent().addClass(flagClass).children().hasClass("mce_editable") && data.structure !== "empty" ) {
											tinyMCE.get(key).execCommand("mceSetContent", false,val);
											cible.val(val);
										} else if (data.structure !== "empty") cible.val(val);
									} else {
										if (cible.parent().addClass(flagClass).children().hasClass("mce_editable") && data.structure !== "empty" ) {
											tinyMCE.execInstanceCommand(key,"mceSetContent",false,val);
											cible.val(val);
										} else if (data.structure !== "empty") cible.val(val);
									}
									});

							} else alert(data.msg);';
            if ($editView == 'product' && !empty($childproducts)) {
                foreach ($childproducts as $child) {
                    $j .= 'jQuery.ajax({
        						type: "GET",
								cache: false,
        						dataType: "json",
        						url: "index.php?option=com_tsmart&view=translate&task=paste&format=json&lg="+langCode+"&id=' . $child->tsmart_product_id . '&editView=' . $editView . '&' . $token . '=1",
    					}).done(
								//	$.getJSON( "index.php?option=com_tsmart&view=translate&task=paste&format=json&lg="+langCode+"&id=' . $child->tsmart_product_id . '&editView=' . $editView . '&' . $token . '=1" ,
										function(data) {
											cible = jQuery("#child' . $child->tsmart_product_id . 'product_name");
											if (oldflag !== "") cible.parent().removeClass(oldflag)
											cible.parent().addClass(flagClass);
											cible.val(data.fields.product_name);
											jQuery("#child' . $child->tsmart_product_id . 'slug").val(data.fields["slug"]);
										}
									)
								';
                }
            }
            $j .= 'oldflag = flagClass ;
						}
					)
				});
			})';
            vmJsApi::addJScript('vmlang', $j);
        } else {
            $jlang = JFactory::getLanguage();
            $langs = $jlang->getKnownLanguages();
            $defautName = $selectedLangue;
            $flagImg = $selectedLangue;
            if (isset($languagesByCode[$selectedLangue])) {
                $defautName = $langs[$selectedLangue]['name'];
                $flagImg = JHtml::_('image', 'mod_languages/' . $languagesByCode[$selectedLangue]->image . '.gif', $languagesByCode[$selectedLangue]->title_native, array('title' => $languagesByCode[$selectedLangue]->title_native), true);
            } else {
                vmWarn(tsmText::sprintf('com_tsmart_MISSING_FLAG', $selectedLangue, $selectedLangue));
            }
            $this->langList = '<input name ="vmlang" type="hidden" value="' . $selectedLangue . '" >' . $flagImg . ' <b> ' . $defautName . '</b>';
        }
        if (JFactory::getApplication()->isSite()) {
            $bar = JToolBar::getInstance('toolbar');
            $bar->appendButton('Link', 'back', 'com_tsmart_LEAVE', 'index.php?option=com_tsmart&manage=0');
        }
    }
コード例 #30
0
            if ($customfield->field_type == 'C') {
                $colspan = 'colspan="2" ';
            }
            if ($customfield->override != 0 or $customfield->disabler != 0) {
                if (!empty($customfield->disabler)) {
                    $checkValue = $customfield->disabler;
                }
                if (!empty($customfield->override)) {
                    $checkValue = $customfield->override;
                }
                $title = tsmText::sprintf('com_tsmart_CUSTOM_OVERRIDE', $checkValue) . '</br>';
                if ($customfield->disabler != 0) {
                    $title = tsmText::sprintf('com_tsmart_CUSTOM_DISABLED', $checkValue) . '</br>';
                }
                if ($customfield->override != 0) {
                    $title = tsmText::sprintf('com_tsmart_CUSTOM_OVERRIDE', $checkValue) . '</br>';
                }
            } else {
                if ($customfield->tsmart_product_id == $this->product->product_parent_id) {
                    $title = tsmText::_('com_tsmart_CUSTOM_INHERITED') . '</br>';
                }
            }
            if (!empty($title)) {
                $text = '<span style="white-space: nowrap;" class="hasTip" title="' . htmlentities(tsmText::_('com_tsmart_CUSTOMFLD_DIS_DER_TIP')) . '">d:' . VmHtml::checkbox('field[' . $i . '][disabler]', $customfield->disabler, $checkValue) . '</span>
							<span style="white-space: nowrap;" class="hasTip" title="' . htmlentities(tsmText::_('com_tsmart_DIS_DER_CUSTOMFLD_OVERR_DER_TIP')) . '">o:' . VmHtml::checkbox('field[' . $i . '][override]', $customfield->override, $checkValue) . '</span>';
            }
            $tables['fields'] .= '<tr class="removable">
							<td >
							<b>' . tsmText::_($type) . '</b> ' . tsmText::_($customfield->custom_title) . '</span><br/>
								' . $title . ' ' . $text . '
								<span class="vmicon vmicon-16-' . $cartIcone . '"></span>';