cvs: phpweb /include shared-manual.inc

From: Date: Wed, 30 Aug 2000 04:50:39 +0000
Subject: cvs: phpweb /include shared-manual.inc
Groups: php.mirrors 
Request: Send a blank email to php-mirrors+get-1874@lists.php.net to get a copy of this message
lyric Tue Aug 29 21:50:39 2000 EDT Modified files: /phpweb/include shared-manual.inc Log: Suppress warnings when using is_file() against non-existant file Index: phpweb/include/shared-manual.inc diff -u phpweb/include/shared-manual.inc:1.70 phpweb/include/shared-manual.inc:1.71 --- phpweb/include/shared-manual.inc:1.70 Wed Aug 23 21:14:42 2000 +++ phpweb/include/shared-manual.inc Tue Aug 29 21:50:39 2000 @@ -72,12 +72,12 @@ echo "<TD COLSPAN=3>"; if(substr($file,-5)=='.php3') $file = substr($file,0,-1); echo "<a href=\"/manual/$file\"><img src=\"/gifs/flag-uk.gif\" valign=bottom height=24 width=45 alt=\"English version of this page\"></a>"; - if(is_file("$DOCUMENT_ROOT/manual/de/$file")) echo "<a href=\"/manual/de/$file\"><img src=\"/gifs/flag-de.gif\" valign=bottom height=24 width=45 alt=\"German version of this page\"></a>"; - if(is_file("$DOCUMENT_ROOT/manual/ja/$file")) echo "<a href=\"/manual/ja/$file\"><img src=\"/gifs/flag-jp.gif\" valign=bottom height=24 width=45 alt=\"Japanese version of this page\"></a><br>"; - if(is_file("$DOCUMENT_ROOT/manual/it/$file")) echo "<a href=\"/manual/it/$file\"><img src=\"/gifs/flag-it.gif\" valign=bottom height=24 width=45 alt=\"Italian version of this page\"></a>"; - if(is_file("$DOCUMENT_ROOT/manual/fr/$file")) echo "<a href=\"/manual/fr/$file\"><img src=\"/gifs/flag-fr.gif\" valign=bottom height=24 width=45 alt=\"French version of this page\"></a>"; - if(is_file("$DOCUMENT_ROOT/manual/hu/$file")) echo "<a href=\"/manual/hu/$file\"><img src=\"/gifs/flag-hu.gif\" valign=bottom height=24 width=45 alt=\"Hungarian version of this page\"></a><br>"; - if(is_file("$DOCUMENT_ROOT/manual/es/$file")) echo "<a href=\"/manual/es/$file\"><img src=\"/gifs/flag-es.gif\" valign=bottom height=24 width=45 alt=\"Spanish version of this page\"></a>"; + if(@is_file("$DOCUMENT_ROOT/manual/de/$file")) echo "<a href=\"/manual/de/$file\"><img src=\"/gifs/flag-de.gif\" valign=bottom height=24 width=45 alt=\"German version of this page\"></a>"; + if(@is_file("$DOCUMENT_ROOT/manual/ja/$file")) echo "<a href=\"/manual/ja/$file\"><img src=\"/gifs/flag-jp.gif\" valign=bottom height=24 width=45 alt=\"Japanese version of this page\"></a><br>"; + if(@is_file("$DOCUMENT_ROOT/manual/it/$file")) echo "<a href=\"/manual/it/$file\"><img src=\"/gifs/flag-it.gif\" valign=bottom height=24 width=45 alt=\"Italian version of this page\"></a>"; + if(@is_file("$DOCUMENT_ROOT/manual/fr/$file")) echo "<a href=\"/manual/fr/$file\"><img src=\"/gifs/flag-fr.gif\" valign=bottom height=24 width=45 alt=\"French version of this page\"></a>"; + if(@is_file("$DOCUMENT_ROOT/manual/hu/$file")) echo "<a href=\"/manual/hu/$file\"><img src=\"/gifs/flag-hu.gif\" valign=bottom height=24 width=45 alt=\"Hungarian version of this page\"></a><br>"; + if(@is_file("$DOCUMENT_ROOT/manual/es/$file")) echo "<a href=\"/manual/es/$file\"><img src=\"/gifs/flag-es.gif\" valign=bottom height=24 width=45 alt=\"Spanish version of this page\"></a>"; echo "</TD></TR>\n"; for ($i = 0; $i < count($TOC); $i++) { @@ -210,7 +210,7 @@ <? }; -function manualGetUserNotes($title,$failover=true) +function manualGetUserNotes($title) { // either get it from local db or www.php.net/manual/get.php global $MYSITE; @@ -230,11 +230,12 @@ } } } else { - if ($failover) { - $url = "http://www.php.net/manual/get-user-notes.php?title=".urlencode($title); - $fp = @fopen($url,"r"); + $notes_file = "usernotes/" . urlencode( $title ) . ".txt"; + if ( @file_exists( $notes_file ) ) + { + $fp = @fopen($notes_file,"r"); if ($fp) { - $body = fread($fp,100000); + $body = fread($fp,filesize($notes_file)); if (strlen($body)) { $notes = @unserialize($body); } @@ -245,7 +246,6 @@ return $notes; } - function manualUserNotes($title) { global $PHP_SELF, $SERVER_NAME, $SERVER_PORT; $cur = substr(dirname($PHP_SELF),-2); @@ -256,12 +256,8 @@ echo '<INPUT type=hidden name="sect" value="'.$title.'">'; echo "<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 width=100%>\n"; - - // is this the correct way to do this? -# include("../configuration.inc"); - $failover = isset($failover_user_notes) && $failover_user_notes; - $notes = manualGetUserNotes($title,$failover); + $notes = manualGetUserNotes($title); $num_notes = count($notes); if ( $num_notes > 0 ) { makeTitle("User Contributed Notes: ".$title);

« previous php.mirrors (#1874) next »