private function setCartLayout($cart, $intoSession = true) { if (!class_exists('VmConfig')) { require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'config.php'; } VmConfig::loadConfig(); $olgConfig = VmConfig::get('oncheckout_opc', true); VmConfig::set('oncheckout_opc', true); $cart->layoutPath = vmPlugin::getTemplatePath($this->_name, 'payment', 'cart'); $cart->layout = 'cart'; if ($intoSession) { $cart->setCartIntoSession(); } }
/** * This function deletes all stored thumbs and deletes the entries for all thumbs, usually this is need for shops * older than vm2.0.22. The new pattern is now not storing the url as long it is not overwritten. * Of course the function deletes all overwrites, but you can now relativly easy change the thumbsize in your shop * @author Max Milbers */ function resetThumbs() { $db = JFactory::getDbo(); $q = 'UPDATE `#__virtuemart_medias` SET `file_url_thumb`=""'; $db->setQuery($q); $db->execute(); $err = $db->getErrorMsg(); if (!empty($err)) { vmError('resetThumbs Update entries failed ', $err); } jimport('joomla.filesystem.folder'); $tmpimg_resize_enable = VmConfig::get('img_resize_enable', 1); VmConfig::set('img_resize_enable', 0); $this->deleteMediaThumbFolder('media_category_path'); $this->deleteMediaThumbFolder('media_product_path'); $this->deleteMediaThumbFolder('media_manufacturer_path'); $this->deleteMediaThumbFolder('media_vendor_path'); $this->deleteMediaThumbFolder('forSale_path_thumb', ''); VmConfig::set('img_resize_enable', $tmpimg_resize_enable); return true; }
protected static function initialize() { if (self::$initialized) { return; } $app = JFactory::getApplication(); if (!class_exists('VmConfig')) { require JPATH_ADMINISTRATOR . '/components/com_virtuemart/helpers/config.php'; VmConfig::loadConfig(); } JTable::addIncludePath(JPATH_VM_ADMINISTRATOR . '/tables'); VmConfig::set('llimit_init_FE', 9000); $app->setUserState('com_virtuemart.htmlc-1.limit', 9000); $app->setUserState('com_virtuemart.htmlc0.limit', 9000); $app->setUserState('com_virtuemart.xmlc0.limit', 9000); if (!class_exists('VirtueMartModelCategory')) { require JPATH_VM_ADMINISTRATOR . '/models/category.php'; } self::$categoryModel = new VirtueMartModelCategory(); if (!class_exists('VirtueMartModelProduct')) { require JPATH_VM_ADMINISTRATOR . '/models/product.php'; } self::$productModel = new VirtueMartModelProduct(); }
$url .= '/'; } $javascript = "\n" . ' var op_ajaxurl = "' . $url . '"; ' . "\n"; /* $javascript .= 'if(window.addEventListener){ // Mozilla, Netscape, Firefox' . "\n"; $javascript .= ' window.addEventListener("load", function(){ op_runAjax(); }, false);' . "\n"; $javascript .= '} else { // IE' . "\n"; $javascript .= ' window.attachEvent("onload", function(){ op_runAjax(); });' . "\n"; $javascript .= '}'; */ $docj = JFactory::getDocument(); $docj->addScriptDeclaration($javascript); $c = VmConfig::get('coupons_enable', true); VmConfig::set('coupons_enable', 10); $test = VmConfig::get('coupons_enable'); VmConfig::set('coupons_enable', $c); if ($test != 10) { $is_admin = false; } else { $is_admin = true; } $session = JFactory::getSession(); jimport('joomla.html.pane'); jimport('joomla.utilities.utility'); JHTML::script('toggle_langs.js', 'administrator/components/com_onepage/views/config/tmpl/js/', false); if (!class_exists('VmConfig')) { require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'config.php'; } VmConfig::loadConfig(true); $document = JFactory::getDocument(); //$document->addScript('/administrator/includes/js/joomla.javascript.js');
} if ($v['tag'] == "ORIGCURRENCY") { $origcurrency = $v['value']; } } $origcurrency = $origcurrency != "" ? $origcurrency : "EUR"; $RATES[$origcurrency] = 1; } $cat = new VirtuemartModelCategory(); $product = new VirtueMartModelProduct(); $image = new VirtueMartModelMedia(); $currency = new VirtueMartModelCurrency(); $config =& JFactory::getConfig(); $app = JFactory::getApplication(); $app->initialise(array('language' => 'it-IT')); $b = VmConfig::set('vmlang', 'it_it'); /*$lang =& JFactory::getLanguage(); $lang->setLanguage('it-IT'); $lang->setDefault('it-IT'); $lang->load(); $lg =& JFactory::getLanguage(); var_dump($lg); break; */ //if(!JRequest::getWord('lang', false )) // JRequest::setVar('lang', $dlg ); /* if($hasShipping && $add_shipping == "on") { $shipment = new VirtueMartModelShipmentmethod();
function patchcalculationh() { $msg = ''; $path = JPATH_SITE . DS . 'administrator' . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'calculationh.php'; $savepath = JPATH_SITE . DS . 'components' . DS . 'com_onepage' . DS . 'overrides' . DS . 'calculationh_patched.php'; $c = VmConfig::get('coupons_enable', true); VmConfig::set('coupons_enable', 10); $test = VmConfig::get('coupons_enable'); VmConfig::set('coupons_enable', $c); if ($test != 10) { $isadmin = false; } else { $isadmin = true; } if (!$isadmin) { $msg .= JText::_('COM_ONAPEGE_USER_IS_NOT_VIRTUEMART_ADMIN') . '<br />'; } // feature removed: return; if (!file_exists($path)) { return; } $data = file_get_contents($path); if (file_exists($savepath)) { $datas = file_get_contents($savepath); } else { $datas = ''; } $data = str_replace("\r\r\n", "\r\n", $data); if (!class_exists('JFile')) { require JPATH_LIBRARIES . DIRECTORY_SEPARATOR . 'joomla' . DIRECTORY_SEPARATOR . 'filesystem' . DIRECTORY_SEPARATOR . 'file.php'; } if (!class_exists('JFolder')) { require JPATH_LIBRARIES . DIRECTORY_SEPARATOR . 'joomla' . DIRECTORY_SEPARATOR . 'filesystem' . DIRECTORY_SEPARATOR . 'folder.php'; } $count = 0; $data = str_replace('private', 'protected', $data, $count); $data = str_replace('VmError(\'Unrecognised', ' // VmError(\'Unrecognised', $data); $data = str_replace('VmWarn(\'Unrecognised', ' // VmError(\'Unrecognised', $data); $content = urldecode('%3C%3Fphp') . ' /* * * @copyright Copyright (C) 2007 - 2010 RuposTel - All rights reserved. * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php * One Page checkout is free software released under GNU/GPL and uses code from VirtueMart * 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. * */ if( !defined( \'_VALID_MOS\' ) && !defined( \'_JEXEC\' ) ) die( \'Direct Access to \'.basename(__FILE__).\' is not allowed.\' ); if (!class_exists(\'calculationHelper\')) require(JPATH_SITE.DS.\'administrator\'.DS.\'components\'.DS.\'com_virtuemart\'.DS.\'helpers\'.DS.\'calculationh.php\'); '; if (empty($count) || $count == 1) { if (strcmp($datas, $content) !== 0) { if (file_exists($savepath)) { if (JFile::delete($savepath) == false) { //$msg = 'Patch for calculationh.php is not needed'; $msg .= 'Couln\'t remove OPC override ' . $savepath; } } if (JFile::write($savepath, $content) == false) { $msg .= '<br />Could not write to ' . $savepath; } } } else { if (strcmp($datas, $data) !== 0) { if (JFile::write($savepath, $data) === false) { $msg = 'Cannot write to ' . $savepath; } else { //test: $data = file_get_contents($savepath); // we use url encode because php compiler sometimes doe not recognize tags inside a string // this code tests config file after saving it $x1 = @eval('return true; ' . urldecode('%3F%3E') . ' ' . $data . ' ' . urldecode('%3C%3Fphp') . ' '); $x2 = @eval('return true; ' . urldecode('%3F%3E') . ' ' . $data . ' '); if (!($x1 !== true && $x2 === true || $x1 === true && $x2 !== true)) { $msg = 'The patch could not be applied'; if (JFile::delete($savepath) == false) { $msg .= ' and couln\'t remove OPC override ' . $savepath; } } } } } /* $link = 'index.php?option=com_onepage'; if (empty($msg)) $msg = 'Patch applied sucessfully'; else $msg = 'Patch not applied ! '.$msg; $this->setRedirect($link, $msg); */ return $msg; }