Initial commit

This commit is contained in:
2020-01-27 08:56:08 +01:00
commit b7525048d6
27129 changed files with 3409855 additions and 0 deletions

View File

@@ -0,0 +1,185 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) Octolys Development */
/* email : thelia@octolys.fr */
/* web : http://www.octolys.fr */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License, or */
/* (at your option) any later version. */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program; if not, write to the Free Software */
/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* */
/*************************************************************************************/
?>
<?php
include_once(realpath(dirname(__FILE__)) . "/../../../classes/PluginsClassiques.class.php");
include_once(realpath(dirname(__FILE__)) . "/../../../classes/Client.class.php");
class Comparateur extends PluginsClassiques{
var $id;
var $client;
var $comparateur;
var $date;
var $table="sauvcomp";
var $bddvars = array("id", "client", "comparateur", "date");
function Comparateur(){
$this->PluginsClassiques();
}
function init(){
$cnx = new Cnx();
$query_sauvcomp = "CREATE TABLE `sauvcomp` (
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`client` INT NOT NULL ,
`comparateur` TEXT NOT NULL,
`date` datetime NOT NULL default '0000-00-00 00:00:00'
) ;";
$resul_sauvcomp = mysql_query($query_sauvcomp, $cnx->link);
}
function charger($client){
return $this->getVars("select * from $this->table where client=\"$client\"");
}
function demarrage(){
if($_REQUEST['action'] == "connexion") {
$client = new Client();
if($client->charger($_REQUEST['email'], $_REQUEST['motdepasse'])){
$recsauv = new Comparateur();
if(! $recsauv->charger($client->id)){
$recsauv->client = $client->id;
$recsauv->comparateur = addslashes(serialize($_SESSION['navig']->comparateur));
$recsauv->date = date("Y-m-d H:i:s");
$recsauv->add();
return;
}
if(! $_SESSION['navig']->comparateur->nbart){
$_SESSION['navig']->comparateur = new Panier();
$_SESSION['navig']->comparateur = unserialize(stripcslashes($recsauv->comparateur));
}
else {
$recsauv->comparateur = addslashes(serialize($_SESSION['navig']->comparateur));
$this->date = date("Y-m-d H:i:s");
$recsauv->maj();
}
}
}
}
function pre(){
include_once(realpath(dirname(__FILE__)) . "/config.php");
if(! isset($_SESSION['navig']->comparateur))
$_SESSION['navig']->comparateur = new Comparateur_panier();
if(isset($_REQUEST['action']) && $_REQUEST['action'] == "ajouter_comparateur" && isset($_REQUEST['ref']) && $_SESSION['navig']->comparateur->nbart<$max)
$_SESSION['navig']->comparateur->ajouter($_REQUEST['ref']);
else if(isset($_REQUEST['action']) && $_REQUEST['action'] == "ajouter_comparateur" && isset($_REQUEST['ref']) && $_SESSION['navig']->comparateur->nbart>=$max){
?>
<script type="text/javascript">
alert("Votre comparateur est plein");
</script>
<?php
}
else if(isset($_REQUEST['action']) && $_REQUEST['action'] == "supprimer_comparateur" && isset($_REQUEST['article']))
{
$_SESSION['navig']->comparateur->supprimer($_REQUEST['article']);
}
}
function post(){
if(($_REQUEST['action'] == "ajouter_comparateur" || $_REQUEST['action'] == "supprimer_comparateur") && $_SESSION['navig']->client->id){
$tempsauv = new Comparateur();
if($tempsauv->charger($_SESSION['navig']->client->id)){
$this->charger($_SESSION['navig']->client->id);
$this->comparateur = addslashes(serialize($_SESSION['navig']->comparateur));
$this->date = date("Y-m-d H:i:s");
$this->maj();
}
else {
$this->client = $_SESSION['navig']->client->id;
$this->comparateur = addslashes(serialize($_SESSION['navig']->comparateur));
$this->date = date("Y-m-d H:i:s");
$this->add();
}
}
if($_REQUEST['action'] == "sauver_comparateur" && ! $_SESSION['navig']->client->id){
?>
<script type="text/javascript">
alert("Vous devez vous identifier afin de pouvoir sauvegarder votre comparateur");
location = "?fond=connexion";
</script>
<?php
}
}
function action(){
global $res;
$res = str_replace("#COMPARATEUR_NBART", $_SESSION['navig']->comparateur->nbart, $res);
}
function boucle($texte, $args){
$dernier = lireTag($args, "dernier");
if(!$deb) $deb=0;
if($dernier == 1)
$deb = $_SESSION['navig']->comparateur->nbart - 1;
$res="";
if(! $_SESSION['navig']->comparateur->nbart) return;
for($i=$deb; $i<$_SESSION['navig']->comparateur->nbart; $i++){
$temp = str_replace("#REF", $_SESSION['navig']->comparateur->tabarticle[$i], $texte);
$temp = str_replace("#ARTICLE", $i, $temp);
$res .= $temp;
}
return $res;
}
function destroy(){
}
}
?>

View File

@@ -0,0 +1,77 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) Octolys Development */
/* email : thelia@octolys.fr */
/* web : http://www.octolys.fr */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License, or */
/* (at your option) any later version. */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program; if not, write to the Free Software */
/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* */
/*************************************************************************************/
?>
<?php
// Déninition du panier
class Comparateur_panier {
var $nbart;
var $tabarticle;
function Comparateur_panier(){
$this->nbart = 0;
$this->tabarticle=array();
}
function ajouter($ref){
$existe = 0;
for($i=0; $i<$this->nbart; $i++)
if(isset($this->tabarticle[$i]) && $this->tabarticle[$i] == "$ref")
$existe = 1;
if(!$existe){
$this->tabarticle[$this->nbart] = $ref;
$this->nbart++;
}
}
function supprimer($id){
if(! $this->tabarticle[$id]) return;
$this->tabarticle[$id]="";
for($i=$id+1; $i<$this->nbart; $i++)
if(isset($this->tabarticle[$i]))
$this->tabarticle[$i-1] = $this->tabarticle[$i];
unset($this->tabarticle[$this->nbart-1]);
$this->nbart--;
}
function nbart(){
return $this->nbart;
}
}
?>

View File

@@ -0,0 +1,68 @@
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) Octolys Development */
/* email : thelia@octolys.fr */
/* web : http://www.octolys.fr */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License, or */
/* (at your option) any later version. */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program; if not, write to the Free Software */
/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* */
/*************************************************************************************/
Ce plugin permet de gérer un comparateur de produit (fonctionnement similaire au panier)
Pour ajouter un produit au comparateur : page.php?action=ajouter_comparateur&ref=REF_DU_PROD
Pour supprimer un produit du comparateur : page.php?action=supprimer_comparateur&article=INDEX_DANS_LE_COMPARATEUR
Substitution :
#COMPARATEUR_NBART : nombre de produits dans le comparateur
Boucle Comparateur :
sortie
#ARTICLE : index du produit dans le comparateur
#REF : référence du produit dans le comparateur
config.php vous permet de configurer le nombre de produit max dans le comparateur
Veuillez simplement glisser le répertoire comparateur dans le dossier client/plugins de votre Thelia.
Exemple d'utilisation sur la page produit:
Nb produit dans le comparateur : #COMPARATEUR_NBART
<THELIA_comparateur type="COMPARATEUR" >
#ARTICLE #REF <a href="#VARIABLE(urlsite)/?fond=produit&id_produit=#PRODUIT_ID&id_rubrique=#PRODUIT_RUBRIQUE&action=supprimer_comparateur&article=#ARTICLE">enlever</a><br/>
</THELIA_comparateur>
<a href="#VARIABLE(urlsite)/?fond=produit&id_produit=#ID&id_rubrique=#RUBRIQUE&action=ajouter_comparateur&ref=#REF">ajouter</a>
<THELIA SI CONNECTE>
<a href="#VARIABLE(urlsite)/?fond=produit&id_produit=#ID&id_rubrique=#RUBRIQUE&action=sauver_comparateur&ref=#REF">sauver_comparateur</a>
</THELIA SI CONNECTE>
<THELIA SI NON CONNECTE>
Connectez-vous pour pouvoir sauver votre comparateur
</THELIA SI NON CONNECTE>
Auteur du plugin : Yoan De Macedo
yoandm@gmail.com

View File

@@ -0,0 +1,29 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) Octolys Development */
/* email : thelia@octolys.fr */
/* web : http://www.octolys.fr */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License, or */
/* (at your option) any later version. */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program; if not, write to the Free Software */
/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* */
/*************************************************************************************/
?>
<?php
$max = 5; // nombre de produits maximum dans le comparateur
// 0 : illimité
?>

View File

@@ -0,0 +1,28 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) Octolys Development */
/* email : thelia@octolys.fr */
/* web : http://www.octolys.fr */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License, or */
/* (at your option) any later version. */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program; if not, write to the Free Software */
/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* */
/*************************************************************************************/
?>
<?php
include_once(realpath(dirname(__FILE__)) . "/Comparateur_panier.class.php");
?>

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--Migration automatique depuis le fichier original, sauvegardé dans plugin.xml.save-->
<plugin>
<descriptif lang="fr">
<titre>Comparateur de produits</titre>
<chapo></chapo>
<description>Ce plugin permet de gérer un comparateur de produit (fonctionnement similaire au panier)</description>
<postscriptum></postscriptum>
</descriptif>
<version>1.1</version>
<auteur>
<nom>Yoan De Macedo - yoandm@gmail.com</nom>
<societe></societe>
<email></email>
<web></web>
</auteur>
<type>classique</type>
<prerequis/>
<thelia>1.5.0</thelia>
<etat>production</etat>
<documentation>Readme.txt</documentation>
<urlmiseajour></urlmiseajour>
</plugin>