]> git.mxchange.org Git - friendica.git/commitdiff
bbcode: Function for cleaning CSS commands (not yet in function)
authorMichael Vogel <icarus@dabo.de>
Fri, 17 Aug 2012 05:59:21 +0000 (07:59 +0200)
committerMichael Vogel <icarus@dabo.de>
Fri, 17 Aug 2012 05:59:21 +0000 (07:59 +0200)
items.php: The detection if a rss/atom-title is identically to the body is improved.

include/bbcode.php
include/items.php

index d83cd35814a9f582c8b117d3b097f4026fe228d5..97e9d76f83f37874cd187c93e294b2d6b53a8aeb 100644 (file)
@@ -3,7 +3,24 @@
 require_once("include/oembed.php");
 require_once('include/event.php');
 
+function cleancss($input) {
 
+       $cleaned = "";
+
+       $input = strtolower($input);
+
+       for ($i = 0; $i < strlen($input); $i++) {
+               $char = substr($input, $i, 1);
+
+               if (($char >= "a") and ($char <= "z"))
+                       $cleaned .= $char;
+
+               if (!(strpos(" #;:0123456789", $char) === false))
+                       $cleaned .= $char;
+       }
+
+       return($cleaned);
+}
 
 function stripcode_br_cb($s) {
        return '[code]' . str_replace('<br />', '', $s[1]) . '[/code]';
index 701a7ada7ec3579596d5ffa525d8d14831c6b4ee..1a664b30109baa792e3cad7723f921223b8852a1 100755 (executable)
@@ -378,10 +378,12 @@ function title_is_body($title, $body) {
 
        $title = strip_tags($title);
        $title = trim($title);
+       $title = html_entity_decode($title, ENT_QUOTES, 'UTF-8');
        $title = str_replace(array("\n", "\r", "\t", " "), array("","","",""), $title);
 
        $body = strip_tags($body);
        $body = trim($body);
+       $body = html_entity_decode($body, ENT_QUOTES, 'UTF-8');
        $body = str_replace(array("\n", "\r", "\t", " "), array("","","",""), $body);
 
        if (strlen($title) < strlen($body))