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/cat_modify.php

    r809 r825  
    4040
    4141//--------------------------------------------------------- form criteria check
    42 if ( isset( $_POST['submit'] ) )
    43 {
    44   $query = 'UPDATE '.CATEGORIES_TABLE;
    45   $query.= ' SET name = ';
    46   if ( empty($_POST['name']))
    47     $query.= 'NULL';
    48   else
    49     $query.= "'".htmlentities( $_POST['name'], ENT_QUOTES)."'";
    50 
    51   $query.= ', comment = ';
    52   if ( empty($_POST['comment']))
    53     $query.= 'NULL';
    54   else
    55     $query.= "'".htmlentities( $_POST['comment'], ENT_QUOTES )."'";
    56 
    57   if ( isset( $_POST['uploadable'] ) )
    58     $query.= ", uploadable = '".$_POST['uploadable']."'";
    59 
    60   if ( isset( $_POST['commentable'] ) )
    61     $query.= ", commentable = '".$_POST['commentable']."'";
    62 
    63   if ( isset( $_POST['associate'] ) )
    64   {
    65     $query.= ', id_uppercat = ';
    66     if ( $_POST['associate'] == -1 or $_POST['associate'] == '' )
    67       $query.= 'NULL';
    68     else
    69       $query.= $_POST['associate'];
    70   }
    71   $query.= ' WHERE id = '.$_GET['cat_id'];
    72   $query.= ';';
    73   pwg_query( $query );
    74 
     42if (isset($_POST['submit']))
     43{
     44  $data =
     45    array(
     46      'id' => $_GET['cat_id'],
     47      'name' => @$_POST['name'],
     48      'commentable' => $_POST['commentable'],
     49      'uploadable' =>
     50        isset($_POST['uploadable']) ? $_POST['uploadable'] : 'false',
     51      'comment' =>
     52        $conf['allow_html_descriptions'] ?
     53          @$_POST['comment'] : strip_tags(@$_POST['comment'])
     54      );
     55
     56  mass_updates(
     57    CATEGORIES_TABLE,
     58    array(
     59      'primary' => array('id'),
     60      'update' => array_diff(array_keys($data), array('id'))
     61      ),
     62    array($data)
     63    );
     64 
    7565  set_cat_visible(array($_GET['cat_id']), $_POST['visible']);
    7666  set_cat_status(array($_GET['cat_id']), $_POST['status']);
Note: See TracChangeset for help on using the changeset viewer.