diff options
-rw-r--r-- | include/conversation.php | 2 | ||||
-rw-r--r-- | mod/wall_attach.php | 31 | ||||
-rw-r--r-- | version.inc | 2 | ||||
-rwxr-xr-x | view/tpl/jot.tpl | 16 |
4 files changed, 34 insertions, 17 deletions
diff --git a/include/conversation.php b/include/conversation.php index 0e35202fa..a85d582ce 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -1172,7 +1172,7 @@ function status_editor($a, $x, $popup = false) { '$pagetitle' => (x($x,'pagetitle') ? $x['pagetitle'] : ''), '$id_select' => $id_select, '$id_seltext' => t('Post as'), - '$writephoto' => perm_is_allowed($x['profile_uid'], get_observer_hash(), 'post_photos'), + '$writefiles' => (perm_is_allowed($x['profile_uid'], get_observer_hash(), 'post_photos') || perm_is_allowed($x['profile_uid'], get_observer_hash(), 'write_storage')), '$bold' => t('Bold'), '$italic' => t('Italic'), '$underline' => t('Underline'), diff --git a/mod/wall_attach.php b/mod/wall_attach.php index 47c097416..465c3e1cc 100644 --- a/mod/wall_attach.php +++ b/mod/wall_attach.php @@ -2,15 +2,42 @@ require_once('include/attach.php'); require_once('include/identity.php'); +require_once('include/photos.php'); function wall_attach_post(&$a) { if(argc() > 1) $channel = get_channel_by_nick(argv(1)); - else + elseif($_FILES['media']) { + require_once('include/api.php'); + $user_info = api_get_user($a); + $nick = $user_info['screen_name']; + $channel = get_channel_by_nick($user_info['screen_name']); + } + + if(! $channel) killme(); - $r = attach_store($channel,get_observer_hash()); + $observer = $a->get_observer(); + + + if($_FILES['userfile']['tmp_name']) { + $x = getimagesize($_FILES['userfile']['tmp_name']); + if(($x) && ($x[2] === IMG_GIF || $x[2] === IMG_JPG || $x[2] === IMG_JPEG || $x[2] === IMG_PNG)) { + $args = array( 'source' => 'editor', 'visible' => 0, 'contact_allow' => array($channel['channel_hash'])); + $ret = photo_upload($channel,$observer,$args); + if($ret['success']) { + echo "\n\n" . $ret['body'] . "\n\n"; + killme(); + } + if($using_api) + return; + notice($ret['message']); + killme(); + } + } + + $r = attach_store($channel,(($observer) ? $observer['xchan_hash'] : '')); if(! $r['success']) { notice( $r['message'] . EOL); diff --git a/version.inc b/version.inc index 39ff03a5d..430f607a5 100644 --- a/version.inc +++ b/version.inc @@ -1 +1 @@ -2015-03-15.972 +2015-03-16.973 diff --git a/view/tpl/jot.tpl b/view/tpl/jot.tpl index 51ea8eedf..e74afffce 100755 --- a/view/tpl/jot.tpl +++ b/view/tpl/jot.tpl @@ -57,23 +57,14 @@ </div> {{if $visitor}} <div class="btn-group hidden-xs"> - {{if $writephoto}} - <button id="wall-image-upload" class="btn btn-default btn-sm" title="{{$upload}}" > - <i class="icon-camera jot-icons"></i> - </button> - {{/if}} + {{if $writefiles}} <button id="wall-file-upload" class="btn btn-default btn-sm" title="{{$attach}}" > <i id="wall-file-upload-icon" class="icon-paper-clip jot-icons"></i> </button> + {{/if}} <button id="profile-link-wrapper" class="btn btn-default btn-sm" title="{{$weblink}}" ondragenter="linkdropper(event);" ondragover="linkdropper(event);" ondrop="linkdrop(event);" onclick="jotGetLink(); return false;"> <i id="profile-link" class="icon-link jot-icons"></i> </button> - <!--button id="profile-video-wrapper" class="btn btn-default btn-sm" title="{{$video}}" onclick="jotVideoURL();return false;"> - <i id="profile-video" class="icon-facetime-video jot-icons"></i> - </button> - <button id="profile-audio-wrapper" class="btn btn-default btn-sm" title="{{$audio}}" onclick="jotAudioURL();return false;"> - <i id="profile-audio" class="icon-volume-up jot-icons"></i> - </button --> </div> <div class="btn-group hidden-xs hidden-sm"> <button id="profile-location-wrapper" class="btn btn-default btn-sm" title="{{$setloc}}" onclick="jotGetLocation();return false;"> @@ -111,8 +102,7 @@ <li class="visible-xs"><a href="#" onclick="preview_post();return false;"><i class="icon-eye-open"></i> {{$preview}}</a></li> {{if $visitor}} <li class="divider visible-xs"></li> - {{if $writephoto}}<li class="visible-xs"><a id="wall-image-upload-sub" href="#" ><i class="icon-camera"></i> {{$upload}}</a></li>{{/if}} - <li class="visible-xs"><a id="wall-file-upload-sub" href="#" ><i class="icon-paper-clip"></i> {{$attach}}</a></li> + {{if $writefiles}}<li class="visible-xs"><a id="wall-file-upload-sub" href="#" ><i class="icon-paper-clip"></i> {{$attach}}</a></li>{{/if}} <li class="visible-xs"><a href="#" onclick="jotGetLink(); return false;"><i class="icon-link"></i> {{$weblink}}</a></li> <!--li class="visible-xs"><a href="#" onclick="jotVideoURL(); return false;"><i class="icon-facetime-video"></i> {{$video}}</a></li--> <!--li class="visible-xs"><a href="#" onclick="jotAudioURL(); return false;"><i class="icon-volume-up"></i> {{$audio}}</a></li--> |