Changeset 3600


Ignore:
Timestamp:
07/16/09 07:20:34 (11 years ago)
Author:
rvelices
Message:
  • fix php warning from comment_list.tpl
  • author name is saved always in #comments (even for registered users) so that
    • sql queries are simpler on the comments page (one less table in a big join)
    • when a user is deleted, we can keep the username in the #comments (there might be still a bug that author_id is not updated when a user is deleted)
Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/comments.php

    r3520 r3600  
    8888  $page['items_number'] = $_GET['items_number']; 
    8989} 
    90 if ( !is_numeric($page['items_number']) and $page['items_number']!='all' )  
     90if ( !is_numeric($page['items_number']) and $page['items_number']!='all' ) 
    9191{ 
    9292  $page['items_number'] = 10; 
     
    272272    INNER JOIN '.COMMENTS_TABLE.' AS com 
    273273    ON ic.image_id = com.image_id 
    274     LEFT JOIN '.USERS_TABLE.' As u 
    275     ON u.'.$conf['user_fields']['id'].' = com.author_id 
    276274  WHERE '.implode(' 
    277275    AND ', $page['where_clauses']).' 
     
    305303     , com.author 
    306304     , com.author_id 
    307      , '.$conf['user_fields']['username'].' AS username 
    308305     , com.date 
    309306     , com.content 
     
    312309    INNER JOIN '.COMMENTS_TABLE.' AS com 
    313310    ON ic.image_id = com.image_id 
    314     LEFT JOIN '.USERS_TABLE.' AS u 
    315     ON u.'.$conf['user_fields']['id'].' = com.author_id 
    316311  WHERE '.implode(' 
    317312    AND ', $page['where_clauses']).' 
     
    379374          ); 
    380375 
    381     if (!empty($comment['author'])) 
    382     { 
    383       $author = $comment['author']; 
    384       if ($author == 'guest') 
    385       { 
    386         $author = l10n('guest'); 
    387       } 
    388     } 
    389     else 
    390     { 
    391       $author = $comment['username']; 
    392     } 
    393  
    394376    $tpl_comment = 
    395377      array( 
     
    397379        'TN_SRC' => $thumbnail_src, 
    398380        'ALT' => $name, 
    399         'AUTHOR' => trigger_event('render_comment_author', $author), 
     381        'AUTHOR' => trigger_event('render_comment_author', $comment['author']), 
    400382        'DATE'=>format_date($comment['date'], true), 
    401383        'CONTENT'=>trigger_event('render_comment_content',$comment['content']), 
  • trunk/include/functions_comment.inc.php

    r3489 r3600  
    111111  else 
    112112  { 
    113     $comm['author'] = ''; 
     113    $comm['author'] = addslashes($user['username']); 
    114114    $comm['author_id'] = $user['id']; 
    115115  } 
     
    172172 
    173173    if (($comment_action=='validate' and $conf['email_admin_on_comment']) or 
    174         ($comment_action!='validate' 
    175          and $conf['email_admin_on_comment_validation'])) 
     174        ($comment_action!='validate' and $conf['email_admin_on_comment_validation'])) 
    176175    { 
    177176      include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php'); 
     
    179178      $del_url = get_absolute_root_url().'comments.php?delete='.$comm['id']; 
    180179 
    181       if (empty($comm['author'])) 
    182       { 
    183         $author_name = $user['username']; 
    184       } 
    185       else 
    186       { 
    187         $author_name = stripslashes($comm['author']); 
    188       } 
    189180      $keyargs_content = array 
    190181      ( 
    191         get_l10n_args('Author: %s', $author_name), 
     182        get_l10n_args('Author: %s', stripslashes($comm['author']) ), 
    192183        get_l10n_args('Comment: %s', stripslashes($comm['content']) ), 
    193184        get_l10n_args('', ''), 
     
    206197      pwg_mail_notification_admins 
    207198      ( 
    208         get_l10n_args('Comment by %s', $author_name), 
     199        get_l10n_args('Comment by %s', stripslashes($comm['author']) ), 
    209200        $keyargs_content 
    210201      ); 
  • trunk/template/yoga/comment_list.tpl

    r3487 r3600  
    1111    </div> 
    1212    {/if} 
    13     <div class="description" style="height:{if ($comment.IN_EDIT==1)}200{/if}px"> 
     13    <div class="description" style="height:{if isset($comment.IN_EDIT)}200{/if}px"> 
    1414      {if isset($comment.U_DELETE) or isset($comment.U_VALIDATE) or isset($comment.U_EDIT) } 
    1515      <ul class="actions" style="float:right"> 
     
    2121        </li> 
    2222        {/if} 
    23         {if isset($comment.U_EDIT) and ($comment.IN_EDIT!=1)} 
     23        {if isset($comment.U_EDIT) and !isset($comment.IN_EDIT)} 
    2424        <li> 
    2525          <a class="editComment" href="{$comment.U_EDIT}#edit_comment" title="{'edit this comment'|@translate}"> 
     
    3838      {/if} 
    3939      <span class="author">{$comment.AUTHOR}</span> - <span class="date">{$comment.DATE}</span> 
    40       {if ($comment.IN_EDIT==1)} 
     40      {if isset($comment.IN_EDIT)} 
    4141      <a name="edit_comment"></a> 
    4242      <form  method="post" action="{$comment.U_EDIT}" class="filter" id="editComment"> 
Note: See TracChangeset for help on using the changeset viewer.