summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2001-03-25 16:42:52 +0000
committerDries Buytaert <dries@buytaert.net>2001-03-25 16:42:52 +0000
commit5fb307f5bf4d39a4492671ac6223bd65492a1b16 (patch)
tree257bbb055b59144d1ad86feb6a92dce7d8ba7693
parent5b92e9099f45a779359cdf85f27874619bb8358f (diff)
downloadbrdo-5fb307f5bf4d39a4492671ac6223bd65492a1b16.tar.gz
brdo-5fb307f5bf4d39a4492671ac6223bd65492a1b16.tar.bz2
- refactoring, refactoring, refactoring
-rw-r--r--includes/function.inc8
-rw-r--r--includes/hostname.conf2
-rw-r--r--includes/theme.inc2
-rw-r--r--modules/book.module13
-rw-r--r--modules/book/book.module13
-rw-r--r--modules/headline.module2
-rw-r--r--modules/moderation.module2
7 files changed, 30 insertions, 12 deletions
diff --git a/includes/function.inc b/includes/function.inc
index eefbda602..0080a8432 100644
--- a/includes/function.inc
+++ b/includes/function.inc
@@ -2,7 +2,6 @@
$na = "<I>na</I>";
-
function check_textfield($message) {
return strip_tags(str_replace("\"", "&quot;", stripslashes($message)));
}
@@ -17,7 +16,8 @@ function check_export($message) {
function check_textarea($message) {
global $allowed_html;
- return htmlspecialchars(strip_tags(stripslashes($message), $allowed_html));
+ return strip_tags(stripslashes($message), $allowed_html);
+ // return htmlspecialchars(strip_tags(stripslashes($message), $allowed_html));
}
function check_input($message) {
@@ -102,9 +102,9 @@ function format_tag($link, $text) {
function format_text($text) {
- $src = array("/(<\/?)(\w+)([^>]*>)/e", // convert HTML to lower case
+ $src = array( // "/(<\/?)(\w+)([^>]*>)/e", // convert HTML to lower case
"/\[(([^\|]*?)(\|([^\|]*?))?)\]/e"); // [link|description]
- $dst = array("'\\1'. strtolower('\\2') .'\\3'", // convert HTML to lower case
+ $dst = array( // "'\\1'. strtolower('\\2') .'\\3'", // convert HTML to lower case
format_tag('\\2', '\\4')); // [link|description]
return preg_replace($src, $dst, $text);
diff --git a/includes/hostname.conf b/includes/hostname.conf
index 764c1f52b..6b2373b56 100644
--- a/includes/hostname.conf
+++ b/includes/hostname.conf
@@ -31,7 +31,7 @@ $comment_votes = array("none" => "none",
#
# Allowed HTML tags:
#
-$allowed_html = "<A><B><BLOCKQUOTE><DD><DL><DT><EM><HR><I><LI><SMALL><OL><U><UL>";
+$allowed_html = "<A><B><BLOCKQUOTE><CODE><DD><DL><DT><EM><HR><I><LI><SMALL><OL><U><UL>";
#
# Name for anonymous users:
diff --git a/includes/theme.inc b/includes/theme.inc
index 6182f8936..3ac8ded06 100644
--- a/includes/theme.inc
+++ b/includes/theme.inc
@@ -109,7 +109,7 @@ function theme_moderation_results($theme, $node) {
$output .= format_username($account->userid) ." voted '". user_get($account, "history", "n$node->nid") ."'.<BR>";
}
- $theme->box(t("Moderation results"), ($output ? $output : t("This story has not been moderated yet.")));
+ $theme->box(t("Moderation results"), ($output ? $output : t("This node has not been moderated yet.")));
}
}
diff --git a/modules/book.module b/modules/book.module
index 66bedfec9..78199557f 100644
--- a/modules/book.module
+++ b/modules/book.module
@@ -75,6 +75,16 @@ function book_search() {
print search_data($keys, $mod);
}
+function book_toc($parent = 0, $offset = 0, $toc = array()) {
+ global $status;
+ $result = db_query("SELECT n.*, b.* FROM nodes n LEFT JOIN book b ON n.nid = b.node WHERE n.type = 'book' AND n.status = '$status[posted]' AND b.parent = '$parent' ORDER BY b.weight");
+ while ($node = db_fetch_object($result)) {
+ $toc[$node->nid] = ($offset ? $offset : "") ."". ++$number .". $node->title";
+ $toc = book_toc($node->nid, ($offset ? "$offset." : "") ."$number.", $toc);
+ }
+ return $toc;
+}
+
function book_form($edit = array()) {
global $allowed_html, $PHP_SELF, $REQUEST_URI, $status, $theme, $user;
@@ -92,8 +102,7 @@ function book_form($edit = array()) {
}
else {
$output .= "<B>". t("Parent") .":</B><BR>\n";
- $result = db_query("SELECT nid, title FROM nodes WHERE type = 'book' AND status = '$status[posted]'");
- while ($node = db_fetch_object($result)) $options2 .= "<OPTION VALUE=\"$node->nid\"". ($edit[parent] == $node->nid ? " SELECTED" : "") .">". check_select($node->title) ."</OPTION>";
+ foreach (book_toc() as $key=>$value) $options2 .= "<OPTION VALUE=\"$key\"". ($edit[parent] == $key ? " SELECTED" : "") .">". check_select($value) ."</OPTION>";
if (user_access($user, "book")) $options2 .= "<OPTION VALUE=\"0\"". ($edit[parent] == 0 ? " SELECTED" : "") .">&nbsp;</OPTION>";
$output .= "<SELECT NAME=\"edit[parent]\">$options2</SELECT><BR>\n";
$output .= "<SMALL><I>". t("The parent subject or category the new page belongs in.") ."</I></SMALL><P>\n";
diff --git a/modules/book/book.module b/modules/book/book.module
index 66bedfec9..78199557f 100644
--- a/modules/book/book.module
+++ b/modules/book/book.module
@@ -75,6 +75,16 @@ function book_search() {
print search_data($keys, $mod);
}
+function book_toc($parent = 0, $offset = 0, $toc = array()) {
+ global $status;
+ $result = db_query("SELECT n.*, b.* FROM nodes n LEFT JOIN book b ON n.nid = b.node WHERE n.type = 'book' AND n.status = '$status[posted]' AND b.parent = '$parent' ORDER BY b.weight");
+ while ($node = db_fetch_object($result)) {
+ $toc[$node->nid] = ($offset ? $offset : "") ."". ++$number .". $node->title";
+ $toc = book_toc($node->nid, ($offset ? "$offset." : "") ."$number.", $toc);
+ }
+ return $toc;
+}
+
function book_form($edit = array()) {
global $allowed_html, $PHP_SELF, $REQUEST_URI, $status, $theme, $user;
@@ -92,8 +102,7 @@ function book_form($edit = array()) {
}
else {
$output .= "<B>". t("Parent") .":</B><BR>\n";
- $result = db_query("SELECT nid, title FROM nodes WHERE type = 'book' AND status = '$status[posted]'");
- while ($node = db_fetch_object($result)) $options2 .= "<OPTION VALUE=\"$node->nid\"". ($edit[parent] == $node->nid ? " SELECTED" : "") .">". check_select($node->title) ."</OPTION>";
+ foreach (book_toc() as $key=>$value) $options2 .= "<OPTION VALUE=\"$key\"". ($edit[parent] == $key ? " SELECTED" : "") .">". check_select($value) ."</OPTION>";
if (user_access($user, "book")) $options2 .= "<OPTION VALUE=\"0\"". ($edit[parent] == 0 ? " SELECTED" : "") .">&nbsp;</OPTION>";
$output .= "<SELECT NAME=\"edit[parent]\">$options2</SELECT><BR>\n";
$output .= "<SMALL><I>". t("The parent subject or category the new page belongs in.") ."</I></SMALL><P>\n";
diff --git a/modules/headline.module b/modules/headline.module
index 4234d33ef..e4393195b 100644
--- a/modules/headline.module
+++ b/modules/headline.module
@@ -212,7 +212,7 @@ function headline_export($uri) {
while ($node = db_fetch_object($result)) {
print "<item>\n";
print " <title>". check_export($node->title) ."</title>\n";
- print " <link>". $site_url ."node.php?id=$node->id</link>\n";
+ print " <link>". $site_url ."node.php?id=$node->nid</link>\n";
print "</item>\n";
}
diff --git a/modules/moderation.module b/modules/moderation.module
index e9380db5f..4b63f0274 100644
--- a/modules/moderation.module
+++ b/modules/moderation.module
@@ -77,7 +77,7 @@ function moderation_node($id) {
else {
if ($node->pid && $n = node_get_object("nid", $node->pid)) {
if ($node->pid) $output .= " ". t("The above node is a suggested update for an existing node:") ." \"<A HREF=\"node.php?id=$n->nid\">". check_output($n->title) ."</A>\".";
- if ($node->log) $output .= " ". t("The log message to accompany this update is given below:") ."<P>". check_output($node->log, 1) ."</P>";
+ if ($node->log) $output .= " ". t("The log message to accompany this update is given below:") ."<P><I>". check_output($node->log, 1) ."</I></P>";
}
// moderation form: