cvs: phpweb / results.php search.php style.css /include layout.inc /styles site.css
| From: | James Cox | Date: | Tue, 28 Feb 2006 01:06:32 +0000 |
| Subject: | cvs: phpweb / results.php search.php style.css /include layout.inc /styles site.css | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-30710@lists.php.net to get a copy of this message | ||
imajes Tue Feb 28 01:06:32 2006 UTC
Modified files:
/phpweb results.php search.php style.css
/phpweb/include layout.inc
/phpweb/styles site.css
Log:
land better version of the search system and enable..
basically it just looks better, has paging, is realistic about results, should respect mirrors..
etc
http://cvs.php.net/viewcvs.cgi/phpweb/results.php?r1=1.3&r2=1.4&diff_format=u
Index: phpweb/results.php
diff -u phpweb/results.php:1.3 phpweb/results.php:1.4
--- phpweb/results.php:1.3 Mon Feb 27 20:46:06 2006
+++ phpweb/results.php Tue Feb 28 01:06:32 2006
@@ -1,18 +1,33 @@
<?php
-// $Id: results.php,v 1.3 2006/02/27 20:46:06 goba Exp $
+// $Id: results.php,v 1.4 2006/02/28 01:06:32 imajes Exp $
$_SERVER['BASE_PAGE'] = 'results.php';
-#include $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc';
+include $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc';
#include $_SERVER['DOCUMENT_ROOT'] . '/include/loadavg.inc';
// Prepare data for search
-if ($MQ) { $q = stripslashes($_GET['q']); }
-else { $q = $_GET['q']; }
+if ($MQ) {
+ $q = stripslashes($_GET['q']); //query
+ $l = stripslashes($GET['l']); // language
+} else {
+ $q = $_GET['q'];
+ $l = $_GET['l'];
+}
+
$q = urlencode($q);
+$l = urlencode($l);
+
$s = (int) $_GET['start'];
+$per_page = 15;
-$data = file_get_contents("http://www.php.net/~rasmus/ws.php?q=$q&results=10&start=$s");
+$valid_profiles = array('all', 'local', 'news', 'bugs');
+$scope = in_array($_GET['p'], $valid_profiles) ? $_GET['p'] : 'all';
+
+$data = file_get_contents("http://www.php.net/ws.php?profile=$scope&q=$q&results=$per_page&start=$s");
$res = unserialize($data);
+
// HTTP status line is passed on, signifies and error
+site_header('Search results');
+
if (is_string($res)) {
echo '<h2>Internal error, please try later</h2>';
exit;
@@ -24,31 +39,14 @@
exit;
}
-echo <<<EOB
-<style type="text/css">
-ul#search-results {
- list-style-type: none;
-}
-ul#search-results li {
- margin-top: 1em;
-}
-ul#search-results p {
- margin: 0;
-}
-ul#search-results p.summary,
-ul#search-results p.meta {
- font-size: 0.8em;
- margin-left: 2em;
-}
-ul#search-results p.meta {
- color: #008000;
-}
-ul#search-results p.meta a {
- color: #8284cc;
-}
+$start_result = ($s == 0 ? 1 : $s);
+$end_result = $s + $res['ResultSet']['totalResultsReturned'];
+
+$results_count = ($res['ResultSet']['totalResultsAvailable'] < 100 ?
$res['ResultSet']['totalResultsAvailable'] : 'more than 100');
+
-</style>
-<h2>Showing {$res['ResultSet']['totalResultsReturned']} of
{$res['ResultSet']['totalResultsAvailable']} results</h2>
+echo <<<EOB
+<h2>Showing results $start_result to $end_result of $results_count</h2>
<ul id="search-results">
EOB;
$pos = $res['ResultSet']['firstResultPosition'];
@@ -66,11 +64,17 @@
$size = " - {$hit['Cache']['Size']} bytes";
}
}
+
+ if(empty($_GET['p']) || $_GET['p'] == 'local') {
+ $real_url = preg_replace('!^http://[\w]+\.php\.net/(.*)$!', $MYSITE .
'\\1', $hit['Url']);
+ } else {
+ $real_url = $hit['Url'];
+ }
$displayurl = preg_replace('!^http://(.+[^/])(/?)$!',
'\\1', $hit['Url']);
-
+ $display_title = str_replace('PHP:', '', $hit['Title']);
echo <<<EOB
<li>
- <p class="result">$cnt. <a
href="{$hit['Url']}">{$hit['Title']}</a></p>
+ <p class="result"><a
href="{$real_url}">{$display_title}</a></p>
<p class="summary">{$hit['Summary']}</p>
<p class="meta">{$displayurl} - {$d}{$size}{$cachelink}</p>
</li>
@@ -80,4 +84,16 @@
</ul>
EOB;
+$start = 0;
+echo '<span style="margin-left: 3.5em;"><a href="http://developer.yahoo.net/about"><img
src="http://us.dev1.yimg.com/us.yimg.com/i/us/nt/bdg/websrv_120_1.gif"
border="0"></a></span>';
+echo '<div id="results_nav"><h4>Results Page:</h4><ul
id="results_nav_list">';
+for($z=1; $z < 11; $z++) {
+ if($start > $res['ResultSet']['totalResultsAvailable']) {
+ break;
+ }
+ printf('<li><a
href="/results.php?q=%s&start=%d">%d</a></li>', $q, $start, $z);
+ $start += $per_page;
+}
+echo '</ul></div>';
+site_footer();
?>
http://cvs.php.net/viewcvs.cgi/phpweb/search.php?r1=1.104&r2=1.105&diff_format=u
Index: phpweb/search.php
diff -u phpweb/search.php:1.104 phpweb/search.php:1.105
--- phpweb/search.php:1.104 Mon Jan 10 13:43:57 2005
+++ phpweb/search.php Tue Feb 28 01:06:32 2006
@@ -1,5 +1,5 @@
<?php
-// $Id: search.php,v 1.104 2005/01/10 13:43:57 goba Exp $
+// $Id: search.php,v 1.105 2006/02/28 01:06:32 imajes Exp $
$_SERVER['BASE_PAGE'] = 'search.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc';
@@ -77,9 +77,7 @@
// Covers "wholesite", "manual" and any malicios targets
default:
- mirror_redirect(
- "http://www.google.com/search?q={$ucp}+site:www.php.net&l=$LANG"
- );
+ mirror_redirect($MYSITE . "results.php?q={$ucp}&l=$LANG");
}
}
http://cvs.php.net/viewcvs.cgi/phpweb/style.css?r1=1.62&r2=1.63&diff_format=u
Index: phpweb/style.css
diff -u phpweb/style.css:1.62 phpweb/style.css:1.63
--- phpweb/style.css:1.62 Sun Dec 5 15:28:47 2004
+++ phpweb/style.css Tue Feb 28 01:06:32 2006
@@ -328,3 +328,44 @@
ul#manualtoc li a:hover {
text-decoration: underline;
}
+
+/* for search system... */
+ul#search-results {
+ list-style-type: none;
+}
+ul#search-results li {
+ margin-top: 1em;
+ list-style-type: none;
+}
+ul#search-results p {
+ margin: 0;
+}
+ul#search-results p.result {
+ font-weight: 700;
+}
+ul#search-results p.summary,
+ul#search-results p.meta {
+ font-size: 0.8em;
+ margin-left: 2em;
+}
+ul#search-results p.meta {
+ color: #008000;
+}
+ul#search-results p.meta a {
+ color: #8284cc;
+}
+div#results_nav {
+ margin:auto;
+ width: 200px;
+ text-align: center;
+}
+
+ul#results_nav_list {
+ text-align: center;
+ padding: 0px;
+}
+ul#results_nav_list li {
+ display: inline;
+ margin-right: 0.4em;
+ list-style-type: none;
+}
http://cvs.php.net/viewcvs.cgi/phpweb/include/layout.inc?r1=1.228&r2=1.229&diff_format=u
Index: phpweb/include/layout.inc
diff -u phpweb/include/layout.inc:1.228 phpweb/include/layout.inc:1.229
--- phpweb/include/layout.inc:1.228 Sat Feb 18 16:18:13 2006
+++ phpweb/include/layout.inc Tue Feb 28 01:06:32 2006
@@ -1,5 +1,5 @@
<?php
-/* $Id: layout.inc,v 1.228 2006/02/18 16:18:13 rasmus Exp $ */
+/* $Id: layout.inc,v 1.229 2006/02/28 01:06:32 imajes Exp $ */
// Set the static content root differently on php.net
$_SERVER['STATIC_ROOT'] = ($MYSITE == 'http://www.php.net/') ?
@@ -119,6 +119,7 @@
@import url("{$_SERVER['STATIC_ROOT']}/styles/site.css");
@import url("{$_SERVER['STATIC_ROOT']}/styles/{$mirror_specific_style}.css");
</style>
+ <meta http-equiv="Content-Type" content="text/html;
charset={$config['charset']}"/>
<link rel="shortcut icon"
href="{$_SERVER['STATIC_ROOT']}/favicon.ico" />
<script type="text/javascript"
src="{$_SERVER['STATIC_ROOT']}/userprefs.js"></script>$base$meta
</head>
http://cvs.php.net/viewcvs.cgi/phpweb/styles/site.css?r1=1.17&r2=1.18&diff_format=u
Index: phpweb/styles/site.css
diff -u phpweb/styles/site.css:1.17 phpweb/styles/site.css:1.18
--- phpweb/styles/site.css:1.17 Mon Oct 11 13:36:38 2004
+++ phpweb/styles/site.css Tue Feb 28 01:06:32 2006
@@ -487,3 +487,44 @@
div.manualnavbar .lastupdated {
font-size: 75%;
}
+
+/* for searching system... */
+ul#search-results {
+ list-style-type: none;
+}
+ul#search-results li {
+ margin-top: 1em;
+ list-style-type: none;
+}
+ul#search-results p {
+ margin: 0;
+}
+ul#search-results p.result {
+ font-weight: 700;
+}
+ul#search-results p.summary,
+ul#search-results p.meta {
+ font-size: 0.8em;
+ margin-left: 2em;
+}
+ul#search-results p.meta {
+ color: #008000;
+}
+ul#search-results p.meta a {
+ color: #8284cc;
+}
+div#results_nav {
+ margin:auto;
+ width: 200px;
+ text-align: center;
+}
+
+ul#results_nav_list {
+ text-align: center;
+ padding: 0px;
+}
+ul#results_nav_list li {
+ display: inline;
+ margin-right: 0.4em;
+ list-style-type: none;
+}