Example #1
0
 function searchtext()
 {
     jimport('joomla.filesystem.file');
     jimport('joomla.filesystem.folder');
     require_once JPATH_ROOT . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'cache.php';
     $search = JRequest::getVar('searchwhat', '', 'post', 'string', JREQUEST_ALLOWRAW);
     if (empty($search)) {
         return '';
     }
     $searchext = JRequest::getVar('ext');
     if (empty($searchext)) {
         return '';
     }
     if ($searchext == '*') {
         $searchext = '.';
     } else {
         $searchext = '.' . $searchext;
     }
     $xc = JRequest::getVar('excludecache', false);
     $cs = JRequest::getVar('casesensitive', false);
     $ftest = OPCcache::getValue('opcsearch' . $searchext);
     if (empty($ftest)) {
         $files = JFolder::files(JPATH_SITE, $searchext, true, true);
     } else {
         $files = $ftest;
     }
     OPCcache::store($files, 'opcsearch' . $searchext);
     $os = JRequest::getVar('onlysmall', false);
     $resa = array();
     foreach ($files as $f) {
         // exclude cache:
         if ($xc) {
             if (stripos($f, 'cache') !== false) {
                 continue;
             }
         }
         if ($os) {
             if (filesize($f) > 500000) {
                 continue;
             }
         }
         $data = file_get_contents($f);
         if (!$cs) {
             if (stripos($data, $search) !== false) {
                 $resa[] = $f;
             }
         } else {
             if (strpos($data, $search) !== false) {
                 $resa[] = $f;
             }
         }
     }
     $ret = implode($resa, "<br />\n");
     return $ret;
 }
Example #2
0
 public function plgVmDisplayListFEShipmentOPC(&$cart, $selected = 0, &$htmlIn)
 {
     if (!isset($cart->vendorId)) {
         $cart->vendorId = 1;
     }
     if ($this->_type != 'vmshipment') {
         return;
     }
     $pluginmethod_id = $this->_idName;
     //virtuemart_shipmentmethod_id
     $pluginName = $this->_psType . '_name';
     // shipment_name
     $pluginName = $this->_name;
     $data = array($selected, $pluginmethod_id, $pluginName);
     $hash = OPCcache::getGeneralCacheHash('plgVmDisplayListFEShipment', $cart, $data);
     $val = OPCcache::getValue($hash);
     VmPlugin::$iCount++;
     if (!empty($val)) {
         if (empty($val[0])) {
             break;
             //return $val[0];
         } else {
             foreach ($val[1] as $vala) {
                 $htmlIn[] = $vala;
             }
             return true;
         }
     }
     $htmlIn2 = array();
     $val = $this->plgVmDisplayListFEShipmentOPCNocache($cart, $selected, $htmlIn2);
     $html = '';
     if (is_array($htmlIn2)) {
         foreach ($htmlIn2 as $h) {
             if (is_array($h)) {
                 foreach ($h as $h2) {
                     $html .= $h2;
                 }
             } else {
                 $html .= $h;
             }
         }
     } else {
         $html = $htmlIn2;
     }
     if (!empty($html) || stripos($html, 'virtuemart_shipmentmethod_id') !== false) {
         if (stripos($html, 'error') === false) {
             $val2 = OPCcache::setValue($hash, array($val, $htmlIn2));
         }
     }
     if (!empty($htmlIn2)) {
         $htmlIn = array_merge($htmlIn, $htmlIn2);
     }
     return $val;
 }
Example #3
0
 function setValue($dimension, $value)
 {
     if (!isset(OPCcache::$cachedResult)) {
         OPCcache::$cachedResult = array();
     }
     OPCcache::$cachedResult[$dimension] = $value;
     OPCcache::store($value, $dimension);
 }
Example #4
0
 function getPrefered()
 {
     $db = JFactory::getDBO();
     $q = 'select template from #__template_styles where home = 1 and client_id = 0 limit 0,1';
     $db->setQuery($q);
     $template = $db->loadResult();
     $colors2 = OPCcache::get('css_' . $template);
     if (!empty($colors2)) {
         $colors = $colors2;
         return $colors;
     }
     $templateDir = JPATH_SITE . DS . 'templates' . DS . $template;
     if (!file_exists($templateDir)) {
         return;
     }
     $files = JFolder::files($templateDir, '.css', true, true, array());
     $colors = array();
     $this->getColors($files, $colors);
     OPCcache::store($colors, 'css_' . $template);
     return $colors;
 }
 /**
  * Calculates the effecting Shipment prices for the calculation
  * @copyright (c) 2009 VirtueMart Team. All rights reserved.
  * @author Max Milbers
  * @author Valerie Isaksen
  * @param 	$code 	The Id of the coupon
  * @return 	$rules 	ids of the coupons
  */
 function calculateShipmentPrice($cart, $ship_id, $checkAutomaticSelected = true)
 {
     $val = OPCcache::getValue(calculationHelperOPC::$_forhash);
     if (!empty($val)) {
         $this->_cartData['shipmentName'] = $val['shipmentName'];
         OPCcache::arrayMerge($this->_cartPrices, $val);
         return $this->_cartPrices;
     }
     $this->_cartData['shipmentName'] = JText::_('COM_VIRTUEMART_CART_NO_SHIPMENT_SELECTED');
     $this->_cartPrices['shipmentValue'] = 0;
     //could be automatically set to a default set in the globalconfig
     $this->_cartPrices['shipmentTax'] = 0;
     $this->_cartPrices['salesPriceShipment'] = 0;
     $this->_cartPrices['shipment_calc_id'] = 0;
     // check if there is only one possible shipment method
     $automaticSelectedShipment = $cart->CheckAutomaticSelectedShipment($this->_cartPrices, $checkAutomaticSelected);
     if ($automaticSelectedShipment) {
         $ship_id = $cart->virtuemart_shipmentmethod_id;
     }
     if (empty($ship_id)) {
         $arr = OPCcache::getSearch('shipment', $this->_cartPrices);
         $arr['shipmentName'] = $this->_cartData['shipmentName'];
         $val = OPCcache::setValue(calculationHelperOPC::$_forhash, $arr);
         return $this->_cartPrices;
     }
     // Handling shipment plugins
     if (!class_exists('vmPSPlugin')) {
         require JPATH_VM_PLUGINS . DS . 'vmpsplugin.php';
     }
     JPluginHelper::importPlugin('vmshipment');
     $dispatcher = JDispatcher::getInstance();
     $returnValues = $dispatcher->trigger('plgVmonSelectedCalculatePriceShipment', array($cart, &$this->_cartPrices, &$this->_cartData['shipmentName']));
     /*
      * Plugin return true if shipment rate is still valid
      * false if not any more
      */
     $shipmentValid = 0;
     foreach ($returnValues as $returnValue) {
         $shipmentValid += $returnValue;
     }
     if (!$shipmentValid) {
         $cart->virtuemart_shipmentmethod_id = 0;
         $cart->setCartIntoSession();
     }
     // store the cached response
     $arr = OPCcache::getSearch('shipment', $this->_cartPrices);
     $arr['shipmentName'] = $this->_cartData['shipmentName'];
     $val = OPCcache::setValue(calculationHelperOPC::$_forhash, $arr);
     return $this->_cartPrices;
 }
Example #6
0
    }
}
//index.php?option=com_onepage&task=loadjs&file=onepage.js
$memstart = memory_get_usage(true);
define('OPCMEMSTART', $memstart);
include JPATH_ROOT . DS . 'components' . DS . 'com_onepage' . DS . 'config' . DS . 'onepage.cfg.php';
if (!isset($opc_memory)) {
    $opc_memory = '128M';
}
ini_set('memory_limit', $opc_memory);
ini_set('error_reporting', 0);
// disable error reporting for ajax:
error_reporting(0);
if (!empty($opc_calc_cache)) {
    require_once JPATH_ROOT . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'cache.php';
    OPCcache::installCache();
}
// since 2.0.109 we need to load com_onepage instead of com_virtuemart becuase of captcha support
JRequest::setVar('option', 'com_virtuemart');
if (!class_exists('VmConfig')) {
    require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'config.php';
}
$task = JRequest::getVar('task', '');
$view = JRequest::getVar('view', '');
if ($view == 'xmlexport') {
    require_once JPATH_SITE . DS . 'components' . DS . 'com_onepage' . DS . 'controllers' . DS . 'xmlexport.php';
    $VirtueMartControllerXmlexport = new VirtueMartControllerXmlexport();
    if ($VirtueMartControllerXmlexport->enabled) {
        $VirtueMartControllerXmlexport->createXml();
    }
} else {
Example #7
0
 function getCachedShipping(&$cart, &$prices, $shipping_id, &$calc, $data = array())
 {
     if (!isset(OPCloader::$totalIsZero)) {
         OPCloader::$totalIsZero = true;
     }
     // cache dimensions:
     // this is a product hash (quantity, attributes, weight, etc..)
     include JPATH_ROOT . DS . 'components' . DS . 'com_onepage' . DS . 'config' . DS . 'onepage.cfg.php';
     self::$count++;
     $savedcoupon = $cart->couponCode;
     $data[] = $shipping_id;
     if (!empty($opc_calc_cache)) {
         $hash = OPCcache::getGeneralCacheHash('calc', $cart, $data);
     }
     $saved_id = $cart->virtuemart_shipmentmethod_id;
     //opc_request_cache
     if (class_exists('calculationHelperOPC')) {
         calculationHelperOPC::$_forhash = $hash;
     }
     // overrided class with the above hash knows if to re-fetch the shipping
     if (!empty($opc_request_cache)) {
         OPCcache::$cachedResult['currentshipping'] = $shipping_id;
         if (!empty(OPCcache::$cachedResult['shippingcache'][$shipping_id])) {
             $cart->virtuemart_shipmentmethod_id = (int) $cart->virtuemart_shipmentmethod_id;
             $cart->virtuemart_shipmentmethod_id = abs($cart->virtuemart_shipmentmethod_id) * -1;
         }
     }
     $vm2015 = false;
     if (method_exists($calc, 'getCheckoutPricesOPC')) {
         $prices = $calc->getCheckoutPricesOPC($cart, false);
         if (method_exists($calculator, 'getCartData')) {
             $cart->OPCCartData = $calc->getCartData();
         }
     } else {
         $prices = OPCloader::getCheckoutPrices($cart, false, $vm2015, 'opc');
     }
     if (!empty($prices['billTotal'])) {
         // special case for zero value orders, do not charge payment fee:
         if ($prices['billTotal'] == $prices['paymentValue']) {
             $savedp = $cart->virtuemart_paymentmethod_id;
             $cart->virtuemart_paymentmethod_id = 0;
             if (method_exists($calc, 'getCheckoutPricesOPC')) {
                 $prices = $calc->getCheckoutPricesOPC($cart, false);
             } else {
                 $prices = OPCloader::getCheckoutPrices($cart, false, $vm2015, 'opc');
             }
         }
     }
     if (!empty($prices['billTotal'])) {
         OPCloader::$totalIsZero = false;
     }
     OPCloader::opcDebug('OPC: getCheckoutPrices from ajaxhelper.php');
     OPCloader::opcDebug($prices);
     if (isset($cart->OPCCartData)) {
         OPCloader::opcDebug($cart->OPCCartData);
     }
     if (!empty($opc_request_cache)) {
         if (!empty($saved_id)) {
             $sprice['shipmentValue'] = $prices['shipmentValue'];
             $sprice['shipmentTax'] = $prices['shipmentTax'];
             $sprice['salesPriceShipment'] = $prices['salesPriceShipment'];
             $sprice['shipment_calc_id'] = $prices['shipment_calc_id'];
             $sprice['shipmentName'] = @$prices['shipmentName'];
             OPCcache::storeShipingCalculation($cart, $sprice, $sprice['shipmentName'], $shipping_id);
         }
     }
     // in case calculation invalidates it:
     $cart->virtuemart_shipmentmethod_id = $saved_id;
     $cart->couponCode = $savedcoupon;
 }