includes/pageutils.php
changeset 328 dc838fd61a06
parent 326 ab66d6d1f1f4
child 334 c72b545f1304
equal deleted inserted replaced
327:c2f4c900c507 328:dc838fd61a06
  1003     $db->free_result();
  1003     $db->free_result();
  1004     $e = $db->sql_query('SELECT * FROM ' . table_prefix.'comments WHERE page_id=\'' . $page_id . '\' AND namespace=\'' . $namespace . '\' AND approved=1;');
  1004     $e = $db->sql_query('SELECT * FROM ' . table_prefix.'comments WHERE page_id=\'' . $page_id . '\' AND namespace=\'' . $namespace . '\' AND approved=1;');
  1005     if(!$e) $db->_die('The comment text data could not be selected.');
  1005     if(!$e) $db->_die('The comment text data could not be selected.');
  1006     $num_app = $db->numrows();
  1006     $num_app = $db->numrows();
  1007     $db->free_result();
  1007     $db->free_result();
  1008     $lq = $db->sql_query('SELECT c.comment_id,c.subject,c.name,c.comment_data,c.approved,c.time,c.user_id,u.user_level,u.signature
  1008     $lq = $db->sql_query('SELECT c.comment_id,c.subject,c.name,c.comment_data,c.approved,c.time,c.user_id,u.user_level,u.signature,u.user_has_avatar,u.avatar_type
  1009                   FROM ' . table_prefix.'comments AS c
  1009                   FROM ' . table_prefix.'comments AS c
  1010                   LEFT JOIN ' . table_prefix.'users AS u
  1010                   LEFT JOIN ' . table_prefix.'users AS u
  1011                     ON c.user_id=u.user_id
  1011                     ON c.user_id=u.user_id
  1012                   WHERE page_id=\'' . $page_id . '\'
  1012                   WHERE page_id=\'' . $page_id . '\'
  1013                   AND namespace=\'' . $namespace . '\' ORDER BY c.time ASC;');
  1013                   AND namespace=\'' . $namespace . '\' ORDER BY c.time ASC;');
  1120         $strings['MOD_DELETE_LINK'] = '<a href="'.makeUrlNS($namespace, $page_id, 'do=comments&amp;sub=admin&amp;action=delete&amp;id=' . $row['comment_id']) . '">' . $lang->get('comment_btn_mod_delete') . '</a>';
  1120         $strings['MOD_DELETE_LINK'] = '<a href="'.makeUrlNS($namespace, $page_id, 'do=comments&amp;sub=admin&amp;action=delete&amp;id=' . $row['comment_id']) . '">' . $lang->get('comment_btn_mod_delete') . '</a>';
  1121         
  1121         
  1122         // Signature
  1122         // Signature
  1123         $strings['SIGNATURE'] = '';
  1123         $strings['SIGNATURE'] = '';
  1124         if($row['signature'] != '') $strings['SIGNATURE'] = RenderMan::render($row['signature']);
  1124         if($row['signature'] != '') $strings['SIGNATURE'] = RenderMan::render($row['signature']);
       
  1125         
       
  1126         // Avatar
       
  1127         if ( $row['user_has_avatar'] == 1 )
       
  1128         {
       
  1129           $bool['user_has_avatar'] = true;
       
  1130           $strings['AVATAR_ALT'] = $lang->get('usercp_avatar_image_alt', array('username' => $row['name']));
       
  1131           $strings['AVATAR_URL'] = make_avatar_url(intval($row['user_id']), $row['avatar_type']);
       
  1132           $strings['USERPAGE_LINK'] = makeUrlNS('User', $row['name']);
       
  1133         }
  1125         
  1134         
  1126         $bool['auth_mod'] = ($session->get_permissions('mod_comments')) ? true : false;
  1135         $bool['auth_mod'] = ($session->get_permissions('mod_comments')) ? true : false;
  1127         $bool['can_edit'] = ( ( $session->user_logged_in && $row['name'] == $session->username && $session->get_permissions('edit_comments') ) || $session->get_permissions('mod_comments') ) ? true : false;
  1136         $bool['can_edit'] = ( ( $session->user_logged_in && $row['name'] == $session->username && $session->get_permissions('edit_comments') ) || $session->get_permissions('mod_comments') ) ? true : false;
  1128         $bool['signature'] = ( $strings['SIGNATURE'] == '' ) ? false : true;
  1137         $bool['signature'] = ( $strings['SIGNATURE'] == '' ) ? false : true;
  1129         
  1138