diff options
author | nikrou <nikrou@piwigo.org> | 2009-06-23 13:44:58 +0000 |
---|---|---|
committer | nikrou <nikrou@piwigo.org> | 2009-06-23 13:44:58 +0000 |
commit | 9245227e7095ce46272df8ff2990586e43a915c8 (patch) | |
tree | 468819f8b412c91e26512e99a4aa2653566919fc /picture.php | |
parent | 5b524425892c99aed47fce58023e1f66300d516e (diff) |
Feature 1026 : Modify / delete comments for users
+ update config table content
+ minor modification of Sylvia theme
+ need refactoring
git-svn-id: http://piwigo.org/svn/trunk@3445 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'picture.php')
-rw-r--r-- | picture.php | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/picture.php b/picture.php index fd42536b2..78f3f719f 100644 --- a/picture.php +++ b/picture.php @@ -25,6 +25,7 @@ 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); @@ -307,19 +308,34 @@ UPDATE '.CATEGORIES_TABLE.' ); redirect($url_self); } + case 'edit_comment' : + { + if (isset($_GET['comment_to_edit']) + and is_numeric($_GET['comment_to_edit']) + 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; + } + } + } case 'delete_comment' : { if (isset($_GET['comment_to_delete']) and is_numeric($_GET['comment_to_delete']) - and is_admin() and !is_adviser() ) + and (is_admin() || $conf['user_can_delete_comment'])) { - $query = ' -DELETE FROM '.COMMENTS_TABLE.' - WHERE id = '.$_GET['comment_to_delete'].' -;'; - pwg_query( $query ); + delete_user_comment($_GET['comment_to_delete']); } - redirect($url_self); } case 'validate_comment' : @@ -592,7 +608,6 @@ if ( $metadata_showable and pwg_get_session_var('show_metadata') ) } - $page['body_id'] = 'thePicturePage'; // allow plugins to change what we computed before passing data to template @@ -947,7 +962,6 @@ $element_content = trigger_event( ); $template->assign( 'ELEMENT_CONTENT', $element_content ); - // +-----------------------------------------------------------------------+ // | sub pages | // +-----------------------------------------------------------------------+ |