PEEL Shopping
Open source ecommerce : PEEL Shopping
article_details.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: article_details.php 47245 2015-10-08 16:47:28Z gboussin $
14 
15 define('IN_RUBRIQUE_ARTICLE', true);
16 if (defined('PEEL_PREFETCH')) {
17  call_module_hook('configuration_end', array());
18 } else {
19  include("../configuration.inc.php");
20 }
21 
22 if (!empty($_GET['artid']) && empty($_GET['rubid']) && empty($_GET['id'])) {
23  // Compatibilité avec anciennes URL
24  $_GET['id'] = intval($_GET['artid']);
25 } elseif (!empty($_GET['rubid']) && empty($_GET['id'])) {
26  // Compatibilité avec anciennes URL
27  $_GET['id'] = intval($_GET['rubid']);
28 } elseif (empty($_GET['id'])) {
29  redirect_and_die(get_url('/'));
30 } else {
31  $_GET['id'] = intval($_GET['id']);
32 }
33 
34 $sql = "SELECT p.technical_code, p.on_reseller, p.id, p.titre_" . $_SESSION['session_langue'] . ", pc.rubrique_id, r.nom_" . $_SESSION['session_langue'] . " AS rubrique_nom
35  FROM peel_articles p
36  INNER JOIN peel_articles_rubriques pc ON p.id = pc.article_id
37  INNER JOIN peel_rubriques r ON r.id = pc.rubrique_id AND r.technical_code NOT IN ('other', 'iphone_content') AND " . get_filter_site_cond('rubriques', 'r') . "
38  WHERE p.id ='" . intval($_GET['id']) . "' AND " . get_filter_site_cond('articles', 'p') . "";
39 
41 ;
42 if ($art = fetch_assoc($art_query)) {
43  if(!empty($art['technical_code']) && String::strpos($art['technical_code'], 'R=') === 0) {
44  // redirection suivie que l'article soit actif ou non
45  $url_art = String::substr($art['technical_code'], 2);
46  if(strpos($url_art, '://') === false) {
47  if(String::substr($url_art, 0, 1) != '/') {
48  $url_art = '/' . $url_art;
49  }
50  $url_art = $GLOBALS['wwwroot'] . $url_art;
51  }
52  redirect_and_die($url_art, true);
53  }
54  if($art['on_reseller'] == 1 && !a_priv("admin_product") && !a_priv("reve")) {
55  redirect_and_die(get_url('/'));
56  }
57  // Si on passe ici et que $art['etat']=0 : on continue quand même, et on affichera dans get_article_details_html que l'article n'a pas été trouvé
58 } else {
59  // Article n'existe pas
60  redirect_and_die(get_url('/'));
61 }
62 
63 // Permet de définir l'id de la div principal du site.
64 if ($art['technical_code'] == 'tradefair') {
65  $GLOBALS['main_div_id'] = 'tradefair';
66 } elseif ($art['technical_code'] == 'tradefloor') {
67  $GLOBALS['main_div_id'] = 'tradefloor';
68 }
69 
70 if (check_if_module_active('url_rewriting')) {
71  // Attention la redirection ne sera effectuée que si il n'y a pas de / sur le REQUEST_URI car cela permet de crée des urls courtes par le htaccess sans rediriger par la suite.
72  // Exemple redirection htaccess pour un article avec l'url /patrocinador-categoría.html
73  if (get_content_url($art['id'], $art["titre_" . $_SESSION['session_langue']], $art['rubrique_id'], $art["rubrique_nom"]) != get_current_url(false) && String::strpos(substr($_SERVER['REQUEST_URI'], 1), '/') !== false) {
74  // L'URL sans le get n'est pas comme elle est censée être => on redirige avec une 301
75  $theoretical_current_url = get_content_url($art['id'], $art["titre_" . $_SESSION['session_langue']], $art['rubrique_id'], $art["rubrique_nom"]);
76  redirect_and_die($theoretical_current_url, true);
77  }
78 } else {
79  $_GET['rubid'] = $art['rubrique_id'];
80 }
81 
82 $tpl = $GLOBALS['tplEngine']->createTemplate('article_details.tpl');
83 $tpl->assign('article_details_html', get_article_details_html(intval($_GET['id'])));
84 $output = $tpl->fetch();
85 
86 if (!empty($GLOBALS['site_parameters']['enable_create_product_in_front_office']) && $art['technical_code'] == 'display_product_form') {
87  $output .= update_product_from_front_office($_POST);
88 }
89 $GLOBALS['page_columns_count'] = $GLOBALS['site_parameters']['article_details_index_page_columns_count'];
90 include($GLOBALS['repertoire_modele'] . "/haut.php");
91 echo $output;
92 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
$output
$sql
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
$art_query
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
if(strlen($date2)== '10') if($type== 'users-by-age'&&a_priv('admin_users', true)) elseif($type== 'forums-count'&&a_priv('admin_content', true)) elseif($type== 'forums-categories'&&a_priv('admin_content', true)) elseif($type== 'users-count'&&a_priv('admin_users', true)) elseif($type== 'product-categories'&&a_priv('admin_products', true)) elseif($type== 'users-by-sex'&&a_priv('admin_users', true)) elseif($type== 'users-by-country'&&a_priv('admin_users', true)) elseif($type== 'sales'&&a_priv('admin_sales', true))
Definition: chart-data.php:160
if(!empty($GLOBALS['site_parameters']['enable_create_product_in_front_office'])&&$art['technical_code']== 'display_product_form') $GLOBALS['page_columns_count']
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 : [...
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
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...
$tpl
if(defined('IN_PEEL_ADMIN')||IN_INSTALLATION) $_SESSION['session_langue']

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