Changeset 801


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)
Location:
trunk
Files:
2 added
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/picture_modify.php

    r792 r801  
    181181  'SIZE_IMG'=>@$row['width'].' * '.@$row['height'],
    182182  'FILESIZE_IMG'=>@$row['filesize'].' KB',
    183   'REGISTRATION_DATE_IMG'=> format_date($row['date_available']),
     183  'REGISTRATION_DATE_IMG'
     184  => format_date($row['date_available'], 'mysql_datetime', true),
    184185  'AUTHOR_IMG'=>isset($_POST['author'])?$_POST['author']:@$row['author'],
    185186  'CREATION_DATE_IMG'=>$date,
  • trunk/admin/remote_site.php

    r792 r801  
    3232include_once(PHPWG_ROOT_PATH.'admin/include/isadmin.inc.php');
    3333
    34 define('CURRENT_DATE', date('Y-m-d'));
     34list($dbnow) = mysql_fetch_row(pwg_query('SELECT NOW();'));
     35define('CURRENT_DATE', $dbnow);
    3536// +-----------------------------------------------------------------------+
    3637// |                               functions                               |
  • trunk/admin/update.php

    r792 r801  
    3232include_once( PHPWG_ROOT_PATH.'admin/include/isadmin.inc.php');
    3333
    34 define('CURRENT_DATE', date('Y-m-d'));
     34list($dbnow) = mysql_fetch_row(pwg_query('SELECT NOW();'));
     35define('CURRENT_DATE', $dbnow);
     36
    3537$error_labels = array('PWG-UPDATE-1' => $lang['update_wrong_dirname_short'],
    3638                      'PWG-UPDATE-2' => $lang['update_missing_tn_short']);
  • trunk/category.php

    r797 r801  
    294294));
    295295
     296// notification feed
     297$template->assign_block_vars(
     298  'summary',
     299  array(
     300    'TITLE'=>l10n('RSS notification feed'),
     301    'NAME'=>l10n('Notification feed'),
     302    'U_SUMMARY'=>
     303    'feed.php'.(ANONYMOUS != $user['id'] ? '?feed='.$user['feed_id'] : '')
     304));
     305
    296306//------------------------------------------------------ main part : thumbnails
    297307if (isset($page['cat'])
  • trunk/comments.php

    r796 r801  
    158158UPDATE '.COMMENTS_TABLE.'
    159159  SET validated = \'true\'
     160    , validation_date = NOW()
    160161  WHERE id IN ('.implode(',', $_POST['comment_id']).')
    161162;';
  • trunk/doc/ChangeLog

    r800 r801  
     12005-06-16 Pierrick LE GALL
     2
     3        * new feature : RSS notification feed. Feed generator is an
     4        external tool (FeedCreator class v1.7.2). New file feed.php
     5
     6        * new database field : comments.validation_date (datetime). This
     7        field is required for notification feed.
     8
     9        * new database field : users.feed_id (varchar(50)). users.feed_id
     10        is an alias of users.id but is much more complicated to find (50
     11        characters, figures or letters, case sensitive) : the purpose is
     12        to keep it secret (as far as possible).
     13
     14        * new database field : users.last_feed_check (datetime)
     15
     16        * new database field : users.registration_date (datetime)
     17
     18        * bug fixed : no need to add the (unavailable) session id to
     19        install.php in the installation form.
     20
     21        * modified database field : images.date_available become more
     22        precise (date to datetime). This precision is needed for
     23        notification feed.
     24
     25        * new index : comments_i1 (validation_date). Might be useful for
     26        feed queries.
     27
     28        * new index : comments_i2 (image_id). Useful each time you want to
     29        have informations about an element and its associated comments.
     30
     31        * version 9.11 of mysqldump outputs database field names and table
     32        names with backquote "`" (didn't find how to take them off)
     33       
    1342005-06-30 Pierrick LE GALL
    235       
  • trunk/include/config_default.inc.php

    r797 r801  
    213213// page.
    214214$conf['links'] = array();
     215
     216// feed_period : how long between two feed refresh ? Possible values are
     217// "hour", "half day", "day", "week", "month".
     218$conf['feed_period'] = 'week';
    215219?>
  • trunk/include/functions_user.inc.php

    r708 r801  
    111111    $insert['language'] = $conf['default_language'];
    112112    $insert['recent_period'] = $conf['recent_period'];
     113    $insert['feed_id'] = find_available_feed_id();
    113114    $insert['expand'] = boolean_to_string($conf['auto_expand']);
    114115    $insert['show_nb_comments'] = boolean_to_string($conf['show_nb_comments']);
     
    142143    }
    143144    $query.= ')
     145;';
     146    pwg_query($query);
     147
     148    $query = '
     149UPDATE '.USERS_TABLE.'
     150  SET registration_date = NOW()
     151  WHERE id = '.mysql_insert_id().'
    144152;';
    145153    pwg_query($query);
     
    380388  return $username;
    381389}
     390
     391/**
     392 * search an available feed_id
     393 *
     394 * @return string feed identifier
     395 */
     396function find_available_feed_id()
     397{
     398  while (true)
     399  {
     400    $key = generate_key(50);
     401    $query = '
     402SELECT COUNT(*)
     403  FROM '.USERS_TABLE.'
     404  WHERE feed_id = \''.$key.'\'
     405;';
     406    list($count) = mysql_fetch_row(pwg_query($query));
     407    if (0 == $count)
     408    {
     409      return $key;
     410    }
     411  }
     412}
    382413?>
  • trunk/include/template.php

    r795 r801  
    157157      // Run the compiled code.
    158158      $_str = '';
    159 //      echo '<pre>'.($this->compiled_code[$handle]).'</pre>';
    160       $fp = @fopen( './log/debug.log', 'a+' );
    161       fwrite( $fp, "\n\n" );
    162       fwrite( $fp, $this->compiled_code[$handle] );
    163       fclose( $fp );
    164159      eval($this->compiled_code[$handle]);
    165160      $this->output.= $_str;
  • trunk/install.php

    r749 r801  
    306306    $query.= ",'admin','".$language."'";
    307307    $query.= ",'".$admin_mail."');";
     308    mysql_query($query);
     309
     310    $query = '
     311UPDATE '.USERS_TABLE.'
     312  SET feed_id = \''.find_available_feed_id().'\'
     313  WHERE id = 1
     314;';
    308315    mysql_query($query);
    309316   
     
    349356    'L_END_MESSAGE'=>$lang['install_end_message'],
    350357   
    351     'F_ACTION'=>add_session_id( 'install.php' ),
     358    'F_ACTION'=>'install.php',
    352359    'F_DB_HOST'=>$dbhost,
    353360    'F_DB_USER'=>$dbuser,
  • trunk/install/dbscheme.txt

    r648 r801  
    11
     2table:caddie
    23table:categories
    34table:comments
     
    1819table:waiting
    1920
     21column:user_id                   table:caddie         type:smallint                 nullable:N length:5   signed:Y
     22column:element_id                table:caddie         type:mediumint                nullable:N length:8   signed:Y
    2023column:id                        table:categories     type:smallint                 nullable:N length:5   signed:N
    21 column:date_last                 table:categories     type:date                     nullable:Y
     24column:date_last                 table:categories     type:datetime                 nullable:Y
    2225column:nb_images                 table:categories     type:mediumint                nullable:N length:8   signed:N
    2326column:name                      table:categories     type:varchar                  nullable:N length:255 binary:N
     
    4043column:content                   table:comments       type:longtext                 nullable:Y
    4144column:validated                 table:comments       type:enum('true','false')     nullable:N
     45column:validation_date           table:comments       type:datetime                 nullable:Y
    4246column:param                     table:config         type:varchar                  nullable:N length:40  binary:N
    4347column:value                     table:config         type:varchar                  nullable:Y length:255 binary:N
     
    5963column:id                        table:images         type:mediumint                nullable:N length:8   signed:N
    6064column:file                      table:images         type:varchar                  nullable:N length:255 binary:N
    61 column:date_available            table:images         type:date                     nullable:N
     65column:date_available            table:images         type:datetime                 nullable:N
    6266column:date_creation             table:images         type:date                     nullable:Y
    6367column:tn_ext                    table:images         type:varchar                  nullable:Y length:4   binary:N
     
    9296column:id                        table:users          type:smallint                 nullable:N length:5   signed:N
    9397column:username                  table:users          type:varchar                  nullable:N length:20  binary:Y
    94 column:password                  table:users          type:varchar                  nullable:N length:255 binary:N
     98column:password                  table:users          type:varchar                  nullable:Y length:32 binary:N
    9599column:mail_address              table:users          type:varchar                  nullable:Y length:255 binary:N
    96100column:nb_image_line             table:users          type:tinyint                  nullable:N length:1   signed:N
     
    104108column:recent_period             table:users          type:tinyint                  nullable:N length:3   signed:N
    105109column:template                  table:users          type:varchar                  nullable:N length:255 binary:N
     110column:last_feed_check           table:users          type:datetime                 nullable:Y
     111column:feed_id                   table:users          type:varchar                  nullable:Y length:50  binary:Y
     112column:registration_date         table:users          type:datetime                 nullable:N
    106113column:id                        table:waiting        type:int                      nullable:N length:10  signed:N
    107114column:storage_category_id       table:waiting        type:smallint                 nullable:N length:5   signed:N
     
    114121column:infos                     table:waiting        type:text                     nullable:Y
    115122
     123PK:caddie_pk         table:caddie         column:user_id
     124PK:caddie_pk         table:caddie         column:element_id
    116125PK:categories_pk     table:categories     column:id
    117126PK:comments_pk       table:comments       column:id
     
    138147
    139148index:categories_i2     table:categories     column:id_uppercat
     149index:comments_i2       table:comments       column:validation_date
     150index:comments_i1       table:comments       column:image_id
    140151index:history_i1        table:history        column:date
    141152index:image_category_i1 table:image_category column:image_id
  • trunk/install/phpwebgallery_structure.sql

    r757 r801  
    1 -- MySQL dump 8.21
     1-- MySQL dump 9.11
    22--
    33-- Host: localhost    Database: pwg-bsf
    4 ---------------------------------------------------------
    5 -- Server version       3.23.49-log
    6 
    7 --
    8 -- Table structure for table 'phpwebgallery_caddie'
    9 --
    10 
    11 DROP TABLE IF EXISTS phpwebgallery_caddie;
    12 CREATE TABLE phpwebgallery_caddie (
    13   user_id smallint(5) NOT NULL default '0',
    14   element_id mediumint(8) NOT NULL default '0',
    15   PRIMARY KEY  (user_id,element_id)
    16 ) TYPE=MyISAM;
    17 
    18 --
    19 -- Table structure for table 'phpwebgallery_categories'
    20 --
    21 
    22 DROP TABLE IF EXISTS phpwebgallery_categories;
    23 CREATE TABLE phpwebgallery_categories (
    24   id smallint(5) unsigned NOT NULL auto_increment,
    25   date_last date default NULL,
    26   nb_images mediumint(8) unsigned NOT NULL default '0',
    27   name varchar(255) NOT NULL default '',
    28   id_uppercat smallint(5) unsigned default NULL,
    29   comment text,
    30   dir varchar(255) default NULL,
    31   rank tinyint(3) unsigned default NULL,
    32   status enum('public','private') NOT NULL default 'public',
    33   site_id tinyint(4) unsigned default '1',
    34   visible enum('true','false') NOT NULL default 'true',
    35   uploadable enum('true','false') NOT NULL default 'false',
    36   representative_picture_id mediumint(8) unsigned default NULL,
    37   uppercats varchar(255) NOT NULL default '',
    38   commentable enum('true','false') NOT NULL default 'true',
    39   global_rank varchar(255) default NULL,
    40   PRIMARY KEY  (id),
    41   KEY categories_i2 (id_uppercat)
    42 ) TYPE=MyISAM;
    43 
    44 --
    45 -- Table structure for table 'phpwebgallery_comments'
    46 --
    47 
    48 DROP TABLE IF EXISTS phpwebgallery_comments;
    49 CREATE TABLE phpwebgallery_comments (
    50   id int(11) unsigned NOT NULL auto_increment,
    51   image_id mediumint(8) unsigned NOT NULL default '0',
    52   date datetime NOT NULL default '0000-00-00 00:00:00',
    53   author varchar(255) default NULL,
    54   content longtext,
    55   validated enum('true','false') NOT NULL default 'false',
    56   PRIMARY KEY  (id)
    57 ) TYPE=MyISAM;
    58 
    59 --
    60 -- Table structure for table 'phpwebgallery_config'
    61 --
    62 
    63 DROP TABLE IF EXISTS phpwebgallery_config;
    64 CREATE TABLE phpwebgallery_config (
    65   param varchar(40) NOT NULL default '',
    66   value varchar(255) default NULL,
    67   comment varchar(255) default NULL,
    68   PRIMARY KEY  (param)
     4-- ------------------------------------------------------
     5-- Server version       4.0.24_Debian-10-log
     6
     7--
     8-- Table structure for table `phpwebgallery_caddie`
     9--
     10
     11DROP TABLE IF EXISTS `phpwebgallery_caddie`;
     12CREATE TABLE `phpwebgallery_caddie` (
     13  `user_id` smallint(5) NOT NULL default '0',
     14  `element_id` mediumint(8) NOT NULL default '0',
     15  PRIMARY KEY  (`user_id`,`element_id`)
     16) TYPE=MyISAM;
     17
     18--
     19-- Table structure for table `phpwebgallery_categories`
     20--
     21
     22DROP TABLE IF EXISTS `phpwebgallery_categories`;
     23CREATE TABLE `phpwebgallery_categories` (
     24  `id` smallint(5) unsigned NOT NULL auto_increment,
     25  `date_last` datetime default NULL,
     26  `nb_images` mediumint(8) unsigned NOT NULL default '0',
     27  `name` varchar(255) NOT NULL default '',
     28  `id_uppercat` smallint(5) unsigned default NULL,
     29  `comment` text,
     30  `dir` varchar(255) default NULL,
     31  `rank` tinyint(3) unsigned default NULL,
     32  `status` enum('public','private') NOT NULL default 'public',
     33  `site_id` tinyint(4) unsigned default '1',
     34  `visible` enum('true','false') NOT NULL default 'true',
     35  `uploadable` enum('true','false') NOT NULL default 'false',
     36  `representative_picture_id` mediumint(8) unsigned default NULL,
     37  `uppercats` varchar(255) NOT NULL default '',
     38  `commentable` enum('true','false') NOT NULL default 'true',
     39  `global_rank` varchar(255) default NULL,
     40  PRIMARY KEY  (`id`),
     41  KEY `categories_i2` (`id_uppercat`)
     42) TYPE=MyISAM;
     43
     44--
     45-- Table structure for table `phpwebgallery_comments`
     46--
     47
     48DROP TABLE IF EXISTS `phpwebgallery_comments`;
     49CREATE TABLE `phpwebgallery_comments` (
     50  `id` int(11) unsigned NOT NULL auto_increment,
     51  `image_id` mediumint(8) unsigned NOT NULL default '0',
     52  `date` datetime NOT NULL default '0000-00-00 00:00:00',
     53  `author` varchar(255) default NULL,
     54  `content` longtext,
     55  `validated` enum('true','false') NOT NULL default 'false',
     56  `validation_date` datetime default NULL,
     57  PRIMARY KEY  (`id`),
     58  KEY `comments_i2` (`validation_date`),
     59  KEY `comments_i1` (`image_id`)
     60) TYPE=MyISAM;
     61
     62--
     63-- Table structure for table `phpwebgallery_config`
     64--
     65
     66DROP TABLE IF EXISTS `phpwebgallery_config`;
     67CREATE TABLE `phpwebgallery_config` (
     68  `param` varchar(40) NOT NULL default '',
     69  `value` varchar(255) default NULL,
     70  `comment` varchar(255) default NULL,
     71  PRIMARY KEY  (`param`)
    6972) TYPE=MyISAM COMMENT='configuration table';
    7073
    7174--
    72 -- Table structure for table 'phpwebgallery_favorites'
    73 --
    74 
    75 DROP TABLE IF EXISTS phpwebgallery_favorites;
    76 CREATE TABLE phpwebgallery_favorites (
    77   user_id smallint(5) unsigned NOT NULL default '0',
    78   image_id mediumint(8) unsigned NOT NULL default '0',
    79   PRIMARY KEY  (user_id,image_id)
    80 ) TYPE=MyISAM;
    81 
    82 --
    83 -- Table structure for table 'phpwebgallery_group_access'
    84 --
    85 
    86 DROP TABLE IF EXISTS phpwebgallery_group_access;
    87 CREATE TABLE phpwebgallery_group_access (
    88   group_id smallint(5) unsigned NOT NULL default '0',
    89   cat_id smallint(5) unsigned NOT NULL default '0',
    90   PRIMARY KEY  (group_id,cat_id)
    91 ) TYPE=MyISAM;
    92 
    93 --
    94 -- Table structure for table 'phpwebgallery_groups'
    95 --
    96 
    97 DROP TABLE IF EXISTS phpwebgallery_groups;
    98 CREATE TABLE phpwebgallery_groups (
    99   id smallint(5) unsigned NOT NULL auto_increment,
    100   name varchar(255) NOT NULL default '',
    101   PRIMARY KEY  (id)
    102 ) TYPE=MyISAM;
    103 
    104 --
    105 -- Table structure for table 'phpwebgallery_history'
    106 --
    107 
    108 DROP TABLE IF EXISTS phpwebgallery_history;
    109 CREATE TABLE phpwebgallery_history (
    110   date datetime NOT NULL default '0000-00-00 00:00:00',
    111   login varchar(15) default NULL,
    112   IP varchar(50) NOT NULL default '',
    113   category varchar(150) default NULL,
    114   file varchar(50) default NULL,
    115   picture varchar(150) default NULL,
    116   KEY history_i1 (date)
    117 ) TYPE=MyISAM;
    118 
    119 --
    120 -- Table structure for table 'phpwebgallery_image_category'
    121 --
    122 
    123 DROP TABLE IF EXISTS phpwebgallery_image_category;
    124 CREATE TABLE phpwebgallery_image_category (
    125   image_id mediumint(8) unsigned NOT NULL default '0',
    126   category_id smallint(5) unsigned NOT NULL default '0',
    127   PRIMARY KEY  (image_id,category_id),
    128   KEY image_category_i1 (image_id),
    129   KEY image_category_i2 (category_id)
    130 ) TYPE=MyISAM;
    131 
    132 --
    133 -- Table structure for table 'phpwebgallery_images'
    134 --
    135 
    136 DROP TABLE IF EXISTS phpwebgallery_images;
    137 CREATE TABLE phpwebgallery_images (
    138   id mediumint(8) unsigned NOT NULL auto_increment,
    139   file varchar(255) NOT NULL default '',
    140   date_available date NOT NULL default '0000-00-00',
    141   date_creation date default NULL,
    142   tn_ext varchar(4) default '',
    143   name varchar(255) default NULL,
    144   comment text,
    145   author varchar(255) default NULL,
    146   hit int(10) unsigned NOT NULL default '0',
    147   filesize mediumint(9) unsigned default NULL,
    148   width smallint(9) unsigned default NULL,
    149   height smallint(9) unsigned default NULL,
    150   keywords varchar(255) default NULL,
    151   storage_category_id smallint(5) unsigned default NULL,
    152   representative_ext varchar(4) default NULL,
    153   date_metadata_update date default NULL,
    154   average_rate float(5,2) unsigned default NULL,
    155   path varchar(255) NOT NULL default '',
    156   PRIMARY KEY  (id),
    157   KEY images_i2 (date_available),
    158   KEY images_i1 (storage_category_id),
    159   KEY images_i3 (average_rate),
    160   KEY images_i4 (hit),
    161   KEY images_i5 (date_creation)
    162 ) TYPE=MyISAM;
    163 
    164 --
    165 -- Table structure for table 'phpwebgallery_rate'
    166 --
    167 
    168 DROP TABLE IF EXISTS phpwebgallery_rate;
    169 CREATE TABLE phpwebgallery_rate (
    170   user_id smallint(5) unsigned NOT NULL default '0',
    171   element_id mediumint(8) unsigned NOT NULL default '0',
    172   rate tinyint(2) unsigned NOT NULL default '0',
    173   PRIMARY KEY  (user_id,element_id)
    174 ) TYPE=MyISAM;
    175 
    176 --
    177 -- Table structure for table 'phpwebgallery_sessions'
    178 --
    179 
    180 DROP TABLE IF EXISTS phpwebgallery_sessions;
    181 CREATE TABLE phpwebgallery_sessions (
    182   id varchar(255) binary NOT NULL default '',
    183   user_id smallint(5) unsigned NOT NULL default '0',
    184   expiration datetime NOT NULL default '0000-00-00 00:00:00',
    185   PRIMARY KEY  (id)
    186 ) TYPE=MyISAM;
    187 
    188 --
    189 -- Table structure for table 'phpwebgallery_sites'
    190 --
    191 
    192 DROP TABLE IF EXISTS phpwebgallery_sites;
    193 CREATE TABLE phpwebgallery_sites (
    194   id tinyint(4) NOT NULL auto_increment,
    195   galleries_url varchar(255) NOT NULL default '',
    196   PRIMARY KEY  (id),
    197   UNIQUE KEY sites_ui1 (galleries_url)
    198 ) TYPE=MyISAM;
    199 
    200 --
    201 -- Table structure for table 'phpwebgallery_user_access'
    202 --
    203 
    204 DROP TABLE IF EXISTS phpwebgallery_user_access;
    205 CREATE TABLE phpwebgallery_user_access (
    206   user_id smallint(5) unsigned NOT NULL default '0',
    207   cat_id smallint(5) unsigned NOT NULL default '0',
    208   PRIMARY KEY  (user_id,cat_id)
    209 ) TYPE=MyISAM;
    210 
    211 --
    212 -- Table structure for table 'phpwebgallery_user_forbidden'
    213 --
    214 
    215 DROP TABLE IF EXISTS phpwebgallery_user_forbidden;
    216 CREATE TABLE phpwebgallery_user_forbidden (
    217   user_id smallint(5) unsigned NOT NULL default '0',
    218   need_update enum('true','false') NOT NULL default 'true',
    219   forbidden_categories text,
    220   PRIMARY KEY  (user_id)
    221 ) TYPE=MyISAM;
    222 
    223 --
    224 -- Table structure for table 'phpwebgallery_user_group'
    225 --
    226 
    227 DROP TABLE IF EXISTS phpwebgallery_user_group;
    228 CREATE TABLE phpwebgallery_user_group (
    229   user_id smallint(5) unsigned NOT NULL default '0',
    230   group_id smallint(5) unsigned NOT NULL default '0',
    231   PRIMARY KEY  (group_id,user_id)
    232 ) TYPE=MyISAM;
    233 
    234 --
    235 -- Table structure for table 'phpwebgallery_users'
    236 --
    237 
    238 DROP TABLE IF EXISTS phpwebgallery_users;
    239 CREATE TABLE phpwebgallery_users (
    240   id smallint(5) unsigned NOT NULL auto_increment,
    241   username varchar(20) binary NOT NULL default '',
    242   password varchar(255) NOT NULL default '',
    243   mail_address varchar(255) default NULL,
    244   nb_image_line tinyint(1) unsigned NOT NULL default '5',
    245   nb_line_page tinyint(3) unsigned NOT NULL default '3',
    246   status enum('admin','guest') NOT NULL default 'guest',
    247   language varchar(50) NOT NULL default 'english',
    248   maxwidth smallint(6) default NULL,
    249   maxheight smallint(6) default NULL,
    250   expand enum('true','false') NOT NULL default 'false',
    251   show_nb_comments enum('true','false') NOT NULL default 'false',
    252   recent_period tinyint(3) unsigned NOT NULL default '7',
    253   template varchar(255) NOT NULL default 'default',
    254   PRIMARY KEY  (id),
    255   UNIQUE KEY users_ui1 (username)
    256 ) TYPE=MyISAM;
    257 
    258 --
    259 -- Table structure for table 'phpwebgallery_waiting'
    260 --
    261 
    262 DROP TABLE IF EXISTS phpwebgallery_waiting;
    263 CREATE TABLE phpwebgallery_waiting (
    264   id int(10) unsigned NOT NULL auto_increment,
    265   storage_category_id smallint(5) unsigned NOT NULL default '0',
    266   file varchar(255) NOT NULL default '',
    267   username varchar(255) NOT NULL default '',
    268   mail_address varchar(255) NOT NULL default '',
    269   date int(10) unsigned NOT NULL default '0',
    270   tn_ext char(3) default NULL,
    271   validated enum('true','false') NOT NULL default 'false',
    272   infos text,
    273   PRIMARY KEY  (id)
    274 ) TYPE=MyISAM;
    275 
     75-- Table structure for table `phpwebgallery_favorites`
     76--
     77
     78DROP TABLE IF EXISTS `phpwebgallery_favorites`;
     79CREATE TABLE `phpwebgallery_favorites` (
     80  `user_id` smallint(5) unsigned NOT NULL default '0',
     81  `image_id` mediumint(8) unsigned NOT NULL default '0',
     82  PRIMARY KEY  (`user_id`,`image_id`)
     83) TYPE=MyISAM;
     84
     85--
     86-- Table structure for table `phpwebgallery_group_access`
     87--
     88
     89DROP TABLE IF EXISTS `phpwebgallery_group_access`;
     90CREATE TABLE `phpwebgallery_group_access` (
     91  `group_id` smallint(5) unsigned NOT NULL default '0',
     92  `cat_id` smallint(5) unsigned NOT NULL default '0',
     93  PRIMARY KEY  (`group_id`,`cat_id`)
     94) TYPE=MyISAM;
     95
     96--
     97-- Table structure for table `phpwebgallery_groups`
     98--
     99
     100DROP TABLE IF EXISTS `phpwebgallery_groups`;
     101CREATE TABLE `phpwebgallery_groups` (
     102  `id` smallint(5) unsigned NOT NULL auto_increment,
     103  `name` varchar(255) NOT NULL default '',
     104  PRIMARY KEY  (`id`)
     105) TYPE=MyISAM;
     106
     107--
     108-- Table structure for table `phpwebgallery_history`
     109--
     110
     111DROP TABLE IF EXISTS `phpwebgallery_history`;
     112CREATE TABLE `phpwebgallery_history` (
     113  `date` datetime NOT NULL default '0000-00-00 00:00:00',
     114  `login` varchar(15) default NULL,
     115  `IP` varchar(50) NOT NULL default '',
     116  `category` varchar(150) default NULL,
     117  `file` varchar(50) default NULL,
     118  `picture` varchar(150) default NULL,
     119  KEY `history_i1` (`date`)
     120) TYPE=MyISAM;
     121
     122--
     123-- Table structure for table `phpwebgallery_image_category`
     124--
     125
     126DROP TABLE IF EXISTS `phpwebgallery_image_category`;
     127CREATE TABLE `phpwebgallery_image_category` (
     128  `image_id` mediumint(8) unsigned NOT NULL default '0',
     129  `category_id` smallint(5) unsigned NOT NULL default '0',
     130  PRIMARY KEY  (`image_id`,`category_id`),
     131  KEY `image_category_i1` (`image_id`),
     132  KEY `image_category_i2` (`category_id`)
     133) TYPE=MyISAM;
     134
     135--
     136-- Table structure for table `phpwebgallery_images`
     137--
     138
     139DROP TABLE IF EXISTS `phpwebgallery_images`;
     140CREATE TABLE `phpwebgallery_images` (
     141  `id` mediumint(8) unsigned NOT NULL auto_increment,
     142  `file` varchar(255) NOT NULL default '',
     143  `date_available` datetime NOT NULL default '0000-00-00 00:00:00',
     144  `date_creation` date default NULL,
     145  `tn_ext` varchar(4) default '',
     146  `name` varchar(255) default NULL,
     147  `comment` text,
     148  `author` varchar(255) default NULL,
     149  `hit` int(10) unsigned NOT NULL default '0',
     150  `filesize` mediumint(9) unsigned default NULL,
     151  `width` smallint(9) unsigned default NULL,
     152  `height` smallint(9) unsigned default NULL,
     153  `keywords` varchar(255) default NULL,
     154  `storage_category_id` smallint(5) unsigned default NULL,
     155  `representative_ext` varchar(4) default NULL,
     156  `date_metadata_update` date default NULL,
     157  `average_rate` float(5,2) unsigned default NULL,
     158  `path` varchar(255) NOT NULL default '',
     159  PRIMARY KEY  (`id`),
     160  KEY `images_i2` (`date_available`),
     161  KEY `images_i1` (`storage_category_id`),
     162  KEY `images_i3` (`average_rate`),
     163  KEY `images_i4` (`hit`),
     164  KEY `images_i5` (`date_creation`)
     165) TYPE=MyISAM;
     166
     167--
     168-- Table structure for table `phpwebgallery_rate`
     169--
     170
     171DROP TABLE IF EXISTS `phpwebgallery_rate`;
     172CREATE TABLE `phpwebgallery_rate` (
     173  `user_id` smallint(5) unsigned NOT NULL default '0',
     174  `element_id` mediumint(8) unsigned NOT NULL default '0',
     175  `rate` tinyint(2) unsigned NOT NULL default '0',
     176  PRIMARY KEY  (`user_id`,`element_id`)
     177) TYPE=MyISAM;
     178
     179--
     180-- Table structure for table `phpwebgallery_sessions`
     181--
     182
     183DROP TABLE IF EXISTS `phpwebgallery_sessions`;
     184CREATE TABLE `phpwebgallery_sessions` (
     185  `id` varchar(255) binary NOT NULL default '',
     186  `user_id` smallint(5) unsigned NOT NULL default '0',
     187  `expiration` datetime NOT NULL default '0000-00-00 00:00:00',
     188  PRIMARY KEY  (`id`)
     189) TYPE=MyISAM;
     190
     191--
     192-- Table structure for table `phpwebgallery_sites`
     193--
     194
     195DROP TABLE IF EXISTS `phpwebgallery_sites`;
     196CREATE TABLE `phpwebgallery_sites` (
     197  `id` tinyint(4) NOT NULL auto_increment,
     198  `galleries_url` varchar(255) NOT NULL default '',
     199  PRIMARY KEY  (`id`),
     200  UNIQUE KEY `sites_ui1` (`galleries_url`)
     201) TYPE=MyISAM;
     202
     203--
     204-- Table structure for table `phpwebgallery_user_access`
     205--
     206
     207DROP TABLE IF EXISTS `phpwebgallery_user_access`;
     208CREATE TABLE `phpwebgallery_user_access` (
     209  `user_id` smallint(5) unsigned NOT NULL default '0',
     210  `cat_id` smallint(5) unsigned NOT NULL default '0',
     211  PRIMARY KEY  (`user_id`,`cat_id`)
     212) TYPE=MyISAM;
     213
     214--
     215-- Table structure for table `phpwebgallery_user_forbidden`
     216--
     217
     218DROP TABLE IF EXISTS `phpwebgallery_user_forbidden`;
     219CREATE TABLE `phpwebgallery_user_forbidden` (
     220  `user_id` smallint(5) unsigned NOT NULL default '0',
     221  `need_update` enum('true','false') NOT NULL default 'true',
     222  `forbidden_categories` text,
     223  PRIMARY KEY  (`user_id`)
     224) TYPE=MyISAM;
     225
     226--
     227-- Table structure for table `phpwebgallery_user_group`
     228--
     229
     230DROP TABLE IF EXISTS `phpwebgallery_user_group`;
     231CREATE TABLE `phpwebgallery_user_group` (
     232  `user_id` smallint(5) unsigned NOT NULL default '0',
     233  `group_id` smallint(5) unsigned NOT NULL default '0',
     234  PRIMARY KEY  (`group_id`,`user_id`)
     235) TYPE=MyISAM;
     236
     237--
     238-- Table structure for table `phpwebgallery_users`
     239--
     240
     241DROP TABLE IF EXISTS `phpwebgallery_users`;
     242CREATE TABLE `phpwebgallery_users` (
     243  `id` smallint(5) unsigned NOT NULL auto_increment,
     244  `username` varchar(20) binary NOT NULL default '',
     245  `password` varchar(32) default NULL,
     246  `mail_address` varchar(255) default NULL,
     247  `nb_image_line` tinyint(1) unsigned NOT NULL default '5',
     248  `nb_line_page` tinyint(3) unsigned NOT NULL default '3',
     249  `status` enum('admin','guest') NOT NULL default 'guest',
     250  `language` varchar(50) NOT NULL default 'english',
     251  `maxwidth` smallint(6) default NULL,
     252  `maxheight` smallint(6) default NULL,
     253  `expand` enum('true','false') NOT NULL default 'false',
     254  `show_nb_comments` enum('true','false') NOT NULL default 'false',
     255  `recent_period` tinyint(3) unsigned NOT NULL default '7',
     256  `template` varchar(255) NOT NULL default 'default',
     257  `last_feed_check` datetime default NULL,
     258  `feed_id` varchar(50) binary default NULL,
     259  `registration_date` datetime NOT NULL default '0000-00-00 00:00:00',
     260  PRIMARY KEY  (`id`),
     261  UNIQUE KEY `users_ui1` (`username`)
     262) TYPE=MyISAM;
     263
     264--
     265-- Table structure for table `phpwebgallery_waiting`
     266--
     267
     268DROP TABLE IF EXISTS `phpwebgallery_waiting`;
     269CREATE TABLE `phpwebgallery_waiting` (
     270  `id` int(10) unsigned NOT NULL auto_increment,
     271  `storage_category_id` smallint(5) unsigned NOT NULL default '0',
     272  `file` varchar(255) NOT NULL default '',
     273  `username` varchar(255) NOT NULL default '',
     274  `mail_address` varchar(255) NOT NULL default '',
     275  `date` int(10) unsigned NOT NULL default '0',
     276  `tn_ext` char(3) default NULL,
     277  `validated` enum('true','false') NOT NULL default 'false',
     278  `infos` text,
     279  PRIMARY KEY  (`id`)
     280) TYPE=MyISAM;
     281
  • 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.