aboutsummaryrefslogtreecommitdiffstats
path: root/picture.php
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2005-07-16 14:29:35 +0000
committerplegall <plg@piwigo.org>2005-07-16 14:29:35 +0000
commit9bafdff17166028ed7448487d0ca8a19f3c2fbb3 (patch)
tree331aec15d000a13451bb6fbc1cd1cb6beec0902d /picture.php
parent315f9c5670b631fcc279c4d6ac00ae9386d67455 (diff)
- 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) git-svn-id: http://piwigo.org/svn/trunk@801 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'picture.php')
-rw-r--r--picture.php36
1 files changed, 24 insertions, 12 deletions
diff --git a/picture.php b/picture.php
index 7ac548088..e1d60d4a4 100644
--- a/picture.php
+++ b/picture.php
@@ -342,23 +342,34 @@ if ( isset( $_POST['content'] ) && !empty($_POST['content']) )
if ( mysql_num_rows( pwg_query( $query ) ) == 0
or $conf['anti-flood_time'] == 0 )
{
- $query = 'INSERT INTO '.COMMENTS_TABLE;
- $query.= ' (author,date,image_id,content,validated) VALUES (';
- $query.= "'".$author."'";
- $query.= ',NOW(),'.$_GET['image_id'];
- $query.= ",'".htmlspecialchars( $_POST['content'], ENT_QUOTES)."'";
- if ( !$conf['comments_validation'] or $user['status'] == 'admin' )
- {
- $query.= ",'true'";
+ list($dbnow) = mysql_fetch_row(pwg_query('SELECT NOW();'));
+
+ $data = array();
+ $data{'author'} = $author;
+ $data{'date'} = $dbnow;
+ $data{'image_id'} = $_GET['image_id'];
+ $data{'content'} = htmlspecialchars( $_POST['content'], ENT_QUOTES);
+
+ if (!$conf['comments_validation'] or $user['status'] == 'admin')
+ {
+ $data{'validated'} = 'true';
+ $data{'validation_date'} = $dbnow;
}
else
{
- $query.= ",'false'";
+ $data{'validated'} = 'false';
}
- $query.= ');';
- pwg_query( $query );
+
+ include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
+ $fields = array('author', 'date', 'image_id', 'content', 'validated',
+ 'validation_date');
+ mass_inserts(COMMENTS_TABLE, $fields, array($data));
+
// information message
$message = $lang['comment_added'];
+
+ if (!$conf['comments_validation'] or $user['status'] == 'admin')
+
if ( $conf['comments_validation'] and $user['status'] != 'admin' )
{
$message.= '<br />'.$lang['comment_to_validate'];
@@ -479,7 +490,8 @@ if ( !empty($picture['current']['date_creation']) )
}
// date of availability
-$availability_date = format_date($picture['current']['date_available']);
+$availability_date = format_date($picture['current']['date_available'],
+ 'mysql_datetime');
// size in pixels
if ($picture['current']['is_picture'])