cvs: php-gtk-web / manual1-lookup.php /include layout.php

[email protected] ("Christian Weiske") Thu, 10 Aug 2006 15:01:05 -0000
Newsgroups php.gtk.webmaster
Message-ID <cvscweiske1155222065@cvsserver>
cweiske		Thu Aug 10 15:01:05 2006 UTC

  Modified files:              
    /php-gtk-web	manual1-lookup.php 
    /php-gtk-web/include	layout.php 
  Log:
  Search dropdown follows directory
  
  
http://cvs.php.net/viewvc.cgi/php-gtk-web/manual1-lookup.php?r1=1.2&r2=1.3&diff_format=u
Index: php-gtk-web/manual1-lookup.php
diff -u php-gtk-web/manual1-lookup.php:1.2 php-gtk-web/manual1-lookup.php:1.3
--- php-gtk-web/manual1-lookup.php:1.2	Fri Apr 14 13:17:50 2006
+++ php-gtk-web/manual1-lookup.php	Thu Aug 10 15:01:05 2006
@@ -2,30 +2,29 @@
 require_once 'prepend.php';
 require_once 'manual1-lookup.inc';
 
-$pattern = $_POST['pattern'];
+$pattern = isset($_POST['pattern']) ? $_POST['PATTERN'] : null;
 $function = $_GET['function'];
 
 if (!$function && $pattern) $function = $pattern;
 $function = strtolower($function);
 
 /* it gets messy trying to pass $lang around - so get it from the referral dir */
-if(strstr(dirname($_SERVER[HTTP_REFERER]), "manual1/")) {
-	$lang = substr(dirname($_SERVER[HTTP_REFERER]), -2);
-	}
-else {
+if(isset($_SERVER['HTTP_REFERER']) && strstr(dirname($_SERVER['HTTP_REFERER']), "manual1/")) {
+	$lang = substr(dirname($_SERVER['HTTP_REFERER']), -2);
+} else {
 	$lang="en";
-	}
+}
 /* there's always one, eh? */
 if($lang == "BR") $lang = "pt_BR";
 
 function make404($lang) {
 	commonHeader("404 Not Found");
-	$no_path = str_replace("/php-gtk-web/manual1-lookup.php?lang=$lang&function=", "", htmlspecialchars($_SERVER[REQUEST_URI]));
+	$no_path = str_replace("/php-gtk-web/manual1-lookup.php?lang=$lang&amp;function=", "", htmlspecialchars($_SERVER['REQUEST_URI']));
 	$no_path = ereg_replace('&[x]=[0-9]&[y]=[0-9]', '', $no_path);
-	echo "<br>&nbsp;<H1>Not Found</H1><br>";
+	echo "<br/>&nbsp;<h1>Not Found</h1><br>";
 	if(strlen($no_path) < 3)
-	echo "&nbsp;<B>" . $no_path . "</B> is too short to be used as a search string.  <a href=$_SERVER[HTTP_REFERER]>Go back and try something longer</a><br><br><br><br><br><br><br>";
-	else echo "&nbsp;The function <B>" . $no_path . "</B> could not be found.  <a href=$_SERVER[HTTP_REFERER]>Try again</a><br><br><br><br><br><br><br>";
+	echo "&nbsp;<b>" . $no_path . "</b> is too short to be used as a search string.  <a href=\"$_SERVER[HTTP_REFERER]\">Go back and try something longer</a><br/><br/><br/><br/><br/><br/><br/>";
+	else echo "&nbsp;The function <b>" . $no_path . "</b> could not be found.  <a href=\"$_SERVER[HTTP_REFERER]\">Try again</a><br/><br/><br/><br/><br/><br/><br/>";
 	commonFooter();
 }
 
http://cvs.php.net/viewvc.cgi/php-gtk-web/include/layout.php?r1=1.62&r2=1.63&diff_format=u
Index: php-gtk-web/include/layout.php
diff -u php-gtk-web/include/layout.php:1.62 php-gtk-web/include/layout.php:1.63
--- php-gtk-web/include/layout.php:1.62	Sat Jul 15 04:20:44 2006
+++ php-gtk-web/include/layout.php	Thu Aug 10 15:01:05 2006
@@ -1,5 +1,5 @@
 <?php
-/* $Id: layout.php,v 1.62 2006/07/15 04:20:44 sfox Exp $ */
+/* $Id: layout.php,v 1.63 2006/08/10 15:01:05 cweiske Exp $ */
 
 # spacer()
 # print a IMG tag for a sized spacer GIF
@@ -192,13 +192,23 @@
        <input class="small" type="text" name="pattern" value="<?php if (isset($_GET['prevsearch'])) echo htmlentities($_GET['prevsearch']); ?>" size="30" />
        <small>in the</small>
        <select name="show" class="small">
-        <option value="manual">PHP-GTK 2 manual</option>
-        <option value="manual1">PHP-GTK 1 manual</option>
-        <option value="whole-site">whole site</option>
-        <option value="wiki">wiki</option>
-        <option value="php-gtk-general-list">general mailing list</option>
-        <option value="php-gtk-dev-list">development mailing list</option>
-        <option value="php-gtk-doc-list">documentation mailing list</option>
+<?php
+$options = array(
+    'manual' => 'PHP-GTK 2 manual',
+    'manual1' => 'PHP-GTK 1 manual',
+    'whole-site' => 'whole site',
+    'wiki' => 'wiki',
+    'php-gtk-general-list' => 'general mailing list',
+    'php-gtk-dev-list' => 'development mailing list',
+    'php-gtk-doc-list' => 'documentation mailing list'
+);
+$uris = explode('/', $_SERVER['REQUEST_URI']);
+$dir = $uris[1];
+foreach ($options as $value => $title) {
+    $sel = ($value == substr($dir, 0, strlen($value))) ? ' selected="selected"' : '';
+    echo '<option value="' . $value . '"' . $sel . '>' . $title . '</option>' . "\n";
+}
+?>
        </select>
       <?php echo make_submit('small_submit_white.gif', 'search', 'bottom'); ?>&nbsp;<br />
      </font>