function edition() { $id = intval(lireParam('pays', 'int')); $maj = $id > 0; $pays = new Pays(); if ($maj) { $pays->charger($id); } else { $pays->lang = 0; $pays->defaut = 0; } $pays->tva = intval($_REQUEST['tva']) != 0 ? 1 : 0; $pays->zone = intval($_REQUEST['zone']); $pays->isocode = intval($_REQUEST['isocode']); $pays->isoalpha2 = $_REQUEST['isoalpha2']; $pays->isoalpha3 = $_REQUEST['isoalpha3']; if ($maj) { $pays->maj(); } else { $id = $pays->add(); } if ($id > 0) { foreach ($_REQUEST['langue'] as $langue) { $paysdesc = new Paysdesc(); if ($maj) { $paysdesc->charger($id, $langue); } $paysdesc->pays = $id; $paysdesc->lang = $langue; $paysdesc->titre = $_REQUEST['titre'][$langue]; $paysdesc->chapo = $_REQUEST['chapo'][$langue]; $paysdesc->description = $_REQUEST['description'][$langue]; if ($maj) { $paysdesc->maj(); } else { $paysdesc->add(); } } } }
/* */ /*************************************************************************************/ require_once __DIR__ . "/../pre.php"; require_once __DIR__ . "/../auth.php"; require_once __DIR__ . "/../../fonctions/divers.php"; if (!est_autorise("configuration")) { exit; } header('Content-Type: text/html; charset=utf-8'); $action = lireParam('action', 'string'); if ($action == 'tva') { $pays = new Pays(); $id = intval(lireParam('pays', 'int')); if ($pays->charger($id)) { $pays->tva = intval($_REQUEST['tva']); $pays->maj(); } exit; } else { if ($action == 'defaut') { $pays = new Pays(); $id = intval(lireParam('pays', 'int')); $pays->query("update {$pays->table} set `defaut`=0"); $pays->query("update {$pays->table} set `defaut`=1 where id={$id}"); exit; } else { if ($action == 'boutique') { $pays = new Pays(); $id = intval(lireParam('pays', 'int')); $pays->query("update {$pays->table} set `boutique`=0"); $pays->query("update {$pays->table} set `boutique`=1 where id={$id}");