cvs: phpweb / download-docs.php

From: Date: Sat, 28 Dec 2002 12:35:09 +0000
Subject: cvs: phpweb / download-docs.php
Groups: php.mirrors 
Request: Send a blank email to php-mirrors+get-14526@lists.php.net to get a copy of this message
goba Sat Dec 28 07:35:09 2002 EDT Modified files: /phpweb download-docs.php Log: Simplify formats array. Only check for files, named php_manual_LANGCODE.FORMAT as all the files are named this way now. This speeds up the page display a bit, and simplifies the code used. Also end the table row normally, and not with a new <tr> ;) Index: phpweb/download-docs.php diff -u phpweb/download-docs.php:1.38 phpweb/download-docs.php:1.39 --- phpweb/download-docs.php:1.38 Sat Dec 28 07:02:39 2002 +++ phpweb/download-docs.php Sat Dec 28 07:35:08 2002 @@ -35,14 +35,14 @@ commonHeader("Download documentation"); -// array structure: (filename => header, extension) +// Available formats $formats = array( - "bigmanual.html.bz2" => array("Single HTML", "html.bz2"), - "manual.tar.bz2" => array("Many HTML files", "tar.bz2"), - //"php_manual_LANG.pdf.bz2" => array("PDF", "pdf.bz2"), - "manual_doc.pdb" => array("PalmPilot DOC", "doc.pdb"), - "manual_isilo.pdb" => array("PalmPilot iSilo", "isilo.pdb"), - "manual-LANG.chm" => array("Windows HTML Help", "chm") + "Single HTML" => "html.bz2", + "Many HTML files" => "tar.bz2", + //"PDF" => "pdf.bz2", + "PalmPilot DOC" => "doc.pdb", + "PalmPilot iSilo" => "isilo.pdb", + "Windows HTML Help" => "chm" ); ?> @@ -74,8 +74,8 @@ <td>&nbsp;</td> <?php // Print out the name of the formats -foreach ($formats as $fname => $details) { - echo " <th valign=\"bottom\">$details[0]</th>\n"; +foreach ($formats as $formatname => $extension) { + echo " <th valign=\"bottom\">$formatname</th>\n"; } ?> </tr> @@ -88,41 +88,21 @@ $files = array(); $formatnum = 0; // Go through all possible manual formats - foreach ($formats as $fname => $details) { + foreach ($formats as $formatname => $extension) { - // Reset link target - $link_to = ""; - - // File named after the format exists [old!] - if (file_exists("manual/$langcode/$fn")) { - $link_to = "manual/$langcode/$fn"; - } - // File named after the language and format exists - elseif (file_exists("distributions/manual/php_manual_$langcode.$details[1]")) { - $link_to = "distributions/manual/php_manual_$langcode.$details[1]"; - } - - // File named after the language and format exists [old!] - elseif (file_exists("distributions/manual/manual-$langcode.$details[1]")) { - $link_to = "distributions/manual/manual-$langcode.$details[1]"; - } - - // Unable to find file - if (!$link_to) { - $files[] = ''; - } - - // File found - else { + if (file_exists("distributions/manual/php_manual_$langcode.$extension")) { + // Relative file path from here + $link_to = "distributions/manual/php_manual_$langcode.$extension"; + // Try to get size and changed date $size = @filesize($link_to); $changed = @filemtime($link_to); // Size available, collect information if ($size) { - $files[] = array($link_to, (int) ($size/1024), date("j M Y", $changed), $details[1]); + $files[] = array($link_to, (int) ($size/1024), date("j M Y", $changed), $formatname); $formatnum++; } @@ -131,6 +111,11 @@ $files[] = ''; } } + + // Unable to find file + else (!$link_to) { + $files[] = ''; + } } // At least one format is found for this @@ -167,6 +152,9 @@ // End table cell echo "</td>\n"; } + + // End table row + echo "</tr>\n"; } } ?>

« previous php.mirrors (#14526) next »