Subversion Repositories Applications.papyrus

Compare Revisions

Ignore whitespace Rev 1420 → Rev 1421

/trunk/client/bottin/bibliotheque/inscription.fonct.php
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: inscription.fonct.php,v 1.28 2007-04-20 08:39:37 alexandre_tb Exp $
// CVS : $Id: inscription.fonct.php,v 1.29 2007-05-25 14:32:17 alexandre_tb Exp $
/**
* Fonctions du module inscription
*
31,7 → 31,7
//Autres auteurs :
*@author Florian Schmitt <florian@ecole-et-nature.org>
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.28 $ $Date: 2007-04-20 08:39:37 $
*@version $Revision: 1.29 $ $Date: 2007-05-25 14:32:17 $
// +------------------------------------------------------------------------------------------------------+
*/
 
96,23 → 96,7
mail ($GLOBALS['email'], 'Inscription', $tpl->get(), 'From: '.INS_MAIL_ADMIN_APRES_INSCRIPTION) ;
}
 
/**
*
* @param array les valeurs renvoyés par le formulaire
* @return
*/
 
function inscription_validee($valeurs) {
insertion($valeurs) ;
$GLOBALS['AUTH']->username = $valeurs['email'] ;
$GLOBALS['AUTH']->password = $valeurs['mot_de_passe'] ;
// On loggue l'utilisateur
$GLOBALS['AUTH']->login() ;
// inscription à la lettre d'information
if (INS_CHAMPS_LETTRE != '' && isset ($valeurs['lettre'])) {
inscription_lettre(INS_MAIL_INSCRIPTION_LISTE) ;
}
}
 
/**
* Renvoie l'accueil de l'inscription
266,6 → 250,9
$req .= ",".INS_CHAMPS_DEPARTEMENT."='$n_dpt'";
}
if (INS_UTILISE_WIKINI && isset ($valeur['nom_wiki'])) $req .= ','.INS_CHAMPS_NOM_WIKINI.'="'.$valeur['nom_wiki'].'"';
if ($GLOBALS['ins_config']['ic_google_key']) {
$req .= ', a_longitude="'.$valeur['longitude'].'", a_latitude="'.$valeur['latitude'].'"';
}
return $req ;
}
 
312,123 → 299,6
}
 
 
/** info() - Renvoie une fiche d'information sur la personne ou la structure
*
* @param integer identifiant de la fiche a afficher, mettre -1 pour voir sa propre fiche
* @param text nom de l'onglet de la fiche
*
* @return text Code HTML de la fiche
*/
function info($id=-1, $type_info='fiche') {
if ($id==-1) $id=$GLOBALS['AUTH']->getAuthData(INS_CHAMPS_ID);
$requete = 'SELECT * FROM '.INS_ANNUAIRE.' WHERE '.INS_ANNUAIRE.'.'
.INS_CHAMPS_ID.'="'.$id.'"' ;
$resultat = $GLOBALS['ins_db'] -> query($requete) ;
if (DB::isError($resultat)) {
die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
}
 
$ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC) ;
//voir la présentation de la fiche
if ($type_info=='fiche') {
if ($ligne[INS_CHAMPS_EST_STRUCTURE] == 1) {
$res = '<h1>'.$ligne[INS_CHAMPS_NOM].'</h1>'."\n";
$res .= '<h2>'.INS_FICHE_STRUCTURE.'</h2>'."\n" ;
$res .= '<ul class="affiche_infos">'."\n";
$res .= ligne_inscription(INS_SIGLE_DE_LA_STRUCTURE, $ligne[INS_CHAMPS_SIGLE_STRUCTURE]) ;
if (INS_CHAMPS_NUM_AGREMENT != '') $res .= ligne_inscription(INS_NUM_AGREMENT, $ligne[INS_CHAMPS_NUM_AGREMENT]) ;
} else {
$res = '<h1>'.$ligne[INS_CHAMPS_PRENOM].' '.$ligne[INS_CHAMPS_NOM].'</h1>'."\n";
$res .= '<h2>'.INS_FICHE_PERSONNELLE.'</h2>'."\n" ;
$res .= '<ul class="affiche_infos">'."\n";
}
$res .= ligne_inscription(INS_ADRESSE_1, $ligne[INS_CHAMPS_ADRESSE_1]) ;
$res .= ligne_inscription(INS_ADRESSE_2, $ligne[INS_CHAMPS_ADRESSE_2]) ;
$res .= ligne_inscription(INS_CODE_POSTAL, $ligne[INS_CHAMPS_CODE_POSTAL]) ;
$res .= ligne_inscription(INS_VILLE, $ligne[INS_CHAMPS_VILLE]) ;
$pays = new ListeDePays($GLOBALS['ins_db']) ;
$res .= ligne_inscription(INS_PAYS, $pays->getNomPays($ligne[INS_CHAMPS_PAYS], INS_LANGUE_DEFAUT)) ;
$res .= ligne_inscription(INS_TELEPHONE, $ligne[INS_CHAMPS_TELEPHONE]) ;
$res .= ligne_inscription(INS_FAX, $ligne[INS_CHAMPS_FAX]) ;
if (INS_UTILISE_WIKINI) {
$res .= ligne_inscription (INS_NOM_WIKI, $ligne[INS_CHAMPS_NOM_WIKINI]) ;
}
if ($ligne[INS_CHAMPS_SITE_INTERNET]!='') {
$res .= ligne_inscription(INS_SITE_INTERNET, '<a href="'.$ligne[INS_CHAMPS_SITE_INTERNET].'" onclick="javascript:window.open(this.href);return false;">'.$ligne[INS_CHAMPS_SITE_INTERNET].'</a>');
}
if ($GLOBALS['AUTH']->getAuth()) $res .= ligne_inscription(INS_EMAIL, '<a href="mailto:'.$ligne[INS_CHAMPS_MAIL].'">'.$ligne[INS_CHAMPS_MAIL].'</a>');
else $res .= '<br /><p class="zone_info">'.INS_PAS_IDENTIFIE.'</p>'."\n";
$res .= '</ul>'."\n";
if ($id==$GLOBALS['AUTH']->getAuthData(INS_CHAMPS_ID)) {
$res .= '<br />'."\n";
$res .= '<ul>'."\n";
if ($ligne[INS_CHAMPS_VISIBLE] == 1) {
$res .= '<li>'.INS_VOUS_APPARAISSEZ.'</li>'."\n";
} else $res .= '<li>'.INS_VOUS_APPARAISSEZ_PAS.'</li>'."\n";
if (INS_CHAMPS_LETTRE != '') {
if ($ligne[INS_CHAMPS_LETTRE] == 1) {
$res .= '<li>'.INS_VOUS_RECEVEZ_LETTRE.'</li>'."\n";
} else $res .= '<li>'.INS_VOUS_RECEVEZ_PAS_LETTRE.'</li>'."\n";
}
$res .= '</ul>'."\n";
$res .= '<br />'."\n";
$res .= '<ul>'."\n";;
$res .= '<li><a href="'.$GLOBALS['ins_url']->getURL().'&amp;action=modifier&amp;form_structure='.$ligne[INS_CHAMPS_EST_STRUCTURE].'">'.INS_MODIFIER_INSCRIPTION.'</a></li>'."\n" ;
$res .= '<li><a href="'.$GLOBALS['ins_url']->getURL().'&amp;action=supprimer&amp;form_structure='.$ligne[INS_CHAMPS_EST_STRUCTURE].'" onclick="javascript:return confirm(\''.INS_SUPPRIMER_INSCRIPTION.'?\');">'.INS_SUPPRIMER_INSCRIPTION.'</a></li>'."\n" ;
$res .= '<li><a href="'.$GLOBALS['ins_url']->getURL().'&amp;action=deconnexion">'.INS_DECONNEXION.'</a></li>'."\n" ;
$res .= '</ul>'."\n";
}
//voir les abonnements presents dans les applis clientes
} elseif ($type_info=='abonnement') {
$res = '<h1>'.$ligne[INS_CHAMPS_PRENOM].' '.$ligne[INS_CHAMPS_NOM].'</h1>'."\n";
$res .= '<h2>'.INS_GESTION_DES_ABONNEMENTS.'</h2>'."\n" ;
// Appel des actions d'abonnement des applications clientes
$d = dir(GEN_CHEMIN_CLIENT);
$abonnement='';
$abonnements='';
while (false !== ($repertoire = $d->read())) {
if (file_exists(GEN_CHEMIN_CLIENT.$repertoire.GEN_SEP.'bibliotheque'.GEN_SEP.$repertoire.'.abonnement.inc.php')) {
require_once GEN_CHEMIN_CLIENT.$repertoire.GEN_SEP.'bibliotheque'.GEN_SEP.$repertoire.'.abonnement.inc.php' ;
$abonnements .= $abonnement;
}
}
$d->close();
$res .= $abonnements;
//voir les actus
} elseif ($type_info=='actus') {
$res = '<h1>'.$ligne[INS_CHAMPS_PRENOM].' '.$ligne[INS_CHAMPS_NOM].'</h1>'."\n";
$res .= '<h2>'.INS_ACTUALITES_DEPOSEES.'</h2>'."\n" ;
require_once GEN_CHEMIN_CLIENT.'bazar'.GEN_SEP.'configuration'.GEN_SEP.'baz_config.inc.php';
require_once GEN_CHEMIN_CLIENT.'bazar'.GEN_SEP.'bibliotheque'.GEN_SEP.'bazar.fonct.rss.php';
$_GET['action']=1;
$res .= RSSversHTML(gen_RSS('', '', $id, 1, ''), 0, 'jma', 0);
//voir les ressources
} elseif ($type_info=='ressources') {
$res = '<h1>'.$ligne[INS_CHAMPS_PRENOM].' '.$ligne[INS_CHAMPS_NOM].'</h1>'."\n";
$res .= '<h2>'.INS_RESSOURCES_ASSOCIEES.'</h2>'."\n" ;
$requete = 'SELECT bf_id_fiche, bf_titre FROM bazar_fiche, bazar_appropriation WHERE ba_ce_id_fiche=bf_id_fiche AND ba_ce_id_structure='.$id ;
$resultat = $GLOBALS['ins_db'] -> query($requete) ;
$res .= '<ul>'."\n";
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$res .= '<li><a href="'.INS_URL_BAZAR.'&amp;action=8&amp;id_fiche='.$ligne['bf_id_fiche'].'" onclick="window.open(this.href,\'_blank\');return false;">'.$ligne['bf_titre'].'</a></li>'."\n";
}
$res .= '</ul><br />'."\n";
//voir les competences
} elseif ($type_info=='competences') {
$res = '<h1>'.$ligne[INS_CHAMPS_PRENOM].' '.$ligne[INS_CHAMPS_NOM].'</h1>'."\n";
$res .= '<h2>'.INS_COMPETENCES_ASSOCIEES.'</h2>'."\n" ;
}
return $res ;
}
 
 
/** ligne_inscription() - Renvoie une ligne avec label et valeur
*
* @param string label Le label
517,32 → 387,7
}
 
/**
* Inscrit un adhérent à la lettre d'actualité par l'envoie d'un email subscribe / unsubscribe
* à la liste
*
* @global AUTH Un objet PEAR::Auth
* @return boolean true en cas de succès
*/
 
function inscription_lettre($action) {
include_once PAP_CHEMIN_RACINE.'api/pear/Mail.php' ;
$mail = & Mail::factory ('smtp') ;
$email = $GLOBALS['AUTH']->getUsername() ;
$headers ['Return-Path'] = $email ;
$headers ['From'] = "<".$email.">" ;
$headers ['Subject'] = $action ;
$headers ['Reply-To'] = $email ;
$mail -> send ($action, $headers, "") ;
if (PEAR::isError ($mail)) {
echo '<p class="erreur">Le mail n\'est pas parti...</p>' ;
return false ;
}
return true ;
}
 
/**
*
* @global ins_db Un pointeur vers un objet PEAR::DB connecté
* @return
*/
657,37 → 502,6
}
 
//==============================================================================
/** function create_new_random($n,$type) permet de générer un nombre de caractères aléatoires.
*
*
*
* ENTREE :
* - $n : créer un 'mot' de $n caractères
* - $type : permet de définir la liste des caractères disponibles
*
* SORTIE : chaine de $n caractères pris dans une liste $type
*/
function create_new_random($n,$type="")
{
$str = "";
 
switch ($type){
default:{
$chaine = "abcdefghkmnpqrstuvwxyzABCDEFGHKLMNPQRSTUVWXYZ23456789";
}
break;
}
srand((double)microtime()*1000000);
for($i = 0; $i < $n; $i++){
$str .= $chaine[rand()%strlen($chaine)];
}
return "$str";
}
 
//==============================================================================
/** function nextId () Renvoie le prochain identifiant numérique libre d'une table
*
* On passe en paramètre le nom de la table et l'identifiant de la base selon PEAR DB
716,6 → 530,9
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.28 2007/04/20 08:39:37 alexandre_tb
* correction de commentaire
*
* Revision 1.27 2007/04/11 08:30:12 neiluj
* remise en état du CVS...
*