Subversion Repositories Sites.tela-botanica.org

Rev

Blame | Last modification | View Log | RSS feed

<?php
function pap_analyseur_analyser($texte) {
        /*
         * Attention : ne fonctionne pas avec les balises meta
         */
        
        global $chemin_papyrus;
        
        define(GEN_CHEMIN_APPLETTE, $chemin_papyrus.'papyrus/applettes/');
        //Inclusions des fichier de configuration de papyrus
        
        include_once $chemin_papyrus.'papyrus/configuration/pap_config.inc.php' ;
        include_once $chemin_papyrus.'papyrus/configuration/pap_config_avancee.inc.php' ;
        
                                                get_include_path().PATH_SEPARATOR;      
        set_include_path($_SERVER['DOCUMENT_ROOT'].PATH_SEPARATOR.PAP_CHEMIN_API_PEAR.PATH_SEPARATOR.
                                                get_include_path().PATH_SEPARATOR);
        
        
        $GLOBALS['_GEN_commun']['info_site']->gs_fichier_squelette ="D:/greg/workspace/papyrus/actu/plugins/analyseur_papyrus/squelette.html";
        $GLOBALS['_GEN_commun']['info_site']->gs_ce_auth = 1;

        global $db, $_GEN_commun;
        
        //Inclusions des fichiers papyrus
        include_once $chemin_papyrus.'papyrus/pap_connecte_bdd.inc.php';
        include_once $chemin_papyrus.'papyrus/pap_initialise_auth.inc.php';
        include_once $chemin_papyrus.'papyrus/pap_initialise_info.inc.php';
        include_once $chemin_papyrus.'papyrus/bibliotheque/classes/pap_rendu.class.php';
        include_once $chemin_papyrus.'papyrus/bibliotheque/fonctions/pap_script.fonct.php';
        $GLOBALS['_PAPYRUS_']['general']['contenu_squelette'] = $texte;
        
        //Informations du site
        //Récupéré depuis pap_rendu.inc.php
        
        $id_langue = $GLOBALS['_GEN_commun']['i18n'];
        $langue_test = (isset($id_langue) && $id_langue!='') ? $id_langue : GEN_I18N_ID_DEFAUT;
        
        $requete =  'SELECT * '.
                'FROM gen_site '.
                'WHERE gs_ce_i18n = "'.$langue_test.'" '.
                'AND gs_code_num = "'.$GLOBALS['_GEN_commun']['info_site']->gs_code_num.'"';
    $resultat = $db->query($requete);
    (DB::isError($resultat)) ? die(BOG_afficherErreurSql(__FILE__, __LINE__, $resultat->getMessage(), $requete)) : '';

    $type_site = isset($GLOBALS['_GEN_commun']['traduction_info_site']) ? 'traduction_info_site' : 'info_site';
        $type_menu = isset($GLOBALS['_GEN_commun']['traduction_info_menu']) ? 'traduction_info_menu' : $type_menu='info_menu';

    // Construction des infos sur le site
        $GLOBALS['_PAPYRUS_']['page']['nom_site'] = htmlentities($GLOBALS['_GEN_commun'][$type_site]->gs_nom);
        $GLOBALS['_PAPYRUS_']['rendu']['SITE_NOM'] = $GLOBALS['_PAPYRUS_']['page']['nom_site'];
        $GLOBALS['_PAPYRUS_']['page']['langue_site'] = htmlentities($GLOBALS['_GEN_commun']['i18n']);
        $GLOBALS['_PAPYRUS_']['rendu']['SITE_LANGUE'] = $GLOBALS['_PAPYRUS_']['page']['langue_site'];
        $GLOBALS['_PAPYRUS_']['page']['code_alpha_site'] = htmlentities($GLOBALS['_GEN_commun'][$type_site]->gs_code_alpha);
        $GLOBALS['_PAPYRUS_']['rendu']['SITE_CODE_ALPHA'] = $GLOBALS['_PAPYRUS_']['page']['code_alpha_site'];

        // Construction des infos sur le menu pour générer les balises
        $GLOBALS['_PAPYRUS_']['rendu']['INFO_MENU_ID'] = htmlentities($GLOBALS['_GEN_commun'][$type_menu]->gm_id_menu);
        $GLOBALS['_PAPYRUS_']['rendu']['INFO_MENU_CODE_ALPHA'] = htmlentities($GLOBALS['_GEN_commun'][$type_menu]->gm_code_alpha);
        $GLOBALS['_PAPYRUS_']['rendu']['INFO_MENU_CODE_NUM'] = htmlentities($GLOBALS['_GEN_commun'][$type_menu]->gm_code_num);
    
        //Préfixe
        $GLOBALS['_GEN_commun']['balise_prefixe'] = 'PAPYRUS_';
        foreach ($GLOBALS['_PAPYRUS_']['rendu'] as $GLOBALS['_PAPYRUS_']['tmp']['cle'] => $GLOBALS['_PAPYRUS_']['tmp']['val']) {
                $GLOBALS['_PAPYRUS_']['general']['contenu_squelette'] = 
                    str_replace(   '<!-- '.$_GEN_commun['balise_prefixe'].$GLOBALS['_PAPYRUS_']['tmp']['cle'].' -->',
                                    $GLOBALS['_PAPYRUS_']['tmp']['val'], 
                                    $GLOBALS['_PAPYRUS_']['general']['contenu_squelette']);
        }
    
        $pap_rendu = new Pap_Rendu();
        $pap_rendu->parserBaliseApplette($texte, true);
        if ($pap_rendu->getBoolBaliseAppli()) {
                $pap_rendu->remplacerBaliseApplette();
        }
        return $GLOBALS['_PAPYRUS_']['general']['contenu_squelette'];
}
?>