57 lines
1.5 KiB
PHP
57 lines
1.5 KiB
PHP
<?php
|
|
include_once(realpath(dirname(__FILE__)) . "/../../../classes/PluginsClassiques.class.php");
|
|
include_once(realpath(dirname(__FILE__)) . "/../../../classes/Modules.class.php");
|
|
|
|
class Cgv extends PluginsClassiques{
|
|
|
|
var $cgv;
|
|
var $type_paiement;
|
|
|
|
function Cgv(){
|
|
$this->PluginsClassiques();
|
|
}
|
|
|
|
function demmarrage(){
|
|
if(!isset($_SESSION["cgv"])){
|
|
$_SESSION["cgv"] = new Cgv();
|
|
}
|
|
}
|
|
|
|
function avantcommande(){
|
|
$_SESSION["cgv"] = new Cgv();
|
|
if(!isset($_POST["cgv"])){
|
|
redirige("?fond=commande&errpay=1");
|
|
}
|
|
|
|
$cgv = strip_tags($_POST["cgv"]);
|
|
$module = new Modules();
|
|
$module->charger_id(intval(strip_tags($_POST["type_paiement"])));
|
|
if(!$cgv || !$module->actif){
|
|
if($cgv) $_SESSION["cgv"]->cgv = 1;
|
|
else $_SESSION["cgv"]->cgv = 0;
|
|
|
|
if($module->actif) $_SESSION["cgv"]->type_paiement = 1;
|
|
else $_SESSION["cgv"]->type_paiement = 0;
|
|
redirige("?fond=commande&errpay=1");
|
|
}
|
|
}
|
|
|
|
function action(){
|
|
global $res;
|
|
|
|
if(isset($_GET["errpay"]) && $_GET["errpay"] == 1){
|
|
if(!$_SESSION['cgv']->cgv) $res = preg_replace("/\#CGV\[([^]]*)\]/", "\\1", $res);
|
|
else $res = preg_replace("/\#CGV\[[^]]*\]/", "", $res);
|
|
|
|
if(!$_SESSION['cgv']->type_paiement) $res = preg_replace("/\#TYPE_PAIEMENT\[([^]]*)\]/", "\\1", $res);
|
|
else $res = preg_replace("/\#TYPE_PAIEMENT\[[^]]*\]/", "", $res);
|
|
|
|
}
|
|
else{
|
|
$res = preg_replace("/\#CGV\[[^]]*\]/", "", $res);
|
|
$res = preg_replace("/\#TYPE_PAIEMENT\[[^]]*\]/", "", $res);
|
|
}
|
|
}
|
|
|
|
}
|
|
?>
|