14 define(
'IN_PEEL_ADMIN', 
true);
 
   15 include(
"../configuration.inc.php");
 
   25 switch (
vb($_REQUEST[
'mode'])) {
 
   44                $_POST[
'image'] = 
upload(
'image', 
false, 
'image', 
$GLOBALS[
'site_parameters'][
'image_max_width'], 
$GLOBALS[
'site_parameters'][
'image_max_height'], null, null, 
vb($_POST[
'image']));
 
   46                $output .= 
$GLOBALS[
'tplEngine']->createTemplate(
'global_success.tpl', array(
'message' => sprintf(
$GLOBALS[
'STR_ADMIN_PAYS_MSG_CREATED_OK'], 
vb($_POST[
'pays_' . 
$_SESSION[
"session_langue"]]))))->fetch();
 
   57           if (!
verify_token($_SERVER[
'PHP_SELF'] . $frm[
'mode'] . $frm[
'id'])) {
 
   61                $_POST[
'image'] = 
upload(
'image', 
false, 
'image', 
$GLOBALS[
'site_parameters'][
'image_max_width'], 
$GLOBALS[
'site_parameters'][
'image_max_height'], null, null, 
vb($_POST[
'image']));
 
   63                $output .= 
$GLOBALS[
'tplEngine']->createTemplate(
'global_success.tpl', array(
'message' => sprintf(
$GLOBALS[
'STR_ADMIN_PAYS_MSG_UPDATED_OK'], 
vn($_POST[
'id']))))->fetch();
 
   78 include(
$GLOBALS[
'repertoire_modele'] . 
"/admin_haut.php");
 
   80 include(
$GLOBALS[
'repertoire_modele'] . 
"/admin_bas.php");
 
   97           foreach (
$GLOBALS[
'admin_lang_codes'] as $lng) {
 
   98                $frm[
'pays_' . $lng] = 
"";
 
  105           $frm[
'iso_num'] = 
"";
 
  106           $frm[
'position'] = 
"";
 
  108      $frm[
'nouveau_mode'] = 
"insere";
 
  128           $qid = 
query(
"SELECT * 
  133                $output .= 
$GLOBALS[
'tplEngine']->createTemplate(
'global_error.tpl', array(
'message' => 
$GLOBALS[
'STR_ADMIN_PAYS_ERR_NOT_FOUND']))->fetch();
 
  137      $frm[
"nouveau_mode"] = 
"maj";
 
  138      $frm[
"titre_bouton"] = 
$GLOBALS[
'STR_ADMIN_FORM_SAVE_CHANGES'];
 
  152      $tpl = 
$GLOBALS[
'tplEngine']->createTemplate(
'admin_formulaire_pays.tpl');
 
  155      $tpl->assign(
'mode', 
$frm[
"nouveau_mode"]);
 
  156      $tpl->assign(
'id', intval(
$frm[
'id']));
 
  159      $tpl->assign(
'iso_num', 
$frm[
"iso_num"]);
 
  162      foreach (
$GLOBALS[
'admin_lang_codes'] as $lng) {
 
  164                'pays' => 
$frm[
'pays_' . $lng],
 
  170      $sql_zone = 
"SELECT id, nom_" . 
$_SESSION[
'session_langue'] . 
" 
  173           ORDER BY nom_" . 
$_SESSION[
'session_langue'];
 
  174      $res_zone = 
query($sql_zone);
 
  176           $tpl_options[] = array(
'value' => intval($tab_zone[
'id']),
 
  177                'issel' => 
vb(
$frm[
'zone']) == $tab_zone[
'id'],
 
  178                'name' => $tab_zone[
'nom_' . 
$_SESSION[
'session_langue']]
 
  183      $tpl->assign(
'position', 
$frm[
"position"]);
 
  184      $tpl->assign(
'titre_bouton', 
$frm[
"titre_bouton"]);
 
  185      $tpl->assign(
'STR_ADMIN_WEBSITE', 
$GLOBALS[
'STR_ADMIN_WEBSITE']);
 
  186      $tpl->assign(
'STR_BEFORE_TWO_POINTS', 
$GLOBALS[
'STR_BEFORE_TWO_POINTS']);
 
  187      $tpl->assign(
'STR_ADMIN_PAYS_ADD_COUNTRY', 
$GLOBALS[
'STR_ADMIN_PAYS_ADD_COUNTRY']);
 
  188      $tpl->assign(
'STR_ADMIN_LANGUAGES_SECTION_HEADER', 
$GLOBALS[
'STR_ADMIN_LANGUAGES_SECTION_HEADER']);
 
  190      $tpl->assign(
'STR_ADMIN_PAYS_ISO_CODES_HEADER', 
$GLOBALS[
'STR_ADMIN_PAYS_ISO_CODES_HEADER']);
 
  191      $tpl->assign(
'STR_ADMIN_PAYS_ISO_2', 
$GLOBALS[
'STR_ADMIN_PAYS_ISO_2']);
 
  192      $tpl->assign(
'STR_ADMIN_PAYS_ISO_3', 
$GLOBALS[
'STR_ADMIN_PAYS_ISO_3']);
 
  193      $tpl->assign(
'STR_ADMIN_PAYS_ISO_NUMERIC', 
$GLOBALS[
'STR_ADMIN_PAYS_ISO_NUMERIC']);
 
  194      $tpl->assign(
'STR_ADMIN_VARIOUS_INFORMATION_HEADER', 
$GLOBALS[
'STR_ADMIN_VARIOUS_INFORMATION_HEADER']);
 
  198      $tpl->assign(
'STR_SHIPPING_ZONE', 
$GLOBALS[
'STR_SHIPPING_ZONE']);
 
  199      $tpl->assign(
'STR_ADMIN_POSITION', 
$GLOBALS[
'STR_ADMIN_POSITION']);
 
  200      $output .= 
$tpl->fetch();
 
  218      query(
"DELETE FROM peel_pays 
  220      return $GLOBALS[
'tplEngine']->createTemplate(
'global_success.tpl', array(
'message' => sprintf(
$GLOBALS[
'STR_ADMIN_PAYS_MSG_DELETED_OK'], $p[
'pays_' . 
$_SESSION[
'session_langue']])))->fetch();
 
  231      $sql = 
"INSERT INTO peel_pays ( 
  239      foreach (
$GLOBALS[
'admin_lang_codes'] as $lng) {
 
  240           $sql .= 
", pays_" . $lng;
 
  244           '" . intval(
$frm[
'zone']) . 
"' 
  245           , '" . intval(
vb(
$frm[
'etat'])) . 
"' 
  248           , '" . intval(
$frm[
'iso_num']) . 
"' 
  249           , '" . intval(
$frm[
'position']) . 
"' 
  251      foreach (
$GLOBALS[
'admin_lang_codes'] as $lng) {
 
  269      $sql = 
"UPDATE peel_pays 
  270           SET zone = '" . intval(
$frm[
'zone']) . 
"'";
 
  271      foreach (
$GLOBALS[
'admin_lang_codes'] as $lng) {
 
  278                , iso_num = '" . intval(
$frm[
'iso_num']) . 
"' 
  279                , etat = '" . intval(
vb(
$frm[
'etat'])) . 
"' 
  280                , position = '" . intval(
$frm[
'position']) . 
"' 
  281           WHERE id = '" . intval(
$id) . 
"'";
 
  292      if (isset($_POST[
'etat']) && isset($_POST[
'zones'])) {
 
  293           if ($_POST[
'etat'] == 1) {
 
  298           $sql = 
"UPDATE peel_pays 
  299                SET etat='" . intval($etat) . 
"' 
  304      $tpl = 
$GLOBALS[
'tplEngine']->createTemplate(
'admin_liste_pays.tpl');
 
  305      $tpl->assign(
'add_src', 
$GLOBALS[
'administrer_url'] . 
'/images/add.png');
 
  310      $sql_zone = 
"SELECT id, nom_" . 
$_SESSION[
'session_langue'] . 
" 
  313           ORDER BY nom_" . 
$_SESSION[
'session_langue'];
 
  314      $res_zone = 
query($sql_zone);
 
  326           ORDER BY p.position ASC, p.pays_" . 
$_SESSION[
'session_langue'] . 
" ASC");
 
  328      $tpl->assign(
'drop_src', 
$GLOBALS[
'administrer_url'] . 
'/images/b_drop.png');
 
  329      $tpl->assign(
'edit_src', 
$GLOBALS[
'administrer_url'] . 
'/images/b_edit.png');
 
  331           $tpl_results = array();
 
  335                $tpl_results[] = array(
'tr_rollover' => tr_rollover(
$i, 
true, null, null, 
'sortable_'.$ligne[
'id']),
 
  336                     'nom' => $ligne[
'pays_' . 
$_SESSION[
'session_langue']],
 
  337                     'drop_href' => 
get_current_url(
false) . 
'?mode=suppr&id=' . $ligne[
'id'],
 
  338                     'edit_href' => 
get_current_url(
false) . 
'?mode=modif&id=' . $ligne[
'id'],
 
  339                     'pays' => $ligne[
'pays_' . $_SESSION[
'session_langue']],
 
  340                     'flag' => getFlag($ligne[
'iso'], $ligne[
'pays_' . $_SESSION[
'session_langue']]),
 
  342                     'position' => $ligne[
'position'],
 
  343                     'etat_onclick' => 
'change_status("countries", "' . $ligne[
'id'] . 
'", this, "'.
$GLOBALS[
'administrer_url'] . 
'")',
 
  344                     'etat_src' => $GLOBALS[
'administrer_url'] . 
'/images/' . (empty($ligne[
'etat']) ? 
'puce-blanche.gif' : 
'puce-verte.gif'),
 
  349           $tpl->assign(
'results', $tpl_results);
 
  351      $GLOBALS[
'sortable_rpc'] = 
'rpc_positions.php?mode=countries';
 
  353      $tpl->assign(
'STR_ADMIN_WEBSITE', 
$GLOBALS[
'STR_ADMIN_WEBSITE']);
 
  354      $tpl->assign(
'STR_BEFORE_TWO_POINTS', 
$GLOBALS[
'STR_BEFORE_TWO_POINTS']);
 
  355      $tpl->assign(
'STR_ADMIN_PAYS_LIST_EXPLAIN', 
$GLOBALS[
'STR_ADMIN_PAYS_LIST_EXPLAIN']);
 
  356      $tpl->assign(
'STR_ADMIN_PAYS_TITLE', 
$GLOBALS[
'STR_ADMIN_PAYS_TITLE']);
 
  357      $tpl->assign(
'STR_ADMIN_PAYS_CREATE', 
$GLOBALS[
'STR_ADMIN_PAYS_CREATE']);
 
  358      $tpl->assign(
'STR_ADMIN_PAYS_ZONE_UPDATE_LABEL', 
$GLOBALS[
'STR_ADMIN_PAYS_ZONE_UPDATE_LABEL']);
 
  359      $tpl->assign(
'STR_ADMIN_ACTIVATE', 
$GLOBALS[
'STR_ADMIN_ACTIVATE']);
 
  360      $tpl->assign(
'STR_ADMIN_DEACTIVATE', 
$GLOBALS[
'STR_ADMIN_DEACTIVATE']);
 
  362      $tpl->assign(
'STR_ADMIN_ACTION', 
$GLOBALS[
'STR_ADMIN_ACTION']);
 
  364      $tpl->assign(
'STR_ADMIN_MENU_MANAGE_ZONES', 
$GLOBALS[
'STR_ADMIN_MENU_MANAGE_ZONES']);
 
  365      $tpl->assign(
'STR_ADMIN_POSITION', 
$GLOBALS[
'STR_ADMIN_POSITION']);
 
  367      $tpl->assign(
'STR_ADMIN_DELETE_WARNING', 
$GLOBALS[
'STR_ADMIN_DELETE_WARNING']);
 
  369      $tpl->assign(
'STR_ADMIN_PAYS_MODIFY', 
$GLOBALS[
'STR_ADMIN_PAYS_MODIFY']);
 
  370      $tpl->assign(
'STR_ADMIN_PAYS_NOTHING_FOUND', 
$GLOBALS[
'STR_ADMIN_PAYS_NOTHING_FOUND']);
 
  371      return $tpl->fetch();
 
get_site_name($site_ids, $skip_rights_check=false)
Retourne le nom d'un ou de plusieurs sites à partir de l'id. 
 
get_current_url($with_get=true, $get_short_url=false, $take_away_get_args_array=null)
get_current_url() 
 
upload($field_name, $rename_file=true, $file_kind=null, $image_max_width=null, $image_max_height=null, $path=null, $new_file_name_without_extension=null, $default_return_value=null)
Fonction d'upload de fichiers. 
 
affiche_formulaire_ajout_pays(&$frm)
FONCTIONS. 
 
get_site_id_select_options($selected_site_id=null, $selected_site_name=null, $display_first_option=null, $select_current_site_id_by_default=false)
Créer les options pour le select qui liste les noms de sites configurés en back office. 
 
static html_entity_decode_if_needed($string)
String::html_entity_decode_if_needed() 
 
insere_pays(&$frm)
Ajoute le pays dans la table pays. 
 
nohtml_real_escape_string($value, $allowed_tags=null)
Protège les données pour insertion dans MySQL ET supprime les tags HTML pour protéger de toute sorte ...
 
if(!empty($_GET['id'])) if(isset($_POST['form_name'], $_POST['form_subject'], $_POST['form_text'], $_POST['form_lang'])&&empty($_GET['id'])) if(empty($_GET['id'])) $tpl
 
affiche_liste_pays()
affiche_liste_pays() 
 
affiche_formulaire_modif_pays($id, &$frm)
Affiche le formulaire de modification pour le pays sélectionné 
 
necessite_priv($priv, $demo_allowed=true, $configuration_modification=false)
Cette fonction vérifie si l'utilisateur a les privilèges de $priv. 
 
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. 
 
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. 
 
maj_pays($id, $frm)
Met à jour le pays $id avec de nouvelles valeurs. 
 
necessite_identification()
Si l'utilisateur n'est pas connecté à un compte, on affiche une page d'identification et arrête le sc...
 
num_rows($query_result)
num_rows() 
 
fetch_assoc($query_result)
fetch_assoc() 
 
get_form_token_input($name= 'general', $use_existing_token=true, $return_as_input_form=true)
get_form_token_input() 
 
affiche_formulaire_pays(&$frm)
affiche_formulaire_pays() 
 
get_site_id_sql_set_value($site_ids)
Retourne la valeur SQL d'un champ INT ou SET suivant que ce soit un entier ou un tableau. 
 
supprime_pays($id)
Supprime le pays spécifié par $id. 
 
verify_token($name= 'general', $delay_in_minutes=60, $check_referer_if_set_by_server=true, $cancel_token=true, $minimum_wait_in_seconds_before_use=0)
Vérification de la validité d'un token Par défaut, un token est valide 1h, et utilisable 1 seule fois...
 
if(defined('IN_PEEL_ADMIN')||IN_INSTALLATION) $_SESSION['session_langue']