PEEL Shopping
Open source ecommerce : PEEL Shopping
rpc_positions.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: rpc_positions.php 46935 2015-09-18 08:49:48Z gboussin $
14 define('IN_PEEL_ADMIN', true);
15 define('IN_RPC', true);
16 define('LOAD_NO_OPTIONAL_MODULE', true);
17 define('SKIP_SET_LANG', true);
18 include("../configuration.inc.php");
19 
20 if (!empty($_GET['encoding'])) {
21  $page_encoding = $_GET['encoding'];
22 } else {
23  $page_encoding = 'utf-8';
24 }
25 $output = '';
26 
27 if (!est_identifie() || empty($_POST)) {
28  $output .= 'nok';
29 } else {
31  // On fait les tests de droits une bonne fois pour toutes
32  if(vb($_GET['mode']) == 'countries' && a_priv("admin_manage")) {
33  $sql = "UPDATE peel_pays
34  SET position='%s' AND " . get_filter_site_cond('pays', null, true) . "
35  WHERE id='%s'";
36  }elseif(vb($_GET['mode']) == 'langues' && a_priv("admin_manage")) {
37  $sql = "UPDATE peel_langues
38  SET position='%s'
39  WHERE id='%s' AND " . get_filter_site_cond('langues', null, true) . "";
40  }elseif(vb($_GET['mode']) == 'types' && a_priv("admin_manage")) {
41  $sql = "UPDATE peel_types
42  SET position='%s'
43  WHERE id='%s' AND " . get_filter_site_cond('types', null, true) . "";
44  }elseif(vb($_GET['mode']) == 'tailles' && a_priv("admin_products")) {
45  $sql = "UPDATE peel_tailles
46  SET position='%s'
47  WHERE id='%s' AND " . get_filter_site_cond('tailles', null, true) . "";
48  }elseif(vb($_GET['mode']) == 'couleurs' && a_priv("admin_products")) {
49  $sql = "UPDATE peel_couleurs
50  SET position='%s'
51  WHERE id='%s' AND " . get_filter_site_cond('couleurs', null, true) . "";
52  }elseif(vb($_GET['mode']) == 'paiement' && a_priv("admin_manage")) {
53  $sql = "UPDATE peel_paiement
54  SET position='%s'
55  WHERE id='%s' AND " . get_filter_site_cond('paiement', null, true) . "";
56  } elseif(vb($_GET['mode']) == 'statut_paiement' && a_priv("admin_manage")) {
57  $sql = "UPDATE peel_statut_paiement
58  SET position='%s'
59  WHERE id='%s' AND " . get_filter_site_cond('statut_paiement', null, true) . "";
60  } elseif(vb($_GET['mode']) == 'references' && a_priv("admin_products")) {
61  $sql = "UPDATE peel_references
62  SET position='%s'
63  WHERE id='%s'";
64  } elseif(vb($_GET['mode']) == 'statut_livraison' && a_priv("admin_manage")) {
65  $sql = "UPDATE peel_statut_livraison
66  SET position='%s'
67  WHERE id='%s' AND " . get_filter_site_cond('statut_livraison', null, true) . "";
68  } else {
69  die('nok');
70  }
71  foreach($_POST['sortable'] as $this_form_position => $this_id) {
72  // On veut commencer à 1 et non pas à 0 : ça fait plus propre
73  $this_position = $this_form_position + 1;
74  // On met à jour les positions en fonction de la liste reçue en POST
75  query(sprintf($sql, intval($this_position), intval($this_id)));
76  }
77  $output .= 'ok';
78 }
79 echo String::convert_encoding($output, $page_encoding, GENERAL_ENCODING);
80 
static convert_encoding($string, $new_encoding, $original_encoding=null)
Converts the character encoding of string $string to $new_encoding from optionally $original_encoding...
Definition: String.php:375
output_general_http_header($page_encoding=null, $cache_duration_in_seconds=null)
Envoie les headers avant l'envoi du HTML.
Definition: fonctions.php:1528
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(!defined('IN_PEEL')) est_identifie()
Retourne true si l'utilisateur est identifié
Definition: user.php:23
vb(&$var, $default=null)
Variable blanche if $var n'est pas défini, retourne $default, sinon retourne $var.
Definition: format.php:97
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(!check_if_module_active('search')) $page_encoding
Definition: produit.php:23
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
$output

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