includes/pageutils.php
changeset 621 68f8a9cc0a18
parent 609 ffa5decbb305
child 679 80bf9b8fe6aa
equal deleted inserted replaced
620:58852672ff12 621:68f8a9cc0a18
   639     $db->free_result();
   639     $db->free_result();
   640     $e = $db->sql_query('SELECT * FROM ' . table_prefix.'comments WHERE page_id=\'' . $page_id . '\' AND namespace=\'' . $namespace . '\' AND approved=1;');
   640     $e = $db->sql_query('SELECT * FROM ' . table_prefix.'comments WHERE page_id=\'' . $page_id . '\' AND namespace=\'' . $namespace . '\' AND approved=1;');
   641     if(!$e) $db->_die('The comment text data could not be selected.');
   641     if(!$e) $db->_die('The comment text data could not be selected.');
   642     $num_app = $db->numrows();
   642     $num_app = $db->numrows();
   643     $db->free_result();
   643     $db->free_result();
   644     $lq = $db->sql_query('SELECT c.comment_id,c.subject,c.name,c.comment_data,c.approved,c.time,c.user_id,c.ip_address,u.user_level,u.signature,u.user_has_avatar,u.avatar_type
   644     $lq = $db->sql_query('SELECT c.comment_id,c.subject,c.name,c.comment_data,c.approved,c.time,c.user_id,c.ip_address,u.user_level,u.email,u.signature,u.user_has_avatar,u.avatar_type
   645                   FROM ' . table_prefix.'comments AS c
   645                   FROM ' . table_prefix.'comments AS c
   646                   LEFT JOIN ' . table_prefix.'users AS u
   646                   LEFT JOIN ' . table_prefix.'users AS u
   647                     ON c.user_id=u.user_id
   647                     ON c.user_id=u.user_id
   648                   WHERE page_id=\'' . $page_id . '\'
   648                   WHERE page_id=\'' . $page_id . '\'
   649                   AND namespace=\'' . $namespace . '\' ORDER BY c.time ASC;');
   649                   AND namespace=\'' . $namespace . '\' ORDER BY c.time ASC;');
   763         // Avatar
   763         // Avatar
   764         if ( $row['user_has_avatar'] == 1 )
   764         if ( $row['user_has_avatar'] == 1 )
   765         {
   765         {
   766           $bool['user_has_avatar'] = true;
   766           $bool['user_has_avatar'] = true;
   767           $strings['AVATAR_ALT'] = $lang->get('usercp_avatar_image_alt', array('username' => $row['name']));
   767           $strings['AVATAR_ALT'] = $lang->get('usercp_avatar_image_alt', array('username' => $row['name']));
   768           $strings['AVATAR_URL'] = make_avatar_url(intval($row['user_id']), $row['avatar_type']);
   768           $strings['AVATAR_URL'] = make_avatar_url(intval($row['user_id']), $row['avatar_type'], $row['email']);
   769           $strings['USERPAGE_LINK'] = makeUrlNS('User', $row['name']);
   769           $strings['USERPAGE_LINK'] = makeUrlNS('User', $row['name']);
   770         }
   770         }
   771         
   771         
   772         $bool['auth_mod'] = ($session->get_permissions('mod_comments')) ? true : false;
   772         $bool['auth_mod'] = ($session->get_permissions('mod_comments')) ? true : false;
   773         $bool['can_edit'] = ( ( $session->user_logged_in && $row['name'] == $session->username && $session->get_permissions('edit_comments') ) || $session->get_permissions('mod_comments') ) ? true : false;
   773         $bool['can_edit'] = ( ( $session->user_logged_in && $row['name'] == $session->username && $session->get_permissions('edit_comments') ) || $session->get_permissions('mod_comments') ) ? true : false;