@@ -60,6 +60,9 @@ discard block |
||
| 60 | 60 | */ |
| 61 | 61 | protected static $rowOperator; |
| 62 | 62 | |
| 63 | + /** |
|
| 64 | + * @param integer $propertyName |
|
| 65 | + */ |
|
| 63 | 66 | protected function bindFieldExport(&$propertyData, $propertyName) { |
| 64 | 67 | if(!empty($propertyData[P_DB_ROW_EXPORT])) { |
| 65 | 68 | return; |
@@ -79,6 +82,9 @@ discard block |
||
| 79 | 82 | } |
| 80 | 83 | } |
| 81 | 84 | |
| 85 | + /** |
|
| 86 | + * @param integer $propertyName |
|
| 87 | + */ |
|
| 82 | 88 | protected function bindFieldImport(&$propertyData, $propertyName) { |
| 83 | 89 | if(!empty($propertyData[P_DB_ROW_IMPORT])) { |
| 84 | 90 | return; |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | protected static $rowOperator; |
| 62 | 62 | |
| 63 | 63 | protected function bindFieldExport(&$propertyData, $propertyName) { |
| 64 | - if(!empty($propertyData[P_DB_ROW_EXPORT])) { |
|
| 64 | + if (!empty($propertyData[P_DB_ROW_EXPORT])) { |
|
| 65 | 65 | return; |
| 66 | 66 | } |
| 67 | 67 | |
@@ -73,14 +73,14 @@ discard block |
||
| 73 | 73 | */ |
| 74 | 74 | // Alas! No bindTo() method in 5.3 closures! So we should use what we have |
| 75 | 75 | // Also no auto bound of $this until 5.4 |
| 76 | - $propertyData[P_DB_ROW_EXPORT] = function ($that, &$row) use ($propertyName, $propertyData) { |
|
| 76 | + $propertyData[P_DB_ROW_EXPORT] = function($that, &$row) use ($propertyName, $propertyData) { |
|
| 77 | 77 | $row[$propertyData[P_DB_FIELD]] = $that->$propertyName; |
| 78 | 78 | }; |
| 79 | 79 | } |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | protected function bindFieldImport(&$propertyData, $propertyName) { |
| 83 | - if(!empty($propertyData[P_DB_ROW_IMPORT])) { |
|
| 83 | + if (!empty($propertyData[P_DB_ROW_IMPORT])) { |
|
| 84 | 84 | return; |
| 85 | 85 | } |
| 86 | 86 | |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | */ |
| 93 | 93 | // Alas! No bindTo() method in 5.3 closures! So we should use what we have |
| 94 | 94 | // Also no auto bound of $this until 5.4 |
| 95 | - $propertyData[P_DB_ROW_IMPORT] = function ($that, &$row) use ($propertyName, $propertyData) { |
|
| 95 | + $propertyData[P_DB_ROW_IMPORT] = function($that, &$row) use ($propertyName, $propertyData) { |
|
| 96 | 96 | $that->$propertyName = \Common\Types::castAs( |
| 97 | 97 | !empty($propertyData[P_DB_TYPE]) ? $propertyData[P_DB_TYPE] : TYPE_EMPTY, |
| 98 | 98 | $row[$propertyData[P_DB_FIELD]] |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | // TODO - however for a sake of uniformity may be we should consider use call_user_func |
| 157 | 157 | // call_user_func($propertyData[P_DB_ROW_EXPORT], $this, $row); |
| 158 | 158 | } else { |
| 159 | - throw new \Exception('There is no valid DB [' . $operation . '] row operation for ' . get_called_class() . '::' . $propertyName); |
|
| 159 | + throw new \Exception('There is no valid DB ['.$operation.'] row operation for '.get_called_class().'::'.$propertyName); |
|
| 160 | 160 | } |
| 161 | 161 | } |
| 162 | 162 | } |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | * Idea from buddy.php Created by Perberos. All rights reversed (C) 2006 |
| 15 | 15 | * */ |
| 16 | 16 | |
| 17 | -include('common.' . substr(strrchr(__FILE__, '.'), 1)); |
|
| 17 | +include('common.'.substr(strrchr(__FILE__, '.'), 1)); |
|
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | 20 | * @var array $user |
@@ -35,14 +35,14 @@ discard block |
||
| 35 | 35 | $cBuddy->new_friend_name_unsafe = sys_get_param_str_unsafe('request_user_name'); |
| 36 | 36 | $cBuddy->new_request_text_unsafe = sys_get_param_str_unsafe('request_text'); |
| 37 | 37 | $cBuddy->playerArray = $user; |
| 38 | - $cBuddy->playerId = function (BuddyRoutingParams $cBuddy) { |
|
| 38 | + $cBuddy->playerId = function(BuddyRoutingParams $cBuddy) { |
|
| 39 | 39 | return $cBuddy->playerArray['id']; |
| 40 | 40 | }; |
| 41 | - $cBuddy->playerName = function (BuddyRoutingParams $cBuddy) { |
|
| 41 | + $cBuddy->playerName = function(BuddyRoutingParams $cBuddy) { |
|
| 42 | 42 | return $cBuddy->playerArray['username']; |
| 43 | 43 | }; |
| 44 | - $cBuddy->playerNameAndCoordinates = function (BuddyRoutingParams $cBuddy) { |
|
| 45 | - return "{$cBuddy->playerArray['username']} " . uni_render_coordinates($cBuddy->playerArray) ; |
|
| 44 | + $cBuddy->playerNameAndCoordinates = function(BuddyRoutingParams $cBuddy) { |
|
| 45 | + return "{$cBuddy->playerArray['username']} ".uni_render_coordinates($cBuddy->playerArray); |
|
| 46 | 46 | }; |
| 47 | 47 | |
| 48 | 48 | classSupernova::$gc->buddy->route($cBuddy); |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | ->setIdField($entity->getIdFieldName()) |
| 17 | 17 | ->field('*') |
| 18 | 18 | ->from($entity->getTableName()) |
| 19 | - ->where($entity->getIdFieldName() . ' = "' . $entity->dbId . '"'); |
|
| 19 | + ->where($entity->getIdFieldName().' = "'.$entity->dbId.'"'); |
|
| 20 | 20 | |
| 21 | 21 | $entity->importDbRow($stmt->selectRow()); |
| 22 | 22 | } |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | public function deleteById($entity) { |
| 28 | 28 | $db = $entity->getDbStatic(); |
| 29 | 29 | |
| 30 | - $db->doquery("DELETE FROM `{{" . $entity->getTableName() . "}}` WHERE `{$entity->getIdFieldName()}` = '{$entity->dbId}' LIMIT 1;"); |
|
| 30 | + $db->doquery("DELETE FROM `{{".$entity->getTableName()."}}` WHERE `{$entity->getIdFieldName()}` = '{$entity->dbId}' LIMIT 1;"); |
|
| 31 | 31 | |
| 32 | 32 | return $db->db_affected_rows(); |
| 33 | 33 | } |
@@ -41,8 +41,8 @@ discard block |
||
| 41 | 41 | $query = array(); |
| 42 | 42 | foreach ($entity->exportRowWithoutId() as $fieldName => $fieldValue) { |
| 43 | 43 | // TODO: MORE type detection |
| 44 | - if(!is_numeric($fieldValue)) { |
|
| 45 | - $fieldValue = "'" . $db->db_escape($fieldValue) . "'"; |
|
| 44 | + if (!is_numeric($fieldValue)) { |
|
| 45 | + $fieldValue = "'".$db->db_escape($fieldValue)."'"; |
|
| 46 | 46 | } |
| 47 | 47 | $query[] = "`{$fieldName}` = {$fieldValue}"; |
| 48 | 48 | } |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | return 0; |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - $db->doquery("INSERT INTO `{{" . $entity->getTableName() . "}}` SET " . $query); |
|
| 56 | + $db->doquery("INSERT INTO `{{".$entity->getTableName()."}}` SET ".$query); |
|
| 57 | 57 | |
| 58 | 58 | // TODO Exceptiion if db_insert_id() is empty |
| 59 | 59 | return $entity->dbId = $db->db_insert_id(); |
@@ -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 | |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | |
| 229 | 229 | if (!empty($error_msg)) { |
| 230 | 230 | // TODO - Убрать позже |
| 231 | - print('<h1>СООБЩИТЕ ЭТО АДМИНУ: sn_db_transaction_check() - ' . $error_msg . '</h1>'); |
|
| 231 | + print('<h1>СООБЩИТЕ ЭТО АДМИНУ: sn_db_transaction_check() - '.$error_msg.'</h1>'); |
|
| 232 | 232 | $backtrace = debug_backtrace(); |
| 233 | 233 | array_shift($backtrace); |
| 234 | 234 | pdump($backtrace); |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | public static function db_transaction_start($level = '') { |
| 242 | 242 | static::db_transaction_check(null); |
| 243 | 243 | |
| 244 | - $level ? doquery('SET TRANSACTION ISOLATION LEVEL ' . $level) : false; |
|
| 244 | + $level ? doquery('SET TRANSACTION ISOLATION LEVEL '.$level) : false; |
|
| 245 | 245 | |
| 246 | 246 | static::$transaction_id++; |
| 247 | 247 | doquery('START TRANSACTION'); |
@@ -305,7 +305,7 @@ discard block |
||
| 305 | 305 | public static function db_lock_tables($tables) { |
| 306 | 306 | $tables = is_array($tables) ? $tables : array($tables => ''); |
| 307 | 307 | foreach ($tables as $table_name => $condition) { |
| 308 | - self::$db->doquery("SELECT 1 FROM {{{$table_name}}}" . ($condition ? ' WHERE ' . $condition : '')); |
|
| 308 | + self::$db->doquery("SELECT 1 FROM {{{$table_name}}}".($condition ? ' WHERE '.$condition : '')); |
|
| 309 | 309 | } |
| 310 | 310 | } |
| 311 | 311 | |
@@ -365,8 +365,8 @@ discard block |
||
| 365 | 365 | $query = static::db_query( |
| 366 | 366 | "SELECT |
| 367 | 367 | distinct({{{$location_info[P_TABLE_NAME]}}}.{$owner_data[P_OWNER_FIELD]}) AS parent_id |
| 368 | - FROM {{{$location_info[P_TABLE_NAME]}}}" . |
|
| 369 | - ($filter ? ' WHERE ' . $filter : '') . |
|
| 368 | + FROM {{{$location_info[P_TABLE_NAME]}}}". |
|
| 369 | + ($filter ? ' WHERE '.$filter : ''). |
|
| 370 | 370 | ($fetch ? ' LIMIT 1' : ''), false, true); |
| 371 | 371 | |
| 372 | 372 | while ($row = db_fetch($query)) { |
@@ -379,13 +379,13 @@ discard block |
||
| 379 | 379 | if ($indexes_str = implode(',', $parent_id_list)) { |
| 380 | 380 | $parent_id_field = static::$location_info[$owner_location_type][P_ID]; |
| 381 | 381 | static::db_get_record_list($owner_location_type, |
| 382 | - $parent_id_field . (count($parent_id_list) > 1 ? " IN ({$indexes_str})" : " = {$indexes_str}"), $fetch, true); |
|
| 382 | + $parent_id_field.(count($parent_id_list) > 1 ? " IN ({$indexes_str})" : " = {$indexes_str}"), $fetch, true); |
|
| 383 | 383 | } |
| 384 | 384 | } |
| 385 | 385 | } |
| 386 | 386 | |
| 387 | 387 | $query = static::db_query( |
| 388 | - "SELECT * FROM {{{$location_info[P_TABLE_NAME]}}}" . |
|
| 388 | + "SELECT * FROM {{{$location_info[P_TABLE_NAME]}}}". |
|
| 389 | 389 | (($filter = trim($filter)) ? " WHERE {$filter}" : '') |
| 390 | 390 | ); |
| 391 | 391 | while ($row = db_fetch($query)) { |
@@ -456,7 +456,7 @@ discard block |
||
| 456 | 456 | $condition = trim($condition); |
| 457 | 457 | $table_name = static::$location_info[$location_type][P_TABLE_NAME]; |
| 458 | 458 | |
| 459 | - if ($result = static::db_query("UPDATE {{{$table_name}}} SET " . $set . ($condition ? ' WHERE ' . $condition : ''))) { |
|
| 459 | + if ($result = static::db_query("UPDATE {{{$table_name}}} SET ".$set.($condition ? ' WHERE '.$condition : ''))) { |
|
| 460 | 460 | |
| 461 | 461 | if (static::$db->db_affected_rows()) { // Обновляем данные только если ряд был затронут |
| 462 | 462 | // Поскольку нам неизвестно, что и как обновилось - сбрасываем кэш этого типа полностью |
@@ -614,7 +614,7 @@ discard block |
||
| 614 | 614 | $username_safe = db_escape($like ? strtolower($username_unsafe) : $username_unsafe); // тут на самом деле strtolower() лишняя, но пусть будет |
| 615 | 615 | |
| 616 | 616 | $user = static::db_query( |
| 617 | - "SELECT * FROM {{users}} WHERE `username` " . ($like ? 'LIKE' : '=') . " '{$username_safe}'" |
|
| 617 | + "SELECT * FROM {{users}} WHERE `username` ".($like ? 'LIKE' : '=')." '{$username_safe}'" |
|
| 618 | 618 | , true); |
| 619 | 619 | SnCache::cache_set(LOC_USER, $user); // В кэш-юзер так же заполнять индексы |
| 620 | 620 | } |
@@ -671,7 +671,7 @@ discard block |
||
| 671 | 671 | } |
| 672 | 672 | |
| 673 | 673 | if (SnCache::isUnitLocatorNotSet($location_type, $location_id)) { |
| 674 | - $got_data = static::db_get_record_list(LOC_UNIT, "unit_location_type = {$location_type} AND unit_location_id = {$location_id} AND " . static::db_unit_time_restrictions()); |
|
| 674 | + $got_data = static::db_get_record_list(LOC_UNIT, "unit_location_type = {$location_type} AND unit_location_id = {$location_id} AND ".static::db_unit_time_restrictions()); |
|
| 675 | 675 | if (!empty($got_data) && is_array($got_data)) { |
| 676 | 676 | foreach ($got_data as $unit_id => $unit_data) { |
| 677 | 677 | SnCache::setUnitLocatorByLocationAndIDs($location_type, $location_id, $unit_data); |
@@ -730,7 +730,7 @@ discard block |
||
| 730 | 730 | if ($que_type == QUE_RESEARCH || $planet_id === null) { |
| 731 | 731 | $query[] = "`que_planet_id` IS NULL"; |
| 732 | 732 | } elseif ($planet_id) { |
| 733 | - $query[] = "(`que_planet_id` = {$planet_id}" . ($que_type ? '' : ' OR que_planet_id IS NULL') . ")"; |
|
| 733 | + $query[] = "(`que_planet_id` = {$planet_id}".($que_type ? '' : ' OR que_planet_id IS NULL').")"; |
|
| 734 | 734 | } |
| 735 | 735 | if ($que_type) { |
| 736 | 736 | $query[] = "`que_type` = {$que_type}"; |
@@ -844,13 +844,13 @@ discard block |
||
| 844 | 844 | $condition = "`{$field_name}` = "; |
| 845 | 845 | $value = ''; |
| 846 | 846 | if ($field_data['delta']) { |
| 847 | - $value = "`{$field_name}`" . ($field_data['delta'] >= 0 ? '+' : '') . $field_data['delta']; |
|
| 847 | + $value = "`{$field_name}`".($field_data['delta'] >= 0 ? '+' : '').$field_data['delta']; |
|
| 848 | 848 | } elseif ($field_data['set']) { |
| 849 | 849 | $value = (is_string($field_data['set']) ? "'{$field_data['set']}'" : $field_data['set']); |
| 850 | 850 | } |
| 851 | 851 | |
| 852 | 852 | if ($value) { |
| 853 | - $fields[] = $condition . $value; |
|
| 853 | + $fields[] = $condition.$value; |
|
| 854 | 854 | } |
| 855 | 855 | } |
| 856 | 856 | $conditions[P_FIELDS_STR] = implode(',', $fields); |
@@ -864,9 +864,7 @@ discard block |
||
| 864 | 864 | // Простое условие - $field_id = $field_value |
| 865 | 865 | if (is_string($field_id)) { |
| 866 | 866 | $field_value = |
| 867 | - $field_value === null ? 'NULL' : |
|
| 868 | - (is_string($field_value) ? "'" . db_escape($field_value) . "'" : |
|
| 869 | - (is_bool($field_value) ? intval($field_value) : $field_value)); |
|
| 867 | + $field_value === null ? 'NULL' : (is_string($field_value) ? "'".db_escape($field_value)."'" : (is_bool($field_value) ? intval($field_value) : $field_value)); |
|
| 870 | 868 | $the_conditions[] = "`{$field_id}` = {$field_value}"; |
| 871 | 869 | } else { |
| 872 | 870 | die('Неподдерживаемый тип условия'); |
@@ -893,7 +891,7 @@ discard block |
||
| 893 | 891 | die('Неподдерживаемая операция в classSupernova::db_changeset_condition_compile'); |
| 894 | 892 | } |
| 895 | 893 | |
| 896 | - $conditions[P_QUERY_STR] = $conditions[P_ACTION_STR] . ' ' . $conditions[P_FIELDS_STR] . (' WHERE ' . $conditions[P_WHERE_STR]); |
|
| 894 | + $conditions[P_QUERY_STR] = $conditions[P_ACTION_STR].' '.$conditions[P_FIELDS_STR].(' WHERE '.$conditions[P_WHERE_STR]); |
|
| 897 | 895 | } |
| 898 | 896 | |
| 899 | 897 | public static function db_changeset_apply($db_changeset, $flush_delayed = false) { |
@@ -981,7 +979,7 @@ discard block |
||
| 981 | 979 | ini_get('magic_quotes_sybase') ? die('SN is incompatible with \'magic_quotes_sybase\' turned on. Disable it in php.ini or .htaccess...') : false; |
| 982 | 980 | if (@get_magic_quotes_gpc()) { |
| 983 | 981 | $gpcr = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST); |
| 984 | - array_walk_recursive($gpcr, function (&$value, $key) { |
|
| 982 | + array_walk_recursive($gpcr, function(&$value, $key) { |
|
| 985 | 983 | $value = stripslashes($value); |
| 986 | 984 | }); |
| 987 | 985 | } |
@@ -996,35 +994,35 @@ discard block |
||
| 996 | 994 | static::$gc = new Common\GlobalContainer(); |
| 997 | 995 | $gc = static::$gc; |
| 998 | 996 | |
| 999 | - $gc->db = function ($c) { |
|
| 997 | + $gc->db = function($c) { |
|
| 1000 | 998 | $db = new db_mysql(); |
| 1001 | 999 | $db->sn_db_connect(); |
| 1002 | 1000 | |
| 1003 | 1001 | return $db; |
| 1004 | 1002 | }; |
| 1005 | 1003 | |
| 1006 | - $gc->debug = function ($c) { |
|
| 1004 | + $gc->debug = function($c) { |
|
| 1007 | 1005 | return new debug(); |
| 1008 | 1006 | }; |
| 1009 | 1007 | |
| 1010 | - $gc->cache = function ($c) { |
|
| 1008 | + $gc->cache = function($c) { |
|
| 1011 | 1009 | return new classCache(classSupernova::$cache_prefix); |
| 1012 | 1010 | }; |
| 1013 | 1011 | |
| 1014 | - $gc->config = function ($c) { |
|
| 1012 | + $gc->config = function($c) { |
|
| 1015 | 1013 | return new classConfig(classSupernova::$cache_prefix); |
| 1016 | 1014 | }; |
| 1017 | 1015 | |
| 1018 | - $gc->dbRowOperator = function ($c) { |
|
| 1016 | + $gc->dbRowOperator = function($c) { |
|
| 1019 | 1017 | return new DbRowDirectOperator($c); |
| 1020 | 1018 | }; |
| 1021 | 1019 | |
| 1022 | 1020 | $gc->buddyClass = 'Buddy\BuddyModel'; |
| 1023 | - $gc->buddy = $gc->factory(function (Common\GlobalContainer $c) { |
|
| 1021 | + $gc->buddy = $gc->factory(function(Common\GlobalContainer $c) { |
|
| 1024 | 1022 | return new $c->buddyClass($c); |
| 1025 | 1023 | }); |
| 1026 | 1024 | |
| 1027 | - $gc->query = $gc->factory(function (Common\GlobalContainer $c) { |
|
| 1025 | + $gc->query = $gc->factory(function(Common\GlobalContainer $c) { |
|
| 1028 | 1026 | return new DbQueryConstructor($c->db); |
| 1029 | 1027 | }); |
| 1030 | 1028 | |
@@ -1037,7 +1035,7 @@ discard block |
||
| 1037 | 1035 | public static function init_3_load_config_file() { |
| 1038 | 1036 | $dbsettings = array(); |
| 1039 | 1037 | |
| 1040 | - require(SN_ROOT_PHYSICAL . "config" . DOT_PHP_EX); |
|
| 1038 | + require(SN_ROOT_PHYSICAL."config".DOT_PHP_EX); |
|
| 1041 | 1039 | self::$cache_prefix = !empty($dbsettings['cache_prefix']) ? $dbsettings['cache_prefix'] : $dbsettings['prefix']; |
| 1042 | 1040 | self::$db_name = $dbsettings['name']; |
| 1043 | 1041 | self::$sn_secret_word = $dbsettings['secretword']; |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | ->where('`user_as_ally` IS NULL') |
| 24 | 24 | ->orderBy(array('`id` DESC')); |
| 25 | 25 | |
| 26 | - return (string)$query->selectValue(); |
|
| 26 | + return (string) $query->selectValue(); |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | /** |
@@ -48,15 +48,15 @@ discard block |
||
| 48 | 48 | static::buildDBQ() |
| 49 | 49 | ->field('id') |
| 50 | 50 | ->where("`user_as_ally` IS NULL") |
| 51 | - ->where("`user_bot` = " . USER_BOT_PLAYER) |
|
| 51 | + ->where("`user_bot` = ".USER_BOT_PLAYER) |
|
| 52 | 52 | ->setForUpdate(); |
| 53 | 53 | |
| 54 | 54 | return $query->selectIterator(); |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | public static function db_user_lock_with_target_owner_and_acs($user, $planet = array()) { |
| 58 | - $query = "SELECT 1 FROM `{{users}}` WHERE `id` = " . idval($user['id']) . |
|
| 59 | - (!empty($planet['id_owner']) ? ' OR `id` = ' . idval($planet['id_owner']) : '') |
|
| 58 | + $query = "SELECT 1 FROM `{{users}}` WHERE `id` = ".idval($user['id']). |
|
| 59 | + (!empty($planet['id_owner']) ? ' OR `id` = '.idval($planet['id_owner']) : '') |
|
| 60 | 60 | . " FOR UPDATE"; |
| 61 | 61 | |
| 62 | 62 | static::getDb()->doquery($query); |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | public static function db_user_count($online = false) { |
| 71 | 71 | return intval(static::getDb()->doQueryFetchValue( |
| 72 | - 'SELECT COUNT(`id`) AS `user_count` FROM `{{users}}` WHERE `user_as_ally` IS NULL' . ($online ? ' AND `onlinetime` > ' . (SN_TIME_NOW - classSupernova::$config->game_users_online_timeout) : '') |
|
| 72 | + 'SELECT COUNT(`id`) AS `user_count` FROM `{{users}}` WHERE `user_as_ally` IS NULL'.($online ? ' AND `onlinetime` > '.(SN_TIME_NOW - classSupernova::$config->game_users_online_timeout) : '') |
|
| 73 | 73 | )); |
| 74 | 74 | } |
| 75 | 75 | |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | ->fieldCount('r.id', 'referral_count') |
| 92 | 92 | ->fieldSingleFunction('sum', 'r.dark_matter', 'referral_dm') |
| 93 | 93 | ->join('LEFT JOIN {{referrals}} as r on r.id_partner = u.id') |
| 94 | - ->where($online ? "`onlinetime` >= " . intval(SN_TIME_NOW - classSupernova::$config->game_users_online_timeout) : 'user_as_ally IS NULL') |
|
| 94 | + ->where($online ? "`onlinetime` >= ".intval(SN_TIME_NOW - classSupernova::$config->game_users_online_timeout) : 'user_as_ally IS NULL') |
|
| 95 | 95 | ->groupBy('u.id') |
| 96 | 96 | ->orderBy("user_as_ally, {$sort} ASC"); |
| 97 | 97 | |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | ->where('(`user_birthday_celebrated` IS NULL OR DATE_ADD(`user_birthday_celebrated`, INTERVAL 1 YEAR) < CURRENT_DATE)') |
| 110 | 110 | ->where('`user_as_ally` IS NULL') |
| 111 | 111 | ->having('`days_after_birthday` >= 0') |
| 112 | - ->having('`days_after_birthday` < ' . intval($config_user_birthday_range)) |
|
| 112 | + ->having('`days_after_birthday` < '.intval($config_user_birthday_range)) |
|
| 113 | 113 | ->setForUpdate(); |
| 114 | 114 | |
| 115 | 115 | $result = $query->selectIterator(); |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | public static function db_user_list_set_mass_mail(&$owners_list, $set) { |
| 194 | - return classSupernova::db_upd_record_list(LOC_USER, !empty($owners_list) ? '`id` IN (' . implode(',', $owners_list) . ');' : '', $set); |
|
| 194 | + return classSupernova::db_upd_record_list(LOC_USER, !empty($owners_list) ? '`id` IN ('.implode(',', $owners_list).');' : '', $set); |
|
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | public static function db_user_list_set_by_ally_and_rank($ally_id, $ally_rank_id, $set) { |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | * @param array $playerArray |
| 207 | 207 | */ |
| 208 | 208 | public static function renderNameAndCoordinates($playerArray) { |
| 209 | - return "{$playerArray['username']} " . uni_render_coordinates($playerArray); |
|
| 209 | + return "{$playerArray['username']} ".uni_render_coordinates($playerArray); |
|
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | // // TODO - IoC test |