Kyberia v2.0
[mirrors/Kyberia-bloodline.git] / inc / smarty / node_methodz / modifier.preview.php
diff --git a/inc/smarty/node_methodz/modifier.preview.php b/inc/smarty/node_methodz/modifier.preview.php
new file mode 100644 (file)
index 0000000..0ab2c37
--- /dev/null
@@ -0,0 +1,35 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+function smarty_modifier_preview($node_content)
+{
+
+                if (!empty($_POST['no_html'])) {
+                        $node_content=htmlspecialchars($node_content);
+                }
+
+                require(SYSTEM_ROOT.'/inc/htmlparse.inc');
+               global $htmlparse;
+                htmlparse::htmlparse($node_content);
+
+                if (!empty($htmlparse)) {
+                        $error=$htmlparse;
+                       echo "<span class='most_important'> $error </span>";
+                       return false;
+                }
+
+               $node_content = EregI_Replace("((( )|(\n)|(^))+)(http://|ftp://|https://)([[:alnum:]][^,[:space:]]*)","\\2<a target='_blank'href=\"\\6\\7\">\\6\\7</a>",$node_content);
+               $node_content=strip_tags($node_content,'<a><b><i><u><img><br><p><font>');
+                $node_content=str_replace("\n","<br>",$node_content);
+               return $node_content;
+
+}
+
+/* vim: set expandtab: */
+
+?>
This page took 0.153901 seconds and 4 git commands to generate.