2003-08-30 17:54:37 +02:00
|
|
|
<?php
|
2004-02-12 00:20:38 +01:00
|
|
|
// +-----------------------------------------------------------------------+
|
2011-01-18 01:02:52 +01:00
|
|
|
// | Piwigo - a PHP based photo gallery |
|
2008-04-05 00:57:23 +02:00
|
|
|
// +-----------------------------------------------------------------------+
|
2013-01-01 13:35:02 +01:00
|
|
|
// | Copyright(C) 2008-2013 Piwigo Team http://piwigo.org |
|
2008-04-05 00:57:23 +02:00
|
|
|
// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
|
|
|
|
// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
|
|
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
// | This program is free software; you can redistribute it and/or modify |
|
|
|
|
// | it under the terms of the GNU General Public License as published by |
|
|
|
|
// | the Free Software Foundation |
|
|
|
|
// | |
|
|
|
|
// | This program is distributed in the hope that it will be useful, but |
|
|
|
|
// | WITHOUT ANY WARRANTY; without even the implied warranty of |
|
|
|
|
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
|
|
|
// | General Public License for more details. |
|
2004-02-12 00:20:38 +01:00
|
|
|
// | |
|
|
|
|
// | You should have received a copy of the GNU General Public License |
|
|
|
|
// | along with this program; if not, write to the Free Software |
|
|
|
|
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
|
|
|
|
// | USA. |
|
|
|
|
// +-----------------------------------------------------------------------+
|
2003-08-30 17:54:37 +02:00
|
|
|
|
2004-10-23 11:58:28 +02:00
|
|
|
if(!defined("PHPWG_ROOT_PATH"))
|
2004-09-01 01:05:19 +02:00
|
|
|
{
|
2005-08-18 19:59:00 +02:00
|
|
|
die('Hacking attempt!');
|
2004-09-01 01:05:19 +02:00
|
|
|
}
|
2006-03-09 23:46:28 +01:00
|
|
|
|
|
|
|
include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
|
|
|
|
|
|
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
// | Check Access and exit when user status is not ok |
|
|
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
check_status(ACCESS_ADMINISTRATOR);
|
2005-08-18 19:59:00 +02:00
|
|
|
|
2010-03-19 23:25:39 +01:00
|
|
|
check_input_parameter('image_id', $_GET, false, PATTERN_ID);
|
|
|
|
check_input_parameter('cat_id', $_GET, false, PATTERN_ID);
|
|
|
|
|
2012-02-10 11:52:07 +01:00
|
|
|
// represent
|
|
|
|
$query = '
|
|
|
|
SELECT id
|
|
|
|
FROM '.CATEGORIES_TABLE.'
|
|
|
|
WHERE representative_picture_id = '.$_GET['image_id'].'
|
|
|
|
;';
|
|
|
|
$represent_options_selected = array_from_query($query, 'id');
|
|
|
|
|
2011-01-19 15:51:03 +01:00
|
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
// | delete photo |
|
|
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
|
|
|
|
if (isset($_GET['delete']))
|
|
|
|
{
|
|
|
|
check_pwg_token();
|
|
|
|
|
|
|
|
delete_elements(array($_GET['image_id']), true);
|
2012-07-03 22:19:47 +02:00
|
|
|
invalidate_user_cache();
|
2011-01-19 15:51:03 +01:00
|
|
|
|
|
|
|
// where to redirect the user now?
|
|
|
|
//
|
|
|
|
// 1. if a category is available in the URL, use it
|
|
|
|
// 2. else use the first reachable linked category
|
|
|
|
// 3. redirect to gallery root
|
|
|
|
|
2011-03-30 23:22:47 +02:00
|
|
|
if (isset($_GET['cat_id']) and !empty($_GET['cat_id']))
|
2011-01-19 15:51:03 +01:00
|
|
|
{
|
|
|
|
redirect(
|
|
|
|
make_index_url(
|
|
|
|
array(
|
|
|
|
'category' => get_cat_info($_GET['cat_id'])
|
|
|
|
)
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
$query = '
|
|
|
|
SELECT category_id
|
|
|
|
FROM '.IMAGE_CATEGORY_TABLE.'
|
|
|
|
WHERE image_id = '.$_GET['image_id'].'
|
|
|
|
;';
|
|
|
|
|
|
|
|
$authorizeds = array_diff(
|
|
|
|
array_from_query($query, 'category_id'),
|
|
|
|
explode(',', calculate_permissions($user['id'], $user['status']))
|
|
|
|
);
|
|
|
|
|
|
|
|
foreach ($authorizeds as $category_id)
|
|
|
|
{
|
|
|
|
redirect(
|
|
|
|
make_index_url(
|
|
|
|
array(
|
|
|
|
'category' => get_cat_info($category_id)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
redirect(make_index_url());
|
|
|
|
}
|
|
|
|
|
2005-08-18 19:59:00 +02:00
|
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
// | synchronize metadata |
|
|
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
|
2010-12-14 14:47:24 +01:00
|
|
|
if (isset($_GET['sync_metadata']))
|
2005-08-18 19:59:00 +02:00
|
|
|
{
|
2012-01-03 21:21:13 +01:00
|
|
|
sync_metadata(array( intval($_GET['image_id'])));
|
2005-08-18 19:59:00 +02:00
|
|
|
array_push($page['infos'], l10n('Metadata synchronized from file'));
|
|
|
|
}
|
|
|
|
|
2003-08-30 17:54:37 +02:00
|
|
|
//--------------------------------------------------------- update informations
|
2005-08-18 19:59:00 +02:00
|
|
|
|
2003-08-30 17:54:37 +02:00
|
|
|
// first, we verify whether there is a mistake on the given creation date
|
2005-08-18 19:59:00 +02:00
|
|
|
if (isset($_POST['date_creation_action'])
|
|
|
|
and 'set' == $_POST['date_creation_action'])
|
2003-08-30 17:54:37 +02:00
|
|
|
{
|
2010-03-23 18:38:55 +01:00
|
|
|
if (!is_numeric($_POST['date_creation_year'])
|
|
|
|
or !checkdate(
|
|
|
|
$_POST['date_creation_month'],
|
|
|
|
$_POST['date_creation_day'],
|
|
|
|
$_POST['date_creation_year'])
|
2005-08-18 19:59:00 +02:00
|
|
|
)
|
2004-10-23 11:58:28 +02:00
|
|
|
{
|
2010-03-02 15:54:22 +01:00
|
|
|
array_push($page['errors'], l10n('wrong date'));
|
2004-10-23 11:58:28 +02:00
|
|
|
}
|
2003-08-30 17:54:37 +02:00
|
|
|
}
|
2005-08-18 19:59:00 +02:00
|
|
|
|
2010-12-14 14:47:24 +01:00
|
|
|
if (isset($_POST['submit']) and count($page['errors']) == 0)
|
2003-08-30 17:54:37 +02:00
|
|
|
{
|
2005-08-18 19:59:00 +02:00
|
|
|
$data = array();
|
|
|
|
$data{'id'} = $_GET['image_id'];
|
|
|
|
$data{'name'} = $_POST['name'];
|
|
|
|
$data{'author'} = $_POST['author'];
|
2007-09-13 03:06:34 +02:00
|
|
|
$data['level'] = $_POST['level'];
|
2003-08-30 17:54:37 +02:00
|
|
|
|
2005-08-18 19:59:00 +02:00
|
|
|
if ($conf['allow_html_descriptions'])
|
|
|
|
{
|
|
|
|
$data{'comment'} = @$_POST['description'];
|
|
|
|
}
|
2003-08-30 17:54:37 +02:00
|
|
|
else
|
|
|
|
{
|
2005-08-18 19:59:00 +02:00
|
|
|
$data{'comment'} = strip_tags(@$_POST['description']);
|
|
|
|
}
|
|
|
|
|
2012-02-10 11:52:07 +01:00
|
|
|
if (!empty($_POST['date_creation_year']))
|
2005-08-18 19:59:00 +02:00
|
|
|
{
|
2012-02-10 11:52:07 +01:00
|
|
|
$data{'date_creation'} =
|
|
|
|
$_POST['date_creation_year']
|
|
|
|
.'-'.$_POST['date_creation_month']
|
2013-02-03 16:25:52 +01:00
|
|
|
.'-'.$_POST['date_creation_day']
|
|
|
|
.' '.$_POST['date_creation_time'];
|
2012-02-10 11:52:07 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$data{'date_creation'} = null;
|
2003-08-30 17:54:37 +02:00
|
|
|
}
|
|
|
|
|
2005-08-18 19:59:00 +02:00
|
|
|
mass_updates(
|
|
|
|
IMAGES_TABLE,
|
|
|
|
array(
|
|
|
|
'primary' => array('id'),
|
|
|
|
'update' => array_diff(array_keys($data), array('id'))
|
|
|
|
),
|
|
|
|
array($data)
|
|
|
|
);
|
|
|
|
|
2010-03-19 13:50:19 +01:00
|
|
|
// time to deal with tags
|
2010-03-06 23:10:23 +01:00
|
|
|
$tag_ids = array();
|
2011-06-03 18:40:25 +02:00
|
|
|
if (!empty($_POST['tags']))
|
2010-03-06 23:10:23 +01:00
|
|
|
{
|
2011-05-25 11:00:46 +02:00
|
|
|
$tag_ids = get_tag_ids($_POST['tags']);
|
2010-03-06 23:10:23 +01:00
|
|
|
}
|
2010-03-19 13:50:19 +01:00
|
|
|
set_tags($tag_ids, $_GET['image_id']);
|
2006-04-03 00:26:19 +02:00
|
|
|
|
2012-02-10 11:52:07 +01:00
|
|
|
// association to albums
|
2012-09-18 13:43:36 +02:00
|
|
|
if (!isset($_POST['associate']))
|
|
|
|
{
|
|
|
|
$_POST['associate'] = array();
|
|
|
|
}
|
2012-02-10 11:52:07 +01:00
|
|
|
move_images_to_categories(array($_GET['image_id']), $_POST['associate']);
|
2006-11-15 05:25:12 +01:00
|
|
|
|
2012-02-10 11:52:07 +01:00
|
|
|
// thumbnail for albums
|
|
|
|
if (!isset($_POST['represent']))
|
2004-12-06 23:28:32 +01:00
|
|
|
{
|
2012-02-10 11:52:07 +01:00
|
|
|
$_POST['represent'] = array();
|
2004-12-06 23:28:32 +01:00
|
|
|
}
|
2012-02-10 11:52:07 +01:00
|
|
|
|
|
|
|
$no_longer_thumbnail_for = array_diff($represent_options_selected, $_POST['represent']);
|
|
|
|
if (count($no_longer_thumbnail_for) > 0)
|
|
|
|
{
|
|
|
|
set_random_representant($no_longer_thumbnail_for);
|
|
|
|
}
|
|
|
|
|
|
|
|
$new_thumbnail_for = array_diff($_POST['represent'], $represent_options_selected);
|
|
|
|
if (count($new_thumbnail_for) > 0)
|
|
|
|
{
|
|
|
|
$query = '
|
|
|
|
UPDATE '.CATEGORIES_TABLE.'
|
|
|
|
SET representative_picture_id = '.$_GET['image_id'].'
|
|
|
|
WHERE id IN ('.implode(',', $new_thumbnail_for).')
|
|
|
|
;';
|
|
|
|
pwg_query($query);
|
|
|
|
}
|
|
|
|
|
|
|
|
$represent_options_selected = $_POST['represent'];
|
|
|
|
|
|
|
|
array_push($page['infos'], l10n('Photo informations updated'));
|
2004-12-06 23:28:32 +01:00
|
|
|
}
|
2003-08-30 17:54:37 +02:00
|
|
|
|
2010-03-06 23:10:23 +01:00
|
|
|
// tags
|
|
|
|
$query = '
|
|
|
|
SELECT
|
2011-07-30 06:49:02 +02:00
|
|
|
id,
|
|
|
|
name
|
2010-03-06 23:10:23 +01:00
|
|
|
FROM '.IMAGE_TAG_TABLE.' AS it
|
|
|
|
JOIN '.TAGS_TABLE.' AS t ON t.id = it.tag_id
|
|
|
|
WHERE image_id = '.$_GET['image_id'].'
|
|
|
|
;';
|
2011-05-25 11:00:46 +02:00
|
|
|
$tag_selection = get_taglist($query);
|
|
|
|
|
|
|
|
$query = '
|
|
|
|
SELECT
|
2011-07-30 06:49:02 +02:00
|
|
|
id,
|
|
|
|
name
|
2011-05-25 11:00:46 +02:00
|
|
|
FROM '.TAGS_TABLE.'
|
|
|
|
;';
|
2011-09-29 15:48:49 +02:00
|
|
|
$tags = get_taglist($query, false);
|
2010-03-06 23:10:23 +01:00
|
|
|
|
2003-08-30 17:54:37 +02:00
|
|
|
// retrieving direct information about picture
|
2004-10-23 11:58:28 +02:00
|
|
|
$query = '
|
2005-08-18 19:59:00 +02:00
|
|
|
SELECT *
|
|
|
|
FROM '.IMAGES_TABLE.'
|
|
|
|
WHERE id = '.$_GET['image_id'].'
|
2004-10-23 11:58:28 +02:00
|
|
|
;';
|
2009-11-20 15:17:04 +01:00
|
|
|
$row = pwg_db_fetch_assoc(pwg_query($query));
|
2004-02-02 01:55:18 +01:00
|
|
|
|
2008-09-23 23:26:36 +02:00
|
|
|
$storage_category_id = null;
|
|
|
|
if (!empty($row['storage_category_id']))
|
|
|
|
{
|
|
|
|
$storage_category_id = $row['storage_category_id'];
|
|
|
|
}
|
|
|
|
|
2006-03-22 02:01:47 +01:00
|
|
|
$image_file = $row['file'];
|
- on picture.php, related categories under the element are displayed in
global_rank order
- when adding a new virtual category, initializes its global_rank
- bug fixed : in admin/cat_list, false next rank
- in admin/cat_modify, complete directory is calculated only if category is
not virtual
- admin/picture_modify rewritten : graphically nearer to admin/cat_modify,
virtual associations are back
- update_category partially rewritten : take an array of categories in
parameter, becomes optionnaly recursive, use the set_random_representant
function, set a random representant for categories with elements and no
representant
- bug fixed : on a search results screen, elements belonging to more than 1
category were shown more than once
- bug fixed : in admin/cat_modify, changing a value in a textefield and
hitting enter was setting a new random representant
git-svn-id: http://piwigo.org/svn/trunk@635 68402e56-0260-453c-a942-63ccdbb3a9ee
2004-12-05 22:28:40 +01:00
|
|
|
|
2005-08-18 19:59:00 +02:00
|
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
// | template init |
|
|
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
|
2005-08-17 16:25:38 +02:00
|
|
|
$template->set_filenames(
|
|
|
|
array(
|
2008-09-14 09:16:15 +02:00
|
|
|
'picture_modify' => 'picture_modify.tpl'
|
2005-08-17 16:25:38 +02:00
|
|
|
)
|
|
|
|
);
|
|
|
|
|
2012-02-10 11:52:07 +01:00
|
|
|
$admin_url_start = $admin_photo_base_url.'-properties';
|
2011-01-19 15:51:03 +01:00
|
|
|
$admin_url_start.= isset($_GET['cat_id']) ? '&cat_id='.$_GET['cat_id'] : '';
|
|
|
|
|
2008-02-29 02:25:13 +01:00
|
|
|
$template->assign(
|
2005-08-18 19:59:00 +02:00
|
|
|
array(
|
2011-05-25 11:00:46 +02:00
|
|
|
'tag_selection' => $tag_selection,
|
2010-03-06 23:10:23 +01:00
|
|
|
'tags' => $tags,
|
2011-01-19 15:51:03 +01:00
|
|
|
'U_SYNC' => $admin_url_start.'&sync_metadata=1',
|
|
|
|
'U_DELETE' => $admin_url_start.'&delete=1&pwg_token='.get_pwg_token(),
|
2006-03-22 02:01:47 +01:00
|
|
|
|
2005-08-18 19:59:00 +02:00
|
|
|
'PATH'=>$row['path'],
|
2006-03-22 02:01:47 +01:00
|
|
|
|
2011-12-27 06:26:44 +01:00
|
|
|
'TN_SRC' => DerivativeImage::thumb_url($row),
|
2006-03-22 02:01:47 +01:00
|
|
|
|
2005-08-18 19:59:00 +02:00
|
|
|
'NAME' =>
|
|
|
|
isset($_POST['name']) ?
|
|
|
|
stripslashes($_POST['name']) : @$row['name'],
|
2006-03-22 02:01:47 +01:00
|
|
|
|
2012-02-10 11:52:07 +01:00
|
|
|
'TITLE' => render_element_name($row),
|
|
|
|
|
2005-08-18 19:59:00 +02:00
|
|
|
'DIMENSIONS' => @$row['width'].' * '.@$row['height'],
|
2006-03-22 02:01:47 +01:00
|
|
|
|
2005-08-18 19:59:00 +02:00
|
|
|
'FILESIZE' => @$row['filesize'].' KB',
|
2006-03-22 02:01:47 +01:00
|
|
|
|
2009-02-04 03:41:03 +01:00
|
|
|
'REGISTRATION_DATE' => format_date($row['date_available']),
|
2006-03-22 02:01:47 +01:00
|
|
|
|
2010-07-27 14:37:38 +02:00
|
|
|
'AUTHOR' => htmlspecialchars(
|
|
|
|
isset($_POST['author'])
|
|
|
|
? stripslashes($_POST['author'])
|
|
|
|
: @$row['author']
|
|
|
|
),
|
2006-03-22 02:01:47 +01:00
|
|
|
|
2005-08-18 19:59:00 +02:00
|
|
|
'DESCRIPTION' =>
|
2007-02-27 02:56:16 +01:00
|
|
|
htmlspecialchars( isset($_POST['description']) ?
|
|
|
|
stripslashes($_POST['description']) : @$row['comment'] ),
|
2006-03-22 02:01:47 +01:00
|
|
|
|
2005-08-18 19:59:00 +02:00
|
|
|
'F_ACTION' =>
|
2008-04-19 05:00:11 +02:00
|
|
|
get_root_url().'admin.php'
|
2005-08-18 19:59:00 +02:00
|
|
|
.get_query_string_diff(array('sync_metadata'))
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
2012-02-10 11:52:07 +01:00
|
|
|
$added_by = 'N/A';
|
|
|
|
$query = '
|
|
|
|
SELECT '.$conf['user_fields']['username'].' AS username
|
|
|
|
FROM '.USERS_TABLE.'
|
|
|
|
WHERE '.$conf['user_fields']['id'].' = '.$row['added_by'].'
|
|
|
|
;';
|
|
|
|
$result = pwg_query($query);
|
|
|
|
while ($user_row = pwg_db_fetch_assoc($result))
|
|
|
|
{
|
2012-02-10 17:10:00 +01:00
|
|
|
$row['added_by'] = $user_row['username'];
|
2012-02-10 11:52:07 +01:00
|
|
|
}
|
|
|
|
|
2012-02-10 17:10:00 +01:00
|
|
|
$intro_vars = array(
|
|
|
|
'file' => sprintf(l10n('Original file : %s'), $row['file']),
|
2012-02-10 18:02:54 +01:00
|
|
|
'add_date' => sprintf(l10n('Posted %s on %s'), time_since($row['date_available'], 'year'), format_date($row['date_available'], false, false)),
|
|
|
|
'added_by' => sprintf(l10n('Added by %s'), $row['added_by']),
|
2012-02-10 17:10:00 +01:00
|
|
|
'size' => $row['width'].'×'.$row['height'].' pixels, '.sprintf('%.2f', $row['filesize']/1024).'MB',
|
2012-02-10 18:02:54 +01:00
|
|
|
'stats' => sprintf(l10n('Visited %d times'), $row['hit']),
|
2012-02-10 17:10:00 +01:00
|
|
|
'id' => sprintf(l10n('Numeric identifier : %d'), $row['id']),
|
2012-02-10 11:52:07 +01:00
|
|
|
);
|
|
|
|
|
|
|
|
if ($conf['rate'] and !empty($row['rating_score']))
|
|
|
|
{
|
|
|
|
$query = '
|
|
|
|
SELECT
|
|
|
|
COUNT(*)
|
|
|
|
FROM '.RATE_TABLE.'
|
|
|
|
WHERE element_id = '.$_GET['image_id'].'
|
|
|
|
;';
|
2012-02-10 17:10:00 +01:00
|
|
|
list($row['nb_rates']) = pwg_db_fetch_row(pwg_query($query));
|
2012-02-10 11:52:07 +01:00
|
|
|
|
2012-02-10 18:02:54 +01:00
|
|
|
$intro_vars['stats'].= ', '.sprintf(l10n('Rated %d times, score : %.2f'), $row['nb_rates'], $row['rating_score']);
|
2012-02-10 11:52:07 +01:00
|
|
|
}
|
|
|
|
|
2012-02-10 17:10:00 +01:00
|
|
|
$template->assign('INTRO', $intro_vars);
|
|
|
|
|
2012-02-10 11:52:07 +01:00
|
|
|
|
2012-02-06 21:59:20 +01:00
|
|
|
if (in_array(get_extension($row['path']),$conf['picture_ext']))
|
|
|
|
{
|
|
|
|
$template->assign('U_COI', get_root_url().'admin.php?page=picture_coi&image_id='.$_GET['image_id']);
|
|
|
|
}
|
|
|
|
|
2007-09-13 03:06:34 +02:00
|
|
|
// image level options
|
2008-02-29 02:25:13 +01:00
|
|
|
$selected_level = isset($_POST['level']) ? $_POST['level'] : $row['level'];
|
|
|
|
$template->assign(
|
|
|
|
array(
|
2010-05-01 00:38:17 +02:00
|
|
|
'level_options'=> get_privacy_level_options(),
|
2008-02-29 02:25:13 +01:00
|
|
|
'level_options_selected' => array($selected_level)
|
|
|
|
)
|
|
|
|
);
|
2007-09-13 03:06:34 +02:00
|
|
|
|
2005-08-18 19:59:00 +02:00
|
|
|
// creation date
|
|
|
|
unset($day, $month, $year);
|
|
|
|
|
|
|
|
if (isset($_POST['date_creation_action'])
|
|
|
|
and 'set' == $_POST['date_creation_action'])
|
|
|
|
{
|
2013-02-03 16:25:52 +01:00
|
|
|
foreach (array('day', 'month', 'year', 'time') as $varname)
|
2005-08-18 19:59:00 +02:00
|
|
|
{
|
|
|
|
$$varname = $_POST['date_creation_'.$varname];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (isset($row['date_creation']) and !empty($row['date_creation']))
|
|
|
|
{
|
2013-02-03 16:25:52 +01:00
|
|
|
list($year, $month, $day) = explode('-', substr($row['date_creation'],0,10));
|
|
|
|
$time = substr($row['date_creation'],11);
|
2005-08-18 19:59:00 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
list($year, $month, $day) = array('', 0, 0);
|
2013-02-03 16:25:52 +01:00
|
|
|
$time = '00:00:00';
|
2005-08-18 19:59:00 +02:00
|
|
|
}
|
2008-02-29 02:25:13 +01:00
|
|
|
|
|
|
|
|
|
|
|
$month_list = $lang['month'];
|
|
|
|
$month_list[0]='------------';
|
|
|
|
ksort($month_list);
|
|
|
|
|
|
|
|
$template->assign(
|
|
|
|
array(
|
2013-10-16 21:42:38 +02:00
|
|
|
'DATE_CREATION_DAY_VALUE' => (int)$day,
|
|
|
|
'DATE_CREATION_MONTH_VALUE' => (int)$month,
|
2008-02-29 02:25:13 +01:00
|
|
|
'DATE_CREATION_YEAR_VALUE' => $year,
|
2013-02-03 16:25:52 +01:00
|
|
|
'DATE_CREATION_TIME_VALUE' => $time,
|
2008-02-29 02:25:13 +01:00
|
|
|
'month_list' => $month_list,
|
|
|
|
)
|
|
|
|
);
|
2006-03-22 02:01:47 +01:00
|
|
|
|
2005-08-18 19:59:00 +02:00
|
|
|
$query = '
|
|
|
|
SELECT category_id, uppercats
|
|
|
|
FROM '.IMAGE_CATEGORY_TABLE.' AS ic
|
|
|
|
INNER JOIN '.CATEGORIES_TABLE.' AS c
|
|
|
|
ON c.id = ic.category_id
|
|
|
|
WHERE image_id = '.$_GET['image_id'].'
|
|
|
|
;';
|
|
|
|
$result = pwg_query($query);
|
|
|
|
|
2009-11-20 15:17:04 +01:00
|
|
|
while ($row = pwg_db_fetch_assoc($result))
|
2005-08-18 19:59:00 +02:00
|
|
|
{
|
|
|
|
$name =
|
|
|
|
get_cat_display_name_cache(
|
|
|
|
$row['uppercats'],
|
2012-02-02 00:03:35 +01:00
|
|
|
get_root_url().'admin.php?page=album-',
|
2005-08-18 19:59:00 +02:00
|
|
|
false
|
|
|
|
);
|
2006-03-22 02:01:47 +01:00
|
|
|
|
2005-08-18 19:59:00 +02:00
|
|
|
if ($row['category_id'] == $storage_category_id)
|
|
|
|
{
|
2008-02-29 02:25:13 +01:00
|
|
|
$template->assign('STORAGE_CATEGORY', $name);
|
2005-08-18 19:59:00 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-02-29 02:25:13 +01:00
|
|
|
$template->append('related_categories', $name);
|
2005-08-18 19:59:00 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// jump to link
|
|
|
|
//
|
|
|
|
// 1. find all linked categories that are reachable for the current user.
|
|
|
|
// 2. if a category is available in the URL, use it if reachable
|
|
|
|
// 3. if URL category not available or reachable, use the first reachable
|
|
|
|
// linked category
|
|
|
|
// 4. if no category reachable, no jumpto link
|
|
|
|
|
|
|
|
$query = '
|
|
|
|
SELECT category_id
|
|
|
|
FROM '.IMAGE_CATEGORY_TABLE.'
|
|
|
|
WHERE image_id = '.$_GET['image_id'].'
|
|
|
|
;';
|
2006-03-15 23:44:35 +01:00
|
|
|
|
2005-08-18 19:59:00 +02:00
|
|
|
$authorizeds = array_diff(
|
|
|
|
array_from_query($query, 'category_id'),
|
2006-03-15 23:44:35 +01:00
|
|
|
explode(
|
|
|
|
',',
|
|
|
|
calculate_permissions($user['id'], $user['status'])
|
|
|
|
)
|
2005-08-18 19:59:00 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
if (isset($_GET['cat_id'])
|
|
|
|
and in_array($_GET['cat_id'], $authorizeds))
|
|
|
|
{
|
2006-07-26 23:00:16 +02:00
|
|
|
$url_img = make_picture_url(
|
2006-03-15 23:44:35 +01:00
|
|
|
array(
|
|
|
|
'image_id' => $_GET['image_id'],
|
2006-03-22 02:01:47 +01:00
|
|
|
'image_file' => $image_file,
|
2007-02-27 02:56:16 +01:00
|
|
|
'category' => $cache['cat_names'][ $_GET['cat_id'] ],
|
2006-03-15 23:44:35 +01:00
|
|
|
)
|
|
|
|
);
|
2005-08-18 19:59:00 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
foreach ($authorizeds as $category)
|
|
|
|
{
|
2006-07-26 23:00:16 +02:00
|
|
|
$url_img = make_picture_url(
|
2006-03-15 23:44:35 +01:00
|
|
|
array(
|
|
|
|
'image_id' => $_GET['image_id'],
|
2006-03-22 02:01:47 +01:00
|
|
|
'image_file' => $image_file,
|
2007-02-27 02:56:16 +01:00
|
|
|
'category' => $cache['cat_names'][ $category ],
|
2006-03-15 23:44:35 +01:00
|
|
|
)
|
|
|
|
);
|
2005-08-18 19:59:00 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isset($url_img))
|
|
|
|
{
|
2008-02-29 02:25:13 +01:00
|
|
|
$template->assign( 'U_JUMPTO', $url_img );
|
2005-08-18 19:59:00 +02:00
|
|
|
}
|
2006-03-22 02:01:47 +01:00
|
|
|
|
2012-02-10 11:52:07 +01:00
|
|
|
// associate to albums
|
- on picture.php, related categories under the element are displayed in
global_rank order
- when adding a new virtual category, initializes its global_rank
- bug fixed : in admin/cat_list, false next rank
- in admin/cat_modify, complete directory is calculated only if category is
not virtual
- admin/picture_modify rewritten : graphically nearer to admin/cat_modify,
virtual associations are back
- update_category partially rewritten : take an array of categories in
parameter, becomes optionnaly recursive, use the set_random_representant
function, set a random representant for categories with elements and no
representant
- bug fixed : on a search results screen, elements belonging to more than 1
category were shown more than once
- bug fixed : in admin/cat_modify, changing a value in a textefield and
hitting enter was setting a new random representant
git-svn-id: http://piwigo.org/svn/trunk@635 68402e56-0260-453c-a942-63ccdbb3a9ee
2004-12-05 22:28:40 +01:00
|
|
|
$query = '
|
2012-02-10 11:52:07 +01:00
|
|
|
SELECT id
|
- on picture.php, related categories under the element are displayed in
global_rank order
- when adding a new virtual category, initializes its global_rank
- bug fixed : in admin/cat_list, false next rank
- in admin/cat_modify, complete directory is calculated only if category is
not virtual
- admin/picture_modify rewritten : graphically nearer to admin/cat_modify,
virtual associations are back
- update_category partially rewritten : take an array of categories in
parameter, becomes optionnaly recursive, use the set_random_representant
function, set a random representant for categories with elements and no
representant
- bug fixed : on a search results screen, elements belonging to more than 1
category were shown more than once
- bug fixed : in admin/cat_modify, changing a value in a textefield and
hitting enter was setting a new random representant
git-svn-id: http://piwigo.org/svn/trunk@635 68402e56-0260-453c-a942-63ccdbb3a9ee
2004-12-05 22:28:40 +01:00
|
|
|
FROM '.CATEGORIES_TABLE.'
|
|
|
|
INNER JOIN '.IMAGE_CATEGORY_TABLE.' ON id = category_id
|
2012-02-10 11:52:07 +01:00
|
|
|
WHERE image_id = '.$_GET['image_id'].'
|
2004-12-06 23:28:32 +01:00
|
|
|
;';
|
2012-02-10 11:52:07 +01:00
|
|
|
$associate_options_selected = array_from_query($query, 'id');
|
2004-12-06 23:28:32 +01:00
|
|
|
|
|
|
|
$query = '
|
|
|
|
SELECT id,name,uppercats,global_rank
|
|
|
|
FROM '.CATEGORIES_TABLE.'
|
|
|
|
;';
|
2012-02-10 11:52:07 +01:00
|
|
|
display_select_cat_wrapper($query, $associate_options_selected, 'associate_options');
|
|
|
|
display_select_cat_wrapper($query, $represent_options_selected, 'represent_options');
|
2005-08-17 16:25:38 +02:00
|
|
|
|
2003-08-30 17:54:37 +02:00
|
|
|
//----------------------------------------------------------- sending html code
|
2005-08-17 16:25:38 +02:00
|
|
|
|
2004-09-01 01:05:19 +02:00
|
|
|
$template->assign_var_from_handle('ADMIN_CONTENT', 'picture_modify');
|
2004-02-12 00:20:38 +01:00
|
|
|
?>
|