- improvement : screen admin/picture_modify rewritten. Presentation copied

from admin/cat_modify : fieldsets regroup fields. Ability to synchronize
  metadata for the displayed item.

- bug 110 fixed : "return to element view from element edition fails
  depending on permissions". If a reachable (for the connected admin)
  category is available, a "jump to" link is displayed, by default, using
  the category given in URL.

- bug fixed : in mass_updates function, the first item of $fields['update']
  has not always 0 for id (as in any array).

- modification : get_keywords function understands spaces as separator,
  allow less than 3 chars keywords, allow quotes.

- new : ability to allow HTML in picture or category description (false by
  default)


git-svn-id: http://piwigo.org/svn/trunk@825 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
plegall
2005-08-18 17:59:00 +00:00
parent a7e5dbf37c
commit 7a8b502e11
12 changed files with 460 additions and 228 deletions
+20 -18
View File
@@ -582,23 +582,23 @@ function date_convert_back( $date )
}
}
// get_keywords returns an array with relevant keywords found in the string
// given in argument. Keywords must be separated by comma in this string.
// keywords must :
// - be longer or equal to 3 characters
// - not contain ', " or blank characters
// - unique in the string ("test,test" -> "test")
function get_keywords( $keywords_string )
/**
* returns an array with relevant keywords found in the given string.
*
* Keywords must be separated by comma or space characters.
*
* @param string keywords_string
* @return array
*/
function get_keywords($keywords_string)
{
$keywords = array();
$candidates = explode( ',', $keywords_string );
foreach ( $candidates as $candidate ) {
if ( strlen($candidate) >= 3 and !preg_match( '/(\'|"|\s)/', $candidate ) )
array_push( $keywords, $candidate );
}
return array_unique( $keywords );
return
array_unique(
preg_split(
'/[\s,]+/',
$keywords_string
)
);
}
/**
@@ -742,14 +742,15 @@ function mass_updates($tablename, $dbfields, $datas)
$query = '
UPDATE '.$tablename.'
SET ';
$is_first = true;
foreach ($dbfields['update'] as $num => $key)
{
if ($num >= 1)
if (!$is_first)
{
$query.= ",\n ";
}
$query.= $key.' = ';
if (isset($data[$key]))
if (isset($data[$key]) and $data[$key] != '')
{
$query.= '\''.$data[$key].'\'';
}
@@ -757,6 +758,7 @@ UPDATE '.$tablename.'
{
$query.= 'NULL';
}
$is_first = false;
}
$query.= '
WHERE ';
+24
View File
@@ -204,4 +204,28 @@ SELECT id, path
return $files;
}
// used_metadata string is displayed to inform admin which metadata will be
// used from files for synchronization
function get_used_metadata_list()
{
global $conf;
$used_metadata = array('filesize', 'width', 'height');
if ($conf['use_exif'])
{
array_push($used_metadata, 'date_creation');
}
if ($conf['use_iptc'])
{
foreach (array_keys($conf['use_iptc_mapping']) as $key)
{
array_push($used_metadata, $key);
}
}
return array_unique($used_metadata);
}
?>