| Fichier source |
projets.php
[ 0]
<?php
[ 1]require_once "include/global.php";
[ 2]require_once "include/preferences.php";
[ 3]require_once "include/menubar.php";
[ 4]require_once "include/xml_historique.php";
[ 5]
[ 6]$initialiser_preferences();
[ 7]$entete_html();
[ 8]afficher_top_bar();
[ 9]
[ 10]debut_mosaique_horizontale();
[ 11]
[ 12]$rep=opendir('./projets');
[ 13]unset($liste);
[ 14]unset($descripteur);
[ 15]
[ 16]while ($file = readdir($rep))
[ 17]{
[ 18] if (($file <> ".") and ($file <>".."))
[ 19] {
[ 20] $tmp = "./projets/" . $file;
[ 21] if (is_dir($tmp))
[ 22] {
[ 23] $repertoire[] = $tmp;
[ 24] }
[ 25] }
[ 26]}
[ 27]
[ 28]// Projetc's left Bar
[ 29]$T = "<B>Il y a " . sizeof($repertoire) ." projets en ligne</b>";
[ 30]$encadre( $T, 140, $COL_bg_yellow, "Projets" );
[ 31]echo "<BR>\n";
[ 32]
[ 33]// Standard Left Bar
[ 34]afficher_standard_left_bar();
[ 35]fin_mosaique_gauche();
[ 36]
[ 37]// Begin of the main Bar
[ 38]for ($nb_desc=0; $nb_desc<sizeof($repertoire); $nb_desc++)
[ 39]{
[ 40] // Display the descriptions of the project
[ 41] $T = "";
[ 42] $path = $repertoire[$nb_desc] ."/desc.txt" ;
[ 43] $fd = fopen($path, "r");
[ 44] $contents = fread($fd, filesize ($path));
[ 45] fclose($fd);
[ 46] //$contents = nl2br($contents);
[ 47] $T .= $contents;
[ 48]
[ 49] // Display the images
[ 50] $rep = opendir($repertoire[$nb_desc]);
[ 51] while ($file = readdir($rep))
[ 52] {
[ 53] if (($file <> ".") and ($file <>".."))
[ 54] {
[ 55] $dir = $repertoire[$nb_desc]."/";
[ 56] $path = $dir . $file;
[ 57] $suffixe = substr (strrchr($file, "."), 1);
[ 58] $suffixe = strtolower($suffixe);
[ 59] if ($suffixe=="jpg")
[ 60] {
[ 61] if (substr($file,0,4)!='tmb.')
[ 62] {
[ 63] $tmp = $dir.'tmb.'.$file;
[ 64] if (!file_exists($tmp))
[ 65] {
[ 66] echo 'fabrication du thumbnail pour '.$file.'<BR>';
[ 67] $src_img = imagecreatefromjpeg($dir.$file);
[ 68] $file_width = 100;
[ 69] $file_eight = imagesy($src_img) / imagesx($src_img) * 100;
[ 70] $dst_img = imagecreate($file_width,$file_eight);
[ 71] imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $file_width, $file_eight, imagesx($src_img), imagesy($src_img));
[ 72] imagejpeg($dst_img, $tmp);
[ 73] }
[ 74] else
[ 75] {
[ 76] $T .= "<A href=\"$path\">\n";
[ 77] $T .= "<IMG border=0 src=\"$tmp\" width=100 alt=\"$file\">\n";
[ 78] $T .= "</a>\n";
[ 79] }
[ 80] }
[ 81] }
[ 82] }
[ 83] }
[ 84]
[ 85] // Display the files
[ 86] $T .= "<H3>Fichiers à télécharger: </H3>\n";
[ 87] $T .= "<UL>\n";
[ 88] $rep = opendir($repertoire[$nb_desc]);
[ 89] $nbfiles = 0;
[ 90] while ($file = readdir($rep))
[ 91] {
[ 92] if (($file <> ".") and ($file <>".."))
[ 93] {
[ 94] $dir = $repertoire[$nb_desc]."/";
[ 95] $path = $dir . $file;
[ 96] $suffixe = substr (strrchr($file, "."), 1);
[ 97] $suffixe = strtolower($suffixe);
[ 98] if (($suffixe=="zip") or ($suffixe=="pdf"))
[ 99] {
[100] $nbfiles +=1;
[101] $T .= "<LI>";
[102] $T .= $inserer_lien( $path, $file );
[103] $T .= " : " . DownloadSize($path) . "</LI>\n";
[104] }
[105] }
[106] }
[107] if ($nbfiles == 0)
[108] {
[109] $T .= "<LI>Aucun fichier.</LI>";
[110] }
[111] $T .= "</UL>\n";
[112] $i = $nb_desc +1;
[113] $encadre( $T, $Largeur_Mainbar, $COL_bg_yellow, "Projet $i/".sizeof($repertoire) );
[114] echo "<BR>\n";
[115] //$T .= $inserer_lien( "index1.php", $contents)."<BR>";
[116] unset($fd);
[117] unset($contents);
[118]}
[119]fin_mosaique_horizontale();
[120]afficher_foot_bar();
[121]$ferme_html();
[122]?>
[123]
|
|
|