diff options
Diffstat (limited to 'includes')
-rw-r--r-- | includes/hostname.conf | 4 | ||||
-rw-r--r-- | includes/node.inc | 54 | ||||
-rw-r--r-- | includes/search.inc | 2 | ||||
-rw-r--r-- | includes/theme.inc | 9 |
4 files changed, 43 insertions, 26 deletions
diff --git a/includes/hostname.conf b/includes/hostname.conf index 57d5f574c..764c1f52b 100644 --- a/includes/hostname.conf +++ b/includes/hostname.conf @@ -58,8 +58,8 @@ $themes = array("UnConeD" => array( # # Submission moderation votes: # The keys of this associative array are displayed in each submission's selection box whereas the corresponding values represent the mathematical calculation to be performed to update a comment's value. -# Warning: changing $submission_votes will affect the integrity of all pending stories in the open submission queue. Do not change this setting unless there are no pending stories in the submission queue or unless you know what you are doing. -$submission_votes = array("neutral (+0)" => "+ 0", +# Warning: changing $moderation_votes will affect the integrity of all pending stories in the open submission queue. Do not change this setting unless there are no pending stories in the submission queue or unless you know what you are doing. +$moderation_votes = array("neutral (+0)" => "+ 0", "post it (+1)" => "+ 1", "dump it (-1)" => "- 1"); diff --git a/includes/node.inc b/includes/node.inc index 824c83ec2..b682b4e4c 100644 --- a/includes/node.inc +++ b/includes/node.inc @@ -1,5 +1,7 @@ <?php +$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'"); if ($node = db_fetch_object($result)) { @@ -32,9 +34,9 @@ function node_del_array($field, $value) { } function node_save($node) { - global $user; + global $user, $status; - $rows = array(nid, lid, type, title, score, votes, author, status, timestamp); + $rows = array(nid, pid, lid, log, type, title, score, votes, author, status, timestamp); // insert or update node: if ($node[nid]) { @@ -55,10 +57,12 @@ function node_save($node) { db_query("UPDATE nodes SET $u1 WHERE nid = '$node[nid]'"); db_query("UPDATE $node[type] SET $u2 WHERE node = '$node[nid]'"); + + watchdog("message", "modified node '$node[title]'"); } else { // setup default values: - $node = array_merge(array(type => "?", title => "?", score => 0, votes => 0, author => $user->id, status => 1, timestamp => time()), $node); + $node = array_merge(array(title => "?", author => $user->id, type => "?", pid => 0, log => "node created", status => $status[queued], score => 0, votes => 0, timestamp => time()), $node); // prepare queries: $f1 = array(); @@ -82,28 +86,36 @@ function node_save($node) { $f2 = implode(", ", $f2); $v2 = implode(", ", $v2); -// if (!_node_get("title = $node[title] AND timestamp < ". time() ." - 60")) { - db_query("INSERT INTO nodes ($f1) VALUES ($v1)"); - if ($nid = db_insert_id()) { - $lid = db_query("INSERT INTO $node[type] ($f2, node) VALUES ($v2, $nid)"); - if ($lid = db_insert_id()) { - db_query("UPDATE nodes SET lid = '$lid' WHERE nid = '$nid'"); - } - else { - db_query("DELETE FROM nodes WHERE nid = '$nid'"); - } + db_query("INSERT INTO nodes ($f1) VALUES ($v1)"); + if ($nid = db_insert_id()) { + $lid = db_query("INSERT INTO $node[type] ($f2, node) VALUES ($v2, $nid)"); + if ($lid = db_insert_id()) { + db_query("UPDATE nodes SET lid = '$lid' WHERE nid = '$nid'"); + } + else { + db_query("DELETE FROM nodes WHERE nid = '$nid'"); } -// } + } + + watchdog("message", "added node '$node[title]'"); + } + + if (($node[pid]) && ($node[status] == $status[posted])) { + db_query("UPDATE nodes SET status = '$status[expired]' WHERE nid = '$node[pid]'"); } } -function node_view($node, $page = 0) { +function node_view($node, $page) { if ($node->type) { $function = $node->type ."_view"; - $function($node); + return $function($node, $page); } - else { - print "not found"; +} + +function node_form($node) { + if ($node[type]) { + $function = $node[type] ."_form"; + return $function($node); } } @@ -122,7 +134,7 @@ function node_info($node) { </SCRIPT> <?php - $choices = array("/node.php?id=$node->nid" => t("view node"), "/node.php?op=update&id=$node->nid" => t("suggest update"), "/node.php?op=history&id=$node->nid" => t("view history"), "/node.php?op=referer&id=$node->nid" => t("view referers")); + $choices = array("/node.php?id=$node->nid" => t("view node"), "/submit.php?mod=$node->type&op=update&id=$node->nid" => t("suggest update"), "/node.php?op=history&id=$node->nid" => t("view history")); $output .= "<FORM METHOD=\"get\" ACTION=\"\">\n"; foreach ($choices as $key => $value) $options .= "<OPTION VALUE=\"$key\"". ($key == $REQUEST_URI ? " SELECTED" : "") .">". check_select($value) ."</OPTION>\n"; @@ -133,8 +145,8 @@ function node_info($node) { } function node_visible($node) { - global $user; - return ($node->status == 2) || ($node->status == 1 && $user->id) || user_access($user, "node"); + global $user, $status; + return ($node->status == $status[posted]) || ($node->status == $status[queued] && $user->id) || user_access($user, "node"); } function node_post_threshold($node, $threshold = 5) { diff --git a/includes/search.inc b/includes/search.inc index 78ec7ed8e..47eefecd9 100644 --- a/includes/search.inc +++ b/includes/search.inc @@ -14,7 +14,7 @@ function search_data($keys, $type) { $result = module_execute($type, "find", $keys); foreach ($result as $entry) { $output .= "<P>\n"; - $output .= " <B><U><A HREF=\"$entry[link]\">$entry[subject]</A></U></B><BR>"; + $output .= " <B><U><A HREF=\"$entry[link]\">$entry[title]</A></U></B><BR>"; $output .= " <SMALL>$site_url$entry[link]". ($entry[user] ? " - ". format_username($entry[user]) : "") ."". ($entry[date] ? " - ". format_date($entry[date], "small") : "") ."</SMALL>"; $output .= "</P>\n"; } diff --git a/includes/theme.inc b/includes/theme.inc index f7fe640dc..6182f8936 100644 --- a/includes/theme.inc +++ b/includes/theme.inc @@ -75,13 +75,13 @@ function theme_account($theme) { function theme_blocks($region, $theme) { - global $id, $PHP_SELF, $user; + global $id, $PHP_SELF, $status, $user; 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 ($node->status == 1) theme_moderation_results($theme, $node); + if ($node->status == $status[queued]) theme_moderation_results($theme, $node); // else theme_new_headlines($theme); } break; @@ -113,6 +113,10 @@ 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"); while ($node = db_fetch_object($result)) $content .= "<LI><A HREF=\"node.php?id=$node->nid\">". check_output($node->title) ."</A></LI>\n"; @@ -132,5 +136,6 @@ function theme_old_headlines($theme, $num = 10) { } $theme->box(t("Older headlines"), $content); } +*/ ?> |