aboutsummaryrefslogtreecommitdiffstats
path: root/picture.php
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2010-03-13 05:59:14 +0000
committerrvelices <rv-github@modusoptimus.com>2010-03-13 05:59:14 +0000
commit2d7a399f7e1d305398a57b275f6fbafbed57ae00 (patch)
treeb7cb1e7082d7f0f6fa2f28ef60912de0ca1a7770 /picture.php
parentf76ce16aa6bdc7d0e45cb8aa56c50acfced1034d (diff)
- fix php warning followed by mysql query fatal error
- don't include a file unless necessary git-svn-id: http://piwigo.org/svn/trunk@5127 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'picture.php')
-rw-r--r--picture.php36
1 files changed, 20 insertions, 16 deletions
diff --git a/picture.php b/picture.php
index 424cf7692..4dd3d4fad 100644
--- a/picture.php
+++ b/picture.php
@@ -25,7 +25,6 @@ define('PHPWG_ROOT_PATH','./');
include_once(PHPWG_ROOT_PATH.'include/common.inc.php');
include(PHPWG_ROOT_PATH.'include/section_init.inc.php');
include_once(PHPWG_ROOT_PATH.'include/functions_picture.inc.php');
-include_once(PHPWG_ROOT_PATH.'include/functions_comment.inc.php');
// Check Access and exit when user status is not ok
check_status(ACCESS_GUEST);
@@ -67,7 +66,9 @@ SELECT id, file, level
{
access_denied();
}
- list($page['image_id'], $page['image_file']) = $row;
+
+ $page['image_id'] = $row['id'];
+ $page['image_file'] = $row['file'];
if ( !isset($page['rank_of'][$page['image_id']]) )
{// the image can still be non accessible (filter/cat perm) and/or not in the set
global $filter;
@@ -310,36 +311,39 @@ UPDATE '.CATEGORIES_TABLE.'
}
case 'edit_comment' :
{
+ include_once(PHPWG_ROOT_PATH.'include/functions_comment.inc.php');
if (isset($_GET['comment_to_edit'])
and is_numeric($_GET['comment_to_edit'])
- and (is_admin() || $conf['user_can_edit_comment']))
+ and (is_admin() || $conf['user_can_edit_comment']))
{
- if (!empty($_POST['content']))
- {
- update_user_comment(array('comment_id' => $_GET['comment_to_edit'],
- 'image_id' => $page['image_id'],
- 'content' => $_POST['content']),
- $_POST['key']
- );
- redirect($url_self);
- } else {
- $edit_comment = $_GET['comment_to_edit'];
- break;
- }
+ if (!empty($_POST['content']))
+ {
+ update_user_comment(array('comment_id' => $_GET['comment_to_edit'],
+ 'image_id' => $page['image_id'],
+ 'content' => $_POST['content']),
+ $_POST['key']
+ );
+ redirect($url_self);
+ } else {
+ $edit_comment = $_GET['comment_to_edit'];
+ break;
+ }
}
}
case 'delete_comment' :
{
+ include_once(PHPWG_ROOT_PATH.'include/functions_comment.inc.php');
if (isset($_GET['comment_to_delete'])
and is_numeric($_GET['comment_to_delete'])
and (is_admin() || $conf['user_can_delete_comment']))
{
- delete_user_comment($_GET['comment_to_delete']);
+ delete_user_comment($_GET['comment_to_delete']);
}
redirect($url_self);
}
case 'validate_comment' :
{
+ include_once(PHPWG_ROOT_PATH.'include/functions_comment.inc.php');
if (isset($_GET['comment_to_validate'])
and is_numeric($_GET['comment_to_validate'])
and is_admin() and !is_adviser() )