@@ -167,7 +167,7 @@ |
||
| 167 | 167 | // $logRecord->browserId . '_' . |
| 168 | 168 | // $logRecord->ip . '_' . |
| 169 | 169 | // $logRecord->proxies; |
| 170 | - return $logRecord->userId . '_' . $logRecord->playerEntryId; |
|
| 170 | + return $logRecord->userId . '_' . $logRecord->playerEntryId; |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | /** |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | protected static $is_init = false; |
| 22 | 22 | |
| 23 | 23 | protected static function init() { |
| 24 | - if(!empty(static::$db)) { |
|
| 24 | + if (!empty(static::$db)) { |
|
| 25 | 25 | return; |
| 26 | 26 | } |
| 27 | 27 | static::$db = SN::$db; |
@@ -68,14 +68,14 @@ discard block |
||
| 68 | 68 | $provider_id_safe = intval($provider_id_unsafe); |
| 69 | 69 | !is_array($account_list) ? $account_list = array($account_list) : false; |
| 70 | 70 | |
| 71 | - foreach($account_list as $provider_account_id_unsafe) { |
|
| 71 | + foreach ($account_list as $provider_account_id_unsafe) { |
|
| 72 | 72 | $provider_account_id_safe = intval($provider_account_id_unsafe); |
| 73 | 73 | |
| 74 | 74 | // TODO - Здесь могут отсутствовать аккаунты - проверять провайдером |
| 75 | 75 | $query = static::$db->doquery( |
| 76 | 76 | "SELECT `user_id` FROM {{account_translate}} WHERE `provider_id` = {$provider_id_safe} AND `provider_account_id` = {$provider_account_id_safe} FOR UPDATE" |
| 77 | 77 | ); |
| 78 | - while($row = static::$db->db_fetch($query)) { |
|
| 78 | + while ($row = static::$db->db_fetch($query)) { |
|
| 79 | 79 | $account_translation[$row['user_id']][$provider_id_unsafe][$provider_account_id_unsafe] = true; |
| 80 | 80 | } |
| 81 | 81 | } |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | ($provider_id_unsafe ? "AND `provider_id` = {$provider_id_safe} " : '') . |
| 103 | 103 | "ORDER BY `timestamp` FOR UPDATE" |
| 104 | 104 | ); |
| 105 | - while($row = static::$db->db_fetch($query)) { |
|
| 105 | + while ($row = static::$db->db_fetch($query)) { |
|
| 106 | 106 | $account_translation[$row['user_id']][$row['provider_id']][$row['provider_account_id']] = $row; |
| 107 | 107 | } |
| 108 | 108 | |
@@ -53,7 +53,7 @@ |
||
| 53 | 53 | $query = $this->db->doQueryAndFetch( |
| 54 | 54 | "SELECT `id` FROM {{confirmations}} WHERE `code` = '{$confirm_code_safe}' FOR UPDATE" |
| 55 | 55 | ); |
| 56 | - } while($query); |
|
| 56 | + } while ($query); |
|
| 57 | 57 | |
| 58 | 58 | $this->db->doquery( |
| 59 | 59 | "REPLACE INTO {{confirmations}} |
@@ -173,9 +173,9 @@ |
||
| 173 | 173 | */ |
| 174 | 174 | public function isChanged() { |
| 175 | 175 | return |
| 176 | - ! empty($this->_changes) |
|
| 176 | + !empty($this->_changes) |
|
| 177 | 177 | || |
| 178 | - ! empty($this->_deltas); |
|
| 178 | + !empty($this->_deltas); |
|
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | public function getChanges() { |
@@ -656,7 +656,7 @@ discard block |
||
| 656 | 656 | } |
| 657 | 657 | |
| 658 | 658 | $invitedUserRecord = db_user_by_id($inv); |
| 659 | - if(!empty($invitedUserRecord)) { |
|
| 659 | + if (!empty($invitedUserRecord)) { |
|
| 660 | 660 | $acsPoints += $invitedUserRecord['total_points']; |
| 661 | 661 | } |
| 662 | 662 | } |
@@ -671,7 +671,7 @@ discard block |
||
| 671 | 671 | } |
| 672 | 672 | |
| 673 | 673 | |
| 674 | - if(self::acsIsAcsFull($aks['id'])) { |
|
| 674 | + if (self::acsIsAcsFull($aks['id'])) { |
|
| 675 | 675 | throw new Exception(SN::$lang['fl_aks_too_power']); |
| 676 | 676 | } |
| 677 | 677 | |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | $this->sql_index_field = "{$table_name}_name"; |
| 41 | 41 | $this->sql_value_field = "{$table_name}_value"; |
| 42 | 42 | |
| 43 | - if(!$this->_DB_LOADED) { |
|
| 43 | + if (!$this->_DB_LOADED) { |
|
| 44 | 44 | $this->db_loadAll(); |
| 45 | 45 | } |
| 46 | 46 | } |
@@ -60,10 +60,10 @@ discard block |
||
| 60 | 60 | */ |
| 61 | 61 | public function db_loadItem($index) { |
| 62 | 62 | $result = null; |
| 63 | - if($index) { |
|
| 63 | + if ($index) { |
|
| 64 | 64 | $index_safe = db_escape($index); |
| 65 | 65 | $queryResult = doquery("SELECT `{$this->sql_value_field}` FROM `{{{$this->table_name}}}` WHERE `{$this->sql_index_field}` = '{$index_safe}' FOR UPDATE", true); |
| 66 | - if(is_array($queryResult) && !empty($queryResult)) { |
|
| 66 | + if (is_array($queryResult) && !empty($queryResult)) { |
|
| 67 | 67 | $this->$index = $result = $queryResult[$this->sql_value_field]; |
| 68 | 68 | } |
| 69 | 69 | } |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | $this->loadDefaults(); |
| 76 | 76 | |
| 77 | 77 | $query = doquery("SELECT * FROM {{{$this->table_name}}} FOR UPDATE;"); |
| 78 | - while($row = db_fetch($query)) { |
|
| 78 | + while ($row = db_fetch($query)) { |
|
| 79 | 79 | $this[$row[$this->sql_index_field]] = $row[$this->sql_value_field]; |
| 80 | 80 | } |
| 81 | 81 | |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | public function loadDefaults() { |
| 86 | - foreach($this->defaults as $defName => $defValue) { |
|
| 86 | + foreach ($this->defaults as $defName => $defValue) { |
|
| 87 | 87 | $this->$defName = $defValue; |
| 88 | 88 | } |
| 89 | 89 | } |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | public function db_saveItem($item_list, $value = NULL) { |
| 96 | - if(empty($item_list)) { |
|
| 96 | + if (empty($item_list)) { |
|
| 97 | 97 | return; |
| 98 | 98 | } |
| 99 | 99 | |
@@ -101,8 +101,8 @@ discard block |
||
| 101 | 101 | |
| 102 | 102 | // Сначала записываем данные в базу - что бы поймать все блокировки |
| 103 | 103 | $qry = array(); |
| 104 | - foreach($item_list as $item_name => $item_value) { |
|
| 105 | - if($item_name) { |
|
| 104 | + foreach ($item_list as $item_name => $item_value) { |
|
| 105 | + if ($item_name) { |
|
| 106 | 106 | $item_value = db_escape($item_value === NULL ? $this->$item_name : $item_value); |
| 107 | 107 | $item_name = db_escape($item_name); |
| 108 | 108 | $qry[] = "('{$item_name}', '{$item_value}')"; |
@@ -111,8 +111,8 @@ discard block |
||
| 111 | 111 | doquery("REPLACE INTO `{{" . $this->table_name . "}}` (`{$this->sql_index_field}`, `{$this->sql_value_field}`) VALUES " . implode(',', $qry) . ";"); |
| 112 | 112 | |
| 113 | 113 | // И только после взятия блокировок - меняем значения в кэше |
| 114 | - foreach($item_list as $item_name => $item_value) { |
|
| 115 | - if($item_name && $item_value !== null) { |
|
| 114 | + foreach ($item_list as $item_name => $item_value) { |
|
| 115 | + if ($item_name && $item_value !== null) { |
|
| 116 | 116 | $this->__set($item_name, $item_value); |
| 117 | 117 | } |
| 118 | 118 | } |
@@ -140,14 +140,14 @@ discard block |
||
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | public function __get($name) { |
| 143 | - if($this->force) { |
|
| 143 | + if ($this->force) { |
|
| 144 | 144 | $this->force = false; |
| 145 | 145 | $value = $this->db_loadItem($name); |
| 146 | 146 | } else { |
| 147 | 147 | $value = parent::__get($name); |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | - if(isset($this->notEmptyFields[$name]) && empty($value) && isset($this->defaults[$name])) { |
|
| 150 | + if (isset($this->notEmptyFields[$name]) && empty($value) && isset($this->defaults[$name])) { |
|
| 151 | 151 | $value = $this->defaults[$name]; |
| 152 | 152 | } |
| 153 | 153 | |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | public function __set($name, $value) { |
| 158 | - if($this->force) { |
|
| 158 | + if ($this->force) { |
|
| 159 | 159 | $this->force = false; |
| 160 | 160 | $this->db_saveItem($name, $value); |
| 161 | 161 | } |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | |
| 225 | 225 | set_error_handler([$this, 'handlerQueryWarning']); |
| 226 | 226 | $sqlquery = $this->db_sql_query($sql); |
| 227 | - if(!$sqlquery) { |
|
| 227 | + if (!$sqlquery) { |
|
| 228 | 228 | $debug->error(db_error() . "<br />$sql<br />", 'SQL Error'); |
| 229 | 229 | } |
| 230 | 230 | restore_error_handler(); |
@@ -396,7 +396,7 @@ discard block |
||
| 396 | 396 | $q1 = $this->db_sql_query("SHOW INDEX FROM {$prefixedTableName_safe};"); |
| 397 | 397 | while ($r1 = db_fetch($q1)) { |
| 398 | 398 | $indexName = $r1['Key_name']; |
| 399 | - if(empty($result[$indexName])) { |
|
| 399 | + if (empty($result[$indexName])) { |
|
| 400 | 400 | $result[$indexName] = new DbIndexDescription(); |
| 401 | 401 | } |
| 402 | 402 | $result[$indexName]->addField($r1); |
@@ -65,7 +65,7 @@ |
||
| 65 | 65 | |
| 66 | 66 | protected function sort() { |
| 67 | 67 | if (!$this->sorted) { |
| 68 | - asort($this->fields, function (DbIndexField $a, DbIndexField $b) { |
|
| 68 | + asort($this->fields, function(DbIndexField $a, DbIndexField $b) { |
|
| 69 | 69 | return $a->Seq_in_index - $b->Seq_in_index; |
| 70 | 70 | }); |
| 71 | 71 | } |
@@ -6,14 +6,14 @@ |
||
| 6 | 6 | |
| 7 | 7 | global $sn_page_name, $sn_mvc, $template, $template_result; |
| 8 | 8 | |
| 9 | -if(isset($sn_page_name) || ($sn_page_name = isset($_GET['page']) ? trim(strip_tags($_GET['page'])) : '')) { |
|
| 9 | +if (isset($sn_page_name) || ($sn_page_name = isset($_GET['page']) ? trim(strip_tags($_GET['page'])) : '')) { |
|
| 10 | 10 | require_once('common.' . substr(strrchr(__FILE__, '.'), 1)); |
| 11 | - if($sn_page_name) { |
|
| 11 | + if ($sn_page_name) { |
|
| 12 | 12 | // Loading page-specific language files |
| 13 | 13 | |
| 14 | 14 | !empty($sn_mvc['model'][$sn_page_name]) and execute_hooks($sn_mvc['model'][$sn_page_name], $template, 'model', $sn_page_name); |
| 15 | 15 | !empty($sn_mvc['view'][$sn_page_name]) and execute_hooks($sn_mvc['view'][$sn_page_name], $template, 'view', $sn_page_name); |
| 16 | - if(!empty($template_result) && is_object($template)) { |
|
| 16 | + if (!empty($template_result) && is_object($template)) { |
|
| 17 | 17 | $template->assign_recursive($template_result); |
| 18 | 18 | } |
| 19 | 19 | |