@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | $this->sql_index_field = "{$table_name}_name"; |
| 34 | 34 | $this->sql_value_field = "{$table_name}_value"; |
| 35 | 35 | |
| 36 | - if(!$this->_DB_LOADED) { |
|
| 36 | + if (!$this->_DB_LOADED) { |
|
| 37 | 37 | $this->db_loadAll(); |
| 38 | 38 | } |
| 39 | 39 | } |
@@ -53,10 +53,10 @@ discard block |
||
| 53 | 53 | */ |
| 54 | 54 | public function db_loadItem($index) { |
| 55 | 55 | $result = null; |
| 56 | - if($index) { |
|
| 56 | + if ($index) { |
|
| 57 | 57 | $index_safe = db_escape($index); |
| 58 | 58 | $queryResult = doquery("SELECT `{$this->sql_value_field}` FROM `{{{$this->table_name}}}` WHERE `{$this->sql_index_field}` = '{$index_safe}' FOR UPDATE", true); |
| 59 | - if(is_array($queryResult) && !empty($queryResult)) { |
|
| 59 | + if (is_array($queryResult) && !empty($queryResult)) { |
|
| 60 | 60 | $this->$index = $result = $queryResult[$this->sql_value_field]; |
| 61 | 61 | } |
| 62 | 62 | } |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | $this->loadDefaults(); |
| 69 | 69 | |
| 70 | 70 | $query = doquery("SELECT * FROM {{{$this->table_name}}} FOR UPDATE;"); |
| 71 | - while($row = db_fetch($query)) { |
|
| 71 | + while ($row = db_fetch($query)) { |
|
| 72 | 72 | $this->$row[$this->sql_index_field] = $row[$this->sql_value_field]; |
| 73 | 73 | } |
| 74 | 74 | |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | public function loadDefaults() { |
| 79 | - foreach($this->defaults as $defName => $defValue) { |
|
| 79 | + foreach ($this->defaults as $defName => $defValue) { |
|
| 80 | 80 | $this->$defName = $defValue; |
| 81 | 81 | } |
| 82 | 82 | } |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | public function db_saveItem($item_list, $value = NULL) { |
| 89 | - if(empty($item_list)) { |
|
| 89 | + if (empty($item_list)) { |
|
| 90 | 90 | return; |
| 91 | 91 | } |
| 92 | 92 | |
@@ -94,8 +94,8 @@ discard block |
||
| 94 | 94 | |
| 95 | 95 | // Сначала записываем данные в базу - что бы поймать все блокировки |
| 96 | 96 | $qry = array(); |
| 97 | - foreach($item_list as $item_name => $item_value) { |
|
| 98 | - if($item_name) { |
|
| 97 | + foreach ($item_list as $item_name => $item_value) { |
|
| 98 | + if ($item_name) { |
|
| 99 | 99 | $item_value = db_escape($item_value === NULL ? $this->$item_name : $item_value); |
| 100 | 100 | $item_name = db_escape($item_name); |
| 101 | 101 | $qry[] = "('{$item_name}', '{$item_value}')"; |
@@ -104,8 +104,8 @@ discard block |
||
| 104 | 104 | doquery("REPLACE INTO `{{" . $this->table_name . "}}` (`{$this->sql_index_field}`, `{$this->sql_value_field}`) VALUES " . implode(',', $qry) . ";"); |
| 105 | 105 | |
| 106 | 106 | // И только после взятия блокировок - меняем значения в кэше |
| 107 | - foreach($item_list as $item_name => $item_value) { |
|
| 108 | - if($item_name && $item_value !== null) { |
|
| 107 | + foreach ($item_list as $item_name => $item_value) { |
|
| 108 | + if ($item_name && $item_value !== null) { |
|
| 109 | 109 | $this->__set($item_name, $item_value); |
| 110 | 110 | } |
| 111 | 111 | } |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | public function __get($name) { |
| 136 | - if($this->force) { |
|
| 136 | + if ($this->force) { |
|
| 137 | 137 | $this->force = false; |
| 138 | 138 | $this->db_loadItem($name); |
| 139 | 139 | } |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | public function __set($name, $value) { |
| 145 | - if($this->force) { |
|
| 145 | + if ($this->force) { |
|
| 146 | 146 | $this->force = false; |
| 147 | 147 | $this->db_saveItem($name, $value); |
| 148 | 148 | } |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | public function __unset($name) { |
| 154 | - doquery("DELETE FROM `{{config}}` WHERE `config_name` = " .SN::$db->db_escape($name)); |
|
| 154 | + doquery("DELETE FROM `{{config}}` WHERE `config_name` = " . SN::$db->db_escape($name)); |
|
| 155 | 155 | |
| 156 | 156 | parent::__unset($name); |
| 157 | 157 | } |
@@ -9,8 +9,8 @@ discard block |
||
| 9 | 9 | * @copyright 2008 by Chlorel for XNova |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | -define('INSIDE' , true); |
|
| 13 | -define('INSTALL' , false); |
|
| 12 | +define('INSIDE', true); |
|
| 13 | +define('INSTALL', false); |
|
| 14 | 14 | define('IN_ADMIN', true); |
| 15 | 15 | require_once('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
| 16 | 16 | |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | messageBoxAdminAccessDenied(AUTH_LEVEL_ADMINISTRATOR); |
| 20 | 20 | |
| 21 | -if(SN_TIME_NOW >= SN::$config->pass()->var_stat_update_admin_forced && SN_TIME_NOW >= SN::$config->pass()->var_stat_update_end) |
|
| 21 | +if (SN_TIME_NOW >= SN::$config->pass()->var_stat_update_admin_forced && SN_TIME_NOW >= SN::$config->pass()->var_stat_update_end) |
|
| 22 | 22 | { |
| 23 | 23 | SN::$config->pass()->var_stat_update_admin_forced = SN_TIME_NOW + 120; |
| 24 | 24 | |
@@ -112,10 +112,10 @@ discard block |
||
| 112 | 112 | $rexep = "#" . strtr(preg_quote($format), $masks) . "#"; |
| 113 | 113 | if (preg_match($rexep, $date, $out)) { |
| 114 | 114 | $ret = array( |
| 115 | - "tm_sec" => (int)$out['S'], |
|
| 116 | - "tm_min" => (int)$out['M'], |
|
| 117 | - "tm_hour" => (int)$out['H'], |
|
| 118 | - "tm_mday" => (int)$out['d'], |
|
| 115 | + "tm_sec" => (int) $out['S'], |
|
| 116 | + "tm_min" => (int) $out['M'], |
|
| 117 | + "tm_hour" => (int) $out['H'], |
|
| 118 | + "tm_mday" => (int) $out['d'], |
|
| 119 | 119 | "tm_mon" => $out['m'] ? $out['m'] - 1 : 0, |
| 120 | 120 | "tm_year" => $out['Y'] > 1900 ? $out['Y'] - 1900 : 0, |
| 121 | 121 | ); |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | * @return int |
| 151 | 151 | */ |
| 152 | 152 | function datePart($fullDate) { |
| 153 | - return (int)strtotime(date('Y-m-d', $fullDate)); |
|
| 153 | + return (int) strtotime(date('Y-m-d', $fullDate)); |
|
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | |
@@ -178,12 +178,12 @@ discard block |
||
| 178 | 178 | * @return bool |
| 179 | 179 | * @throws ErrorException |
| 180 | 180 | */ |
| 181 | - function ($errno, $errstr, $errfile, $errline) { |
|
| 181 | + function($errno, $errstr, $errfile, $errline) { |
|
| 182 | 182 | throw new ErrorException($errstr, 0, $errno, $errfile, $errline); |
| 183 | 183 | } |
| 184 | 184 | ); |
| 185 | 185 | |
| 186 | - if(!$var) { |
|
| 186 | + if (!$var) { |
|
| 187 | 187 | return $var; |
| 188 | 188 | } |
| 189 | 189 | |