Changeset 801 for trunk/picture.php


Ignore:
Timestamp:
Jul 16, 2005, 4:29:35 PM (19 years ago)
Author:
plg
Message:
  • new feature : RSS notification feed. Feed generator is an external tool (FeedCreator class v1.7.2). New file feed.php
  • new database field : comments.validation_date (datetime). This field is required for notification feed.
  • new database field : users.feed_id (varchar(50)). users.feed_id is an alias of users.id but is much more complicated to find (50 characters, figures or letters, case sensitive) : the purpose is to keep it secret (as far as possible).
  • new database field : users.last_feed_check (datetime)
  • new database field : users.registration_date (datetime)
  • bug fixed : no need to add the (unavailable) session id to install.php in the installation form.
  • modified database field : images.date_available become more precise (date to datetime). This precision is needed for notification feed.
  • new index : comments_i1 (validation_date). Might be useful for feed queries.
  • new index : comments_i2 (image_id). Useful each time you want to have informations about an element and its associated comments.
  • version 9.11 of mysqldump outputs database field names and table names with backquote "`" (didn't find how to take them off)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/picture.php

    r774 r801  
    343343         or $conf['anti-flood_time'] == 0 )
    344344    {
    345       $query = 'INSERT INTO '.COMMENTS_TABLE;
    346       $query.= ' (author,date,image_id,content,validated) VALUES (';
    347       $query.= "'".$author."'";
    348       $query.= ',NOW(),'.$_GET['image_id'];
    349       $query.= ",'".htmlspecialchars( $_POST['content'], ENT_QUOTES)."'";
    350       if ( !$conf['comments_validation'] or $user['status'] == 'admin' )
    351       {       
    352         $query.= ",'true'";
     345      list($dbnow) = mysql_fetch_row(pwg_query('SELECT NOW();'));
     346
     347      $data = array();
     348      $data{'author'} = $author;
     349      $data{'date'} = $dbnow;
     350      $data{'image_id'} = $_GET['image_id'];
     351      $data{'content'} = htmlspecialchars( $_POST['content'], ENT_QUOTES);
     352     
     353      if (!$conf['comments_validation'] or $user['status'] == 'admin')
     354      {
     355        $data{'validated'} = 'true';
     356        $data{'validation_date'} = $dbnow;
    353357      }
    354358      else
    355359      {
    356         $query.= ",'false'";
     360        $data{'validated'} = 'false';
    357361      }
    358       $query.= ');';
    359       pwg_query( $query );
     362     
     363      include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
     364      $fields = array('author', 'date', 'image_id', 'content', 'validated',
     365                      'validation_date');
     366      mass_inserts(COMMENTS_TABLE, $fields, array($data));
     367     
    360368      // information message
    361369      $message = $lang['comment_added'];
     370
     371      if (!$conf['comments_validation'] or $user['status'] == 'admin')
     372     
    362373      if ( $conf['comments_validation'] and $user['status'] != 'admin' )
    363374      {
     
    480491
    481492// date of availability
    482 $availability_date = format_date($picture['current']['date_available']);
     493$availability_date = format_date($picture['current']['date_available'],
     494                                 'mysql_datetime');
    483495
    484496// size in pixels
Note: See TracChangeset for help on using the changeset viewer.