@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | { |
| 5 | 5 | global $lang; |
| 6 | 6 | |
| 7 | - if(!in_array($unit_id, sn_get_groups('artifacts'))) |
|
| 7 | + if (!in_array($unit_id, sn_get_groups('artifacts'))) |
|
| 8 | 8 | { |
| 9 | 9 | return; |
| 10 | 10 | } |
@@ -13,17 +13,17 @@ discard block |
||
| 13 | 13 | $user = db_user_by_id($user['id'], true); |
| 14 | 14 | |
| 15 | 15 | $unit_level = $artifact_level_old = mrc_get_level($user, array(), $unit_id, true); |
| 16 | - if($unit_level > 0) |
|
| 16 | + if ($unit_level > 0) |
|
| 17 | 17 | { |
| 18 | 18 | $db_changeset = array(); |
| 19 | - switch($unit_id) |
|
| 19 | + switch ($unit_id) |
|
| 20 | 20 | { |
| 21 | 21 | case ART_LHC: |
| 22 | 22 | case ART_HOOK_SMALL: |
| 23 | 23 | case ART_HOOK_MEDIUM: |
| 24 | 24 | case ART_HOOK_LARGE: |
| 25 | 25 | $has_moon = DBStaticPlanet::db_planet_by_parent($planetrow['id'], true, '`id`'); |
| 26 | - if($planetrow['planet_type'] == PT_PLANET && !$has_moon['id']) |
|
| 26 | + if ($planetrow['planet_type'] == PT_PLANET && !$has_moon['id']) |
|
| 27 | 27 | { |
| 28 | 28 | $unit_level--; |
| 29 | 29 | $updateDebris = false; |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | break; |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - if($moonSize) |
|
| 47 | + if ($moonSize) |
|
| 48 | 48 | { |
| 49 | 49 | $new_moon_row = uni_create_moon($planetrow['galaxy'], $planetrow['system'], $planetrow['planet'], $user['id'], $moonSize, $updateDebris); |
| 50 | 50 | $message = sprintf($lang['art_moon_create'][$unit_id], $new_moon_row['name'], uni_render_coordinates($planetrow), HelperString::numberFloorAndFormat($moonSize)); |
@@ -65,14 +65,14 @@ discard block |
||
| 65 | 65 | case ART_RCD_MEDIUM: |
| 66 | 66 | case ART_RCD_LARGE: |
| 67 | 67 | $planetrow = DBStaticPlanet::db_planet_by_id($planetrow['id'], true); |
| 68 | - if($planetrow['planet_type'] != PT_PLANET) |
|
| 68 | + if ($planetrow['planet_type'] != PT_PLANET) |
|
| 69 | 69 | { |
| 70 | 70 | $message = $lang['art_rcd_err_moon']; |
| 71 | 71 | break; |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | $que = que_get($user['id'], $planetrow['id'], QUE_STRUCTURES, false); |
| 75 | - if(!empty($que['items'])) |
|
| 75 | + if (!empty($que['items'])) |
|
| 76 | 76 | { |
| 77 | 77 | $message = $lang['art_rcd_err_que']; |
| 78 | 78 | break; |
@@ -81,15 +81,15 @@ discard block |
||
| 81 | 81 | $artifact_deploy = get_unit_param($unit_id, P_DEPLOY); |
| 82 | 82 | |
| 83 | 83 | $sectors_used = 0; |
| 84 | - foreach($artifact_deploy as $deploy_unit_id => $deploy_unit_level) |
|
| 84 | + foreach ($artifact_deploy as $deploy_unit_id => $deploy_unit_level) |
|
| 85 | 85 | { |
| 86 | - if(!($levels_deployed = max(0, $deploy_unit_level - mrc_get_level($user, $planetrow, $deploy_unit_id, true, true)))) |
|
| 86 | + if (!($levels_deployed = max(0, $deploy_unit_level - mrc_get_level($user, $planetrow, $deploy_unit_id, true, true)))) |
|
| 87 | 87 | continue; |
| 88 | 88 | $sectors_used += $levels_deployed; |
| 89 | 89 | $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($deploy_unit_id, $levels_deployed, $user, $planetrow['id']); |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - if($sectors_used == 0) |
|
| 92 | + if ($sectors_used == 0) |
|
| 93 | 93 | { |
| 94 | 94 | $message = $lang['art_rcd_err_no_sense']; |
| 95 | 95 | break; |
@@ -104,13 +104,13 @@ discard block |
||
| 104 | 104 | $que_item = null; |
| 105 | 105 | $que = que_get($user['id'], $planetrow['id'], QUE_RESEARCH, true); |
| 106 | 106 | $current_que = &$que['ques'][QUE_RESEARCH][$user['id']][0]; |
| 107 | - if(!empty($current_que)) |
|
| 107 | + if (!empty($current_que)) |
|
| 108 | 108 | { |
| 109 | 109 | reset($current_que); |
| 110 | 110 | $que_item = &$que['ques'][QUE_RESEARCH][$user['id']][0][key($current_que)]; |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | - if(!empty($que_item) && $que_item['que_time_left'] > 60) |
|
| 113 | + if (!empty($que_item) && $que_item['que_time_left'] > 60) |
|
| 114 | 114 | { |
| 115 | 115 | $unit_level--; |
| 116 | 116 | $old_time = $que_item['que_time_left']; |
@@ -131,13 +131,13 @@ discard block |
||
| 131 | 131 | $que = que_get($user['id'], $planetrow['id'], QUE_STRUCTURES, true); |
| 132 | 132 | $current_que = &$que['ques'][QUE_STRUCTURES][$user['id']][$planetrow['id']]; |
| 133 | 133 | // $que_item = &$que['que'][QUE_STRUCTURES][0]; |
| 134 | - if(!empty($current_que)) |
|
| 134 | + if (!empty($current_que)) |
|
| 135 | 135 | { |
| 136 | 136 | reset($current_que); |
| 137 | 137 | $que_item = &$que['ques'][QUE_STRUCTURES][$user['id']][$planetrow['id']][key($current_que)]; |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | - if(isset($que_item) && $que_item['que_time_left'] > 60) |
|
| 140 | + if (isset($que_item) && $que_item['que_time_left'] > 60) |
|
| 141 | 141 | { |
| 142 | 142 | $unit_level--; |
| 143 | 143 | $old_time = $que_item['que_time_left']; |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | break; |
| 156 | 156 | |
| 157 | 157 | } |
| 158 | - if($unit_level != $artifact_level_old) |
|
| 158 | + if ($unit_level != $artifact_level_old) |
|
| 159 | 159 | { |
| 160 | 160 | $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($unit_id, $unit_level - $artifact_level_old, $user); |
| 161 | 161 | OldDbChangeSet::db_changeset_apply($db_changeset); |
@@ -72,7 +72,7 @@ |
||
| 72 | 72 | // Для не-симулятора - рандомизируем каждый раунд значения атаки и щитов |
| 73 | 73 | $fleet_data[UBE_ATTACK_BASE][$unit_id] = floor($fleet_info[UBE_ATTACK][$unit_id] * ($isSimulatorStatic ? 1 : mt_rand(80, 120) / 100)); |
| 74 | 74 | $fleet_data[UBE_SHIELD_BASE][$unit_id] = floor($fleet_info[UBE_SHIELD][$unit_id] * ($isSimulatorStatic ? 1 : mt_rand(80, 120) / 100)); |
| 75 | - $fleet_data[UBE_ARMOR_BASE][$unit_id] = floor($fleet_info[UBE_ARMOR][$unit_id]);// * ($is_simulator ? 1 : mt_rand(80, 120) / 100)); |
|
| 75 | + $fleet_data[UBE_ARMOR_BASE][$unit_id] = floor($fleet_info[UBE_ARMOR][$unit_id]); // * ($is_simulator ? 1 : mt_rand(80, 120) / 100)); |
|
| 76 | 76 | |
| 77 | 77 | $fleet_data[UBE_ATTACK][$unit_id] = $fleet_data[UBE_ATTACK_BASE][$unit_id] * $unit_count; |
| 78 | 78 | $fleet_data[UBE_SHIELD][$unit_id] = $fleet_data[UBE_SHIELD_BASE][$unit_id] * $unit_count; |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | * |
| 41 | 41 | * @var int[] $shipsToRemove |
| 42 | 42 | */ |
| 43 | - protected $shipsToRemove = [SHIP_COLONIZER, SHIP_SPY,]; |
|
| 43 | + protected $shipsToRemove = [SHIP_COLONIZER, SHIP_SPY, ]; |
|
| 44 | 44 | |
| 45 | 45 | // ------------------------------------------------------------------------------------------------------------------- |
| 46 | 46 | /** |
@@ -85,7 +85,7 @@ |
||
| 85 | 85 | |
| 86 | 86 | $template->assign_block_vars('user', array( |
| 87 | 87 | 'ID' => $user_row['id'], |
| 88 | - 'NAME' => $renderedNick = player_nick_render_to_html($user_row, ['player_rank' => true, 'vacancy' => true, 'birthday' => true, 'award' => true, NICK_RANK_NO_TEXT => true,]), |
|
| 88 | + 'NAME' => $renderedNick = player_nick_render_to_html($user_row, ['player_rank' => true, 'vacancy' => true, 'birthday' => true, 'award' => true, NICK_RANK_NO_TEXT => true, ]), |
|
| 89 | 89 | 'NAME_HTML' => htmlentities($user_row['username'], ENT_QUOTES, 'UTF-8'), |
| 90 | 90 | 'IP' => $user_row['user_lastip'], |
| 91 | 91 | 'IP_MULTI' => intval($multi_ip[$user_row['user_lastip']]), |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | || |
| 126 | 126 | (!empty($uni_galaxyRowPlanet['destruyed']) && CheckAbandonPlanetState($uni_galaxyRowPlanet)) |
| 127 | 127 | ) { |
| 128 | - $template->assign_block_vars('galaxyrow', ['PLANET_NUM' => $Planet,]); |
|
| 128 | + $template->assign_block_vars('galaxyrow', ['PLANET_NUM' => $Planet, ]); |
|
| 129 | 129 | continue; |
| 130 | 130 | } |
| 131 | 131 | |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | 'IS_CAPITAL' => $uni_galaxyRowUser['id_planet'] == $uni_galaxyRowPlanet['id'], |
| 243 | 243 | |
| 244 | 244 | 'USER_ID' => $uni_galaxyRowUser['id'], |
| 245 | - 'USER_NAME' => $renderedNick = player_nick_render_to_html($uni_galaxyRowUser, ['icons' => true,]), |
|
| 245 | + 'USER_NAME' => $renderedNick = player_nick_render_to_html($uni_galaxyRowUser, ['icons' => true, ]), |
|
| 246 | 246 | 'USER_NAME_JS' => js_safe_string($renderedNick), |
| 247 | 247 | 'USER_RANK' => in_array($uni_galaxyRowUser['id'], $user_skip_list) ? '-' : $uni_galaxyRowUser['total_rank'], |
| 248 | 248 | 'USER_BANNED' => $uni_galaxyRowUser['banaday'], |
@@ -21,8 +21,8 @@ |
||
| 21 | 21 | $mode = sys_get_param_escaped('mode'); |
| 22 | 22 | $mode = (!$mode || $mode == 'buildings') ? QUE_STRUCTURES : ($mode == 'fleet' ? SUBQUE_FLEET : ($mode == 'defense' ? SUBQUE_DEFENSE : ($mode == 'research' ? QUE_RESEARCH : $mode))); |
| 23 | 23 | |
| 24 | -if($building_sort = sys_get_param_id('sort_elements')) { |
|
| 25 | - if(!empty($lang['player_option_building_sort'][$building_sort])) { |
|
| 24 | +if ($building_sort = sys_get_param_id('sort_elements')) { |
|
| 25 | + if (!empty($lang['player_option_building_sort'][$building_sort])) { |
|
| 26 | 26 | SN::$user_options[array(PLAYER_OPTION_BUILDING_SORT, $mode)] = $building_sort; |
| 27 | 27 | SN::$user_options[array(PLAYER_OPTION_BUILDING_SORT_INVERSE, $mode)] = sys_get_param_id('sort_elements_inverse', 0); |
| 28 | 28 | } |
@@ -18,39 +18,39 @@ discard block |
||
| 18 | 18 | { |
| 19 | 19 | sn_db_transaction_start(); |
| 20 | 20 | |
| 21 | - if($buddy_id = sys_get_param_id('buddy_id')) |
|
| 21 | + if ($buddy_id = sys_get_param_id('buddy_id')) |
|
| 22 | 22 | { |
| 23 | 23 | $buddy_row = doquery("SELECT BUDDY_SENDER_ID, BUDDY_OWNER_ID, BUDDY_STATUS FROM {{buddy}} WHERE `BUDDY_ID` = {$buddy_id} LIMIT 1 FOR UPDATE;", true); |
| 24 | - if(!is_array($buddy_row)) |
|
| 24 | + if (!is_array($buddy_row)) |
|
| 25 | 25 | { |
| 26 | 26 | throw new exception('buddy_err_not_exist', ERR_ERROR); |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | - switch($mode = sys_get_param_str('mode')) |
|
| 29 | + switch ($mode = sys_get_param_str('mode')) |
|
| 30 | 30 | { |
| 31 | 31 | case 'accept': |
| 32 | - if($buddy_row['BUDDY_SENDER_ID'] == $user['id']) |
|
| 32 | + if ($buddy_row['BUDDY_SENDER_ID'] == $user['id']) |
|
| 33 | 33 | { |
| 34 | 34 | throw new exception('buddy_err_accept_own', ERR_ERROR); |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - if($buddy_row['BUDDY_OWNER_ID'] != $user['id']) |
|
| 37 | + if ($buddy_row['BUDDY_OWNER_ID'] != $user['id']) |
|
| 38 | 38 | { |
| 39 | 39 | throw new exception('buddy_err_accept_alien', ERR_ERROR); |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - if($buddy_row['BUDDY_STATUS'] == BUDDY_REQUEST_ACTIVE) |
|
| 42 | + if ($buddy_row['BUDDY_STATUS'] == BUDDY_REQUEST_ACTIVE) |
|
| 43 | 43 | { |
| 44 | 44 | throw new exception('buddy_err_accept_already', ERR_WARNING); |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - if($buddy_row['BUDDY_STATUS'] == BUDDY_REQUEST_DENIED) |
|
| 47 | + if ($buddy_row['BUDDY_STATUS'] == BUDDY_REQUEST_DENIED) |
|
| 48 | 48 | { |
| 49 | 49 | throw new exception('buddy_err_accept_denied', ERR_ERROR); |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | doquery("UPDATE {{buddy}} SET `BUDDY_STATUS` = " . BUDDY_REQUEST_ACTIVE . " WHERE `BUDDY_ID` = {$buddy_id} LIMIT 1;"); |
| 53 | - if(SN::$db->db_affected_rows()) |
|
| 53 | + if (SN::$db->db_affected_rows()) |
|
| 54 | 54 | { |
| 55 | 55 | msg_send_simple_message($buddy_row['BUDDY_SENDER_ID'], $user['id'], SN_TIME_NOW, MSG_TYPE_PLAYER, $user['username'], $lang['buddy_msg_accept_title'], |
| 56 | 56 | sprintf($lang['buddy_msg_accept_text'], $user['username'])); |
@@ -64,12 +64,12 @@ discard block |
||
| 64 | 64 | break; |
| 65 | 65 | |
| 66 | 66 | case 'delete': |
| 67 | - if($buddy_row['BUDDY_SENDER_ID'] != $user['id'] && $buddy_row['BUDDY_OWNER_ID'] != $user['id']) |
|
| 67 | + if ($buddy_row['BUDDY_SENDER_ID'] != $user['id'] && $buddy_row['BUDDY_OWNER_ID'] != $user['id']) |
|
| 68 | 68 | { |
| 69 | 69 | throw new exception('buddy_err_delete_alien', ERR_ERROR); |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - if($buddy_row['BUDDY_STATUS'] == BUDDY_REQUEST_ACTIVE) // Existing friendship |
|
| 72 | + if ($buddy_row['BUDDY_STATUS'] == BUDDY_REQUEST_ACTIVE) // Existing friendship |
|
| 73 | 73 | { |
| 74 | 74 | $ex_friend_id = $buddy_row['BUDDY_SENDER_ID'] == $user['id'] ? $buddy_row['BUDDY_OWNER_ID'] : $buddy_row['BUDDY_SENDER_ID']; |
| 75 | 75 | |
@@ -80,13 +80,13 @@ discard block |
||
| 80 | 80 | sn_db_transaction_commit(); |
| 81 | 81 | throw new exception('buddy_err_unfriend_none', ERR_NONE); |
| 82 | 82 | } |
| 83 | - elseif($buddy_row['BUDDY_SENDER_ID'] == $user['id']) // Player's outcoming request - either denied or waiting |
|
| 83 | + elseif ($buddy_row['BUDDY_SENDER_ID'] == $user['id']) // Player's outcoming request - either denied or waiting |
|
| 84 | 84 | { |
| 85 | 85 | doquery("DELETE FROM {{buddy}} WHERE `BUDDY_ID` = {$buddy_id} LIMIT 1;"); |
| 86 | 86 | sn_db_transaction_commit(); |
| 87 | 87 | throw new exception('buddy_err_delete_own', ERR_NONE); |
| 88 | 88 | } |
| 89 | - elseif($buddy_row['BUDDY_STATUS'] == BUDDY_REQUEST_WAITING) // Deny incoming request |
|
| 89 | + elseif ($buddy_row['BUDDY_STATUS'] == BUDDY_REQUEST_WAITING) // Deny incoming request |
|
| 90 | 90 | { |
| 91 | 91 | msg_send_simple_message($buddy_row['BUDDY_SENDER_ID'], $user['id'], SN_TIME_NOW, MSG_TYPE_PLAYER, $user['username'], $lang['buddy_msg_deny_title'], |
| 92 | 92 | sprintf($lang['buddy_msg_deny_text'], $user['username'])); |
@@ -101,24 +101,24 @@ discard block |
||
| 101 | 101 | |
| 102 | 102 | // New request? |
| 103 | 103 | // Checking for user ID - in case if it was request from outside buddy system |
| 104 | - if($new_friend_id = sys_get_param_id('request_user_id')) |
|
| 104 | + if ($new_friend_id = sys_get_param_id('request_user_id')) |
|
| 105 | 105 | { |
| 106 | 106 | $new_friend_row = db_user_by_id($new_friend_id, true, '`id`, `username`'); |
| 107 | 107 | } |
| 108 | - elseif($new_friend_name = sys_get_param_str_unsafe('request_user_name')) |
|
| 108 | + elseif ($new_friend_name = sys_get_param_str_unsafe('request_user_name')) |
|
| 109 | 109 | { |
| 110 | 110 | $new_friend_row = db_user_by_username($new_friend_name); |
| 111 | 111 | $new_friend_name = db_escape($new_friend_name); |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | - if($new_friend_row['id'] == $user['id']) |
|
| 114 | + if ($new_friend_row['id'] == $user['id']) |
|
| 115 | 115 | { |
| 116 | 116 | unset($new_friend_row); |
| 117 | 117 | throw new exception('buddy_err_adding_self', ERR_ERROR); |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | // Checking for user name & request text - in case if it was request to adding new request |
| 121 | - if(isset($new_friend_row['id']) && ($new_request_text = sys_get_param_str('request_text'))) |
|
| 121 | + if (isset($new_friend_row['id']) && ($new_request_text = sys_get_param_str('request_text'))) |
|
| 122 | 122 | { |
| 123 | 123 | $check_relation = doquery("SELECT `BUDDY_ID` FROM {{buddy}} WHERE |
| 124 | 124 | (`BUDDY_SENDER_ID` = {$user['id']} AND `BUDDY_OWNER_ID` = {$new_friend_row['id']}) |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | (`BUDDY_SENDER_ID` = {$new_friend_row['id']} AND `BUDDY_OWNER_ID` = {$user['id']}) |
| 127 | 127 | LIMIT 1 FOR UPDATE;" |
| 128 | 128 | , true); |
| 129 | - if(isset($check_relation['BUDDY_ID'])) |
|
| 129 | + if (isset($check_relation['BUDDY_ID'])) |
|
| 130 | 130 | { |
| 131 | 131 | throw new exception('buddy_err_adding_exists', ERR_WARNING); |
| 132 | 132 | } |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | throw new exception('buddy_err_adding_none', ERR_NONE); |
| 140 | 140 | } |
| 141 | 141 | } |
| 142 | -catch(exception $e) |
|
| 142 | +catch (exception $e) |
|
| 143 | 143 | { |
| 144 | 144 | $result[] = array( |
| 145 | 145 | 'STATUS' => in_array($e->getCode(), array(ERR_NONE, ERR_WARNING, ERR_ERROR)) ? $e->getCode() : ERR_ERROR, |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | sn_db_transaction_rollback(); |
| 151 | 151 | |
| 152 | 152 | $query = db_buddy_list_by_user($user['id']); |
| 153 | -while($row = db_fetch($query)) |
|
| 153 | +while ($row = db_fetch($query)) |
|
| 154 | 154 | { |
| 155 | 155 | $row['BUDDY_REQUEST'] = HelperString::nl2br($row['BUDDY_REQUEST']); |
| 156 | 156 | |
@@ -17,11 +17,11 @@ discard block |
||
| 17 | 17 | array('query' => "DELETE FROM `{{planets}}` WHERE `id_owner` = 0 AND `destruyed` < UNIX_TIMESTAMP();", 'result' => false, 'error' => '', 'affected_rows' => 0), |
| 18 | 18 | ); |
| 19 | 19 | |
| 20 | - foreach($queries as &$query) |
|
| 20 | + foreach ($queries as &$query) |
|
| 21 | 21 | { |
| 22 | 22 | $query['result'] = doquery($query['query']); |
| 23 | 23 | $query['error'] = SN::$db->db_error(); |
| 24 | - $query['affected_rows'] = SN::$db->db_affected_rows(); |
|
| 24 | + $query['affected_rows'] = SN::$db->db_affected_rows(); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | return $queries; |
@@ -53,30 +53,30 @@ discard block |
||
| 53 | 53 | $recorded_run = strtotime($recorded_run); |
| 54 | 54 | |
| 55 | 55 | $prev_run_array = getdate($recorded_run); |
| 56 | - $prev_run_array = array($prev_run_array['seconds'],$prev_run_array['minutes'],$prev_run_array['hours'],$prev_run_array['mday'],$prev_run_array['mon'],$prev_run_array['year']); |
|
| 56 | + $prev_run_array = array($prev_run_array['seconds'], $prev_run_array['minutes'], $prev_run_array['hours'], $prev_run_array['mday'], $prev_run_array['mon'], $prev_run_array['year']); |
|
| 57 | 57 | $today_array = getdate(SN_TIME_NOW); |
| 58 | - $today_array = array($today_array['seconds'],$today_array['minutes'],$today_array['hours'],$today_array['mday'],$today_array['mon'],$today_array['year']); |
|
| 58 | + $today_array = array($today_array['seconds'], $today_array['minutes'], $today_array['hours'], $today_array['mday'], $today_array['mon'], $today_array['year']); |
|
| 59 | 59 | $scheduleList = explode(',', $scheduleList); |
| 60 | 60 | array_walk($scheduleList, function(&$schedule) use ($prev_run_array, $today_array, $date_part_names_reverse, &$possible_schedules) { |
| 61 | 61 | $schedule = array('schedule_array' => array_reverse(explode(':', trim($schedule)))); |
| 62 | 62 | |
| 63 | 63 | $interval = $date_part_names_reverse[count($schedule['schedule_array'])]; |
| 64 | 64 | |
| 65 | - foreach($prev_run_array as $index => $date_part) { |
|
| 65 | + foreach ($prev_run_array as $index => $date_part) { |
|
| 66 | 66 | $schedule['array']['recorded'][$index] = isset($schedule['schedule_array'][$index]) ? intval($schedule['schedule_array'][$index]) : $date_part; |
| 67 | 67 | $schedule['array']['now'][$index] = isset($schedule['schedule_array'][$index]) ? intval($schedule['schedule_array'][$index]) : $today_array[$index]; |
| 68 | 68 | } |
| 69 | - if($schedule['array']['recorded'] == $schedule['array']['now']) { |
|
| 69 | + if ($schedule['array']['recorded'] == $schedule['array']['now']) { |
|
| 70 | 70 | unset($schedule['array']['now']); |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - foreach($schedule['array'] as $name => $array) { |
|
| 73 | + foreach ($schedule['array'] as $name => $array) { |
|
| 74 | 74 | $schedule['string'][$name] = "{$array[5]}-{$array[4]}-{$array[3]} {$array[2]}:{$array[1]}:{$array[0]}"; |
| 75 | 75 | $schedule['string'][$name . '_next'] = $schedule['string'][$name] . ' +1 ' . $interval; |
| 76 | 76 | $schedule['string'][$name . '_prev'] = $schedule['string'][$name] . ' -1 ' . $interval; |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - foreach($schedule['string'] as $string) { |
|
| 79 | + foreach ($schedule['string'] as $string) { |
|
| 80 | 80 | $timestamp = strtotime($string); |
| 81 | 81 | $schedule['timestamp'][$timestamp] = $possible_schedules[$timestamp] = date(FMT_DATE_TIME_SQL, strtotime($string)); |
| 82 | 82 | } |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | |
| 87 | 87 | $prev_run = 0; |
| 88 | 88 | $next_run = 0; |
| 89 | - foreach($possible_schedules as $timestamp => $string_date) { |
|
| 89 | + foreach ($possible_schedules as $timestamp => $string_date) { |
|
| 90 | 90 | $prev_run = SN_TIME_NOW >= $timestamp ? $timestamp : $prev_run; |
| 91 | 91 | $next_run = SN_TIME_NOW < $timestamp && !$next_run ? $timestamp : $next_run; |
| 92 | 92 | } |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | "ally_id = '{$ally_id}'" . ($ally_rank_id >= 0 ? " AND ally_rank_id = {$ally_rank_id}" : ''), |
| 27 | 27 | false, 'id, username'); |
| 28 | 28 | // while ($u = db_fetch($query)) |
| 29 | - foreach($query as $u) |
|
| 29 | + foreach ($query as $u) |
|
| 30 | 30 | { |
| 31 | 31 | $sendList[] = $u['id']; |
| 32 | 32 | $list .= "<br>{$u['username']} "; |
@@ -53,19 +53,19 @@ discard block |
||
| 53 | 53 | { |
| 54 | 54 | global $config, $user, $sn_message_class_list; |
| 55 | 55 | |
| 56 | - if(!$owners) |
|
| 56 | + if (!$owners) |
|
| 57 | 57 | { |
| 58 | 58 | return; |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | $timestamp = $timestamp ? $timestamp : SN_TIME_NOW; |
| 62 | 62 | $sender = intval($sender); |
| 63 | - if(!is_array($owners)) |
|
| 63 | + if (!is_array($owners)) |
|
| 64 | 64 | { |
| 65 | 65 | $owners = array($owners); |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - if($escaped == STRING_NEED_ESCAPING) |
|
| 68 | + if ($escaped == STRING_NEED_ESCAPING) |
|
| 69 | 69 | { |
| 70 | 70 | $from = db_escape($from); |
| 71 | 71 | $subject = db_escape($subject); |
@@ -81,9 +81,9 @@ discard block |
||
| 81 | 81 | |
| 82 | 82 | $message_class_name_total = $sn_message_class_list[MSG_TYPE_NEW]['name']; |
| 83 | 83 | |
| 84 | - if($owners[0] == '*') |
|
| 84 | + if ($owners[0] == '*') |
|
| 85 | 85 | { |
| 86 | - if($user['authlevel'] < 3) |
|
| 86 | + if ($user['authlevel'] < 3) |
|
| 87 | 87 | { |
| 88 | 88 | return false; |
| 89 | 89 | } |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | |
| 100 | 100 | foreach ($owners as $owner) |
| 101 | 101 | { |
| 102 | - if($user['id'] != $owner) |
|
| 102 | + if ($user['id'] != $owner) |
|
| 103 | 103 | { |
| 104 | 104 | $owner_row = db_user_by_id($owner); |
| 105 | 105 | } |
@@ -109,14 +109,14 @@ discard block |
||
| 109 | 109 | } |
| 110 | 110 | sys_user_options_unpack($owner_row); |
| 111 | 111 | |
| 112 | - if($force || !$message_class_switchable || $owner_row["opt_{$message_class_name}"]) |
|
| 112 | + if ($force || !$message_class_switchable || $owner_row["opt_{$message_class_name}"]) |
|
| 113 | 113 | { |
| 114 | 114 | $insert_values[] = sprintf($insert_template, $owner); |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | - if($message_class_email && $config->game_email_pm && $owner_row["opt_email_{$message_class_name}"]) |
|
| 117 | + if ($message_class_email && $config->game_email_pm && $owner_row["opt_email_{$message_class_name}"]) |
|
| 118 | 118 | { |
| 119 | - if($message_type == MSG_TYPE_SPY) { |
|
| 119 | + if ($message_type == MSG_TYPE_SPY) { |
|
| 120 | 120 | @$result = mymail($owner_row['email'], $subject, SN::$lang['sys_spy_activity'], '', true); |
| 121 | 121 | } else { |
| 122 | 122 | @$result = mymail($owner_row['email'], $subject, $text_unescaped, '', true); |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | } |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | - if(empty($insert_values)) |
|
| 127 | + if (empty($insert_values)) |
|
| 128 | 128 | { |
| 129 | 129 | return; |
| 130 | 130 | } |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | } |
| 135 | 135 | db_user_list_set_mass_mail($owners, "`{$message_class_name}` = `{$message_class_name}` + 1, `{$message_class_name_total}` = `{$message_class_name_total}` + 1"); |
| 136 | 136 | |
| 137 | - if(in_array($user['id'], $owners) || $owners[0] == '*') |
|
| 137 | + if (in_array($user['id'], $owners) || $owners[0] == '*') |
|
| 138 | 138 | { |
| 139 | 139 | $user[$message_class_name]++; |
| 140 | 140 | $user[$message_class_name_total]++; |