diff options
author | Steven Wittens <steven@10.no-reply.drupal.org> | 2004-01-05 19:19:05 +0000 |
---|---|---|
committer | Steven Wittens <steven@10.no-reply.drupal.org> | 2004-01-05 19:19:05 +0000 |
commit | c2151b52485c84f87cb5ac10ff5a0aa72ed8cff7 (patch) | |
tree | 7d772150943f69e98cd8e2ceec973bbbdced75e9 /includes/common.inc | |
parent | daaeef0e8c39ebd28a865526702870b1e7733804 (diff) | |
download | brdo-c2151b52485c84f87cb5ac10ff5a0aa72ed8cff7.tar.gz brdo-c2151b52485c84f87cb5ac10ff5a0aa72ed8cff7.tar.bz2 |
Committed filter separation patch: all filter-related things are now in filter.module (which is a required module).
To do this cleanly, I reorganised some bits of system.module: there is now a generic handler available for simple variable-get/set based configuration pages. Look at filter_admin() or system_view() for example usage.
(based on the patch by Goba)
Diffstat (limited to 'includes/common.inc')
-rw-r--r-- | includes/common.inc | 109 |
1 files changed, 0 insertions, 109 deletions
diff --git a/includes/common.inc b/includes/common.inc index 2de172c89..304e753ca 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -454,115 +454,6 @@ function check_form($text) { return drupal_specialchars($text, ENT_QUOTES); } -function filter($text) { - $modules = module_list(); - - /* - ** Make sure the HTML filters that are part of the node module - ** are run first. - */ - - if (in_array("node", $modules)) { - $text = module_invoke("node", "filter", $text); - } - - foreach ($modules as $name) { - if (module_hook($name, "filter") && $name != "node") { - $text = module_invoke($name, "filter", $text); - } - } - - return $text; -} - -function rewrite_old_urls($text) { - global $base_url; - - $end = substr($base_url, 12); - - /* - ** This is a *temporary* filter to rewrite old-style URLs to new-style - ** URLs (clean URLs). Currently, URLs are being rewritten dynamically - ** (ie. "on output"), however when these rewrite rules have been tested - ** enough, we will use them to permanently rewrite the links in node - ** and comment bodies. - */ - - if (variable_get("clean_url", "0") == "0") { - /* - ** Relative URLs: - */ - - // rewrite 'node.php?id=<number>[&cid=<number>]' style URLs: - $text = eregi_replace("\"(node)\.php\?id=([[:digit:]]+)(&cid=)?([[:digit:]]*)", "\"?q=\\1/view/\\2/\\4", $text); - - // rewrite 'module.php?mod=<name>{&<op>=<value>}' style URLs: - $text = ereg_replace("\"module\.php\?(&?[[:alpha:]]+=([[:alnum:]]+))(&?[[:alpha:]]+=([[:alnum:]]+))(&?[[:alpha:]]+=([[:alnum:]]+))", "\"?q=\\2/\\4/\\6" , $text); - $text = ereg_replace("\"module\.php\?(&?[[:alpha:]]+=([[:alnum:]]+))(&?[[:alpha:]]+=([[:alnum:]]+))", "\"?q=\\2/\\4", $text); - $text = ereg_replace("\"module\.php\?(&?[[:alpha:]]+=([[:alnum:]]+))", "\"?q=\\2", $text); - - /* - ** Absolute URLs: - */ - - // rewrite 'node.php?id=<number>[&cid=<number>]' style URLs: - $text = eregi_replace("$end/(node)\.php\?id=([[:digit:]]+)(&cid=)?([[:digit:]]*)", "$end/?q=\\1/view/\\2/\\4", $text); - - // rewrite 'module.php?mod=<name>{&<op>=<value>}' style URLs: - $text = ereg_replace("$end/module\.php\?(&?[[:alpha:]]+=([[:alnum:]]+))(&?[[:alpha:]]+=([[:alnum:]]+))(&?[[:alpha:]]+=([[:alnum:]]+))", "$end/?q=\\2/\\4/\\6" , $text); - $text = ereg_replace("$end/module\.php\?(&?[[:alpha:]]+=([[:alnum:]]+))(&?[[:alpha:]]+=([[:alnum:]]+))", "$end/?q=\\2/\\4", $text); - $text = ereg_replace("$end/module\.php\?(&?[[:alpha:]]+=([[:alnum:]]+))", "\"$end/?q=\\2", $text); - } - else { - /* - ** Relative URLs: - */ - - // rewrite 'node.php?id=<number>[&cid=<number>]' style URLs: - $text = eregi_replace("\"(node)\.php\?id=([[:digit:]]+)(&cid=)?([[:digit:]]*)", "\"\\1/view/\\2/\\4", $text); - - // rewrite 'module.php?mod=<name>{&<op>=<value>}' style URLs: - $text = ereg_replace("\"module\.php\?(&?[[:alpha:]]+=([[:alnum:]]+))(&?[[:alpha:]]+=([[:alnum:]]+))(&?[[:alpha:]]+=([[:alnum:]]+))", "\"\\2/\\4/\\6", $text); - $text = ereg_replace("\"module\.php\?(&?[[:alpha:]]+=([[:alnum:]]+))(&?[[:alpha:]]+=([[:alnum:]]+))", "\"\\2/\\4", $text); - $text = ereg_replace("\"module\.php\?(&?[[:alpha:]]+=([[:alnum:]]+))", "\"\\2", $text); - - /* - ** Absolute URLs: - */ - - // rewrite 'node.php?id=<number>[&cid=<number>]' style URLs: - $text = eregi_replace("$end/(node)\.php\?id=([[:digit:]]+)(&cid=)?([[:digit:]]*)", "$end/\\1/view/\\2/\\4", $text); - - // rewrite 'module.php?mod=<name>{&<op>=<value>}' style URLs: - $text = ereg_replace("$end/module\.php\?(&?[[:alpha:]]+=([[:alnum:]]+))(&?[[:alpha:]]+=([[:alnum:]]+))(&?[[:alpha:]]+=([[:alnum:]]+))", "$end/\\2/\\4/\\6", $text); - $text = ereg_replace("$end/module\.php\?(&?[[:alpha:]]+=([[:alnum:]]+))(&?[[:alpha:]]+=([[:alnum:]]+))", "$end/\\2/\\4", $text); - $text = ereg_replace("$end/module\.php\?(&?[[:alpha:]]+=([[:alnum:]]+))", "$end/\\2", $text); -} - - return $text; -} - -function check_output($text) { - if (isset($text)) { - // filter content on output: - $text = filter($text); - - /* - ** If only inline elements are used and no block level elements, we - ** replace all newlines with HTML line breaks. - */ - if (strip_tags($text, '<a><br><span><bdo><map><object><img><tt><i><b><big><small><em><strong><dfn><code><q><samp><kbd><var><cite><abbr><acronym><sub><sup><input><select><textarea><label><button><ins><del><script>') == $text) { - $text = nl2br($text); - } - } - else { - $text = message_na(); - } - - return $text; -} - - function check_file($filename) { return is_uploaded_file($filename); } |