- improved the search system by making it context sensitive
parent
64a6fbc790
commit
e2f249878e
|
@ -1,6 +1,10 @@
|
|||
drupal x.xx, xx/xx/xxxx
|
||||
-----------------------
|
||||
- rewrote the user system
|
||||
- rewrote the user system:
|
||||
* added support for Drupal authentication through XML-RPC and through
|
||||
a Jabber server.
|
||||
- various updates:
|
||||
* improved the search system by making it context sensitive.
|
||||
|
||||
drupal 3.00, 15/09/2001
|
||||
-----------------------
|
||||
|
|
|
@ -355,11 +355,11 @@ function blog_block() {
|
|||
|
||||
|
||||
function blog_search($keys) {
|
||||
global $status;
|
||||
global $PHP_SELF, $status;
|
||||
|
||||
$result = db_query("SELECT n.*, b.* FROM blog b LEFT JOIN node n ON n.nid = b.nid AND n.lid = b.lid WHERE (n.title LIKE '%$keys%' OR b.body LIKE '%$keys%') ORDER BY n.timestamp DESC LIMIT 20");
|
||||
while ($blog = db_fetch_object($result)) {
|
||||
$find[$i++] = array("title" => check_output($blog->title), "link" => (user_access("administer nodes") ? "admin.php?mod=node&type=blog&op=edit&id=$blog->nid" : "node.php?id=$blog->nid"), "user" => $blog->name, "date" => $blog->timestamp);
|
||||
$find[$i++] = array("title" => check_output($blog->title), "link" => ($PHP_SELF == "/admin.php" ? "admin.php?mod=node&type=blog&op=edit&id=$blog->nid" : "node.php?id=$blog->nid"), "user" => $blog->name, "date" => $blog->timestamp);
|
||||
}
|
||||
return $find;
|
||||
}
|
||||
|
|
|
@ -355,11 +355,11 @@ function blog_block() {
|
|||
|
||||
|
||||
function blog_search($keys) {
|
||||
global $status;
|
||||
global $PHP_SELF, $status;
|
||||
|
||||
$result = db_query("SELECT n.*, b.* FROM blog b LEFT JOIN node n ON n.nid = b.nid AND n.lid = b.lid WHERE (n.title LIKE '%$keys%' OR b.body LIKE '%$keys%') ORDER BY n.timestamp DESC LIMIT 20");
|
||||
while ($blog = db_fetch_object($result)) {
|
||||
$find[$i++] = array("title" => check_output($blog->title), "link" => (user_access("administer nodes") ? "admin.php?mod=node&type=blog&op=edit&id=$blog->nid" : "node.php?id=$blog->nid"), "user" => $blog->name, "date" => $blog->timestamp);
|
||||
$find[$i++] = array("title" => check_output($blog->title), "link" => ($PHP_SELF == "/admin.php" ? "admin.php?mod=node&type=blog&op=edit&id=$blog->nid" : "node.php?id=$blog->nid"), "user" => $blog->name, "date" => $blog->timestamp);
|
||||
}
|
||||
return $find;
|
||||
}
|
||||
|
|
|
@ -82,10 +82,10 @@ function book_view($node, $main = 0) {
|
|||
}
|
||||
|
||||
function book_search($keys) {
|
||||
global $status;
|
||||
global $PHP_SELF, $status;
|
||||
$result = db_query("SELECT n.*, u.name FROM node n LEFT JOIN book b ON n.nid = b.nid AND n.lid = b.lid LEFT JOIN user u ON n.author = u.uid WHERE n.type = 'book' AND n.status = '$status[posted]' AND (n.title LIKE '%". check_input($keys) ."%' OR b.body LIKE '%". check_input($keys) ."%') ORDER BY n.timestamp DESC LIMIT 20");
|
||||
while ($node = db_fetch_object($result)) {
|
||||
$find[$i++] = array("title" => check_output($node->title), "link" => (user_access("administer nodes") ? "admin.php?mod=node&type=book&op=edit&id=$node->nid" : "node.php?id=$node->nid"), "user" => $node->name, "date" => $node->timestamp);
|
||||
$find[$i++] = array("title" => check_output($node->title), "link" => ($PHP_SELF == "/admin.php" ? "admin.php?mod=node&type=book&op=edit&id=$node->nid" : "node.php?id=$node->nid"), "user" => $node->name, "date" => $node->timestamp);
|
||||
}
|
||||
return $find;
|
||||
}
|
||||
|
|
|
@ -82,10 +82,10 @@ function book_view($node, $main = 0) {
|
|||
}
|
||||
|
||||
function book_search($keys) {
|
||||
global $status;
|
||||
global $PHP_SELF, $status;
|
||||
$result = db_query("SELECT n.*, u.name FROM node n LEFT JOIN book b ON n.nid = b.nid AND n.lid = b.lid LEFT JOIN user u ON n.author = u.uid WHERE n.type = 'book' AND n.status = '$status[posted]' AND (n.title LIKE '%". check_input($keys) ."%' OR b.body LIKE '%". check_input($keys) ."%') ORDER BY n.timestamp DESC LIMIT 20");
|
||||
while ($node = db_fetch_object($result)) {
|
||||
$find[$i++] = array("title" => check_output($node->title), "link" => (user_access("administer nodes") ? "admin.php?mod=node&type=book&op=edit&id=$node->nid" : "node.php?id=$node->nid"), "user" => $node->name, "date" => $node->timestamp);
|
||||
$find[$i++] = array("title" => check_output($node->title), "link" => ($PHP_SELF == "/admin.php" ? "admin.php?mod=node&type=book&op=edit&id=$node->nid" : "node.php?id=$node->nid"), "user" => $node->name, "date" => $node->timestamp);
|
||||
}
|
||||
return $find;
|
||||
}
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
<?php
|
||||
|
||||
function comment_search($keys) {
|
||||
global $PHP_SELF;
|
||||
$result = db_query("SELECT c.*, u.name FROM comments c LEFT JOIN user u ON c.author = u.uid WHERE c.subject LIKE '%$keys%' OR c.comment LIKE '%$keys%' ORDER BY c.timestamp DESC LIMIT 20");
|
||||
while ($comment = db_fetch_object($result)) {
|
||||
$find[$i++] = array("title" => check_output($comment->subject), "link" => (user_access("administer comments") ? "admin.php?mod=comment&op=edit&id=$comment->cid" : "node.php?id=$comment->lid&cid=$comment->cid"), "user" => $comment->name, "date" => $comment->timestamp);
|
||||
$find[$i++] = array("title" => check_output($comment->subject), "link" => ($PHP_SELF == "/admin.php" ? "admin.php?mod=comment&op=edit&id=$comment->cid" : "node.php?id=$comment->lid&cid=$comment->cid"), "user" => $comment->name, "date" => $comment->timestamp);
|
||||
}
|
||||
return $find;
|
||||
}
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
<?php
|
||||
|
||||
function comment_search($keys) {
|
||||
global $PHP_SELF;
|
||||
$result = db_query("SELECT c.*, u.name FROM comments c LEFT JOIN user u ON c.author = u.uid WHERE c.subject LIKE '%$keys%' OR c.comment LIKE '%$keys%' ORDER BY c.timestamp DESC LIMIT 20");
|
||||
while ($comment = db_fetch_object($result)) {
|
||||
$find[$i++] = array("title" => check_output($comment->subject), "link" => (user_access("administer comments") ? "admin.php?mod=comment&op=edit&id=$comment->cid" : "node.php?id=$comment->lid&cid=$comment->cid"), "user" => $comment->name, "date" => $comment->timestamp);
|
||||
$find[$i++] = array("title" => check_output($comment->subject), "link" => ($PHP_SELF == "/admin.php" ? "admin.php?mod=comment&op=edit&id=$comment->cid" : "node.php?id=$comment->lid&cid=$comment->cid"), "user" => $comment->name, "date" => $comment->timestamp);
|
||||
}
|
||||
return $find;
|
||||
}
|
||||
|
|
|
@ -75,10 +75,10 @@ function poll_status() {
|
|||
}
|
||||
|
||||
function poll_search($keys) {
|
||||
global $status;
|
||||
global $PHP_SELF, $status;
|
||||
$result = db_query("SELECT n.*, p.* FROM poll p LEFT JOIN node n ON n.nid = p.nid AND n.lid = p.lid WHERE n.status = '$status[posted]' AND (n.title LIKE '%$keys%') LIMIT 20");
|
||||
while ($poll = db_fetch_object($result)) {
|
||||
$find[$i++] = array("title" => check_output($poll->title), "link" => (user_access("administer nodes") ? "admin.php?mod=poll&op=edit&id=$poll->nid" : "node.php?id=$poll->nid"), "user" => $poll->name, "date" => $poll->timestamp);
|
||||
$find[$i++] = array("title" => check_output($poll->title), "link" => ($PHP_SELF == "/admin.php" ? "admin.php?mod=poll&op=edit&id=$poll->nid" : "node.php?id=$poll->nid"), "user" => $poll->name, "date" => $poll->timestamp);
|
||||
}
|
||||
return $find;
|
||||
}
|
||||
|
|
|
@ -75,10 +75,10 @@ function poll_status() {
|
|||
}
|
||||
|
||||
function poll_search($keys) {
|
||||
global $status;
|
||||
global $PHP_SELF, $status;
|
||||
$result = db_query("SELECT n.*, p.* FROM poll p LEFT JOIN node n ON n.nid = p.nid AND n.lid = p.lid WHERE n.status = '$status[posted]' AND (n.title LIKE '%$keys%') LIMIT 20");
|
||||
while ($poll = db_fetch_object($result)) {
|
||||
$find[$i++] = array("title" => check_output($poll->title), "link" => (user_access("administer nodes") ? "admin.php?mod=poll&op=edit&id=$poll->nid" : "node.php?id=$poll->nid"), "user" => $poll->name, "date" => $poll->timestamp);
|
||||
$find[$i++] = array("title" => check_output($poll->title), "link" => ($PHP_SELF == "/admin.php" ? "admin.php?mod=poll&op=edit&id=$poll->nid" : "node.php?id=$poll->nid"), "user" => $poll->name, "date" => $poll->timestamp);
|
||||
}
|
||||
return $find;
|
||||
}
|
||||
|
|
|
@ -13,10 +13,10 @@ function story_status() {
|
|||
}
|
||||
|
||||
function story_search($keys) {
|
||||
global $status;
|
||||
global $PHP_SELF, $status;
|
||||
$result = db_query("SELECT n.*, s.* FROM story s LEFT JOIN node n ON n.nid = s.nid AND n.lid = s.lid WHERE n.status = '$status[posted]' AND (n.title LIKE '%$keys%' OR s.abstract LIKE '%$keys%' OR s.body LIKE '%$keys%') ORDER BY n.timestamp DESC LIMIT 20");
|
||||
while ($story = db_fetch_object($result)) {
|
||||
$find[$i++] = array("title" => check_output($story->title), "link" => (user_access("administer nodes") ? "admin.php?mod=node&type=story&op=edit&id=$story->nid" : "node.php?id=$story->nid"), "user" => $story->name, "date" => $story->timestamp);
|
||||
$find[$i++] = array("title" => check_output($story->title), "link" => ($PHP_SELF == "/admin.php" ? "admin.php?mod=node&type=story&op=edit&id=$story->nid" : "node.php?id=$story->nid"), "user" => $story->name, "date" => $story->timestamp);
|
||||
}
|
||||
return $find;
|
||||
}
|
||||
|
|
|
@ -13,10 +13,10 @@ function story_status() {
|
|||
}
|
||||
|
||||
function story_search($keys) {
|
||||
global $status;
|
||||
global $PHP_SELF, $status;
|
||||
$result = db_query("SELECT n.*, s.* FROM story s LEFT JOIN node n ON n.nid = s.nid AND n.lid = s.lid WHERE n.status = '$status[posted]' AND (n.title LIKE '%$keys%' OR s.abstract LIKE '%$keys%' OR s.body LIKE '%$keys%') ORDER BY n.timestamp DESC LIMIT 20");
|
||||
while ($story = db_fetch_object($result)) {
|
||||
$find[$i++] = array("title" => check_output($story->title), "link" => (user_access("administer nodes") ? "admin.php?mod=node&type=story&op=edit&id=$story->nid" : "node.php?id=$story->nid"), "user" => $story->name, "date" => $story->timestamp);
|
||||
$find[$i++] = array("title" => check_output($story->title), "link" => ($PHP_SELF == "/admin.php" ? "admin.php?mod=node&type=story&op=edit&id=$story->nid" : "node.php?id=$story->nid"), "user" => $story->name, "date" => $story->timestamp);
|
||||
}
|
||||
return $find;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue