Index: tensions/Icy_Picture_Modify/README
===================================================================
--- /extensions/Icy_Picture_Modify/README	(revision 11607)
+++ 	(revision )
@@ -1,44 +1,0 @@
-Name
-  Icy Picture Modify
-
-Description
-  A piwigo extension that allows users to modify pictures they uploaded.
-  This extension just works as the 'picture_modify.php' for administrator.
-
-  The code of this plugin is heavily based on the original source
-  'picture_modify.php' of the Piwigo distribution (version 2.2.3.)
-
-Author
-  icy
-
-License
-  GPL2
-
-Homepage
-  At Github.com: https://github.com/icy/icy_picture_modify
-  At Piwigo.com: http://piwigo.org/ext/extension_view.php?eid=563
-
-Usage
-
-  1. Install and enable the plugin "community" which allows users to upload pictures
-  2. Install and enable this extension
-  3. When users view a picture they uploaded, they will be provided a link
-     to modify that picture's information.
-
-Features
-
-  Users can modify the following information of a picture
-    1. Author
-    2. Description
-    3. Picture's date
-    4. Tags
-    5. ACL
-    6. Synchornize meta data
-    7. Delete picture
-
-Known problems
-
-  1. Doesn't support all known templates
-  2. The source code isn't cleaned up for some hidden features:
-      - Link picture to some albums
-      - Use picture as some albums' thumbnail
Index: tensions/Icy_Picture_Modify/icy_picture_modify.php
===================================================================
--- /extensions/Icy_Picture_Modify/icy_picture_modify.php	(revision 11607)
+++ 	(revision )
@@ -1,531 +1,0 @@
-<?php
-// +-----------------------------------------------------------------------+
-// | Piwigo - a PHP based photo gallery                                    |
-// +-----------------------------------------------------------------------+
-// | Copyright(C) 2008-2011 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 |
-// +-----------------------------------------------------------------------+
-// | 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.                              |
-// |                                                                       |
-// | 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.                                                                  |
-// +-----------------------------------------------------------------------+
-
-if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
-if (!defined('ICY_PICTURE_MODIFY_PATH')) die('Hacking attempt!');
-
-include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
-include_once(ICY_PICTURE_MODIFY_PATH.'include/functions_icy_picture_modify.inc.php');
-
-global $template, $conf, $user, $page, $lang, $cache;
-
-// redirect users to the index page if 'image_id' isn't provided
-if (!isset($_GET['image_id']))
-{
-  if (isset($_GET['cat_id']))
-  {
-    redirect_http(get_root_url().'?/category/'.$_GET['cat_id']);
-  }
-  else
-  {
-    redirect_http(make_index_url());
-  }
-}
-
-check_input_parameter('cat_id', $_GET, false, PATTERN_ID);
-check_input_parameter('image_id', $_GET, false, PATTERN_ID);
-
-// make sure the image is editable by current user
-if (!icy_check_image_owner($_GET['image_id'], $user['id']))
-{
-  $url = make_picture_url(
-      array(
-        'image_id' => $_GET['image_id'],
-        'cat_id' => $_GET['cat_id'],
-      )
-    );
-  redirect_http($url);
-}
-
-// <admin.php>
-$page['errors'] = array();
-$page['infos']  = array();
-$page['warnings']  = array();
-
-if (isset($_SESSION['page_infos']))
-{
-  $page['infos'] = array_merge($page['infos'], $_SESSION['page_infos']);
-  unset($_SESSION['page_infos']);
-}
-// </admin.php>
-
-// +-----------------------------------------------------------------------+
-// |                             delete photo                              |
-// +-----------------------------------------------------------------------+
-
-if (isset($_GET['delete']))
-{
-  check_pwg_token();
-
-  delete_elements(array($_GET['image_id']), true);
-
-  // 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
-
-  if (isset($_GET['cat_id']) and !empty($_GET['cat_id']))
-  {
-    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());
-}
-
-// +-----------------------------------------------------------------------+
-// |                          synchronize metadata                         |
-// +-----------------------------------------------------------------------+
-
-if (isset($_GET['sync_metadata']))
-{
-  $query = '
-SELECT path
-  FROM '.IMAGES_TABLE.'
-  WHERE id = '.$_GET['image_id'].'
-;';
-  list($path) = pwg_db_fetch_row(pwg_query($query));
-  update_metadata(array($_GET['image_id'] => $path));
-
-  array_push($page['infos'], l10n('Metadata synchronized from file'));
-}
-
-//--------------------------------------------------------- update informations
-
-// first, we verify whether there is a mistake on the given creation date
-if (isset($_POST['date_creation_action'])
-    and 'set' == $_POST['date_creation_action'])
-{
-  if (!is_numeric($_POST['date_creation_year'])
-    or !checkdate(
-          $_POST['date_creation_month'],
-          $_POST['date_creation_day'],
-          $_POST['date_creation_year'])
-    )
-  {
-    array_push($page['errors'], l10n('wrong date'));
-  }
-}
-
-if (isset($_POST['submit']) and count($page['errors']) == 0)
-{
-  $data = array();
-  $data{'id'} = $_GET['image_id'];
-  $data{'name'} = $_POST['name'];
-  $data{'author'} = $_POST['author'];
-  $data['level'] = $_POST['level'];
-
-  if ($conf['allow_html_descriptions'])
-  {
-    $data{'comment'} = @$_POST['description'];
-  }
-  else
-  {
-    $data{'comment'} = strip_tags(@$_POST['description']);
-  }
-
-  if (isset($_POST['date_creation_action']))
-  {
-    if ('set' == $_POST['date_creation_action'])
-    {
-      $data{'date_creation'} = $_POST['date_creation_year']
-                                 .'-'.$_POST['date_creation_month']
-                                 .'-'.$_POST['date_creation_day'];
-    }
-    else if ('unset' == $_POST['date_creation_action'])
-    {
-      $data{'date_creation'} = '';
-    }
-  }
-
-  mass_updates(
-    IMAGES_TABLE,
-    array(
-      'primary' => array('id'),
-      'update' => array_diff(array_keys($data), array('id'))
-      ),
-    array($data)
-    );
-
-  // time to deal with tags
-  $tag_ids = array();
-  if (!empty($_POST['tags']))
-  {
-    $tag_ids = get_tag_ids($_POST['tags']);
-  }
-  set_tags($tag_ids, $_GET['image_id']);
-
-  array_push($page['infos'], l10n('Photo informations updated'));
-}
-// associate the element to other categories than its storage category
-if (isset($_POST['associate'])
-    and isset($_POST['cat_dissociated'])
-    and count($_POST['cat_dissociated']) > 0
-  )
-{
-  associate_images_to_categories(
-    array($_GET['image_id']),
-    $_POST['cat_dissociated']
-    );
-}
-// dissociate the element from categories (but not from its storage category)
-if (isset($_POST['dissociate'])
-    and isset($_POST['cat_associated'])
-    and count($_POST['cat_associated']) > 0
-  )
-{
-  $query = '
-DELETE FROM '.IMAGE_CATEGORY_TABLE.'
-  WHERE image_id = '.$_GET['image_id'].'
-    AND category_id IN ('.implode(',', $_POST['cat_associated']).')
-';
-  pwg_query($query);
-
-  update_category($_POST['cat_associated']);
-}
-// elect the element to represent the given categories
-if (isset($_POST['elect'])
-    and isset($_POST['cat_dismissed'])
-    and count($_POST['cat_dismissed']) > 0
-  )
-{
-  $datas = array();
-  foreach ($_POST['cat_dismissed'] as $category_id)
-  {
-    array_push($datas,
-               array('id' => $category_id,
-                     'representative_picture_id' => $_GET['image_id']));
-  }
-  $fields = array('primary' => array('id'),
-                  'update' => array('representative_picture_id'));
-  mass_updates(CATEGORIES_TABLE, $fields, $datas);
-}
-// dismiss the element as representant of the given categories
-if (isset($_POST['dismiss'])
-    and isset($_POST['cat_elected'])
-    and count($_POST['cat_elected']) > 0
-  )
-{
-  set_random_representant($_POST['cat_elected']);
-}
-
-// tags
-$query = '
-SELECT
-    tag_id,
-    name AS tag_name
-  FROM '.IMAGE_TAG_TABLE.' AS it
-    JOIN '.TAGS_TABLE.' AS t ON t.id = it.tag_id
-  WHERE image_id = '.$_GET['image_id'].'
-;';
-$tag_selection = get_taglist($query);
-
-$query = '
-SELECT
-    id AS tag_id,
-    name AS tag_name
-  FROM '.TAGS_TABLE.'
-;';
-$tags = get_taglist($query);
-
-// retrieving direct information about picture
-$query = '
-SELECT *
-  FROM '.IMAGES_TABLE.'
-  WHERE id = '.$_GET['image_id'].'
-;';
-$row = pwg_db_fetch_assoc(pwg_query($query));
-
-$storage_category_id = null;
-if (!empty($row['storage_category_id']))
-{
-  $storage_category_id = $row['storage_category_id'];
-}
-
-$image_file = $row['file'];
-
-// +-----------------------------------------------------------------------+
-// |                             template init                             |
-// +-----------------------------------------------------------------------+
-
-$template->set_template_dir(ICY_PICTURE_MODIFY_PATH.'template/');
-$template->set_filenames(array('icy_picture_modify' => 'icy_picture_modify.tpl'));
-
-$admin_url_start = get_root_url().'index.php?/icy_picture_modify';
-$admin_url_start.= '&amp;image_id='.$_GET['image_id'];
-$admin_url_start.= isset($_GET['cat_id']) ? '&amp;cat_id='.$_GET['cat_id'] : '';
-
-$template->assign(
-  array(
-    'ICY_PICTURE_MODIFY_PATH' => ICY_PICTURE_MODIFY_PATH,
-    'ICY_ROOT_PATH' => realpath(dirname(PHPWG_PLUGINS_PATH)),
-    'tag_selection' => $tag_selection,
-    'tags' => $tags,
-    'U_SYNC' => $admin_url_start.'&amp;sync_metadata=1',
-    'U_DELETE' => $admin_url_start.'&amp;delete=1&amp;pwg_token='.get_pwg_token(),
-
-    'PATH'=>$row['path'],
-
-    'TN_SRC' => get_thumbnail_url($row),
-
-    'NAME' =>
-      isset($_POST['name']) ?
-        stripslashes($_POST['name']) : @$row['name'],
-
-    'DIMENSIONS' => @$row['width'].' * '.@$row['height'],
-
-    'FILESIZE' => @$row['filesize'].' KB',
-
-    'REGISTRATION_DATE' => format_date($row['date_available']),
-
-    'AUTHOR' => htmlspecialchars(
-      isset($_POST['author'])
-        ? stripslashes($_POST['author'])
-        : @$row['author']
-      ),
-
-    'DESCRIPTION' =>
-      htmlspecialchars( isset($_POST['description']) ?
-        stripslashes($_POST['description']) : @$row['comment'] ),
-
-    'F_ACTION' =>
-        get_root_url() # .'index.php?/icy_picture_modify'
-        .get_query_string_diff(array('sync_metadata'))
-    )
-  );
-
-if ($row['has_high'] == 'true')
-{
-  $template->assign(
-    'HIGH_FILESIZE',
-    isset($row['high_filesize'])
-        ? $row['high_filesize'].' KB'
-        : l10n('unknown')
-    );
-}
-
-// image level options
-$selected_level = isset($_POST['level']) ? $_POST['level'] : $row['level'];
-$template->assign(
-    array(
-      'level_options'=> get_privacy_level_options(),
-      'level_options_selected' => array($selected_level)
-    )
-  );
-
-// creation date
-unset($day, $month, $year);
-
-if (isset($_POST['date_creation_action'])
-    and 'set' == $_POST['date_creation_action'])
-{
-  foreach (array('day', 'month', 'year') as $varname)
-  {
-    $$varname = $_POST['date_creation_'.$varname];
-  }
-}
-else if (isset($row['date_creation']) and !empty($row['date_creation']))
-{
-  list($year, $month, $day) = explode('-', $row['date_creation']);
-}
-else
-{
-  list($year, $month, $day) = array('', 0, 0);
-}
-
-
-$month_list = $lang['month'];
-$month_list[0]='------------';
-ksort($month_list);
-
-$template->assign(
-    array(
-      'DATE_CREATION_DAY_VALUE' => $day,
-      'DATE_CREATION_MONTH_VALUE' => $month,
-      'DATE_CREATION_YEAR_VALUE' => $year,
-      'month_list' => $month_list,
-      )
-    );
-
-$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);
-
-while ($row = pwg_db_fetch_assoc($result))
-{
-  $name =
-    get_cat_display_name_cache(
-      $row['uppercats'],
-      get_root_url().'index.php?/icy_picture_modify&amp;cat_id=',
-      false
-      );
-
-  if ($row['category_id'] == $storage_category_id)
-  {
-    $template->assign('STORAGE_CATEGORY', $name);
-  }
-  else
-  {
-    $template->append('related_categories', $name);
-  }
-}
-
-// 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'].'
-;';
-
-$authorizeds = array_diff(
-  array_from_query($query, 'category_id'),
-  explode(
-    ',',
-    calculate_permissions($user['id'], $user['status'])
-    )
-  );
-
-if (isset($_GET['cat_id'])
-    and in_array($_GET['cat_id'], $authorizeds))
-{
-  $url_img = make_picture_url(
-    array(
-      'image_id' => $_GET['image_id'],
-      'image_file' => $image_file,
-      'category' => $cache['cat_names'][ $_GET['cat_id'] ],
-      )
-    );
-}
-else
-{
-  foreach ($authorizeds as $category)
-  {
-    $url_img = make_picture_url(
-      array(
-        'image_id' => $_GET['image_id'],
-        'image_file' => $image_file,
-        'category' => $cache['cat_names'][ $category ],
-        )
-      );
-    break;
-  }
-}
-
-if (isset($url_img))
-{
-  $template->assign( 'U_JUMPTO', $url_img );
-}
-
-// associate to another category ?
-$query = '
-SELECT id,name,uppercats,global_rank
-  FROM '.CATEGORIES_TABLE.'
-    INNER JOIN '.IMAGE_CATEGORY_TABLE.' ON id = category_id
-  WHERE image_id = '.$_GET['image_id'];
-if (isset($storage_category_id))
-{
-  $query.= '
-    AND id != '.$storage_category_id;
-}
-$query.= '
-;';
-display_select_cat_wrapper($query, array(), 'associated_options');
-
-$result = pwg_query($query);
-$associateds = array(-1);
-if (isset($storage_category_id))
-{
-  array_push($associateds, $storage_category_id);
-}
-while ($row = pwg_db_fetch_assoc($result))
-{
-  array_push($associateds, $row['id']);
-}
-$query = '
-SELECT id,name,uppercats,global_rank
-  FROM '.CATEGORIES_TABLE.'
-  WHERE id NOT IN ('.implode(',', $associateds).')
-;';
-display_select_cat_wrapper($query, array(), 'dissociated_options');
-
-// representing
-$query = '
-SELECT id,name,uppercats,global_rank
-  FROM '.CATEGORIES_TABLE.'
-  WHERE representative_picture_id = '.$_GET['image_id'].'
-;';
-display_select_cat_wrapper($query, array(), 'elected_options');
-
-$query = '
-SELECT id,name,uppercats,global_rank
-  FROM '.CATEGORIES_TABLE.'
-  WHERE representative_picture_id != '.$_GET['image_id'].'
-    OR representative_picture_id IS NULL
-;';
-display_select_cat_wrapper($query, array(), 'dismissed_options');
-
-//----------------------------------------------------------- sending html code
-
-$template->assign_var_from_handle('PLUGIN_INDEX_CONTENT_BEGIN', 'icy_picture_modify');
-
-?>
Index: tensions/Icy_Picture_Modify/index.php
===================================================================
--- /extensions/Icy_Picture_Modify/index.php	(revision 11607)
+++ 	(revision )
@@ -1,33 +1,0 @@
-<?php
-// +-----------------------------------------------------------------------+
-// | PhpWebGallery - a PHP based picture gallery                           |
-// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
-// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
-// +-----------------------------------------------------------------------+
-// | file          : $Id: index.php 1912 2007-03-16 06:30:07Z rub $
-// | last update   : $Date: 2007-03-16 07:30:07 +0100 (ven, 16 mar 2007) $
-// | last modifier : $Author: rub $
-// | revision      : $Revision: 1912 $
-// +-----------------------------------------------------------------------+
-// | 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.                              |
-// |                                                                       |
-// | 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.                                                                  |
-// +-----------------------------------------------------------------------+
-
-// Recursive call
-$url = '../';
-header( 'Request-URI: '.$url );
-header( 'Content-Location: '.$url );
-header( 'Location: '.$url );
-exit();
-?>
Index: tensions/Icy_Picture_Modify/main.inc.php
===================================================================
--- /extensions/Icy_Picture_Modify/main.inc.php	(revision 11607)
+++ 	(revision )
@@ -1,62 +1,0 @@
-<?php
-/*
-Plugin Name: Icy User Modify Picture
-Version: 1.0.0
-Description: Allow users to modify users they uploaded
-Plugin URI: https://github.com/icy/icy_picture_modify
-Author: icy
-Author URI: http://metakyanh.sarovar.org/
-*/
-
-if (!defined('PHPWG_ROOT_PATH'))
-{
-  die('Hacking attempt!');
-}
-
-# Should be ./plugins/icy_picture_modify/
-define('ICY_PICTURE_MODIFY_PATH' , PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/');
-include_once(ICY_PICTURE_MODIFY_PATH.'include/functions_icy_picture_modify.inc.php');
-
-add_event_handler('loc_end_section_init', 'icy_picture_modify_section_init');
-function icy_picture_modify_section_init()
-{
-  global $tokens, $page;
-
-  if ($tokens[0] == 'icy_picture_modify')
-  {
-    $page['section'] = 'icy_picture_modify';
-  }
-}
-
-add_event_handler('loc_end_index', 'icy_picture_modify_index');
-function icy_picture_modify_index()
-{
-  global $page;
-
-  if (isset($page['section']) and $page['section'] == 'icy_picture_modify')
-  {
-    include(ICY_PICTURE_MODIFY_PATH.'icy_picture_modify.php');
-  }
-}
-
-// provide the link to modify the picture
-add_event_handler('loc_begin_picture', 'icy_picture_modify_loc_begin_picture');
-function icy_picture_modify_loc_begin_picture()
-{
-  global $conf, $template, $page, $user;
-  if ((!is_admin()) and icy_check_image_owner($page['image_id'], $user['id']))
-  {
-    $url_admin =
-      get_root_url().'index.php?/icy_picture_modify'
-      .'&amp;cat_id='.(isset($page['category']) ? $page['category']['id'] : '')
-      .'&amp;image_id='.$page['image_id'];
-
-    $template->assign(
-      array(
-        'U_ADMIN' => $url_admin,
-        )
-      );
-  }
-}
-
-?>
Index: tensions/Icy_Picture_Modify/maintain.inc.php
===================================================================
--- /extensions/Icy_Picture_Modify/maintain.inc.php	(revision 11607)
+++ 	(revision )
@@ -1,17 +1,0 @@
-<?php
-
-function plugin_install()
-{
-  // do nothing
-}
-
-function plugin_uninstall()
-{
-  // do nothing
-}
-
-function plugin_activate()
-{
-  // do nothing
-}
-?>
Index: /extensions/Icy_Picture_Modify/trunk/README
===================================================================
--- /extensions/Icy_Picture_Modify/trunk/README	(revision 11608)
+++ /extensions/Icy_Picture_Modify/trunk/README	(revision 11608)
@@ -0,0 +1,44 @@
+Name
+  Icy Picture Modify
+
+Description
+  A piwigo extension that allows users to modify pictures they uploaded.
+  This extension just works as the 'picture_modify.php' for administrator.
+
+  The code of this plugin is heavily based on the original source
+  'picture_modify.php' of the Piwigo distribution (version 2.2.3.)
+
+Author
+  icy
+
+License
+  GPL2
+
+Homepage
+  At Github.com: https://github.com/icy/icy_picture_modify
+  At Piwigo.com: http://piwigo.org/ext/extension_view.php?eid=563
+
+Usage
+
+  1. Install and enable the plugin "community" which allows users to upload pictures
+  2. Install and enable this extension
+  3. When users view a picture they uploaded, they will be provided a link
+     to modify that picture's information.
+
+Features
+
+  Users can modify the following information of a picture
+    1. Author
+    2. Description
+    3. Picture's date
+    4. Tags
+    5. ACL
+    6. Synchornize meta data
+    7. Delete picture
+
+Known problems
+
+  1. Doesn't support all known templates
+  2. The source code isn't cleaned up for some hidden features:
+      - Link picture to some albums
+      - Use picture as some albums' thumbnail
Index: /extensions/Icy_Picture_Modify/trunk/icy_picture_modify.php
===================================================================
--- /extensions/Icy_Picture_Modify/trunk/icy_picture_modify.php	(revision 11608)
+++ /extensions/Icy_Picture_Modify/trunk/icy_picture_modify.php	(revision 11608)
@@ -0,0 +1,531 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based photo gallery                                    |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008-2011 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 |
+// +-----------------------------------------------------------------------+
+// | 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.                              |
+// |                                                                       |
+// | 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.                                                                  |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+if (!defined('ICY_PICTURE_MODIFY_PATH')) die('Hacking attempt!');
+
+include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
+include_once(ICY_PICTURE_MODIFY_PATH.'include/functions_icy_picture_modify.inc.php');
+
+global $template, $conf, $user, $page, $lang, $cache;
+
+// redirect users to the index page if 'image_id' isn't provided
+if (!isset($_GET['image_id']))
+{
+  if (isset($_GET['cat_id']))
+  {
+    redirect_http(get_root_url().'?/category/'.$_GET['cat_id']);
+  }
+  else
+  {
+    redirect_http(make_index_url());
+  }
+}
+
+check_input_parameter('cat_id', $_GET, false, PATTERN_ID);
+check_input_parameter('image_id', $_GET, false, PATTERN_ID);
+
+// make sure the image is editable by current user
+if (!icy_check_image_owner($_GET['image_id'], $user['id']))
+{
+  $url = make_picture_url(
+      array(
+        'image_id' => $_GET['image_id'],
+        'cat_id' => $_GET['cat_id'],
+      )
+    );
+  redirect_http($url);
+}
+
+// <admin.php>
+$page['errors'] = array();
+$page['infos']  = array();
+$page['warnings']  = array();
+
+if (isset($_SESSION['page_infos']))
+{
+  $page['infos'] = array_merge($page['infos'], $_SESSION['page_infos']);
+  unset($_SESSION['page_infos']);
+}
+// </admin.php>
+
+// +-----------------------------------------------------------------------+
+// |                             delete photo                              |
+// +-----------------------------------------------------------------------+
+
+if (isset($_GET['delete']))
+{
+  check_pwg_token();
+
+  delete_elements(array($_GET['image_id']), true);
+
+  // 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
+
+  if (isset($_GET['cat_id']) and !empty($_GET['cat_id']))
+  {
+    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());
+}
+
+// +-----------------------------------------------------------------------+
+// |                          synchronize metadata                         |
+// +-----------------------------------------------------------------------+
+
+if (isset($_GET['sync_metadata']))
+{
+  $query = '
+SELECT path
+  FROM '.IMAGES_TABLE.'
+  WHERE id = '.$_GET['image_id'].'
+;';
+  list($path) = pwg_db_fetch_row(pwg_query($query));
+  update_metadata(array($_GET['image_id'] => $path));
+
+  array_push($page['infos'], l10n('Metadata synchronized from file'));
+}
+
+//--------------------------------------------------------- update informations
+
+// first, we verify whether there is a mistake on the given creation date
+if (isset($_POST['date_creation_action'])
+    and 'set' == $_POST['date_creation_action'])
+{
+  if (!is_numeric($_POST['date_creation_year'])
+    or !checkdate(
+          $_POST['date_creation_month'],
+          $_POST['date_creation_day'],
+          $_POST['date_creation_year'])
+    )
+  {
+    array_push($page['errors'], l10n('wrong date'));
+  }
+}
+
+if (isset($_POST['submit']) and count($page['errors']) == 0)
+{
+  $data = array();
+  $data{'id'} = $_GET['image_id'];
+  $data{'name'} = $_POST['name'];
+  $data{'author'} = $_POST['author'];
+  $data['level'] = $_POST['level'];
+
+  if ($conf['allow_html_descriptions'])
+  {
+    $data{'comment'} = @$_POST['description'];
+  }
+  else
+  {
+    $data{'comment'} = strip_tags(@$_POST['description']);
+  }
+
+  if (isset($_POST['date_creation_action']))
+  {
+    if ('set' == $_POST['date_creation_action'])
+    {
+      $data{'date_creation'} = $_POST['date_creation_year']
+                                 .'-'.$_POST['date_creation_month']
+                                 .'-'.$_POST['date_creation_day'];
+    }
+    else if ('unset' == $_POST['date_creation_action'])
+    {
+      $data{'date_creation'} = '';
+    }
+  }
+
+  mass_updates(
+    IMAGES_TABLE,
+    array(
+      'primary' => array('id'),
+      'update' => array_diff(array_keys($data), array('id'))
+      ),
+    array($data)
+    );
+
+  // time to deal with tags
+  $tag_ids = array();
+  if (!empty($_POST['tags']))
+  {
+    $tag_ids = get_tag_ids($_POST['tags']);
+  }
+  set_tags($tag_ids, $_GET['image_id']);
+
+  array_push($page['infos'], l10n('Photo informations updated'));
+}
+// associate the element to other categories than its storage category
+if (isset($_POST['associate'])
+    and isset($_POST['cat_dissociated'])
+    and count($_POST['cat_dissociated']) > 0
+  )
+{
+  associate_images_to_categories(
+    array($_GET['image_id']),
+    $_POST['cat_dissociated']
+    );
+}
+// dissociate the element from categories (but not from its storage category)
+if (isset($_POST['dissociate'])
+    and isset($_POST['cat_associated'])
+    and count($_POST['cat_associated']) > 0
+  )
+{
+  $query = '
+DELETE FROM '.IMAGE_CATEGORY_TABLE.'
+  WHERE image_id = '.$_GET['image_id'].'
+    AND category_id IN ('.implode(',', $_POST['cat_associated']).')
+';
+  pwg_query($query);
+
+  update_category($_POST['cat_associated']);
+}
+// elect the element to represent the given categories
+if (isset($_POST['elect'])
+    and isset($_POST['cat_dismissed'])
+    and count($_POST['cat_dismissed']) > 0
+  )
+{
+  $datas = array();
+  foreach ($_POST['cat_dismissed'] as $category_id)
+  {
+    array_push($datas,
+               array('id' => $category_id,
+                     'representative_picture_id' => $_GET['image_id']));
+  }
+  $fields = array('primary' => array('id'),
+                  'update' => array('representative_picture_id'));
+  mass_updates(CATEGORIES_TABLE, $fields, $datas);
+}
+// dismiss the element as representant of the given categories
+if (isset($_POST['dismiss'])
+    and isset($_POST['cat_elected'])
+    and count($_POST['cat_elected']) > 0
+  )
+{
+  set_random_representant($_POST['cat_elected']);
+}
+
+// tags
+$query = '
+SELECT
+    tag_id,
+    name AS tag_name
+  FROM '.IMAGE_TAG_TABLE.' AS it
+    JOIN '.TAGS_TABLE.' AS t ON t.id = it.tag_id
+  WHERE image_id = '.$_GET['image_id'].'
+;';
+$tag_selection = get_taglist($query);
+
+$query = '
+SELECT
+    id AS tag_id,
+    name AS tag_name
+  FROM '.TAGS_TABLE.'
+;';
+$tags = get_taglist($query);
+
+// retrieving direct information about picture
+$query = '
+SELECT *
+  FROM '.IMAGES_TABLE.'
+  WHERE id = '.$_GET['image_id'].'
+;';
+$row = pwg_db_fetch_assoc(pwg_query($query));
+
+$storage_category_id = null;
+if (!empty($row['storage_category_id']))
+{
+  $storage_category_id = $row['storage_category_id'];
+}
+
+$image_file = $row['file'];
+
+// +-----------------------------------------------------------------------+
+// |                             template init                             |
+// +-----------------------------------------------------------------------+
+
+$template->set_template_dir(ICY_PICTURE_MODIFY_PATH.'template/');
+$template->set_filenames(array('icy_picture_modify' => 'icy_picture_modify.tpl'));
+
+$admin_url_start = get_root_url().'index.php?/icy_picture_modify';
+$admin_url_start.= '&amp;image_id='.$_GET['image_id'];
+$admin_url_start.= isset($_GET['cat_id']) ? '&amp;cat_id='.$_GET['cat_id'] : '';
+
+$template->assign(
+  array(
+    'ICY_PICTURE_MODIFY_PATH' => ICY_PICTURE_MODIFY_PATH,
+    'ICY_ROOT_PATH' => realpath(dirname(PHPWG_PLUGINS_PATH)),
+    'tag_selection' => $tag_selection,
+    'tags' => $tags,
+    'U_SYNC' => $admin_url_start.'&amp;sync_metadata=1',
+    'U_DELETE' => $admin_url_start.'&amp;delete=1&amp;pwg_token='.get_pwg_token(),
+
+    'PATH'=>$row['path'],
+
+    'TN_SRC' => get_thumbnail_url($row),
+
+    'NAME' =>
+      isset($_POST['name']) ?
+        stripslashes($_POST['name']) : @$row['name'],
+
+    'DIMENSIONS' => @$row['width'].' * '.@$row['height'],
+
+    'FILESIZE' => @$row['filesize'].' KB',
+
+    'REGISTRATION_DATE' => format_date($row['date_available']),
+
+    'AUTHOR' => htmlspecialchars(
+      isset($_POST['author'])
+        ? stripslashes($_POST['author'])
+        : @$row['author']
+      ),
+
+    'DESCRIPTION' =>
+      htmlspecialchars( isset($_POST['description']) ?
+        stripslashes($_POST['description']) : @$row['comment'] ),
+
+    'F_ACTION' =>
+        get_root_url() # .'index.php?/icy_picture_modify'
+        .get_query_string_diff(array('sync_metadata'))
+    )
+  );
+
+if ($row['has_high'] == 'true')
+{
+  $template->assign(
+    'HIGH_FILESIZE',
+    isset($row['high_filesize'])
+        ? $row['high_filesize'].' KB'
+        : l10n('unknown')
+    );
+}
+
+// image level options
+$selected_level = isset($_POST['level']) ? $_POST['level'] : $row['level'];
+$template->assign(
+    array(
+      'level_options'=> get_privacy_level_options(),
+      'level_options_selected' => array($selected_level)
+    )
+  );
+
+// creation date
+unset($day, $month, $year);
+
+if (isset($_POST['date_creation_action'])
+    and 'set' == $_POST['date_creation_action'])
+{
+  foreach (array('day', 'month', 'year') as $varname)
+  {
+    $$varname = $_POST['date_creation_'.$varname];
+  }
+}
+else if (isset($row['date_creation']) and !empty($row['date_creation']))
+{
+  list($year, $month, $day) = explode('-', $row['date_creation']);
+}
+else
+{
+  list($year, $month, $day) = array('', 0, 0);
+}
+
+
+$month_list = $lang['month'];
+$month_list[0]='------------';
+ksort($month_list);
+
+$template->assign(
+    array(
+      'DATE_CREATION_DAY_VALUE' => $day,
+      'DATE_CREATION_MONTH_VALUE' => $month,
+      'DATE_CREATION_YEAR_VALUE' => $year,
+      'month_list' => $month_list,
+      )
+    );
+
+$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);
+
+while ($row = pwg_db_fetch_assoc($result))
+{
+  $name =
+    get_cat_display_name_cache(
+      $row['uppercats'],
+      get_root_url().'index.php?/icy_picture_modify&amp;cat_id=',
+      false
+      );
+
+  if ($row['category_id'] == $storage_category_id)
+  {
+    $template->assign('STORAGE_CATEGORY', $name);
+  }
+  else
+  {
+    $template->append('related_categories', $name);
+  }
+}
+
+// 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'].'
+;';
+
+$authorizeds = array_diff(
+  array_from_query($query, 'category_id'),
+  explode(
+    ',',
+    calculate_permissions($user['id'], $user['status'])
+    )
+  );
+
+if (isset($_GET['cat_id'])
+    and in_array($_GET['cat_id'], $authorizeds))
+{
+  $url_img = make_picture_url(
+    array(
+      'image_id' => $_GET['image_id'],
+      'image_file' => $image_file,
+      'category' => $cache['cat_names'][ $_GET['cat_id'] ],
+      )
+    );
+}
+else
+{
+  foreach ($authorizeds as $category)
+  {
+    $url_img = make_picture_url(
+      array(
+        'image_id' => $_GET['image_id'],
+        'image_file' => $image_file,
+        'category' => $cache['cat_names'][ $category ],
+        )
+      );
+    break;
+  }
+}
+
+if (isset($url_img))
+{
+  $template->assign( 'U_JUMPTO', $url_img );
+}
+
+// associate to another category ?
+$query = '
+SELECT id,name,uppercats,global_rank
+  FROM '.CATEGORIES_TABLE.'
+    INNER JOIN '.IMAGE_CATEGORY_TABLE.' ON id = category_id
+  WHERE image_id = '.$_GET['image_id'];
+if (isset($storage_category_id))
+{
+  $query.= '
+    AND id != '.$storage_category_id;
+}
+$query.= '
+;';
+display_select_cat_wrapper($query, array(), 'associated_options');
+
+$result = pwg_query($query);
+$associateds = array(-1);
+if (isset($storage_category_id))
+{
+  array_push($associateds, $storage_category_id);
+}
+while ($row = pwg_db_fetch_assoc($result))
+{
+  array_push($associateds, $row['id']);
+}
+$query = '
+SELECT id,name,uppercats,global_rank
+  FROM '.CATEGORIES_TABLE.'
+  WHERE id NOT IN ('.implode(',', $associateds).')
+;';
+display_select_cat_wrapper($query, array(), 'dissociated_options');
+
+// representing
+$query = '
+SELECT id,name,uppercats,global_rank
+  FROM '.CATEGORIES_TABLE.'
+  WHERE representative_picture_id = '.$_GET['image_id'].'
+;';
+display_select_cat_wrapper($query, array(), 'elected_options');
+
+$query = '
+SELECT id,name,uppercats,global_rank
+  FROM '.CATEGORIES_TABLE.'
+  WHERE representative_picture_id != '.$_GET['image_id'].'
+    OR representative_picture_id IS NULL
+;';
+display_select_cat_wrapper($query, array(), 'dismissed_options');
+
+//----------------------------------------------------------- sending html code
+
+$template->assign_var_from_handle('PLUGIN_INDEX_CONTENT_BEGIN', 'icy_picture_modify');
+
+?>
Index: /extensions/Icy_Picture_Modify/trunk/include/functions_icy_picture_modify.inc.php
===================================================================
--- /extensions/Icy_Picture_Modify/trunk/include/functions_icy_picture_modify.inc.php	(revision 11608)
+++ /extensions/Icy_Picture_Modify/trunk/include/functions_icy_picture_modify.inc.php	(revision 11608)
@@ -0,0 +1,53 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based photo gallery                                    |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008-2011 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 |
+// +-----------------------------------------------------------------------+
+// | 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.                              |
+// |                                                                       |
+// | 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.                                                                  |
+// +-----------------------------------------------------------------------+
+
+/*
+ * Check if the current image is editable by the current user. The input
+ * data $image_id and $user_id must be validated befored being used here.
+ * @return bool
+ * @author icy
+ *
+*/
+function icy_check_image_owner($image_id, $user_id = 0)
+{
+  if (!preg_match(PATTERN_ID, $image_id))
+  {
+    fatal_error('[Hacking attempt] the input parameter "'.$image_id.'" is not valid');
+  }
+  if (!preg_match(PATTERN_ID, $user_id))
+  {
+    fatal_error('[Hacking attempt] the input parameter "'.$user_id.'" is not valid');
+  }
+
+  $query = '
+SELECT COUNT(id)
+  FROM '.IMAGES_TABLE.'
+  WHERE id = '.$image_id.'
+  AND added_by = '.$user_id.'
+;';
+
+  list($count) = pwg_db_fetch_row(pwg_query($query));
+
+  return ($count > 0 ? true: false);
+}
+?>
Index: /extensions/Icy_Picture_Modify/trunk/index.php
===================================================================
--- /extensions/Icy_Picture_Modify/trunk/index.php	(revision 11608)
+++ /extensions/Icy_Picture_Modify/trunk/index.php	(revision 11608)
@@ -0,0 +1,33 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | PhpWebGallery - a PHP based picture gallery                           |
+// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
+// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
+// +-----------------------------------------------------------------------+
+// | file          : $Id: index.php 1912 2007-03-16 06:30:07Z rub $
+// | last update   : $Date: 2007-03-16 07:30:07 +0100 (ven, 16 mar 2007) $
+// | last modifier : $Author: rub $
+// | revision      : $Revision: 1912 $
+// +-----------------------------------------------------------------------+
+// | 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.                              |
+// |                                                                       |
+// | 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.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: /extensions/Icy_Picture_Modify/trunk/main.inc.php
===================================================================
--- /extensions/Icy_Picture_Modify/trunk/main.inc.php	(revision 11608)
+++ /extensions/Icy_Picture_Modify/trunk/main.inc.php	(revision 11608)
@@ -0,0 +1,62 @@
+<?php
+/*
+Plugin Name: Icy User Modify Picture
+Version: 1.0.0
+Description: Allow users to modify users they uploaded
+Plugin URI: https://github.com/icy/icy_picture_modify
+Author: icy
+Author URI: http://metakyanh.sarovar.org/
+*/
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+  die('Hacking attempt!');
+}
+
+# Should be ./plugins/icy_picture_modify/
+define('ICY_PICTURE_MODIFY_PATH' , PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/');
+include_once(ICY_PICTURE_MODIFY_PATH.'include/functions_icy_picture_modify.inc.php');
+
+add_event_handler('loc_end_section_init', 'icy_picture_modify_section_init');
+function icy_picture_modify_section_init()
+{
+  global $tokens, $page;
+
+  if ($tokens[0] == 'icy_picture_modify')
+  {
+    $page['section'] = 'icy_picture_modify';
+  }
+}
+
+add_event_handler('loc_end_index', 'icy_picture_modify_index');
+function icy_picture_modify_index()
+{
+  global $page;
+
+  if (isset($page['section']) and $page['section'] == 'icy_picture_modify')
+  {
+    include(ICY_PICTURE_MODIFY_PATH.'icy_picture_modify.php');
+  }
+}
+
+// provide the link to modify the picture
+add_event_handler('loc_begin_picture', 'icy_picture_modify_loc_begin_picture');
+function icy_picture_modify_loc_begin_picture()
+{
+  global $conf, $template, $page, $user;
+  if ((!is_admin()) and icy_check_image_owner($page['image_id'], $user['id']))
+  {
+    $url_admin =
+      get_root_url().'index.php?/icy_picture_modify'
+      .'&amp;cat_id='.(isset($page['category']) ? $page['category']['id'] : '')
+      .'&amp;image_id='.$page['image_id'];
+
+    $template->assign(
+      array(
+        'U_ADMIN' => $url_admin,
+        )
+      );
+  }
+}
+
+?>
Index: /extensions/Icy_Picture_Modify/trunk/maintain.inc.php
===================================================================
--- /extensions/Icy_Picture_Modify/trunk/maintain.inc.php	(revision 11608)
+++ /extensions/Icy_Picture_Modify/trunk/maintain.inc.php	(revision 11608)
@@ -0,0 +1,17 @@
+<?php
+
+function plugin_install()
+{
+  // do nothing
+}
+
+function plugin_uninstall()
+{
+  // do nothing
+}
+
+function plugin_activate()
+{
+  // do nothing
+}
+?>
Index: /extensions/Icy_Picture_Modify/trunk/template/autosize.inc.tpl
===================================================================
--- /extensions/Icy_Picture_Modify/trunk/template/autosize.inc.tpl	(revision 11608)
+++ /extensions/Icy_Picture_Modify/trunk/template/autosize.inc.tpl	(revision 11608)
@@ -0,0 +1,9 @@
+{combine_script id='jquery.autogrow' load='async' require='jquery' path="themes/default/js/plugins/jquery.autogrow-textarea.js"}
+{* Auto size and auto grow textarea *}
+{footer_script require='jquery.autogrow'}{literal}
+jQuery(document).ready(function(){
+	jQuery('textarea').css('overflow-y', 'hidden');
+	// Auto size and auto grow for all text area
+	jQuery('textarea').autogrow();
+});
+{/literal}{/footer_script}
Index: /extensions/Icy_Picture_Modify/trunk/template/datepicker.css
===================================================================
--- /extensions/Icy_Picture_Modify/trunk/template/datepicker.css	(revision 11608)
+++ /extensions/Icy_Picture_Modify/trunk/template/datepicker.css	(revision 11608)
@@ -0,0 +1,23 @@
+#ui-datepicker-div {background-color: #555; border:2px solid #333;}
+#ui-datepicker-div .ui-datepicker-title {color:white;}
+#ui-datepicker-div .ui-icon-circle-triangle-w {background: transparent url(icon/prev.png) no-repeat;}
+#ui-datepicker-div .ui-icon-circle-triangle-e {background: transparent url(icon/next.png) no-repeat;}
+#ui-datepicker-div A.ui-datepicker-prev:hover,
+#ui-datepicker-div A.ui-datepicker-next:hover
+{
+  background-color:#eee;border:1px solid #aaa;
+}
+.ui-datepicker th {color:#ccc;}
+.ui-state-disabled {color:#aaa;}
+
+#ui-datepicker-div .ui-datepicker-control, #ui-datepicker-div  a { background-color: #111; color: #f70 !important;}
+#ui-datepicker-div .ui-datepicker-days-row { background-color: #444;}
+#ui-datepicker-div .ui-datepicker-week-end-cell, #ui-datepicker-div .ui-datepicker-week-end-cell  a { background-color: #222; color: #f33; border-color: #444; border-top-color: #222; border-left-color: #222;}
+#ui-datepicker-div .ui-datepicker-title-row { background-color: #111;}
+#ui-datepicker-div .ui-datepicker-title-row .ui-datepicker-week-end-cell a { color: #f33;}
+#ui-datepicker-div  a:hover { color: #ff3333 !important; border: 0; background-color: #111 !important;}
+#ui-datepicker-div .ui-datepicker-header select { background-color:#444; color:#999; font-weight:normal;}
+#ui-datepicker-div .ui-datepicker-links { background-color:#222;}
+#ui-datepicker-div .ui-datepicker-header { background-color:#444;}
+#ui-datepicker-div .ui-datepicker-current-day { background-color: #111 !important; border-color: #444; border-top-color: #111; border-left-color: #111;}
+#ui-datepicker-div .ui-datepicker-days-cell { background-color:#444; border:1px solid #222; border-top-color: #444; border-left-color: #444;}
Index: /extensions/Icy_Picture_Modify/trunk/template/datepicker.inc.tpl
===================================================================
--- /extensions/Icy_Picture_Modify/trunk/template/datepicker.inc.tpl	(revision 11608)
+++ /extensions/Icy_Picture_Modify/trunk/template/datepicker.inc.tpl	(revision 11608)
@@ -0,0 +1,18 @@
+{combine_script id='datepicker.js' load='footer' require='jquery.ui.datepicker' path='themes/default/js/datepicker.js'}
+
+{assign var="datepicker_language" value="themes/default/js/ui/i18n/jquery.ui.datepicker-`$lang_info.code`.js"}
+
+{if "PHPWG_ROOT_PATH"|@constant|@cat:$datepicker_language|@file_exists}
+{combine_script id="jquery.ui.datepicker-$lang_info.code" load='footer' path=$datepicker_language}
+{/if}
+
+{combine_css path="themes/default/js/ui/theme/jquery.ui.datepicker.css"}
+
+{footer_script require='jquery.ui.datepicker,datepicker.js'}
+function pwg_initialization_datepicker(day, month, year, linked_date, checked_on_change, min_linked_date, max_linked_date)
+{ldelim}
+  return pwg_common_initialization_datepicker(
+    "{$ICY_PICTURE_MODIFY_PATH}/template/icon/datepicker.png",
+    day, month, year, linked_date, checked_on_change, min_linked_date, max_linked_date);
+};
+{/footer_script}
Index: /extensions/Icy_Picture_Modify/trunk/template/dbselect.inc.tpl
===================================================================
--- /extensions/Icy_Picture_Modify/trunk/template/dbselect.inc.tpl	(revision 11608)
+++ /extensions/Icy_Picture_Modify/trunk/template/dbselect.inc.tpl	(revision 11608)
@@ -0,0 +1,15 @@
+{footer_script require='jquery.ui.resizable'}{literal}
+jQuery(document).ready(function(){
+	// Resize possible for double select list
+	jQuery(".doubleSelect select.categoryList").resizable({
+		handles: "w,e",
+		animate: true,
+		animateDuration: "slow",
+		animateEasing: "swing",
+		preventDefault: true,
+		preserveCursor: true,
+		autoHide: true,
+		ghost: true
+	});
+});
+{/literal}{/footer_script}
Index: /extensions/Icy_Picture_Modify/trunk/template/icy_picture_modify.tpl
===================================================================
--- /extensions/Icy_Picture_Modify/trunk/template/icy_picture_modify.tpl	(revision 11608)
+++ /extensions/Icy_Picture_Modify/trunk/template/icy_picture_modify.tpl	(revision 11608)
@@ -0,0 +1,184 @@
+{* Use the files copied from admin/themes/default/template/include *}
+{* Need: $template->set_template_dir(ICY_PICTURE_MODIFY_PATH.'template/'); *}
+
+{include file="autosize.inc.tpl"}
+{include file="datepicker.inc.tpl"}
+{include file="dbselect.inc.tpl"}
+
+{* Use some default stylesheets *}
+{* The 'datepicker.css' is copied from ./admin/themes/roma/theme.css *}
+
+{combine_css path= 'admin/themes/default/'|@cat:'theme.css'}
+{combine_css path= 'themes/default/js/ui/theme/'|@cat:'jquery.ui.datepicker.css'}
+{combine_css path= "$ICY_PICTURE_MODIFY_PATH/template/"|@cat:'datepicker.css'}
+
+{* Heavily copied from Piwigo distribution: picture_modify.tpl *}
+
+{combine_script id='jquery.tokeninput' load='async' require='jquery' path='themes/default/js/plugins/jquery.tokeninput.js'}
+{footer_script require='jquery.tokeninput'}
+jQuery(document).ready(function() {ldelim}
+  jQuery("#tags").tokenInput(
+    [{foreach from=$tags item=tag name=tags}{ldelim}"name":"{$tag.name|@escape:'javascript'}","id":"{$tag.id}"{rdelim}{if !$smarty.foreach.tags.last},{/if}{/foreach}],
+    {ldelim}
+      hintText: '{'Type in a search term'|@translate}',
+      noResultsText: '{'No results'|@translate}',
+      searchingText: '{'Searching...'|@translate}',
+      newText: ' ({'new'|@translate})',
+      animateDropdown: false,
+      preventDuplicates: true,
+      allowCreation: true
+    }
+  );
+});
+{/footer_script}
+
+{footer_script}
+pwg_initialization_datepicker("#date_creation_day", "#date_creation_month", "#date_creation_year", "#date_creation_linked_date", "#date_creation_action_set");
+{/footer_script}
+
+<h2>{'Edit photo information'|@translate}</h2>
+
+<img src="{$TN_SRC}" alt="{'Thumbnail'|@translate}" class="Thumbnail">
+
+<ul class="categoryActions">
+  {if isset($U_JUMPTO) }
+  <li><a href="{$U_JUMPTO}" title="{'jump to photo'|@translate}"><img src="{$ICY_PICTURE_MODIFY_PATH}/template/icon/category_jump-to.png" class="button" alt="{'jump to photo'|@translate}"></a></li>
+  {/if}
+  {if !url_is_remote($PATH)}
+  <li><a href="{$U_SYNC}" title="{'synchronize'|@translate}"><img src="{$ICY_PICTURE_MODIFY_PATH}/template/icon/sync_metadata.png" class="button" alt="{'synchronize'|@translate}"></a></li>
+
+  <li><a href="{$U_DELETE}" title="{'delete photo'|@translate}"><img src="{$ICY_PICTURE_MODIFY_PATH}/template/icon/category_delete.png" class="button" alt="{'delete photo'|@translate}" onclick="return confirm('{'Are you sure?'|@translate|@escape:javascript}');"></a></li>
+  {/if}
+</ul>
+
+<form action="{$F_ACTION}" method="post" id="properties">
+
+  <fieldset>
+    <legend>{'Informations'|@translate}</legend>
+
+    <table>
+
+      <tr>
+        <td><strong>{'Path'|@translate}</strong></td>
+        <td>{$PATH}</td>
+      </tr>
+
+      <tr>
+        <td><strong>{'Post date'|@translate}</strong></td>
+        <td>{$REGISTRATION_DATE}</td>
+      </tr>
+
+      <tr>
+        <td><strong>{'Dimensions'|@translate}</strong></td>
+        <td>{$DIMENSIONS}</td>
+      </tr>
+
+      <tr>
+        <td><strong>{'Filesize'|@translate}</strong></td>
+        <td>{$FILESIZE}</td>
+      </tr>
+
+{if isset($HIGH_FILESIZE) }
+      <tr>
+        <td><strong>{'High filesize'|@translate}</strong></td>
+        <td>{$HIGH_FILESIZE}</td>
+      </tr>
+{/if}
+
+      <tr>
+        <td><strong>{'Storage album'|@translate}</strong></td>
+        <td>{$STORAGE_CATEGORY}</td>
+      </tr>
+
+      {if isset($related_categories) }
+      <tr>
+        <td><strong>{'Linked albums'|@translate}</strong></td>
+        <td>
+          <ul>
+            {foreach from=$related_categories item=name}
+            <li>{$name}</li>
+            {/foreach}
+          </ul>
+        </td>
+      </tr>
+      {/if}
+
+    </table>
+
+  </fieldset>
+
+  <fieldset>
+    <legend>{'Properties'|@translate}</legend>
+
+    <table>
+
+      <tr>
+        <td><strong>{'Name'|@translate}</strong></td>
+        <td><input type="text" class="large" name="name" value="{$NAME}"></td>
+      </tr>
+
+      <tr>
+        <td><strong>{'Author'|@translate}</strong></td>
+        <td><input type="text" class="large" name="author" value="{$AUTHOR}"></td>
+      </tr>
+
+      <tr>
+        <td><strong>{'Creation date'|@translate}</strong></td>
+        <td>
+          <label><input type="radio" name="date_creation_action" value="unset"> {'unset'|@translate}</label>
+          <input type="radio" name="date_creation_action" value="set" id="date_creation_action_set"> {'set to'|@translate}
+          <select id="date_creation_day" name="date_creation_day">
+            <option value="0">--</option>
+            {section name=day start=1 loop=32}
+              <option value="{$smarty.section.day.index}" {if $smarty.section.day.index==$DATE_CREATION_DAY_VALUE}selected="selected"{/if}>{$smarty.section.day.index}</option>
+            {/section}
+          </select>
+          <select id="date_creation_month" name="date_creation_month">
+            {html_options options=$month_list selected=$DATE_CREATION_MONTH_VALUE}
+          </select>
+          <input id="date_creation_year"
+                 name="date_creation_year"
+                 type="text"
+                 size="4"
+                 maxlength="4"
+                 value="{$DATE_CREATION_YEAR_VALUE}">
+          <input id="date_creation_linked_date" name="date_creation_linked_date" type="hidden" size="10" disabled="disabled">
+        </td>
+      </tr>
+
+      <tr>
+        <td><strong>{'Tags'|@translate}</strong></td>
+        <td>
+<select id="tags" name="tags">
+{foreach from=$tag_selection item=tag}
+  <option value="{$tag.id}" class="selected">{$tag.name}</option>
+{/foreach}
+</select>
+        </td>
+      </tr>
+
+
+      <tr>
+        <td><strong>{'Description'|@translate}</strong></td>
+        <td><textarea name="description" id="description" class="description">{$DESCRIPTION}</textarea></td>
+      </tr>
+
+  <tr>
+    <td><strong>{'Who can see this photo?'|@translate}</strong></td>
+    <td>
+      <select name="level" size="1">
+        {html_options options=$level_options selected=$level_options_selected}
+      </select>
+    </td>
+  </tr>
+
+    </table>
+
+    <p style="text-align:center;">
+      <input class="submit" type="submit" value="{'Submit'|@translate}" name="submit">
+      <input class="submit" type="reset" value="{'Reset'|@translate}" name="reset">
+    </p>
+
+  </fieldset>
+
+</form>
