aboutsummaryrefslogtreecommitdiffstats
path: root/admin/include/photos_add_direct_prepare.inc.php
diff options
context:
space:
mode:
Diffstat (limited to 'admin/include/photos_add_direct_prepare.inc.php')
-rw-r--r--admin/include/photos_add_direct_prepare.inc.php103
1 files changed, 66 insertions, 37 deletions
diff --git a/admin/include/photos_add_direct_prepare.inc.php b/admin/include/photos_add_direct_prepare.inc.php
index f9443553d..117abb802 100644
--- a/admin/include/photos_add_direct_prepare.inc.php
+++ b/admin/include/photos_add_direct_prepare.inc.php
@@ -2,7 +2,7 @@
// +-----------------------------------------------------------------------+
// | Piwigo - a PHP based photo gallery |
// +-----------------------------------------------------------------------+
-// | Copyright(C) 2008-2013 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2008-2014 Piwigo Team http://piwigo.org |
// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
// +-----------------------------------------------------------------------+
@@ -105,6 +105,18 @@ if (pwg_image::get_library() == 'gd')
}
}
+//warn the user if the picture will be resized after upload
+if ($conf['original_resize'])
+{
+ $template->assign(
+ array(
+ 'original_resize_maxwidth' => $conf['original_resize_maxwidth'],
+ 'original_resize_maxheight' => $conf['original_resize_maxheight'],
+ )
+ );
+}
+
+
$upload_modes = array('html', 'multiple');
$upload_mode = isset($conf['upload_mode']) ? $conf['upload_mode'] : 'multiple';
@@ -132,6 +144,13 @@ $template->assign(
);
$upload_file_types = 'jpeg, png, gif';
+
+if (pwg_image::get_library() == 'ext_imagick')
+{
+ $upload_file_types.= ', tiff';
+ $template->assign('tif_enabled', true);
+}
+
if ('html' == $upload_mode)
{
$upload_file_types.= ', zip';
@@ -148,28 +167,52 @@ $template->assign(
// we need to know the category in which the last photo was added
$selected_category = array();
-$selected_parent = array();
-$query = '
-SELECT
- category_id,
- id_uppercat
+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']);
-
- if (!empty($row['id_uppercat']))
+;
+';
+ $result = pwg_query($query);
+ if (pwg_db_num_rows($result) > 0)
{
- $selected_parent = array($row['id_uppercat']);
+ $row = pwg_db_fetch_assoc($result);
+ $selected_category = array($row['category_id']);
}
}
@@ -185,13 +228,6 @@ display_select_cat_wrapper(
'category_options'
);
-// new category
-display_select_cat_wrapper(
- $query,
- $selected_parent,
- 'category_parent_options'
- );
-
// image level options
$selected_level = isset($_POST['level']) ? $_POST['level'] : 0;
@@ -212,12 +248,12 @@ $setup_errors = array();
$error_message = ready_for_upload_message();
if (!empty($error_message))
{
- array_push($setup_errors, $error_message);
+ $setup_errors[] = $error_message;
}
if (!function_exists('gd_info'))
{
- array_push($setup_errors, l10n('GD library is missing'));
+ $setup_errors[] = l10n('GD library is missing');
}
$template->assign(
@@ -238,24 +274,17 @@ if (!isset($_SESSION['upload_hide_warnings']))
if ($conf['use_exif'] and !function_exists('read_exif_data'))
{
- array_push(
- $setup_warnings,
- l10n('Exif extension not available, admin should disable exif use')
- );
+ $setup_warnings[] = l10n('Exif extension not available, admin should disable exif use');
}
if (get_ini_size('upload_max_filesize') > get_ini_size('post_max_size'))
{
- array_push(
- $setup_warnings,
- sprintf(
- l10n('In your php.ini file, the upload_max_filesize (%sB) is bigger than post_max_size (%sB), you should change this setting'),
- get_ini_size('upload_max_filesize', false),
- get_ini_size('post_max_size', false)
- )
+ $setup_warnings[] = l10n(
+ 'In your php.ini file, the upload_max_filesize (%sB) is bigger than post_max_size (%sB), you should change this setting',
+ get_ini_size('upload_max_filesize', false),
+ get_ini_size('post_max_size', false)
);
}
-
$template->assign(
array(
'setup_warnings' => $setup_warnings,