summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
Diffstat (limited to 'includes')
-rw-r--r--includes/ban.inc3
-rw-r--r--includes/comment.inc4
-rw-r--r--includes/function.inc2
-rw-r--r--includes/node.inc25
-rw-r--r--includes/search.inc2
-rw-r--r--includes/theme.inc6
6 files changed, 22 insertions, 20 deletions
diff --git a/includes/ban.inc b/includes/ban.inc
index 64d2cc434..98f39be6d 100644
--- a/includes/ban.inc
+++ b/includes/ban.inc
@@ -18,7 +18,8 @@ function ban_match($mask, $category) {
return db_fetch_object($result);
}
-function ban_add($mask, $category, $reason, $message = "") {
+// TODO --> $message by reference
+function ban_add($mask, $category, $reason, $message = 0) {
global $index2type;
if (empty($mask)) {
diff --git a/includes/comment.inc b/includes/comment.inc
index c775be98f..57b87583b 100644
--- a/includes/comment.inc
+++ b/includes/comment.inc
@@ -128,14 +128,14 @@ function comment_post($pid, $id, $subject, $comment) {
$duplicate = db_result(db_query("SELECT COUNT(cid) FROM comments WHERE pid = '$pid' AND lid = '$id' AND subject = '$subject' AND comment = '$comment'"), 0);
if ($duplicate != 0) {
- watchdog("error", "comment: attempt to insert duplicate comment");
+ watchdog("warning", "comment: duplicate '$subject'");
}
else {
// Validate subject:
$subject = ($subject) ? $subject : substr($comment, 0, 29);
// Add watchdog entry:
- watchdog("comment", "comment: added comment with subject '$subject'");
+ watchdog("comment", "comment: added '$subject'");
// Add comment to database:
db_query("INSERT INTO comments (lid, pid, author, subject, comment, hostname, timestamp, score) VALUES ('$id', '$pid', '$user->id', '$subject', '$comment', '". getenv("REMOTE_ADDR") ."', '". time() ."', '". ($user->userid ? 1 : 0) ."')");
diff --git a/includes/function.inc b/includes/function.inc
index eb1a08b3c..809fd4ed9 100644
--- a/includes/function.inc
+++ b/includes/function.inc
@@ -48,7 +48,7 @@ function format_interval($timestamp) {
$timestamp = $timestamp % 3600;
}
if ($timestamp >= 60) {
- $output .= " ". floor($timestamp / 60) ."min";
+ $output .= " ". floor($timestamp / 60) ." min";
$timestamp = $timestamp % 60;
}
if ($timestamp > 0) {
diff --git a/includes/node.inc b/includes/node.inc
index d6c7a9744..b58609d04 100644
--- a/includes/node.inc
+++ b/includes/node.inc
@@ -3,9 +3,9 @@
$status = array(dumped => 0, expired => 1, queued => 2, posted => 3, scheduled => 4);
function _node_get($field, $value) {
- $result = db_query("SELECT lid, type FROM nodes WHERE $field = '$value'");
+ $result = db_query("SELECT lid, type FROM node WHERE $field = '$value'");
if ($node = db_fetch_object($result)) {
- return db_query("SELECT n.*, l.*, u.userid FROM nodes n LEFT JOIN $node->type l ON n.lid = l.id AND l.node = n.nid LEFT JOIN users u ON n.author = u.id WHERE n.$field = '$value' ORDER BY n.timestamp DESC");
+ return db_query("SELECT n.*, l.*, u.userid FROM node n LEFT JOIN $node->type l ON n.lid = l.lid AND n.nid = l.nid LEFT JOIN users u ON n.author = u.id WHERE n.$field = '$value' ORDER BY n.timestamp DESC");
}
}
@@ -21,8 +21,9 @@ function node_del($field, $value) {
global $status;
if ($node = node_get_object($field, $value)) {
if ($node->status == $status[dumped]) {
- db_query("DELETE FROM nodes WHERE nid = '$node->nid'");
- db_query("DELETE FROM $node->type WHERE node = '$node->nid'");
+ db_query("DELETE FROM node WHERE nid = '$node->nid'");
+ db_query("DELETE FROM $node->type WHERE lid = '$node->lid' AND nid = '$node->nid'");
+ db_query("DELETE FROM comments WHERE lid = '$node->nid'");
watchdog("message", "node: deleted '$node->title'");
return $node;
}
@@ -50,8 +51,8 @@ function node_save($node) {
$u1 = implode(", ", $u1);
$u2 = implode(", ", $u2);
- db_query("UPDATE nodes SET $u1 WHERE nid = '$node[nid]'");
- db_query("UPDATE $node[type] SET $u2 WHERE node = '$node[nid]'");
+ db_query("UPDATE node SET $u1 WHERE nid = '$node[nid]'");
+ db_query("UPDATE $node[type] SET $u2 WHERE nid = '$node[nid]'");
watchdog("message", "node: modified '$node[title]'");
}
@@ -59,7 +60,7 @@ function node_save($node) {
$duplicate = node_get_object("title", $node[title]);
if ($duplicate && (time() - $duplicate->timestamp < 300)) {
- watchdog("warning", "node: duplicate node '$node[title]'");
+ watchdog("warning", "node: duplicate '$node[title]'");
}
else {
// setup default values:
@@ -87,14 +88,14 @@ function node_save($node) {
$f2 = implode(", ", $f2);
$v2 = implode(", ", $v2);
- db_query("INSERT INTO nodes ($f1) VALUES ($v1)");
+ db_query("INSERT INTO node ($f1) VALUES ($v1)");
if ($nid = db_insert_id()) {
- $lid = db_query("INSERT INTO $node[type] ($f2, node) VALUES ($v2, $nid)");
+ $lid = db_query("INSERT INTO $node[type] ($f2, nid) VALUES ($v2, $nid)");
if ($lid = db_insert_id()) {
- db_query("UPDATE nodes SET lid = '$lid' WHERE nid = '$nid'");
+ db_query("UPDATE node SET lid = '$lid' WHERE nid = '$nid'");
}
else {
- db_query("DELETE FROM nodes WHERE nid = '$nid'");
+ db_query("DELETE FROM node WHERE nid = '$nid'");
}
}
@@ -103,7 +104,7 @@ function node_save($node) {
}
if (($node[pid]) && ($node[status] == $status[posted])) {
- db_query("UPDATE nodes SET status = '$status[expired]' WHERE nid = '$node[pid]'");
+ db_query("UPDATE node SET status = '$status[expired]' WHERE nid = '$node[pid]'");
}
}
diff --git a/includes/search.inc b/includes/search.inc
index 47eefecd9..cf47ebda8 100644
--- a/includes/search.inc
+++ b/includes/search.inc
@@ -11,7 +11,7 @@ function search_form($keys) {
function search_data($keys, $type) {
if ($keys && $type) {
- $result = module_execute($type, "find", $keys);
+ $result = module_execute($type, "find", check_input($keys));
foreach ($result as $entry) {
$output .= "<P>\n";
$output .= " <B><U><A HREF=\"$entry[link]\">$entry[title]</A></U></B><BR>";
diff --git a/includes/theme.inc b/includes/theme.inc
index 3ac8ded06..5ba2daa10 100644
--- a/includes/theme.inc
+++ b/includes/theme.inc
@@ -18,7 +18,7 @@ function theme_link($separator = " | ") {
"<A HREF=\"submit.php\">". t("submit") ."</A>",
"<A HREF=\"module.php?mod=diary\">". t("diary") ."</A>",
"<A HREF=\"account.php\">". t("account") ."</A>",
- "<A HREF=\"module.php?mod=book\">". t("help") ."</A>");
+ "<A HREF=\"module.php?mod=book\">". t("handbook") ."</A>");
return implode($separator, $links);
}
@@ -80,7 +80,7 @@ function theme_blocks($region, $theme) {
switch (strrchr($PHP_SELF, "/")) {
case "/node.php":
if ($region != "left") {
- if ($user->id) $node = db_fetch_object(db_query("SELECT * FROM nodes WHERE nid = '$id'"));
+ if ($user->id) $node = db_fetch_object(db_query("SELECT * FROM node WHERE nid = '$id'"));
if ($node->status == $status[queued]) theme_moderation_results($theme, $node);
// else theme_new_headlines($theme);
}
@@ -118,7 +118,7 @@ function theme_moderation_results($theme, $node) {
// depricated -> new block strategy
//
function theme_new_headlines($theme, $num = 10) {
- $result = db_query("SELECT nid, title FROM nodes WHERE status = 2 AND type = 'story' ORDER BY nid DESC LIMIT $num");
+ $result = db_query("SELECT nid, title FROM node WHERE status = 2 AND type = 'story' ORDER BY nid DESC LIMIT $num");
while ($node = db_fetch_object($result)) $content .= "<LI><A HREF=\"node.php?id=$node->nid\">". check_output($node->title) ."</A></LI>\n";
$theme->box(t("Latest headlines"), $content);
}