@@ -13,8 +13,9 @@ discard block |
||
13 | 13 | * @version 2.1 Beta 4 |
14 | 14 | */ |
15 | 15 | |
16 | -if (!defined('SMF')) |
|
16 | +if (!defined('SMF')) { |
|
17 | 17 | die('No direct access...'); |
18 | +} |
|
18 | 19 | |
19 | 20 | /** |
20 | 21 | * Retrieve a list and several other statistics of the users currently online. |
@@ -45,8 +46,9 @@ discard block |
||
45 | 46 | } |
46 | 47 | |
47 | 48 | // Not allowed sort method? Bang! Error! |
48 | - elseif (!in_array($membersOnlineOptions['sort'], $allowed_sort_options)) |
|
49 | - trigger_error('Sort method for getMembersOnlineStats() function is not allowed', E_USER_NOTICE); |
|
49 | + elseif (!in_array($membersOnlineOptions['sort'], $allowed_sort_options)) { |
|
50 | + trigger_error('Sort method for getMembersOnlineStats() function is not allowed', E_USER_NOTICE); |
|
51 | + } |
|
50 | 52 | |
51 | 53 | // Initialize the array that'll be returned later on. |
52 | 54 | $membersOnlineStats = array( |
@@ -63,8 +65,9 @@ discard block |
||
63 | 65 | // Get any spiders if enabled. |
64 | 66 | $spiders = array(); |
65 | 67 | $spider_finds = array(); |
66 | - if (!empty($modSettings['show_spider_online']) && ($modSettings['show_spider_online'] < 3 || allowedTo('admin_forum')) && !empty($modSettings['spider_name_cache'])) |
|
67 | - $spiders = $smcFunc['json_decode']($modSettings['spider_name_cache'], true); |
|
68 | + if (!empty($modSettings['show_spider_online']) && ($modSettings['show_spider_online'] < 3 || allowedTo('admin_forum')) && !empty($modSettings['spider_name_cache'])) { |
|
69 | + $spiders = $smcFunc['json_decode']($modSettings['spider_name_cache'], true); |
|
70 | + } |
|
68 | 71 | |
69 | 72 | // Load the users online right now. |
70 | 73 | $request = $smcFunc['db_query']('', ' |
@@ -92,9 +95,7 @@ discard block |
||
92 | 95 | $membersOnlineStats['num_guests']++; |
93 | 96 | |
94 | 97 | continue; |
95 | - } |
|
96 | - |
|
97 | - elseif (empty($row['show_online']) && empty($membersOnlineOptions['show_hidden'])) |
|
98 | + } elseif (empty($row['show_online']) && empty($membersOnlineOptions['show_hidden'])) |
|
98 | 99 | { |
99 | 100 | // Just increase the stats and don't add this hidden user to any list. |
100 | 101 | $membersOnlineStats['num_users_hidden']++; |
@@ -102,10 +103,11 @@ discard block |
||
102 | 103 | } |
103 | 104 | |
104 | 105 | // Some basic color coding... |
105 | - if (!empty($row['online_color'])) |
|
106 | - $link = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '" style="color: ' . $row['online_color'] . ';">' . $row['real_name'] . '</a>'; |
|
107 | - else |
|
108 | - $link = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['real_name'] . '</a>'; |
|
106 | + if (!empty($row['online_color'])) { |
|
107 | + $link = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '" style="color: ' . $row['online_color'] . ';">' . $row['real_name'] . '</a>'; |
|
108 | + } else { |
|
109 | + $link = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['real_name'] . '</a>'; |
|
110 | + } |
|
109 | 111 | |
110 | 112 | // Buddies get counted and highlighted. |
111 | 113 | $is_buddy = in_array($row['id_member'], $user_info['buddies']); |
@@ -132,8 +134,8 @@ discard block |
||
132 | 134 | $membersOnlineStats['list_users_online'][$row[$membersOnlineOptions['sort']] . '_' . $row['member_name']] = empty($row['show_online']) ? '<em>' . $link . '</em>' : $link; |
133 | 135 | |
134 | 136 | // Store all distinct (primary) membergroups that are shown. |
135 | - if (!isset($membersOnlineStats['online_groups'][$row['id_group']])) |
|
136 | - $membersOnlineStats['online_groups'][$row['id_group']] = array( |
|
137 | + if (!isset($membersOnlineStats['online_groups'][$row['id_group']])) { |
|
138 | + $membersOnlineStats['online_groups'][$row['id_group']] = array( |
|
137 | 139 | 'id' => $row['id_group'], |
138 | 140 | 'name' => $row['group_name'], |
139 | 141 | 'color' => $row['online_color'], |
@@ -141,6 +143,7 @@ discard block |
||
141 | 143 | 'type' => $row['group_type'], |
142 | 144 | 'parent' => $row['id_parent'], |
143 | 145 | ); |
146 | + } |
|
144 | 147 | } |
145 | 148 | $smcFunc['db_free_result']($request); |
146 | 149 | |
@@ -201,11 +204,12 @@ discard block |
||
201 | 204 | $settingsToUpdate = array(); |
202 | 205 | |
203 | 206 | // More members on now than ever were? Update it! |
204 | - if (!isset($modSettings['mostOnline']) || $total_users_online >= $modSettings['mostOnline']) |
|
205 | - $settingsToUpdate = array( |
|
207 | + if (!isset($modSettings['mostOnline']) || $total_users_online >= $modSettings['mostOnline']) { |
|
208 | + $settingsToUpdate = array( |
|
206 | 209 | 'mostOnline' => $total_users_online, |
207 | 210 | 'mostDate' => time() |
208 | 211 | ); |
212 | + } |
|
209 | 213 | |
210 | 214 | $date = strftime('%Y-%m-%d', forum_time(false)); |
211 | 215 | |
@@ -237,8 +241,9 @@ discard block |
||
237 | 241 | { |
238 | 242 | list ($modSettings['mostOnlineToday']) = $smcFunc['db_fetch_row']($request); |
239 | 243 | |
240 | - if ($total_users_online > $modSettings['mostOnlineToday']) |
|
241 | - trackStats(array('most_on' => $total_users_online)); |
|
244 | + if ($total_users_online > $modSettings['mostOnlineToday']) { |
|
245 | + trackStats(array('most_on' => $total_users_online)); |
|
246 | + } |
|
242 | 247 | |
243 | 248 | $total_users_online = max($total_users_online, $modSettings['mostOnlineToday']); |
244 | 249 | } |
@@ -255,8 +260,9 @@ discard block |
||
255 | 260 | $settingsToUpdate['mostOnlineToday'] = $total_users_online; |
256 | 261 | } |
257 | 262 | |
258 | - if (!empty($settingsToUpdate)) |
|
259 | - updateSettings($settingsToUpdate); |
|
260 | -} |
|
263 | + if (!empty($settingsToUpdate)) { |
|
264 | + updateSettings($settingsToUpdate); |
|
265 | + } |
|
266 | + } |
|
261 | 267 | |
262 | 268 | ?> |
263 | 269 | \ No newline at end of file |