@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -include('common.' . substr(strrchr(__FILE__, '.'), 1)); |
|
3 | +include('common.'.substr(strrchr(__FILE__, '.'), 1)); |
|
4 | 4 | |
5 | 5 | $template = gettemplate('viewreport', true); |
6 | 6 | $template->assign_var('PAGE_HINT', classLocale::$lang['cr_view_hint']); |
@@ -76,13 +76,13 @@ discard block |
||
76 | 76 | |
77 | 77 | protected function checkPropertyExists($name) { |
78 | 78 | if (!array_key_exists($name, $this->_properties)) { |
79 | - throw new ExceptionPropertyNotExists('Property [' . get_called_class() . '::' . $name . '] not exists', ERR_ERROR); |
|
79 | + throw new ExceptionPropertyNotExists('Property ['.get_called_class().'::'.$name.'] not exists', ERR_ERROR); |
|
80 | 80 | } |
81 | 81 | } |
82 | 82 | |
83 | 83 | protected function checkOverwriteAdjusted($name) { |
84 | 84 | if (array_key_exists($name, $this->propertiesAdjusted)) { |
85 | - throw new PropertyAccessException('Property [' . get_called_class() . '::' . $name . '] already was adjusted so no SET is possible until dbSave', ERR_ERROR); |
|
85 | + throw new PropertyAccessException('Property ['.get_called_class().'::'.$name.'] already was adjusted so no SET is possible until dbSave', ERR_ERROR); |
|
86 | 86 | } |
87 | 87 | } |
88 | 88 | |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | * @return boolean |
132 | 132 | */ |
133 | 133 | public function isContainerEmpty() { |
134 | - throw new Exception('PropertyHider::isContainerEmpty() is not implemented. You should implement it in class ' . get_called_class()); |
|
134 | + throw new Exception('PropertyHider::isContainerEmpty() is not implemented. You should implement it in class '.get_called_class()); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | |
@@ -175,15 +175,15 @@ discard block |
||
175 | 175 | $result = null; |
176 | 176 | // Now deciding - will we call a protected setter or will we work with protected property |
177 | 177 | // Todo - on init recalc all method_exists |
178 | - if (method_exists($this, $methodName = $action . ucfirst($name))) { |
|
178 | + if (method_exists($this, $methodName = $action.ucfirst($name))) { |
|
179 | 179 | // If method exists - just calling it |
180 | 180 | // TODO - should return TRUE if value changed or FALSE otherwise |
181 | 181 | $result = call_user_func_array(array($this, $methodName), array($value)); |
182 | 182 | } elseif ($this->isPropertyActionAvailable($name, $action)) { |
183 | 183 | // No setter exists - works directly with protected property |
184 | - $result = $this->{$action . 'Property'}($name, $value); |
|
184 | + $result = $this->{$action.'Property'}($name, $value); |
|
185 | 185 | } else { |
186 | - throw new ExceptionPropertyNotExists('Property [' . get_called_class() . '::' . $name . '] does not have ' . $action . 'ter/property to ' . $action, ERR_ERROR); |
|
186 | + throw new ExceptionPropertyNotExists('Property ['.get_called_class().'::'.$name.'] does not have '.$action.'ter/property to '.$action, ERR_ERROR); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | return $result; |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | * @return string |
275 | 275 | */ |
276 | 276 | protected function adjustPropertyString($name, $diff) { |
277 | - return (string)$this->$name . (string)$diff; |
|
277 | + return (string) $this->$name.(string) $diff; |
|
278 | 278 | } |
279 | 279 | |
280 | 280 | /** |
@@ -284,8 +284,8 @@ discard block |
||
284 | 284 | * @return array |
285 | 285 | */ |
286 | 286 | protected function adjustPropertyArray($name, $diff) { |
287 | - $copy = (array)$this->$name; |
|
288 | - HelperArray::merge($copy, (array)$diff, HelperArray::MERGE_PHP); |
|
287 | + $copy = (array) $this->$name; |
|
288 | + HelperArray::merge($copy, (array) $diff, HelperArray::MERGE_PHP); |
|
289 | 289 | |
290 | 290 | return $copy; |
291 | 291 | } |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | * @return int |
298 | 298 | */ |
299 | 299 | protected function deltaInteger($name, $diff) { |
300 | - return (int)HelperArray::keyExistsOr($this->propertiesAdjusted, $name, 0) + (int)$diff; |
|
300 | + return (int) HelperArray::keyExistsOr($this->propertiesAdjusted, $name, 0) + (int) $diff; |
|
301 | 301 | } |
302 | 302 | |
303 | 303 | /** |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | * @return float |
308 | 308 | */ |
309 | 309 | protected function deltaDouble($name, $diff) { |
310 | - return (float)HelperArray::keyExistsOr($this->propertiesAdjusted, $name, 0.0) + (float)$diff; |
|
310 | + return (float) HelperArray::keyExistsOr($this->propertiesAdjusted, $name, 0.0) + (float) $diff; |
|
311 | 311 | } |
312 | 312 | |
313 | 313 | /** |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | * @return string |
318 | 318 | */ |
319 | 319 | protected function deltaString($name, $diff) { |
320 | - return (string)HelperArray::keyExistsOr($this->propertiesAdjusted, $name, '') . (string)$diff; |
|
320 | + return (string) HelperArray::keyExistsOr($this->propertiesAdjusted, $name, '').(string) $diff; |
|
321 | 321 | } |
322 | 322 | |
323 | 323 | /** |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | * @return array |
328 | 328 | */ |
329 | 329 | protected function deltaArray($name, $diff) { |
330 | - $copy = (array)HelperArray::keyExistsOr($this->propertiesAdjusted, $name, array()); |
|
330 | + $copy = (array) HelperArray::keyExistsOr($this->propertiesAdjusted, $name, array()); |
|
331 | 331 | HelperArray::merge($copy, $diff, HelperArray::MERGE_PHP); |
332 | 332 | |
333 | 333 | return $copy; |
@@ -350,10 +350,10 @@ discard block |
||
350 | 350 | // Capitalizing type name |
351 | 351 | $methodName = explode(' ', $type); |
352 | 352 | array_walk($methodName, 'DbSqlHelper::UCFirstByRef'); |
353 | - $methodName = $prefix . implode('', $methodName); |
|
353 | + $methodName = $prefix.implode('', $methodName); |
|
354 | 354 | |
355 | 355 | if (!method_exists($this, $methodName)) { |
356 | - throw new ExceptionTypeUnsupported('Type "' . $type . '" is unsupported in PropertyHider::propertyMethodResult'); |
|
356 | + throw new ExceptionTypeUnsupported('Type "'.$type.'" is unsupported in PropertyHider::propertyMethodResult'); |
|
357 | 357 | } |
358 | 358 | |
359 | 359 | return call_user_func(array($this, $methodName), $name, $diff); |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | break; |
31 | 31 | |
32 | 32 | case TYPE_ARRAY: |
33 | - $value = (array)$value; |
|
33 | + $value = (array) $value; |
|
34 | 34 | break; |
35 | 35 | |
36 | 36 | case TYPE_STRING: |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | case TYPE_EMPTY: |
39 | 39 | // No-type defaults to string |
40 | 40 | default: |
41 | - $value = (string)$value; |
|
41 | + $value = (string) $value; |
|
42 | 42 | break; |
43 | 43 | } |
44 | 44 |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | if (is_callable($callable)) { |
53 | 53 | $this->accessors[$type][$varName] = $callable; |
54 | 54 | } else { |
55 | - throw new Exception('Error assigning callable in ' . get_called_class() . '! Callable typed [' . $type . '] is not a callable or not accessible in the scope'); |
|
55 | + throw new Exception('Error assigning callable in '.get_called_class().'! Callable typed ['.$type.'] is not a callable or not accessible in the scope'); |
|
56 | 56 | } |
57 | 57 | } |
58 | 58 | |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | } |
74 | 74 | |
75 | 75 | public function importRow($row) { |
76 | - if(empty($row)) { |
|
76 | + if (empty($row)) { |
|
77 | 77 | return; |
78 | 78 | } |
79 | 79 |
@@ -78,12 +78,12 @@ discard block |
||
78 | 78 | $that = $this; |
79 | 79 | |
80 | 80 | $this->_container->assignAccessor('type', P_CONTAINER_GETTER, |
81 | - function () use ($that) { |
|
81 | + function() use ($that) { |
|
82 | 82 | return $that->type; |
83 | 83 | } |
84 | 84 | ); |
85 | 85 | $this->_container->assignAccessor('type', P_CONTAINER_SETTER, |
86 | - function ($value) use ($that) { |
|
86 | + function($value) use ($that) { |
|
87 | 87 | $that->type = $value; |
88 | 88 | $array = get_unit_param($value); |
89 | 89 | $that->unitInfo = $array; |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | $propertyName = 'timeStart'; |
100 | 100 | $fieldName = self::$_properties[$propertyName][P_DB_FIELD]; |
101 | 101 | $this->_container->assignAccessor($propertyName, P_CONTAINER_IMPORTER, |
102 | - function (&$row) use ($that, $fieldName) { |
|
102 | + function(&$row) use ($that, $fieldName) { |
|
103 | 103 | if (isset($row[$fieldName])) { |
104 | 104 | $dateTime = new \DateTime($row[$fieldName]); |
105 | 105 | } else { |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | } |
110 | 110 | ); |
111 | 111 | $this->_container->assignAccessor($propertyName, P_CONTAINER_EXPORTER, |
112 | - function (&$row) use ($that, $fieldName) { |
|
112 | + function(&$row) use ($that, $fieldName) { |
|
113 | 113 | $dateTime = $that->timeStart; |
114 | 114 | if ($dateTime instanceof \DateTime) { |
115 | 115 | $row[$fieldName] = $dateTime->format(FMT_DATE_TIME_SQL); |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | $propertyName = 'timeFinish'; |
123 | 123 | $fieldName = self::$_properties[$propertyName][P_DB_FIELD]; |
124 | 124 | $this->_container->assignAccessor($propertyName, P_CONTAINER_IMPORTER, |
125 | - function (&$row) use ($that, $fieldName) { |
|
125 | + function(&$row) use ($that, $fieldName) { |
|
126 | 126 | if (isset($row[$fieldName])) { |
127 | 127 | $dateTime = new \DateTime($row[$fieldName]); |
128 | 128 | } else { |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | } |
133 | 133 | ); |
134 | 134 | $this->_container->assignAccessor($propertyName, P_CONTAINER_EXPORTER, |
135 | - function (&$row) use ($that, $fieldName) { |
|
135 | + function(&$row) use ($that, $fieldName) { |
|
136 | 136 | $dateTime = $that->timeFinish; |
137 | 137 | if ($dateTime instanceof \DateTime) { |
138 | 138 | $row[$fieldName] = $dateTime->format(FMT_DATE_TIME_SQL); |
@@ -27,14 +27,14 @@ |
||
27 | 27 | $cBuddy->new_request_text_unsafe = sys_get_param_str_unsafe('request_text'); |
28 | 28 | $cBuddy->playerArray = $user; |
29 | 29 | |
30 | - $cBuddy->playerId = function (BuddyRoutingParams $cBuddy) { |
|
30 | + $cBuddy->playerId = function(BuddyRoutingParams $cBuddy) { |
|
31 | 31 | return $cBuddy->playerArray['id']; |
32 | 32 | }; |
33 | - $cBuddy->playerName = function (BuddyRoutingParams $cBuddy) { |
|
33 | + $cBuddy->playerName = function(BuddyRoutingParams $cBuddy) { |
|
34 | 34 | return $cBuddy->playerArray['username']; |
35 | 35 | }; |
36 | - $cBuddy->playerNameAndCoordinates = function (BuddyRoutingParams $cBuddy) { |
|
37 | - return "{$cBuddy->playerArray['username']} " . uni_render_coordinates($cBuddy->playerArray); |
|
36 | + $cBuddy->playerNameAndCoordinates = function(BuddyRoutingParams $cBuddy) { |
|
37 | + return "{$cBuddy->playerArray['username']} ".uni_render_coordinates($cBuddy->playerArray); |
|
38 | 38 | }; |
39 | 39 | |
40 | 40 | $result = array(); |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | /** |
201 | 201 | * Блокирует указанные таблицу/список таблиц |
202 | 202 | * |
203 | - * @param string|array $tables Таблица/список таблиц для блокировки. Названия таблиц - без префиксов |
|
203 | + * @param string $tables Таблица/список таблиц для блокировки. Названия таблиц - без префиксов |
|
204 | 204 | * <p>string - название таблицы для блокировки</p> |
205 | 205 | * <p>array - массив, где ключ - имя таблицы, а значение - условия блокировки элементов</p> |
206 | 206 | */ |
@@ -377,6 +377,9 @@ discard block |
||
377 | 377 | return $result; |
378 | 378 | } |
379 | 379 | |
380 | + /** |
|
381 | + * @param integer $location_type |
|
382 | + */ |
|
380 | 383 | public static function db_ins_field_set($location_type, $field_set, $serialize = false) { |
381 | 384 | // TODO multiinsert |
382 | 385 | !sn_db_field_set_is_safe($field_set) ? $field_set = sn_db_field_set_make_safe($field_set, $serialize) : false; |
@@ -1,7 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | use Vector\Vector; |
4 | - |
|
5 | 4 | use Common\GlobalContainer; |
6 | 5 | |
7 | 6 | class classSupernova { |
@@ -363,9 +363,11 @@ |
||
363 | 363 | $set = trim($set); |
364 | 364 | $table_name = static::$location_info[$location_type][P_TABLE_NAME]; |
365 | 365 | if ($result = static::$db->doInsert("INSERT INTO `{{{$table_name}}}` SET {$set}")) { |
366 | - if (static::$db->db_affected_rows()) // Обновляем данные только если ряд был затронут |
|
366 | + if (static::$db->db_affected_rows()) { |
|
367 | + // Обновляем данные только если ряд был затронут |
|
367 | 368 | { |
368 | 369 | $record_id = classSupernova::$db->db_insert_id(); |
370 | + } |
|
369 | 371 | // Вытаскиваем запись целиком, потому что в $set могли быть "данные по умолчанию" |
370 | 372 | $result = static::db_get_record_by_id($location_type, $record_id); |
371 | 373 | // Очищаем второстепенные кэши - потому что вставленная запись могла повлиять на результаты запросов или локация или еще чего |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | public static function db_lock_tables($tables) { |
206 | 206 | $tables = is_array($tables) ? $tables : array($tables => ''); |
207 | 207 | foreach ($tables as $table_name => $condition) { |
208 | - self::$db->doSelect("SELECT 1 FROM {{{$table_name}}}" . ($condition ? ' WHERE ' . $condition : '')); |
|
208 | + self::$db->doSelect("SELECT 1 FROM {{{$table_name}}}".($condition ? ' WHERE '.$condition : '')); |
|
209 | 209 | } |
210 | 210 | } |
211 | 211 | |
@@ -247,8 +247,8 @@ discard block |
||
247 | 247 | $query = static::$db->doSelect( |
248 | 248 | "SELECT |
249 | 249 | distinct({{{$location_info[P_TABLE_NAME]}}}.{$owner_data[P_OWNER_FIELD]}) AS parent_id |
250 | - FROM {{{$location_info[P_TABLE_NAME]}}}" . |
|
251 | - ($filter ? ' WHERE ' . $filter : '') . |
|
250 | + FROM {{{$location_info[P_TABLE_NAME]}}}". |
|
251 | + ($filter ? ' WHERE '.$filter : ''). |
|
252 | 252 | ($fetch ? ' LIMIT 1' : '')); |
253 | 253 | while ($row = db_fetch($query)) { |
254 | 254 | // Исключаем из списка родительских ИД уже заблокированные записи |
@@ -261,13 +261,13 @@ discard block |
||
261 | 261 | if ($indexes_str = implode(',', $parent_id_list)) { |
262 | 262 | $parent_id_field = static::$location_info[$owner_location_type][P_ID]; |
263 | 263 | static::db_get_record_list($owner_location_type, |
264 | - $parent_id_field . (count($parent_id_list) > 1 ? " IN ({$indexes_str})" : " = {$indexes_str}"), $fetch, true); |
|
264 | + $parent_id_field.(count($parent_id_list) > 1 ? " IN ({$indexes_str})" : " = {$indexes_str}"), $fetch, true); |
|
265 | 265 | } |
266 | 266 | } |
267 | 267 | } |
268 | 268 | |
269 | 269 | $query = static::$db->doSelect( |
270 | - "SELECT * FROM {{{$location_info[P_TABLE_NAME]}}}" . |
|
270 | + "SELECT * FROM {{{$location_info[P_TABLE_NAME]}}}". |
|
271 | 271 | (($filter = trim($filter)) ? " WHERE {$filter}" : '') |
272 | 272 | . " FOR UPDATE" |
273 | 273 | ); |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | $condition = trim($condition); |
342 | 342 | $table_name = static::$location_info[$location_type][P_TABLE_NAME]; |
343 | 343 | |
344 | - if ($result = static::$db->doUpdate("UPDATE {{{$table_name}}} SET " . $set . ($condition ? ' WHERE ' . $condition : ''))) { |
|
344 | + if ($result = static::$db->doUpdate("UPDATE {{{$table_name}}} SET ".$set.($condition ? ' WHERE '.$condition : ''))) { |
|
345 | 345 | |
346 | 346 | if (static::$db->db_affected_rows()) { // Обновляем данные только если ряд был затронут |
347 | 347 | // Поскольку нам неизвестно, что и как обновилось - сбрасываем кэш этого типа полностью |
@@ -491,7 +491,7 @@ discard block |
||
491 | 491 | ini_get('magic_quotes_sybase') ? die('SN is incompatible with \'magic_quotes_sybase\' turned on. Disable it in php.ini or .htaccess...') : false; |
492 | 492 | if (@get_magic_quotes_gpc()) { |
493 | 493 | $gpcr = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST); |
494 | - array_walk_recursive($gpcr, function (&$value, $key) { |
|
494 | + array_walk_recursive($gpcr, function(&$value, $key) { |
|
495 | 495 | $value = stripslashes($value); |
496 | 496 | }); |
497 | 497 | } |
@@ -507,43 +507,43 @@ discard block |
||
507 | 507 | $gc = static::$gc; |
508 | 508 | |
509 | 509 | // Default db |
510 | - $gc->db = function ($c) { |
|
510 | + $gc->db = function($c) { |
|
511 | 511 | $db = new db_mysql($c); |
512 | 512 | $db->sn_db_connect(); |
513 | 513 | |
514 | 514 | return $db; |
515 | 515 | }; |
516 | 516 | |
517 | - $gc->debug = function ($c) { |
|
517 | + $gc->debug = function($c) { |
|
518 | 518 | return new debug(); |
519 | 519 | }; |
520 | 520 | |
521 | - $gc->cache = function ($c) { |
|
521 | + $gc->cache = function($c) { |
|
522 | 522 | return new classCache(classSupernova::$cache_prefix); |
523 | 523 | }; |
524 | 524 | |
525 | - $gc->config = function ($c) { |
|
525 | + $gc->config = function($c) { |
|
526 | 526 | return new classConfig(classSupernova::$cache_prefix); |
527 | 527 | }; |
528 | 528 | |
529 | - $gc->localePlayer = function (GlobalContainer $c) { |
|
529 | + $gc->localePlayer = function(GlobalContainer $c) { |
|
530 | 530 | return new classLocale($c->config->server_locale_log_usage); |
531 | 531 | }; |
532 | 532 | |
533 | - $gc->dbRowOperator = function ($c) { |
|
533 | + $gc->dbRowOperator = function($c) { |
|
534 | 534 | return new DbRowDirectOperator($c); |
535 | 535 | }; |
536 | 536 | |
537 | 537 | $gc->buddyClass = 'Buddy\BuddyModel'; |
538 | - $gc->buddy = $gc->factory(function (GlobalContainer $c) { |
|
538 | + $gc->buddy = $gc->factory(function(GlobalContainer $c) { |
|
539 | 539 | return new $c->buddyClass($c); |
540 | 540 | }); |
541 | 541 | |
542 | - $gc->query = $gc->factory(function (GlobalContainer $c) { |
|
542 | + $gc->query = $gc->factory(function(GlobalContainer $c) { |
|
543 | 543 | return new DbQueryConstructor($c->db); |
544 | 544 | }); |
545 | 545 | |
546 | - $gc->unit = $gc->factory(function (GlobalContainer $c) { |
|
546 | + $gc->unit = $gc->factory(function(GlobalContainer $c) { |
|
547 | 547 | return new \V2Unit\V2UnitModel($c); |
548 | 548 | }); |
549 | 549 | |
@@ -556,7 +556,7 @@ discard block |
||
556 | 556 | public static function init_3_load_config_file() { |
557 | 557 | $dbsettings = array(); |
558 | 558 | |
559 | - require(SN_ROOT_PHYSICAL . "config" . DOT_PHP_EX); |
|
559 | + require(SN_ROOT_PHYSICAL."config".DOT_PHP_EX); |
|
560 | 560 | self::$cache_prefix = !empty($dbsettings['cache_prefix']) ? $dbsettings['cache_prefix'] : $dbsettings['prefix']; |
561 | 561 | self::$db_name = $dbsettings['name']; |
562 | 562 | self::$sn_secret_word = $dbsettings['secretword']; |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | /** |
150 | 150 | * @param string $query |
151 | 151 | * |
152 | - * @return mixed|string |
|
152 | + * @return string |
|
153 | 153 | */ |
154 | 154 | public function replaceTablePlaceholders($query) { |
155 | 155 | $sql = $query; |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | } |
164 | 164 | |
165 | 165 | /** |
166 | - * @param $query |
|
166 | + * @param string $query |
|
167 | 167 | */ |
168 | 168 | protected function logQuery($query) { |
169 | 169 | if (!classSupernova::$config->debug) { |
@@ -352,6 +352,10 @@ discard block |
||
352 | 352 | } |
353 | 353 | |
354 | 354 | // TODO Заменить это на новый логгер |
355 | + |
|
356 | + /** |
|
357 | + * @param string $query |
|
358 | + */ |
|
355 | 359 | protected function security_watch_user_queries($query) { |
356 | 360 | global $user; |
357 | 361 | |
@@ -375,6 +379,9 @@ discard block |
||
375 | 379 | } |
376 | 380 | |
377 | 381 | |
382 | + /** |
|
383 | + * @param string $query |
|
384 | + */ |
|
378 | 385 | public function security_query_check_bad_words($query) { |
379 | 386 | if ($this->skipQueryCheck) { |
380 | 387 | return; |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | public function load_db_settings($configFile = '') { |
84 | 84 | $dbsettings = array(); |
85 | 85 | |
86 | - empty($configFile) ? $configFile = SN_ROOT_PHYSICAL . "config" . DOT_PHP_EX : false; |
|
86 | + empty($configFile) ? $configFile = SN_ROOT_PHYSICAL."config".DOT_PHP_EX : false; |
|
87 | 87 | |
88 | 88 | require $configFile; |
89 | 89 | |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | } |
104 | 104 | |
105 | 105 | if (empty($this->dbsettings)) { |
106 | - $this->load_db_settings(SN_ROOT_PHYSICAL . "config" . DOT_PHP_EX); |
|
106 | + $this->load_db_settings(SN_ROOT_PHYSICAL."config".DOT_PHP_EX); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | // TODO - фатальные (?) ошибки на каждом шагу. Хотя - скорее Эксепшны |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | $sql = $query; |
156 | 156 | if (strpos($sql, '{{') !== false) { |
157 | 157 | foreach ($this->table_list as $tableName) { |
158 | - $sql = str_replace("{{{$tableName}}}", $this->db_prefix . $tableName, $sql); |
|
158 | + $sql = str_replace("{{{$tableName}}}", $this->db_prefix.$tableName, $sql); |
|
159 | 159 | } |
160 | 160 | } |
161 | 161 | |
@@ -228,12 +228,12 @@ discard block |
||
228 | 228 | |
229 | 229 | $queryResult = null; |
230 | 230 | try { |
231 | - $queryResult = $this->db_sql_query($stringQuery . DbSqlHelper::quoteComment($queryTrace)); |
|
231 | + $queryResult = $this->db_sql_query($stringQuery.DbSqlHelper::quoteComment($queryTrace)); |
|
232 | 232 | if (!$queryResult) { |
233 | 233 | throw new Exception(); |
234 | 234 | } |
235 | 235 | } catch (Exception $e) { |
236 | - classSupernova::$debug->error($this->db_error() . "<br />{$query}<br />", 'SQL Error'); |
|
236 | + classSupernova::$debug->error($this->db_error()."<br />{$query}<br />", 'SQL Error'); |
|
237 | 237 | } |
238 | 238 | |
239 | 239 | return $queryResult; |
@@ -364,10 +364,10 @@ discard block |
||
364 | 364 | $this->isWatching = true; |
365 | 365 | $msg = "\$query = \"{$query}\"\n\r"; |
366 | 366 | if (!empty($_POST)) { |
367 | - $msg .= "\n\r" . dump($_POST, '$_POST'); |
|
367 | + $msg .= "\n\r".dump($_POST, '$_POST'); |
|
368 | 368 | } |
369 | 369 | if (!empty($_GET)) { |
370 | - $msg .= "\n\r" . dump($_GET, '$_GET'); |
|
370 | + $msg .= "\n\r".dump($_GET, '$_GET'); |
|
371 | 371 | } |
372 | 372 | classSupernova::$debug->warning($msg, "Watching user {$user['id']}", 399, array('base_dump' => true)); |
373 | 373 | $this->isWatching = false; |
@@ -393,37 +393,37 @@ discard block |
||
393 | 393 | case stripos($query, 'RPG_POINTS') != false && stripos(trim($query), 'UPDATE ') === 0 && !$dm_change_legit: |
394 | 394 | case stripos($query, 'METAMATTER') != false && stripos(trim($query), 'UPDATE ') === 0 && !$mm_change_legit: |
395 | 395 | case stripos($query, 'AUTHLEVEL') != false && $user['authlevel'] < 3 && stripos($query, 'SELECT') !== 0: |
396 | - $report = "Hacking attempt (" . date("d.m.Y H:i:s") . " - [" . time() . "]):\n"; |
|
396 | + $report = "Hacking attempt (".date("d.m.Y H:i:s")." - [".time()."]):\n"; |
|
397 | 397 | $report .= ">Database Inforamation\n"; |
398 | - $report .= "\tID - " . $user['id'] . "\n"; |
|
399 | - $report .= "\tUser - " . $user['username'] . "\n"; |
|
400 | - $report .= "\tAuth level - " . $user['authlevel'] . "\n"; |
|
401 | - $report .= "\tAdmin Notes - " . $user['adminNotes'] . "\n"; |
|
402 | - $report .= "\tCurrent Planet - " . $user['current_planet'] . "\n"; |
|
403 | - $report .= "\tUser IP - " . $user['user_lastip'] . "\n"; |
|
404 | - $report .= "\tUser IP at Reg - " . $user['ip_at_reg'] . "\n"; |
|
405 | - $report .= "\tUser Agent- " . $_SERVER['HTTP_USER_AGENT'] . "\n"; |
|
406 | - $report .= "\tCurrent Page - " . $user['current_page'] . "\n"; |
|
407 | - $report .= "\tRegister Time - " . $user['register_time'] . "\n"; |
|
398 | + $report .= "\tID - ".$user['id']."\n"; |
|
399 | + $report .= "\tUser - ".$user['username']."\n"; |
|
400 | + $report .= "\tAuth level - ".$user['authlevel']."\n"; |
|
401 | + $report .= "\tAdmin Notes - ".$user['adminNotes']."\n"; |
|
402 | + $report .= "\tCurrent Planet - ".$user['current_planet']."\n"; |
|
403 | + $report .= "\tUser IP - ".$user['user_lastip']."\n"; |
|
404 | + $report .= "\tUser IP at Reg - ".$user['ip_at_reg']."\n"; |
|
405 | + $report .= "\tUser Agent- ".$_SERVER['HTTP_USER_AGENT']."\n"; |
|
406 | + $report .= "\tCurrent Page - ".$user['current_page']."\n"; |
|
407 | + $report .= "\tRegister Time - ".$user['register_time']."\n"; |
|
408 | 408 | $report .= "\n"; |
409 | 409 | |
410 | 410 | $report .= ">Query Information\n"; |
411 | - $report .= "\tQuery - " . $query . "\n"; |
|
411 | + $report .= "\tQuery - ".$query."\n"; |
|
412 | 412 | $report .= "\n"; |
413 | 413 | |
414 | 414 | $report .= ">\$_SERVER Information\n"; |
415 | - $report .= "\tIP - " . $_SERVER['REMOTE_ADDR'] . "\n"; |
|
416 | - $report .= "\tHost Name - " . $_SERVER['HTTP_HOST'] . "\n"; |
|
417 | - $report .= "\tUser Agent - " . $_SERVER['HTTP_USER_AGENT'] . "\n"; |
|
418 | - $report .= "\tRequest Method - " . $_SERVER['REQUEST_METHOD'] . "\n"; |
|
419 | - $report .= "\tCame From - " . $_SERVER['HTTP_REFERER'] . "\n"; |
|
420 | - $report .= "\tPage is - " . $_SERVER['SCRIPT_NAME'] . "\n"; |
|
421 | - $report .= "\tUses Port - " . $_SERVER['REMOTE_PORT'] . "\n"; |
|
422 | - $report .= "\tServer Protocol - " . $_SERVER['SERVER_PROTOCOL'] . "\n"; |
|
415 | + $report .= "\tIP - ".$_SERVER['REMOTE_ADDR']."\n"; |
|
416 | + $report .= "\tHost Name - ".$_SERVER['HTTP_HOST']."\n"; |
|
417 | + $report .= "\tUser Agent - ".$_SERVER['HTTP_USER_AGENT']."\n"; |
|
418 | + $report .= "\tRequest Method - ".$_SERVER['REQUEST_METHOD']."\n"; |
|
419 | + $report .= "\tCame From - ".$_SERVER['HTTP_REFERER']."\n"; |
|
420 | + $report .= "\tPage is - ".$_SERVER['SCRIPT_NAME']."\n"; |
|
421 | + $report .= "\tUses Port - ".$_SERVER['REMOTE_PORT']."\n"; |
|
422 | + $report .= "\tServer Protocol - ".$_SERVER['SERVER_PROTOCOL']."\n"; |
|
423 | 423 | |
424 | 424 | $report .= "\n--------------------------------------------------------------------------------------------------\n"; |
425 | 425 | |
426 | - $fp = fopen(SN_ROOT_PHYSICAL . 'badqrys.txt', 'a'); |
|
426 | + $fp = fopen(SN_ROOT_PHYSICAL.'badqrys.txt', 'a'); |
|
427 | 427 | fwrite($fp, $report); |
428 | 428 | fclose($fp); |
429 | 429 |
@@ -39,7 +39,7 @@ |
||
39 | 39 | * <p>true - транзакция должна быть запущена - для совместимости с $for_update</p> |
40 | 40 | * <p>false - всё равно - для совместимости с $for_update</p> |
41 | 41 | * |
42 | - * @return bool Текущий статус транзакции |
|
42 | + * @return null|boolean Текущий статус транзакции |
|
43 | 43 | */ |
44 | 44 | public function check($status = null) { |
45 | 45 | $error_msg = false; |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | |
52 | 52 | if (!empty($error_msg)) { |
53 | 53 | // TODO - Убрать позже |
54 | - print('<h1>СООБЩИТЕ ЭТО АДМИНУ: sn_db_transaction_check() - ' . $error_msg . '</h1>'); |
|
54 | + print('<h1>СООБЩИТЕ ЭТО АДМИНУ: sn_db_transaction_check() - '.$error_msg.'</h1>'); |
|
55 | 55 | $backtrace = debug_backtrace(); |
56 | 56 | array_shift($backtrace); |
57 | 57 | pdump($backtrace); |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | public function start($level = '') { |
65 | 65 | $this->check(null); |
66 | 66 | |
67 | - $level ? $this->db->doExecute('SET TRANSACTION ISOLATION LEVEL ' . $level) : false; |
|
67 | + $level ? $this->db->doExecute('SET TRANSACTION ISOLATION LEVEL '.$level) : false; |
|
68 | 68 | |
69 | 69 | $this->transaction_id++; |
70 | 70 | $this->db->doExecute('START TRANSACTION'); |