aboutsummaryrefslogtreecommitdiffstats
path: root/admin/element_set_unit.php
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2005-08-19 19:07:13 +0000
committerplegall <plg@piwigo.org>2005-08-19 19:07:13 +0000
commitdded962ded654bbb73eb144d77bea681aad95868 (patch)
treeb1796635bae1b6c8f39bd29f929bd27d9c928f2a /admin/element_set_unit.php
parentabed8b4a18988f4a3fc2ca788fd835195b7d81b8 (diff)
- improvement : less compact presentation of screen admin/element_set_unit.
git-svn-id: http://piwigo.org/svn/trunk@836 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'admin/element_set_unit.php')
-rw-r--r--admin/element_set_unit.php88
1 files changed, 61 insertions, 27 deletions
diff --git a/admin/element_set_unit.php b/admin/element_set_unit.php
index 15dcd62a3..9ccbf9346 100644
--- a/admin/element_set_unit.php
+++ b/admin/element_set_unit.php
@@ -45,17 +45,7 @@ if (isset($_POST['submit']))
{
$collection = explode(',', $_POST['list']);
-// echo '<pre>';
-// print_r($_POST);
-// echo '</pre>';
-// exit();
-
$datas = array();
- $dbfields =
- array(
- 'primary' => array('id'),
- 'update' => array('name','author','comment','date_creation','keywords')
- );
$query = '
SELECT id, date_creation
@@ -67,34 +57,70 @@ SELECT id, date_creation
while ($row = mysql_fetch_array($result))
{
$data = array();
- $data['id'] = $row['id'];
-
- foreach (array_diff($dbfields['update'], array('date_creation')) as $field)
+
+ $data{'id'} = $row['id'];
+ $data{'name'} = $_POST['name-'.$row['id']];
+ $data{'author'} = $_POST['author-'.$row['id']];
+
+ foreach (array('name', 'author') as $field)
{
if (!empty($_POST[$field.'-'.$row['id']]))
{
- $data[$field] = $_POST[$field.'-'.$row['id']];
+ $data{$field} = strip_tags($_POST[$field.'-'.$row['id']]);
+ }
+ }
+
+ if ($conf['allow_html_descriptions'])
+ {
+ $data{'comment'} = @$_POST['description-'.$row['id']];
+ }
+ else
+ {
+ $data{'comment'} = strip_tags(@$_POST['description-'.$row['id']]);
+ }
+
+ if (isset($_POST['date_creation_action-'.$row['id']]))
+ {
+ if ('set' == $_POST['date_creation_action-'.$row['id']])
+ {
+ $data{'date_creation'} =
+ $_POST['date_creation_year-'.$row['id']]
+ .'-'.$_POST['date_creation_month-'.$row['id']]
+ .'-'.$_POST['date_creation_day-'.$row['id']];
+ }
+ else if ('unset' == $_POST['date_creation_action-'.$row['id']])
+ {
+ $data{'date_creation'} = '';
}
}
+ else
+ {
+ $data{'date_creation'} = $row['date_creation'];
+ }
- if ('set' == $_POST['date_creation_action-'.$row['id']])
+ $keywords = get_keywords($_POST['keywords-'.$row['id']]);
+ if (count($keywords) > 0)
{
- $data['date_creation'] =
- $_POST['date_creation_year-'.$row['id']]
- .'-'.$_POST['date_creation_month-'.$row['id']]
- .'-'.$_POST['date_creation_day-'.$row['id']]
- ;
+ $data{'keywords'} = implode(',', $keywords);
}
- else if ('leave' == $_POST['date_creation_action-'.$row['id']]
- and !empty($row['date_creation']))
+ else
{
- $data['date_creation'] = $row['date_creation'];
+ $data{'keywords'} = '';
}
array_push($datas, $data);
}
- // echo '<pre>'; print_r($datas); echo '</pre>';
- mass_updates(IMAGES_TABLE, $dbfields, $datas);
+
+ mass_updates(
+ IMAGES_TABLE,
+ array(
+ 'primary' => array('id'),
+ 'update' => array('name','author','comment','date_creation','keywords')
+ ),
+ $datas
+ );
+
+ array_push($page['infos'], l10n('Picture informations updated'));
}
// +-----------------------------------------------------------------------+
@@ -148,7 +174,7 @@ if (count($page['cat_elements_id']) > 0)
$element_ids = array();
$query = '
-SELECT id,path,tn_ext,name,date_creation,comment,keywords,author
+SELECT id,path,tn_ext,name,date_creation,comment,keywords,author,file
FROM '.IMAGES_TABLE.'
WHERE id IN ('.implode(',', $page['cat_elements_id']).')
'.$conf['order_by'].'
@@ -176,12 +202,20 @@ SELECT id,path,tn_ext,name,date_creation,comment,keywords,author
$template->assign_block_vars(
'element',
array(
+ 'LEGEND' =>
+ !empty($row['name']) ?
+ $row['name'] : get_name_from_file($row['file']),
+ 'U_EDIT' =>
+ add_session_id(
+ PHPWG_ROOT_PATH.'admin.php?page=picture_modify'.
+ '&amp;image_id='.$row['id']
+ ),
'ID' => $row['id'],
'FILENAME' => $row['path'],
'TN_SRC' => $src,
'NAME' => @$row['name'],
'AUTHOR' => @$row['author'],
- 'COMMENT' => @$row['comment'],
+ 'DESCRIPTION' => @$row['comment'],
'DATE_CREATION_YEAR' => $year,
'KEYWORDS' => @$row['keywords']
)