Changeset 5127 for trunk/picture.php


Ignore:
Timestamp:
Mar 13, 2010, 6:59:14 AM (14 years ago)
Author:
rvelices
Message:
  • fix php warning followed by mysql query fatal error
  • don't include a file unless necessary
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/picture.php

    r5021 r5127  
    2626include(PHPWG_ROOT_PATH.'include/section_init.inc.php');
    2727include_once(PHPWG_ROOT_PATH.'include/functions_picture.inc.php');
    28 include_once(PHPWG_ROOT_PATH.'include/functions_comment.inc.php');
    2928
    3029// Check Access and exit when user status is not ok
     
    6867    access_denied();
    6968  }
    70   list($page['image_id'], $page['image_file']) =  $row;
     69
     70  $page['image_id'] = $row['id'];
     71  $page['image_file'] =  $row['file'];
    7172  if ( !isset($page['rank_of'][$page['image_id']]) )
    7273  {// the image can still be non accessible (filter/cat perm) and/or not in the set
     
    311312    case 'edit_comment' :
    312313    {
     314      include_once(PHPWG_ROOT_PATH.'include/functions_comment.inc.php');
    313315      if (isset($_GET['comment_to_edit'])
    314316          and is_numeric($_GET['comment_to_edit'])
    315           and (is_admin() || $conf['user_can_edit_comment']))
     317          and (is_admin() || $conf['user_can_edit_comment']))
    316318      {
    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         }
     319        if (!empty($_POST['content']))
     320        {
     321          update_user_comment(array('comment_id' => $_GET['comment_to_edit'],
     322                  'image_id' => $page['image_id'],
     323                  'content' => $_POST['content']),
     324                  $_POST['key']
     325                  );
     326          redirect($url_self);
     327        } else {
     328          $edit_comment = $_GET['comment_to_edit'];
     329          break;
     330        }
    329331      }
    330332    }
    331333    case 'delete_comment' :
    332334    {
     335      include_once(PHPWG_ROOT_PATH.'include/functions_comment.inc.php');
    333336      if (isset($_GET['comment_to_delete'])
    334337          and is_numeric($_GET['comment_to_delete'])
    335338          and (is_admin() || $conf['user_can_delete_comment']))
    336339      {
    337         delete_user_comment($_GET['comment_to_delete']);
     340        delete_user_comment($_GET['comment_to_delete']);
    338341      }
    339342      redirect($url_self);
     
    341344    case 'validate_comment' :
    342345    {
     346      include_once(PHPWG_ROOT_PATH.'include/functions_comment.inc.php');
    343347      if (isset($_GET['comment_to_validate'])
    344348          and is_numeric($_GET['comment_to_validate'])
Note: See TracChangeset for help on using the changeset viewer.