Line 17... |
Line 17... |
17 |
// | |
|
17 |
// | |
|
18 |
// | You should have received a copy of the GNU Lesser General Public |
|
18 |
// | You should have received a copy of the GNU Lesser General Public |
|
19 |
// | License along with this library; if not, write to the Free Software |
|
19 |
// | License along with this library; if not, write to the Free Software |
|
20 |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
20 |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
21 |
// +------------------------------------------------------------------------------------------------------+
|
21 |
// +------------------------------------------------------------------------------------------------------+
|
22 |
// CVS : $Id: bazar.fonct.php,v 1.52 2006-07-25 13:05:00 alexandre_tb Exp $
|
22 |
// CVS : $Id: bazar.fonct.php,v 1.53 2006-07-25 13:24:44 florian Exp $
|
23 |
/**
|
23 |
/**
|
24 |
*
|
24 |
*
|
25 |
* Fonctions du module bazar
|
25 |
* Fonctions du module bazar
|
26 |
*
|
26 |
*
|
27 |
*
|
27 |
*
|
Line 29... |
Line 29... |
29 |
//Auteur original :
|
29 |
//Auteur original :
|
30 |
*@author Alexandre Granier <alexandre@tela-botanica.org>
|
30 |
*@author Alexandre Granier <alexandre@tela-botanica.org>
|
31 |
*@author Florian Schmitt <florian@ecole-et-nature.org>
|
31 |
*@author Florian Schmitt <florian@ecole-et-nature.org>
|
32 |
//Autres auteurs :
|
32 |
//Autres auteurs :
|
33 |
*@copyright Tela-Botanica 2000-2004
|
33 |
*@copyright Tela-Botanica 2000-2004
|
34 |
*@version $Revision: 1.52 $ $Date: 2006-07-25 13:05:00 $
|
34 |
*@version $Revision: 1.53 $ $Date: 2006-07-25 13:24:44 $
|
35 |
// +------------------------------------------------------------------------------------------------------+
|
35 |
// +------------------------------------------------------------------------------------------------------+
|
36 |
*/
|
36 |
*/
|
Line 37... |
Line 37... |
37 |
|
37 |
|
38 |
// +------------------------------------------------------------------------------------------------------+
|
38 |
// +------------------------------------------------------------------------------------------------------+
|
Line 699... |
Line 699... |
699 |
}
|
699 |
}
|
700 |
}
|
700 |
}
|
701 |
//cas des images
|
701 |
//cas des images
|
702 |
elseif ($tableau[$i]['type']=='image') {
|
702 |
elseif ($tableau[$i]['type']=='image') {
|
703 |
if (isset($_FILES['image']['name']) && $_FILES['image']['name']!='') {
|
703 |
if (isset($_FILES['image']['name']) && $_FILES['image']['name']!='') {
|
704 |
baz_insertion_image($GLOBALS['_BAZAR_']['id_fiche']);
|
704 |
$requete .= baz_insertion_image($GLOBALS['_BAZAR_']['id_fiche']);
|
705 |
}
|
705 |
}
|
706 |
}
|
706 |
}
|
707 |
//cas des dates
|
707 |
//cas des dates
|
708 |
elseif ( $tableau[$i]['type']=='listedatedeb' || $tableau[$i]['type']=='listedatefin' ) {
|
708 |
elseif ( $tableau[$i]['type']=='listedatedeb' || $tableau[$i]['type']=='listedatefin' ) {
|
709 |
$val=$valeur[$tableau[$i]['nom_bdd']]['Y'].'-'.$valeur[$tableau[$i]['nom_bdd']]['m'].'-'.$valeur[$tableau[$i]['nom_bdd']]['d'] ;
|
709 |
$val=$valeur[$tableau[$i]['nom_bdd']]['Y'].'-'.$valeur[$tableau[$i]['nom_bdd']]['m'].'-'.$valeur[$tableau[$i]['nom_bdd']]['d'] ;
|
Line 824... |
Line 824... |
824 |
|
824 |
|
825 |
|
825 |
|
826 |
/** baz_insertion_image() - inserer une image a une fiche
|
826 |
/** baz_insertion_image() - inserer une image a une fiche
|
827 |
*
|
827 |
*
|
828 |
* @global integer L'identifiant de la fiche
|
828 |
* @global integer L'identifiant de la fiche
|
829 |
* @return void
|
829 |
* @return string requete SQL
|
830 |
*/
|
830 |
*/
|
831 |
function baz_insertion_image($idfiche) {
|
831 |
function baz_insertion_image($idfiche) {
|
832 |
//verification de la presence de ce fichier
|
832 |
//verification de la presence de ce fichier
|
833 |
$requete = 'SELECT bf_id_fiche FROM bazar_fiche WHERE bf_url_image="'.$_FILES['image']['name'].'"';
|
833 |
$requete = 'SELECT bf_id_fiche FROM bazar_fiche WHERE bf_url_image="'.$_FILES['image']['name'].'" AND bf_id_fiche!='.$idfiche;
|
834 |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
|
834 |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
|
835 |
if (DB::isError($resultat)) {
|
835 |
if (DB::isError($resultat)) {
|
836 |
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
|
836 |
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
|
837 |
}
|
837 |
}
|
838 |
if ($resultat->numRows()==0) {
|
838 |
if ($resultat->numRows()==0) {
|
839 |
$chemin_destination=BAZ_CHEMIN_APPLI.'upload/'.$_FILES['image']['name'];
|
839 |
$chemin_destination=BAZ_CHEMIN_APPLI.'upload/'.$_FILES['image']['name'];
|
840 |
move_uploaded_file($_FILES['image']['tmp_name'], $chemin_destination);
|
- |
|
841 |
}
|
- |
|
842 |
//verification de l'existence de la fiche
|
- |
|
843 |
$requete = 'SELECT bf_id_fiche FROM bazar_fiche WHERE bf_id_fiche='.$idfiche;
|
- |
|
844 |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
|
- |
|
845 |
if (DB::isError($resultat)) {
|
- |
|
846 |
echo ($resultat->getMessage().$resultat->getDebugInfo()) ;
|
- |
|
847 |
}
|
- |
|
848 |
if ($resultat->numRows()==0) {
|
- |
|
849 |
//creation d'une fiche temporaire avec l'image
|
- |
|
850 |
$requete = 'INSERT INTO bazar_fiche SET bf_id_fiche='.$idfiche.', bf_ce_nature='.$GLOBALS['_BAZAR_']['id_typeannonce'].', bf_ce_utilisateur='.$GLOBALS['id_user'].', bf_date_creation_fiche=NOW(), bf_url_image="'.$_FILES['image']['name'].'", '.
|
- |
|
851 |
'bf_titre="annonce temporaire"';
|
- |
|
852 |
}
|
840 |
move_uploaded_file($_FILES['image']['tmp_name'], $chemin_destination);
|
853 |
else {
|
- |
|
854 |
$requete='UPDATE bazar_fiche SET bf_url_image="'.$_FILES['image']['name'].'" WHERE bf_id_fiche='.$idfiche;
|
- |
|
855 |
}
|
- |
|
856 |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
|
- |
|
857 |
if (DB::isError($resultat)) {
|
- |
|
858 |
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
|
- |
|
859 |
}
|
841 |
}
|
Line 860... |
Line 842... |
860 |
return;
|
842 |
return 'bf_url_image="'.$_FILES['image']['name'].'", ' ;
|
861 |
}
|
843 |
}
|
Line 1219... |
Line 1201... |
1219 |
}
|
1201 |
}
|
Line 1220... |
Line 1202... |
1220 |
|
1202 |
|
1221 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
1203 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
1222 |
*
|
1204 |
*
|
- |
|
1205 |
* $Log: not supported by cvs2svn $
|
- |
|
1206 |
* Revision 1.52 2006/07/25 13:05:00 alexandre_tb
|
- |
|
1207 |
* Remplacement d un die par un echo
|
1223 |
* $Log: not supported by cvs2svn $
|
1208 |
*
|
1224 |
* Revision 1.51 2006/07/18 14:17:32 alexandre_tb
|
1209 |
* Revision 1.51 2006/07/18 14:17:32 alexandre_tb
|
1225 |
* Ajout d'un formulaire d identification
|
1210 |
* Ajout d'un formulaire d identification
|
1226 |
*
|
1211 |
*
|
1227 |
* Revision 1.50 2006/06/21 08:37:59 alexandre_tb
|
1212 |
* Revision 1.50 2006/06/21 08:37:59 alexandre_tb
|