Completed
Push — trunk ( 56d310...72cafa )
by SuperNova.WS
04:23
created
includes/pages/chat.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
   $user_auth_level = isset($user['authlevel']) ? $user['authlevel'] : AUTH_LEVEL_ANONYMOUS;
15 15
 
16 16
   $mode = sys_get_param_int('mode');
17
-  switch($mode)
17
+  switch ($mode)
18 18
   {
19 19
     case CHAT_MODE_ALLY:
20 20
       $template_result['ALLY'] = intval($user['ally_id']);
@@ -28,12 +28,12 @@  discard block
 block discarded – undo
28 28
   }
29 29
 
30 30
   $template_result['.']['smiles'] = array();
31
-  foreach(classSupernova::$gc->design->getSmilesList() as $auth_level => $replaces) {
32
-    if($auth_level > $user_auth_level) {
31
+  foreach (classSupernova::$gc->design->getSmilesList() as $auth_level => $replaces) {
32
+    if ($auth_level > $user_auth_level) {
33 33
       continue;
34 34
     }
35 35
 
36
-    foreach($replaces as $bbcode => $filename)
36
+    foreach ($replaces as $bbcode => $filename)
37 37
     {
38 38
       $template_result['.']['smiles'][] = array(
39 39
         'BBCODE' => $bbcode,
@@ -57,12 +57,12 @@  discard block
 block discarded – undo
57 57
 
58 58
   define('IN_AJAX', true);
59 59
 
60
-  if($config->getMode() != classCache::CACHER_NO_CACHE && $config->chat_timeout && SN_TIME_MICRO - $config->array_get('users', $user['id'], 'chat_last_activity') > $config->chat_timeout)
60
+  if ($config->getMode() != classCache::CACHER_NO_CACHE && $config->chat_timeout && SN_TIME_MICRO - $config->array_get('users', $user['id'], 'chat_last_activity') > $config->chat_timeout)
61 61
   {
62 62
     die();
63 63
   }
64 64
 
65
-  if(($message = sys_get_param_str('message')) && $user['username'])
65
+  if (($message = sys_get_param_str('message')) && $user['username'])
66 66
   {
67 67
     $ally_id = sys_get_param('ally') && $user['ally_id'] ? $user['ally_id'] : 0;
68 68
     $nick = db_escape(player_nick_compact(player_nick_render_current_to_array($user, array('color' => true, 'icons' => true, 'ally' => !$ally_id))));
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
   define('IN_AJAX', true);
88 88
 
89 89
   $history = sys_get_param_str('history');
90
-  if(!$history)
90
+  if (!$history)
91 91
   {
92 92
     $config->array_set('users', $user['id'], 'chat_last_refresh', SN_TIME_MICRO);
93 93
   }
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
   $last_message = '';
97 97
   $alliance = 0;
98 98
   $template_result['.']['chat'] = array();
99
-  if(!$history && $config->getMode() != classCache::CACHER_NO_CACHE && $config->chat_timeout && SN_TIME_MICRO - $config->array_get('users', $user['id'], 'chat_last_activity') > $config->chat_timeout)
99
+  if (!$history && $config->getMode() != classCache::CACHER_NO_CACHE && $config->chat_timeout && SN_TIME_MICRO - $config->array_get('users', $user['id'], 'chat_last_activity') > $config->chat_timeout)
100 100
   {
101 101
     $result['disable'] = true;
102 102
     $template_result['.']['chat'][] = array(
@@ -112,12 +112,12 @@  discard block
 block discarded – undo
112 112
 
113 113
     $where_add = '';
114 114
     $last_message = 0;
115
-    if($history)
115
+    if ($history)
116 116
     {
117 117
       $rows = doquery("SELECT count(1) AS CNT FROM {{chat}} WHERE ally_id = '{$alliance}';", true);
118 118
       $page_count = ceil($rows['CNT'] / $page_limit);
119 119
 
120
-      for($i = 0; $i < $page_count; $i++)
120
+      for ($i = 0; $i < $page_count; $i++)
121 121
       {
122 122
         $template_result['.']['page'][] = array(
123 123
           'NUMBER' => $i
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
         {{chat}} AS c
140 140
         LEFT JOIN {{users}} AS u ON u.id = c.chat_message_sender_id
141 141
       WHERE c.chat_message_recipient_id IS NULL AND c.ally_id = '{$alliance}' {$where_add} ORDER BY messageid DESC LIMIT {$start_row}, {$page_limit};");
142
-    while($chat_row = db_fetch($query))
142
+    while ($chat_row = db_fetch($query))
143 143
     {
144 144
       // Little magik here - to retain HTML codes from DB and stripping HTML codes from nick
145 145
       $chat_row['user'] = player_nick_render_to_html($chat_row['user']);
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
   $template = gettemplate('chat_messages', $template);
169 169
   $template->assign_recursive($template_result);
170 170
 
171
-  if($history)
171
+  if ($history)
172 172
   {
173 173
     $pageTitle = "{$lang['chat_history']} - {$lang[$alliance ? 'chat_ally' : 'chat_common']}";
174 174
     display($template, $pageTitle);
Please login to merge, or discard this patch.