dolibarr/htdocs/public/dons/index.php

117 lines
2.7 KiB
PHP
Raw Normal View History

2004-10-20 22:06:49 +02:00
<?php
2002-12-20 19:07:49 +01:00
/* Copyright (C) 2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* 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");
2003-09-11 22:18:51 +02:00
require("../../conf/conf.class.php");
2002-12-20 19:07:49 +01:00
2002-12-21 18:35:17 +01:00
$conf = new Conf();
conf->db->type = $dolibarr_main_db_type;
// Si type non d<>fini (pour compatibilit<69> avec ancienne install), on
// travail avec mysql
if (! $conf->db->type) { $conf->db->type = 'mysql'; }
require("../../lib/.$dolibarr_main_db_type.lib.php");
2002-12-21 18:35:17 +01:00
if ($conf->don->enabled)
2002-12-20 19:07:49 +01:00
{
2003-09-12 14:46:45 +02:00
$db = new DoliDb();
2002-12-22 16:11:07 +01:00
$don = new Don($db);
$don->projetid = $_POST["projetid"];
2002-12-22 16:11:07 +01:00
$don->date = time();
$don->prenom = $_POST["prenom"];
$don->nom = $_POST["nom"];
$don->societe = $_POST["societe"];
$don->adresse = $_POST["adresse"];
$don->cp = $_POST["cp"];
$don->ville = $_POST["ville"];
$don->pays = $_POST["pays"];
2002-12-28 16:18:27 +01:00
$don->public = 1;
if ($_POST["public"] == "FALSE")
2002-12-28 16:18:27 +01:00
{
$don->public = 0;
}
$don->email = $_POST["email"];
$don->amount = $_POST["montant"];
$don->commentaire = $_POST["commentaire"];
2002-12-22 16:11:07 +01:00
if ($_POST["action"] == 'add')
2002-12-20 19:07:49 +01:00
{
2002-12-21 18:35:17 +01:00
2002-12-22 19:46:40 +01:00
if ($don->check($conf->don->minimum))
2002-12-21 18:35:17 +01:00
{
require("valid.php");
}
else
{
require("erreur.php");
}
2002-12-20 19:07:49 +01:00
}
elseif ($_POST["action"] == 'valid' && $_POST["valid"] == 'Valider')
2002-12-20 19:07:49 +01:00
{
2002-12-21 18:35:17 +01:00
2002-12-22 19:46:40 +01:00
if ($don->check($conf->don->minimum))
2002-12-21 18:35:17 +01:00
{
2002-12-28 02:25:51 +01:00
$ref_commande = $don->create(0);
2002-12-21 18:35:17 +01:00
2002-12-28 02:25:51 +01:00
if ($ref_commande)
2002-12-21 18:35:17 +01:00
{
$a = setlocale(LC_TIME, "fr_FR");
2002-12-23 23:36:23 +01:00
$date_limite = strftime("%A %d %B %Y",time() + (3 * 7 * 24 * 3600));
include ("mail.php");
2002-12-28 02:25:51 +01:00
include ("mail_moderator.php");
2002-12-23 23:55:09 +01:00
mail($don->email, $subject, $body, "From: contact@eucd.info");
2002-12-23 23:36:23 +01:00
2002-12-28 02:25:51 +01:00
mail($conf->don->email_moderator, $subject_moderator, $body_moderator);
2002-12-21 18:35:17 +01:00
require("merci.php");
}
2002-12-28 02:25:51 +01:00
else
{
print "Erreur : can't insert value in db";
}
2002-12-21 18:35:17 +01:00
}
else
2002-12-21 16:12:27 +01:00
{
2002-12-21 18:35:17 +01:00
require("erreur.php");
2002-12-21 16:12:27 +01:00
}
}
else
{
2002-12-21 18:35:17 +01:00
require("don.php");
2002-12-21 16:12:27 +01:00
}
2002-12-20 19:07:49 +01:00
}
else
{
2002-12-21 18:35:17 +01:00
print "Cette fonctionnalit<69> n'est pas activ<69> sur ce site";
2002-12-20 19:07:49 +01:00
}
?>