Subversion Repositories Sites.obs-saisons.fr

Rev

Go to most recent revision | Blame | Last modification | View Log | RSS feed

<?php
// +----------------------------------------------------------------------------+
// |car_config.inc.php                                                            |
// +----------------------------------------------------------------------------+
// | Copyright (c) 2004 Tela Botanica                                            |
// +----------------------------------------------------------------------------+
// | Le module d'inscription amélioré, configuration                            |
// +----------------------------------------------------------------------------+
// | Auteur : Alexandre Granier <alexandre@tela-botanica.org>                     |
// +----------------------------------------------------------------------------+
//
// $Id: car_config.inc.php,v 1.1 2004/11/30 13:37:13 tam Exp $

// Paramêtres indiquant que l'on est en français pourpermettre la mise en majuscule des caractères accentués
setlocale(LC_CTYPE, "fr_FR");

//chemin relatif d'acces a la carto
define ('CAR_CHEMIN_APPLI', 'modules'.DIRECTORY_SEPARATOR);

//bouh! c'est pas propre! c'est a cause de PEAR et de ses includes
set_include_path(CAR_CHEMIN_APPLI.'configuration/'.PATH_SEPARATOR.get_include_path());

//librairies PEAR
require_once CAR_CHEMIN_APPLI.'configuration/DB.php' ;
require_once CAR_CHEMIN_APPLI.'configuration/URL.php' ;
include_once CAR_CHEMIN_APPLI.'configuration/Auth.php' ;

//langues
if (isset($lang)) {
    include_once CAR_CHEMIN_APPLI.'langues/car_langue_$lang.inc.php' ;
} else {
    include_once CAR_CHEMIN_APPLI.'langues/car_langue_fr.inc.php' ;
}

//url du chemin de la librairie de fichier php
define("CAR_CHEMIN_LIBRAIRIE", 'http://obs-saisons.fr/modules/bibliotheque/');
//define("CAR_CHEMIN_LIBRAIRIE", 'http://localhost/david/ods/modules/bibliotheque/');

//url de l'inscription
define("CAR_CHEMIN_INSCRIPTION","http://obs-saisons.fr/article.php3?id_article=1");
//define("CAR_CHEMIN_INSCRIPTION","http://localhost/david/ods/article.php3?id_article=1");

/**
//=========================DEFINITION DE VARIABLES =================================
* Définition des variables globales
//==================================================================================
*/

//==================================== LES URLS ====================================

/** Variable globale contenant l'objet d'accès à l'URL de base de l'application, un objet Net_URL*/
//$GLOBALS['car_url'] = new Net_URL('http://obs-saisons.fr/article.php3?id_article='.$_GET['id_article']);
//$GLOBALS['car_url'] = new Net_URL('http://localhost/david/ods/article.php3?id_article='.$_GET['id_article']);

$GLOBALS['car_url'] = new Net_URL($_SERVER['REQUEST_URI']); 

//=============================== LA BASE DE DONNEES ===============================
// Connection a la base de donnee

$dsn='mysql://'.$login.':'.$pass.'@'.$hote.'/'.$db;
$GLOBALS['car_db'] =& DB::connect($dsn) ;

//=============================== AUTHENTIFICATION =================================

// Fonction d'identification par PEAR Auth
function loginFunction($username = null, $status = null, $auth = null)
{
        $url = $GLOBALS['car_url'];
        if (isset($GLOBALS['historique_cartes'])) $url->addQueryString('historique_cartes', $GLOBALS['historique_cartes']);
    
        
    
    $res  = "<h3 class=\"titre2_cartographie\">".CAR_TEXTE_IDENTIFICATION_1."</h3>";
    $res .= "<form method=\"post\" action=\"".$GLOBALS['car_url']->getURL()."\">\n";
    $res .= "<table border=\"0\">";
        $res .= "<tr><td colspan=\"2\">&nbsp;</td></tr>";
        $res .= "<tr><td colspan=\"2\">&nbsp;</td></tr>";
        $res .= "<tr><td>Identifiant</td><td><input type=\"text\" name=\"username\"></td></tr>";
        $res .= "<tr><td>Mot de passe &nbsp;</td><td><input type=\"password\" name=\"password\"></td></tr>";
        $res .= "<tr><td colspan=\"2\" align=\"right\"><input type=\"submit\" class=\"submit\" value=\"Je me connecte\"></td></tr>";
        $res .= "<tr><td colspan=\"2\"><a href=\"".$GLOBALS['car_url']->getURL()."\">J'ai oublié mon mot de passe</a></td></tr>";
        $res .= "<tr><td><a href=\"inscription\">S'inscrire</a></td></tr>";
        $res .= "</form>\n"; 
        
        
        return $res;
}

$params = array(
"dsn" => $dsn ,
"table" => 'PARTICIPANT' ,
"usernamecol" => 'PARTICIPANT_PSEUDO' ,
"passwordcol" => 'PARTICIPANT_MOTDEPASSE',
"cryptType" => 'none',
"db_fields"=>'*'
);

if (isset($_GET['act']) && $_GET['act'] == "login") {
     $optional = true;
} else {
     $optional = false;
}
$GLOBALS['car_auth'] = new Auth("DB", $params, "loginFunction", $optional);


/**
//==================================== CONSTANTES ==================================
* Constantes des noms de tables et de champs dans l'annuaire
//==================================================================================
*/
define ("CAR_ANNUAIRE", "PARTICIPANT") ;
define ("CAR_CHAMPS_NOM", "PARTICIPANT_NOM") ;                   // Nom du champs nom
define ("CAR_CHAMPS_MAIL", "PARTICIPANT_EMAIL") ;                  // Nom du champs mail
define ("CAR_CHAMPS_PRENOM", "PARTICIPANT_PRENOM") ;             // Nom du champs prénom
define ("CAR_CHAMPS_CE_PAYS", "PAYS_ID") ;
define ("CAR_CHAMPS_DPT", " DEPARTEMENT_ID") ;
define ("CAR_CHAMPS_ID", "PARTICIPANT_ID") ;
define ("CAR_CHAMPS_DATE_INS", "PARTICIPANT_DATE_INSCRIPTION") ;
define ("CAR_CHAMPS_CODE_POSTAL", "PARTICIPANT_CODE_POSTAL") ;
define ("CAR_CHAMPS_VILLE", "PARTICIPANT_VILLE") ;
define ("CAR_CHAMPS_ADRESSE", "PARTICIPANT_ADRESSE") ;
define ('CAR_CHAMPS_LETTRE', 'PARTICIPANT_RECEVOIR_NEWSLETTER');
define ('CAR_CHAMPS_VISIBLE', 'PARTICIPANT_NOM_PRENOM_VISIBLE');
define ("CAR_TABLE_DPT", "carto_DEPARTEMENT") ;           // Nom de la table département
define ('CAR_CHAMPS_CARTO_DEP', 'CD_ID_Departement');
define ('CAR_CHAMPS_NOM_DEP', 'CD_Intitule_departement');
define ("CAR_TABLE_PAYS", "carto_PAYS") ;             // Nom de la table pays
define ("CAR_CHAMPS_ID_PAYS", "CP_ID_Pays");
define ("CAR_CHAMPS_NOM_PAYS", "CP_Intitule_pays");
/**
//==================================== CONSTANTES ==================================
* Constantes
//==================================================================================
**/
/** Constante de préfixe des mails envoyés */
define('CAR_PREFIXE_MAIL','[Observatoire des Saisons] ');
/** Variable définissant la lettre par défaut du parcour alphabétique.*/
define('CAR_LETTRE_DEFAUT', 'a') ;// une lettre de l'aphabet ou "tous"
/** Variable définissant si oui ou non on affiche l'entrée "tous" dans le parcour alphabétique.*/
define('CAR_TOUS_BOOL', true) ;// true ou false

/** Variable definissant le niveau de zoom de depart */
 
define('CAR_ECHELLE_DEPART', "continent*europe*france") ;// ex : continent ou continent*europe ou continent*europe*france

/** Tableau global contenant les mails des administrateurs. */
// Liste des personne recevant le mail après envoie de courriel par l'annuaire
$GLOBALS['mail_admin'] = array ('david.delon@clapas.net, carto@obs-saisons.fr');  



// Liste des personne pouvant se connecter à l'annuaire general
$GLOBALS['pseudo_annu'] = array ('david.delon','violette');  

                                                                
/** Constante spécifique à l'ODS : choisir entre inscription adulte et inscription junior. */
// Pour l'ODS : les participants sont'ils des adultes (1) ou des enfants (0)
define ('PARTICIPANT_EST_ADULTE',1);  

/** Requete personnalisée supplémentaire pour l'annuaire et la carto. */
// Bout supplémentaire de requète MySQL pour préciser des options pour l'affichage
define ('SQL_SUPPLEMENTAIRE',' PARTICIPANT_ADULTE='.PARTICIPANT_EST_ADULTE.' ');  
                                                                
?>