Changeset 3445 for trunk/picture.php


Ignore:
Timestamp:
Jun 23, 2009, 3:44:58 PM (15 years ago)
Author:
nikrou
Message:

Feature 1026 : Modify / delete comments for users

+ update config table content
+ minor modification of Sylvia theme
+ need refactoring

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/picture.php

    r3409 r3445  
    2626include(PHPWG_ROOT_PATH.'include/section_init.inc.php');
    2727include_once(PHPWG_ROOT_PATH.'include/functions_picture.inc.php');
     28include_once(PHPWG_ROOT_PATH.'include/functions_comment.inc.php');
    2829
    2930// Check Access and exit when user status is not ok
     
    308309      redirect($url_self);
    309310    }
     311    case 'edit_comment' :
     312    {
     313      if (isset($_GET['comment_to_edit'])
     314          and is_numeric($_GET['comment_to_edit'])
     315          and (is_admin() || $conf['user_can_edit_comment']))
     316      {
     317        if (!empty($_POST['content']))
     318        {
     319          update_user_comment(array('comment_id' => $_GET['comment_to_edit'],
     320                                    'image_id' => $page['image_id'],
     321                                    'content' => $_POST['content']),
     322                              $_POST['key']
     323                              );
     324          redirect($url_self);
     325        } else {
     326          $edit_comment = $_GET['comment_to_edit'];
     327          break;
     328        }
     329      }
     330    }
    310331    case 'delete_comment' :
    311332    {
    312333      if (isset($_GET['comment_to_delete'])
    313334          and is_numeric($_GET['comment_to_delete'])
    314           and is_admin() and !is_adviser() )
     335          and (is_admin() || $conf['user_can_delete_comment']))
    315336      {
    316         $query = '
    317 DELETE FROM '.COMMENTS_TABLE.'
    318   WHERE id = '.$_GET['comment_to_delete'].'
    319 ;';
    320         pwg_query( $query );
     337        delete_user_comment($_GET['comment_to_delete']);
    321338      }
    322 
    323339      redirect($url_self);
    324340    }
     
    593609
    594610
    595 
    596611$page['body_id'] = 'thePicturePage';
    597612
     
    948963$template->assign( 'ELEMENT_CONTENT', $element_content );
    949964
    950 
    951965// +-----------------------------------------------------------------------+
    952966// |                               sub pages                               |
Note: See TracChangeset for help on using the changeset viewer.