Changeset 702 for trunk/forum/includes/functions_display.php
- Timestamp:
- Mar 31, 2010, 6:32:40 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/forum/includes/functions_display.php
r400 r702 3 3 * 4 4 * @package phpBB3 5 * @version $Id : functions_display.php 9082 2008-11-22 20:26:09Z acydburn$5 * @version $Id$ 6 6 * @copyright (c) 2005 phpBB Group 7 7 * @license http://opensource.org/licenses/gpl-license.php GNU Public License … … 103 103 $forum_tracking_info = array(); 104 104 $branch_root_id = $root_data['forum_id']; 105 106 // Check for unread global announcements (index page only) 107 $ga_unread = false; 108 if ($root_data['forum_id'] == 0) 109 { 110 $unread_ga_list = get_unread_topics($user->data['user_id'], 'AND t.forum_id = 0', '', 1); 111 112 if (!empty($unread_ga_list)) 113 { 114 $ga_unread = true; 115 } 116 } 117 105 118 while ($row = $db->sql_fetchrow($result)) 106 119 { … … 155 168 } 156 169 170 // Count the difference of real to public topics, so we can display an information to moderators 171 $row['forum_id_unapproved_topics'] = ($auth->acl_get('m_approve', $forum_id) && ($row['forum_topics_real'] != $row['forum_topics'])) ? $forum_id : 0; 157 172 $row['forum_topics'] = ($auth->acl_get('m_approve', $forum_id)) ? $row['forum_topics_real'] : $row['forum_topics']; 158 173 … … 211 226 { 212 227 $subforums[$parent_id][$row['parent_id']]['children'][] = $forum_id; 228 } 229 230 if (!$forum_rows[$parent_id]['forum_id_unapproved_topics'] && $row['forum_id_unapproved_topics']) 231 { 232 $forum_rows[$parent_id]['forum_id_unapproved_topics'] = $forum_id; 213 233 } 214 234 … … 238 258 if ($mark_read == 'forums' || $mark_read == 'all') 239 259 { 240 $redirect = build_url( 'mark', 'hash');260 $redirect = build_url(array('mark', 'hash')); 241 261 $token = request_var('hash', ''); 242 262 if (check_link_hash($token, 'global')) … … 249 269 else 250 270 { 271 // Add 0 to forums array to mark global announcements correctly 272 $forum_ids[] = 0; 251 273 markread('topics', $forum_ids); 252 274 $message = sprintf($user->lang['RETURN_FORUM'], '<a href="' . $redirect . '">', '</a>'); … … 300 322 301 323 $forum_unread = (isset($forum_tracking_info[$forum_id]) && $row['orig_forum_last_post_time'] > $forum_tracking_info[$forum_id]) ? true : false; 324 325 // Mark the first visible forum on index as unread if there's any unread global announcement 326 if ($ga_unread && !empty($forum_ids_moderator) && $forum_id == $forum_ids_moderator[0]) 327 { 328 $forum_unread = true; 329 } 302 330 303 331 $folder_image = $folder_alt = $l_subforums = ''; … … 429 457 'S_LIST_SUBFORUMS' => ($row['display_subforum_list']) ? true : false, 430 458 'S_SUBFORUMS' => (sizeof($subforums_list)) ? true : false, 459 'S_FEED_ENABLED' => ($config['feed_forum'] && !phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $row['forum_options'])) ? true : false, 431 460 432 461 'FORUM_ID' => $row['forum_id'], … … 452 481 'L_MODERATOR_STR' => $l_moderator, 453 482 483 'U_UNAPPROVED_TOPICS' => ($row['forum_id_unapproved_topics']) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=unapproved_topics&f=' . $row['forum_id_unapproved_topics']) : '', 454 484 'U_VIEWFORUM' => $u_viewforum, 455 485 'U_LAST_POSTER' => get_username_string('profile', $row['forum_last_poster_id'], $row['forum_last_poster_name'], $row['forum_last_poster_colour']), … … 474 504 'S_HAS_SUBFORUM' => ($visible_forums) ? true : false, 475 505 'L_SUBFORUM' => ($visible_forums == 1) ? $user->lang['SUBFORUM'] : $user->lang['SUBFORUMS'], 476 'LAST_POST_IMG' => $user->img('icon_topic_latest', 'VIEW_LATEST_POST')) 477 ); 506 'LAST_POST_IMG' => $user->img('icon_topic_latest', 'VIEW_LATEST_POST'), 507 'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', 'TOPICS_UNAPPROVED'), 508 )); 478 509 479 510 if ($return_moderators) … … 515 546 function generate_forum_nav(&$forum_data) 516 547 { 517 global $db, $user, $template, $auth ;548 global $db, $user, $template, $auth, $config; 518 549 global $phpEx, $phpbb_root_path; 519 550 … … 562 593 'FORUM_ID' => $forum_data['forum_id'], 563 594 'FORUM_NAME' => $forum_data['forum_name'], 564 'FORUM_DESC' => generate_text_for_display($forum_data['forum_desc'], $forum_data['forum_desc_uid'], $forum_data['forum_desc_bitfield'], $forum_data['forum_desc_options'])) 565 ); 595 'FORUM_DESC' => generate_text_for_display($forum_data['forum_desc'], $forum_data['forum_desc_uid'], $forum_data['forum_desc_bitfield'], $forum_data['forum_desc_options']), 596 597 'S_ENABLE_FEEDS_FORUM' => ($config['feed_forum'] && $forum_data['forum_type'] == FORUM_POST && !phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $forum_data['forum_options'])) ? true : false, 598 )); 566 599 567 600 return; … … 659 692 global $config, $template, $db, $phpbb_root_path, $phpEx, $user, $auth; 660 693 661 // Have we disabled the display of moderators? If so, then return 662 // from whence we came ... 663 if (!$config['load_moderators']) 664 { 665 return; 666 } 667 668 $forum_sql = ''; 694 $forum_id_ary = array(); 669 695 670 696 if ($forum_id !== false) … … 675 701 } 676 702 677 // If we don't have a forum then we can't have a moderator 678 if (!sizeof($forum_id)) 679 { 680 return; 681 } 682 683 $forum_sql = 'AND m.' . $db->sql_in_set('forum_id', $forum_id); 703 // Exchange key/value pair to be able to faster check for the forum id existence 704 $forum_id_ary = array_flip($forum_id); 684 705 } 685 706 … … 702 723 ), 703 724 704 'WHERE' => "m.display_on_index = 1 $forum_sql",725 'WHERE' => 'm.display_on_index = 1', 705 726 ); 706 727 728 // We query every forum here because for caching we should not have any parameter. 707 729 $sql = $db->sql_build_query('SELECT', $sql_array); 708 730 $result = $db->sql_query($sql, 3600); … … 710 732 while ($row = $db->sql_fetchrow($result)) 711 733 { 734 $f_id = (int) $row['forum_id']; 735 736 if (!isset($forum_id_ary[$f_id])) 737 { 738 continue; 739 } 740 712 741 if (!empty($row['user_id'])) 713 742 { 714 $forum_moderators[$ row['forum_id']][] = get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']);743 $forum_moderators[$f_id][] = get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']); 715 744 } 716 745 else … … 720 749 if ($user->data['user_id'] != ANONYMOUS && !$auth->acl_get('u_viewprofile')) 721 750 { 722 $forum_moderators[$ row['forum_id']][] = '<span' . (($row['group_colour']) ? ' style="color:#' . $row['group_colour'] . ';"' : '') . '>' . $group_name . '</span>';751 $forum_moderators[$f_id][] = '<span' . (($row['group_colour']) ? ' style="color:#' . $row['group_colour'] . ';"' : '') . '>' . $group_name . '</span>'; 723 752 } 724 753 else 725 754 { 726 $forum_moderators[$ row['forum_id']][] = '<a' . (($row['group_colour']) ? ' style="color:#' . $row['group_colour'] . ';"' : '') . ' href="' . append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&g=' . $row['group_id']) . '">' . $group_name . '</a>';755 $forum_moderators[$f_id][] = '<a' . (($row['group_colour']) ? ' style="color:#' . $row['group_colour'] . ';"' : '') . ' href="' . append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&g=' . $row['group_id']) . '">' . $group_name . '</a>'; 727 756 } 728 757 } … … 847 876 function display_custom_bbcodes() 848 877 { 849 global $db, $template ;878 global $db, $template, $user; 850 879 851 880 // Start counting from 22 for the bbcode ids (every bbcode takes two ids - opening/closing) … … 861 890 while ($row = $db->sql_fetchrow($result)) 862 891 { 892 // If the helpline is defined within the language file, we will use the localised version, else just use the database entry... 893 if (isset($user->lang[strtoupper($row['bbcode_helpline'])])) 894 { 895 $row['bbcode_helpline'] = $user->lang[strtoupper($row['bbcode_helpline'])]; 896 } 897 863 898 $template->assign_block_vars('custom_tags', array( 864 899 'BBCODE_NAME' => "'[{$row['bbcode_tag']}]', '[/" . str_replace('=', '', $row['bbcode_tag']) . "]'", … … 1195 1230 * @param string $avatar_height Height of users avatar 1196 1231 * @param string $alt Optional language string for alt tag within image, can be a language key or text 1232 * @param bool $ignore_config Ignores the config-setting, to be still able to view the avatar in the UCP 1197 1233 * 1198 1234 * @return string Avatar image 1199 1235 */ 1200 function get_user_avatar($avatar, $avatar_type, $avatar_width, $avatar_height, $alt = 'USER_AVATAR' )1236 function get_user_avatar($avatar, $avatar_type, $avatar_width, $avatar_height, $alt = 'USER_AVATAR', $ignore_config = false) 1201 1237 { 1202 1238 global $user, $config, $phpbb_root_path, $phpEx; 1203 1239 1204 if (empty($avatar) || !$avatar_type )1240 if (empty($avatar) || !$avatar_type || (!$config['allow_avatar'] && !$ignore_config)) 1205 1241 { 1206 1242 return ''; … … 1212 1248 { 1213 1249 case AVATAR_UPLOAD: 1250 if (!$config['allow_avatar_upload'] && !$ignore_config) 1251 { 1252 return ''; 1253 } 1214 1254 $avatar_img = $phpbb_root_path . "download/file.$phpEx?avatar="; 1215 1255 break; 1216 1256 1217 1257 case AVATAR_GALLERY: 1258 if (!$config['allow_avatar_local'] && !$ignore_config) 1259 { 1260 return ''; 1261 } 1218 1262 $avatar_img = $phpbb_root_path . $config['avatar_gallery_path'] . '/'; 1219 1263 break; 1264 1265 case AVATAR_REMOTE: 1266 if (!$config['allow_avatar_remote'] && !$ignore_config) 1267 { 1268 return ''; 1269 } 1270 break; 1220 1271 } 1221 1272
Note:
See TracChangeset
for help on using the changeset viewer.