Example #1
0
function tep_href_link($page = '', $parameters = '', $connection = 'NONSSL', $add_session_id = true, $search_engine_safe = true)
{
    global $seo_urls, $languages_id, $request_type, $session_started, $sid;
    if (!is_object($seo_urls)) {
        include_once DIR_WS_MODULES . 'ultimate_seo_urls5' . DIRECTORY_SEPARATOR . 'classes' . DIRECTORY_SEPARATOR . 'usu.php';
        $seo_urls = new usu($languages_id, $request_type, $session_started, $sid);
    }
    return $seo_urls->href_link($page, $parameters, $connection, $add_session_id);
}
 public function retrieve()
 {
     if (SEO_URLS_ENABLED != 'false') {
         usu::$performance['time'] = microtime(true);
         if (false === ($rawdata = gzinflate(base64_decode($this->get($this->cachename))))) {
             return usu::$registry = Usu_Registry::getInstance();
         }
         usu::$cachefile_size = number_format(strlen($this->get($this->cachename)) / 1024, 2) . ' kb';
         usu::$registry = unserialize($rawdata);
         usu::$performance['time'] = round(microtime(true) - usu::$performance['time'], 4);
     }
 }
 public function retrieve()
 {
     if (is_readable($this->cachpath) && SEO_URLS_ENABLED != 'false' && !$this->gc()) {
         usu::$cachefile_size = number_format(filesize($this->cachpath) / 1024, 2) . ' kb';
         usu::$performance['time'] = microtime(true);
         $this->md5check = md5(file_get_contents($this->cachpath));
         usu::$registry = unserialize(gzinflate(file_get_contents($this->cachpath)));
         usu::$performance['time'] = round(microtime(true) - usu::$performance['time'], 4);
         return true;
     }
     usu::$registry = Usu_Registry::getInstance();
 }
Example #4
0
 /**
  * Builds the seo url
  * 
  * @param string $page - file name of the calling page e.g. index.php
  * @param array $valuepair - key => value pair array containing dependency(e.g. cPath) => value (e.g. 2_24_52)
  * @param string $url - $url passed by reference created by the method linkCreate() 
  * @param array $added_qs - passed by reference containing key value pairs for _GET
  * @param string $parameters - Currently unused
  */
 public function buildLink($page, $valuepair, &$url, &$added_qs, $parameters)
 {
     if ($valuepair[0] != self::DEPENDENCY || false === array_key_exists(1, $valuepair) || false === $this->installed || !tep_not_null($valuepair[1])) {
         return false;
         // Either this module is not installed or the value pair does not meet our requirements so abort
     }
     $base_path = $valuepair[1];
     // well it might be a single top level item
     if (false === $this->suppress_underscores) {
         if (false !== strpos($valuepair[1], '_')) {
             // It is a path with parents? ( has underscores )
             $base_path = ltrim(strrchr($valuepair[1], '_'), '_');
             // Grab the base path which is the number at the end of a path with parents ( e.g. 2_23_37_52 = 52 )
         }
     }
     // Sanity check - if the $base_path is not numeric then we dump it
     if (false === is_numeric(str_replace('_', '', $base_path))) {
         trigger_error(__CLASS__ . ' Incorrect ' . self::DEPENDENCY . ' presented: ' . $valuepair[1], E_USER_WARNING);
         return false;
     }
     // Get a full path with underscores from the database
     $full_path = $this->get_full_path($base_path);
     // If this item is not already in the registry we use the acquire() method to query for the data
     if (!isset(usu::$registry->vars[self::DEPENDENCY][$full_path])) {
         if (false === $this->acquire($base_path, $full_path)) {
             return false;
             // Looks like an invalid request so dump it
         }
     } else {
         usu::$performance['queries_saved']++;
         // Already in the registry so we saved one query
     }
     /**
      * About $reg_item
      * 
      * We grab the array of data from the registry and place it in $reg_item for convenience
      * The data stored in the registry was set in the method acquire as properties of this class
      * These are then set in the registry using the method getProperties()
      * the specific array keys like $reg_item['catname'] will be specific and differ in each module 
      */
     $reg_item = array();
     $reg_item = usu::$registry->vars[$valuepair[0]][$full_path];
     /**
      * Set the link text from reg_item
      * e.g. $link_text = $reg_item['parentname'] . '-' . $reg_item['catname'];
      */
     $link_text = $reg_item['information_title'];
     // the property added in the acquire function this would have been set in the acquire method like $this->xxxname
     switch (true) {
         case $page == self::FILENAME:
             $url = $this->linkCreate(self::FILENAME, $link_text, self::MARKER, $full_path);
             break;
         default:
             // Add leftovers to the querystring _GET
             $added_qs[filter_var($valuepair[0], FILTER_SANITIZE_STRING)] = usu::cleanse($valuepair[1]);
             break;
     }
     # end switch
 }
 public function gc()
 {
     $query = str_replace(':cache_name', $this->cachename, $this->gc_query);
     usu::query($query);
     $this->retrieved = false;
 }
Example #6
0
 public function buildLink($page, $valuepair, &$url, &$added_qs, $parameters)
 {
     if (false === array_key_exists(1, $valuepair) || $valuepair[0] != $this->dependency || false !== strpos(urldecode($valuepair[1]), '{') || !tep_not_null($valuepair[1])) {
         return false;
     }
     if (!isset(usu::$registry->vars[$valuepair[0]][$valuepair[1]])) {
         if (false === $this->acquire($valuepair[1], $fullpath = false)) {
             return false;
         }
     } else {
         usu::$performance['queries_saved']++;
     }
     $reg_item = usu::$registry->vars[$valuepair[0]][$valuepair[1]];
     switch (true) {
         case $page == FILENAME_PRODUCT_INFO && false === strpos($valuepair[1], '{'):
             $url = $this->linkCreate(FILENAME_PRODUCT_INFO, $reg_item['link_text'], '-p-', $valuepair[1]);
             break;
         case $page == FILENAME_PRODUCT_REVIEWS:
             $url = $this->linkCreate(FILENAME_PRODUCT_REVIEWS, $reg_item['link_text'], '-pr-', $valuepair[1]);
             break;
         case $page == FILENAME_PRODUCT_REVIEWS_INFO:
             $url = $this->linkCreate(FILENAME_PRODUCT_REVIEWS_INFO, $reg_item['link_text'], '-pri-', $valuepair[1]);
             break;
         default:
             $added_qs[filter_var($valuepair[0], FILTER_SANITIZE_STRING)] = usu::cleanse($valuepair[1]);
             break;
     }
     # end switch
 }
Example #7
0
 private function extractByDirSeparator()
 {
     global $_GET;
     $tmp = explode('/', $this->filestring);
     $count = count($tmp);
     for ($i = 0; $i < $count; $i = $i + 2) {
         $newget[filter_var($tmp[$i], FILTER_SANITIZE_STRING)] = usu::cleanse($tmp[$i + 1]);
         // assign cleansed key=>value pair to _GET
         $_GET[filter_var($tmp[$i], FILTER_SANITIZE_STRING)] = usu::cleanse($tmp[$i + 1]);
         $_GET[filter_var($tmp[$i], FILTER_SANITIZE_STRING)] = usu::cleanse($tmp[$i + 1]);
     }
     // Newly created _GET array added to the querystring and converted to _GET string
     $getstring = http_build_query($newget) . '&' . $this->querystring;
     $this->querystring = rtrim($getstring, '&');
 }
Example #8
0
 /**
  * Builds the seo url
  * 
  * @param string $page - file name of the calling page e.g. index.php
  * @param array $valuepair - key => value pair array containing dependency(e.g. cPath) => value (e.g. 2_24_52)
  * @param string $url - $url passed by reference created by the method linkCreate() 
  * @param array $added_qs - passed by reference containing key value pairs for _GET
  * @param string $parameters - Currently unused
  */
 public function buildLink($page, $valuepair, &$url, &$added_qs, $parameters)
 {
     if ($valuepair[0] != self::DEPENDENCY || false === array_key_exists(1, $valuepair) || !tep_not_null($valuepair[1]) || false === $this->installed) {
         return false;
         // Either this module is not installed or the value pair does not meet our requirements so abort
     }
     $base_path = $valuepair[1];
     // well it might be a single top level item
     if (false !== strpos($valuepair[1], '_')) {
         // It is a path with parents? ( has underscores )
         $base_path = ltrim(strrchr($valuepair[1], '_'), '_');
         // Grab the base path which is the number at the end of a path with parents ( e.g. 2_23_37_52 = 52 )
     }
     // Sanity check - if the $base_path is not numeric then we dump it
     if (false === is_numeric($base_path)) {
         trigger_error(__CLASS__ . ' Incorrect ' . self::DEPENDENCY . ' presented: ' . $valuepair[1], E_USER_WARNING);
         return false;
     }
     // Check if the registry fullpaths array exists, if not then create it
     if (false === array_key_exists('fullpaths', usu::$registry->vars)) {
         usu::$registry->vars['fullpaths'] = array();
     }
     // If the $base_path is not in the registry let's add it
     if (false === array_key_exists($base_path, usu::$registry->vars['fullpaths'])) {
         $valuepair[1] = $this->get_full_path($valuepair[1]);
         // Get the full path including any parents
         usu::$registry->vars['fullpaths'][$base_path] = $valuepair[1];
         // Add to the registry - base_category => full path
     } else {
         // It is already in the registry so no need for queries
         $countpaths = 1;
         // Could be a single item with no parents so set it here
         // If multiple paths a query would be needed for each path
         if (false !== strpos(usu::$registry->vars['fullpaths'][$base_path], '_')) {
             // If it is a path with parents
             $countpaths = substr_count(usu::$registry->vars['fullpaths'][$base_path], '_') + 1;
             // Count the number of underscores and add one
         }
         usu::$performance['queries_saved'] += $countpaths;
         $valuepair[1] = usu::$registry->vars['fullpaths'][$base_path];
         // Set $valuepair[1] from the registry ( e.g. the value of cPath so could be like 4_21_54)
     }
     // If this item is not already in the registry we use the acquire() method to query for the data
     if (!isset(usu::$registry->vars[self::DEPENDENCY][$base_path])) {
         if (false === $this->acquire($base_path, $fullpath = false)) {
             return false;
             // Looks like an invalid request so dump it
         }
     } else {
         usu::$performance['queries_saved']++;
         // Already in the registry so we saved one query
     }
     /**
      * About $reg_item
      * 
      * We grab the array of data from the registry and place it in $reg_item for convenience
      * The data stored in the registry was set in the method acquire as properties of this class
      * These are then set in the registry using the method getProperties()
      * the specific array keys like $reg_item['catname'] will be specific and differ in each module 
      */
     $reg_item = array();
     $reg_item = usu::$registry->vars[$valuepair[0]][$base_path];
     /**
      * Set the link text from reg_item
      * e.g. $link_text = $reg_item['parentname'] . '-' . $reg_item['catname'];
      */
     if (defined('SEO_URLS_ADD_CAT_PARENT') && SEO_URLS_ADD_CAT_PARENT == 'true' && $reg_item['parentname'] != 'false') {
         $link_text = $reg_item['parentname'] . '-' . $reg_item['catname'];
     } else {
         $link_text = $reg_item['catname'];
     }
     switch (true) {
         case $page == self::FILENAME:
             $url = $this->linkCreate(self::FILENAME, $link_text, self::MARKER, $valuepair[1]);
             break;
         default:
             // Add leftovers to the querystring _GET
             $added_qs[filter_var($valuepair[0], FILTER_SANITIZE_STRING)] = usu::cleanse($valuepair[1]);
             break;
     }
     # end switch
 }
Example #9
0
 /**
  * Converter for the special character conversion string
  * 
  * Converts the comma seperated string e.g. a=>b,z=>y to an array of key=>value pairs
  * or if a language character conversion file exists - use it overriding the db settings
  */
 private static function characterConversionSet()
 {
     // Check to see if there is a character conversion language file before trying the admin settings
     $character_conv_filepath = self::$usuPath . 'includes' . DIRECTORY_SEPARATOR . 'character_conversion' . DIRECTORY_SEPARATOR . self::$language . '.php';
     if (is_readable($character_conv_filepath)) {
         include_once $character_conv_filepath;
         if (isset($char_convert) && is_array($char_convert) && !empty($char_convert)) {
             return $char_convert;
         }
     }
     if (defined('SEO_URLS_CHAR_CONVERT_SET') && tep_not_null(SEO_URLS_CHAR_CONVERT_SET)) {
         self::$character_conversion = array();
         $comma_separation = explode(',', SEO_URLS_CHAR_CONVERT_SET);
         foreach ($comma_separation as $index => $value_pairs) {
             $pairs = @explode('=>', $value_pairs);
             self::$character_conversion[trim($pairs[0])] = trim($pairs[1]);
         }
         return self::$character_conversion;
     }
     return self::$character_conversion = false;
 }
Example #10
0
}
// EOF: [TiM's osC Solutions] ISO-8859-1/UTF-8 dual support
// LINE ADDED: MOD - BTS
require DIR_WS_INCLUDES . 'configure_bts.php';
require bts_select('include', 'functions/html_output.php');
// include the language translations
require bts_select('language', 'core.php');
// include the language locale
require bts_select('language', 'locale/locale.php');
// LINE ADDED - CREDIT CLASS Gift Voucher Contribution
require bts_select('language', 'add_ccgvdc.php');
// BOF: MOD
// ULTIMATE Seo Urls 5 by FWR Media
if (!isset($seo_urls) || !is_object($seo_urls)) {
    include_once DIR_WS_MODULES . 'ultimate_seo_urls5' . DIRECTORY_SEPARATOR . 'classes' . DIRECTORY_SEPARATOR . 'usu.php';
    $seo_urls = new usu($languages_id, $request_type, $session_started, $SID);
}
$seo_urls->initiate($SID, $languages_id, $language);
// EOF: ULTIMATE Seo Urls 5 by FWR Media
// EOF: MOD
// currency
if (!tep_session_is_registered('currency') || isset($_GET['currency']) || USE_DEFAULT_LANGUAGE_CURRENCY == 'true' && LANGUAGE_CURRENCY != $currency) {
    if (!tep_session_is_registered('currency')) {
        tep_session_register('currency');
    }
    if (isset($_GET['currency']) && $currencies->is_set($_GET['currency'])) {
        $currency = $_GET['currency'];
    } else {
        $currency = USE_DEFAULT_LANGUAGE_CURRENCY == 'true' ? LANGUAGE_CURRENCY : DEFAULT_CURRENCY;
    }
}