当前位置: 首页>>代码示例>>PHP>>正文


PHP tsmText::sprintf方法代码示例

本文整理汇总了PHP中tsmText::sprintf方法的典型用法代码示例。如果您正苦于以下问题:PHP tsmText::sprintf方法的具体用法?PHP tsmText::sprintf怎么用?PHP tsmText::sprintf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tsmText的用法示例。


在下文中一共展示了tsmText::sprintf方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 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);
     }
 }
开发者ID:cuongnd,项目名称:etravelservice,代码行数:31,代码来源:paypalexp.php

示例2: __construct

 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);
     }
 }
开发者ID:cuongnd,项目名称:etravelservice,代码行数:28,代码来源:paypalhosted.php

示例3: displayErrors

 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');
         }
     }
 }
开发者ID:cuongnd,项目名称:etravelservice,代码行数:10,代码来源:sofort.php

示例4: notifyList

 /**
  * 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;
 }
开发者ID:cuongnd,项目名称:etravelservice,代码行数:63,代码来源:waitinglist.php

示例5: getOrderHistory

 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;
 }
开发者ID:cuongnd,项目名称:etravelservice,代码行数:14,代码来源:subscribe.php

示例6: onNotificationUpdateOrderHistory

 /**
  * 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);
     }
 }
开发者ID:cuongnd,项目名称:etravelservice,代码行数:54,代码来源:capturenotification.php

示例7: save

 /**
  * 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);
 }
开发者ID:cuongnd,项目名称:etravelservice,代码行数:21,代码来源:hotel.php

示例8: __construct

 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);
     }
 }
开发者ID:cuongnd,项目名称:etravelservice,代码行数:18,代码来源:paypalapi.php

示例9: __construct

 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;
     }
 }
开发者ID:cuongnd,项目名称:etravelservice,代码行数:19,代码来源:paypalstd.php

示例10: getOrderHistory

 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;
 }
开发者ID:cuongnd,项目名称:etravelservice,代码行数:40,代码来源:recurring.php

示例11: onNotificationUpdateOrderHistory

 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;
 }
开发者ID:cuongnd,项目名称:etravelservice,代码行数:40,代码来源:refundnotification.php

示例12: defined

* @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>
开发者ID:cuongnd,项目名称:etravelservice,代码行数:31,代码来源:edit.php

示例13: defined

<?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";
开发者ID:cuongnd,项目名称:etravelservice,代码行数:26,代码来源:mail_raw_vendor.php

示例14:

		</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>
开发者ID:cuongnd,项目名称:etravelservice,代码行数:31,代码来源:default_shopfront.php

示例15: uploadFile

 /**
  * 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');
//.........这里部分代码省略.........
开发者ID:cuongnd,项目名称:etravelservice,代码行数:101,代码来源:tsmuploader.php


注:本文中的tsmText::sprintf方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。