2003-10-04 18:08:53 +02:00
|
|
|
<?php
|
2004-02-07 20:36:44 +01:00
|
|
|
// +-----------------------------------------------------------------------+
|
2004-11-06 22:12:59 +01:00
|
|
|
// | PhpWebGallery - a PHP based picture gallery |
|
|
|
|
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
|
2008-02-28 03:41:48 +01:00
|
|
|
// | Copyright (C) 2003-2008 PhpWebGallery Team - http://phpwebgallery.net |
|
2004-02-07 20:36:44 +01:00
|
|
|
// +-----------------------------------------------------------------------+
|
2006-11-08 05:28:30 +01:00
|
|
|
// | file : $Id$
|
2004-02-07 20:36:44 +01:00
|
|
|
// | last update : $Date$
|
|
|
|
// | last modifier : $Author$
|
|
|
|
// | revision : $Revision$
|
|
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
// | This program is free software; you can redistribute it and/or modify |
|
|
|
|
// | it under the terms of the GNU General Public License as published by |
|
|
|
|
// | the Free Software Foundation |
|
|
|
|
// | |
|
|
|
|
// | This program is distributed in the hope that it will be useful, but |
|
|
|
|
// | WITHOUT ANY WARRANTY; without even the implied warranty of |
|
|
|
|
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
|
|
|
// | General Public License for more details. |
|
|
|
|
// | |
|
|
|
|
// | You should have received a copy of the GNU General Public License |
|
|
|
|
// | along with this program; if not, write to the Free Software |
|
|
|
|
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
|
|
|
|
// | USA. |
|
|
|
|
// +-----------------------------------------------------------------------+
|
2003-10-04 18:08:53 +02:00
|
|
|
|
2004-10-23 19:56:46 +02:00
|
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
// | initialization |
|
|
|
|
// +-----------------------------------------------------------------------+
|
2006-11-08 05:28:30 +01:00
|
|
|
define('PHPWG_ROOT_PATH','./');
|
|
|
|
include_once(PHPWG_ROOT_PATH.'include/common.inc.php');
|
2004-02-02 01:55:18 +01:00
|
|
|
|
2006-03-09 23:46:28 +01:00
|
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
// | Check Access and exit when user status is not ok |
|
|
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
check_status(ACCESS_GUEST);
|
|
|
|
|
2005-06-21 23:08:11 +02:00
|
|
|
$sort_order = array(
|
2008-02-28 03:41:48 +01:00
|
|
|
'DESC' => l10n('descending'),
|
|
|
|
'ASC' => l10n('ascending')
|
2005-06-21 23:08:11 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
// sort_by : database fields proposed for sorting comments list
|
|
|
|
$sort_by = array(
|
2008-02-28 03:41:48 +01:00
|
|
|
'date' => l10n('comment date'),
|
|
|
|
'image_id' => l10n('picture')
|
2005-06-21 23:08:11 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
// items_number : list of number of items to display per page
|
|
|
|
$items_number = array(5,10,20,50,'all');
|
|
|
|
|
|
|
|
// since when display comments ?
|
|
|
|
//
|
|
|
|
$since_options = array(
|
|
|
|
1 => array('label' => l10n('today'),
|
|
|
|
'clause' => 'date > SUBDATE(CURDATE(), INTERVAL 1 DAY)'),
|
|
|
|
2 => array('label' => sprintf(l10n('last %d days'), 7),
|
|
|
|
'clause' => 'date > SUBDATE(CURDATE(), INTERVAL 7 DAY)'),
|
|
|
|
3 => array('label' => sprintf(l10n('last %d days'), 30),
|
|
|
|
'clause' => 'date > SUBDATE(CURDATE(), INTERVAL 30 DAY)'),
|
|
|
|
4 => array('label' => l10n('the beginning'),
|
|
|
|
'clause' => '1=1') // stupid but generic
|
|
|
|
);
|
|
|
|
|
2007-01-12 00:15:26 +01:00
|
|
|
$page['since'] = isset($_GET['since']) ? $_GET['since'] : 4;
|
2005-06-21 23:08:11 +02:00
|
|
|
|
|
|
|
// on which field sorting
|
|
|
|
//
|
|
|
|
$page['sort_by'] = 'date';
|
|
|
|
// if the form was submitted, it overloads default behaviour
|
|
|
|
if (isset($_GET['sort_by']))
|
2004-03-20 01:52:37 +01:00
|
|
|
{
|
2005-06-21 23:08:11 +02:00
|
|
|
$page['sort_by'] = $_GET['sort_by'];
|
2004-03-20 01:52:37 +01:00
|
|
|
}
|
2005-06-21 23:08:11 +02:00
|
|
|
|
|
|
|
// order to sort
|
|
|
|
//
|
2008-02-28 03:41:48 +01:00
|
|
|
$page['sort_order'] = 'DESC';
|
2005-06-21 23:08:11 +02:00
|
|
|
// if the form was submitted, it overloads default behaviour
|
|
|
|
if (isset($_GET['sort_order']))
|
|
|
|
{
|
2008-02-28 03:41:48 +01:00
|
|
|
$page['sort_order'] = $_GET['sort_order'];
|
2005-06-21 23:08:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// number of items to display
|
|
|
|
//
|
2007-02-14 01:36:34 +01:00
|
|
|
$page['items_number'] = 10;
|
2005-06-21 23:08:11 +02:00
|
|
|
if (isset($_GET['items_number']))
|
2004-03-20 01:52:37 +01:00
|
|
|
{
|
2005-06-21 23:08:11 +02:00
|
|
|
$page['items_number'] = $_GET['items_number'];
|
|
|
|
}
|
|
|
|
|
2007-01-12 00:15:26 +01:00
|
|
|
$page['where_clauses'] = array();
|
|
|
|
|
2005-06-21 23:08:11 +02:00
|
|
|
// which category to filter on ?
|
|
|
|
if (isset($_GET['cat']) and 0 != $_GET['cat'])
|
|
|
|
{
|
2007-01-12 00:15:26 +01:00
|
|
|
$page['where_clauses'][] =
|
2005-06-21 23:08:11 +02:00
|
|
|
'category_id IN ('.implode(',', get_subcat_ids(array($_GET['cat']))).')';
|
|
|
|
}
|
|
|
|
|
|
|
|
// search a particular author
|
|
|
|
if (isset($_GET['author']) and !empty($_GET['author']))
|
|
|
|
{
|
2007-01-12 00:15:26 +01:00
|
|
|
$page['where_clauses'][] = 'com.author = \''.$_GET['author'].'\'';
|
2005-06-21 23:08:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// search a substring among comments content
|
|
|
|
if (isset($_GET['keyword']) and !empty($_GET['keyword']))
|
|
|
|
{
|
2007-01-12 00:15:26 +01:00
|
|
|
$page['where_clauses'][] =
|
2005-06-21 23:08:11 +02:00
|
|
|
'('.
|
|
|
|
implode(' AND ',
|
|
|
|
array_map(
|
|
|
|
create_function(
|
|
|
|
'$s',
|
|
|
|
'return "content LIKE \'%$s%\'";'
|
|
|
|
),
|
2007-05-15 05:38:48 +02:00
|
|
|
preg_split('/[\s,;]+/', $_GET['keyword'] )
|
2005-06-21 23:08:11 +02:00
|
|
|
)
|
|
|
|
).
|
|
|
|
')';
|
2004-03-20 01:52:37 +01:00
|
|
|
}
|
2005-06-21 23:08:11 +02:00
|
|
|
|
2007-01-12 00:15:26 +01:00
|
|
|
$page['where_clauses'][] = $since_options[$page['since']]['clause'];
|
|
|
|
|
2006-11-08 05:28:30 +01:00
|
|
|
// which status to filter on ?
|
2007-01-12 00:15:26 +01:00
|
|
|
if ( !is_admin() )
|
2006-11-08 05:28:30 +01:00
|
|
|
{
|
2007-01-12 00:15:26 +01:00
|
|
|
$page['where_clauses'][] = 'validated="true"';
|
2006-11-08 05:28:30 +01:00
|
|
|
}
|
|
|
|
|
2007-01-12 00:15:26 +01:00
|
|
|
$page['where_clauses'][] = get_sql_condition_FandF
|
|
|
|
(
|
|
|
|
array
|
|
|
|
(
|
|
|
|
'forbidden_categories' => 'category_id',
|
|
|
|
'visible_categories' => 'category_id',
|
|
|
|
'visible_images' => 'ic.image_id'
|
|
|
|
),
|
|
|
|
'', true
|
|
|
|
);
|
2006-11-08 05:28:30 +01:00
|
|
|
|
2004-10-23 19:56:46 +02:00
|
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
// | comments management |
|
|
|
|
// +-----------------------------------------------------------------------+
|
2006-11-22 05:41:25 +01:00
|
|
|
if (isset($_GET['delete']) and is_numeric($_GET['delete'])
|
|
|
|
and !is_adviser() )
|
|
|
|
{// comments deletion
|
|
|
|
check_status(ACCESS_ADMINISTRATOR);
|
|
|
|
$query = '
|
2004-10-23 19:56:46 +02:00
|
|
|
DELETE FROM '.COMMENTS_TABLE.'
|
2006-11-08 05:28:30 +01:00
|
|
|
WHERE id='.$_GET['delete'].'
|
2004-10-23 19:56:46 +02:00
|
|
|
;';
|
2006-11-22 05:41:25 +01:00
|
|
|
pwg_query($query);
|
|
|
|
}
|
2006-11-08 05:28:30 +01:00
|
|
|
|
2006-11-22 05:41:25 +01:00
|
|
|
if (isset($_GET['validate']) and is_numeric($_GET['validate'])
|
|
|
|
and !is_adviser() )
|
|
|
|
{ // comments validation
|
|
|
|
check_status(ACCESS_ADMINISTRATOR);
|
|
|
|
$query = '
|
2004-10-23 19:56:46 +02:00
|
|
|
UPDATE '.COMMENTS_TABLE.'
|
|
|
|
SET validated = \'true\'
|
2006-11-22 05:41:25 +01:00
|
|
|
, validation_date = NOW()
|
2006-11-08 05:28:30 +01:00
|
|
|
WHERE id='.$_GET['validate'].'
|
2004-10-23 19:56:46 +02:00
|
|
|
;';
|
2006-11-22 05:41:25 +01:00
|
|
|
pwg_query($query);
|
2004-10-23 19:56:46 +02:00
|
|
|
}
|
2006-11-22 05:41:25 +01:00
|
|
|
|
2004-10-23 19:56:46 +02:00
|
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
// | page header and options |
|
|
|
|
// +-----------------------------------------------------------------------+
|
- new : HTML BODY identifier to let CSS stylesheets manage specific
behaviour.
- deletion : admin/search useless
- improvement : in admin/user_list, special behaviour for true/false fields
(expand, show_comments)
- new : gallery_title and gallery_description are displayed at the top of
each page.
- improvement : simplification in HTML for categories menu.
- improvement : standardization of presentation in all public pages
(identification, registration, search, profile, notification, comments,
etc.)
(not in ChangeLog, below this line)
- add forgotten notification.php (should have been added in a previous
commit)
- [template cclear] deletion of useless class .bouton
- [template cclear] for test purpose, new presentation of register page
(using FORM.filter)
- [template cclear] adaptation of admin/group_list from template default
- [template cclear] deletion of obsolete admin/infos_images
- [template cclear] deletion of obsolete admin/search_username
- [template cclear] new icon register.png
git-svn-id: http://piwigo.org/svn/trunk@850 68402e56-0260-453c-a942-63ccdbb3a9ee
2005-08-26 00:43:47 +02:00
|
|
|
|
2008-03-08 13:38:09 +01:00
|
|
|
$title= l10n('User comments');
|
- new : HTML BODY identifier to let CSS stylesheets manage specific
behaviour.
- deletion : admin/search useless
- improvement : in admin/user_list, special behaviour for true/false fields
(expand, show_comments)
- new : gallery_title and gallery_description are displayed at the top of
each page.
- improvement : simplification in HTML for categories menu.
- improvement : standardization of presentation in all public pages
(identification, registration, search, profile, notification, comments,
etc.)
(not in ChangeLog, below this line)
- add forgotten notification.php (should have been added in a previous
commit)
- [template cclear] deletion of useless class .bouton
- [template cclear] for test purpose, new presentation of register page
(using FORM.filter)
- [template cclear] adaptation of admin/group_list from template default
- [template cclear] deletion of obsolete admin/infos_images
- [template cclear] deletion of obsolete admin/search_username
- [template cclear] new icon register.png
git-svn-id: http://piwigo.org/svn/trunk@850 68402e56-0260-453c-a942-63ccdbb3a9ee
2005-08-26 00:43:47 +02:00
|
|
|
$page['body_id'] = 'theCommentsPage';
|
2004-02-08 02:28:18 +01:00
|
|
|
|
2004-10-23 19:56:46 +02:00
|
|
|
$template->set_filenames(array('comments'=>'comments.tpl'));
|
2008-02-28 03:41:48 +01:00
|
|
|
$template->assign(
|
2004-10-23 19:56:46 +02:00
|
|
|
array(
|
2005-06-21 23:08:11 +02:00
|
|
|
'F_ACTION'=>PHPWG_ROOT_PATH.'comments.php',
|
2007-10-11 02:10:41 +02:00
|
|
|
'F_KEYWORD'=>@htmlspecialchars(stripslashes($_GET['keyword'])),
|
|
|
|
'F_AUTHOR'=>@htmlspecialchars(stripslashes($_GET['author'])),
|
2004-10-23 19:56:46 +02:00
|
|
|
)
|
|
|
|
);
|
2004-02-08 02:28:18 +01:00
|
|
|
|
2005-06-21 23:08:11 +02:00
|
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
// | form construction |
|
|
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
|
|
|
|
// Search in a particular category
|
2008-02-28 03:41:48 +01:00
|
|
|
$blockname = 'categories';
|
2005-06-21 23:08:11 +02:00
|
|
|
|
|
|
|
$query = '
|
2007-02-27 02:56:16 +01:00
|
|
|
SELECT id, name, uppercats, global_rank
|
2006-12-21 22:38:20 +01:00
|
|
|
FROM '.CATEGORIES_TABLE.'
|
|
|
|
'.get_sql_condition_FandF
|
|
|
|
(
|
|
|
|
array
|
|
|
|
(
|
|
|
|
'forbidden_categories' => 'id',
|
|
|
|
'visible_categories' => 'id'
|
|
|
|
),
|
|
|
|
'WHERE'
|
|
|
|
).'
|
2005-06-21 23:08:11 +02:00
|
|
|
;';
|
|
|
|
display_select_cat_wrapper($query, array(@$_GET['cat']), $blockname, true);
|
|
|
|
|
|
|
|
// Filter on recent comments...
|
2008-02-28 03:41:48 +01:00
|
|
|
$tpl_var=array();
|
2005-06-21 23:08:11 +02:00
|
|
|
foreach ($since_options as $id => $option)
|
|
|
|
{
|
2008-02-28 03:41:48 +01:00
|
|
|
$tpl_var[ $id ] = $option['label'];
|
2005-06-21 23:08:11 +02:00
|
|
|
}
|
2008-02-28 03:41:48 +01:00
|
|
|
$template->assign( 'since_options', $tpl_var);
|
|
|
|
$template->assign( 'since_options_selected', $page['since']);
|
2005-06-21 23:08:11 +02:00
|
|
|
|
|
|
|
// Sort by
|
2008-02-28 03:41:48 +01:00
|
|
|
$template->assign( 'sort_by_options', $sort_by);
|
|
|
|
$template->assign( 'sort_by_options_selected', $page['sort_by']);
|
2005-06-21 23:08:11 +02:00
|
|
|
|
|
|
|
// Sorting order
|
2008-02-28 03:41:48 +01:00
|
|
|
$template->assign( 'sort_order_options', $sort_order);
|
|
|
|
$template->assign( 'sort_order_options_selected', $page['sort_order']);
|
2005-06-21 23:08:11 +02:00
|
|
|
|
|
|
|
|
|
|
|
// Number of items
|
|
|
|
$blockname = 'items_number_option';
|
2008-02-28 03:41:48 +01:00
|
|
|
$tpl_var=array();
|
2005-06-21 23:08:11 +02:00
|
|
|
foreach ($items_number as $option)
|
|
|
|
{
|
2008-02-28 03:41:48 +01:00
|
|
|
$tpl_var[ $option ] = is_numeric($option) ? $option : l10n($option);
|
2005-06-21 23:08:11 +02:00
|
|
|
}
|
2008-02-28 03:41:48 +01:00
|
|
|
$template->assign( 'item_number_options', $tpl_var);
|
|
|
|
$template->assign( 'item_number_options_selected', $page['items_number']);
|
|
|
|
|
2005-06-21 23:08:11 +02:00
|
|
|
|
|
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
// | navigation bar |
|
|
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
|
|
|
|
if (isset($_GET['start']) and is_numeric($_GET['start']))
|
|
|
|
{
|
|
|
|
$start = $_GET['start'];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$start = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
$query = '
|
|
|
|
SELECT COUNT(DISTINCT(id))
|
|
|
|
FROM '.IMAGE_CATEGORY_TABLE.' AS ic
|
|
|
|
INNER JOIN '.COMMENTS_TABLE.' AS com
|
|
|
|
ON ic.image_id = com.image_id
|
2007-01-12 00:15:26 +01:00
|
|
|
WHERE '.implode('
|
|
|
|
AND ', $page['where_clauses']).'
|
2005-06-21 23:08:11 +02:00
|
|
|
;';
|
|
|
|
list($counter) = mysql_fetch_row(pwg_query($query));
|
|
|
|
|
2006-11-08 05:28:30 +01:00
|
|
|
$url = PHPWG_ROOT_PATH
|
|
|
|
.'comments.php'
|
|
|
|
.get_query_string_diff(array('start','delete','validate'));
|
2005-06-21 23:08:11 +02:00
|
|
|
|
|
|
|
$navbar = create_navigation_bar($url,
|
|
|
|
$counter,
|
|
|
|
$start,
|
|
|
|
$page['items_number'],
|
|
|
|
'');
|
|
|
|
|
2008-02-28 03:41:48 +01:00
|
|
|
$template->assign('NAVBAR', $navbar);
|
2005-06-21 23:08:11 +02:00
|
|
|
|
2004-10-23 19:56:46 +02:00
|
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
// | last comments display |
|
|
|
|
// +-----------------------------------------------------------------------+
|
2005-06-21 23:08:11 +02:00
|
|
|
|
|
|
|
$comments = array();
|
|
|
|
$element_ids = array();
|
|
|
|
$category_ids = array();
|
2004-10-23 19:56:46 +02:00
|
|
|
|
|
|
|
$query = '
|
2005-06-21 23:08:11 +02:00
|
|
|
SELECT com.id AS comment_id
|
|
|
|
, com.image_id
|
|
|
|
, ic.category_id
|
|
|
|
, com.author
|
|
|
|
, com.date
|
|
|
|
, com.content
|
|
|
|
, com.id AS comment_id
|
2006-11-08 05:28:30 +01:00
|
|
|
, com.validated
|
2005-06-21 23:08:11 +02:00
|
|
|
FROM '.IMAGE_CATEGORY_TABLE.' AS ic
|
|
|
|
INNER JOIN '.COMMENTS_TABLE.' AS com
|
|
|
|
ON ic.image_id = com.image_id
|
2007-01-12 00:15:26 +01:00
|
|
|
WHERE '.implode('
|
|
|
|
AND ', $page['where_clauses']).'
|
2005-06-21 23:08:11 +02:00
|
|
|
GROUP BY comment_id
|
|
|
|
ORDER BY '.$page['sort_by'].' '.$page['sort_order'];
|
|
|
|
if ('all' != $page['items_number'])
|
|
|
|
{
|
|
|
|
$query.= '
|
|
|
|
LIMIT '.$start.','.$page['items_number'];
|
|
|
|
}
|
|
|
|
$query.= '
|
2004-10-23 19:56:46 +02:00
|
|
|
;';
|
2004-10-30 17:42:29 +02:00
|
|
|
$result = pwg_query($query);
|
2006-11-08 05:28:30 +01:00
|
|
|
while ($row = mysql_fetch_assoc($result))
|
2004-03-20 01:52:37 +01:00
|
|
|
{
|
2005-06-21 23:08:11 +02:00
|
|
|
array_push($comments, $row);
|
|
|
|
array_push($element_ids, $row['image_id']);
|
|
|
|
array_push($category_ids, $row['category_id']);
|
2004-03-20 01:52:37 +01:00
|
|
|
}
|
2005-06-21 23:08:11 +02:00
|
|
|
|
|
|
|
if (count($comments) > 0)
|
2004-10-23 19:56:46 +02:00
|
|
|
{
|
2005-06-21 23:08:11 +02:00
|
|
|
// retrieving element informations
|
|
|
|
$elements = array();
|
2004-10-23 19:56:46 +02:00
|
|
|
$query = '
|
2005-06-21 23:08:11 +02:00
|
|
|
SELECT id, name, file, path, tn_ext
|
2004-10-23 19:56:46 +02:00
|
|
|
FROM '.IMAGES_TABLE.'
|
2005-06-21 23:08:11 +02:00
|
|
|
WHERE id IN ('.implode(',', $element_ids).')
|
2004-10-23 19:56:46 +02:00
|
|
|
;';
|
2005-06-21 23:08:11 +02:00
|
|
|
$result = pwg_query($query);
|
2006-11-08 05:28:30 +01:00
|
|
|
while ($row = mysql_fetch_assoc($result))
|
2004-10-23 19:56:46 +02:00
|
|
|
{
|
2005-06-21 23:08:11 +02:00
|
|
|
$elements[$row['id']] = $row;
|
2004-10-23 19:56:46 +02:00
|
|
|
}
|
2005-01-23 16:27:20 +01:00
|
|
|
|
2005-06-21 23:08:11 +02:00
|
|
|
// retrieving category informations
|
2004-10-23 19:56:46 +02:00
|
|
|
$query = '
|
2007-02-28 04:07:12 +01:00
|
|
|
SELECT id, name, permalink, uppercats
|
2005-06-21 23:08:11 +02:00
|
|
|
FROM '.CATEGORIES_TABLE.'
|
|
|
|
WHERE id IN ('.implode(',', $category_ids).')
|
|
|
|
;';
|
2007-02-28 04:07:12 +01:00
|
|
|
$categories = hash_from_query($query, 'id');
|
2005-06-21 23:08:11 +02:00
|
|
|
|
|
|
|
foreach ($comments as $comment)
|
2004-10-23 19:56:46 +02:00
|
|
|
{
|
2005-06-21 23:08:11 +02:00
|
|
|
if (!empty($elements[$comment['image_id']]['name']))
|
2003-10-04 18:08:53 +02:00
|
|
|
{
|
2006-11-08 05:28:30 +01:00
|
|
|
$name=$elements[$comment['image_id']]['name'];
|
2003-10-04 18:08:53 +02:00
|
|
|
}
|
2005-06-21 23:08:11 +02:00
|
|
|
else
|
|
|
|
{
|
2006-11-08 05:28:30 +01:00
|
|
|
$name=get_name_from_file($elements[$comment['image_id']]['file']);
|
2005-06-21 23:08:11 +02:00
|
|
|
}
|
2006-03-21 02:27:21 +01:00
|
|
|
|
2005-06-21 23:08:11 +02:00
|
|
|
// source of the thumbnail picture
|
2006-11-08 05:28:30 +01:00
|
|
|
$thumbnail_src = get_thumbnail_url( $elements[$comment['image_id']] );
|
2006-03-21 02:27:21 +01:00
|
|
|
|
2005-06-21 23:08:11 +02:00
|
|
|
// link to the full size picture
|
2006-03-21 02:27:21 +01:00
|
|
|
$url = make_picture_url(
|
|
|
|
array(
|
2007-02-27 02:56:16 +01:00
|
|
|
'category' => $categories[ $comment['category_id'] ],
|
2006-03-21 02:27:21 +01:00
|
|
|
'image_id' => $comment['image_id'],
|
|
|
|
'image_file' => $elements[$comment['image_id']]['file'],
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
2005-06-21 23:08:11 +02:00
|
|
|
$author = $comment['author'];
|
|
|
|
if (empty($comment['author']))
|
2003-10-04 18:08:53 +02:00
|
|
|
{
|
2005-06-21 23:08:11 +02:00
|
|
|
$author = l10n('guest');
|
2003-10-04 18:08:53 +02:00
|
|
|
}
|
2006-03-21 02:27:21 +01:00
|
|
|
|
2008-02-28 03:41:48 +01:00
|
|
|
$tpl_comment =
|
2005-06-21 23:08:11 +02:00
|
|
|
array(
|
2006-01-15 14:45:42 +01:00
|
|
|
'U_PICTURE' => $url,
|
2005-08-21 23:23:17 +02:00
|
|
|
'TN_SRC' => $thumbnail_src,
|
2006-11-08 05:28:30 +01:00
|
|
|
'ALT' => $name,
|
2007-06-07 20:50:25 +02:00
|
|
|
'AUTHOR' => trigger_event('render_comment_author', $author),
|
2005-08-21 23:23:17 +02:00
|
|
|
'DATE'=>format_date($comment['date'],'mysql_datetime',true),
|
2006-11-08 05:28:30 +01:00
|
|
|
'CONTENT'=>trigger_event('render_comment_content',$comment['content']),
|
2008-02-28 03:41:48 +01:00
|
|
|
);
|
2006-11-08 05:28:30 +01:00
|
|
|
|
|
|
|
if ( is_admin() )
|
|
|
|
{
|
|
|
|
$url = get_root_url().'comments.php'.get_query_string_diff(array('delete','validate'));
|
2008-02-28 03:41:48 +01:00
|
|
|
$tpl_comment['U_DELETE'] = add_url_params($url,
|
2006-11-08 05:28:30 +01:00
|
|
|
array('delete'=>$comment['comment_id'])
|
2008-02-28 03:41:48 +01:00
|
|
|
);
|
|
|
|
|
2006-11-08 05:28:30 +01:00
|
|
|
if ($comment['validated'] != 'true')
|
|
|
|
{
|
2008-02-28 03:41:48 +01:00
|
|
|
$tpl_comment['U_VALIDATE'] = add_url_params($url,
|
2006-11-08 05:28:30 +01:00
|
|
|
array('validate'=>$comment['comment_id'])
|
2008-02-28 03:41:48 +01:00
|
|
|
);
|
2006-11-08 05:28:30 +01:00
|
|
|
}
|
|
|
|
}
|
2008-02-28 03:41:48 +01:00
|
|
|
$template->append('comments', $tpl_comment);
|
2003-10-04 18:08:53 +02:00
|
|
|
}
|
2004-10-23 19:56:46 +02:00
|
|
|
}
|
|
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
// | html code display |
|
|
|
|
// +-----------------------------------------------------------------------+
|
2007-09-28 00:46:17 +02:00
|
|
|
include(PHPWG_ROOT_PATH.'include/page_header.php');
|
2008-02-28 03:41:48 +01:00
|
|
|
$template->pparse('comments');
|
2006-11-08 05:28:30 +01:00
|
|
|
include(PHPWG_ROOT_PATH.'include/page_tail.php');
|
2007-09-28 00:46:17 +02:00
|
|
|
?>
|