]> git.mxchange.org Git - friendica-addons.git/commitdiff
Merge pull request #111 from mexon/mailstream
authortobiasd <tobias.diekershoff@gmx.net>
Mon, 1 Apr 2013 03:54:41 +0000 (20:54 -0700)
committertobiasd <tobias.diekershoff@gmx.net>
Mon, 1 Apr 2013 03:54:41 +0000 (20:54 -0700)
* Fix typos in database schema

defaultfeatures/defaultfeatures.php
gpluspost/gpluspost.php
statusnet/statusnet.php
twitter/twitter.php

index ad6a1816112ce4f11478fdee63a1a8e3fcc19fee..fbed22ee8b71c1e8a6a13b116efa73dbd00fbf0c 100755 (executable)
@@ -27,7 +27,7 @@ function defaultfeatures_register($a, $newuid) {
 }
 
 function defaultfeatures_plugin_admin_post (&$a) {
-    check_form_security_token_redirectOnErr('/admin/plugins/defaultfeatures', 'admin_themes');
+    check_form_security_token_redirectOnErr('/admin/plugins/defaultfeatures', 'defaultfeaturessave');
     foreach($_POST as $k => $v) {
            if(strpos($k,'feature_') === 0) {
                    set_config('defaultfeatures',substr($k,8),((intval($v)) ? 1 : 0));
@@ -38,6 +38,7 @@ function defaultfeatures_plugin_admin_post (&$a) {
 
 function defaultfeatures_plugin_admin (&$a, &$o) {
     $t = get_markup_template( "admin.tpl", "addon/defaultfeatures/" );
+    $token = get_form_security_token("defaultfeaturessave");
     $arr = array();
     $features = get_features();
     foreach($features as $fname => $fdata) {
@@ -52,6 +53,7 @@ function defaultfeatures_plugin_admin (&$a, &$o) {
 
     $o = replace_macros($t, array(
         '$submit' => t('Submit'),
-        '$features' => $arr
+        '$features' => $arr,
+        '$form_security_token' => $token
     ));
 }
index 9f0f010275c305268bae9694b0613cdac2cabfc9..db240aa3eeee20229e0645ec3d61ba4237129ffa 100644 (file)
@@ -327,6 +327,16 @@ function gpluspost_feeditem($pid, $uid) {
                                $link = current($links);
                        }
                        $multiplelinks = (sizeof($links) > 1);
+
+                       if ($multiplelinks) {
+                               $html2 = bbcode($msg, false, false);
+                               $links2 = collecturls($html2);
+                               if (sizeof($links2) > 0) {
+                                       reset($links2);
+                                       $link = current($links2);
+                                       $multiplelinks = (sizeof($links2) > 1);
+                               }
+                       }
                }
 
                $msglink = "";
@@ -350,8 +360,8 @@ function gpluspost_feeditem($pid, $uid) {
                        $title = $lines[0];
                }
 
-               if ($image != $msglink)
-                       $html = trim(str_replace($msglink, "", $html));
+               //if ($image != $msglink)
+               //      $html = trim(str_replace($msglink, "", $html));
 
                $title = trim(str_replace($msglink, "", $title));
 
@@ -360,6 +370,8 @@ function gpluspost_feeditem($pid, $uid) {
                if ($uid == 0)
                        $title = $item["author-name"].": ".$title;
 
+               $msglink = htmlspecialchars(html_entity_decode($msglink));
+
                $title = str_replace("&", "&amp;", $title);
                //$html = str_replace("&", "&amp;", $html);
 
index 77bff7a44fe199d7494a43008f490aa7f7639e47..0a9f0d8d439f2bd0379847703f9979d9f1680fc6 100755 (executable)
@@ -498,6 +498,8 @@ function statusnet_shortenmsg($b, $max_char) {
        while (strpos($msg, "  ") !== false)
                $msg = str_replace("  ", " ", $msg);
 
+       $origmsg = $msg;
+
        // Removing URLs
        $msg = preg_replace('/(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)/i', "", $msg);
 
@@ -533,6 +535,10 @@ function statusnet_shortenmsg($b, $max_char) {
        if (($msglink == "") and strlen($msg) > $max_char)
                $msglink = $b["plink"];
 
+       // If the message is short enough then don't modify it. (if the link exists in the original message)
+       if ((strlen(trim($origmsg)) <= $max_char) AND (strpos($origmsg, $msglink) OR ($msglink == "")))
+               return(array("msg"=>trim($origmsg), "image"=>""));
+
        if (strlen($msglink) > 20)
                $msglink = short_link($msglink);
 
index e4848f9db8122cb63f0878477c55246c340da945..8941508eb903a95d791a7d6c59e394c4ae549f96 100755 (executable)
@@ -351,6 +351,8 @@ function twitter_shortenmsg($b) {
        while (strpos($msg, "  ") !== false)
                $msg = str_replace("  ", " ", $msg);
 
+       $origmsg = $msg;
+
        // Removing URLs
        $msg = preg_replace('/(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)/i', "", $msg);
 
@@ -386,6 +388,10 @@ function twitter_shortenmsg($b) {
        if (($msglink == "") and strlen($msg) > $max_char)
                $msglink = $b["plink"];
 
+       // If the message is short enough then don't modify it. (if the link exists in the original message)
+       if ((strlen(trim($origmsg)) <= $max_char) AND (strpos($origmsg, $msglink) OR ($msglink == "")))
+               return(trim($origmsg));
+
        if (strlen($msglink) > 20)
                $msglink = short_link($msglink);