]> git.mxchange.org Git - friendica.git/blobdiff - mod/parse_url.php
Fix SQL error for missing AND operator
[friendica.git] / mod / parse_url.php
index 083a39b55f9012d2733ad55118d41c664d1b38b6..a2b4c9e28a179c44b997a31602f6c0e2587e638f 100644 (file)
@@ -236,7 +236,8 @@ function parse_url_content(&$a) {
        $str_tags = '';
 
        $textmode = false;
-       if(local_user() && intval(get_pconfig(local_user(),'system','plaintext')))
+
+       if(local_user() && (! feature_enabled(local_user(),'richtext')))
                $textmode = true;
 
        //if($textmode)
@@ -307,16 +308,26 @@ function parse_url_content(&$a) {
 
        $image = "";
 
-        if(sizeof($siteinfo["images"]) > 0){
-            /*
-              Execute below code only if image is present in siteinfo
-             */
-            foreach ($siteinfo["images"] as $imagedata)
-               if($textmode)
-                    $image .= '[img='.$imagedata["width"].'x'.$imagedata["height"].']'.$imagedata["src"].'[/img]';
+       if(sizeof($siteinfo["images"]) > 0){
+               /* Execute below code only if image is present in siteinfo */
+
+               $total_images = 0;
+               $max_images = get_config('system','max_bookmark_images');
+               if($max_images === false)
+                       $max_images = 2;
                else
-                    $image .= '<img height="'.$imagedata["height"].'" width="'.$imagedata["width"].'" src="'.$imagedata["src"].'" alt="photo" />';
+                       $max_images = intval($max_images);
+
+               foreach ($siteinfo["images"] as $imagedata) {
+                       if($textmode)
+                               $image .= '[img='.$imagedata["width"].'x'.$imagedata["height"].']'.$imagedata["src"].'[/img]' . "\n";
+                       else
+                               $image .= '<img height="'.$imagedata["height"].'" width="'.$imagedata["width"].'" src="'.$imagedata["src"].'" alt="photo" /><br />';
+                       $total_images ++;
+                       if($max_images && $max_images >= $total_images)
+                               break;
         }
+       }
 
        if(strlen($text)) {
                if($textmode)