PEEL Shopping
Open source ecommerce : PEEL Shopping
index.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: index.php 47245 2015-10-08 16:47:28Z gboussin $
14 if (defined('PEEL_PREFETCH')) {
15  call_module_hook('configuration_end', array());
16 } else {
17  include("../configuration.inc.php");
18 }
19 
20 define('IN_RUBRIQUE', true);
21 
22 if (empty($_GET['rubid']) && !empty($GLOBALS['site_parameters']['disallow_main_content_category'])) {
23  // Si pas autorisé de voir /lire/ , retour à la page d'accueil
24  redirect_and_die(get_url('/'), true);
25 }
26 
27 $output = '';
28 $GLOBALS['page_name'] = 'rubriques';
29 $rubid = intval(vn($_GET['rubid']));
30 $sql = "SELECT r.nom_" . $_SESSION['session_langue'] . " as nom, etat, technical_code
31  FROM peel_rubriques r
32  WHERE r.id ='" . intval($rubid) . "' AND r.technical_code NOT IN ('other', 'iphone_content') AND " . get_filter_site_cond('rubriques', 'r') . "
33  ORDER BY r.position " . (!empty($GLOBALS['site_parameters']['content_category_primary_order_by'])? ", r." . $GLOBALS['site_parameters']['content_category_primary_order_by'] : '') . "
34  ";
36 if ($rub = fetch_assoc($rub_query)) {
37  if(!empty($rub['technical_code']) && String::strpos($rub['technical_code'], 'R=') === 0) {
38  // redirection suivie que la rubrique soit active ou non
39  $url_rub = String::substr($rub['technical_code'], 2);
40  if(strpos($url_rub, '://') === false) {
41  if(String::substr($url_rub, 0, 1) != '/') {
42  $url_rub = '/' . $url_rub;
43  }
44  $url_rub = $GLOBALS['wwwroot'] . $url_rub;
45  }
46  redirect_and_die($url_rub, true);
47  }
48  if($rub['etat']==0 && !a_priv('admin_content', false)) {
49  redirect_and_die(get_url('/'), true);
50  }
51  // Permet de définir l'id de la div principal du site.
52  if ($rub['technical_code'] == 'tradefair' || $rub['technical_code'] == 'tradefaire_home') {
53  $GLOBALS['main_div_id'] = 'tradefair';
54  } elseif ($rub['technical_code'] == 'tradefloor') {
55  $GLOBALS['main_div_id'] = 'tradefloor';
56  }
57 }
58 if (check_if_module_active('url_rewriting')) {
59  if (!empty($rub) && get_content_category_url($rubid, $rub['nom']) != get_current_url(false)) {
60  // L'URL sans le get n'est pas comme elle est censée être => on redirige avec une 301
61  $theoretical_current_url = (!empty($_GET['page'])?get_content_category_url($rubid, $rub['nom'], true, true) . 'page=' . $_GET['page']:get_content_category_url($rubid, $rub['nom']));
62  redirect_and_die($theoretical_current_url, true);
63  } elseif (empty($rub) && get_content_category_url(null, null) != get_current_url(false)) {
64  redirect_and_die(get_content_category_url(null, null));
65  }
66 }
67 
68 $class = "";
69 if (function_exists('has_special_article') && has_special_article($rubid)) {
70  $class = "special_content";
71 }
72 
73 $tpl = $GLOBALS['tplEngine']->createTemplate('lire.tpl');
74 $tpl->assign('class', $class);
75 $tpl->assign('articles_list_brief_html', get_articles_list_brief_html($rubid));
76 $output .= $tpl->fetch();
77 
78 $GLOBALS['page_columns_count'] = $GLOBALS['site_parameters']['lire_index_page_columns_count'];
79 include($GLOBALS['repertoire_modele'] . "/haut.php");
80 echo $output;
81 include($GLOBALS['repertoire_modele'] . "/bas.php");
static strpos($haystack, $needle, $offset=0)
Returns the numeric position of the first occurrence of needle in the haystack string.
Definition: String.php:54
get_current_url($with_get=true, $get_short_url=false, $take_away_get_args_array=null)
get_current_url()
Definition: fonctions.php:1743
$sql
Definition: index.php:30
$tpl
Definition: index.php:69
$rub_query
Definition: index.php:35
if($rub=fetch_assoc($rub_query)) if(check_if_module_active('url_rewriting')) $class
Definition: index.php:68
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
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
call_module_hook($hook, $params, $mode= 'boolean')
Appelle la fonction correspondant au $hook pour chaque module installé La fonction doit s'appeler : [...
$output
Definition: index.php:61
vn(&$var, $default=0)
Variable nulle if $var n'est pas défini, retourne $default, sinon retourne $var.
Definition: format.php:110
a_priv($requested_priv, $demo_allowed=false, $site_configuration_modification=false, $user_id=null)
Renvoie true si l'utilisateur de la session a le privilège $requested_priv ou un droit supérieur Des ...
Definition: user.php:63
$GLOBALS['page_name']
Definition: index.php:28
$rubid
Definition: index.php:29
if(!isset($_GET['lettre'])&&!isset($_GET['id'])) elseif(isset($_GET['lettre'])&&!isset($_GET['id'])) elseif(isset($_GET['lettre'])&&isset($_GET['id']))
Definition: index.php:27
static substr($string, $start, $length=null)
Returns the portion of string specified by the start and length parameters.
Definition: String.php:112
check_if_module_active($module_name, $specific_file_name=null)
Renvoie si un module est présent et activé ou non - Peut être appelé avant ou après le chargement d'u...
$_SESSION['session_install_serveur']
Definition: index.php:23

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