]> git.mxchange.org Git - friendica.git/blobdiff - include/api.php
Merge remote branch 'upstream/master'
[friendica.git] / include / api.php
index 11494ba278078cc38db6cab184f775f6b739d39d..f58a91a72f48224616e09ee047014a304d63de7c 100644 (file)
                        $nick = $name;
 
                // Generating a random ID
-               if (!array_key_exists($nick, $usercache))
+               if (is_null($usercache[$nick]) or !array_key_exists($nick, $usercache))
                        $usercache[$nick] = mt_rand(2000000, 2100000);
 
                $ret = array(
                $_REQUEST['profile_uid'] = local_user();
                if(requestdata('parent'))
                        $_REQUEST['type'] = 'net-comment';
-               else
+               else {
                        $_REQUEST['type'] = 'wall';
+                        if(x($_FILES,'media')) {
+                               // upload the image if we have one
+                               $_REQUEST['hush']='yeah'; //tell wall_upload function to return img info instead of echo
+                               require_once('mod/wall_upload.php');
+                               $media = wall_upload_post($a);
+                               if(strlen($media)>0)
+                                       $_REQUEST['body'] .= "\n\n".$media;
+                               }
+               }
 
                // set this so that the item_post() function is quiet and doesn't redirect or emit json