Ignore:
Timestamp:
May 4, 2011, 4:06:56 PM (13 years ago)
Author:
plg
Message:

feature 2294 added: ability to define photo properties before upload (name/author/description).

Because this is more a workaround than a clean way to implement it, webmaster
has to set $confcommunity_ask_for_properties = true in is local configuration file.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/community/add_photos.php

    r9583 r10756  
    8787  // reinitialize the informations to display on the result page
    8888  $page['infos'] = array();
     89
     90  if (isset($conf['community_ask_for_properties']) and $conf['community_ask_for_properties'])
     91  {
     92    $data = array();
     93   
     94    $data['name'] = $_POST['name'];
     95    $data['author'] = $_POST['author'];
     96   
     97    if ($conf['allow_html_descriptions'])
     98    {
     99      $data['comment'] = @$_POST['description'];
     100    }
     101    else
     102    {
     103      $data['comment'] = strip_tags(@$_POST['description']);
     104    }
     105
     106    $updates = array();
     107    foreach ($image_ids as $image_id)
     108    {
     109      $update = $data;
     110      $update['id'] = $image_id;
     111
     112      array_push($updates, $update);
     113    }
     114
     115    mass_updates(
     116      IMAGES_TABLE,
     117      array(
     118        'primary' => array('id'),
     119        'update' => array_keys($updates[0])
     120        ),
     121      $updates
     122      );
     123  }
    89124 
    90125  // $category_id is set in the photos_add_direct_process.inc.php included script
     
    300335  );
    301336
     337if (isset($conf['community_ask_for_properties']) and $conf['community_ask_for_properties'])
     338{
     339  $template->assign(
     340    array(
     341      'community_ask_for_properties' => true,
     342      )
     343    );
     344}
    302345
    303346// +-----------------------------------------------------------------------+
Note: See TracChangeset for help on using the changeset viewer.