private function disectUri() { // get the base filename $this->basename = usu5_base_filename(); // Confirm we have an seo registered page if not return false if (false === array_key_exists($this->basename, usu::$registry->seo_pages)) { return false; } // Remove the osCsid and sanitise $this->sanitizeQuerystring($_SERVER['QUERY_STRING']); // Attempt to format $_SERVER['REQUEST_URI'] for Windows/IIS $this->iis_request_uri(); // Remove the querystring (if there) if (false !== strpos($this->request_uri, '?')) { $this->filestring = substr_replace($this->request_uri, '', strpos($this->request_uri, '?')); // Querystring should not start with & but remove anyway (if there) } elseif (false !== strpos($this->request_uri, '&')) { $this->filestring = substr_replace($this->request_uri, '', strpos($this->request_uri, '&')); // Looks clean with no query string } else { $this->filestring = $this->request_uri; } // Return false if .. $this->filestring is empty .. or .. the querystring is empty and the filestring ends in .php if (false === tep_not_null($this->filestring) || substr($this->filestring, -4, 4) == '.php' && false === tep_not_null($this->querystring)) { return false; } // Check to see the type of URI we are dealing with switch ($this->filestring) { // broken osCommerce urls case substr_count($this->filestring, '/') > 1: $this->filestring = str_replace($this->basename . '/', '', $this->filestring); $newget = $this->extractByDirSeparator(); $this->parsePath(); break; // Non rewrite seo urls // Non rewrite seo urls case false !== strpos($this->filestring, '/'): $this->filestring = str_replace($this->basename . '/', '', $this->filestring); $extractqs = $this->extractByMarkers(); $this->querystring = $extractqs . '&' . $this->querystring; $this->parsePath(); break; // Rewrite seo urls // Rewrite seo urls case false !== strpos($this->filestring, '.html'): $this->filestring = str_replace('/', '', $this->filestring); $this->extractByMarkers(); $this->parsePath(); break; // Standard files // Standard files case substr($this->filestring, -4) == '.php': // If there is querystring but not an seo get key then don't validate foreach (usu::$registry->vars['page_dependencies'][$this->basename] as $getkey => $dummy) { if (false !== strpos($this->querystring, $getkey)) { // Serve standard osC uri when the products_id has attributes if ($getkey == 'products_id' && false !== strpos(urldecode($this->querystring), '}')) { return false; } $this->parsePath(); break; } } return false; break; default: break; } }
return $matches[0]; } } } $base->next(); } // Some odd server set ups return / for SCRIPT_NAME and PHP_SELF when accessed as mysite.com (no index.php) where they usually return /index.php if ($_SERVER['SCRIPT_NAME'] == '/' || $_SERVER['PHP_SELF'] == '/') { return 'index.php'; } // Return the standard RC3 code return strlen(ini_get('cgi.fix_pathinfo')) > 0 && (bool) ini_get('cgi.fix_pathinfo') == false || !isset($_SERVER['SCRIPT_NAME']) ? basename($_SERVER['PHP_SELF']) : basename($_SERVER['SCRIPT_NAME']); } // End function // set php_self in the local scope $PHP_SELF = usu5_base_filename(); if ($request_type == 'NONSSL') { define('DIR_WS_CATALOG', DIR_WS_HTTP_CATALOG); } else { define('DIR_WS_CATALOG', DIR_WS_HTTPS_CATALOG); } // include the list of project filenames require DIR_WS_INCLUDES . 'filenames.php'; // include the list of project database tables require DIR_WS_INCLUDES . 'database_tables.php'; // include the database functions require DIR_WS_FUNCTIONS . 'database.php'; // make a connection to the database... now tep_db_connect() or die('Unable to connect to database server!'); // set the application parameters $configuration_query = tep_db_query('select configuration_key as cfgKey, configuration_value as cfgValue from ' . TABLE_CONFIGURATION);