summaryrefslogtreecommitdiff
path: root/modules/node/node.module
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2001-05-20 13:51:40 +0000
committerDries Buytaert <dries@buytaert.net>2001-05-20 13:51:40 +0000
commit20397ad3d9dad39670ed92923d2513bd89c7b0bb (patch)
tree1e16b41f8312007e0f0805c6db7c94813f5c05fb /modules/node/node.module
parent3fbd49d786e57ebde5736793a5050cda8796205d (diff)
downloadbrdo-20397ad3d9dad39670ed92923d2513bd89c7b0bb.tar.gz
brdo-20397ad3d9dad39670ed92923d2513bd89c7b0bb.tar.bz2
CHANGES
- Redid settings.module and even renamed it to conf.module. * Settings are now grouped in basic categories like "system settings", "module settings" and "filters". * Added new settings to make Drupal easier to configure and to make some aspects like the watchdog scale better. - Renamed includes/settings.php to includes/conf.php. - Added filter support to conf.module and introduced filter hooks so modules can implement and export new filters. Example filters are an HTML filter (implemented), a profanity filter, an url converter, ASCII smileys to images filter and so on ... - Reworked the check_* functions: user contributed content/input is only verified and filtered once in its lifespan. NOTES - Altough this is a large commit, no database changes are required.
Diffstat (limited to 'modules/node/node.module')
-rw-r--r--modules/node/node.module25
1 files changed, 23 insertions, 2 deletions
diff --git a/modules/node/node.module b/modules/node/node.module
index 53c32219f..98b6482ef 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -11,13 +11,34 @@ class Node {
}
}
-function node_macro($text) {
+function node_conf_filters() {
+ $output .= form_select(t("Strip HTML tags"), "filter_html", variable_get("filter_html", 0), array("Disabled", "Enabled"), t("Strip HTML and PHP tags."));
+ $output .= form_textfield(t("Allowed HTML tags"), "allowed_html", variable_get("allowed_html", "<A><B><BLOCKQUOTE><DD><DL><DT><I><LI><OL><U><UL>"), 64, 128, t("If enabled, optionally specify tags which should not be stripped. 'STYLE' attributes, 'ON' attributes and unclosed tags are always stripped."));
+ $output .= "<HR>";
+ $output .= form_select(t("Strip link tags"), "filter_link", variable_get("filter_link", 0), array("Disabled", "Enabled"), t("Substitute special [[link]] tags."));
+ $output .= "<HR>";
+ return $output;
+}
+
+function node_filter_html($text) {
+ $text = eregi_replace("([ \f\r\t\n\'\"])style=[^>]+", "\\1", $text);
+ $text = eregi_replace("([ \f\r\t\n\'\"])on[a-z]+=[^>]+", "\\1", $text);
+ $text = strip_tags($text, variable_get("allowed_html", ""));
+ return $text;
+}
+
+function node_filter_link($text) {
$src = array("/\[\[(([^\|]*?)(\|([^\|]*?))?)\]\]/e"); // [link|description]
$dst = array(format_tag('\\2', '\\4')); // [link|description]
-
return preg_replace($src, $dst, $text);
}
+function node_filter($text) {
+ if (variable_get("filter_html", 0)) $text = node_filter_html($text);
+ if (variable_get("filter_link", 0)) $text = node_filter_link($text);
+ return $text;
+}
+
function node_overview($query = array()) {
global $user;