Changeset 12767

Show
Ignore:
Timestamp:
12/19/11 18:08:49 (17 months ago)
Author:
mistic100
Message:

feature:2538 transmits messages after comment edition trough SESSION (no more ugly url displayed, avoid some minor bugs)

Location:
trunk
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/include/functions_session.inc.php

    r12119 r12767  
    142142REPLACE INTO '.SESSIONS_TABLE.' 
    143143  (id,data,expiration) 
    144   VALUES(\''.get_remote_addr_session_hash().$session_id.'\',\''.$data.'\',now()) 
     144  VALUES(\''.get_remote_addr_session_hash().$session_id.'\',\''.str_replace("'", "\'", $data).'\',now()) 
    145145;'; 
    146146  pwg_query($query); 
  • trunk/include/picture_comment.inc.php

    r12764 r12767  
    229229  { 
    230230    $key = get_ephemeral_key(3, $page['image_id']); 
    231     $content = ''; 
    232     if ('reject'===@$comment_action) 
    233     { 
    234       $content = htmlspecialchars( stripslashes($comm['content']) ); 
    235     } 
    236231    $template->assign('comment_add', 
    237232        array( 
    238233          'F_ACTION' => $url_self, 
    239234          'KEY' => $key, 
    240           'CONTENT' => $content, 
     235          'CONTENT' => null, 
    241236          'SHOW_AUTHOR' => !is_classic_user() 
    242237        )); 
  • trunk/picture.php

    r12764 r12767  
    321321      check_input_parameter('comment_to_edit', $_GET, false, PATTERN_ID); 
    322322      $author_id = get_comment_author_id($_GET['comment_to_edit']); 
     323       
    323324      if (can_manage_comment('edit', $author_id)) 
    324325      { 
     
    334335            ); 
    335336 
     337          $perform_redirect = false; 
    336338          switch ($comment_action) 
    337339          { 
    338340            case 'moderate': 
    339               array_push($page['infos'], l10n('An administrator must authorize your comment before it is visible.')); 
     341              $_SESSION['page_infos'][] = l10n('An administrator must authorize your comment before it is visible.'); 
    340342            case 'validate': 
    341               array_push($page['infos'], l10n('Your comment has been registered')); 
     343              $_SESSION['page_infos'][] = l10n('Your comment has been registered'); 
     344              $perform_redirect = true; 
    342345              break; 
    343346            case 'reject': 
    344               set_status_header(403); 
    345               array_push($page['errors'], l10n('Your comment has NOT been registered because it did not pass the validation rules')); 
     347              $_SESSION['page_errors'][] = l10n('Your comment has NOT been registered because it did not pass the validation rules'); 
     348              $perform_redirect = true; 
    346349              break; 
    347350            default: 
    348351              trigger_error('Invalid comment action '.$comment_action, E_USER_WARNING); 
    349352          } 
    350              
     353           
     354          if ($perform_redirect) 
     355          { 
     356            redirect($url_self); 
     357          } 
    351358          unset($_POST['content']); 
    352359          break;