diff --git a/htdocs/don.class.php b/htdocs/don.class.php index 9702986c734..2aec0ea7883 100644 --- a/htdocs/don.class.php +++ b/htdocs/don.class.php @@ -38,6 +38,7 @@ class Don var $statut; var $projet; + var $errorstr; /* * Statut du don * 0 : promesse non validée @@ -50,6 +51,66 @@ class Don Function Don($DB, $soc_idp="") { $this->db = $DB ; + $this->modepaiement = 0; + } + /* + * + * + * + */ + Function print_error_list() + { + $num = sizeof($this->errorstr); + for ($i = 0 ; $i < $num ; $i++) + { + print "
  • " . $this->errorstr[$i]; + } + } + + Function check() + { + $err = 0; + if (strlen(trim($this->nom)) == 0) + { + $error_string[$err] = "Le nom saisi est invalide"; + $err++; + } + + if (strlen(trim($this->adresse)) == 0) + { + $error_string[$err] = "L'adresse saisie est invalide"; + $err++; + } + + if (strlen(trim($this->cp)) == 0) + { + $error_string[$err] = "Le code postal saisi est invalide"; + $err++; + } + + if (strlen(trim($this->ville)) == 0) + { + $error_string[$err] = "La ville saisie est invalide"; + $err++; + } + + if ($this->amount == 0) + { + $error_string[$err] = "Le montant du don est invalide"; + $err++; + } + + + if ($err) + { + $this->errorstr = $error_string; + return 0; + } + else + { + return 1; + } + } /* * @@ -62,6 +123,8 @@ class Don * Insertion dans la base */ + $this->date = $this->db->idate($this->date); + $sql = "INSERT INTO llx_don (datec, amount, fk_paiement, nom, adresse, cp, ville, pays, public, fk_don_projet, note, fk_user_author, datedon)"; $sql .= " VALUES (now(), $this->amount, $this->modepaiement,'$this->nom','$this->adresse', '$this->cp','$this->ville','$this->pays',$this->public, $this->projetid, '$this->note', $userid, '$this->date')"; @@ -84,8 +147,9 @@ class Don * */ Function delete($rowid) - { + { + $sql = "DELETE FROM llx_don WHERE rowid = $rowid AND fk_statut = 0;"; if ( $this->db->query( $sql) ) diff --git a/htdocs/public/dons/Makefile b/htdocs/public/dons/Makefile new file mode 100644 index 00000000000..a4de44f0c76 --- /dev/null +++ b/htdocs/public/dons/Makefile @@ -0,0 +1,59 @@ +# Authors: Loic Dachary and Jaime Villate +# +# XML/XSLT processor (validator) +# ------------------------- +# +# sablotron (sabcmd) +# apt-get install sablotron +# +# libxslt + libxml2 (xsltproc) +# http://www.xmlsoft.org/ +# +# XML validator +# ------------- +# apt-get install rxp +# or +# ftp://ftp.cogsci.ed.ac.uk/pub/richard/rxp-1.2.3.tar.gz +# +XSLTPROC = sabcmd + +XSLTOPTS = \ + '$$fsfeurope=$(FSFEUROPE)' \ + '$$fsf=$(FSF)' \ + '$$gnu=$(GNU)' + +ENPAGES = $(shell find * -regex '.*\.en\.xhtml' -print | sed "s/xhtml$$/html/") + +FRPAGES = $(shell find * -regex '.*\.fr\.xhtml' -print | sed "s/xhtml$$/html/") + + +RSYNC=/usr/bin/rsync +ROPT=-av +RSSH=-e ssh + +all: + $(XSLTPROC) eucd.xsl don.xhtml > don.php + $(XSLTPROC) eucd.xsl erreur.xhtml > erreur.php + $(XSLTPROC) eucd.xsl merci.xhtml > merci.php + + +$(ENPAGES) $(FRPAGES): %.html: %.xhtml fsfe-fr.xsl navigation.en.xsl navigation.fr.xsl + @echo "Building $@ ..."; \ + path=$< ; \ + base=`expr $$path : '\(.*\).xhtml'` ; \ + filebase=`basename $$base` ; \ + dir=`dirname $$path` ; \ + root=`dirname $$path | perl -pe 'chop; s:([^/]+):..:g if($$_ ne ".")'` ; \ + $(XSLTPROC) fsfe-fr.xsl $$path $(XSLTOPTS) \ + '$$fsffrance='$$root '$$filebase='$$filebase '$$path='$$path | \ + perl -MFile::Copy -p -e '$$| = 1; copy("'$$dir'/$$1", \*STDOUT) if(/\#include virtual=\"(.*?)\"/); s/\$$//g if(/\$$''Date:/);' \ + > $$base.html-temp && \ + ( cat $$base.html-temp | \ + perl -p -e '$$| = 1; s/\$$//g if(/\$$''Date:/); s/mode: xml \*\*\*/mode: html \*\*\*/' > $$base.html \ + ) ; \ + rm -f $$base.html-temp + +# remove html files for which an xhtml version exists (exclude fr/) +clean: + rm -f $(NEWS) $(ENPAGES) $(FRPAGES) + diff --git a/htdocs/public/dons/don.xhtml b/htdocs/public/dons/don.xhtml new file mode 100644 index 00000000000..87ba07a8e78 --- /dev/null +++ b/htdocs/public/dons/don.xhtml @@ -0,0 +1,87 @@ + + + + + + + +
    + +

    +

    Ce formulaire n'est pas encore actif, merci de ne pas l'utiliser

    +

    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    CP Ville + + +
    + Montant + + euros +
    + +
    +
    +
    + + + + diff --git a/htdocs/public/dons/erreur.xhtml b/htdocs/public/dons/erreur.xhtml new file mode 100644 index 00000000000..606b5558595 --- /dev/null +++ b/htdocs/public/dons/erreur.xhtml @@ -0,0 +1,94 @@ + + + + + + + +
    +

    +

    Erreur

    +

    + +

    + Nous avons détecté les erreurs suivantes : + +

      + +
    +

    + +

    + Pour corriger ces erreurs utilisez la touche 'Back' de votre navigateur. +

    + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    + +
    + + + + + + diff --git a/htdocs/public/dons/eucd-nav.fr.xsl b/htdocs/public/dons/eucd-nav.fr.xsl index 5a9a4e1b15e..2efe163b1a2 100644 --- a/htdocs/public/dons/eucd-nav.fr.xsl +++ b/htdocs/public/dons/eucd-nav.fr.xsl @@ -9,7 +9,7 @@ @@ -27,9 +27,15 @@ Qui


    + Dons
    + + - diff --git a/htdocs/public/dons/eucd.xsl b/htdocs/public/dons/eucd.xsl new file mode 100644 index 00000000000..6b76a7b0287 --- /dev/null +++ b/htdocs/public/dons/eucd.xsl @@ -0,0 +1,65 @@ + +]> + + + + + + http://france.fsfeurope.org + http://www.fsfeurope.org + http://www.fsf.org + http://www.gnu.org + nofile.html + nofile.html + + + + + + + + + + + + DO NOT MODIFY THIS DOCUMENT. IT WAS GENERATED BY XSLT PROCESSING + AND YOUR MODIFICATIONS WILL BE LOST. THE SOURCE OF THE DOCUMENT + IS IN THE .xhtml FILE USE make all TO REGENERATE + + + + + + + + + + + + + Dons FSF France - Fond de secours EUCD.INFO + + + + + + + + + + + + + + + diff --git a/htdocs/public/dons/index.php b/htdocs/public/dons/index.php new file mode 100644 index 00000000000..86bd54d045d --- /dev/null +++ b/htdocs/public/dons/index.php @@ -0,0 +1,64 @@ + + * + * 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. + * + * $Id$ + * $Source$ + * + */ + +require("../../don.class.php"); +require("../../lib/mysql.lib.php3"); +require("../../conf/conf.class.php3"); + +if ($HTTP_POST_VARS["action"] == 'add') +{ + + $conf = new Conf(); + $db = new Db(); + $don = new Don($db); + + $don->projetid = $HTTP_POST_VARS["projetid"]; + $don->date = time(); + $don->nom = $HTTP_POST_VARS["nom"]; + $don->adresse = $HTTP_POST_VARS["adresse"]; + $don->cp = $HTTP_POST_VARS["cp"]; + $don->ville = $HTTP_POST_VARS["ville"]; + $don->public = $HTTP_POST_VARS["public"]; + $don->email = $HTTP_POST_VARS["email"]; + $don->amount = $HTTP_POST_VARS["montant"]; + + + if ($don->check()) + { + $return = $don->create(0); + + require("merci.php"); + } + else + { + require("erreur.php"); + } + + +} +else +{ +require("don.php"); +} + + +?> diff --git a/htdocs/public/dons/merci.xhtml b/htdocs/public/dons/merci.xhtml index a37cfc5f5e1..d8a3f4ed216 100644 --- a/htdocs/public/dons/merci.xhtml +++ b/htdocs/public/dons/merci.xhtml @@ -58,19 +58,14 @@ - - - + +
    - Dons FSF France + EUCD.INFO - Au secours de la copie privée
    +
    - Commentaire - - -