Ignore:
Timestamp:
Aug 18, 2005, 7:59:00 PM (19 years ago)
Author:
plg
Message:
  • 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 $fieldsupdate 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)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/include/functions.php

    r809 r825  
    583583}
    584584
    585 // get_keywords returns an array with relevant keywords found in the string
    586 // given in argument. Keywords must be separated by comma in this string.
    587 // keywords must :
    588 //   - be longer or equal to 3 characters
    589 //   - not contain ', " or blank characters
    590 //   - unique in the string ("test,test" -> "test")
    591 function get_keywords( $keywords_string )
    592 {
    593   $keywords = array();
    594 
    595   $candidates = explode( ',', $keywords_string );
    596   foreach ( $candidates as $candidate ) {
    597     if ( strlen($candidate) >= 3 and !preg_match( '/(\'|"|\s)/', $candidate ) )
    598       array_push( $keywords, $candidate );
    599   }
    600 
    601   return array_unique( $keywords );
     585/**
     586 * returns an array with relevant keywords found in the given string.
     587 *
     588 * Keywords must be separated by comma or space characters.
     589 *
     590 * @param string keywords_string
     591 * @return array
     592 */
     593function get_keywords($keywords_string)
     594{
     595  return
     596    array_unique(
     597      preg_split(
     598        '/[\s,]+/',
     599        $keywords_string
     600        )
     601      );
    602602}
    603603
     
    743743UPDATE '.$tablename.'
    744744  SET ';
     745      $is_first = true;
    745746      foreach ($dbfields['update'] as $num => $key)
    746747      {
    747         if ($num >= 1)
     748        if (!$is_first)
    748749        {
    749750          $query.= ",\n      ";
    750751        }
    751752        $query.= $key.' = ';
    752         if (isset($data[$key]))
     753        if (isset($data[$key]) and $data[$key] != '')
    753754        {
    754755          $query.= '\''.$data[$key].'\'';
     
    758759          $query.= 'NULL';
    759760        }
     761        $is_first = false;
    760762      }
    761763      $query.= '
Note: See TracChangeset for help on using the changeset viewer.