PEEL Shopping
Open source ecommerce : PEEL Shopping
prefetch.php
Go to the documentation of this file.
1 <?php
2 // This file should be in UTF8 without BOM - Accents examples: éèê
3 // +----------------------------------------------------------------------+
4 // | Copyright (c) 2004-2015 Advisto SAS, service PEEL - contact@peel.fr |
5 // +----------------------------------------------------------------------+
6 // | This file is part of PEEL Shopping 8.0.0, which is subject to an |
7 // | opensource GPL license: you are allowed to customize the code |
8 // | for your own needs, but must keep your changes under GPL |
9 // | More information: https://www.peel.fr/lire/licence-gpl-70.html |
10 // +----------------------------------------------------------------------+
11 // | Author: Advisto SAS, RCS 479 205 452, France, https://www.peel.fr/ |
12 // +----------------------------------------------------------------------+
13 // $Id: prefetch.php 46935 2015-09-18 08:49:48Z gboussin $
14 define('PEEL_PREFETCH', true);
15 include("configuration.inc.php");
16 
17 $short_url = $_SERVER['REQUEST_URI'];
18 
19 if(empty($GLOBALS['site_parameters']['enable_prefetch'])) {
20  // Le prefetch est désactivé. Pourtant on arrive ici car le .htaccess a la règle qui fait la correspondance entre tous les .htm et ce fichier prefetch.php
21  if (empty($_GET) && strpos($short_url, '..') === false && file_exists($GLOBALS['dirroot'] . $short_url)) {
22  // On cherche la page .htm demandée au cas où elle existe
23  require_once($GLOBALS['dirroot'] . $short_url);
24  die();
25  }
26  // Sinon on redirige vers la page d'accueil
27  redirect_and_die(get_url('/'));
28 }
29 
30 // Faire 301 de anciennes pages vers nouvelles pages
31 // A FAIRE
32 
33 
34 // On va chercher à quoi peut correspondre la page .htm demandée
35 if (String::strpos($short_url, '?') !== false) {
37 }
38 if (String::strpos($short_url, '/') === 0) {
40 }
41 // Etape 1 : Recherche dans les rubriques de contenu
42 $sql = "SELECT r.*
43  FROM peel_rubriques r
44  WHERE " . get_filter_site_cond('rubriques', 'r') . " AND (r.technical_code='".real_escape_string($short_url)."' OR r.technical_code='/".real_escape_string($short_url)."')
45  LIMIT 1";
47 if ($result = fetch_assoc($query)) {
48  $_GET['rubid'] = $result['id'];
49  include($GLOBALS['dirroot'] . '/lire/index.php');
50  die();
51 }
52 
53 // Etape 2 : Recherche dans les articles de contenu
54 $sql = "SELECT a.*
55  FROM peel_articles a
56  WHERE " . get_filter_site_cond('articles', 'a') . " AND (a.technical_code='".real_escape_string($short_url)."' OR a.technical_code='/".real_escape_string($short_url)."')
57  LIMIT 1";
58 $query = query($sql);
59 if ($result = fetch_assoc($query)) {
60  $_GET['id'] = $result['id'];
61  include($GLOBALS['dirroot'] . '/lire/article_details.php');
62  die();
63 }
64 
65 if(function_exists('convertHrefUri')) {
66  // Décodage d'URL
67  $href = convertHrefUri($_SERVER['REQUEST_URI']);
68  if(String::strpos($href['script_filename'], '.php') && file_exists($GLOBALS['dirroot'] . '/' . $href['script_filename'])) {
69  $script_filename = $href['script_filename'];
70  unset($href['script_filename']);
71  $_GET = $href;
72  unset($href);
73  require_once($GLOBALS['dirroot'] . '/' . $script_filename);
74  die();
75  }
76 }
77 
78 /*
79 // Annonces Advisto.com
80 $href = convertHrefUri($_SERVER['REQUEST_URI'], null, $_SESSION['session_langue']);
81 
82 if (!empty($href) && !empty($href[0])) {
83  // On réécrit le nom du script dans la variable $_SERVER
84  $file_name = $href[0];
85  $_SERVER['SCRIPT_NAME'] = '/' . $href[0];
86  if(isset($_GET['test_ads'])){
87  $test_ads=$_GET['test_ads'];
88  }
89  $_GET = $href;
90  unset($_GET[0]);
91  unset($href);
92  if(isset($test_ads)){
93  $_GET['test_ads']=$test_ads;
94  }
95  if (!empty($_GET['page']) && (is_numeric($_GET['page']) || strpos($_GET['page'], 'rss') === 0)) { // || !empty($_GET['logout'])
96  if ($file_name == 'form_save.php') {
97  require_once($GLOBALS['dirroot'] . '/modules/advistocom/form_save.php');
98  } elseif (file_exists('files/' . $file_name)) {
99  require_once($GLOBALS['dirroot'] . 'files/' . $file_name);
100  die();
101  }
102  }
103 }
104 */
105 
106 echo 'nothing found';
$result
static strpos($haystack, $needle, $offset=0)
Returns the numeric position of the first occurrence of needle in the haystack string.
Definition: String.php:54
redirect_and_die($url, $permanent_redirection=false, $avoid_loop=false)
Redirige vers l'URL demandée et arrête le programme.
Definition: fonctions.php:1551
$query
Definition: prefetch.php:46
real_escape_string($value)
real_escape_string()
Definition: database.php:374
$short_url
Definition: prefetch.php:17
get_filter_site_cond($table_technical_code, $table_alias=null, $use_strict_rights_if_in_admin=false, $specific_site_id=null, $exclude_public_items=false, $admin_force_multisite_if_allowed=false)
Retourne la condition SQL permettant de filtrer les données pour une table.
Definition: fonctions.php:4643
query($query, $die_if_error=false, $database_object=null, $silent_if_error=false, $security_sql_filter=true)
The query() function is meant to be called anywhere you want to make a query.
Definition: database.php:158
fetch_assoc($query_result)
fetch_assoc()
Definition: database.php:283
$GLOBALS['page_columns_count']
if(empty($GLOBALS['site_parameters']['enable_prefetch'])) if(String::strpos($short_url, '?')!==false) if(String::strpos($short_url, '/')===0) $sql
Definition: prefetch.php:42
static substr($string, $start, $length=null)
Returns the portion of string specified by the start and length parameters.
Definition: String.php:112

This documentation for Open ecommerce PEEL Shopping and PEEL.fr has been generated by Doxygen on Thu Oct 15 2015 14:41:35 - Peel ecommerce is a product of Agence web Advisto SAS. All rights reserved.