Codulle - L'explorateur de code sources
Informations fichier
Nom du fichier : index.phpTaille du fichier : 11 Ko (332 lignes)
Language : PHP
<?php //////////////////////////////////////// // Encodage du fichier : UTF-8 // Utilisation des tabulations : Oui // 1 tabulation = 4 caractères // Fins de lignes = LF (Unix) //////////////////////////////////////// /////////////////////////////// // LICENCE /////////////////////////////// // // Codulle is a PHP program with which you can publish any project // or sources files of any type supported you want. // // Copyright (C) 2005 © DUCARRE Cédric, Bubulles Creations, (25/11/2005) // // Contact @ http://jebulle.net - webmaster@jebulle.net // // Codulle is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. // // Codulle is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Codulle; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // /////////////////////////////// /** * Codulle - Explorateur de projets * * @author SamRay1024 * @copyright Bubulles Creations * @license http://gnu.org/copyleft/gpl.html GNU GPL * @link http://jebulle.net * @name Codulle * @since 04/11/2005 * @version 0.1 */ // ==================== // INCLUSION DES FICHIERS NECESSAIRES // require_once( './includes/config.php' ); require_once( './includes/fonctions.php' ); require_once( './classes/geshi.php' ); // ==================== // VERIFICATIONS // Le dossier <em>'.JB_CO_DOSSIER_PROJETS.'</em> est introuvable. Vérifiez la configuration dans le fichier <strong>includes/config.php</strong>. Il s\'agit du répertoire qui doit contenir vos projets !' ); if( !file_exists(JB_CO_DOSSIER_THEMES.JB_CO_DOSSIER_THEME_ACTIF.JB_CO_FICHIER_THEME) ) // existence thème spécifié Le fichier du thème <em>'.JB_CO_DOSSIER_THEMES.JB_CO_DOSSIER_THEME_ACTIF.JB_AL_FICHIER_THEME.'</em> est introuvable. Vérifiez la configuration dans le fichier <strong>includes/config.php</strong>.' ); Le fichier <em>'.JB_AL_FICHIER_ACCUEIL.'</em> est introuvable. Vérifiez la configuration dans le fichier <strong>includes/config.php</strong>. Si ce fichier n\'existe pas, créez-le et complétez-le pour bénéficier d\'un texte d\'accueil.' ); // ==================== // INITIALISATIONS // $sCodulleVersion = '0.1'; $sContenuAccueil = ''; $sThemeCheminComplet = JB_CO_DOSSIER_THEMES.JB_CO_DOSSIER_THEME_ACTIF; // ==================== // LECTURE DES PARAMETRES PASSES DANS L'URL // ( isset( $_GET['fichier'] ) ) ? $sFichier = stripslashes(rawurldecode( $_GET['fichier'] )) : $sFichier = ''; // ==================== // EXTRACTION INFOS SUR LE FICHIER DEMANDE // $sDossierFichier = $aInfosFichier['dirname']; $sNomFichier = $aInfosFichier['basename']; $sExtensionFichier = $aInfosFichier['extension']; // ==================== // VERIFICATION DES PARAMETRES // // Nettoyage du chemin (pour éviter les failles d'accès) // On récupère la liste des dossiers de ce chemin pour pouvoir connaitre le niveau dans lequel on se trouve { $aDossiers = nettoyerCheminURL( $sRep ); // Vérification que le dossier passé dans l'url existe sinon on l'efface // ce qui a pour effet de revenir à la page d'accueil. { $sRep = ''; } } // Nettoyage chemin de la page { nettoyerCheminURL( $sDossierFichier ); // Reconstruction chaine d'accès au fichier avec l'accès nettoyé $sFichier = $sDossierFichier.'/'.$sNomFichier; // Vérification de la page demandée $sFichier = ''; } // ==================== // CALCUL NIVEAU DANS L'ARBORESCENCE // // ==================== // GESTION DE LA LISTE DES DOSSIERS DE PROJETS // $sRepCourant = $sRep; // pour la construction de l'arborescence on prend une autre variable car elle va être modifiée. $sResultat = SousChaineGauche( $sRepCourant, '/', 1 ); $sRepParent = ( $sResultat === $sRepCourant ) ? '' : $sResultat; // Détermination du premier niveau à lire selon ce qui a été demandé et où l'utilisateur se trouve. if( $iNiveau > 1 ) $sDossierLecture = JB_CO_DOSSIER_PROJETS.$sRepParent; else $sDossierLecture = JB_CO_DOSSIER_PROJETS; // lecture répertoires $mResultat = advScanDir( $sDossierLecture, 'TOUT' ); // lecture nombre dossiers lus // S'il n'y a pas de dossiers. if ( $iNbDossiers === 0 ) $sLiensDossiersProjets = '<li class="puceVide">Il n\'y a pas de projets actuellement.</li>'; if( $iNiveau > 1 ) $sLiensDossiersProjets = '<li class="puceRemonter"> <a href="'.$_SERVER['PHP_SELF'].'?rep=' ."\">Remonter</a></li>\n"; // Création liste dossiers for( $i = 0 ; $i < $iNbDossiers ; $i++ ) { $sLienNiveau1 = ( $sRepParent === '' ) ? $aListeRepProjets['dir'][$i] : $sRepParent.'/'.$aListeRepProjets['dir'][$i]; $sGrasDebut = $sGrasFin = ''; // lecture sous dossiers du dossier courant $mResultat = advScanDir( $sDossierLecture.'/'.$aListeRepProjets['dir'][$i], 'TOUT' ); // lecture nombre sous-dossiers et fichiers lus // test si on se trouve sur le dossier courant pour le mettre en gras if( $sLienNiveau1 === $sRepCourant ) { $sGrasDebut = '<strong>'; $sGrasFin = '</strong> '; } // lien dossier parent $sNbFichiers = ( JB_CO_AFFICHER_NB_FICHIERS === true ) ? '<em>('.($iNbSousDossiers + $iNbFichiers).')</em>' : ''; $sLiensDossiersProjets .= '<li class="puceDossier"> ."$sGrasFin</a> $sNbFichiers</li>\n"; // Concaténation sous-liste avec les dossiers if( $sLienNiveau1 === $sRepCourant ) { for( $j = 0 ; $j < $iNbSousDossiers ; $j++ ) { // on ne calcule le nombre de photo d'un dossier que si autorisé dans la config if( JB_CO_AFFICHER_NB_FICHIERS === true ) { $mResultat = advScanDir( $sDossierLecture.'/'.$aListeRepProjets['dir'][$i].'/'.$aListeSousRep['dir'][$j], 'TOUT' ); } else $sNbFichiers = ''; $sLiensDossiersProjets .= '<li class="puceSousDossier"> <a href="'.$_SERVER['PHP_SELF'].'?rep=' ."</a> $sNbFichiers</li>\n"; } // Concaténation sous-liste avec les fichiers for( $j = 0 ; $j < $iNbFichiers ; $j++ ) { // Déterminiation de la classe CSS en fonction du type de fichier switch ($sExtCourante) { // Fichiers web case 'css': $sClassePuce = 'puceCss'; break; case 'htm': case 'html': $sClassePuce = 'puceHtml'; break; case 'php': $sClassePuce = 'pucePhp'; break; case 'xml': $sClassePuce = 'puceXml'; break; // Fichiers images case 'gif': $sClassePuce = 'puceGif'; break; case 'jpg': $sClassePuce = 'puceJpg'; break; case 'png': $sClassePuce = 'pucePng'; break; // Fichiers divers case 'txt': $sClassePuce = 'puceTxt'; break; // Autres default: $sClassePuce = 'puceAutres'; } $sLiensDossiersProjets .= '<li class="'.$sClassePuce.'"> ."</a></li>\n"; } } } // ==================== // ANALYSE DU FICHIER DEMANDE // // Selon l'extension switch ($sExtensionFichier) { case 'jpg': case 'gif': case 'png': case 'bmp': case 'tiff': $sFichierFinal = '<img src="'.JB_CO_DOSSIER_PROJETS.$sFichier.'" alt="Image '.$sNomFichier.'" />'; break; default: $oGeshi = new GeSHi( $sFichierContenu, $sExtensionFichier ); $oGeshi->enable_line_numbers( GESHI_FANCY_LINE_NUMBERS, 5 ); $sFichierFinal = $oGeshi->parse_code(); } // ==================== // INTIALISATIONS DIVERSES POUR L'AFFICHAGE // // Titre de la page { $sHeadTitre = JB_CO_TITRE; $sErreurAccueil = "<p style=\"color: red;\">#ATTENTION# - Impossible de trouver le fichier <em>JB_CO_FICHIER_ACCUEIL</em>.<br /> => Créez et complétez ce fichier à la racine de Codulle pour disposer d'un texte d'accueil.</p>"; $sContenuAccueil = ( file_exists(JB_CO_FICHIER_ACCUEIL) ) ? file_get_contents(JB_CO_FICHIER_ACCUEIL) : $sErreurAccueil; } else $sHeadTitre = 'Codulle : Source de '.$sNomFichier; // liens sur le titre qui contient le chemin où l'utilisateur se trouve else { $sAdresse = $sLien = ''; $sPuceChemin = '<img src="'.JB_CO_DOSSIER_THEMES.JB_CO_DOSSIER_THEME_ACTIF.'images/puce_chemin.png" alt=">>" />'; for( $i = 0 ; $i < $iNiveau - 1 ; $i++ ) { $sLien .= ( $i !== 0 ) ? '/'.$aDossiers[$i] : $aDossiers[$i]; $sAdresse .= $sPuceChemin.' <a href="'.$_SERVER['PHP_SELF'].'?rep=' } } // Informations du fichier ouvert $sNomFichierOuvert = $sTailleFichierOuvert = $sLanguageFichierOuvert = '-'; { $sNomFichierOuvert = $sNomFichier; if( isset($oGeshi) ) $sTailleFichierOuvert .= ' ('.(substr_count($sFichierContenu, "\n") + 1).' lignes)'; } // ==================== // AFFICHAGE // require_once( JB_CO_DOSSIER_THEMES.JB_CO_DOSSIER_THEME_ACTIF.JB_CO_FICHIER_THEME ); ?>