From a95c2a68aaededb5538da3df4d40c88879c4c45d Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sun, 30 Dec 2001 16:16:38 +0000 Subject: - import.module: + Improved input filtering; this should make the news items look more consistent in terms of mark-up. + Quoted all array indices: converted all instances of $foo[bar] to $foo["bar"]. Made various other changes to make the import module compliant with the coding style. - theme.inc: + Fixed small XHTML glitch - comment system: + Made it possible for users to edit their comments (when certain criteria are matched). + Renamed the SQL table field "lid" to "nid" and updated the code to reflect this change: this is a rather /annoying/ change that has been asked for a few times. It will impact the contributed BBS/forum modules and requires a tiny SQL update: sql> ALTER TABLE comments CHANGE lid nid int(10) NOT NULL; + Moved most (all?) of the comment related logic from node.php to comment.module where it belongs. This also marks a first step towards removing/reducing "node.php". + Added a delete button to the comment admin form and made it so that Drupal prompts for confirmation prior to deleting a comment from the database. This behavior is similar to that of deleting nodes. + Disabled comment moderation for now. + Some of the above changes will make it easier to integrate the upcomcing mail-to-web and web-to-mail gateways. They are part of a bigger plan. ;) - node system: + Made it so that updating nodes (like for instance updating blog entries) won't trigger the submission rate throttle. + Fixed a small glitch where a node's title wasn't always passed to the $theme->header() function. + Made "node_array()" and "node_object()" more generic and named them "object2array()" and "array2object()". + Moved most (all?) of the comment related logic from node.php to comment.module where it belongs. This also marks a first step towards removing/reducing "node.php". - misc: + Applied three patches by Foxen. One to improve performance of the book module, and two other patches to fix small glitches in common.inc. Thanks Foxen! --- includes/common.inc | 40 +++++++++++++++++++++++++++++++++++----- includes/theme.inc | 2 +- 2 files changed, 36 insertions(+), 6 deletions(-) (limited to 'includes') diff --git a/includes/common.inc b/includes/common.inc index 6f70e4820..7c398663e 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -50,6 +50,34 @@ function throttle($type, $rate) { } } +function array2object($node) { + + if (is_array($node)) { + foreach ($node as $key => $value) { + $object->$key = $value; + } + } + else { + $object = $node; + } + + return $object; +} + +function object2array($node) { + + if (is_object($node)) { + foreach ($node as $key => $value) { + $array[$key] = $value; + } + } + else { + $array = $node; + } + + return $array; +} + function path_uri() { global $HTTP_HOST, $REQUEST_URI; return "http://". $HTTP_HOST . substr($REQUEST_URI, 0, strrpos($REQUEST_URI, "/")) ."/"; @@ -287,7 +315,7 @@ function check_input($text) { } function check_output($text, $nl2br = 0) { - return ($text) ? ($nl2br ? nl2br(stripslashes($text)) : stripslashes($text)) : message_na(); + return ($text) ? ($nl2br ? str_replace("\r", "", str_replace("\n", "
", stripslashes($text))) : stripslashes($text)) : message_na(); } function check_file($filename) { @@ -542,14 +570,16 @@ function link_node($node, $main = 0) { function timer_start() { global $timer; - $timer = explode(" ", microtime()); + list($usec, $sec) = explode(" ", microtime()); + $timer = (float)$usec + (float)$sec; } function timer_print() { global $timer; - $stop = explode(" ", microtime()); - $diff = $stop[0] - $timer[0]; - print "
execution time: $diff ms
"; + list($usec, $sec) = explode(" ", microtime()); + $stop = (float)$usec + (float)$sec; + $diff = $stop - $timer; + print "
execution time: $diff sec
"; } function query_print() { diff --git a/includes/theme.inc b/includes/theme.inc index 6279fa0ed..29ee3d8a6 100644 --- a/includes/theme.inc +++ b/includes/theme.inc @@ -27,7 +27,7 @@ class BaseTheme { if ($user->uid) { // Display account settings: - $output .= "
\n"; + $output .= "
\n"; foreach (module_list() as $name) { if (module_hook($name, "link")) { -- cgit v1.2.3