19,7 → 19,7 |
// | License along with this library; if not, write to the Free Software | |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
// +------------------------------------------------------------------------------------------------------+ |
// CVS : $Id: bazar.fonct.php,v 1.73 2007-10-24 13:27:00 alexandre_tb Exp $ |
// CVS : $Id: bazar.fonct.php,v 1.74 2007-10-25 09:41:31 alexandre_tb Exp $ |
/** |
* |
* Fonctions du module bazar |
31,7 → 31,7 |
*@author Florian Schmitt <florian@ecole-et-nature.org> |
//Autres auteurs : |
*@copyright Tela-Botanica 2000-2004 |
*@version $Revision: 1.73 $ $Date: 2007-10-24 13:27:00 $ |
*@version $Revision: 1.74 $ $Date: 2007-10-25 09:41:31 $ |
// +------------------------------------------------------------------------------------------------------+ |
*/ |
|
531,6 → 531,9 |
$lien_formulaire->addQueryString('action', BAZ_ACTION_MODIFIER); |
} else { |
$lien_formulaire->addQueryString('action', BAZ_ACTION_MODIFIER_V); |
if (isset ($_SESSION['_BAZAR_']['fichier'])) unset($_SESSION['_BAZAR_']['fichier']) ; |
if (isset ($_SESSION['_BAZAR_']['image'])) unset($_SESSION['_BAZAR_']['image']); |
if (isset ($_SESSION['_BAZAR_']['lien'])) unset($_SESSION['_BAZAR_']['lien']); |
} |
$lien_formulaire->addQueryString('id_fiche', $GLOBALS['_BAZAR_']['id_fiche']); |
} |
952,15 → 955,18 |
*/ |
function baz_insertion_url($url_lien, $url_texte, $idfiche) { |
//requete d'insertion dans bazar_url |
$id_url = baz_nextId('bazar_url', 'bu_id_url', $GLOBALS['_BAZAR_']['db']) ; |
$requete = 'INSERT INTO bazar_url SET bu_id_url='.$id_url.', bu_ce_fiche='.$idfiche.', '. |
'bu_url="'.$url_lien.'", bu_descriptif_url="'.addslashes($url_texte).'"'; |
|
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ; |
if (DB::isError($resultat)) { |
return $resultat->getMessage().$resultat->getDebugInfo() ; |
} |
return; |
if (!isset($_SESSION['_BAZAR_']['lien'])) { |
$id_url = baz_nextId('bazar_url', 'bu_id_url', $GLOBALS['_BAZAR_']['db']) ; |
$requete = 'INSERT INTO bazar_url SET bu_id_url='.$id_url.', bu_ce_fiche='.$idfiche.', '. |
'bu_url="'.$url_lien.'", bu_descriptif_url="'.addslashes($url_texte).'"'; |
|
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ; |
if (DB::isError($resultat)) { |
return $resultat->getMessage().$resultat->getDebugInfo() ; |
} |
$_SESSION['_BAZAR_']['lien'] = 1; |
return; |
} |
} |
|
|
975,21 → 981,24 |
//verification de la presence de ce fichier |
$requete = 'SELECT bfj_id_fichier FROM bazar_fichier_joint WHERE bfj_fichier="'.$_FILES[$nom_fichier]['name'].'"'; |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ; |
if (DB::isError($resultat)) { |
die ($resultat->getMessage().$resultat->getDebugInfo()) ; |
} |
if (!isset ($_SESSION['_BAZAR_']['fichier'])) { |
if ($resultat->numRows()==0) { |
$chemin_destination=BAZ_CHEMIN_APPLI.'upload/'.$_FILES[$nom_fichier]['name']; |
move_uploaded_file($_FILES[$nom_fichier]['tmp_name'], $chemin_destination); |
chmod ($chemin_destination, 0755); |
} |
$id_fichier_joint = baz_nextId('bazar_fichier_joint', 'bfj_id_fichier', $GLOBALS['_BAZAR_']['db']) ; |
$requete = 'INSERT INTO bazar_fichier_joint SET bfj_id_fichier='.$id_fichier_joint.', bfj_ce_fiche='.$idfiche. |
', bfj_description="'.addslashes($fichier_description).'", bfj_fichier="'.$_FILES[$nom_fichier]['name'].'"'; |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ; |
if (DB::isError($resultat)) { |
die ($resultat->getMessage().$resultat->getDebugInfo()) ; |
return $resultat->getMessage().$resultat->getDebugInfo() ; |
} |
if ($resultat->numRows()==0) { |
$chemin_destination=BAZ_CHEMIN_APPLI.'upload/'.$_FILES[$nom_fichier]['name']; |
move_uploaded_file($_FILES[$nom_fichier]['tmp_name'], $chemin_destination); |
chmod ($chemin_destination, 0755); |
} |
$id_fichier_joint = baz_nextId('bazar_fichier_joint', 'bfj_id_fichier', $GLOBALS['_BAZAR_']['db']) ; |
$requete = 'INSERT INTO bazar_fichier_joint SET bfj_id_fichier='.$id_fichier_joint.', bfj_ce_fiche='.$idfiche. |
', bfj_description="'.addslashes($fichier_description).'", bfj_fichier="'.$_FILES[$nom_fichier]['name'].'"'; |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ; |
if (DB::isError($resultat)) { |
die ($resultat->getMessage().$resultat->getDebugInfo()) ; |
} |
$_SESSION['_BAZAR_']['fichier'] = 1; |
return; |
} |
|
1011,6 → 1020,7 |
move_uploaded_file($_FILES['image']['tmp_name'], $chemin_destination); |
chmod ($chemin_destination, 0755); |
} |
$_SESSION['_BAZAR_']['image'] = 1; |
return 'bf_url_image="'.$_FILES['image']['name'].'", ' ; |
} |
|
1388,6 → 1398,10 |
/* +--Fin du code ----------------------------------------------------------------------------------------+ |
* |
* $Log: not supported by cvs2svn $ |
* Revision 1.73 2007-10-24 13:27:00 alexandre_tb |
* bug : double saisie d url |
* suppression de warning sur variable |
* |
* Revision 1.72 2007-10-22 10:09:21 florian |
* correction template |
* |