cvs: phpweb / bug-pwd-finder.php bugs-php3.php bugs.php bugstats.php manual-lookup.php quickref.php search.php /error index.php /include layout.inc
site.inc /manual index.php /manual/html index.php
| From: | Jim Winstead | Date: | Sat, 07 Jul 2001 01:17:50 +0000 |
| Subject: | cvs: phpweb / bug-pwd-finder.php bugs-php3.php bugs.php bugstats.php manual-lookup.php quickref.php search.php /error index.php /include layout.inc site.inc /manual index.php /manual/html index.php |
||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-5248@lists.php.net to get a copy of this message | ||
jimw Fri Jul 6 21:17:50 2001 EDT
Modified files:
/phpweb bug-pwd-finder.php bugs-php3.php bugs.php bugstats.php
manual-lookup.php quickref.php search.php
/phpweb/error index.php
/phpweb/include layout.inc site.inc
/phpweb/manual index.php
/phpweb/manual/html index.php
Log:
hide the $MIRRORS array behind some access functions, for the most part
Index: phpweb/bug-pwd-finder.php
diff -u phpweb/bug-pwd-finder.php:1.10 phpweb/bug-pwd-finder.php:1.11
--- phpweb/bug-pwd-finder.php:1.10 Sun Jul 1 12:55:03 2001
+++ phpweb/bug-pwd-finder.php Fri Jul 6 21:17:32 2001
@@ -3,7 +3,7 @@
/* See bugs.php for the table layout of bugdb. */
-if (strstr($MYSITE,"www.php.net") || strstr($MYSITE,"localhost")) {
+if (is_primary_site() || strstr($MYSITE,"localhost")) {
$dbhost="localhost";
$dbuser="nobody";
$dbpwd="";
Index: phpweb/bugs-php3.php
diff -u phpweb/bugs-php3.php:1.19 phpweb/bugs-php3.php:1.20
--- phpweb/bugs-php3.php:1.19 Sun Jul 1 05:55:11 2001
+++ phpweb/bugs-php3.php Fri Jul 6 21:17:32 2001
@@ -6,7 +6,7 @@
/* See the end of the script for the table layout. */
-if (strstr($MYSITE,"www.php.net")) {
+if (is_primary_site()) {
$dbhost="localhost";
$dbuser="nobody";
$dbpwd="";
Index: phpweb/bugs.php
diff -u phpweb/bugs.php:1.118 phpweb/bugs.php:1.119
--- phpweb/bugs.php:1.118 Fri Jul 6 18:28:31 2001
+++ phpweb/bugs.php Fri Jul 6 21:17:33 2001
@@ -12,7 +12,7 @@
if (!isset($pw)) $pw = '';
$destination = "php-dev@lists.php.net";
-if (strstr($MYSITE,"www.php.net") || strstr($MYSITE,"localhost")) {
+if (is_primary_site() || strstr($MYSITE,"localhost")) {
$dbhost = "localhost";
$dbuser = "nobody";
$dbpwd = "";
Index: phpweb/bugstats.php
diff -u phpweb/bugstats.php:1.24 phpweb/bugstats.php:1.25
--- phpweb/bugstats.php:1.24 Sun Jul 1 05:55:11 2001
+++ phpweb/bugstats.php Fri Jul 6 21:17:33 2001
@@ -1,8 +1,8 @@
<?php
require_once 'prepend.inc';
-if(!strstr($MYSITE,"www.php.net")) {
- Header("Location: http://www.php.net/bugstats.php");
+if(!is_primary_site()) {
+ header("Location: http://www.php.net/bugstats.php");
exit;
}
Index: phpweb/manual-lookup.php
diff -u phpweb/manual-lookup.php:1.14 phpweb/manual-lookup.php:1.15
--- phpweb/manual-lookup.php:1.14 Sun Jul 1 05:55:12 2001
+++ phpweb/manual-lookup.php Fri Jul 6 21:17:34 2001
@@ -5,7 +5,7 @@
if (!$function && $pattern) $function = $pattern;
$function = strtolower($function);
-if (!isset($lang)) $lang = $MIRRORS[$MYSITE][6];
+if (!isset($lang)) $lang = default_language();
$file = find_manual_page($lang, $function);
Index: phpweb/quickref.php
diff -u phpweb/quickref.php:1.13 phpweb/quickref.php:1.14
--- phpweb/quickref.php:1.13 Sun Jul 1 05:55:12 2001
+++ phpweb/quickref.php Fri Jul 6 21:17:34 2001
@@ -4,7 +4,7 @@
$NUMACROSS=2;
$SHOW_CLOSE=10;
-if (!isset($lang)) $lang = $MIRRORS[$MYSITE][6];
+if (!isset($lang)) $lang = default_language();
if (!file_exists("$DOCUMENT_ROOT/manual/$lang")) $lang = "en";
function makeTable($lang,$array) {
Index: phpweb/search.php
diff -u phpweb/search.php:1.14 phpweb/search.php:1.15
--- phpweb/search.php:1.14 Sun Jul 1 05:55:12 2001
+++ phpweb/search.php Fri Jul 6 21:17:34 2001
@@ -11,8 +11,6 @@
SetCookie("prevsearch",$pattern,0,"",".php.net");
}
-$HAVE_SEARCH=$MIRRORS[$MYSITE][5];
-
if (isset($pattern) && ($pattern)) {
if ($show=="quickref") {
header("Location: manual-lookup.php?pattern=".urlencode($pattern));
@@ -51,7 +49,7 @@
exit;
}
- if (!$HAVE_SEARCH) {
+ if (!have_search()) {
$location="http://www.php.net/search.php";
$query =
"show=".$show."&pattern=".urlencode($pattern)."&sourceurl=".urlencode($MYSITE);
Header("Location: ".$location."?".$query);
@@ -136,7 +134,7 @@
<?php } else {
commonHeader("Search Results");
echo "<h1>Search Results</h1>\n";
- if ($HAVE_SEARCH && isset($htsearch_prog)) {
+ if (have_search() && isset($htsearch_prog)) {
$form=$PHP_SELF;
} else {
$form="http://www.php.net/search.php";
Index: phpweb/error/index.php
diff -u phpweb/error/index.php:1.26 phpweb/error/index.php:1.27
--- phpweb/error/index.php:1.26 Wed May 16 10:37:12 2001
+++ phpweb/error/index.php Fri Jul 6 21:17:35 2001
@@ -21,7 +21,7 @@
exit;
}
-$lang = $MIRRORS[$MYSITE][6];
+$lang = default_language();
if (!is_dir("$DOCUMENT_ROOT/manual/$lang")) {
$lang = "en"; // fall back to English
}
@@ -72,8 +72,6 @@
} else {
$function = strtolower($uri);
}
-
-if (!$lang) $lang = $MIRRORS[$MYSITE][6];
$try = find_manual_page($lang, $function);
if ($try) {
Index: phpweb/include/layout.inc
diff -u phpweb/include/layout.inc:1.39 phpweb/include/layout.inc:1.40
--- phpweb/include/layout.inc:1.39 Sun Jul 1 05:59:40 2001
+++ phpweb/include/layout.inc Fri Jul 6 21:17:38 2001
@@ -1,5 +1,5 @@
<?php
-/* $Id: layout.inc,v 1.39 2001/07/01 09:59:40 goba Exp $ */
+/* $Id: layout.inc,v 1.40 2001/07/07 01:17:38 jimw Exp $ */
# spacer()
@@ -315,10 +315,10 @@
echo delim();
print_link('/credits.php', 'credits', false,
'class="small"');
echo delim();
- if ($MIRRORS[$MYSITE][2]):
+ if (have_stats()) {
print_link('/stats/', 'stats', false, 'class="small"');
echo delim();
- endif;
+ }
print_link('/mirrors.php', 'mirror sites:', false,
'class="small"');
echo " <select class=\"small\" name=\"country\"
onchange=\"gotomirror(this.form)\">\n";
foreach($MIRRORS as $url=>$mirror) {
@@ -350,7 +350,7 @@
</td>
<td align="right"><small>
This mirror generously provided by:
- <a href="<?php echo $MIRRORS[$MYSITE][3];?>"><?php echo
$MIRRORS[$MYSITE][1];?></a><BR>
+ <a href="<?php echo mirror_provider_url();?>"><?php echo
mirror_provider();?></a><BR>
Last updated: <url-minder-ignore><?php echo strftime("%c %Z",
$LAST_UPDATED); ?></url-minder-ignore><BR>
</small>
</td>
Index: phpweb/include/site.inc
diff -u phpweb/include/site.inc:1.208 phpweb/include/site.inc:1.209
--- phpweb/include/site.inc:1.208 Fri Jul 6 20:33:42 2001
+++ phpweb/include/site.inc Fri Jul 6 21:17:38 2001
@@ -11,6 +11,36 @@
require_once 'mirrors.inc';
+function is_primary_site() {
+ global $MYSITE;
+ return $MYSITE == "http://www.php.net/";
+}
+
+function default_language() {
+ global $MIRRORS,$MYSITE;
+ return $MIRRORS[$MYSITE][6];
+}
+
+function have_search() {
+ global $MIRRORS,$MYSITE;
+ return $MIRRORS[$MYSITE][5];
+}
+
+function have_stats() {
+ global $MIRRORS,$MYSITE;
+ return $MIRRORS[$MYSITE][2];
+}
+
+function mirror_provider() {
+ global $MIRRORS,$MYSITE;
+ return $MIRRORS[$MYSITE][1];
+}
+
+function mirror_provider_url() {
+ global $MIRRORS,$MYSITE;
+ return $MIRRORS[$MYSITE][3];
+}
+
$COUNTRIES = array(
"au" => "Australia",
"at" => "Austria",
Index: phpweb/manual/index.php
diff -u phpweb/manual/index.php:1.3 phpweb/manual/index.php:1.4
--- phpweb/manual/index.php:1.3 Wed Mar 7 19:18:11 2001
+++ phpweb/manual/index.php Fri Jul 6 21:17:40 2001
@@ -1,7 +1,7 @@
<?php
require_once 'prepend.inc';
-$lang = $MIRRORS[$MYSITE][6];
+$lang = default_language();
if (is_dir($lang)) {
header("Location: $lang/");
}
Index: phpweb/manual/html/index.php
diff -u phpweb/manual/html/index.php:1.3 phpweb/manual/html/index.php:1.4
--- phpweb/manual/html/index.php:1.3 Wed Mar 7 19:18:15 2001
+++ phpweb/manual/html/index.php Fri Jul 6 21:17:41 2001
@@ -1,7 +1,7 @@
<?php
require_once 'prepend.inc';
-$lang = $MIRRORS[$MYSITE][6];
+$lang = default_language();
if (is_dir("../$lang/html")) {
header("Location: ../$lang/html/");
}