@@ -75,7 +75,7 @@ |
||
75 | 75 | |
76 | 76 | |
77 | 77 | /** |
78 | - * @param $fleet_group_id_list |
|
78 | + * @param string $fleet_group_id_list |
|
79 | 79 | */ |
80 | 80 | public static function db_acs_delete_by_list($fleet_group_id_list) { |
81 | 81 | doquery("DELETE FROM {{aks}} WHERE `id` IN ({$fleet_group_id_list})"); |
@@ -51,7 +51,7 @@ |
||
51 | 51 | */ |
52 | 52 | public static function db_acs_insert($fleetid, $userId, $objFleet) { |
53 | 53 | classSupernova::$db->doInsertSet(TABLE_AKS, array( |
54 | - 'name' => classLocale::$lang['flt_acs_prefix'] . $fleetid, |
|
54 | + 'name' => classLocale::$lang['flt_acs_prefix'].$fleetid, |
|
55 | 55 | 'teilnehmer' => $userId, |
56 | 56 | 'flotten' => $fleetid, |
57 | 57 | 'ankunft' => $objFleet->time_arrive_to_target, |
@@ -5,7 +5,7 @@ |
||
5 | 5 | /** |
6 | 6 | * @param $user |
7 | 7 | * @param $planet_dst |
8 | - * @param $time_limit |
|
8 | + * @param integer $time_limit |
|
9 | 9 | * |
10 | 10 | * @return array|bool|mysqli_result|null |
11 | 11 | */ |
@@ -2,6 +2,10 @@ |
||
2 | 2 | |
3 | 3 | class DBStaticFleetMissile { |
4 | 4 | |
5 | + /** |
|
6 | + * @param double $arrival |
|
7 | + * @param integer $target_structure |
|
8 | + */ |
|
5 | 9 | public static function db_missile_insert($target_coord, $user, $planetrow, $arrival, $fleet_ship_count, $target_structure) { |
6 | 10 | classSupernova::$db->doInsert( |
7 | 11 | "INSERT INTO `{{iraks}}` SET |
@@ -23,7 +23,7 @@ |
||
23 | 23 | * @return array|bool|mysqli_result|null |
24 | 24 | */ |
25 | 25 | public static function db_missile_list_by_arrival() { |
26 | - $iraks = classSupernova::$db->doSelect("SELECT * FROM `{{iraks}}` WHERE `fleet_end_time` <= " . SN_TIME_NOW . " FOR UPDATE;"); |
|
26 | + $iraks = classSupernova::$db->doSelect("SELECT * FROM `{{iraks}}` WHERE `fleet_end_time` <= ".SN_TIME_NOW." FOR UPDATE;"); |
|
27 | 27 | |
28 | 28 | return $iraks; |
29 | 29 | } |
@@ -467,6 +467,12 @@ |
||
467 | 467 | {$StartRec}, 25;"); |
468 | 468 | } |
469 | 469 | |
470 | + /** |
|
471 | + * @param integer $message_type |
|
472 | + * @param string $from_unsafe |
|
473 | + * @param string $subject_unsafe |
|
474 | + * @param string $text_unsafe |
|
475 | + */ |
|
470 | 476 | public static function db_message_insert_all($message_type, $from_unsafe, $subject_unsafe, $text_unsafe) { |
471 | 477 | $message_type_safe = intval($message_type); |
472 | 478 | $from_safe = db_escape($from_unsafe); |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | sys_user_options_unpack($owner_row); |
114 | 114 | |
115 | 115 | if ($force || !$message_class['switchable'] || $owner_row["opt_{$message_class_name}"]) { |
116 | - $insert_values[] = "('" . idval($owner) . "', '{$sender}', '{$timestamp}', '{$message_type}', '" . db_escape($from_unsafe) . "', '" . db_escape($subject_unsafe) . "', '" . db_escape($text_unsafe) . "')"; |
|
116 | + $insert_values[] = "('".idval($owner)."', '{$sender}', '{$timestamp}', '{$message_type}', '".db_escape($from_unsafe)."', '".db_escape($subject_unsafe)."', '".db_escape($text_unsafe)."')"; |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | // TODO - allow sending HTML email only from admin |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | array(), |
154 | 154 | array( |
155 | 155 | // TODO DANGER |
156 | - '`id` IN (' . implode(',', $owners) . ')', |
|
156 | + '`id` IN ('.implode(',', $owners).')', |
|
157 | 157 | ) |
158 | 158 | ); |
159 | 159 | } |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | $sendList = array(); |
173 | 173 | $list = ''; |
174 | 174 | $query = DBStaticUser::db_user_list( |
175 | - "ally_id = '{$ally_id}'" . ($ally_rank_id >= 0 ? " AND ally_rank_id = {$ally_rank_id}" : ''), |
|
175 | + "ally_id = '{$ally_id}'".($ally_rank_id >= 0 ? " AND ally_rank_id = {$ally_rank_id}" : ''), |
|
176 | 176 | false, 'id, username'); |
177 | 177 | foreach ($query as $u) { |
178 | 178 | $sendList[] = $u['id']; |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | $subject_unsafe = substr($subject_unsafe, strlen(classLocale::$lang['msg_answer_prefix'])); |
262 | 262 | $re++; |
263 | 263 | } |
264 | - $re ? $subject_unsafe = classLocale::$lang['msg_answer_prefix'] . $subject_unsafe : false; |
|
264 | + $re ? $subject_unsafe = classLocale::$lang['msg_answer_prefix'].$subject_unsafe : false; |
|
265 | 265 | |
266 | 266 | $subject_unsafe = $subject_unsafe ? $subject_unsafe : classLocale::$lang['msg_subject_default']; |
267 | 267 | |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | return classSupernova::$db->doSelect( |
438 | 438 | "SELECT * FROM {{messages}} |
439 | 439 | WHERE |
440 | - `message_type` = '" . MSG_TYPE_PLAYER . "' AND |
|
440 | + `message_type` = '" . MSG_TYPE_PLAYER."' AND |
|
441 | 441 | ((`message_owner` = '{$user['id']}' AND `message_sender` = '{$recipient_id}') |
442 | 442 | OR |
443 | 443 | (`message_sender` = '{$user['id']}' AND `message_owner` = '{$recipient_id}')) ORDER BY `message_time` DESC LIMIT 20;"); |
@@ -481,7 +481,7 @@ discard block |
||
481 | 481 | FROM |
482 | 482 | {{messages}} AS m |
483 | 483 | LEFT JOIN {{users}} AS u ON u.id = m.message_owner " . |
484 | - ($int_type_selected >= 0 ? "WHERE `message_type` = {$int_type_selected} " : '') . |
|
484 | + ($int_type_selected >= 0 ? "WHERE `message_type` = {$int_type_selected} " : ''). |
|
485 | 485 | "ORDER BY |
486 | 486 | `message_id` DESC |
487 | 487 | LIMIT |
@@ -494,7 +494,7 @@ discard block |
||
494 | 494 | $subject_safe = db_escape($subject_unsafe); |
495 | 495 | $text_safe = db_escape($text_unsafe); |
496 | 496 | |
497 | - return classSupernova::$db->doInsertComplex('INSERT INTO {{messages}} (`message_owner`, `message_sender`, `message_time`, `message_type`, `message_from`, `message_subject`, `message_text`) ' . |
|
497 | + return classSupernova::$db->doInsertComplex('INSERT INTO {{messages}} (`message_owner`, `message_sender`, `message_time`, `message_type`, `message_from`, `message_subject`, `message_text`) '. |
|
498 | 498 | "SELECT `id`, 0, unix_timestamp(now()), {$message_type_safe}, '{$from_safe}', '{$subject_safe}', '{$text_safe}' FROM {{users}}"); |
499 | 499 | } |
500 | 500 | |
@@ -504,7 +504,7 @@ discard block |
||
504 | 504 | * @return array|bool|mysqli_result|null |
505 | 505 | */ |
506 | 506 | public static function db_message_count_by_type($int_type_selected) { |
507 | - $page_max = classSupernova::$db->doSelectFetch('SELECT COUNT(*) AS `max` FROM `{{messages}}`' . ($int_type_selected >= 0 ? " WHERE `message_type` = {$int_type_selected};" : '')); |
|
507 | + $page_max = classSupernova::$db->doSelectFetch('SELECT COUNT(*) AS `max` FROM `{{messages}}`'.($int_type_selected >= 0 ? " WHERE `message_type` = {$int_type_selected};" : '')); |
|
508 | 508 | |
509 | 509 | return $page_max; |
510 | 510 | } |
@@ -50,8 +50,8 @@ |
||
50 | 50 | |
51 | 51 | /** |
52 | 52 | * @param template $template |
53 | - * @param $query_where |
|
54 | - * @param $query_limit |
|
53 | + * @param string $query_where |
|
54 | + * @param integer $query_limit |
|
55 | 55 | * |
56 | 56 | * @return array|bool|mysqli_result|null |
57 | 57 | */ |
@@ -43,7 +43,7 @@ |
||
43 | 43 | LEFT JOIN {{survey}} AS s ON s.survey_announce_id = a.idAnnounce |
44 | 44 | LEFT JOIN {{users}} AS u ON u.id = a.user_id |
45 | 45 | {$query_where} |
46 | - ORDER BY `tsTimeStamp` DESC, idAnnounce" . |
|
46 | + ORDER BY `tsTimeStamp` DESC, idAnnounce". |
|
47 | 47 | ($query_limit ? " LIMIT {$query_limit}" : '')); |
48 | 48 | |
49 | 49 | $template->assign_var('NEWS_COUNT', classSupernova::$db->db_num_rows($announce_list)); |
@@ -21,11 +21,19 @@ discard block |
||
21 | 21 | return empty($result) ? null : $result; |
22 | 22 | } |
23 | 23 | |
24 | + /** |
|
25 | + * @param integer $galaxy |
|
26 | + * @param integer $system |
|
27 | + * @param integer $planet |
|
28 | + */ |
|
24 | 29 | public static function db_planet_by_gspt_safe($galaxy, $system, $planet, $planet_type, $for_update = false, $fields = '*') { |
25 | 30 | return classSupernova::db_get_record_list(LOC_PLANET, |
26 | 31 | "{{planets}}.`galaxy` = {$galaxy} AND {{planets}}.`system` = {$system} AND {{planets}}.`planet` = {$planet} AND {{planets}}.`planet_type` = {$planet_type}", true); |
27 | 32 | } |
28 | 33 | |
34 | + /** |
|
35 | + * @param integer $planet_type |
|
36 | + */ |
|
29 | 37 | public static function db_planet_by_gspt($galaxy, $system, $planet, $planet_type, $for_update = false, $fields = '*') { |
30 | 38 | $galaxy = intval($galaxy); |
31 | 39 | $system = intval($system); |
@@ -120,6 +128,9 @@ discard block |
||
120 | 128 | "`id_owner` = '{$user_row['id']}' {$conditions} ORDER BY {$order_by}"); |
121 | 129 | } |
122 | 130 | |
131 | + /** |
|
132 | + * @param integer $planet_id |
|
133 | + */ |
|
123 | 134 | public static function db_planet_list_by_user_or_planet($user_id, $planet_id) { |
124 | 135 | if(!($user_id = idval($user_id)) && !($planet_id = idval($planet_id))) { |
125 | 136 | return false; |
@@ -138,6 +149,9 @@ discard block |
||
138 | 149 | return classSupernova::db_upd_record_by_id(LOC_PLANET, $planet_id, $set); |
139 | 150 | } |
140 | 151 | |
152 | + /** |
|
153 | + * @param integer $ui_planet_type |
|
154 | + */ |
|
141 | 155 | public static function db_planet_set_by_gspt($ui_galaxy, $ui_system, $ui_planet, $ui_planet_type = PT_ALL, $set) { |
142 | 156 | if(!($set = trim($set))) { |
143 | 157 | return false; |
@@ -65,11 +65,10 @@ discard block |
||
65 | 65 | } |
66 | 66 | |
67 | 67 | public static function db_planet_by_vector($vector, $prefix = '', $for_update = false, $fields = '*') { |
68 | - $galaxy = isset($vector[$prefix . 'galaxy']) ? intval($vector[$prefix . 'galaxy']) : 0; |
|
69 | - $system = isset($vector[$prefix . 'system']) ? intval($vector[$prefix . 'system']) : 0; |
|
70 | - $planet = isset($vector[$prefix . 'planet']) ? intval($vector[$prefix . 'planet']) : 0; |
|
71 | - $planet_type = isset($vector[$prefix . 'planet_type']) ? intval($vector[$prefix . 'planet_type']) : |
|
72 | - (isset($vector[$prefix . 'type']) ? intval($vector[$prefix . 'type']) : 0); |
|
68 | + $galaxy = isset($vector[$prefix.'galaxy']) ? intval($vector[$prefix.'galaxy']) : 0; |
|
69 | + $system = isset($vector[$prefix.'system']) ? intval($vector[$prefix.'system']) : 0; |
|
70 | + $planet = isset($vector[$prefix.'planet']) ? intval($vector[$prefix.'planet']) : 0; |
|
71 | + $planet_type = isset($vector[$prefix.'planet_type']) ? intval($vector[$prefix.'planet_type']) : (isset($vector[$prefix.'type']) ? intval($vector[$prefix.'type']) : 0); |
|
73 | 72 | $planet_type = $planet_type == PT_DEBRIS ? PT_PLANET : $planet_type; |
74 | 73 | |
75 | 74 | return DBStaticPlanet::db_planet_by_gspt_safe($galaxy, $system, $planet, $planet_type, $for_update, $fields); |
@@ -120,7 +119,7 @@ discard block |
||
120 | 119 | } |
121 | 120 | |
122 | 121 | return classSupernova::$gc->cacheOperator->db_get_record_list(LOC_PLANET, |
123 | - "`planet_type` = " . PT_MOON . " AND `id_owner` = {$user_id} AND `id` != {$this_moon_id}"); |
|
122 | + "`planet_type` = ".PT_MOON." AND `id_owner` = {$user_id} AND `id` != {$this_moon_id}"); |
|
124 | 123 | } |
125 | 124 | |
126 | 125 | public static function db_planet_list_in_system($galaxy, $system) { |
@@ -146,7 +145,7 @@ discard block |
||
146 | 145 | ); |
147 | 146 | $order_by = classSupernova::$user_options[PLAYER_OPTION_PLANET_SORT]; |
148 | 147 | empty($sort_orders[$order_by]) ? $order_by = SORT_ID : false; |
149 | - $order_by = $sort_orders[$order_by] . ' ' . (classSupernova::$user_options[PLAYER_OPTION_PLANET_SORT_INVERSE] == SORT_ASCENDING ? 'ASC' : 'DESC'); |
|
148 | + $order_by = $sort_orders[$order_by].' '.(classSupernova::$user_options[PLAYER_OPTION_PLANET_SORT_INVERSE] == SORT_ASCENDING ? 'ASC' : 'DESC'); |
|
150 | 149 | |
151 | 150 | // Compilating query |
152 | 151 | return classSupernova::$gc->cacheOperator->db_get_record_list(LOC_PLANET, |
@@ -118,6 +118,9 @@ |
||
118 | 118 | return classSupernova::$gc->cacheOperator->db_ins_record(LOC_UNIT, $set); |
119 | 119 | } |
120 | 120 | |
121 | + /** |
|
122 | + * @param integer $unit_location_type |
|
123 | + */ |
|
121 | 124 | public static function db_unit_list_delete($user_id = 0, $unit_location_type, $unit_location_id = 0, $unit_snid = 0) { |
122 | 125 | $where = array('unit_location_type' => $unit_location_type); |
123 | 126 | ($unit_location_id = idval($unit_location_id)) ? $where['unit_location_id'] = $unit_location_id : false; |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | } |
25 | 25 | |
26 | 26 | if (classSupernova::$gc->snCache->isUnitLocatorNotSet($location_type, $location_id)) { |
27 | - $got_data = classSupernova::$gc->cacheOperator->db_get_record_list(LOC_UNIT, "unit_location_type = {$location_type} AND unit_location_id = {$location_id} AND " . DBStaticUnit::db_unit_time_restrictions()); |
|
27 | + $got_data = classSupernova::$gc->cacheOperator->db_get_record_list(LOC_UNIT, "unit_location_type = {$location_type} AND unit_location_id = {$location_id} AND ".DBStaticUnit::db_unit_time_restrictions()); |
|
28 | 28 | if (!empty($got_data) && is_array($got_data)) { |
29 | 29 | foreach ($got_data as $unit_id => $unit_data) { |
30 | 30 | classSupernova::$gc->snCache->setUnitLocatorByLocationAndIDs($location_type, $location_id, $unit_data); |
@@ -59,9 +59,9 @@ discard block |
||
59 | 59 | |
60 | 60 | public static function db_unit_count_by_user_and_type_and_snid($user_id, $unit_type = 0, $unit_snid = 0) { |
61 | 61 | $query = classSupernova::$db->doSelect( |
62 | - "SELECT unit_snid, sum(unit_level) as `qty` FROM {{unit}} WHERE `unit_player_id` = {$user_id} " . |
|
63 | - ($unit_type ? "AND `unit_type` = {$unit_type} " : '') . |
|
64 | - ($unit_snid ? "AND `unit_snid` = {$unit_snid} " : '') . |
|
62 | + "SELECT unit_snid, sum(unit_level) as `qty` FROM {{unit}} WHERE `unit_player_id` = {$user_id} ". |
|
63 | + ($unit_type ? "AND `unit_type` = {$unit_type} " : ''). |
|
64 | + ($unit_snid ? "AND `unit_snid` = {$unit_snid} " : ''). |
|
65 | 65 | 'GROUP BY `unit_snid`' |
66 | 66 | ); |
67 | 67 | $result = array(); |
@@ -81,8 +81,8 @@ discard block |
||
81 | 81 | WHERE |
82 | 82 | f.fleet_owner = {$user_id} AND |
83 | 83 | (f.fleet_start_planet_id = {$location_id} OR f.fleet_end_planet_id = {$location_id}) |
84 | - AND u.unit_snid = {$unit_snid} AND u.`unit_location_type` = " . LOC_FLEET . " AND " . self::db_unit_time_restrictions() . |
|
85 | - " LIMIT 1" . |
|
84 | + AND u.unit_snid = {$unit_snid} AND u.`unit_location_type` = ".LOC_FLEET." AND ".self::db_unit_time_restrictions(). |
|
85 | + " LIMIT 1". |
|
86 | 86 | ($for_update ? ' FOR UPDATE' : '')); |
87 | 87 | } |
88 | 88 | |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | public static function db_unit_list_laboratories($user_id) { |
91 | 91 | return classSupernova::$db->doSelect("SELECT DISTINCT unit_location_id AS `id` |
92 | 92 | FROM {{unit}} |
93 | - WHERE unit_player_id = {$user_id} AND unit_location_type = " . LOC_PLANET . " AND unit_level > 0 AND unit_snid IN (" . STRUC_LABORATORY . ", " . STRUC_LABORATORY_NANO . ");"); |
|
93 | + WHERE unit_player_id = {$user_id} AND unit_location_type = ".LOC_PLANET." AND unit_level > 0 AND unit_snid IN (".STRUC_LABORATORY.", ".STRUC_LABORATORY_NANO.");"); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | /** |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | return classSupernova::$db->doSelect( |
137 | 137 | "SELECT unit_player_id, unit_type, unit_snid, unit_level, count(*) AS unit_amount |
138 | 138 | FROM `{{unit}}` |
139 | - WHERE unit_level > 0 AND " . self::db_unit_time_restrictions() . |
|
139 | + WHERE unit_level > 0 AND " . self::db_unit_time_restrictions(). |
|
140 | 140 | " GROUP BY unit_player_id, unit_type, unit_snid, unit_level" |
141 | 141 | ); |
142 | 142 | } |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | ), |
165 | 165 | array( |
166 | 166 | 'unit_time_finish IS NOT NULL', |
167 | - "unit_time_finish < FROM_UNIXTIME(" . SN_TIME_NOW . ")", |
|
167 | + "unit_time_finish < FROM_UNIXTIME(".SN_TIME_NOW.")", |
|
168 | 168 | ) |
169 | 169 | ); |
170 | 170 | } |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | |
204 | 204 | $temp = DBStaticUnit::db_get_unit_by_location($user['id'], $unit_location, $location_id, $unit_id, true, 'unit_id'); |
205 | 205 | if (!empty($temp['unit_id'])) { |
206 | - $result = (bool)classSupernova::$gc->cacheOperator->db_upd_record_by_id( |
|
206 | + $result = (bool) classSupernova::$gc->cacheOperator->db_upd_record_by_id( |
|
207 | 207 | LOC_UNIT, |
208 | 208 | $temp['unit_id'], |
209 | 209 | array(), |
@@ -214,15 +214,15 @@ discard block |
||
214 | 214 | } else { |
215 | 215 | $locationIdRendered = $unit_location == LOC_USER ? $user['id'] : $planet_id; |
216 | 216 | $unitType = get_unit_param($unit_id, P_UNIT_TYPE); |
217 | - $result = (bool)classSupernova::$gc->cacheOperator->db_ins_record( |
|
217 | + $result = (bool) classSupernova::$gc->cacheOperator->db_ins_record( |
|
218 | 218 | LOC_UNIT, |
219 | 219 | array( |
220 | 220 | 'unit_player_id' => $user['id'], |
221 | - 'unit_location_type' => (int)$unit_location, |
|
221 | + 'unit_location_type' => (int) $unit_location, |
|
222 | 222 | 'unit_location_id' => $locationIdRendered, |
223 | - 'unit_type' => (int)$unitType, |
|
224 | - 'unit_snid' => (int)$unit_id, |
|
225 | - 'unit_level' => (float)$unit_value, |
|
223 | + 'unit_type' => (int) $unitType, |
|
224 | + 'unit_snid' => (int) $unit_id, |
|
225 | + 'unit_level' => (float) $unit_value, |
|
226 | 226 | ) |
227 | 227 | ); |
228 | 228 | } |
@@ -40,6 +40,7 @@ discard block |
||
40 | 40 | } |
41 | 41 | |
42 | 42 | /** |
43 | + * @param string $fields |
|
43 | 44 | * @return DbResultIterator |
44 | 45 | */ |
45 | 46 | protected static function playerSelectIterator($fields, $orderBy = '', $forUpdate = false, $groupHaving = '', $where = '', $limit = '') { |
@@ -134,6 +135,9 @@ discard block |
||
134 | 135 | return $result; |
135 | 136 | } |
136 | 137 | |
138 | + /** |
|
139 | + * @param integer $config_user_birthday_range |
|
140 | + */ |
|
137 | 141 | public static function db_user_list_to_celebrate($config_user_birthday_range) { |
138 | 142 | $query = "SELECT |
139 | 143 | `id`, `username`, `user_birthday`, `user_birthday_celebrated`, |
@@ -213,6 +217,9 @@ discard block |
||
213 | 217 | return $user_list; |
214 | 218 | } |
215 | 219 | |
220 | + /** |
|
221 | + * @param string $username_unsafe |
|
222 | + */ |
|
216 | 223 | public static function db_user_by_username($username_unsafe, $for_update = false, $fields = '*', $player = null, $like = false) { |
217 | 224 | // TODO Проверить, кстати - а везде ли нужно выбирать юзеров или где-то все-таки ищутся Альянсы ? |
218 | 225 | if (!($username_unsafe = trim($username_unsafe))) { |
@@ -266,7 +273,6 @@ discard block |
||
266 | 273 | |
267 | 274 | /** |
268 | 275 | * @param $user_id |
269 | - * @param array $set |
|
270 | 276 | * @param array $adjust |
271 | 277 | * |
272 | 278 | * @return array|bool|mysqli_result|null |
@@ -283,8 +289,8 @@ discard block |
||
283 | 289 | * <p>array - запись пользователя с установленным полем ['id']</p> |
284 | 290 | * @param bool $for_update @deprecated |
285 | 291 | * @param string $fields @deprecated список полей или '*'/'' для всех полей |
286 | - * @param null $player |
|
287 | - * @param bool|null $player Признак выбора записи пользователь типа "игрок" |
|
292 | + * @param boolean $player |
|
293 | + * @param boolean $player Признак выбора записи пользователь типа "игрок" |
|
288 | 294 | * <p>null - Можно выбрать запись любого типа</p> |
289 | 295 | * <p>true - Выбирается только запись типа "игрок"</p> |
290 | 296 | * <p>false - Выбирается только запись типа "альянс"</p> |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | */ |
39 | 39 | // TODO - remove or use something else |
40 | 40 | public static function renderNameAndCoordinates($playerArray) { |
41 | - return "{$playerArray['username']} " . uni_render_coordinates($playerArray); |
|
41 | + return "{$playerArray['username']} ".uni_render_coordinates($playerArray); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | * @return int |
116 | 116 | */ |
117 | 117 | public static function db_user_count($online = false) { |
118 | - $iterator = static::playerSelectIterator('COUNT(`id`)', '', false, '', ($online ? '`onlinetime` > ' . (SN_TIME_NOW - classSupernova::$config->game_users_online_timeout) : '')); |
|
118 | + $iterator = static::playerSelectIterator('COUNT(`id`)', '', false, '', ($online ? '`onlinetime` > '.(SN_TIME_NOW - classSupernova::$config->game_users_online_timeout) : '')); |
|
119 | 119 | |
120 | 120 | return intval(classSupernova::$db->getDbIteratorFirstValue($iterator)); |
121 | 121 | } |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | LEFT JOIN |
129 | 129 | {{referrals}} as r on r.id_partner = u.id |
130 | 130 | WHERE " . |
131 | - ($online ? "`onlinetime` >= " . intval(SN_TIME_NOW - classSupernova::$config->game_users_online_timeout) : 'user_as_ally IS NULL') . |
|
131 | + ($online ? "`onlinetime` >= ".intval(SN_TIME_NOW - classSupernova::$config->game_users_online_timeout) : 'user_as_ally IS NULL'). |
|
132 | 132 | " GROUP BY u.id |
133 | 133 | ORDER BY user_as_ally, {$sort} ASC"; |
134 | 134 | $result = classSupernova::$db->doSelectIterator($query); |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | `{{users}}` |
146 | 146 | WHERE |
147 | 147 | `user_as_ally` IS NULL |
148 | - AND `user_bot` = " . USER_BOT_PLAYER . " |
|
148 | + AND `user_bot` = " . USER_BOT_PLAYER." |
|
149 | 149 | AND `user_birthday` IS NOT NULL |
150 | 150 | AND (`user_birthday_celebrated` IS NULL OR DATE_ADD(`user_birthday_celebrated`, INTERVAL 1 YEAR) < CURRENT_DATE) |
151 | 151 | HAVING |
@@ -166,8 +166,8 @@ discard block |
||
166 | 166 | $query = |
167 | 167 | "SELECT 1 |
168 | 168 | FROM `{{users}}` |
169 | - WHERE `id` = " . idval($user['id']) . |
|
170 | - (!empty($planet['id_owner']) ? ' OR `id` = ' . idval($planet['id_owner']) : '') . |
|
169 | + WHERE `id` = " . idval($user['id']). |
|
170 | + (!empty($planet['id_owner']) ? ' OR `id` = '.idval($planet['id_owner']) : ''). |
|
171 | 171 | " FOR UPDATE"; |
172 | 172 | |
173 | 173 | classSupernova::$db->doSelect($query); |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | $username_safe = db_escape($like ? strtolower($username_unsafe) : $username_unsafe); // тут на самом деле strtolower() лишняя, но пусть будет |
244 | 244 | |
245 | 245 | $user = classSupernova::$db->doSelectFetch( |
246 | - "SELECT * FROM {{users}} WHERE `username` " . ($like ? 'LIKE' : '=') . " '{$username_safe}'" |
|
246 | + "SELECT * FROM {{users}} WHERE `username` ".($like ? 'LIKE' : '=')." '{$username_safe}'" |
|
247 | 247 | . " FOR UPDATE" |
248 | 248 | ); |
249 | 249 | classSupernova::$gc->snCache->cache_set(LOC_USER, $user); // В кэш-юзер так же заполнять индексы |
@@ -187,6 +187,9 @@ |
||
187 | 187 | return $error_backtrace; |
188 | 188 | } |
189 | 189 | |
190 | + /** |
|
191 | + * @param string $die_message |
|
192 | + */ |
|
190 | 193 | public function error_fatal($die_message, $details = 'There is a fatal error on page') { |
191 | 194 | // TODO - Записывать детали ошибки в лог-файл |
192 | 195 | die($die_message); |
@@ -32,10 +32,10 @@ discard block |
||
32 | 32 | |
33 | 33 | defined('INSIDE') || die(); |
34 | 34 | |
35 | -if(php_sapi_name() == "cli") { |
|
35 | +if (php_sapi_name() == "cli") { |
|
36 | 36 | // In cli-mode |
37 | 37 | define('__DEBUG_CRLF', "\r\n"); |
38 | - define('__DEBUG_LINE', '-------------------------------------------------' . __DEBUG_CRLF); |
|
38 | + define('__DEBUG_LINE', '-------------------------------------------------'.__DEBUG_CRLF); |
|
39 | 39 | } else { |
40 | 40 | // Not in cli-mode |
41 | 41 | define('__DEBUG_CRLF', '<br />'); |
@@ -52,17 +52,17 @@ discard block |
||
52 | 52 | public function log_file($message, $ident_change = 0) { |
53 | 53 | static $ident = 0; |
54 | 54 | |
55 | - if(!defined('SN_DEBUG_LOG')) { |
|
55 | + if (!defined('SN_DEBUG_LOG')) { |
|
56 | 56 | return; |
57 | 57 | } |
58 | 58 | |
59 | - if($this->log_file_handler === null) { |
|
60 | - $this->log_file_handler = @fopen(SN_ROOT_PHYSICAL . '/.logs/supernova.log', 'a+'); |
|
59 | + if ($this->log_file_handler === null) { |
|
60 | + $this->log_file_handler = @fopen(SN_ROOT_PHYSICAL.'/.logs/supernova.log', 'a+'); |
|
61 | 61 | @fwrite($this->log_file_handler, "\r\n\r\n"); |
62 | 62 | } |
63 | 63 | $ident_change < 0 ? $ident += $ident_change * 2 : false; |
64 | - if($this->log_file_handler) { |
|
65 | - @fwrite($this->log_file_handler, date(FMT_DATE_TIME_SQL, time()) . str_repeat(' ', $ident + 1) . $message . "\r\n"); |
|
64 | + if ($this->log_file_handler) { |
|
65 | + @fwrite($this->log_file_handler, date(FMT_DATE_TIME_SQL, time()).str_repeat(' ', $ident + 1).$message."\r\n"); |
|
66 | 66 | } |
67 | 67 | $ident_change > 0 ? $ident += $ident_change * 2 : false; |
68 | 68 | } |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | } |
83 | 83 | |
84 | 84 | public function echo_log() { |
85 | - echo '<br><table><tr><td class=k colspan=4><a href="' . SN_ROOT_PHYSICAL . "admin/settings.php\">Debug Log</a>:</td></tr>{$this->log}</table>"; |
|
85 | + echo '<br><table><tr><td class=k colspan=4><a href="'.SN_ROOT_PHYSICAL."admin/settings.php\">Debug Log</a>:</td></tr>{$this->log}</table>"; |
|
86 | 86 | die(); |
87 | 87 | } |
88 | 88 | |
@@ -92,25 +92,25 @@ discard block |
||
92 | 92 | $result = array(); |
93 | 93 | $transaction_id = classSupernova::$db->getTransaction()->getNextQueryTransactionId(); |
94 | 94 | $result[] = "tID {$transaction_id}"; |
95 | - foreach($backtrace as $a_trace) { |
|
96 | - if(in_array($a_trace['function'], $exclude_functions)) { |
|
95 | + foreach ($backtrace as $a_trace) { |
|
96 | + if (in_array($a_trace['function'], $exclude_functions)) { |
|
97 | 97 | continue; |
98 | 98 | } |
99 | 99 | $function = |
100 | 100 | ($a_trace['type'] |
101 | 101 | ? ($a_trace['type'] == '->' |
102 | - ? "({$a_trace['class']})" . get_class($a_trace['object']) |
|
102 | + ? "({$a_trace['class']})".get_class($a_trace['object']) |
|
103 | 103 | : $a_trace['class'] |
104 | - ) . $a_trace['type'] |
|
104 | + ).$a_trace['type'] |
|
105 | 105 | : '' |
106 | - ) . $a_trace['function'] . '()'; |
|
106 | + ).$a_trace['function'].'()'; |
|
107 | 107 | |
108 | 108 | $file = str_replace(SN_ROOT_PHYSICAL, '', str_replace('\\', '/', $a_trace['file'])); |
109 | 109 | |
110 | 110 | // $result[] = "{$function} ({$a_trace['line']})'{$file}'"; |
111 | 111 | $result[] = "{$function} - '{$file}' Line {$a_trace['line']}"; |
112 | 112 | |
113 | - if(!$long_comment) { |
|
113 | + if (!$long_comment) { |
|
114 | 114 | break; |
115 | 115 | } |
116 | 116 | } |
@@ -124,26 +124,26 @@ discard block |
||
124 | 124 | public function dump($dump = false, $force_base = false, $deadlock = false) { |
125 | 125 | global $user, $planetrow; |
126 | 126 | |
127 | - if($dump === false) { |
|
127 | + if ($dump === false) { |
|
128 | 128 | return; |
129 | 129 | } |
130 | 130 | |
131 | 131 | $error_backtrace = array(); |
132 | 132 | $base_dump = false; |
133 | 133 | |
134 | - if($force_base === true) { |
|
134 | + if ($force_base === true) { |
|
135 | 135 | $base_dump = true; |
136 | 136 | } |
137 | 137 | |
138 | - if($dump === true) { |
|
138 | + if ($dump === true) { |
|
139 | 139 | $base_dump = true; |
140 | 140 | } else { |
141 | - if(!is_array($dump)) { |
|
141 | + if (!is_array($dump)) { |
|
142 | 142 | $dump = array('var' => $dump); |
143 | 143 | } |
144 | 144 | |
145 | - foreach($dump as $dump_var_name => $dump_var) { |
|
146 | - if($dump_var_name == 'base_dump') { |
|
145 | + foreach ($dump as $dump_var_name => $dump_var) { |
|
146 | + if ($dump_var_name == 'base_dump') { |
|
147 | 147 | $base_dump = $dump_var; |
148 | 148 | } else { |
149 | 149 | $error_backtrace[$dump_var_name] = $dump_var; |
@@ -151,22 +151,21 @@ discard block |
||
151 | 151 | } |
152 | 152 | } |
153 | 153 | |
154 | - if($deadlock && ($q = db_fetch(classSupernova::$db->mysql_get_innodb_status()))) { |
|
154 | + if ($deadlock && ($q = db_fetch(classSupernova::$db->mysql_get_innodb_status()))) { |
|
155 | 155 | $error_backtrace['deadlock'] = explode("\n", $q['Status']); |
156 | 156 | $error_backtrace['locks'] = classSupernova::$gc->snCache->getLocks(); |
157 | 157 | $error_backtrace['cSN_data'] = classSupernova::$gc->snCache->getData(); |
158 | - foreach($error_backtrace['cSN_data'] as &$location) { |
|
159 | - foreach($location as $location_id => &$location_data) { |
|
160 | - $location_data = isset($location_data['username']) ? $location_data['username'] : |
|
161 | - (isset($location_data['name']) ? $location_data['name'] : $location_id); |
|
158 | + foreach ($error_backtrace['cSN_data'] as &$location) { |
|
159 | + foreach ($location as $location_id => &$location_data) { |
|
160 | + $location_data = isset($location_data['username']) ? $location_data['username'] : (isset($location_data['name']) ? $location_data['name'] : $location_id); |
|
162 | 161 | } |
163 | 162 | } |
164 | 163 | $error_backtrace['cSN_queries'] = classSupernova::$gc->snCache->getQueries(); |
165 | 164 | } |
166 | 165 | |
167 | - if($base_dump) { |
|
168 | - if(is_array($this->log_array) && count($this->log_array) > 0) { |
|
169 | - foreach($this->log_array as $log) { |
|
166 | + if ($base_dump) { |
|
167 | + if (is_array($this->log_array) && count($this->log_array) > 0) { |
|
168 | + foreach ($this->log_array as $log) { |
|
170 | 169 | $error_backtrace['queries'][] = $log; |
171 | 170 | } |
172 | 171 | } |
@@ -195,14 +194,14 @@ discard block |
||
195 | 194 | public function error($message = 'There is a error on page', $title = 'Internal Error', $error_code = 500, $dump = true) { |
196 | 195 | global $sys_stop_log_hit, $sys_log_disabled, $user; |
197 | 196 | |
198 | - if(empty(classSupernova::$db->connected)) { |
|
197 | + if (empty(classSupernova::$db->connected)) { |
|
199 | 198 | // TODO - писать ошибку в файл |
200 | 199 | die('SQL server currently unavailable. Please contact Administration...'); |
201 | 200 | } |
202 | 201 | |
203 | 202 | sn_db_transaction_rollback(); |
204 | 203 | |
205 | - if(classSupernova::$config->debug == 1) { |
|
204 | + if (classSupernova::$config->debug == 1) { |
|
206 | 205 | echo "<h2>{$title}</h2><br><font color=red>{$message}</font><br><hr>"; |
207 | 206 | echo "<table>{$this->log}</table>"; |
208 | 207 | } |
@@ -214,16 +213,16 @@ discard block |
||
214 | 213 | |
215 | 214 | $userId = empty($user['id']) ? 0 : $user['id']; |
216 | 215 | |
217 | - if(!$sys_log_disabled) { |
|
216 | + if (!$sys_log_disabled) { |
|
218 | 217 | $query = "INSERT INTO `{{logs}}` SET |
219 | - `log_time` = '" . time() . "', `log_code` = '" . db_escape($error_code) . "', `log_sender` = '" . db_escape($userId) . "', |
|
220 | - `log_username` = '" . db_escape($user['user_name']) . "', `log_title` = '" . db_escape($title) . "', `log_text` = '" . db_escape($message) . "', |
|
221 | - `log_page` = '" . db_escape(strpos($_SERVER['SCRIPT_NAME'], SN_ROOT_RELATIVE) === false ? $_SERVER['SCRIPT_NAME'] : substr($_SERVER['SCRIPT_NAME'], strlen(SN_ROOT_RELATIVE))) . "'" . |
|
218 | + `log_time` = '" . time()."', `log_code` = '".db_escape($error_code)."', `log_sender` = '".db_escape($userId)."', |
|
219 | + `log_username` = '" . db_escape($user['user_name'])."', `log_title` = '".db_escape($title)."', `log_text` = '".db_escape($message)."', |
|
220 | + `log_page` = '" . db_escape(strpos($_SERVER['SCRIPT_NAME'], SN_ROOT_RELATIVE) === false ? $_SERVER['SCRIPT_NAME'] : substr($_SERVER['SCRIPT_NAME'], strlen(SN_ROOT_RELATIVE)))."'". |
|
222 | 221 | // ($error_backtrace ? ", `log_dump` = '" . db_escape(serialize($error_backtrace)) . "'" : '') . ";"; |
223 | - ", `log_dump` = '" . ($error_backtrace ? db_escape(serialize($error_backtrace)) : '') . "'" . ";"; |
|
224 | - classSupernova::$db->doSql($query, true) or die($fatal_error . classSupernova::$db->db_error()); |
|
222 | + ", `log_dump` = '".($error_backtrace ? db_escape(serialize($error_backtrace)) : '')."'".";"; |
|
223 | + classSupernova::$db->doSql($query, true) or die($fatal_error.classSupernova::$db->db_error()); |
|
225 | 224 | |
226 | - $message = "Пожалуйста, свяжитесь с админом, если ошибка повторится. Ошибка №: <b>" . classSupernova::$db->db_insert_id() . "</b>"; |
|
225 | + $message = "Пожалуйста, свяжитесь с админом, если ошибка повторится. Ошибка №: <b>".classSupernova::$db->db_insert_id()."</b>"; |
|
227 | 226 | |
228 | 227 | $sys_stop_log_hit = true; |
229 | 228 | $sys_log_disabled = true; |
@@ -233,7 +232,7 @@ discard block |
||
233 | 232 | ob_start(); |
234 | 233 | print("<hr>User ID {$user['id']} raised error code {$error_code} titled '{$title}' with text '{$error_text}' on page {$_SERVER['SCRIPT_NAME']}"); |
235 | 234 | |
236 | - foreach($error_backtrace as $name => $value) { |
|
235 | + foreach ($error_backtrace as $name => $value) { |
|
237 | 236 | print(__DEBUG_LINE); |
238 | 237 | pdump($value, $name); |
239 | 238 | } |
@@ -245,7 +244,7 @@ discard block |
||
245 | 244 | public function warning($message, $title = 'System Message', $log_code = 300, $dump = false) { |
246 | 245 | global $user, $sys_log_disabled; |
247 | 246 | |
248 | - if(empty(classSupernova::$db->connected)) { |
|
247 | + if (empty(classSupernova::$db->connected)) { |
|
249 | 248 | // TODO - писать ошибку в файл |
250 | 249 | die('SQL server currently unavailable. Please contact Administration...'); |
251 | 250 | } |
@@ -254,12 +253,12 @@ discard block |
||
254 | 253 | |
255 | 254 | $userId = empty($user['id']) ? 0 : $user['id']; |
256 | 255 | |
257 | - if(!$sys_log_disabled) { |
|
256 | + if (!$sys_log_disabled) { |
|
258 | 257 | $query = "INSERT INTO `{{logs}}` SET |
259 | - `log_time` = '" . time() . "', `log_code` = '" . db_escape($log_code) . "', `log_sender` = '" . db_escape($userId) . "', |
|
260 | - `log_username` = '" . db_escape($user['user_name']) . "', `log_title` = '" . db_escape($title) . "', `log_text` = '" . db_escape($message) . "', |
|
261 | - `log_page` = '" . db_escape(strpos($_SERVER['SCRIPT_NAME'], SN_ROOT_RELATIVE) === false ? $_SERVER['SCRIPT_NAME'] : substr($_SERVER['SCRIPT_NAME'], strlen(SN_ROOT_RELATIVE))) . "'" . |
|
262 | - ", `log_dump` = '" . ($error_backtrace ? db_escape(serialize($error_backtrace)) : '') . "'" . ";"; |
|
258 | + `log_time` = '" . time()."', `log_code` = '".db_escape($log_code)."', `log_sender` = '".db_escape($userId)."', |
|
259 | + `log_username` = '" . db_escape($user['user_name'])."', `log_title` = '".db_escape($title)."', `log_text` = '".db_escape($message)."', |
|
260 | + `log_page` = '" . db_escape(strpos($_SERVER['SCRIPT_NAME'], SN_ROOT_RELATIVE) === false ? $_SERVER['SCRIPT_NAME'] : substr($_SERVER['SCRIPT_NAME'], strlen(SN_ROOT_RELATIVE)))."'". |
|
261 | + ", `log_dump` = '".($error_backtrace ? db_escape(serialize($error_backtrace)) : '')."'".";"; |
|
263 | 262 | classSupernova::$db->doSql($query, true); |
264 | 263 | } else { |
265 | 264 | // // TODO Здесь надо писать в файло |
@@ -272,11 +271,11 @@ discard block |
||
272 | 271 | // Dump variables nicer then var_dump() |
273 | 272 | |
274 | 273 | function dump($value, $varname = null, $level = 0, $dumper = '') { |
275 | - if(isset($varname)) { |
|
274 | + if (isset($varname)) { |
|
276 | 275 | $varname .= " = "; |
277 | 276 | } |
278 | 277 | |
279 | - if($level == -1) { |
|
278 | + if ($level == -1) { |
|
280 | 279 | $trans[' '] = '∴'; |
281 | 280 | $trans["\t"] = '⇒'; |
282 | 281 | $trans["\n"] = '¶;'; |
@@ -285,31 +284,31 @@ discard block |
||
285 | 284 | |
286 | 285 | return strtr(htmlspecialchars($value), $trans); |
287 | 286 | } |
288 | - if($level == 0) { |
|
287 | + if ($level == 0) { |
|
289 | 288 | // $dumper = '<pre>' . mt_rand(10, 99) . '|' . $varname; |
290 | - $dumper = mt_rand(10, 99) . '|' . $varname; |
|
289 | + $dumper = mt_rand(10, 99).'|'.$varname; |
|
291 | 290 | } |
292 | 291 | |
293 | 292 | $type = gettype($value); |
294 | 293 | $dumper .= $type; |
295 | 294 | |
296 | - if($type == TYPE_STRING) { |
|
297 | - $dumper .= '(' . strlen($value) . ')'; |
|
295 | + if ($type == TYPE_STRING) { |
|
296 | + $dumper .= '('.strlen($value).')'; |
|
298 | 297 | $value = dump($value, '', -1); |
299 | - } elseif($type == TYPE_BOOLEAN) { |
|
298 | + } elseif ($type == TYPE_BOOLEAN) { |
|
300 | 299 | $value = ($value ? 'true' : 'false'); |
301 | - } elseif($type == 'object') { |
|
300 | + } elseif ($type == 'object') { |
|
302 | 301 | $props = get_class_vars(get_class($value)); |
303 | - $dumper .= '(' . count($props) . ') <u>' . get_class($value) . '</u>'; |
|
304 | - foreach($props as $key => $val) { |
|
305 | - $dumper .= "\n" . str_repeat("\t", $level + 1) . $key . ' => '; |
|
302 | + $dumper .= '('.count($props).') <u>'.get_class($value).'</u>'; |
|
303 | + foreach ($props as $key => $val) { |
|
304 | + $dumper .= "\n".str_repeat("\t", $level + 1).$key.' => '; |
|
306 | 305 | $dumper .= dump($value->$key, '', $level + 1); |
307 | 306 | } |
308 | 307 | $value = ''; |
309 | - } elseif($type == TYPE_ARRAY) { |
|
310 | - $dumper .= '(' . count($value) . ')'; |
|
311 | - foreach($value as $key => $val) { |
|
312 | - $dumper .= "\n" . str_repeat("\t", $level + 1) . dump($key, '', -1) . ' => '; |
|
308 | + } elseif ($type == TYPE_ARRAY) { |
|
309 | + $dumper .= '('.count($value).')'; |
|
310 | + foreach ($value as $key => $val) { |
|
311 | + $dumper .= "\n".str_repeat("\t", $level + 1).dump($key, '', -1).' => '; |
|
313 | 312 | $dumper .= dump($val, '', $level + 1); |
314 | 313 | } |
315 | 314 | $value = ''; |
@@ -328,24 +327,24 @@ discard block |
||
328 | 327 | // $backtrace = $backtrace[1]; |
329 | 328 | |
330 | 329 | $caller = ''; |
331 | - if(defined('SN_DEBUG_PDUMP_CALLER') && SN_DEBUG_PDUMP_CALLER) { |
|
332 | - $caller = (!empty($backtrace[1]['class']) ? $backtrace[1]['class'] : '') . |
|
333 | - (!empty($backtrace[1]['type']) ? $backtrace[1]['type'] : '') . |
|
334 | - $backtrace[1]['function'] . |
|
330 | + if (defined('SN_DEBUG_PDUMP_CALLER') && SN_DEBUG_PDUMP_CALLER) { |
|
331 | + $caller = (!empty($backtrace[1]['class']) ? $backtrace[1]['class'] : ''). |
|
332 | + (!empty($backtrace[1]['type']) ? $backtrace[1]['type'] : ''). |
|
333 | + $backtrace[1]['function']. |
|
335 | 334 | (!empty($backtrace[0]['file']) |
336 | 335 | ? ( |
337 | - ' (' . substr($backtrace[0]['file'], SN_ROOT_PHYSICAL_STR_LEN) . |
|
338 | - (!empty($backtrace[0]['line']) ? ':' . $backtrace[0]['line'] : '') . |
|
336 | + ' ('.substr($backtrace[0]['file'], SN_ROOT_PHYSICAL_STR_LEN). |
|
337 | + (!empty($backtrace[0]['line']) ? ':'.$backtrace[0]['line'] : ''). |
|
339 | 338 | ')' |
340 | 339 | ) |
341 | 340 | : '' |
342 | 341 | ); |
343 | - $caller = "\r\n" . $caller; |
|
342 | + $caller = "\r\n".$caller; |
|
344 | 343 | } |
345 | 344 | |
346 | - print('<pre style="text-align: left; background-color: #111111; color: #0A0; font-family: Courier, monospace !important; padding: 1em 0; font-weight: 800; font-size: 14px;">' . |
|
347 | - dump($value, $varname) . |
|
348 | - $caller . |
|
345 | + print('<pre style="text-align: left; background-color: #111111; color: #0A0; font-family: Courier, monospace !important; padding: 1em 0; font-weight: 800; font-size: 14px;">'. |
|
346 | + dump($value, $varname). |
|
347 | + $caller. |
|
349 | 348 | '</pre>' |
350 | 349 | ); |
351 | 350 | } |
@@ -355,24 +354,24 @@ discard block |
||
355 | 354 | } |
356 | 355 | |
357 | 356 | function pr($prePrint = false) { |
358 | - if($prePrint) { |
|
357 | + if ($prePrint) { |
|
359 | 358 | print(__DEBUG_CRLF); |
360 | 359 | } |
361 | - print(mt_rand() . __DEBUG_CRLF); |
|
360 | + print(mt_rand().__DEBUG_CRLF); |
|
362 | 361 | } |
363 | 362 | |
364 | 363 | function pc($prePrint = false) { |
365 | 364 | global $_PRINT_COUNT_VALUE; |
366 | 365 | $_PRINT_COUNT_VALUE++; |
367 | 366 | |
368 | - if($prePrint) { |
|
367 | + if ($prePrint) { |
|
369 | 368 | print(__DEBUG_CRLF); |
370 | 369 | } |
371 | - print($_PRINT_COUNT_VALUE . __DEBUG_CRLF); |
|
370 | + print($_PRINT_COUNT_VALUE.__DEBUG_CRLF); |
|
372 | 371 | } |
373 | 372 | |
374 | 373 | function prep($message) { |
375 | - print('<pre>' . $message . '</pre>'); |
|
374 | + print('<pre>'.$message.'</pre>'); |
|
376 | 375 | } |
377 | 376 | |
378 | 377 | function backtrace_no_arg() { |
@@ -396,9 +395,9 @@ discard block |
||
396 | 395 | */ |
397 | 396 | function pdie($message = '', $level = 0) { |
398 | 397 | $backtrace = debug_backtrace(); |
399 | - for($i = 0; $i < $level; $i++) { |
|
398 | + for ($i = 0; $i < $level; $i++) { |
|
400 | 399 | array_pop($backtrace); |
401 | 400 | } |
402 | 401 | |
403 | - die(__DEBUG_LINE . ($message ? $message . ' @ ' : '') . $backtrace[0]['file'] . ':' . $backtrace[0]['line']); |
|
402 | + die(__DEBUG_LINE.($message ? $message.' @ ' : '').$backtrace[0]['file'].':'.$backtrace[0]['line']); |
|
404 | 403 | } |