summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/ChangeLog2
-rw-r--r--doc/developers/TODO2
-rw-r--r--www/search.php17
3 files changed, 17 insertions, 4 deletions
diff --git a/doc/ChangeLog b/doc/ChangeLog
index 13e3d65..459ee8d 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -6,6 +6,8 @@ ChangeLog for SemantiScuttle
- Implement request #2878169: Voting system
- Fix bug #2881886: PHP notice when viewing tags
- Configuration option to disable registration
+- Implement request #2874049: "Feeling lucky" button
+ just add "?lucky=1" as parameter to search page
0.94 - 2009-10-02
diff --git a/doc/developers/TODO b/doc/developers/TODO
index a827750..72ab582 100644
--- a/doc/developers/TODO
+++ b/doc/developers/TODO
@@ -107,5 +107,3 @@ Tracker items:
So I'd define "freddy" as short url name in the bookmark, and anyone could
access it e.g. via our-bookmarks.com/s/freddy and get redirected to the
real url. Useful to get permanent URLs to moving targets.
-#2874049 - feeling lucky button
- redirect to first search result
diff --git a/www/search.php b/www/search.php
index c957b80..11c382c 100644
--- a/www/search.php
+++ b/www/search.php
@@ -113,10 +113,23 @@ if (is_null($terms)) {
}
}
-$bookmarks =& $bookmarkservice->getBookmarks($start, $perpage, $s_user, NULL, $terms, getSortOrder(), $s_watchlist, $s_start, $s_end);
+$bookmarks =& $bookmarkservice->getBookmarks(
+ $start, $perpage, $s_user, NULL, $terms, getSortOrder(),
+ $s_watchlist, $s_start, $s_end
+);
// Save search
-$searchhistoryservice->addSearch($terms, $range, $bookmarks['total'], $currentUserId);
+$searchhistoryservice->addSearch(
+ $terms, $range, $bookmarks['total'], $currentUserId
+);
+
+if (isset($_GET['lucky']) && $_GET['lucky']
+ && isset($bookmarks['bookmarks'][0])
+) {
+ $url = $bookmarks['bookmarks'][0]['bAddress'];
+ header('Location: ' . $url);
+ exit();
+}
if ($GLOBALS['enableGoogleCustomSearch']) {
$tplVars['tipMsg'] = T_('Unsatisfied? You can also try our ')