本文整理汇总了PHP中shopFunctions::checkSafePath方法的典型用法代码示例。如果您正苦于以下问题:PHP shopFunctions::checkSafePath方法的具体用法?PHP shopFunctions::checkSafePath怎么用?PHP shopFunctions::checkSafePath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类shopFunctions
的用法示例。
在下文中一共展示了shopFunctions::checkSafePath方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
function display($tpl = null)
{
$this->loadHelper('image');
$this->loadHelper('html');
$model = VmModel::getModel();
$usermodel = VmModel::getModel('user');
JToolBarHelper::title(JText::_('COM_VIRTUEMART_CONFIG'), 'head vm_config_48');
$this->addStandardEditViewCommands();
$config = VmConfig::loadConfig();
if (!empty($config->_params)) {
unset($config->_params['pdf_invoice']);
// parameter remove and replaced by inv_os
}
$this->config = $config;
$this->userparams = JComponentHelper::getParams('com_users');
$this->jTemplateList = ShopFunctions::renderTemplateList(JText::_('COM_VIRTUEMART_ADMIN_CFG_JOOMLA_TEMPLATE_DEFAULT'));
$this->vmLayoutList = $model->getLayoutList('virtuemart', VmConfig::get('vmlayout', 0), 'vmlayout');
$this->categoryLayoutList = $model->getLayoutList('category', VmConfig::get('categorylayout', 0), 'categorylayout');
$this->productLayoutList = $model->getLayoutList('productdetails', VmConfig::get('productlayout', 0), 'productlayout');
$this->noimagelist = $model->getNoImageList();
$this->orderStatusModel = VmModel::getModel('orderstatus');
$this->currConverterList = $model->getCurrencyConverterList();
$this->moduleList = $model->getModuleList();
$this->activeLanguages = $model->getActiveLanguages(VmConfig::get('active_languages'));
$this->orderByFields = $model->getProductFilterFields('browse_orderby_fields');
$this->searchFields = $model->getProductFilterFields('browse_search_fields');
$this->aclGroups = $usermodel->getAclGroupIndentedTree();
if (is_Dir(VmConfig::get('vmtemplate') . DS . 'images' . DS . 'availability' . DS)) {
$imagePath = VmConfig::get('vmtemplate') . '/images/availability/';
} else {
$imagePath = '/components/com_virtuemart/assets/images/availability/';
}
$this->imagePath = $imagePath;
shopFunctions::checkSafePath();
$this->checkVmUserVendor();
parent::display($tpl);
}
示例2: display
//.........这里部分代码省略.........
/* Data for the Edit Status form popup */
$_currentOrderStat = $order['details']['BT']->order_status;
// used to update all item status in one time
$_orderStatusSelect = JHtml::_('select.genericlist', $orderStates, 'order_status', 'style="width:100px;"', 'order_status_code', 'order_status_name', $_currentOrderStat, 'order_items_status', true);
$this->assignRef('orderStatSelect', $_orderStatusSelect);
$this->assignRef('currentOrderStat', $_currentOrderStat);
/* Toolbar */
if (JVM_VERSION < 3) {
$backward = "back";
$list = 'back';
} else {
$backward = 'backward';
$list = 'list';
}
JToolBarHelper::custom('prevItem', $backward, '', 'com_tsmart_ITEM_PREVIOUS', false);
JToolBarHelper::custom('nextItem', 'forward', '', 'com_tsmart_ITEM_NEXT', false);
JToolBarHelper::divider();
JToolBarHelper::custom('cancel', $list, '', 'com_tsmart_ORDER_LIST_LBL', false, false);
} else {
if ($curTask == 'editOrderItem') {
if (!class_exists('calculationHelper')) {
require VMPATH_ADMIN . DS . 'helpers' . DS . 'calculationh.php';
}
$this->assignRef('orderstatuses', $orderStates);
$model = tmsModel::getModel();
$orderId = vRequest::getString('orderId', '');
$orderLineItem = vRequest::getVar('orderLineId', '');
$this->assignRef('tsmart_order_id', $orderId);
$this->assignRef('tsmart_order_item_id', $orderLineItem);
$orderItem = $model->getOrderLineDetails($orderId, $orderLineItem);
$this->assignRef('orderitem', $orderItem);
} else {
$this->setLayout('orders');
$model = tmsModel::getModel();
$this->addStandardDefaultViewLists($model, 'created_on');
$orderStatusModel = tmsModel::getModel('orderstatus');
$orderstates = vRequest::getCmd('order_status_code', '');
$this->lists['state_list'] = $orderStatusModel->renderOSList($orderstates, 'order_status_code', FALSE, ' onchange="this.form.submit();" ');
$orderslist = $model->getOrdersList();
$this->assignRef('orderstatuses', $orderStates);
if (!class_exists('CurrencyDisplay')) {
require VMPATH_ADMIN . DS . 'helpers' . DS . 'currencydisplay.php';
}
/* Apply currency This must be done per order since it's vendor specific */
$_currencies = array();
// Save the currency data during this loop for performance reasons
if ($orderslist) {
foreach ($orderslist as $tsmart_order_id => $order) {
if (!empty($order->order_currency)) {
$currency = $order->order_currency;
} else {
if ($order->tsmart_vendor_id) {
if (!class_exists('tsmartModelVendor')) {
require VMPATH_ADMIN . DS . 'models' . DS . 'vendor.php';
}
$currObj = tsmartModelVendor::getVendorCurrency($order->tsmart_vendor_id);
$currency = $currObj->tsmart_currency_id;
}
}
//This is really interesting for multi-X, but I avoid to support it now already, lets stay it in the code
if (!array_key_exists('curr' . $currency, $_currencies)) {
$_currencies['curr' . $currency] = CurrencyDisplay::getInstance($currency, $order->tsmart_vendor_id);
}
$order->order_total = $_currencies['curr' . $currency]->priceDisplay($order->order_total);
$order->invoiceNumber = $model->getInvoiceNumber($order->tsmart_order_id);
}
}
//update order items button
/*$q = 'SELECT * FROM #__tsmart_order_items WHERE `product_discountedPriceWithoutTax` IS NULL ';
$db = JFactory::getDBO();
$db->setQuery($q);
//$res = $db->loadRow();
if(true) {
JToolBarHelper::custom('updateCustomsOrderItems', 'new', 'new', vmText::_('com_tsmart_REPORT_UPDATEORDERITEMS'),false);
vmError('com_tsmart_UPDATEORDERITEMS_WARN');
}*/
/*
* UpdateStatus removed from the toolbar; don't understand how this was intented to work but
* the order ID's aren't properly passed. Might be readded later; the controller needs to handle
* the arguments.
*/
/* Toolbar */
//JToolBarHelper::customX( 'CreateOrderHead', 'new','new','New',false);
JToolBarHelper::save('updatestatus', tsmText::_('com_tsmart_UPDATE_STATUS'));
if (vmAccess::manager('orders.delete')) {
JToolBarHelper::spacer('80');
JToolBarHelper::deleteList();
}
/* Assign the data */
$this->assignRef('orderslist', $orderslist);
$this->pagination = $model->getPagination();
}
}
if (JFactory::getApplication()->isSite()) {
$bar = JToolBar::getInstance('toolbar');
$bar->appendButton('Link', 'back', 'com_tsmart_LEAVE', 'index.php?option=com_tsmart&manage=0');
}
shopFunctions::checkSafePath();
parent::display($tpl);
}
示例3: setFileInfo
/**
* Sets the file information and paths/urls and so on.
*
* @author Max Milbers
* @param unknown_type $filename
* @param unknown_type $url
* @param unknown_type $path
*/
function setFileInfo($type = 0)
{
$this->file_url_folder = '';
$this->file_path_folder = '';
$this->file_url_folder_thumb = '';
if ($this->file_is_forSale == 0 and $type != 'forSale') {
$this->file_url_folder = $this->getMediaUrlByView($type);
$this->file_url_folder_thumb = $this->file_url_folder . 'resized/';
$this->file_path_folder = str_replace('/', DS, $this->file_url_folder);
} else {
if (!class_exists('shopFunctions')) {
require VMPATH_SITE . DS . 'helpers' . DS . 'shopfunctions.php';
}
$safePath = shopFunctions::checkSafePath();
if (!$safePath) {
return FALSE;
}
$this->file_path_folder = $safePath;
$this->file_url_folder = $this->file_path_folder;
//str_replace(DS,'/',$this->file_path_folder);
$this->file_url_folder_thumb = VmConfig::get('forSale_path_thumb');
}
//Clean from possible injection
while (strpos($this->file_path_folder, '..') !== false) {
$this->file_path_folder = str_replace('..', '', $this->file_path_folder);
}
$this->file_path_folder = preg_replace('#[/\\\\]+#', DS, $this->file_path_folder);
if (empty($this->file_url)) {
$this->file_url = $this->file_url_folder;
$this->file_name = '';
$this->file_extension = '';
} else {
if (!class_exists('JFile')) {
require VMPATH_LIBS . DS . 'joomla' . DS . 'filesystem' . DS . 'file.php';
}
if ($this->file_is_forSale == 1) {
$rdspos = strrpos($this->file_url, DS);
if ($rdspos !== false) {
$name = substr($this->file_url, $rdspos + 1);
} else {
vmdebug('$name', $this->file_url, $rdspos);
}
} else {
//This construction is only valid for the images, it is for own structuring using folders
$name = str_replace($this->file_url_folder, '', $this->file_url);
}
if (!empty($name) && $name !== '/') {
$this->file_name = JFile::stripExt($name);
//$this->file_extension = strtolower(JFile::getExt($name));
$this->file_extension = strtolower(JFile::getExt($name));
//Ensure using right directory
$file_url = $this->getMediaUrlByView($type) . $name;
if ($this->file_is_forSale == 1) {
if (JFile::exists($file_url)) {
$this->file_url = $file_url;
} else {
// vmdebug('MediaHandler, file does not exist in safepath '.$file_url);
}
} else {
$pathToTest = VMPATH_ROOT . DS . str_replace('/', DS, $file_url);
if (JFile::exists($pathToTest)) {
$this->file_url = $file_url;
} else {
// vmdebug('MediaHandler, file does not exist in '.$pathToTest);
}
}
}
}
if ($this->file_is_downloadable) {
$this->media_role = 'file_is_downloadable';
}
if ($this->file_is_forSale) {
$this->media_role = 'file_is_forSale';
}
if (empty($this->media_role)) {
$this->media_role = 'file_is_displayable';
}
// vmdebug('$this->media_role',$this->media_role);
$this->determineFoldersToTest();
if (!empty($this->file_url) && empty($this->file_url_thumb)) {
$this->displayMediaThumb('', true, '', false);
}
}
示例4: getInvoiceDownloadButton
public static function getInvoiceDownloadButton($orderInfo, $descr = 'COM_VIRTUEMART_PRINT', $icon = 'system/pdf_button.png')
{
$html = '';
if (!empty($orderInfo->invoiceNumber)) {
if (!($sPath = shopFunctions::checkSafePath())) {
return $html;
}
$path = $sPath . self::getInvoiceFolderName() . DS . self::getInvoiceName($orderInfo->invoiceNumber) . '.pdf';
//$path .= preg_replace('/[^A-Za-z0-9_\-\.]/', '_', 'vm'.$layout.'_'.$orderInfo->invoiceNumber.'.pdf');
if (file_exists($path)) {
$link = JURI::root(true) . '/index.php?option=com_virtuemart&view=invoice&layout=invoice&format=pdf&tmpl=component&order_number=' . $orderInfo->order_number . '&order_pass=' . $orderInfo->order_pass;
$pdf_link = "<a href=\"javascript:void window.open('" . $link . "', 'win2', 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=640,height=480,directories=no,location=no');\" >";
$pdf_link .= JHtml::_('image', $icon, vmText::_($descr), NULL, true);
$pdf_link .= '</a>';
$html = $pdf_link;
}
}
return $html;
}
示例5: store
/**
* Save the configuration record
*
* @author RickG
* @return boolean True is successful, false otherwise
*/
function store(&$data)
{
JRequest::checkToken() or jexit('Invalid Token, in store config');
//$data['active_languages'] = strtolower(strtr($data['active_languages'],'-','_'));
//ATM we want to ensure that only one config is used
$config = VmConfig::loadConfig();
unset($config->_params['pdf_invoice']);
// parameter remove and replaced by inv_os
$config->setParams($data);
$confData = array();
$query = 'SELECT * FROM `#__virtuemart_configs`';
$this->_db->setQuery($query);
if ($this->_db->loadResult()) {
$confData['virtuemart_config_id'] = 1;
} else {
$confData['virtuemart_config_id'] = 0;
}
$urls = array('assets_general_path', 'media_category_path', 'media_product_path', 'media_manufacturer_path', 'media_vendor_path');
foreach ($urls as $urlkey) {
$url = trim($config->get($urlkey));
$length = strlen($url);
if (strrpos($url, '/') != $length - 1) {
$config->set($urlkey, $url . '/');
vmInfo('Corrected media url ' . $urlkey . ' added missing /');
}
}
/* $path = trim($config->get('forSale_path'));
$length = strlen($path);
if(strrpos($url,DS)!=($length-1)){
if(is_dir()){
$config->set('forSale_path',$path.DS);
vmInfo('Corrected safe path added missing '.DS);
} else {
}
}
*/
$safePath = trim($config->get('forSale_path'));
if (!empty($safePath)) {
$length = strlen($safePath);
if (strrpos($safePath, DS) != $length - 1) {
$safePath = $safePath . DS;
$config->set('forSale_path', $safePath);
vmInfo('Corrected safe path added missing ' . DS);
}
}
if (!class_exists('shopfunctions')) {
require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'shopfunctions.php';
}
$safePath = shopFunctions::checkSafePath($safePath);
if (!empty($safePath)) {
$exists = JFolder::exists($safePath . 'invoices');
if (!$exists) {
$created = JFolder::create($safePath . 'invoices');
if ($created) {
vmInfo('COM_VIRTUEMART_SAFE_PATH_INVOICE_CREATED');
} else {
VmWarn('COM_VIRTUEMART_WARN_SAFE_PATH_NO_INVOICE', JText::_('COM_VIRTUEMART_ADMIN_CFG_MEDIA_FORSALE_PATH'));
}
}
}
$confData['config'] = $config->toString();
// vmdebug('config to store',$confData);
$confTable = $this->getTable('configs');
if (!$confTable->bindChecknStore($confData)) {
vmError($confTable->getError());
}
// Load the newly saved values into the session.
$config = VmConfig::loadConfig(true);
if (!class_exists('GenericTableUpdater')) {
require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'tableupdater.php';
}
$updater = new GenericTableUpdater();
$result = $updater->createLanguageTables();
return true;
}
示例6: store
/**
* Save the configuration record
*
* @author Max Milbers
* @return boolean True is successful, false otherwise
*/
function store(&$data)
{
vRequest::vmCheckToken();
//We create a fresh config
$config = VmConfig::loadConfig(false, true);
//We load the config file
$_raw = self::readConfigFile(FALSE);
$_value = join('|', $_raw);
//We set the config file values as parameters into the config
$config->setParams($_value);
//We merge the array from the file with the array from the form
//in case it the form has the same key as the file, the value is taken from the form
$config->_params = array_merge($config->_params, $data);
//We need this to know if we should delete the cache
$browse_cat_orderby_field = $config->get('browse_cat_orderby_field');
$cat_brws_orderby_dir = $config->get('cat_brws_orderby_dir');
$urls = array('assets_general_path', 'media_category_path', 'media_product_path', 'media_manufacturer_path', 'media_vendor_path');
foreach ($urls as $urlkey) {
$url = trim($config->get($urlkey));
$length = strlen($url);
if ($length <= 1) {
vmdebug('Urlkey was TOO SHORT ' . $urlkey . ' = ' . $url . ' and length ' . $length, $_raw[$urlkey]);
unset($config->_params[$urlkey]);
continue;
}
if (strrpos($url, '/') != $length - 1) {
$config->set($urlkey, $url . '/');
vmInfo('Corrected media url ' . $urlkey . ' added missing /');
}
}
//If empty it is not sent by the form, other forms do it by using a table to store,
//the config is like a big xparams and so we check some values for this form manually
/*$toSetEmpty = array('active_languages','inv_os','email_os_v','email_os_s');
foreach($toSetEmpty as $item){
if(!isset($data[$item])) {
$config->set($item,array());
}
}*/
$checkCSVInput = array('pagseq', 'pagseq_1', 'pagseq_2', 'pagseq_3', 'pagseq_4', 'pagseq_5');
foreach ($checkCSVInput as $csValueKey) {
$csValue = $config->get($csValueKey);
if (!empty($csValue)) {
$sequenceArray = explode(',', $csValue);
foreach ($sequenceArray as &$csV) {
$csV = (int) trim($csV);
}
$csValue = implode(',', $sequenceArray);
$config->set($csValueKey, $csValue);
}
}
if (!class_exists('JFolder')) {
require JPATH_VM_LIBRARIES . DS . 'joomla' . DS . 'filesystem' . DS . 'folder.php';
}
$safePath = trim($config->get('forSale_path'));
if (!empty($safePath)) {
if (DS != '/' and strpos($safePath, '/') !== false) {
$safePath = str_replace('/', DS, $safePath);
vmInfo('Corrected safe path, replaced / by ' . DS);
}
$length = strlen($safePath);
if (strrpos($safePath, DS) != $length - 1) {
$safePath = $safePath . DS;
vmInfo('Corrected safe path, added missing ' . DS);
}
$config->set('forSale_path', $safePath);
} else {
VmWarn('COM_VIRTUEMART_WARN_SAFE_PATH_NO_INVOICE', vmText::_('COM_VIRTUEMART_ADMIN_CFG_MEDIA_FORSALE_PATH'));
/* $safePath = JPATH_ROOT.DS.'administrator'.DS.'components'.DS.'com_virtuemart'.DS.'vmfiles';
$exists = JFolder::exists($safePath);
if(!$exists){
$created = JFolder::create($safePath);
$safePath = $safePath.DS;
if($created){
vmInfo('COM_VIRTUEMART_SAFE_PATH_DEFAULT_CREATED',$safePath);
// create htaccess file
$fileData = "order deny, allow\ndeny from all\nallow from none";
JLoader::import('joomla.filesystem.file');
$fileName = $safePath.DS.'.htaccess';
$result = JFile::write($fileName, $fileData);
if (!$result) {
VmWarn('COM_VIRTUEMART_HTACCESS_DEFAULT_NOT_CREATED',$safePath,$fileData);
}
$config->set('forSale_path',$safePath);
} else {
VmWarn('COM_VIRTUEMART_WARN_SAFE_PATH_NO_INVOICE',vmText::_('COM_VIRTUEMART_ADMIN_CFG_MEDIA_FORSALE_PATH'));
}
}*/
}
if (!class_exists('shopfunctions')) {
require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'shopfunctions.php';
}
$safePath = shopFunctions::checkSafePath($safePath);
if (!empty($safePath)) {
//.........这里部分代码省略.........
示例7: store
/**
* Save the configuration record
*
* @author Max Milbers
* @return boolean True is successful, false otherwise
*/
function store(&$data, $replace = FALSE)
{
JRequest::checkToken() or jexit('Invalid Token, in store config');
//$data['active_languages'] = strtolower(strtr($data['active_languages'],'-','_'));
//ATM we want to ensure that only one config is used
$config = VmConfig::loadConfig(TRUE);
$browse_cat_orderby_field = $config->get('browse_cat_orderby_field');
$cat_brws_orderby_dir = $config->get('cat_brws_orderby_dir');
$config->setParams($data, $replace);
$confData = array();
$query = 'SELECT * FROM `#__virtuemart_configs`';
$this->_db->setQuery($query);
if ($this->_db->loadResult()) {
$confData['virtuemart_config_id'] = 1;
} else {
$confData['virtuemart_config_id'] = 0;
}
$urls = array('assets_general_path', 'media_category_path', 'media_product_path', 'media_manufacturer_path', 'media_vendor_path');
foreach ($urls as $urlkey) {
$url = trim($config->get($urlkey));
$length = strlen($url);
if (strrpos($url, '/') != $length - 1) {
$config->set($urlkey, $url . '/');
vmInfo('Corrected media url ' . $urlkey . ' added missing /');
}
}
//If empty it is not sent by the form, other forms do it by using a table to store,
//the config is like a big xparams and so we check some values for this form manually
/*$toSetEmpty = array('active_languages','inv_os','email_os_v','email_os_s');
foreach($toSetEmpty as $item){
if(!isset($data[$item])) {
$config->set($item,array());
}
}*/
$checkCSVInput = array('pagseq', 'pagseq_1', 'pagseq_2', 'pagseq_3', 'pagseq_4', 'pagseq_5');
foreach ($checkCSVInput as $csValueKey) {
$csValue = $config->get($csValueKey);
if (!empty($csValue)) {
$sequenceArray = explode(',', $csValue);
foreach ($sequenceArray as &$csV) {
$csV = (int) trim($csV);
}
$csValue = implode(',', $sequenceArray);
$config->set($csValueKey, $csValue);
}
}
$safePath = trim($config->get('forSale_path'));
if (!empty($safePath)) {
if (DS != '/' and strpos($safePath, '/') !== false) {
$safePath = str_replace('/', DS, $safePath);
vmdebug('$safePath', $safePath);
}
$length = strlen($safePath);
if (strrpos($safePath, DS) != $length - 1) {
$safePath = $safePath . DS;
vmInfo('Corrected safe path added missing ' . DS);
}
$config->set('forSale_path', $safePath);
} else {
$safePath = JPATH_ROOT . DS . 'administrator' . DS . 'components' . DS . 'com_virtuemart' . DS . 'vmfiles';
$exists = JFolder::exists($safePath);
if (!$exists) {
$created = JFolder::create($safePath);
$safePath = $safePath . DS;
if ($created) {
vmInfo('COM_VIRTUEMART_SAFE_PATH_DEFAULT_CREATED', $safePath);
/* create htaccess file */
$fileData = "order deny, allow\ndeny from all\nallow from none";
JLoader::import('joomla.filesystem.file');
$fileName = $safePath . DS . '.htaccess';
$result = JFile::write($fileName, $fileData);
if (!$result) {
VmWarn('COM_VIRTUEMART_HTACCESS_DEFAULT_NOT_CREATED', $safePath, $fileData);
}
$config->set('forSale_path', $safePath);
} else {
VmWarn('COM_VIRTUEMART_WARN_SAFE_PATH_NO_INVOICE', JText::_('COM_VIRTUEMART_ADMIN_CFG_MEDIA_FORSALE_PATH'));
}
}
}
if (!class_exists('shopfunctions')) {
require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'shopfunctions.php';
}
$safePath = shopFunctions::checkSafePath($safePath);
if (!empty($safePath)) {
$exists = JFolder::exists($safePath . 'invoices');
if (!$exists) {
$created = JFolder::create($safePath . 'invoices');
if ($created) {
vmInfo('COM_VIRTUEMART_SAFE_PATH_INVOICE_CREATED');
} else {
VmWarn('COM_VIRTUEMART_WARN_SAFE_PATH_NO_INVOICE', JText::_('COM_VIRTUEMART_ADMIN_CFG_MEDIA_FORSALE_PATH'));
}
}
//.........这里部分代码省略.........
示例8: display
function display($tpl = null)
{
if (!class_exists('VmImage')) {
require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'image.php';
}
if (!class_exists('VmHTML')) {
require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'html.php';
}
$model = VmModel::getModel();
$usermodel = VmModel::getModel('user');
JToolBarHelper::title(JText::_('COM_VIRTUEMART_CONFIG'), 'head vm_config_48');
$this->addStandardEditViewCommands();
$config = VmConfig::loadConfig();
if (!empty($config->_params)) {
unset($config->_params['pdf_invoice']);
// parameter remove and replaced by inv_os
}
$this->assignRef('config', $config);
$mainframe = JFactory::getApplication();
$this->assignRef('joomlaconfig', $mainframe);
$userparams = JComponentHelper::getParams('com_users');
$this->assignRef('userparams', $userparams);
$templateList = ShopFunctions::renderTemplateList(JText::_('COM_VIRTUEMART_ADMIN_CFG_JOOMLA_TEMPLATE_DEFAULT'));
$this->assignRef('jTemplateList', $templateList);
$vmLayoutList = $model->getLayoutList('virtuemart');
$this->assignRef('vmLayoutList', $vmLayoutList);
$categoryLayoutList = $model->getLayoutList('category');
$this->assignRef('categoryLayoutList', $categoryLayoutList);
$productLayoutList = $model->getLayoutList('productdetails');
$this->assignRef('productLayoutList', $productLayoutList);
$noimagelist = $model->getNoImageList();
$this->assignRef('noimagelist', $noimagelist);
$orderStatusModel = VmModel::getModel('orderstatus');
$this->assignRef('orderStatusModel', $orderStatusModel);
$currConverterList = $model->getCurrencyConverterList();
$this->assignRef('currConverterList', $currConverterList);
$moduleList = $model->getModuleList();
$this->assignRef('moduleList', $moduleList);
$activeLanguages = $model->getActiveLanguages(VmConfig::get('active_languages'));
$this->assignRef('activeLanguages', $activeLanguages);
$orderByFieldsProduct = $model->getProductFilterFields('browse_orderby_fields');
$this->assignRef('orderByFieldsProduct', $orderByFieldsProduct);
VmModel::getModel('category');
foreach (VirtueMartModelCategory::$_validOrderingFields as $key => $field) {
if ($field == 'c.category_shared') {
continue;
}
$fieldWithoutPrefix = $field;
$dotps = strrpos($fieldWithoutPrefix, '.');
if ($dotps !== false) {
$prefix = substr($field, 0, $dotps + 1);
$fieldWithoutPrefix = substr($field, $dotps + 1);
}
$text = JText::_('COM_VIRTUEMART_' . strtoupper($fieldWithoutPrefix));
$orderByFieldsCat[] = JHTML::_('select.option', $field, $text);
}
//$orderByFieldsCat = $model->get;
$this->assignRef('orderByFieldsCat', $orderByFieldsCat);
$searchFields = $model->getProductFilterFields('browse_search_fields');
$this->assignRef('searchFields', $searchFields);
$aclGroups = $usermodel->getAclGroupIndentedTree();
$this->assignRef('aclGroups', $aclGroups);
if (!class_exists('shopFunctionsF')) {
require JPATH_VM_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php';
}
$vmtemplate = shopFunctionsF::loadVmTemplateStyle();
if (is_Dir(JPATH_ROOT . DS . 'templates' . DS . $vmtemplate . DS . 'images' . DS . 'availability' . DS)) {
$imagePath = '/templates/' . $vmtemplate . '/images/availability/';
} else {
$imagePath = '/components/com_virtuemart/assets/images/availability/';
}
$this->assignRef('imagePath', $imagePath);
shopFunctions::checkSafePath();
$this->checkVmUserVendor();
parent::display($tpl);
}
示例9: display
function display($tpl = null)
{
if (!class_exists('VmImage')) {
require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'image.php';
}
if (!class_exists('VmHTML')) {
require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'html.php';
}
$model = VmModel::getModel();
$usermodel = VmModel::getModel('user');
JToolBarHelper::title(JText::_('COM_VIRTUEMART_CONFIG'), 'head vm_config_48');
$this->addStandardEditViewCommands();
$config = VmConfig::loadConfig();
if (!empty($config->_params)) {
unset($config->_params['pdf_invoice']);
// parameter remove and replaced by inv_os
}
$this->assignRef('config', $config);
$mainframe = JFactory::getApplication();
$this->assignRef('joomlaconfig', $mainframe);
$userparams = JComponentHelper::getParams('com_users');
$this->assignRef('userparams', $userparams);
$templateList = ShopFunctions::renderTemplateList(JText::_('COM_VIRTUEMART_ADMIN_CFG_JOOMLA_TEMPLATE_DEFAULT'));
$this->assignRef('jTemplateList', $templateList);
$vmLayoutList = $model->getLayoutList('virtuemart');
$this->assignRef('vmLayoutList', $vmLayoutList);
$categoryLayoutList = $model->getLayoutList('category');
$this->assignRef('categoryLayoutList', $categoryLayoutList);
$productLayoutList = $model->getLayoutList('productdetails');
$this->assignRef('productLayoutList', $productLayoutList);
$noimagelist = $model->getNoImageList();
$this->assignRef('noimagelist', $noimagelist);
$orderStatusModel = VmModel::getModel('orderstatus');
$this->assignRef('orderStatusModel', $orderStatusModel);
$currConverterList = $model->getCurrencyConverterList();
$this->assignRef('currConverterList', $currConverterList);
$moduleList = $model->getModuleList();
$this->assignRef('moduleList', $moduleList);
$activeLanguages = $model->getActiveLanguages(VmConfig::get('active_languages'));
$this->assignRef('activeLanguages', $activeLanguages);
$orderByFields = $model->getProductFilterFields('browse_orderby_fields');
$this->assignRef('orderByFields', $orderByFields);
$searchFields = $model->getProductFilterFields('browse_search_fields');
$this->assignRef('searchFields', $searchFields);
$aclGroups = $usermodel->getAclGroupIndentedTree();
$this->assignRef('aclGroups', $aclGroups);
if (is_Dir(VmConfig::get('vmtemplate') . DS . 'images' . DS . 'availability' . DS)) {
$imagePath = VmConfig::get('vmtemplate') . '/images/availability/';
} else {
$imagePath = '/components/com_virtuemart/assets/images/availability/';
}
$this->assignRef('imagePath', $imagePath);
shopFunctions::checkSafePath();
$this->checkVmUserVendor();
$cache = JFactory::getCache('_virtuemart');
$cached = $cache->getCaching();
if ($cached) {
vmInfo('COM_VIRTUEMART_CFG_CACHE_ACTIVE');
}
parent::display($tpl);
}
示例10: display
function display($tpl = null)
{
// Load the helper(s)
$this->loadHelper('image');
$this->loadHelper('html');
$model = VmModel::getModel();
$usermodel = VmModel::getModel('user');
JToolBarHelper::title(JText::_('COM_VIRTUEMART_CONFIG'), 'head vm_config_48');
$this->addStandardEditViewCommands();
$config = VmConfig::loadConfig();
unset($config->_params['pdf_invoice']);
// parameter remove and replaced by inv_os
$this->assignRef('config', $config);
$mainframe = JFactory::getApplication();
$this->assignRef('joomlaconfig', $mainframe);
$userparams = JComponentHelper::getParams('com_users');
$this->assignRef('userparams', $userparams);
$templateList = ShopFunctions::renderTemplateList(JText::_('COM_VIRTUEMART_ADMIN_CFG_JOOMLA_TEMPLATE_DEFAULT'));
$this->assignRef('jTemplateList', $templateList);
$vmLayoutList = $model->getLayoutList('virtuemart');
$this->assignRef('vmLayoutList', $vmLayoutList);
// Outcommented to revert rev. 2916
// $vendorList = ShopFunctions::renderVendorList(VmConfig::get('default_virtuemart_vendor_id'));
// // We must replace the fieldname and ID 'virtuemart_vendor_id' to 'default_vendor'
// $vendorList = preg_replace('/"virtuemart_vendor_id"/', '"default_virtuemart_vendor_id"', $vendorList);
// $this->assignRef('vendorList', $vendorList);
$categoryLayoutList = $model->getLayoutList('category');
$this->assignRef('categoryLayoutList', $categoryLayoutList);
$productLayoutList = $model->getLayoutList('productdetails');
$this->assignRef('productLayoutList', $productLayoutList);
$noimagelist = $model->getNoImageList();
$this->assignRef('noimagelist', $noimagelist);
$orderStatusModel = VmModel::getModel('orderstatus');
/* $orderStates = $orderStatusModel->getOrderStatusList();
$orderStatusList = array();
$orderStatusList[0] = JText::_('COM_VIRTUEMART_NONE');
foreach ($orderStates as $orderState) {
$orderStatusList[$orderState->order_status_code] = JText::_($orderState->order_status_name);
}*/
$this->assignRef('orderStatusModel', $orderStatusModel);
/*
$oderstatusModel = VmModel::getModel('Orderstatus');
$orderStatusList = $oderstatusModel->getOrderStatusList();
$this->assignRef('orderStatusList', $orderStatusList);
*/
$currConverterList = $model->getCurrencyConverterList();
$this->assignRef('currConverterList', $currConverterList);
$moduleList = $model->getModuleList();
$this->assignRef('moduleList', $moduleList);
//$contentLinks = $model->getContentLinks();
//$this->assignRef('contentLinks', $contentLinks);
$activeLanguages = $model->getActiveLanguages(VmConfig::get('active_languages'));
$this->assignRef('activeLanguages', $activeLanguages);
$orderByFields = $model->getProductFilterFields('browse_orderby_fields');
$this->assignRef('orderByFields', $orderByFields);
$searchFields = $model->getProductFilterFields('browse_search_fields');
$this->assignRef('searchFields', $searchFields);
$aclGroups = $usermodel->getAclGroupIndentedTree();
$this->assignRef('aclGroups', $aclGroups);
if (is_Dir(VmConfig::get('vmtemplate') . DS . 'images' . DS . 'availability' . DS)) {
$imagePath = VmConfig::get('vmtemplate') . '/images/availability/';
} else {
$imagePath = '/components/com_virtuemart/assets/images/availability/';
}
$this->assignRef('imagePath', $imagePath);
shopFunctions::checkSafePath();
parent::display($tpl);
}
示例11: store
/**
* Save the configuration record
*
* @author Max Milbers
* @return boolean True is successful, false otherwise
*/
function store(&$data)
{
vRequest::vmCheckToken();
if (!vmAccess::manager('config')) {
vmWarn('Insufficient permissions to delete product');
return false;
}
//We create a fresh config
$config = tsmConfig::loadConfig(false, true);
//We load the config file
$_raw = self::readConfigFile(FALSE);
$_value = join('|', $_raw);
//We set the config file values as parameters into the config
$config->setParams($_value);
//We merge the array from the file with the array from the form
//in case it the form has the same key as the file, the value is taken from the form
$config->_params = array_merge($config->_params, $data);
//We need this to know if we should delete the cache
$browse_cat_orderby_field = $config->get('browse_cat_orderby_field');
$cat_brws_orderby_dir = $config->get('cat_brws_orderby_dir');
$urls = array('assets_general_path', 'media_category_path', 'media_product_path', 'media_manufacturer_path', 'media_vendor_path');
foreach ($urls as $urlkey) {
$url = trim($config->get($urlkey));
$length = strlen($url);
if ($length <= 1) {
vmdebug('Urlkey was TOO SHORT ' . $urlkey . ' = ' . $url . ' and length ' . $length, $_raw[$urlkey]);
unset($config->_params[$urlkey]);
continue;
}
if (strrpos($url, '/') != $length - 1) {
$config->set($urlkey, $url . '/');
vmInfo('Corrected media url ' . $urlkey . ' added missing /');
}
}
$checkCSVInput = array('pagseq', 'pagseq_1', 'pagseq_2', 'pagseq_3', 'pagseq_4', 'pagseq_5');
foreach ($checkCSVInput as $csValueKey) {
$csValue = $config->get($csValueKey);
if (!empty($csValue)) {
$sequenceArray = explode(',', $csValue);
foreach ($sequenceArray as &$csV) {
$csV = (int) trim($csV);
}
$csValue = implode(',', $sequenceArray);
$config->set($csValueKey, $csValue);
}
}
if (!class_exists('JFolder')) {
require VMPATH_LIBS . DS . 'joomla' . DS . 'filesystem' . DS . 'folder.php';
}
$safePath = trim($config->get('forSale_path'));
if (!empty($safePath)) {
if (DS != '/' and strpos($safePath, '/') !== false) {
$safePath = str_replace('/', DS, $safePath);
vmInfo('Corrected safe path, replaced / by ' . DS);
}
$length = strlen($safePath);
if (strrpos($safePath, DS) != $length - 1) {
$safePath = $safePath . DS;
vmInfo('Corrected safe path, added missing ' . DS);
}
$p = VMPATH_ROOT . DS;
if (strtolower($safePath) == strtolower($p)) {
$safePath = '';
vmError('Do not use as safepath your tsmart root folder');
}
$config->set('forSale_path', $safePath);
} else {
VmWarn('com_tsmart_WARN_SAFE_PATH_NO_INVOICE', tsmText::_('com_tsmart_ADMIN_CFG_MEDIA_FORSALE_PATH'));
/* $safePath = VMPATH_ROOT.DS.'administrator'.DS.'components'.DS.'com_tsmart'.DS.'vmfiles';
$exists = JFolder::exists($safePath);
if(!$exists){
$created = JFolder::create($safePath);
$safePath = $safePath.DS;
if($created){
vmInfo('com_tsmart_SAFE_PATH_DEFAULT_CREATED',$safePath);
// create htaccess file
$fileData = "order deny, allow\ndeny from all\nallow from none";
JLoader::import('joomla.filesystem.file');
$fileName = $safePath.DS.'.htaccess';
$result = JFile::write($fileName, $fileData);
if (!$result) {
VmWarn('com_tsmart_HTACCESS_DEFAULT_NOT_CREATED',$safePath,$fileData);
}
$config->set('forSale_path',$safePath);
} else {
VmWarn('com_tsmart_WARN_SAFE_PATH_NO_INVOICE',vmText::_('com_tsmart_ADMIN_CFG_MEDIA_FORSALE_PATH'));
}
}*/
}
if (!class_exists('shopfunctions')) {
require VMPATH_ADMIN . DS . 'helpers' . DS . 'shopfunctions.php';
}
$safePath = shopFunctions::checkSafePath($safePath);
//.........这里部分代码省略.........
示例12: store
/**
* Save the configuration record
*
* @author RickG
* @return boolean True is successful, false otherwise
*/
function store(&$data, $replace = FALSE)
{
JSession::checkToken() or JSession::checkToken('get') or jexit('Invalid Token, in store config');
//$data['active_languages'] = strtolower(strtr($data['active_languages'],'-','_'));
//ATM we want to ensure that only one config is used
$config = VmConfig::loadConfig(TRUE);
unset($config->_params['pdf_invoice']);
// parameter remove and replaced by inv_os
$config->setParams($data, $replace);
$confData = array();
$query = 'SELECT * FROM `#__virtuemart_configs`';
$this->_db->setQuery($query);
if ($this->_db->loadResult()) {
$confData['virtuemart_config_id'] = 1;
} else {
$confData['virtuemart_config_id'] = 0;
}
$urls = array('assets_general_path', 'media_category_path', 'media_product_path', 'media_manufacturer_path', 'media_vendor_path');
foreach ($urls as $urlkey) {
$url = trim($config->get($urlkey));
$length = strlen($url);
if (strrpos($url, '/') != $length - 1) {
$config->set($urlkey, $url . '/');
vmInfo('Corrected media url ' . $urlkey . ' added missing /');
}
}
//If empty it is not sent by the form, other forms do it by using a table to store,
//the config is like a big xparams and so we check some values for this form manually
/*$toSetEmpty = array('active_languages','inv_os','email_os_v','email_os_s');
foreach($toSetEmpty as $item){
if(!isset($data[$item])) {
$config->set($item,array());
}
}*/
$checkCSVInput = array('pagseq', 'pagseq_1', 'pagseq_2', 'pagseq_3', 'pagseq_4', 'pagseq_5');
foreach ($checkCSVInput as $csValueKey) {
$csValue = $config->get($csValueKey);
if (!empty($csValue)) {
$sequenceArray = explode(',', $csValue);
foreach ($sequenceArray as &$csV) {
$csV = (int) trim($csV);
}
$csValue = implode(',', $sequenceArray);
$config->set($csValueKey, $csValue);
}
}
$safePath = trim($config->get('forSale_path'));
if (!empty($safePath)) {
$length = strlen($safePath);
if (strrpos($safePath, DS) != $length - 1) {
$safePath = $safePath . DS;
$config->set('forSale_path', $safePath);
vmInfo('Corrected safe path added missing ' . DS);
}
}
if (!class_exists('shopfunctions')) {
require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'shopfunctions.php';
}
$safePath = shopFunctions::checkSafePath($safePath);
if (!empty($safePath)) {
$exists = JFolder::exists($safePath . 'invoices');
if (!$exists) {
$created = JFolder::create($safePath . 'invoices');
if ($created) {
vmInfo('COM_VIRTUEMART_SAFE_PATH_INVOICE_CREATED');
} else {
VmWarn('COM_VIRTUEMART_WARN_SAFE_PATH_NO_INVOICE', JText::_('COM_VIRTUEMART_ADMIN_CFG_MEDIA_FORSALE_PATH'));
}
}
}
$confData['config'] = $config->toJson();
// vmdebug('config to store',$confData);
$confTable = $this->getTable('configs');
if (!$confTable->bindChecknStore($confData)) {
vmError($confTable->getError());
}
// Load the newly saved values into the session.
$config = VmConfig::loadConfig(true);
if (!class_exists('GenericTableUpdater')) {
require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'tableupdater.php';
}
$updater = new GenericTableUpdater();
$result = $updater->createLanguageTables();
return true;
}