cvs: phpweb /include shared-manual.inc site.inc

From: Date: Sat, 27 Jan 2001 09:37:38 +0000
Subject: cvs: phpweb /include shared-manual.inc site.inc
Groups: php.mirrors 
Request: Send a blank email to php-mirrors+get-3621@lists.php.net to get a copy of this message
goba Sat Jan 27 01:37:38 2001 EDT Modified files: /phpweb/include site.inc shared-manual.inc Log: Automating the manual flags. I hope it will work fine :)

Index: phpweb/include/site.inc diff -u phpweb/include/site.inc:1.129 phpweb/include/site.inc:1.130 --- phpweb/include/site.inc:1.129 Fri Jan 26 13:13:20 2001 +++ phpweb/include/site.inc Sat Jan 27 01:37:37 2001 @@ -6,7 +6,7 @@ 3 "url for hosting company", 4 flag for whether site is a full mirror (1) or just a download site (0), or just a placeholder (2), 5 flag for whether search engine works (1) or not (0) on the site - 6 default language code + 6 default language code */ $MIRRORS = array( Index: phpweb/include/shared-manual.inc diff -u phpweb/include/shared-manual.inc:1.84 phpweb/include/shared-manual.inc:1.85 --- phpweb/include/shared-manual.inc:1.84 Fri Jan 26 18:22:08 2001 +++ phpweb/include/shared-manual.inc Sat Jan 27 01:37:37 2001 @@ -16,14 +16,14 @@ $PREV = @$data["prev"]; $UP = @$data["up"]; $TOC = @$data["toc"]; - $tstamp = gmdate("D, d M Y",getlastmod()); + $tstamp = gmdate("D, d M Y",getlastmod()); } function makeBullet($url,$number,$offtype,$offnum) { - echo "<A HREF=\"$url\" onMouseover=\"hide();changebullet('bullet$number',1)\" \n"; - echo "onMouseout=\"changebullet('bullet$number',$offnum)\">"; - echo "<IMG SRC=\"/gifs/b-bullet-$offtype.gif\" \n WIDTH=10 HEIGHT=10 HSPACE=2 VSPACE=2 BORDER=0 \n ALT=\"*\" NAME=\"bullet$number\">"; - echo "</A>"; + echo "<A HREF=\"$url\" onMouseover=\"hide();changebullet('bullet$number',1)\" \n"; + echo "onMouseout=\"changebullet('bullet$number',$offnum)\">"; + echo "<IMG SRC=\"/gifs/b-bullet-$offtype.gif\" \n WIDTH=10 HEIGHT=10 HSPACE=2 VSPACE=2 BORDER=0 \n ALT=\"*\" NAME=\"bullet$number\">"; + echo "</A>"; } function makeBorderTOC($this) @@ -38,23 +38,37 @@ echo "<TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 WIDTH=\"100%\">\n"; $this = eregi_replace("^Manual: *", "", $this); - $cur = substr(dirname($PHP_SELF),-3); - $file = basename($PHP_SELF); - echo "<TR VALIGN=top>\n"; + $cur = substr(dirname($PHP_SELF),-3); + $file = basename($PHP_SELF); + echo "<TR VALIGN=top>\n"; echo "<TD COLSPAN=3>"; - if(substr($file,-5)=='.php3') $file = substr($file,0,-1); - echo "<a href=\"/manual/en/$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/nl/$file")) echo "<a href=\"/manual/nl/$file\"><img src=\"/gifs/flag-nl.gif\" valign=bottom height=24 width=45 alt=\"Dutch version of this page\"></a>"; - if(@is_file("$DOCUMENT_ROOT/manual/pt_BR/$file")) echo "<a href=\"/manual/pt_BR/$file\"><img src=\"/gifs/flag-br.gif\" valign=bottom height=24 width=45 alt=\"Brazilian Portuguese version of this page\"></a><br>"; - if(@is_file("$DOCUMENT_ROOT/manual/kr/$file")) echo "<a href=\"/manual/kr/$file\"><img src=\"/gifs/flag-kr.gif\" valign=bottom height=24 width=45 alt=\"Korean version of this page\"></a>"; - if(@is_file("$DOCUMENT_ROOT/manual/cs/$file")) echo "<a href=\"/manual/cs/$file\"><img src=\"/gifs/flag-cz.gif\" valign=bottom height=24 width=45 alt=\"Czech version of this page\"></a>"; - echo "</TD></TR>\n"; + if(substr($file,-5)=='.php3') $file = substr($file,0,-1); + + // manual languages array [directory, flag code, language] + $manual_languages = Array ( + Array("en", "uk", "English"), + Array("de", "de", "German"), + Array("ja", "jp", "Japanese"), + + Array("it", "it", "Italian"), + Array("fr", "fr", "French"), + Array("hu", "hu", "Hungarian"), + + Array("es", "es", "Spanish"), + Array("nl", "nl", "Dutch"), + Array("pt_BR", "br", "Brazilian Portuguese"), + + Array("kr", "kr", "Korean"), + Array("cs", "cz", "Czech") + ); + + while (list($lang_num, $lang_data) = each ($manual_languages)) { + if (@is_file("$DOCUMENT_ROOT/manual/$lang_data[0]/$file")) echo "<a href=\"/manual/$lang_data[0]/$file\"><img src=\"/gifs/flag-$lang_data[1].gif\" valign=bottom height=24 width=45 alt=\"$lang_data[2] version of this page\"></a>"; + else echo "<img src=\"/gifs/flag-xx.gif\" valign=bottom height=24 width=45 alt=\"$lang_data[2] version of this page is not available\"></a>"; + if ($lang_num % 3 == 2) { echo '<br>'; } + } + + echo "</TD></TR>\n"; echo "<TR VALIGN=top>\n"; echo "<TD WIDTH=10>"; @@ -65,34 +79,34 @@ echo "<B>$UP[1]</B></FONT></A></TD></TR>\n"; for ($i = 0; $i < count($TOC); $i++) { - list($url, $title) = $TOC[$i]; - if (!$url || !$title) { - continue; - } - if ($title == $this) { - $type = "w"; - $out = 2; - } else { - $type = "p"; - $out = 0; - } - if ($UP[0] == 'funcref.php') { - $title = eregi_replace(" functions\$", "", $title); - } - echo "<TR VALIGN=top><TD WIDTH=10>"; - spc(10,10); - echo "</TD>\n<TD WIDTH=15><A HREF=\"$url\" "; - echo "onMouseover=\"hide();changebullet('bullet$i',1)\" \n"; - echo "onMouseout=\"changebullet('bullet$i',$out)\">"; - echo "<IMG SRC=\"/gifs/b-bullet-$type.gif\" WIDTH=10 HEIGHT=10 ALT=\"*\" BORDER=0 NAME=\"bullet$i\"></A>\n"; - echo "</TD>\n<TD WIDTH=100%>"; - echo "<A HREF=\"$url\" onMouseover=\"hide();"; - echo "changebullet('bullet$i',1)\" \n "; - echo "onMouseout=\"changebullet('bullet$i',$out)\" \n"; - echo "CLASS=sidebartoc>"; - echo "<FONT SIZE=\"$tocfontsize\"".$FONTCOL.$FONTFACEATTR.">"; - echo "$title</FONT></A></TD></TR>\n"; + list($url, $title) = $TOC[$i]; + if (!$url || !$title) { + continue; + } + if ($title == $this) { + $type = "w"; + $out = 2; + } else { + $type = "p"; + $out = 0; + } + if ($UP[0] == 'funcref.php') { + $title = eregi_replace(" functions\$", "", $title); } + echo "<TR VALIGN=top><TD WIDTH=10>"; + spc(10,10); + echo "</TD>\n<TD WIDTH=15><A HREF=\"$url\" "; + echo "onMouseover=\"hide();changebullet('bullet$i',1)\" \n"; + echo "onMouseout=\"changebullet('bullet$i',$out)\">"; + echo "<IMG SRC=\"/gifs/b-bullet-$type.gif\" WIDTH=10 HEIGHT=10 ALT=\"*\" BORDER=0 NAME=\"bullet$i\"></A>\n"; + echo "</TD>\n<TD WIDTH=100%>"; + echo "<A HREF=\"$url\" onMouseover=\"hide();"; + echo "changebullet('bullet$i',1)\" \n "; + echo "onMouseout=\"changebullet('bullet$i',$out)\" \n"; + echo "CLASS=sidebartoc>"; + echo "<FONT SIZE=\"$tocfontsize\"".$FONTCOL.$FONTFACEATTR.">"; + echo "$title</FONT></A></TD></TR>\n"; + } echo "</TABLE>\n"; }; @@ -101,23 +115,23 @@ global $navBarNo; $no = $navBarNo; if ($title!="Show Source") { - echo("<!-- start next/prev -->\n"); - echo "<TABLE BORDER=0 WIDTH=100% BGCOLOR='#D0D0D0' CELLPADDING=0 CELLSPACING=0>\n"; - echo "<TR VALIGN=middle>\n"; - echo "<TD ALIGN=left WIDTH=18><IMG SRC='/gifs/gcap-left.gif' ALT=' ' WIDTH=18 HEIGHT=36 BORDER=0><BR></TD>\n"; - if ($PREV[0] && $PREV[1]) { - echo "<TD ALIGN=left WIDTH=75><A HREF=\"$PREV[0]\" onMouseover=\"change('prev$no',1);\" onMouseout=\"hide();\"><IMG SRC='/gifs/b-prev-p.gif' ALT='Previous page' WIDTH=75 HEIGHT=21 VSPACE=7 BORDER=0 NAME='prev$no' align=absmiddle></A><BR></TD>\n"; - } - echo "<TD ALIGN=left WIDTH=44%><FONT FACE='$FONTFACE' SIZE=-1>&nbsp;$PREV[1]<BR></FONT></TD>\n"; - echo "<TD ALIGN=center WIDTH=12% nobr><FONT FACE='$FONTFACE' SIZE=-2>&nbsp;Updated<br>$tstamp<BR></FONT></TD>\n"; - echo "<TD ALIGN=right WIDTH=44%><FONT FACE='$FONTFACE' SIZE=-1>$NEXT[1]&nbsp;<BR></FONT></TD>\n"; - if ($NEXT[0] && $NEXT[1]) { - echo "<TD ALIGN=left WIDTH=75><A HREF=\"$NEXT[0]\" onMouseover=\"change('next$no',1);\" onMouseout=\"hide();\"><IMG SRC='/gifs/b-next-p.gif' ALT='Next page' WIDTH=75 HEIGHT=21 VSPACE=7 BORDER=0 NAME='next$no' align=absmiddle></A><BR></TD>\n"; - } - echo "<TD ALIGN=right WIDTH=18><IMG SRC='/gifs/gcap-right.gif' alt=' ' WIDTH=18 HEIGHT=36 BORDER=0><BR></TD>\n"; - echo "</TR></TABLE>\n"; - echo "<BR>\n"; - $navBarNo = (string)((int)$navBarNo + 2); + echo("<!-- start next/prev -->\n"); + echo "<TABLE BORDER=0 WIDTH=100% BGCOLOR='#D0D0D0' CELLPADDING=0 CELLSPACING=0>\n"; + echo "<TR VALIGN=middle>\n"; + echo "<TD ALIGN=left WIDTH=18><IMG SRC='/gifs/gcap-left.gif' ALT=' ' WIDTH=18 HEIGHT=36 BORDER=0><BR></TD>\n"; + if ($PREV[0] && $PREV[1]) { + echo "<TD ALIGN=left WIDTH=75><A HREF=\"$PREV[0]\" onMouseover=\"change('prev$no',1);\" onMouseout=\"hide();\"><IMG SRC='/gifs/b-prev-p.gif' ALT='Previous page' WIDTH=75 HEIGHT=21 VSPACE=7 BORDER=0 NAME='prev$no' align=absmiddle></A><BR></TD>\n"; + } + echo "<TD ALIGN=left WIDTH=44%><FONT FACE='$FONTFACE' SIZE=-1>&nbsp;$PREV[1]<BR></FONT></TD>\n"; + echo "<TD ALIGN=center WIDTH=12% nobr><FONT FACE='$FONTFACE' SIZE=-2>&nbsp;Updated<br>$tstamp<BR></FONT></TD>\n"; + echo "<TD ALIGN=right WIDTH=44%><FONT FACE='$FONTFACE' SIZE=-1>$NEXT[1]&nbsp;<BR></FONT></TD>\n"; + if ($NEXT[0] && $NEXT[1]) { + echo "<TD ALIGN=left WIDTH=75><A HREF=\"$NEXT[0]\" onMouseover=\"change('next$no',1);\" onMouseout=\"hide();\"><IMG SRC='/gifs/b-next-p.gif' ALT='Next page' WIDTH=75 HEIGHT=21 VSPACE=7 BORDER=0 NAME='next$no' align=absmiddle></A><BR></TD>\n"; + } + echo "<TD ALIGN=right WIDTH=18><IMG SRC='/gifs/gcap-right.gif' alt=' ' WIDTH=18 HEIGHT=36 BORDER=0><BR></TD>\n"; + echo "</TR></TABLE>\n"; + echo "<BR>\n"; + $navBarNo = (string)((int)$navBarNo + 2); } } @@ -137,7 +151,7 @@ }; function makeEntry($date,$name,$blurb,$id=0) { - global $FONTFACE, $MAGIC_COOKIE; + global $FONTFACE, $MAGIC_COOKIE; ?> <TR VALIGN=top> <TD ALIGN=left><? spc(18,18);?><BR></TD> @@ -147,7 +161,7 @@ <TR><TD> <? echo "<FONT FACE=\"$FONTFACE\" SIZE=-1>\n"; - $name = htmlspecialchars($name); + $name = htmlspecialchars($name); if (ereg("(.+)@(.+)\.(.+)",$name)) { echo "<A HREF=\"mailto:".$name."\">".$name."</A><BR>\n"; } else { @@ -197,106 +211,106 @@ function manualGetUserNotes($title, $id) { - // if we're www.php.net, get it from the local DB - // otherwise look in "/manual/usernotes/$title.txt" (if present) - global $MYSITE; - $notes = array(); - if(strstr($MYSITE,"www.php.net")) { -# if(strstr($MYSITE,"www.php.net") || strstr($MYSITE,"localhost")) { - $host = 'localhost'; -# $host = '127.0.0.1'; - $user = 'nobody'; - $pass = ''; - $db_id = mysql_connect($host, $user, $pass); - $query = "SELECT *,UNIX_TIMESTAMP(ts) AS xwhen FROM note WHERE sect = '$title' OR sect = '$id' ORDER BY id"; - $result_id = mysql_db_query("php3", $query, $db_id); - if ($result_id && mysql_num_rows($result_id) > 0) { - while ($row = mysql_fetch_array($result_id)) { - $notes[] = $row; - } - } - } else { - $notes_file = "usernotes/" . urlencode( $title ) . ".txt"; - if ( @file_exists( $notes_file ) ) - { - $fp = @fopen($notes_file,"r"); - if ($fp) { - $body = fread($fp,filesize($notes_file)); - if (strlen($body)) { - $notes = @unserialize($body); - } - fclose($fp); - } - } - } - return $notes; + // if we're www.php.net, get it from the local DB + // otherwise look in "/manual/usernotes/$title.txt" (if present) + global $MYSITE; + $notes = array(); + if(strstr($MYSITE,"www.php.net")) { +# if(strstr($MYSITE,"www.php.net") || strstr($MYSITE,"localhost")) { + $host = 'localhost'; +# $host = '127.0.0.1'; + $user = 'nobody'; + $pass = ''; + $db_id = mysql_connect($host, $user, $pass); + $query = "SELECT *,UNIX_TIMESTAMP(ts) AS xwhen FROM note WHERE sect = '$title' OR sect = '$id' ORDER BY id"; + $result_id = mysql_db_query("php3", $query, $db_id); + if ($result_id && mysql_num_rows($result_id) > 0) { + while ($row = mysql_fetch_array($result_id)) { + $notes[] = $row; + } + } + } else { + $notes_file = "usernotes/" . urlencode( $title ) . ".txt"; + if ( @file_exists( $notes_file ) ) + { + $fp = @fopen($notes_file,"r"); + if ($fp) { + $body = fread($fp,filesize($notes_file)); + if (strlen($body)) { + $notes = @unserialize($body); + } + fclose($fp); + } + } + } + return $notes; } function manualUserNotes($title, $id) { - global $PHP_SELF, $SERVER_NAME, $SERVER_PORT; - $cur = substr(dirname($PHP_SELF),-2); - if($cur=='al') $cur='en'; - echo '<FORM method="POST" action="http://www.php.net/manual/add-note.php?lang='.$cur.'">'; - $back_url = "http://$SERVER_NAME".(($SERVER_PORT==80)?"":":".$SERVER_PORT).$PHP_SELF; - echo '<INPUT type=hidden name="redirect" value="'.$back_url.'">'; - echo '<INPUT type=hidden name="sect" value="'.$title.'">'; - - echo "<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 width=100%>\n"; - - $notes = manualGetUserNotes($title, $id); - $num_notes = count($notes); - if ( $num_notes > 0 ) { - makeTitle("User Contributed Notes: ".$title); - for ($i=0; $i<$num_notes; $i++) { - $note = $notes[$i]; // should use foreach? - makeEntry($note['xwhen'],$note['user'],$note['note'],$note['id']); - } - } - makeAddNote(); - echo "</TABLE></FORM>\n"; + global $PHP_SELF, $SERVER_NAME, $SERVER_PORT; + $cur = substr(dirname($PHP_SELF),-2); + if($cur=='al') $cur='en'; + echo '<FORM method="POST" action="http://www.php.net/manual/add-note.php?lang='.$cur.'">'; + $back_url = "http://$SERVER_NAME".(($SERVER_PORT==80)?"":":".$SERVER_PORT).$PHP_SELF; + echo '<INPUT type=hidden name="redirect" value="'.$back_url.'">'; + echo '<INPUT type=hidden name="sect" value="'.$title.'">'; + + echo "<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 width=100%>\n"; + + $notes = manualGetUserNotes($title, $id); + $num_notes = count($notes); + if ( $num_notes > 0 ) { + makeTitle("User Contributed Notes: ".$title); + for ($i=0; $i<$num_notes; $i++) { + $note = $notes[$i]; // should use foreach? + makeEntry($note['xwhen'],$note['user'],$note['note'],$note['id']); + } + } + makeAddNote(); + echo "</TABLE></FORM>\n"; } function manualLastModified($title, $id) { - global $MYSITE, $SCRIPT_FILENAME; - if(strstr($MYSITE,"www.php.net")) { - $host = 'localhost'; - $user = 'nobody'; - $pass = ''; - $db_id = mysql_connect($host, $user, $pass); - $query = "SELECT UNIX_TIMESTAMP(ts) AS stamp FROM note WHERE sect = '$title' OR sect = '$id' ORDER BY ts DESC limit 1"; - $result_id = mysql_db_query("php3", $query, $db_id); - } else { - $result_id = 0; - } - if($result_id && mysql_num_rows($result_id)) { - $t = mysql_fetch_row($result_id); - Header("Last-Modified: ".gmdate("D, d M Y H:i:s",$t[0])." GMT"); - } else { - Header("Last-Modified: ".gmdate("D, d M Y H:i:s",getlastmod())." GMT"); - } - if($result_id) mysql_free_result($result_id); + global $MYSITE, $SCRIPT_FILENAME; + if(strstr($MYSITE,"www.php.net")) { + $host = 'localhost'; + $user = 'nobody'; + $pass = ''; + $db_id = mysql_connect($host, $user, $pass); + $query = "SELECT UNIX_TIMESTAMP(ts) AS stamp FROM note WHERE sect = '$title' OR sect = '$id' ORDER BY ts DESC limit 1"; + $result_id = mysql_db_query("php3", $query, $db_id); + } else { + $result_id = 0; + } + if($result_id && mysql_num_rows($result_id)) { + $t = mysql_fetch_row($result_id); + Header("Last-Modified: ".gmdate("D, d M Y H:i:s",$t[0])." GMT"); + } else { + Header("Last-Modified: ".gmdate("D, d M Y H:i:s",getlastmod())." GMT"); + } + if($result_id) mysql_free_result($result_id); } function sendManualHeaders($charset,$lang) { - Header("Content-type: text/html;charset=$charset"); - Header("Content-language: $lang"); + Header("Content-type: text/html;charset=$charset"); + Header("Content-language: $lang"); } function manualHeader($title,$id="") { - global $FRAMEMODE, $HTDIG; - manualLastModified($title,$id); - commonHeader("Manual: $title"); - if (!$HTDIG): - navigationBar($title); - endif; + global $FRAMEMODE, $HTDIG; + manualLastModified($title,$id); + commonHeader("Manual: $title"); + if (!$HTDIG): + navigationBar($title); + endif; } function manualFooter($title,$id="") { - global $HTDIG; - if (!$HTDIG): - manualUserNotes($title,$id); - navigationBar($title); - endif; - commonFooter($title); + global $HTDIG; + if (!$HTDIG): + manualUserNotes($title,$id); + navigationBar($title); + endif; + commonFooter($title); } ?>
« previous php.mirrors (#3621) next »