cvs: phpweb / index.php /include layout.inc

From: Date: Fri, 02 May 2003 20:56:39 +0000
Subject: cvs: phpweb / index.php /include layout.inc
Groups: php.mirrors 
Request: Send a blank email to php-mirrors+get-17231@lists.php.net to get a copy of this message
goba Fri May 2 16:56:39 2003 EDT Modified files: /phpweb index.php /phpweb/include layout.inc Log: Apply E_ALL fixes provided by Hans Zaunere with slight modifications Also remove all whitespace at the end of lines Use !empty() instead of isset() in sidebar checking, so it will work if the variable is set, but empty Index: phpweb/index.php diff -u phpweb/index.php:1.368 phpweb/index.php:1.369 --- phpweb/index.php:1.368 Mon Apr 28 18:22:21 2003 +++ phpweb/index.php Fri May 2 16:56:38 2003 @@ -1,5 +1,5 @@ <?php -/* +/* If you're reading this, it isn't because you've found a security hole. this is an open source website. read and learn! */ @@ -11,8 +11,8 @@ /* The date of prepend.inc represents the age of ALL - included files. Please touch it if you modify an - another include file (and the modification affects + included files. Please touch it if you modify any + other include file (and the modification affects the display of the index page). The cost of stat'ing them all is prohibitive. Also note the file path, we aren't using the include path here. @@ -29,7 +29,8 @@ $tsstring = gmdate("D, d M Y H:i:s ", $timestamp) . "GMT"; // Check if the client has the same page cached -if ($_SERVER["HTTP_IF_MODIFIED_SINCE"] == $tsstring) { +if (isset($_SERVER["HTTP_IF_MODIFIED_SINCE"]) && + ($_SERVER["HTTP_IF_MODIFIED_SINCE"] == $tsstring)) { header("HTTP/1.1 304 Not Modified"); exit(); } @@ -61,7 +62,7 @@ </p> <p> -PHP is a project of the ' . +PHP is a project of the ' . make_link("http://www.apache.org/","Apache Software Foundation") . '. </p> @@ -100,12 +101,15 @@ // image types in priority order $types = array("gif", "jpg", "png"); +// Default right sidebar +$RSIDEBAR_DATA = ''; + // Go through all possible types while (list(,$ext) = each($types)) { - + // Check if file exists for this type if (file_exists("backend/mirror." . $ext)) { - + // Add text to rigth sidebar $RSIDEBAR_DATA .= "<div align=\"center\"><h3>This mirror sponsored by:</h3>\n"; @@ -118,7 +122,7 @@ 'backend', 0 ); - + // Add size information depending on mirror type if (is_primary_site() || is_backup_primary()) { $img = resize_image($img, 125, 125); @@ -127,9 +131,9 @@ } // End mirror specific part - $RSIDEBAR_DATA .= make_link(mirror_provider_url(), $img) . + $RSIDEBAR_DATA .= make_link(mirror_provider_url(), $img) . '</div><br />' . hdelim(); - + // We have found an image break; } @@ -140,13 +144,13 @@ // If we were able to open the file if ($fp) { - + // Current month number (for delimiter additions) $cm = 0; - + // Event duplication check hash $seen = array(); - + // While we can read the events file while (!feof($fp)) { @@ -156,14 +160,14 @@ // Fgetcvs() returns an array with a single null element // for a blank line, which we need to skip if ($d === NULL) { continue; } - + // If the month number changed - if ($cm != (int) $m) { - + if ($cm != (int) $m) { + // If we are not at the begining if ($cm) { $RSIDEBAR_DATA .= "<br />\n"; - } + } // If we are at the begining else { $RSIDEBAR_DATA .= '<div align="center"><h3>Upcoming Events<br /><a href="submit-event.php">[add event]</a></h3></div>'; @@ -171,22 +175,22 @@ // Update current month information $cm = (int) $m; - + // Add month name - $RSIDEBAR_DATA .= "<h4>" . strftime('%B', mktime(12, 0, 0, $cm, $d, $y)) . "</h4>\n"; - + $RSIDEBAR_DATA .= "<h4>" . strftime('%B', mktime(12, 0, 0, $cm, $d, $y)) . "</h4>\n"; + // We have not seen any events in this month $seen = array(); } - + // There is no event with this description in this month - if (!$seen[$desc]) { + if (!isset($seen[$desc])) { // Add event to sidebar $RSIDEBAR_DATA .= "$d. <a href=\"cal.php?id=$id\">" . htmlspecialchars(stripslashes($desc)) . "</a><br />\n"; // Set seen flag - $seen[$desc] = true; + $seen[$desc] = TRUE; } } @@ -204,9 +208,9 @@ <h1>PHP 4.3.2RC2 Released</h1> <p> <font class="newsdate">[29-Apr-2003]</font> -<a href="http://qa.php.net/">PHP 4.3.2RC2</a> has been released. +<a href="http://qa.php.net/">PHP 4.3.2RC2</a> has been released. This is the second release candidate and should have no critical problems/bugs. -Nevertheless, please download and test it as much as possible on real-life +Nevertheless, please download and test it as much as possible on real-life applications to uncover any remaining issues. </p> Index: phpweb/include/layout.inc diff -u phpweb/include/layout.inc:1.139 phpweb/include/layout.inc:1.140 --- phpweb/include/layout.inc:1.139 Thu May 1 09:11:11 2003 +++ phpweb/include/layout.inc Fri May 2 16:56:38 2003 @@ -1,6 +1,6 @@ <?php -/* $Id: layout.inc,v 1.139 2003/05/01 13:11:11 goba Exp $ */ +/* $Id: layout.inc,v 1.140 2003/05/02 20:56:38 goba Exp $ */ // Print an image for a sized spacer function spacer($width = 1, $height = 1, $return = false, $align = false, $extras = false) @@ -282,7 +282,7 @@ <table border="0" cellpadding="0" cellspacing="0"> <tr valign="top"> -<?php if (isset($SIDEBAR_DATA)):?> +<?php if (!empty($SIDEBAR_DATA)):?> <td width="200" bgcolor="#f0f0f0"> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr valign="top"><td class="sidebar"><?php echo $SIDEBAR_DATA?></td></tr> @@ -312,7 +312,7 @@ $enclosed, $RSIDEBAR_DATA, $page_creation_start; if ($enclosed) { echo "</td></tr></table></td>"; - if(isset($RSIDEBAR_DATA)) {?> + if (!empty($RSIDEBAR_DATA)) { ?> <td bgcolor="#cccccc" background="/images/checkerboard.gif" width="1"><?php spacer(); ?></td> <td width="175" bgcolor="#f0f0f0"> <table width="100%" cellpadding="4" cellspacing="0">

« previous php.mirrors (#17231) next »