@@ -57,9 +57,11 @@ discard block |
||
| 57 | 57 | throw new exception('buddy_err_delete_alien', ERR_ERROR); |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - if($buddy_row['BUDDY_STATUS'] == BUDDY_REQUEST_ACTIVE) // Existing friendship |
|
| 60 | + if($buddy_row['BUDDY_STATUS'] == BUDDY_REQUEST_ACTIVE) { |
|
| 61 | + // Existing friendship |
|
| 61 | 62 | { |
| 62 | 63 | $ex_friend_id = $buddy_row['BUDDY_SENDER_ID'] == $user['id'] ? $buddy_row['BUDDY_OWNER_ID'] : $buddy_row['BUDDY_SENDER_ID']; |
| 64 | + } |
|
| 63 | 65 | |
| 64 | 66 | msg_send_simple_message($ex_friend_id, $user['id'], SN_TIME_NOW, MSG_TYPE_PLAYER, $user['username'], $lang['buddy_msg_unfriend_title'], |
| 65 | 67 | sprintf($lang['buddy_msg_unfriend_text'], $user['username'])); |
@@ -67,15 +69,19 @@ discard block |
||
| 67 | 69 | db_buddy_delete($buddy_id); |
| 68 | 70 | sn_db_transaction_commit(); |
| 69 | 71 | throw new exception('buddy_err_unfriend_none', ERR_NONE); |
| 70 | - } elseif($buddy_row['BUDDY_SENDER_ID'] == $user['id']) // Player's outcoming request - either denied or waiting |
|
| 72 | + } elseif($buddy_row['BUDDY_SENDER_ID'] == $user['id']) { |
|
| 73 | + // Player's outcoming request - either denied or waiting |
|
| 71 | 74 | { |
| 72 | 75 | db_buddy_delete($buddy_id); |
| 76 | + } |
|
| 73 | 77 | sn_db_transaction_commit(); |
| 74 | 78 | throw new exception('buddy_err_delete_own', ERR_NONE); |
| 75 | - } elseif($buddy_row['BUDDY_STATUS'] == BUDDY_REQUEST_WAITING) // Deny incoming request |
|
| 79 | + } elseif($buddy_row['BUDDY_STATUS'] == BUDDY_REQUEST_WAITING) { |
|
| 80 | + // Deny incoming request |
|
| 76 | 81 | { |
| 77 | 82 | msg_send_simple_message($buddy_row['BUDDY_SENDER_ID'], $user['id'], SN_TIME_NOW, MSG_TYPE_PLAYER, $user['username'], $lang['buddy_msg_deny_title'], |
| 78 | 83 | sprintf($lang['buddy_msg_deny_text'], $user['username'])); |
| 84 | + } |
|
| 79 | 85 | |
| 80 | 86 | db_buddy_update_status($buddy_id, BUDDY_REQUEST_DENIED); |
| 81 | 87 | sn_db_transaction_commit(); |
@@ -253,9 +253,11 @@ |
||
| 253 | 253 | } |
| 254 | 254 | |
| 255 | 255 | // Если новая планета не найдена или было переключения - проверяем текущую выбранную планету |
| 256 | - if(!isset($planet_row['id'])) // || $planet_row['id'] != $user['current_planet'] |
|
| 256 | + if(!isset($planet_row['id'])) { |
|
| 257 | + // || $planet_row['id'] != $user['current_planet'] |
|
| 257 | 258 | { |
| 258 | 259 | $planet_row = db_planet_by_id_and_owner($user['current_planet'], $user['id'], false, 'id'); |
| 260 | + } |
|
| 259 | 261 | // Если текущей планеты не существует - выставляем Столицу |
| 260 | 262 | if(!isset($planet_row['id'])) { |
| 261 | 263 | $planet_row = db_planet_by_id_and_owner($user['id_planet'], $user['id'], false, 'id'); |
@@ -83,8 +83,7 @@ discard block |
||
| 83 | 83 | { |
| 84 | 84 | $this->inherit_root = $phpbb_root_path . 'styles/' . $user->theme['template_inherit_path'] . '/template'; |
| 85 | 85 | } |
| 86 | - } |
|
| 87 | - else |
|
| 86 | + } else |
|
| 88 | 87 | { |
| 89 | 88 | trigger_error('Template path could not be found: styles/' . $user->theme['template_path'] . '/template', E_USER_ERROR); |
| 90 | 89 | } |
@@ -120,8 +119,7 @@ discard block |
||
| 120 | 119 | |
| 121 | 120 | $this->inherit_root = $fallback_template_path; |
| 122 | 121 | $this->orig_tpl_inherits_id = true; |
| 123 | - } |
|
| 124 | - else |
|
| 122 | + } else |
|
| 125 | 123 | { |
| 126 | 124 | $this->orig_tpl_inherits_id = false; |
| 127 | 125 | } |
@@ -195,8 +193,7 @@ discard block |
||
| 195 | 193 | } |
| 196 | 194 | |
| 197 | 195 | unset($str[$blocks[$blockcount]]); |
| 198 | - } |
|
| 199 | - else |
|
| 196 | + } else |
|
| 200 | 197 | { |
| 201 | 198 | // Top-level block. |
| 202 | 199 | unset($this->_tpldata[$blockname]); |
@@ -232,8 +229,7 @@ discard block |
||
| 232 | 229 | if ($filename = $this->_tpl_load($handle)) |
| 233 | 230 | { |
| 234 | 231 | ($include_once) ? include_once($filename) : include($filename); |
| 235 | - } |
|
| 236 | - else |
|
| 232 | + } else |
|
| 237 | 233 | { |
| 238 | 234 | eval(' ?>' . $this->compiled_code[$handle] . '<?php '); |
| 239 | 235 | } |
@@ -287,8 +283,7 @@ discard block |
||
| 287 | 283 | if (!file_exists($filename) || @filesize($filename) === 0) |
| 288 | 284 | { |
| 289 | 285 | $recompile = true; |
| 290 | - } |
|
| 291 | - else if (classSupernova::$config->load_tplcompile) |
|
| 286 | + } else if (classSupernova::$config->load_tplcompile) |
|
| 292 | 287 | { |
| 293 | 288 | // No way around it: we need to check inheritance here |
| 294 | 289 | if ($user->theme['template_inherits_id'] && !file_exists($this->files[$handle])) |
@@ -376,15 +371,13 @@ discard block |
||
| 376 | 371 | $this->files[$row['template_filename']] = $file; |
| 377 | 372 | $this->files_inherit[$row['template_filename']] = $file; |
| 378 | 373 | $this->files_template[$row['template_filename']] = $user->theme['template_inherits_id']; |
| 379 | - } |
|
| 380 | - else if (isset($user->theme['template_inherits_id']) && $user->theme['template_inherits_id']) |
|
| 374 | + } else if (isset($user->theme['template_inherits_id']) && $user->theme['template_inherits_id']) |
|
| 381 | 375 | { |
| 382 | 376 | // Ok, we have a situation. There is a file in the subtemplate, but nothing in the DB. We have to fix that. |
| 383 | 377 | $force_reload = true; |
| 384 | 378 | $this->files_template[$row['template_filename']] = $user->theme['template_inherits_id']; |
| 385 | 379 | } |
| 386 | - } |
|
| 387 | - else |
|
| 380 | + } else |
|
| 388 | 381 | { |
| 389 | 382 | $this->files_template[$row['template_filename']] = $user->theme['template_id']; |
| 390 | 383 | } |
@@ -394,8 +387,7 @@ discard block |
||
| 394 | 387 | if ($row['template_filename'] == $this->filename[$handle]) |
| 395 | 388 | { |
| 396 | 389 | $compile->_tpl_load_file($handle, true); |
| 397 | - } |
|
| 398 | - else |
|
| 390 | + } else |
|
| 399 | 391 | { |
| 400 | 392 | $this->files[$row['template_filename']] = $file; |
| 401 | 393 | $this->filename[$row['template_filename']] = $row['template_filename']; |
@@ -410,8 +402,7 @@ discard block |
||
| 410 | 402 | { |
| 411 | 403 | $this->compiled_code[$handle] = $compile->compile(trim($row['template_data'])); |
| 412 | 404 | $compile->compile_write($handle, $this->compiled_code[$handle]); |
| 413 | - } |
|
| 414 | - else |
|
| 405 | + } else |
|
| 415 | 406 | { |
| 416 | 407 | // Only bother compiling if it doesn't already exist |
| 417 | 408 | if (!file_exists($this->cachepath . str_replace('/', '.', $row['template_filename']) . DOT_PHP_EX)) |
@@ -422,8 +413,7 @@ discard block |
||
| 422 | 413 | } |
| 423 | 414 | } |
| 424 | 415 | } |
| 425 | - } |
|
| 426 | - else |
|
| 416 | + } else |
|
| 427 | 417 | { |
| 428 | 418 | $file = $this->root . '/' . $row['template_filename']; |
| 429 | 419 | |
@@ -511,8 +501,7 @@ discard block |
||
| 511 | 501 | // We're adding a new iteration to this block with the given |
| 512 | 502 | // variable assignments. |
| 513 | 503 | $str[$blocks[$blockcount]][] = $vararray; |
| 514 | - } |
|
| 515 | - else |
|
| 504 | + } else |
|
| 516 | 505 | { |
| 517 | 506 | // Top-level block. |
| 518 | 507 | $s_row_count = (isset($this->_tpldata[$blockname])) ? sizeof($this->_tpldata[$blockname]) : 0; |
@@ -612,8 +601,7 @@ discard block |
||
| 612 | 601 | $key = sizeof($this->_tpldata[$blockname]); |
| 613 | 602 | unset($this->_tpldata[$blockname][($key - 1)]['S_LAST_ROW']); |
| 614 | 603 | $vararray['S_LAST_ROW'] = true; |
| 615 | - } |
|
| 616 | - else if ($key === 0) |
|
| 604 | + } else if ($key === 0) |
|
| 617 | 605 | { |
| 618 | 606 | unset($this->_tpldata[$blockname][0]['S_FIRST_ROW']); |
| 619 | 607 | $vararray['S_FIRST_ROW'] = true; |
@@ -711,8 +699,7 @@ discard block |
||
| 711 | 699 | if(!$name) |
| 712 | 700 | { |
| 713 | 701 | $this->assign_vars($values); |
| 714 | - } |
|
| 715 | - else |
|
| 702 | + } else |
|
| 716 | 703 | { |
| 717 | 704 | $this->assign_block_vars($name, $values); |
| 718 | 705 | } |
@@ -756,9 +756,11 @@ |
||
| 756 | 756 | !empty($strings) ? doquery($query_string . implode(',', $strings)) : false; |
| 757 | 757 | } |
| 758 | 758 | |
| 759 | - if(isset($update_tables['counter']['page'])) // TODO REMOVE |
|
| 759 | + if(isset($update_tables['counter']['page'])) { |
|
| 760 | + // TODO REMOVE |
|
| 760 | 761 | { |
| 761 | 762 | update_security_url("SELECT DISTINCT `page` AS url FROM {{counter}}"); |
| 763 | + } |
|
| 762 | 764 | update_security_url("SELECT DISTINCT `url` AS url FROM {{counter}}"); |
| 763 | 765 | } |
| 764 | 766 | } |
@@ -86,8 +86,7 @@ discard block |
||
| 86 | 86 | if($n % 2 == 0) |
| 87 | 87 | { |
| 88 | 88 | $median = ($args[$h] + $args[$h-1]) / 2; |
| 89 | - } |
|
| 90 | - else |
|
| 89 | + } else |
|
| 91 | 90 | { |
| 92 | 91 | $median = $args[$h]; |
| 93 | 92 | } |
@@ -111,7 +110,9 @@ discard block |
||
| 111 | 110 | $eq[$j] /= $eq[$from]; |
| 112 | 111 | } |
| 113 | 112 | } |
| 114 | - if($logProcess) pdump($linear, 'Нормализовано по х' . $from); |
|
| 113 | + if($logProcess) { |
|
| 114 | + pdump($linear, 'Нормализовано по х' . $from); |
|
| 115 | + } |
|
| 115 | 116 | |
| 116 | 117 | for($i = $from + 1; $i < count($linear); $i++) |
| 117 | 118 | { |
@@ -121,7 +122,9 @@ discard block |
||
| 121 | 122 | $eq[$j] -= $linear[$from][$j]; |
| 122 | 123 | } |
| 123 | 124 | } |
| 124 | - if($logProcess) pdump($linear, 'Подставили х' . $from); |
|
| 125 | + if($logProcess) { |
|
| 126 | + pdump($linear, 'Подставили х' . $from); |
|
| 127 | + } |
|
| 125 | 128 | |
| 126 | 129 | if($from < count($linear) - 1) |
| 127 | 130 | { |
@@ -138,11 +141,14 @@ discard block |
||
| 138 | 141 | $eq[$j] = $eq[$j] - $eq[$from] * $linear[$from][$j]; |
| 139 | 142 | } |
| 140 | 143 | } |
| 141 | - if($logProcess) pdump($linear, 'Подставили обратно х' . $from); |
|
| 142 | - } |
|
| 143 | - else |
|
| 144 | + if($logProcess) { |
|
| 145 | + pdump($linear, 'Подставили обратно х' . $from); |
|
| 146 | + } |
|
| 147 | + } else |
|
| 144 | 148 | { |
| 145 | - if($logProcess) pdump($linear, 'Результат' . $from); |
|
| 149 | + if($logProcess) { |
|
| 150 | + pdump($linear, 'Результат' . $from); |
|
| 151 | + } |
|
| 146 | 152 | foreach($linear as $index => &$eq) |
| 147 | 153 | { |
| 148 | 154 | pdump($eq[count($linear)], 'x' . $index); |
@@ -542,7 +542,8 @@ discard block |
||
| 542 | 542 | $location_info = &static::$location_info[$location_type]; |
| 543 | 543 | $id_field = $location_info[P_ID]; |
| 544 | 544 | $table_name = $location_info[P_TABLE_NAME]; |
| 545 | - if ($result = static::db_query($q = "UPDATE {{{$table_name}}} SET {$set} WHERE `{$id_field}` = {$record_id}")) // TODO Как-то вернуть может быть LIMIT 1 ? |
|
| 545 | + if ($result = static::db_query($q = "UPDATE {{{$table_name}}} SET {$set} WHERE `{$id_field}` = {$record_id}")) { |
|
| 546 | + // TODO Как-то вернуть может быть LIMIT 1 ? |
|
| 546 | 547 | { |
| 547 | 548 | if (static::$db->db_affected_rows()) { |
| 548 | 549 | // Обновляем данные только если ряд был затронут |
@@ -550,6 +551,7 @@ discard block |
||
| 550 | 551 | |
| 551 | 552 | // Тут именно так, а не cache_unset - что бы в кэшах автоматически обновилась запись. Будет нужно на будущее |
| 552 | 553 | static::$data[$location_type][$record_id] = null; |
| 554 | + } |
|
| 553 | 555 | // Вытаскиваем обновленную запись |
| 554 | 556 | static::db_get_record_by_id($location_type, $record_id); |
| 555 | 557 | static::cache_clear($location_type, false); // Мягкий сброс - только $queries |
@@ -589,9 +591,11 @@ discard block |
||
| 589 | 591 | $set = trim($set); |
| 590 | 592 | $table_name = static::$location_info[$location_type][P_TABLE_NAME]; |
| 591 | 593 | if ($result = static::db_query("INSERT INTO `{{{$table_name}}}` SET {$set}")) { |
| 592 | - if (static::$db->db_affected_rows()) // Обновляем данные только если ряд был затронут |
|
| 594 | + if (static::$db->db_affected_rows()) { |
|
| 595 | + // Обновляем данные только если ряд был затронут |
|
| 593 | 596 | { |
| 594 | 597 | $record_id = db_insert_id(); |
| 598 | + } |
|
| 595 | 599 | // Вытаскиваем запись целиком, потому что в $set могли быть "данные по умолчанию" |
| 596 | 600 | $result = static::db_get_record_by_id($location_type, $record_id); |
| 597 | 601 | // Очищаем второстепенные кэши - потому что вставленная запись могла повлиять на результаты запросов или локация или еще чего |