summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/blog.module11
-rw-r--r--modules/blog/blog.module11
-rw-r--r--modules/comment.module2
-rw-r--r--modules/comment/comment.module2
-rw-r--r--modules/node.module6
-rw-r--r--modules/node/node.module6
-rw-r--r--modules/poll.module2
-rw-r--r--modules/poll/poll.module2
-rw-r--r--modules/story.module2
-rw-r--r--modules/story/story.module2
-rw-r--r--modules/tracker.module2
-rw-r--r--modules/tracker/tracker.module2
-rw-r--r--modules/user.module2
-rw-r--r--modules/user/user.module2
14 files changed, 36 insertions, 18 deletions
diff --git a/modules/blog.module b/modules/blog.module
index a7ca6cea0..8688ee5ac 100644
--- a/modules/blog.module
+++ b/modules/blog.module
@@ -14,6 +14,15 @@ function blog_help() {
<?php
}
+function blog_cron() {
+ $result = db_query("SELECT n.nid, n.timestamp, SUM(m.score) / COUNT(m.cid) AS score, COUNT(m.cid) AS votes FROM node n LEFT JOIN moderate m ON m.nid = n.nid WHERE n.type = 'blog' AND n.status = '". node_status("posted") ."' GROUP BY n.nid ORDER BY n.timestamp DESC LIMIT 30");
+ while ($node = db_fetch_object($result)) {
+ if ($node->score > 3 && $node->votes > 4) {
+ db_query("UPDATE node SET promote = '1' WHERE nid = '$node->nid'");
+ }
+ }
+}
+
function blog_perm() {
return array("administer blogs", "access blogs", "post blogs");
}
@@ -358,7 +367,7 @@ function blog_search($keys) {
$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" => ($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);
+ $find[$i++] = array("title" => check_output($blog->title), "link" => (strstr($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;
}
diff --git a/modules/blog/blog.module b/modules/blog/blog.module
index a7ca6cea0..8688ee5ac 100644
--- a/modules/blog/blog.module
+++ b/modules/blog/blog.module
@@ -14,6 +14,15 @@ function blog_help() {
<?php
}
+function blog_cron() {
+ $result = db_query("SELECT n.nid, n.timestamp, SUM(m.score) / COUNT(m.cid) AS score, COUNT(m.cid) AS votes FROM node n LEFT JOIN moderate m ON m.nid = n.nid WHERE n.type = 'blog' AND n.status = '". node_status("posted") ."' GROUP BY n.nid ORDER BY n.timestamp DESC LIMIT 30");
+ while ($node = db_fetch_object($result)) {
+ if ($node->score > 3 && $node->votes > 4) {
+ db_query("UPDATE node SET promote = '1' WHERE nid = '$node->nid'");
+ }
+ }
+}
+
function blog_perm() {
return array("administer blogs", "access blogs", "post blogs");
}
@@ -358,7 +367,7 @@ function blog_search($keys) {
$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" => ($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);
+ $find[$i++] = array("title" => check_output($blog->title), "link" => (strstr($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;
}
diff --git a/modules/comment.module b/modules/comment.module
index 448f1ff32..d420e5b69 100644
--- a/modules/comment.module
+++ b/modules/comment.module
@@ -4,7 +4,7 @@ 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" => ($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);
+ $find[$i++] = array("title" => check_output($comment->subject), "link" => (strstr($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;
}
diff --git a/modules/comment/comment.module b/modules/comment/comment.module
index 448f1ff32..d420e5b69 100644
--- a/modules/comment/comment.module
+++ b/modules/comment/comment.module
@@ -4,7 +4,7 @@ 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" => ($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);
+ $find[$i++] = array("title" => check_output($comment->subject), "link" => (strstr($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;
}
diff --git a/modules/node.module b/modules/node.module
index aae7afdaf..e856a17ec 100644
--- a/modules/node.module
+++ b/modules/node.module
@@ -188,16 +188,16 @@ function node_save_content($edit, $type) {
function node_delete($id) {
return (node_del(array("nid" => $id)) ? "node has been deleted." : "failed to delete node.");
}
-
+
function node_delete_confirmation($id) {
-
+
$node = node_get_object(array("nid" => $id));
$form .= form_item(t("Do you really want to delete this node"), check_output($node->title));
$form .= form_submit("Delete node");
$form .= form_submit("Keep node");
-
+
return form("admin.php?mod=node&id=$node->nid", $form);
}
diff --git a/modules/node/node.module b/modules/node/node.module
index aae7afdaf..e856a17ec 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -188,16 +188,16 @@ function node_save_content($edit, $type) {
function node_delete($id) {
return (node_del(array("nid" => $id)) ? "node has been deleted." : "failed to delete node.");
}
-
+
function node_delete_confirmation($id) {
-
+
$node = node_get_object(array("nid" => $id));
$form .= form_item(t("Do you really want to delete this node"), check_output($node->title));
$form .= form_submit("Delete node");
$form .= form_submit("Keep node");
-
+
return form("admin.php?mod=node&id=$node->nid", $form);
}
diff --git a/modules/poll.module b/modules/poll.module
index 579a43314..bd7d58f5a 100644
--- a/modules/poll.module
+++ b/modules/poll.module
@@ -78,7 +78,7 @@ function poll_search($keys) {
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" => ($PHP_SELF == "/admin.php" ? "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" => (strstr($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;
}
diff --git a/modules/poll/poll.module b/modules/poll/poll.module
index 579a43314..bd7d58f5a 100644
--- a/modules/poll/poll.module
+++ b/modules/poll/poll.module
@@ -78,7 +78,7 @@ function poll_search($keys) {
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" => ($PHP_SELF == "/admin.php" ? "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" => (strstr($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;
}
diff --git a/modules/story.module b/modules/story.module
index 4fbd630fa..8a7497a65 100644
--- a/modules/story.module
+++ b/modules/story.module
@@ -16,7 +16,7 @@ function story_search($keys) {
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" => ($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);
+ $find[$i++] = array("title" => check_output($story->title), "link" => (strstr($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;
}
diff --git a/modules/story/story.module b/modules/story/story.module
index 4fbd630fa..8a7497a65 100644
--- a/modules/story/story.module
+++ b/modules/story/story.module
@@ -16,7 +16,7 @@ function story_search($keys) {
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" => ($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);
+ $find[$i++] = array("title" => check_output($story->title), "link" => (strstr($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;
}
diff --git a/modules/tracker.module b/modules/tracker.module
index 46d2fee48..21ad284a1 100644
--- a/modules/tracker.module
+++ b/modules/tracker.module
@@ -30,7 +30,7 @@ function tracker_comments($id = 0) {
$output .= "<ul>";
while ($comment = db_fetch_object($cresult)) {
- $output .= " <li><a href=\"node.php?id=$node->nid&cid=$comment->cid&pid=$comment->pid#$comment->cid\">". check_output($comment->subject) ."</a> (". t("replies") .": ". comment_num_replies($comment->cid) .", ". t("votes") .": $comment->votes, ". t("score") .": ". comment_score($comment) .")</li>\n";
+ $output .= " <li><a href=\"node.php?id=$node->nid&cid=$comment->cid&pid=$comment->pid#$comment->cid\">". check_output($comment->subject) ."</a> (". t("replies") .": ". comment_num_replies($comment->cid) .")</li>\n";
}
$output .= " </ul>\n";
}
diff --git a/modules/tracker/tracker.module b/modules/tracker/tracker.module
index 46d2fee48..21ad284a1 100644
--- a/modules/tracker/tracker.module
+++ b/modules/tracker/tracker.module
@@ -30,7 +30,7 @@ function tracker_comments($id = 0) {
$output .= "<ul>";
while ($comment = db_fetch_object($cresult)) {
- $output .= " <li><a href=\"node.php?id=$node->nid&cid=$comment->cid&pid=$comment->pid#$comment->cid\">". check_output($comment->subject) ."</a> (". t("replies") .": ". comment_num_replies($comment->cid) .", ". t("votes") .": $comment->votes, ". t("score") .": ". comment_score($comment) .")</li>\n";
+ $output .= " <li><a href=\"node.php?id=$node->nid&cid=$comment->cid&pid=$comment->pid#$comment->cid\">". check_output($comment->subject) ."</a> (". t("replies") .": ". comment_num_replies($comment->cid) .")</li>\n";
}
$output .= " </ul>\n";
}
diff --git a/modules/user.module b/modules/user.module
index 87133ee06..ee5754b7b 100644
--- a/modules/user.module
+++ b/modules/user.module
@@ -219,7 +219,7 @@ function user_search($keys) {
global $PHP_SELF;
$result = db_query("SELECT * FROM user WHERE name LIKE '%$keys%' LIMIT 20");
while ($account = db_fetch_object($result)) {
- $find[$i++] = array("title" => $account->name, "link" => ($PHP_SELF == "/admin.php" ? "admin.php?mod=user&op=edit&id=$account->uid" : "module.php?mod=user&op=view&id=$account->uid"), "user" => $account->name);
+ $find[$i++] = array("title" => $account->name, "link" => (strstr($PHP_SELF, "admin.php") ? "admin.php?mod=user&op=edit&id=$account->uid" : "module.php?mod=user&op=view&id=$account->uid"), "user" => $account->name);
}
return $find;
}
diff --git a/modules/user/user.module b/modules/user/user.module
index 87133ee06..ee5754b7b 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -219,7 +219,7 @@ function user_search($keys) {
global $PHP_SELF;
$result = db_query("SELECT * FROM user WHERE name LIKE '%$keys%' LIMIT 20");
while ($account = db_fetch_object($result)) {
- $find[$i++] = array("title" => $account->name, "link" => ($PHP_SELF == "/admin.php" ? "admin.php?mod=user&op=edit&id=$account->uid" : "module.php?mod=user&op=view&id=$account->uid"), "user" => $account->name);
+ $find[$i++] = array("title" => $account->name, "link" => (strstr($PHP_SELF, "admin.php") ? "admin.php?mod=user&op=edit&id=$account->uid" : "module.php?mod=user&op=view&id=$account->uid"), "user" => $account->name);
}
return $find;
}