diff options
author | Michael <icarus@dabo.de> | 2012-05-19 16:55:33 +0200 |
---|---|---|
committer | Michael <icarus@dabo.de> | 2012-05-19 16:55:33 +0200 |
commit | 6342b3e0bdd5774857a8fca809994f05e0208d25 (patch) | |
tree | 54114a005e74c8a6d8bad8a490e1d1e41bc4178f /mod/wall_upload.php | |
parent | 2b8c4df544f59d611ad1e8fc0dbc5fcd38bee8f7 (diff) | |
parent | 9a940786c18c1c2bd772aec93f1828f67dc45667 (diff) | |
download | volse-hubzilla-6342b3e0bdd5774857a8fca809994f05e0208d25.tar.gz volse-hubzilla-6342b3e0bdd5774857a8fca809994f05e0208d25.tar.bz2 volse-hubzilla-6342b3e0bdd5774857a8fca809994f05e0208d25.zip |
Merge branch 'master' of github.com:annando/friendica
Diffstat (limited to 'mod/wall_upload.php')
-rw-r--r-- | mod/wall_upload.php | 38 |
1 files changed, 26 insertions, 12 deletions
diff --git a/mod/wall_upload.php b/mod/wall_upload.php index f341cc9cd..fa66561e8 100644 --- a/mod/wall_upload.php +++ b/mod/wall_upload.php @@ -5,19 +5,26 @@ require_once('Photo.php'); function wall_upload_post(&$a) { if($a->argc > 1) { - $nick = $a->argv[1]; - $r = q("SELECT `user`.*, `contact`.`id` FROM `user` LEFT JOIN `contact` on `user`.`uid` = `contact`.`uid` WHERE `user`.`nickname` = '%s' AND `user`.`blocked` = 0 and `contact`.`self` = 1 LIMIT 1", - dbesc($nick) - ); - if(! count($r)) - return; - + if(! x($_FILES,'media')) { + $nick = $a->argv[1]; + $r = q("SELECT `user`.*, `contact`.`id` FROM `user` LEFT JOIN `contact` on `user`.`uid` = `contact`.`uid` WHERE `user`.`nickname` = '%s' AND `user`.`blocked` = 0 and `contact`.`self` = 1 LIMIT 1", + dbesc($nick) + ); + + if(! count($r)) + return; + } + else { + $user_info = api_get_user($a); + $r = q("SELECT `user`.*, `contact`.`id` FROM `user` LEFT JOIN `contact` on `user`.`uid` = `contact`.`uid` WHERE `user`.`nickname` = '%s' AND `user`.`blocked` = 0 and `contact`.`self` = 1 LIMIT 1", + dbesc($user_info['screen_name']) + ); + } } else return; - $can_post = false; $visitor = 0; @@ -47,12 +54,19 @@ function wall_upload_post(&$a) { killme(); } - if(! x($_FILES,'userfile')) + if(! x($_FILES,'userfile') && ! x($_FILES,'media')) killme(); - $src = $_FILES['userfile']['tmp_name']; - $filename = basename($_FILES['userfile']['name']); - $filesize = intval($_FILES['userfile']['size']); + if(x($_FILES,'userfile')) { + $src = $_FILES['userfile']['tmp_name']; + $filename = basename($_FILES['userfile']['name']); + $filesize = intval($_FILES['userfile']['size']); + } + elseif(x($_FILES,'media')) { + $src = $_FILES['media']['tmp_name']; + $filename = basename($_FILES['media']['name']); + $filesize = intval($_FILES['media']['size']); + } $maximagesize = get_config('system','maximagesize'); |