Changeset 3445 for trunk/comments.php
- Timestamp:
- Jun 23, 2009, 3:44:58 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/comments.php
r3405 r3445 27 27 define('PHPWG_ROOT_PATH','./'); 28 28 include_once(PHPWG_ROOT_PATH.'include/common.inc.php'); 29 include_once(PHPWG_ROOT_PATH.'include/functions_comment.inc.php'); 29 30 30 31 // +-----------------------------------------------------------------------+ … … 143 144 // +-----------------------------------------------------------------------+ 144 145 if (isset($_GET['delete']) and is_numeric($_GET['delete']) 145 and !is_adviser())146 and (is_admin() || $conf['user_can_delete_comment'])) 146 147 {// comments deletion 147 check_status(ACCESS_ADMINISTRATOR); 148 $query = ' 149 DELETE FROM '.COMMENTS_TABLE.' 150 WHERE id='.$_GET['delete'].' 151 ;'; 152 pwg_query($query); 148 delete_user_comment($_GET['delete']); 153 149 } 154 150 … … 164 160 ;'; 165 161 pwg_query($query); 162 } 163 164 if (isset($_GET['edit']) and is_numeric($_GET['edit']) 165 and (is_admin() || $conf['user_can_edit_comment'])) 166 { 167 if (!empty($_POST['content'])) 168 { 169 update_user_comment(array('comment_id' => $_GET['edit'], 170 'image_id' => $_POST['image_id'], 171 'content' => $_POST['content']), 172 $_POST['key'] 173 ); 174 175 $edit_comment = null; 176 } 177 else 178 { 179 $edit_comment = $_GET['edit']; 180 } 166 181 } 167 182 … … 368 383 ); 369 384 370 if ( is_admin() ) 371 { 372 $url = get_root_url().'comments.php'.get_query_string_diff(array('delete','validate')); 373 $tpl_comment['U_DELETE'] = add_url_params($url, 374 array('delete'=>$comment['comment_id']) 375 ); 376 377 if ($comment['validated'] != 'true') 385 if (can_manage_comment('delete', $comment['author'])) 386 { 387 $url = get_root_url().'comments.php' 388 .get_query_string_diff(array('delete','validate','edit')); 389 $tpl_comment['U_DELETE'] = 390 add_url_params($url, 391 array('delete'=>$comment['comment_id']) 392 ); 393 } 394 if (can_manage_comment('edit', $comment['author'])) 395 { 396 $url = get_root_url().'comments.php' 397 .get_query_string_diff(array('edit', 'delete','validate')); 398 $tpl_comment['U_EDIT'] = 399 add_url_params($url, 400 array('edit'=>$comment['comment_id']) 401 ); 402 if (isset($edit_comment) and ($comment['comment_id'] == $edit_comment)) 378 403 { 379 $tpl_comment['U_VALIDATE'] = add_url_params($url, 380 array('validate'=>$comment['comment_id']) 381 ); 404 $tpl_comment['IN_EDIT'] = true; 405 $key = get_comment_post_key($comment['image_id']); 406 $tpl_comment['KEY'] = $key; 407 $tpl_comment['IMAGE_ID'] = $comment['image_id']; 408 $tpl_comment['CONTENT'] = $comment['content']; 382 409 } 410 } 411 412 if ( is_admin() && $comment['validated'] != 'true') 413 { 414 $tpl_comment['U_VALIDATE'] = 415 add_url_params($url, 416 array('validate'=>$comment['comment_id']) 417 ); 383 418 } 384 419 $template->append('comments', $tpl_comment);
Note: See TracChangeset
for help on using the changeset viewer.