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/Variable.class.php");
class Commentaires extends PluginsClassiques{
var $id;
var $commentateur;
var $ville;
var $pays;
var $message;
var $ref;
var $titre;
var $date;
var $note;
var $ip;
var $valide;
var $table="commentaires";
var $bddvars = array("id", "commentateur", "ville", "pays", "message", "ref", "titre", "date", "note", "ip", "valide");
function Commentaires(){
$this->PluginsClassiques();
}
function charger($id, $lang=1){
return $this->getVars("select * from $this->table where id=\"$id\"");
}
function init(){
$cnx = new Cnx();
$query_commentaires = "CREATE TABLE `commentaires` (
`id` int(11) NOT NULL auto_increment,
`commentateur` text NOT NULL,
`ville` text NOT NULL,
`pays` text NOT NULL,
`message` text NOT NULL,
`ref` text NOT NULL,
`date` datetime NOT NULL,
`titre` text NOT NULL,
`note` int(1) NOT NULL,
`ip` varchar(15) NOT NULL default '000.000.000.000',
`valide` char(1) NOT NULL default '0',
PRIMARY KEY (`id`)
) AUTO_INCREMENT=1 ;";
$resul_commentaires = mysql_query($query_commentaires, $cnx->link);
}
function destroy(){
}
function boucle($texte, $args){
// récupération des arguments
$ref= lireTag($args, "ref");
$deb= lireTag($args, "deb", "int");
$num= lireTag($args, "num", "int");
$classement = lireTag($args, "classement");
if(!$deb) $deb = 0;
if($num>0)
$limit = "LIMIT $deb, $num";
else
$limit = "";
switch($classement)
{
case 'croissant':
$order = "ORDER BY date ASC";
break;
case 'decroissant':
$order = "ORDER BY date DESC";
break;
default:
$order = "ORDER BY date ASC";
break;
}
$search ="";
$res="";
// préparation de la requête
if($ref!="") $search.=" and ref=\"$ref\" and valide=\"1\"";
$commentaire = new Commentaires();
$query_commentaires = "select * from $commentaire->table where 1 $search $order $limit";
$resul_commentaires = mysql_query($query_commentaires, $commentaire->link);
$nbres = mysql_numrows($resul_commentaires);
if(!$nbres) return "";
while($row = mysql_fetch_object($resul_commentaires)){
$temp = str_replace("#COMMENTATEUR", $row->commentateur, $texte);
$temp = str_replace("#VILLE", $row->ville, $temp);
$temp = str_replace("#PAYS", $row->pays, $temp);
$temp = str_replace("#MESSAGE", $row->message, $temp);
$temp = str_replace("#DATE", substr($row->date, 0, 10), $temp);
$temp = str_replace("#HEURE", substr($row->date, 11), $temp);
$temp = str_replace("#TITRE", $row->titre, $temp);
$temp = str_replace("#NOTE", $row->note, $temp);
$temp = str_replace("#VALIDE", $row->valide, $temp);
$res .= $temp;
}
return $res;
}
function action($res){
if(isset($_POST['action']) && $_POST['action'] == "ajcommentaire"){
$commentaire = new Commentaires();
$commentaire->commentateur = strip_tags($_POST['commentaire_nom']);
$commentaire->ville = strip_tags($_POST['commentaire_ville']);
$commentaire->pays = strip_tags($_POST['commentaire_pays']);
$commentaire->message = strip_tags($_POST['commentaire_message']);
$commentaire->ref = strip_tags($_POST['commentaire_ref']);
$commentaire->titre = strip_tags($_POST["commentaire_titre"]);
$commentaire->date = date("Y-m-d H:i:s");
$commentaire->note = strip_tags($_POST["note"]);
$commentaire->ip = strip_tags($_SERVER['REMOTE_ADDR']);
$commentaire->valide = 0;
$commentaire->add();
$emailcontact = new Variable();
$emailcontact->charger("emailcontact");
$nomsite = new Variable();
$nomsite->charger("nomsite");
$mail = new Mail();
$mail->IsMail();
$mail->FromName = $nomsite->valeur;
$mail->From = $emailcontact->valeur;
$mail->Subject = "nouveau commentaire pour le produit : ".$commentaire->ref;
$mail->MsgHTML($commentaire->commentateur." : ".$commentaire->message);
$mail->AltBody = $commentaire->commentateur." : ".$commentaire->message;
$mail->AddAddress($emailcontact->valeur,$nomsite->valeur);
$mail->send();
$cache = new Cache();
$cache->vider("COMMENTAIRES", "%");
}
}
}
?>

View File

@@ -0,0 +1,43 @@
Ce plugin permet de gérer des commentaires sur les produits.
Veuillez simplement glisser le répertoire commentaires dans le dossier client/plugins/ de votre Thelia.
Vous pouvez aussi utiliser l'assistant d'import de plugins dans Configuration/Gestion des plugins.
Activez-le ensuite dans le menu Configuration/Gestion des plugins dans votre interface d'administration
Exemple de formulaire d'ajout :
<form action="#" method="post">
<input type="hidden" name="action" value="ajcommentaire" />
<input type="hidden" name="commentaire_ref" value="#PRODUIT_REF" />
<input type="hidden" name="ref" value="#PRODUIT_REF" />
Nom : <input type="text" name="commentaire_nom" /><br />
Message : <input type="text" name="commentaire_message" /><br />
<input type="submit" value="OK" />
</form>
Param entrée
ref : référence du produit
deb : debut
num : nombre de résultat
classement : croissant | decroissant
Param sortie
#NOM : nom de la personne qui a posté un commentaire
#MESSAGE : contenu du commentaire
#DATE : date du commentaire
#HEURE : heure du commentaire
Exemple d'une boucle d'affichage
<THELIA_comment type="COMMENTAIRES" ref="#PRODUIT_REF">
Message de #NOM : #MESSAGE <br />
#HEURE #DATE
</THELIA_comment>
Auteur : Yoan De Macedo
yoandm@gmail.com
V 1.1 : Etienne Roudeix
etienne.roudeix@gmail.com

View File

@@ -0,0 +1,6 @@
21 juin 2012 | etienne.roudeix@gmail.com
########################################
Ajout des paramètres d'entrée pour la boucle :
deb : debut
num : nombre de résultat
classement : croissant | decroissant

View File

@@ -0,0 +1,109 @@
<?php
include_once(realpath(dirname(__FILE__)) . "/../../../fonctions/authplugins.php");
autorisation("commentaires");
include_once(realpath(dirname(__FILE__)) . "/Commentaires.class.php");
$commentaires = new Commentaires();
?>
<div id="contenu_int">
<p align="left"><a href="accueil.php" class="lien04">Accueil </a> <img src="gfx/suivant.gif" width="12" height="9" border="0" /><a href="module_liste.php" class="lien04">Modules</a> <img src="gfx/suivant.gif" width="12" height="9" border="0" /><a href="#" class="lien04">Gestion des commentaires</a>
</p>
<!-- bloc gestion des commentaires / colonne gauche -->
<?php
if(isset($action) && $action == "supprimer"){
$commentaires->charger($id);
$commentaires->delete();
$cache = new Cache();
$cache->vider("COMMENTAIRES", "%");
}
/*
if(isset($action) && $action == "valider"){
$commentaires->charger($id);
$commentaires->update();
$cache = new Cache();
$cache->vider("COMMENTAIRES", "%");
}
*/
if(isset($action) && $action == "visualiser"){
$commentaires->charger($id);
?>
<div class="entete_liste">
<div class="titre">DETAIL DU COMMENTAIRE</div>
<div class="fonction_valider"><a href="<?php echo $_SERVER['PHP_SELF'] ?>?nom=commentaires">RETOUR</a></div>
</div>
<ul class="ligne_fonce_BlocDescription">
<li style="width:130px">Date</li>
<li style="border-left:1px solid #C4CACE;"><?php echo($commentaires->date); ?></li>
</ul>
<ul class="ligne_claire_BlocDescription">
<li style="width:130px">Produit</li>
<li style="border-left:1px solid #C4CACE;"><a href="produit_modifier.php?ref=<?php echo $commentaires->ref; ?>" class="lien04"><?php echo $commentaires->ref; ?></a></li>
</ul>
<ul class="ligne_fonce_BlocDescription">
<li style="width:130px">Nom</li>
<li style="border-left:1px solid #C4CACE;"><?php echo($commentaires->commentateur); ?></li>
</ul>
<ul class="ligne_fonce_BlocDescription">
<li style="width:130px">Ville</li>
<li style="border-left:1px solid #C4CACE;"><?php echo($commentaires->ville); ?></li>
</ul>
<ul class="ligne_claire_BlocDescription">
<li style="width:130px">Titre</li>
<li style="border-left:1px solid #C4CACE;"><?php echo($commentaires->titre); ?></li>
</ul>
<ul class="ligne_claire_BlocDescription">
<li style="width:130px">Message</li>
<li style="border-left:1px solid #C4CACE;"><?php echo($commentaires->message); ?></li>
</ul>
<?php
} else if(! isset($action) || $action == "" || $action == "valider" || $action == "supprimer"){
?>
<div class="entete_liste">
<div class="titre">LISTES DES COMMENTAIRES</div>
</div>
<div class="bordure_bottom">
<ul class="Nav_bloc_description">
<li style="height:25px; width:130px; border-left:1px solid #96A8B5;">Date</li>
<li style="height:25px; width:150px; border-left:1px solid #96A8B5;">R&eacute;f&eacute;rence produit</li>
<li style="height:25px; width:130px; border-left:1px solid #96A8B5;">Nom</li>
<li style="height:25px; width:130px; border-left:1px solid #96A8B5;">Ville</li>
<li style="height:25px; width:72px; border-left:1px solid #96A8B5;">Editer</li>
<li style="height:25px; width:50px; border-left:1px solid #96A8B5;">Supprimer</li>
</ul>
<?php
$commentaires = new Commentaires();
$query_commentaires = "select * from $commentaires->table order by date desc";
$resul_commentaires = mysql_query($query_commentaires, $commentaires->link);
$i = 0;
while($row = mysql_fetch_object($resul_commentaires)){
if(!($i%2)) $fond="ligne_claire_rub";
else $fond="ligne_fonce_rub";
$i++;
?>
<ul class="<?php echo($fond); ?>">
<li style="width:130px;"><?php echo $row->date; ?></li>
<li style="width:150px;"><a href="produit_modifier.php?ref=<?php echo $row->ref; ?>" class="lien04"><?php echo $row->ref; ?></a></li>
<li style="width:130px;"><?php echo $row->commentateur; ?></li>
<li style="width:130px;"><?php echo $row->ville; ?></li>
<li style="width:72px;"><a href="<?php echo $_SERVER['PHP_SELF'] ?>?nom=commentaires&action=visualiser&id=<?php echo $row->id; ?>">&eacute;diter </a></li>
<li style="width:50px; text-align:center"><a href="<?php echo $_SERVER['PHP_SELF'] ?>?nom=commentaires&action=supprimer&id=<?php echo $row->id; ?>"><img src="gfx/supprimer.gif" width="9" height="9" border="0" /></a></li>
</ul>
<?php
}
}
?>
</div>
</div>

Binary file not shown.

After

Width:  |  Height:  |  Size: 214 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 352 B

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>Commenter une fiche produit</titre>
<chapo></chapo>
<description>Ce plugin permet de gérer des commentaires sur les produits.</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>