diff options
author | Friendika <info@friendika.com> | 2011-02-03 15:13:38 -0800 |
---|---|---|
committer | Friendika <info@friendika.com> | 2011-02-03 15:13:38 -0800 |
commit | e2c8bedfe57501f0ac15b09c053f603ea99344d6 (patch) | |
tree | d3076c3374007b68cedca6ff0d2d369adbc1eeea /mod | |
parent | 01cd7cc9f2d811889cebcd410000b03742ded176 (diff) | |
download | volse-hubzilla-e2c8bedfe57501f0ac15b09c053f603ea99344d6.tar.gz volse-hubzilla-e2c8bedfe57501f0ac15b09c053f603ea99344d6.tar.bz2 volse-hubzilla-e2c8bedfe57501f0ac15b09c053f603ea99344d6.zip |
allow changing album name in photo edit page
Diffstat (limited to 'mod')
-rw-r--r-- | mod/photos.php | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/mod/photos.php b/mod/photos.php index 82060378e..f892e2ce2 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -244,20 +244,26 @@ foreach($_FILES AS $key => $val) { return; // NOTREACHED } - if(($a->argc > 2) && ((x($_POST,'desc') !== false) || (x($_POST,'newtag') !== false))) { + if(($a->argc > 2) && ((x($_POST,'desc') !== false) || (x($_POST,'newtag') !== false)) || (x($_POST,'albname') !== false)) { - $desc = ((x($_POST,'desc')) ? notags(trim($_POST['desc'])) : ''); - $rawtags = ((x($_POST,'newtag')) ? notags(trim($_POST['newtag'])) : ''); - $item_id = ((x($_POST,'item_id')) ? intval($_POST['item_id']) : 0); + $desc = ((x($_POST,'desc')) ? notags(trim($_POST['desc'])) : ''); + $rawtags = ((x($_POST,'newtag')) ? notags(trim($_POST['newtag'])) : ''); + $item_id = ((x($_POST,'item_id')) ? intval($_POST['item_id']) : 0); + $albname = ((x($_POST,'albname')) ? notags(trim($_POST['albname'])) : ''); $resource_id = $a->argv[2]; + if(! strlen($albname)) + $albname = datetime_convert('UTC',date_default_timezone_get(),'now', 'Y'); + + $p = q("SELECT * FROM `photo` WHERE `resource-id` = '%s' AND `uid` = %d ORDER BY `scale` DESC", dbesc($resource_id), intval($page_owner_uid) ); - if((count($p)) && ($p[0]['desc'] !== $desc)) { - $r = q("UPDATE `photo` SET `desc` = '%s' WHERE `resource-id` = '%s' AND `uid` = %d", + if((count($p)) && (($p[0]['desc'] !== $desc) || ($p[0]['album'] !== $albname))) { + $r = q("UPDATE `photo` SET `desc` = '%s', `album` = '%s' WHERE `resource-id` = '%s' AND `uid` = %d", dbesc($desc), + dbesc($albname), dbesc($resource_id), intval($page_owner_uid) ); @@ -989,6 +995,8 @@ function photos_content(&$a) { $edit_tpl = load_view_file('view/photo_edit.tpl'); $o .= replace_macros($edit_tpl, array( '$id' => $ph[0]['id'], + '$album' => $ph[0]['album'], + '$newalbum' => t('New album name'), '$nickname' => $a->data['user']['nickname'], '$resource_id' => $ph[0]['resource-id'], '$capt_label' => t('Caption'), |