aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2013-11-19 20:19:36 +0000
committerplegall <plg@piwigo.org>2013-11-19 20:19:36 +0000
commite32da625e7e0b28b06281bede491223a2de6678c (patch)
tree8689935b9bb48116f6a656c6532251982f05acb2
parent995b1b33762663423dfa4dd2ccf495e56503f9e2 (diff)
feature 3001: new link "add photos" on album edition page. Patch by msakik
git-svn-id: http://piwigo.org/svn/trunk@25593 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--admin/cat_modify.php1
-rw-r--r--admin/include/photos_add_direct_prepare.inc.php48
-rw-r--r--admin/themes/default/template/cat_modify.tpl2
3 files changed, 43 insertions, 8 deletions
diff --git a/admin/cat_modify.php b/admin/cat_modify.php
index 0ecfef4fb..3a46b7aa5 100644
--- a/admin/cat_modify.php
+++ b/admin/cat_modify.php
@@ -231,6 +231,7 @@ $template->assign(
)
),
+ 'U_ADD_PHOTOS_ALBUM' => $base_url.'photos_add&amp;album='.$category['id'],
'U_CHILDREN' => $cat_list_url.'&amp;parent_id='.$category['id'],
'U_HELP' => get_root_url().'admin/popuphelp.php?page=cat_modify',
diff --git a/admin/include/photos_add_direct_prepare.inc.php b/admin/include/photos_add_direct_prepare.inc.php
index fb5331a47..6b53aaa83 100644
--- a/admin/include/photos_add_direct_prepare.inc.php
+++ b/admin/include/photos_add_direct_prepare.inc.php
@@ -161,20 +161,52 @@ $template->assign(
// we need to know the category in which the last photo was added
$selected_category = array();
-$query = '
+if (isset($_GET['album']))
+{
+ // set the category from get url or ...
+ check_input_parameter('album', $_GET, false, PATTERN_ID);
+
+ // test if album really exists
+ $query = '
+SELECT id
+ FROM '.CATEGORIES_TABLE.'
+ WHERE id = '.$_GET['album'].'
+;';
+ $result = pwg_query($query);
+ if (pwg_db_num_rows($result) == 1)
+ {
+ $selected_category = array($_GET['album']);
+
+ // lets put in the session to persist in case of upload method switch
+ $_SESSION['selected_category'] = $selected_category;
+ }
+ else
+ {
+ fatal_error('[Hacking attempt] the album id = "'.$_GET['album'].'" is not valid');
+ }
+}
+else if (isset($_SESSION['selected_category']))
+{
+ $selected_category = $_SESSION['selected_category'];
+}
+else
+{
+ // we need to know the category in which the last photo was added
+ $query = '
SELECT category_id
FROM '.IMAGES_TABLE.' AS i
JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON image_id = i.id
JOIN '.CATEGORIES_TABLE.' AS c ON category_id = c.id
ORDER BY i.id DESC
LIMIT 1
-;';
-$result = pwg_query($query);
-if (pwg_db_num_rows($result) > 0)
-{
- $row = pwg_db_fetch_assoc($result);
-
- $selected_category = array($row['category_id']);
+;
+';
+ $result = pwg_query($query);
+ if (pwg_db_num_rows($result) > 0)
+ {
+ $row = pwg_db_fetch_assoc($result);
+ $selected_category = array($row['category_id']);
+ }
}
// existing album
diff --git a/admin/themes/default/template/cat_modify.tpl b/admin/themes/default/template/cat_modify.tpl
index 5174960e2..ff411dca7 100644
--- a/admin/themes/default/template/cat_modify.tpl
+++ b/admin/themes/default/template/cat_modify.tpl
@@ -38,6 +38,8 @@
<li><a href="{$U_MANAGE_ELEMENTS}">{'manage album photos'|@translate}</a></li>
{/if}
+ <li style="text-transform:lowercase;"><a href="{$U_ADD_PHOTOS_ALBUM}">{'Add Photos'|translate}</a></li>
+
<li><a href="{$U_CHILDREN}">{'manage sub-albums'|@translate}</a></li>
{if isset($U_SYNC) }