From 2963be60e53916c9c6d579745695a54800876f82 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 17 Jun 2015 18:26:56 -0700 Subject: more photos work --- include/attach.php | 2 +- mod/photos.php | 12 +++++++++--- mod/wall_attach.php | 5 ++++- view/tpl/photos_upload.tpl | 2 +- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/include/attach.php b/include/attach.php index 08aaccb4c..96ce83e2c 100644 --- a/include/attach.php +++ b/include/attach.php @@ -351,12 +351,12 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) { $album = (($arr) ? $arr['album'] : ''); $newalbum = (($arr) ? $arr['newalbum'] : ''); $hash = (($arr && $arr['hash']) ? $arr['hash'] : null); + $upload_path = (($arr && $arr['directory']) ? $arr['directory'] : ''); logger('arr: ' . print_r($arr,true)); // This is currently used only in mod/wall_attach - $str_contact_allow = perms2str(((is_array($arr['contact_allow'])) ? $arr['contact_allow'] : explode(',',$arr['contact_allow']))); if(! perm_is_allowed($channel_id,get_observer_hash(), 'write_storage')) { $ret['message'] = t('Permission denied.'); diff --git a/mod/photos.php b/mod/photos.php index dee027cf9..c65c87c27 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -563,14 +563,20 @@ function photos_content(&$a) { $albums = ((array_key_exists('albums', $a->data)) ? $a->data['albums'] : photos_albums_list($a->data['channel'],$a->data['observer'])); + $def_album = get_pconfig($a->data['channel']['channel_id'],'system','photo_path'); + if($def_album) { + $selname = filepath_macro($def_album); + $albums['album'][] = array('text' => $selname); + } + $tpl = get_markup_template('photos_upload.tpl'); $upload_form = replace_macros($tpl,array( '$pagename' => t('Upload Photos'), '$sessid' => session_id(), '$usage' => $usage_message, '$nickname' => $a->data['channel']['channel_address'], - '$newalbum_label' => t('Enter a new album name'), - '$newalbum_placeholder' => t('or select an existing one (doubleclick)'), + '$newalbum_label' => t('Enter an album name'), + '$newalbum_placeholder' => t('or select an existing album (doubleclick)'), '$visible' => array('visible', t('Create a status post for this upload'), 0, '', array(t('No'), t('Yes'))), '$albums' => $albums['albums'], '$selname' => $selname, @@ -899,7 +905,7 @@ function photos_content(&$a) { } } - if((local_channel()) && (local_user() == $link_item['uid'])) { + if((local_channel()) && (local_channel() == $link_item['uid'])) { q("UPDATE `item` SET item_unseen = 0 WHERE parent = %d and uid = %d and item_unseen = 1", intval($link_item['parent']), intval(local_channel()) diff --git a/mod/wall_attach.php b/mod/wall_attach.php index 9ce16d190..4e30556b6 100644 --- a/mod/wall_attach.php +++ b/mod/wall_attach.php @@ -38,7 +38,10 @@ function wall_attach_post(&$a) { // } // } - $r = attach_store($channel,(($observer) ? $observer['xchan_hash'] : ''),'', array('source' => 'editor', 'visible' => 0, 'contact_allow' => array($channel['channel_hash']))); + $def_album = get_pconfig($channel['channel_id'],'system','photo_path'); + $def_attach = get_pconfig($channel['channel_id'],'system','attach_path'); + + $r = attach_store($channel,(($observer) ? $observer['xchan_hash'] : ''),'', array('source' => 'editor', 'visible' => 0, 'album' => $def_album, 'directory' => $def_attach, 'allow_cid' => '<' . $channel['channel_hash'] . '>')); if(! $r['success']) { notice( $r['message'] . EOL); diff --git a/view/tpl/photos_upload.tpl b/view/tpl/photos_upload.tpl index 06e3ef612..009ee0f9f 100755 --- a/view/tpl/photos_upload.tpl +++ b/view/tpl/photos_upload.tpl @@ -9,7 +9,7 @@ {{foreach $albums as $al}} {{if $al.text}} - -- cgit v1.2.3