Source de affiche_source.php
<?
require ("page.inc");
require ("toolbox.inc");
$currentPage = new Page();
$currentPage->setCreationDate("2002-12-17");
if (!isset($_GET["source"]))
{
$_GET["source"] = "";
}
$basefilename = strip_tags(basename($_GET["source"]));
$isForum = ereg("forums/",$_GET["source"]);
$isJs = ereg("js/",$_GET["source"]);
$isLesson = ereg("cours/",$_GET["source"]);
if ($isForum)
{
$basefilename = FORUM_DIR.$basefilename;
}
else if($isJs)
{
$basefilename = JS_DIR.$basefilename;
}
else if($isLesson)
{
$basefilename = 'cours/'.$basefilename;
}
$currentPage->setKeywords("source, site, php, css, télécharger, $basefilename");
$currentPage->setDescription("Les sources du fichier $basefilename utilisé par ce site.");
$currentPage->setTitle($basefilename);
$currentPage->setHomePage("Retour aux sources du site","/site_sources.php");
$currentPage->setBreadCrumb(array(
"Boîte à outils" => "/boite.php"
));
getSourcesArray($sources_array, $themes_array, $forums_array, $js_array);
$sources_count = count($sources_array);
$themes_count = count($themes_array);
$forums_count = count($forums_array);
$js_count = count($js_array);
$topics = array();
for ($index = 0; $index<$sources_count; $index++)
{
$source_name = $sources_array[$index];
$topics[$source_name] = "affiche_source.php?source=$source_name";
}
for ($index = 0; $index<$js_count; $index++)
{
$source_name = JS_DIR.$js_array[$index];
$topics[$source_name] = "affiche_source.php?source=$source_name";
}
for ($index = 0; $index<$forums_count; $index++)
{
$source_name = FORUM_DIR.$forums_array[$index];
$topics[$source_name] = "affiche_source.php?source=$source_name";
}
for ($index = 0; $index<$themes_count; $index++)
{
$source_name = $themes_array[$index];
$topics[$source_name] = "affiche_source.php?source=$source_name";
}
$currentPage->setSectionContent("Sources du site", $topics);
if (ereg("\.css$",$basefilename))
{
$filenameToOpen = $_SERVER["DOCUMENT_ROOT"].THEMES_DIR.$basefilename;
}
else
{
$filenameToOpen = $_SERVER["DOCUMENT_ROOT"]."/".$basefilename;
}
@ $fp = fopen($filenameToOpen, "r");
$currentPage->setContent('');
$currentPage->setPageTitle('Source de '.$basefilename);
if ($fp && !ereg("^\.",$basefilename) && ereg("\.php$|\.inc$|\.css$|\.js$",$basefilename) && (!ereg(LOGIN_FILE,$basefilename)))
{
fclose ($fp);
$formatted_source = highlight_file($filenameToOpen,true);
$formatted_source = str_replace ("<code>","", $formatted_source);
$formatted_source = str_replace ("</code>","", $formatted_source);
$formatted_source = str_replace ("<font","<span", $formatted_source);
$formatted_source = str_replace ("</font>","</span>", $formatted_source);
$formatted_source = str_replace ("color=\"#000000\"", "", $formatted_source);
$formatted_source = str_replace ("color=\"", "style=\"color:", $formatted_source);
$formatted_source = str_replace ("<br />", "<br />\n", $formatted_source);
if (ereg("\.php$",$basefilename) && !ereg(NO_VIEW_LINK_PATTERN,$basefilename))
{
$viewLink = "\n<div class=\"download\"><a href=\"/".$basefilename."\" title=\"Voir la page dont le source est affiché telle qu'elle est sur le site\">";
$viewLink .= "Voir la page $basefilename";
$viewLink .="</a></div>\n";
}
else
{
$viewLink = "\n";
}
$currentPage->setIntroduction($viewLink);
$currentPage->addChapter('', '', '
<div class="source">
'.$formatted_source.'
</div>
');
}
else
{
@ fclose($fp);
$currentPage->setPageTitle('Fichier introuvable');
$currentPage->setIntroduction('<p>Le fichier '.$basefilename.' n\'existe pas</p>');
}
$currentPage->setExtra('<div id="forum-link">Si avez des problèmes ou des questions concernant ce fichier source, vous pouvez utiliser le <a href="/forums/sources/">Forum Sources du site</a></div>');
$currentPage->display();
?>
require ("page.inc");
require ("toolbox.inc");
$currentPage = new Page();
$currentPage->setCreationDate("2002-12-17");
if (!isset($_GET["source"]))
{
$_GET["source"] = "";
}
$basefilename = strip_tags(basename($_GET["source"]));
$isForum = ereg("forums/",$_GET["source"]);
$isJs = ereg("js/",$_GET["source"]);
$isLesson = ereg("cours/",$_GET["source"]);
if ($isForum)
{
$basefilename = FORUM_DIR.$basefilename;
}
else if($isJs)
{
$basefilename = JS_DIR.$basefilename;
}
else if($isLesson)
{
$basefilename = 'cours/'.$basefilename;
}
$currentPage->setKeywords("source, site, php, css, télécharger, $basefilename");
$currentPage->setDescription("Les sources du fichier $basefilename utilisé par ce site.");
$currentPage->setTitle($basefilename);
$currentPage->setHomePage("Retour aux sources du site","/site_sources.php");
$currentPage->setBreadCrumb(array(
"Boîte à outils" => "/boite.php"
));
getSourcesArray($sources_array, $themes_array, $forums_array, $js_array);
$sources_count = count($sources_array);
$themes_count = count($themes_array);
$forums_count = count($forums_array);
$js_count = count($js_array);
$topics = array();
for ($index = 0; $index<$sources_count; $index++)
{
$source_name = $sources_array[$index];
$topics[$source_name] = "affiche_source.php?source=$source_name";
}
for ($index = 0; $index<$js_count; $index++)
{
$source_name = JS_DIR.$js_array[$index];
$topics[$source_name] = "affiche_source.php?source=$source_name";
}
for ($index = 0; $index<$forums_count; $index++)
{
$source_name = FORUM_DIR.$forums_array[$index];
$topics[$source_name] = "affiche_source.php?source=$source_name";
}
for ($index = 0; $index<$themes_count; $index++)
{
$source_name = $themes_array[$index];
$topics[$source_name] = "affiche_source.php?source=$source_name";
}
$currentPage->setSectionContent("Sources du site", $topics);
if (ereg("\.css$",$basefilename))
{
$filenameToOpen = $_SERVER["DOCUMENT_ROOT"].THEMES_DIR.$basefilename;
}
else
{
$filenameToOpen = $_SERVER["DOCUMENT_ROOT"]."/".$basefilename;
}
@ $fp = fopen($filenameToOpen, "r");
$currentPage->setContent('');
$currentPage->setPageTitle('Source de '.$basefilename);
if ($fp && !ereg("^\.",$basefilename) && ereg("\.php$|\.inc$|\.css$|\.js$",$basefilename) && (!ereg(LOGIN_FILE,$basefilename)))
{
fclose ($fp);
$formatted_source = highlight_file($filenameToOpen,true);
$formatted_source = str_replace ("<code>","", $formatted_source);
$formatted_source = str_replace ("</code>","", $formatted_source);
$formatted_source = str_replace ("<font","<span", $formatted_source);
$formatted_source = str_replace ("</font>","</span>", $formatted_source);
$formatted_source = str_replace ("color=\"#000000\"", "", $formatted_source);
$formatted_source = str_replace ("color=\"", "style=\"color:", $formatted_source);
$formatted_source = str_replace ("<br />", "<br />\n", $formatted_source);
if (ereg("\.php$",$basefilename) && !ereg(NO_VIEW_LINK_PATTERN,$basefilename))
{
$viewLink = "\n<div class=\"download\"><a href=\"/".$basefilename."\" title=\"Voir la page dont le source est affiché telle qu'elle est sur le site\">";
$viewLink .= "Voir la page $basefilename";
$viewLink .="</a></div>\n";
}
else
{
$viewLink = "\n";
}
$currentPage->setIntroduction($viewLink);
$currentPage->addChapter('', '', '
<div class="source">
'.$formatted_source.'
</div>
');
}
else
{
@ fclose($fp);
$currentPage->setPageTitle('Fichier introuvable');
$currentPage->setIntroduction('<p>Le fichier '.$basefilename.' n\'existe pas</p>');
}
$currentPage->setExtra('<div id="forum-link">Si avez des problèmes ou des questions concernant ce fichier source, vous pouvez utiliser le <a href="/forums/sources/">Forum Sources du site</a></div>');
$currentPage->display();
?>
Si avez des problèmes ou des questions concernant ce fichier source, vous pouvez utiliser le Forum Sources du site