| @@ -50,52 +50,52 @@ | ||
| 50 | 50 | stat_tpl_assign($template, $who, 'subject', $subject_list, $sn_group_stat_common); | 
| 51 | 51 | |
| 52 | 52 | $stat_types = array( | 
| 53 | - STAT_TOTAL => array( | |
| 54 | - 'type' => 'total', | |
| 55 | - ), | |
| 53 | + STAT_TOTAL => array( | |
| 54 | + 'type' => 'total', | |
| 55 | + ), | |
| 56 | 56 | |
| 57 | - STAT_FLEET => array( | |
| 58 | - 'type' => 'fleet', | |
| 59 | - ), | |
| 57 | + STAT_FLEET => array( | |
| 58 | + 'type' => 'fleet', | |
| 59 | + ), | |
| 60 | 60 | |
| 61 | - STAT_TECH => array( | |
| 62 | - 'type' => 'tech', | |
| 63 | - ), | |
| 61 | + STAT_TECH => array( | |
| 62 | + 'type' => 'tech', | |
| 63 | + ), | |
| 64 | 64 | |
| 65 | - STAT_BUILDING => array( | |
| 66 | - 'type' => 'build', | |
| 67 | - ), | |
| 65 | + STAT_BUILDING => array( | |
| 66 | + 'type' => 'build', | |
| 67 | + ), | |
| 68 | 68 | |
| 69 | - STAT_DEFENSE => array( | |
| 70 | - 'type' => 'defs', | |
| 71 | - ), | |
| 69 | + STAT_DEFENSE => array( | |
| 70 | + 'type' => 'defs', | |
| 71 | + ), | |
| 72 | 72 | |
| 73 | - STAT_RESOURCE => array( | |
| 74 | - 'type' => 'res', | |
| 75 | - ), | |
| 73 | + STAT_RESOURCE => array( | |
| 74 | + 'type' => 'res', | |
| 75 | + ), | |
| 76 | 76 | |
| 77 | - STAT_RAID_TOTAL => array( | |
| 78 | - 'type' => 'raids', | |
| 79 | - ), | |
| 77 | + STAT_RAID_TOTAL => array( | |
| 78 | + 'type' => 'raids', | |
| 79 | + ), | |
| 80 | 80 | |
| 81 | - STAT_RAID_WON => array( | |
| 82 | - 'type' => 'raidswin', | |
| 83 | - ), | |
| 81 | + STAT_RAID_WON => array( | |
| 82 | + 'type' => 'raidswin', | |
| 83 | + ), | |
| 84 | 84 | |
| 85 | - STAT_RAID_LOST => array( | |
| 86 | - 'type' => 'raidsloose', | |
| 87 | - ), | |
| 85 | + STAT_RAID_LOST => array( | |
| 86 | + 'type' => 'raidsloose', | |
| 87 | + ), | |
| 88 | 88 | |
| 89 | 89 | STAT_LVL_BUILDING => array( | 
| 90 | - 'type' => 'lvl_minier', | |
| 90 | + 'type' => 'lvl_minier', | |
| 91 | 91 | ), | 
| 92 | 92 | |
| 93 | 93 | STAT_LVL_TECH => array( | 
| 94 | - 'type' => 'player_rpg_tech_level', | |
| 94 | + 'type' => 'player_rpg_tech_level', | |
| 95 | 95 | ), | 
| 96 | 96 | |
| 97 | 97 | STAT_LVL_RAID => array( | 
| 98 | - 'type' => 'lvl_raid', | |
| 98 | + 'type' => 'lvl_raid', | |
| 99 | 99 | ), | 
| 100 | 100 | ); | 
| 101 | 101 | stat_tpl_assign($template, $type, 'type', $stat_types, $sn_group_stat_common); | 
| @@ -11,8 +11,8 @@ discard block | ||
| 11 | 11 | global $who; | 
| 12 | 12 | |
| 13 | 13 |    // $sn_group_stat_common = sn_get_groups('STAT_COMMON'); | 
| 14 | -  foreach($array as $key => $value) { | |
| 15 | -    if($array_name == 'type' && $who == 2 && !in_array($key, $sn_group_stat_common)) { | |
| 14 | +  foreach ($array as $key => $value) { | |
| 15 | +    if ($array_name == 'type' && $who == 2 && !in_array($key, $sn_group_stat_common)) { | |
| 16 | 16 | continue; | 
| 17 | 17 | } | 
| 18 | 18 | |
| @@ -28,7 +28,7 @@ discard block | ||
| 28 | 28 | |
| 29 | 29 | $allow_anonymous = true; | 
| 30 | 30 | |
| 31 | -include('common.' . substr(strrchr(__FILE__, '.'), 1)); | |
| 31 | +include('common.'.substr(strrchr(__FILE__, '.'), 1)); | |
| 32 | 32 | |
| 33 | 33 |  lng_include('stat'); | 
| 34 | 34 | |
| @@ -44,7 +44,7 @@ discard block | ||
| 44 | 44 | $subject_list = array( | 
| 45 | 45 |    1 => array('header' => classLocale::$lang['stat_player']), | 
| 46 | 46 | ); | 
| 47 | -if(!$source) { | |
| 47 | +if (!$source) { | |
| 48 | 48 |    $subject_list[2] = array('header' => classLocale::$lang['stat_allys']); | 
| 49 | 49 | } | 
| 50 | 50 | stat_tpl_assign($template, $who, 'subject', $subject_list, $sn_group_stat_common); | 
| @@ -113,7 +113,7 @@ discard block | ||
| 113 | 113 | |
| 114 | 114 | $page_count = floor($record_count / 100); | 
| 115 | 115 | $pages = array(); | 
| 116 | -for($i = 0; $i <= $page_count; $i++) { | |
| 116 | +for ($i = 0; $i <= $page_count; $i++) { | |
| 117 | 117 | $first_element = $i * 100 + 1; | 
| 118 | 118 | $last_element = $first_element + 99; | 
| 119 | 119 | $pages[$first_element] = array( | 
| @@ -133,7 +133,7 @@ discard block | ||
| 133 | 133 | ); | 
| 134 | 134 | //pdump($row); | 
| 135 | 135 | |
| 136 | -  if($who == 1) { | |
| 136 | +  if ($who == 1) { | |
| 137 | 137 | $row_stat['ALLY_NAME'] = $row['ally_name']; | 
| 138 | 138 | $row_stat['ALLY_ID'] = $row['ally_id']; | 
| 139 | 139 | empty($row['username']) ? $row['username'] = $row['name'] : false; | 
| @@ -24,11 +24,11 @@ | ||
| 24 | 24 | |
| 25 | 25 |  // require_once('includes/includes/scheduler_process.php'); | 
| 26 | 26 | |
| 27 | -if(($result = scheduler_process()) && !defined('IN_ADMIN')) { | |
| 27 | +if (($result = scheduler_process()) && !defined('IN_ADMIN')) { | |
| 28 | 28 | $result = htmlspecialchars($result, ENT_QUOTES, 'UTF-8'); | 
| 29 | 29 | print(json_encode($result)); | 
| 30 | 30 | } | 
| 31 | 31 | |
| 32 | -if(!defined('IN_ADMIN')) { | |
| 32 | +if (!defined('IN_ADMIN')) { | |
| 33 | 33 | die(); | 
| 34 | 34 | } | 
| @@ -1,6 +1,6 @@ discard block | ||
| 1 | 1 | <?php | 
| 2 | 2 | |
| 3 | -if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) | |
| 3 | +if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) | |
| 4 | 4 |  { | 
| 5 | 5 |    $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403); | 
| 6 | 6 | } | 
| @@ -20,7 +20,7 @@ discard block | ||
| 20 | 20 |      header('Location: alliance.php'); | 
| 21 | 21 | } | 
| 22 | 22 | |
| 23 | - if($user_request['request_denied']) | |
| 23 | + if ($user_request['request_denied']) | |
| 24 | 24 |    { | 
| 25 | 25 | $lang['request_text'] = sprintf($lang['ali_req_deny_msg'], $ally['ally_tag'], $user_request['request_text']); | 
| 26 | 26 | } | 
| @@ -42,12 +42,12 @@ discard block | ||
| 42 | 42 | |
| 43 | 43 |  $ally = doquery("SELECT * FROM {{alliance}} WHERE `id` ='{$id_ally}'", true); | 
| 44 | 44 | |
| 45 | -if(!$ally) | |
| 45 | +if (!$ally) | |
| 46 | 46 |  { | 
| 47 | 47 | message($lang['ali_sys_notFound'], $lang['ali_req_title']); | 
| 48 | 48 | } | 
| 49 | 49 | |
| 50 | -if($ally['ally_request_notallow']) | |
| 50 | +if ($ally['ally_request_notallow']) | |
| 51 | 51 |  { | 
| 52 | 52 | message($lang['ali_req_not_allowed'], $lang['ali_req_title']); | 
| 53 | 53 | } | 
| @@ -1,6 +1,6 @@ discard block | ||
| 1 | 1 | <?php | 
| 2 | 2 | |
| 3 | -if((!defined('SN_IN_MARKET') || SN_IN_MARKET !== true) && (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true)) { | |
| 3 | +if ((!defined('SN_IN_MARKET') || SN_IN_MARKET !== true) && (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true)) { | |
| 4 | 4 |    $debug->error("Attempt to call market page mode {$mode} directly - not from market.php", 'Forbidden', 403); | 
| 5 | 5 | } | 
| 6 | 6 | |
| @@ -27,12 +27,12 @@ discard block | ||
| 27 | 27 | |
| 28 | 28 | // $dm_db_name = pname_resource_name(RES_DARK_MATTER); | 
| 29 | 29 |    $exchangeTo = in_array($exchangeTo = sys_get_param_int('exchangeTo'), sn_get_groups('resources_trader')) ? $exchangeTo : 0; | 
| 30 | -  if($exchangeTo && is_array($tradeList = $_POST['spend'])) { | |
| 30 | +  if ($exchangeTo && is_array($tradeList = $_POST['spend'])) { | |
| 31 | 31 | $value = 0; | 
| 32 | 32 | $qry = array(); | 
| 33 | 33 | |
| 34 | 34 | sn_db_transaction_start(); | 
| 35 | -    if($planetrow['id_owner']) { | |
| 35 | +    if ($planetrow['id_owner']) { | |
| 36 | 36 | $global_data = sys_o_get_updated($user, $planetrow, SN_TIME_NOW); | 
| 37 | 37 | $planetrow = $global_data['planet']; | 
| 38 | 38 | } | 
| @@ -41,27 +41,27 @@ discard block | ||
| 41 | 41 | $user = db_user_by_id($user['id'], true); | 
| 42 | 42 | } | 
| 43 | 43 | |
| 44 | -    foreach(sn_get_groups('resources_trader') as $resource_id) { | |
| 44 | +    foreach (sn_get_groups('resources_trader') as $resource_id) { | |
| 45 | 45 | $amount = floatval($tradeList[$resource_id]); | 
| 46 | -      if($amount < 0) { | |
| 46 | +      if ($amount < 0) { | |
| 47 | 47 |          $debug->error('Trying to supply negative resource amount on Black Market Page', 'Hack Attempt', 305); | 
| 48 | 48 | } | 
| 49 | 49 | |
| 50 | -      if($resource_id == RES_DARK_MATTER && $exchangeTo == RES_DARK_MATTER) { | |
| 50 | +      if ($resource_id == RES_DARK_MATTER && $exchangeTo == RES_DARK_MATTER) { | |
| 51 | 51 | continue; | 
| 52 | 52 | } | 
| 53 | 53 | |
| 54 | 54 | $resource_db_name = pname_resource_name($resource_id); | 
| 55 | -      if($exchangeTo == RES_DARK_MATTER) { | |
| 55 | +      if ($exchangeTo == RES_DARK_MATTER) { | |
| 56 | 56 | $sign = '+'; | 
| 57 | 57 | $amount = floor($tradeList[RES_DARK_MATTER] / 3 * $rates[RES_DARK_MATTER] / $rates[$resource_id]); | 
| 58 | 58 | $value += $amount; | 
| 59 | 59 |        } else { | 
| 60 | 60 | $value += floor($amount * $rates[$resource_id] / $rates[$exchangeTo]); | 
| 61 | -        if($resource_id == RES_DARK_MATTER) { | |
| 61 | +        if ($resource_id == RES_DARK_MATTER) { | |
| 62 | 62 | $amount = 0; | 
| 63 | 63 |          } else { | 
| 64 | -          if(mrc_get_level($user, $planetrow, $resource_id, true) < $amount) { | |
| 64 | +          if (mrc_get_level($user, $planetrow, $resource_id, true) < $amount) { | |
| 65 | 65 | $intError = MARKET_NO_RESOURCES; | 
| 66 | 66 | break; | 
| 67 | 67 | } | 
| @@ -70,12 +70,12 @@ discard block | ||
| 70 | 70 | } | 
| 71 | 71 | } | 
| 72 | 72 | |
| 73 | -      if($amount) { | |
| 73 | +      if ($amount) { | |
| 74 | 74 |          $qry[] = "`{$resource_db_name}` = `{$resource_db_name}` {$sign} {$amount}"; | 
| 75 | 75 | } | 
| 76 | 76 | } | 
| 77 | 77 | |
| 78 | -    if($exchangeTo != RES_DARK_MATTER) { | |
| 78 | +    if ($exchangeTo != RES_DARK_MATTER) { | |
| 79 | 79 | $amount = floor($value); | 
| 80 | 80 | $exchange_to_db_name = pname_resource_name($exchangeTo); | 
| 81 | 81 |        $qry[] = "`{$exchange_to_db_name}` = `{$exchange_to_db_name}` + {$amount}"; | 
| @@ -86,7 +86,7 @@ discard block | ||
| 86 | 86 | $intError = $value <= 0 ? MARKET_ZERO_DEAL : $intError; | 
| 87 | 87 | $intError = mrc_get_level($user, null, RES_DARK_MATTER) < $operation_cost ? MARKET_NO_DM : $intError; | 
| 88 | 88 | |
| 89 | -    if($intError == MARKET_DEAL) { | |
| 89 | +    if ($intError == MARKET_DEAL) { | |
| 90 | 90 |        $qry = implode(', ', $qry); | 
| 91 | 91 | $table = $planetrow['id_owner'] ? 'planets' : 'users'; | 
| 92 | 92 | |
| @@ -111,8 +111,8 @@ discard block | ||
| 111 | 111 | 'EXCHANGE_TO_RESOURCE_ID' => $exchangeTo, | 
| 112 | 112 | )); | 
| 113 | 113 | |
| 114 | -  foreach(sn_get_groups('resources_trader') as $resource_id) { | |
| 115 | -    if($resource_id == RES_DARK_MATTER) { | |
| 114 | +  foreach (sn_get_groups('resources_trader') as $resource_id) { | |
| 115 | +    if ($resource_id == RES_DARK_MATTER) { | |
| 116 | 116 | $amount = floor(mrc_get_level($user, null, RES_DARK_MATTER) - $config->rpg_cost_trader); | 
| 117 | 117 |      } else { | 
| 118 | 118 | $amount = floor(mrc_get_level($user, $planetrow, $resource_id)); | 
| @@ -38,8 +38,8 @@ discard block | ||
| 38 | 38 | !is_array($offset) ? $offset = array($offset) : false; | 
| 39 | 39 | |
| 40 | 40 | $current_leaf = $this->__get(reset($offset)); | 
| 41 | -    while(($leaf_index = next($offset)) !== false) { | |
| 42 | -      if(!isset($current_leaf) || !is_array($current_leaf) || !isset($current_leaf[$leaf_index])) { | |
| 41 | +    while (($leaf_index = next($offset)) !== false) { | |
| 42 | +      if (!isset($current_leaf) || !is_array($current_leaf) || !isset($current_leaf[$leaf_index])) { | |
| 43 | 43 | unset($current_leaf); | 
| 44 | 44 | break; | 
| 45 | 45 | } | 
| @@ -64,9 +64,9 @@ discard block | ||
| 64 | 64 | |
| 65 | 65 | !is_array($offset) ? $offset = array($offset) : false; | 
| 66 | 66 | |
| 67 | -    if($this->offsetExists($offset)) { | |
| 67 | +    if ($this->offsetExists($offset)) { | |
| 68 | 68 | $result = $this->__get(reset($offset)); | 
| 69 | -      while(($leaf_index = next($offset)) !== false) { | |
| 69 | +      while (($leaf_index = next($offset)) !== false) { | |
| 70 | 70 | $result = $result[$leaf_index]; | 
| 71 | 71 | } | 
| 72 | 72 | } | 
| @@ -91,12 +91,12 @@ discard block | ||
| 91 | 91 | */ | 
| 92 | 92 |    public function offsetSet($offset, $value = null) { | 
| 93 | 93 | // Если нет никакого индекса - значит нечего записывать | 
| 94 | -    if(!isset($offset) || (is_array($offset) && empty($offset))) { | |
| 94 | +    if (!isset($offset) || (is_array($offset) && empty($offset))) { | |
| 95 | 95 | return; | 
| 96 | 96 | } | 
| 97 | 97 | |
| 98 | 98 | // Если в массиве индекса только один элемент - значит это просто индекс | 
| 99 | -    if(is_array($offset) && count($offset) == 1) { | |
| 99 | +    if (is_array($offset) && count($offset) == 1) { | |
| 100 | 100 | // Разворачиваем его в индекс | 
| 101 | 101 | $offset = array(reset($offset) => $value); | 
| 102 | 102 | unset($value); | 
| @@ -104,20 +104,20 @@ discard block | ||
| 104 | 104 | } | 
| 105 | 105 | |
| 106 | 106 | // Адресация многомерного массива через массив индексов в $option | 
| 107 | -    if(is_array($offset) && isset($value)) { | |
| 107 | +    if (is_array($offset) && isset($value)) { | |
| 108 | 108 | // TODO - а не переделать ли это всё на __isset() ?? | 
| 109 | 109 | //pdump($offset, '$offset'); | 
| 110 | 110 | //pdump($value, '$value'); | 
| 111 | 111 | // Вытаскиваем корневой элемент | 
| 112 | 112 | $root = $this->__get(reset($offset)); | 
| 113 | 113 | $current_leaf = &$root; | 
| 114 | -      while(($leaf_index = next($offset)) !== false) { | |
| 114 | +      while (($leaf_index = next($offset)) !== false) { | |
| 115 | 115 | !is_array($current_leaf[$leaf_index]) ? $current_leaf[$leaf_index] = array() : false; | 
| 116 | 116 | $current_leaf = &$current_leaf[$leaf_index]; | 
| 117 | 117 | } | 
| 118 | 118 | //pdump($current_leaf, '$current_leaf'); | 
| 119 | 119 | //pdump($value, '$value'); | 
| 120 | -      if($current_leaf != $value) { | |
| 120 | +      if ($current_leaf != $value) { | |
| 121 | 121 | $current_leaf = $value; | 
| 122 | 122 | //pdump(reset($offset), 'reset($offset)'); | 
| 123 | 123 | //pdump($root, '$root'); | 
| @@ -128,7 +128,7 @@ discard block | ||
| 128 | 128 | // Пакетная запись из массива ключ -> значение | 
| 129 | 129 | !is_array($offset) ? $offset = array($offset => $value) : false; | 
| 130 | 130 | |
| 131 | -      foreach($offset as $key => $value) { | |
| 131 | +      foreach ($offset as $key => $value) { | |
| 132 | 132 | $this->__get($key) !== $value ? $this->__set($key, $value) : false; | 
| 133 | 133 | } | 
| 134 | 134 | } | 
| @@ -149,13 +149,13 @@ discard block | ||
| 149 | 149 | */ | 
| 150 | 150 |    public function offsetUnset($offset) { | 
| 151 | 151 | // Если нет никакого индекса - значит нечего записывать | 
| 152 | -    if(!isset($offset) || (is_array($offset) && empty($offset))) { | |
| 152 | +    if (!isset($offset) || (is_array($offset) && empty($offset))) { | |
| 153 | 153 | return; | 
| 154 | 154 | } | 
| 155 | 155 | |
| 156 | 156 | !is_array($offset) ? $offset = array($offset) : false; | 
| 157 | 157 | |
| 158 | -    if($this->offsetExists($offset)) { | |
| 158 | +    if ($this->offsetExists($offset)) { | |
| 159 | 159 | //pdump($offset); | 
| 160 | 160 | // Перематываем массив в конец | 
| 161 | 161 | $key_to_delete = end($offset); | 
| @@ -163,7 +163,7 @@ discard block | ||
| 163 | 163 | //pdump($key_to_delete, '$key_to_delete'); | 
| 164 | 164 | $parent_offset = $offset; | 
| 165 | 165 | array_pop($parent_offset); | 
| 166 | -      if(!count($parent_offset)) { | |
| 166 | +      if (!count($parent_offset)) { | |
| 167 | 167 | // В массиве был один элемент - мы удаляем в корне. Просто удаляем элемент | 
| 168 | 168 | $this->__unset($key_to_delete); | 
| 169 | 169 |        } else { | 
| @@ -41,7 +41,7 @@ | ||
| 41 | 41 |        // $query = static::$db->doquery("SELECT `id` FROM {{confirmations}} WHERE `code` = '{$confirm_code_safe}' AND `type` = {$confirmation_type_safe} FOR UPDATE", true); | 
| 42 | 42 | // Тип не нужен для проверки - код подтверждения должен быть уникален от слова "совсем" | 
| 43 | 43 |        $query = $this->db->doquery("SELECT `id` FROM {{confirmations}} WHERE `code` = '{$confirm_code_safe}' FOR UPDATE", true); | 
| 44 | - } while($query); | |
| 44 | + } while ($query); | |
| 45 | 45 | |
| 46 | 46 | $this->db->doquery( | 
| 47 | 47 |        "REPLACE INTO {{confirmations}} | 
| @@ -25,11 +25,11 @@ discard block | ||
| 25 | 25 | class template | 
| 26 | 26 |  { | 
| 27 | 27 | /** variable that holds all the data we'll be substituting into | 
| 28 | - * the compiled templates. Takes form: | |
| 29 | - * --> $this->_tpldata[block][iteration#][child][iteration#][child2][iteration#][variablename] == value | |
| 30 | - * if it's a root-level variable, it'll be like this: | |
| 31 | - * --> $this->_tpldata[.][0][varname] == value | |
| 32 | - */ | |
| 28 | + * the compiled templates. Takes form: | |
| 29 | + * --> $this->_tpldata[block][iteration#][child][iteration#][child2][iteration#][variablename] == value | |
| 30 | + * if it's a root-level variable, it'll be like this: | |
| 31 | + * --> $this->_tpldata[.][0][varname] == value | |
| 32 | + */ | |
| 33 | 33 |    var $_tpldata = array('.' => array(0 => array())); | 
| 34 | 34 | var $_rootref; | 
| 35 | 35 | // var $_block_counter = array(); | 
| @@ -60,9 +60,9 @@ discard block | ||
| 60 | 60 | var $parsed = false; | 
| 61 | 61 | |
| 62 | 62 | /** | 
| 63 | - * Set template location | |
| 64 | - * @access public | |
| 65 | - */ | |
| 63 | + * Set template location | |
| 64 | + * @access public | |
| 65 | + */ | |
| 66 | 66 | function set_template() | 
| 67 | 67 |    { | 
| 68 | 68 | global $phpbb_root_path, $user; | 
| @@ -101,9 +101,9 @@ discard block | ||
| 101 | 101 | } | 
| 102 | 102 | |
| 103 | 103 | /** | 
| 104 | - * Set custom template location (able to use directory outside of phpBB) | |
| 105 | - * @access public | |
| 106 | - */ | |
| 104 | + * Set custom template location (able to use directory outside of phpBB) | |
| 105 | + * @access public | |
| 106 | + */ | |
| 107 | 107 | function set_custom_template($template_path, $template_name, $fallback_template_path = false) | 
| 108 | 108 |    { | 
| 109 | 109 | global $phpbb_root_path, $user; | 
| @@ -142,10 +142,10 @@ discard block | ||
| 142 | 142 | } | 
| 143 | 143 | |
| 144 | 144 | /** | 
| 145 | - * Sets the template filenames for handles. $filename_array | |
| 146 | - * should be a hash of handle => filename pairs. | |
| 147 | - * @access public | |
| 148 | - */ | |
| 145 | + * Sets the template filenames for handles. $filename_array | |
| 146 | + * should be a hash of handle => filename pairs. | |
| 147 | + * @access public | |
| 148 | + */ | |
| 149 | 149 | function set_filenames($filename_array) | 
| 150 | 150 |    { | 
| 151 | 151 | if (!is_array($filename_array)) | 
| @@ -172,9 +172,9 @@ discard block | ||
| 172 | 172 | } | 
| 173 | 173 | |
| 174 | 174 | /** | 
| 175 | - * Destroy template data set | |
| 176 | - * @access public | |
| 177 | - */ | |
| 175 | + * Destroy template data set | |
| 176 | + * @access public | |
| 177 | + */ | |
| 178 | 178 | function destroy() | 
| 179 | 179 |    { | 
| 180 | 180 |      $this->_tpldata = array('.' => array(0 => array())); | 
| @@ -182,9 +182,9 @@ discard block | ||
| 182 | 182 | } | 
| 183 | 183 | |
| 184 | 184 | /** | 
| 185 | - * Reset/empty complete block | |
| 186 | - * @access public | |
| 187 | - */ | |
| 185 | + * Reset/empty complete block | |
| 186 | + * @access public | |
| 187 | + */ | |
| 188 | 188 | function destroy_block_vars($blockname) | 
| 189 | 189 |    { | 
| 190 | 190 | if (strpos($blockname, '.') !== false) | 
| @@ -212,9 +212,9 @@ discard block | ||
| 212 | 212 | } | 
| 213 | 213 | |
| 214 | 214 | /** | 
| 215 | - * Display handle | |
| 216 | - * @access public | |
| 217 | - */ | |
| 215 | + * Display handle | |
| 216 | + * @access public | |
| 217 | + */ | |
| 218 | 218 | function display($handle, $include_once = true) | 
| 219 | 219 |    { | 
| 220 | 220 | global $user, $phpbb_hook, $lang, $config; | 
| @@ -248,9 +248,9 @@ discard block | ||
| 248 | 248 | } | 
| 249 | 249 | |
| 250 | 250 | /** | 
| 251 | - * Display the handle and assign the output to a template variable or return the compiled result. | |
| 252 | - * @access public | |
| 253 | - */ | |
| 251 | + * Display the handle and assign the output to a template variable or return the compiled result. | |
| 252 | + * @access public | |
| 253 | + */ | |
| 254 | 254 | function assign_display($handle, $template_var = '', $return_content = true, $include_once = false) | 
| 255 | 255 |    { | 
| 256 | 256 | ob_start(); | 
| @@ -268,9 +268,9 @@ discard block | ||
| 268 | 268 | } | 
| 269 | 269 | |
| 270 | 270 | /** | 
| 271 | - * Load a compiled template if possible, if not, recompile it | |
| 272 | - * @access private | |
| 273 | - */ | |
| 271 | + * Load a compiled template if possible, if not, recompile it | |
| 272 | + * @access private | |
| 273 | + */ | |
| 274 | 274 | function _tpl_load(&$handle) | 
| 275 | 275 |    { | 
| 276 | 276 | global $user, $config; | 
| @@ -453,9 +453,9 @@ discard block | ||
| 453 | 453 | } | 
| 454 | 454 | |
| 455 | 455 | /** | 
| 456 | - * Assign key variable pairs from an array | |
| 457 | - * @access public | |
| 458 | - */ | |
| 456 | + * Assign key variable pairs from an array | |
| 457 | + * @access public | |
| 458 | + */ | |
| 459 | 459 | function assign_vars($vararray) | 
| 460 | 460 |    { | 
| 461 | 461 | foreach ($vararray as $key => $val) | 
| @@ -467,9 +467,9 @@ discard block | ||
| 467 | 467 | } | 
| 468 | 468 | |
| 469 | 469 | /** | 
| 470 | - * Assign a single variable to a single key | |
| 471 | - * @access public | |
| 472 | - */ | |
| 470 | + * Assign a single variable to a single key | |
| 471 | + * @access public | |
| 472 | + */ | |
| 473 | 473 | function assign_var($varname, $varval) | 
| 474 | 474 |    { | 
| 475 | 475 | $this->_rootref[$varname] = $varval; | 
| @@ -478,9 +478,9 @@ discard block | ||
| 478 | 478 | } | 
| 479 | 479 | |
| 480 | 480 | /** | 
| 481 | - * Assign key variable pairs from an array to a specified block | |
| 482 | - * @access public | |
| 483 | - */ | |
| 481 | + * Assign key variable pairs from an array to a specified block | |
| 482 | + * @access public | |
| 483 | + */ | |
| 484 | 484 | function assign_block_vars($blockname, $vararray) | 
| 485 | 485 |    { | 
| 486 | 486 | if (strpos($blockname, '.') !== false) | 
| @@ -545,33 +545,33 @@ discard block | ||
| 545 | 545 | } | 
| 546 | 546 | |
| 547 | 547 | /** | 
| 548 | - * Change already assigned key variable pair (one-dimensional - single loop entry) | |
| 549 | - * | |
| 550 | - * An example of how to use this function: | |
| 551 | -  * {@example alter_block_array.php} | |
| 552 | - * | |
| 553 | - * @param string $blockname the blockname, for example 'loop' | |
| 554 | - * @param array $vararray the var array to insert/add or merge | |
| 555 | - * @param mixed $key Key to search for | |
| 556 | - * | |
| 557 | - * array: KEY => VALUE [the key/value pair to search for within the loop to determine the correct position] | |
| 558 | - * | |
| 559 | - * int: Position [the position to change or insert at directly given] | |
| 560 | - * | |
| 561 | - * If key is false the position is set to 0 | |
| 562 | - * If key is true the position is set to the last entry | |
| 563 | - * | |
| 564 | - * @param string $mode Mode to execute (valid modes are 'insert' and 'change') | |
| 565 | - * | |
| 566 | - * If insert, the vararray is inserted at the given position (position counting from zero). | |
| 567 | - * If change, the current block gets merged with the vararray (resulting in new key/value pairs be added and existing keys be replaced by the new value). | |
| 568 | - * | |
| 569 | - * Since counting begins by zero, inserting at the last position will result in this array: array(vararray, last positioned array) | |
| 570 | - * and inserting at position 1 will result in this array: array(first positioned array, vararray, following vars) | |
| 571 | - * | |
| 572 | - * @return bool false on error, true on success | |
| 573 | - * @access public | |
| 574 | - */ | |
| 548 | + * Change already assigned key variable pair (one-dimensional - single loop entry) | |
| 549 | + * | |
| 550 | + * An example of how to use this function: | |
| 551 | +   * {@example alter_block_array.php} | |
| 552 | + * | |
| 553 | + * @param string $blockname the blockname, for example 'loop' | |
| 554 | + * @param array $vararray the var array to insert/add or merge | |
| 555 | + * @param mixed $key Key to search for | |
| 556 | + * | |
| 557 | + * array: KEY => VALUE [the key/value pair to search for within the loop to determine the correct position] | |
| 558 | + * | |
| 559 | + * int: Position [the position to change or insert at directly given] | |
| 560 | + * | |
| 561 | + * If key is false the position is set to 0 | |
| 562 | + * If key is true the position is set to the last entry | |
| 563 | + * | |
| 564 | + * @param string $mode Mode to execute (valid modes are 'insert' and 'change') | |
| 565 | + * | |
| 566 | + * If insert, the vararray is inserted at the given position (position counting from zero). | |
| 567 | + * If change, the current block gets merged with the vararray (resulting in new key/value pairs be added and existing keys be replaced by the new value). | |
| 568 | + * | |
| 569 | + * Since counting begins by zero, inserting at the last position will result in this array: array(vararray, last positioned array) | |
| 570 | + * and inserting at position 1 will result in this array: array(first positioned array, vararray, following vars) | |
| 571 | + * | |
| 572 | + * @return bool false on error, true on success | |
| 573 | + * @access public | |
| 574 | + */ | |
| 575 | 575 | function alter_block_array($blockname, $vararray, $key = false, $mode = 'insert') | 
| 576 | 576 |    { | 
| 577 | 577 | if (strpos($blockname, '.') !== false) | 
| @@ -655,9 +655,9 @@ discard block | ||
| 655 | 655 | } | 
| 656 | 656 | |
| 657 | 657 | /** | 
| 658 | - * Include a separate template | |
| 659 | - * @access private | |
| 660 | - */ | |
| 658 | + * Include a separate template | |
| 659 | + * @access private | |
| 660 | + */ | |
| 661 | 661 | function _tpl_include($filename, $include = true) | 
| 662 | 662 |    { | 
| 663 | 663 | global $lang, $config; | 
| @@ -686,9 +686,9 @@ discard block | ||
| 686 | 686 | } | 
| 687 | 687 | |
| 688 | 688 | /** | 
| 689 | - * Include a php-file | |
| 690 | - * @access private | |
| 691 | - */ | |
| 689 | + * Include a php-file | |
| 690 | + * @access private | |
| 691 | + */ | |
| 692 | 692 | function _php_include($filename) | 
| 693 | 693 |    { | 
| 694 | 694 | global $phpbb_root_path; | 
| @@ -705,9 +705,9 @@ discard block | ||
| 705 | 705 | } | 
| 706 | 706 | |
| 707 | 707 | /** | 
| 708 | - * Assign key variable pairs from an array with block support | |
| 709 | - * @access public | |
| 710 | - */ | |
| 708 | + * Assign key variable pairs from an array with block support | |
| 709 | + * @access public | |
| 710 | + */ | |
| 711 | 711 | function assign_recursive($values, $name = '') | 
| 712 | 712 |    { | 
| 713 | 713 | if(isset($values['.'])) | 
| @@ -61,10 +61,10 @@ discard block | ||
| 61 | 61 |    { | 
| 62 | 62 | global $phpbb_root_path, $user; | 
| 63 | 63 | |
| 64 | - if (file_exists($phpbb_root_path . 'styles/' . $user->theme['template_path'] . '/template')) | |
| 64 | + if (file_exists($phpbb_root_path.'styles/'.$user->theme['template_path'].'/template')) | |
| 65 | 65 |      { | 
| 66 | - $this->root = $phpbb_root_path . 'styles/' . $user->theme['template_path'] . '/template'; | |
| 67 | -      $this->cachepath = $phpbb_root_path . 'cache/tpl_' . str_replace('_', '-', $user->theme['template_path']) . '_'; | |
| 66 | + $this->root = $phpbb_root_path.'styles/'.$user->theme['template_path'].'/template'; | |
| 67 | +      $this->cachepath = $phpbb_root_path.'cache/tpl_'.str_replace('_', '-', $user->theme['template_path']).'_'; | |
| 68 | 68 | |
| 69 | 69 | if ($this->orig_tpl_storedb === null) | 
| 70 | 70 |        { | 
| @@ -81,12 +81,12 @@ discard block | ||
| 81 | 81 | |
| 82 | 82 | if ($user->theme['template_inherits_id']) | 
| 83 | 83 |        { | 
| 84 | - $this->inherit_root = $phpbb_root_path . 'styles/' . $user->theme['template_inherit_path'] . '/template'; | |
| 84 | + $this->inherit_root = $phpbb_root_path.'styles/'.$user->theme['template_inherit_path'].'/template'; | |
| 85 | 85 | } | 
| 86 | 86 | } | 
| 87 | 87 | else | 
| 88 | 88 |      { | 
| 89 | -      trigger_error('Template path could not be found: styles/' . $user->theme['template_path'] . '/template', E_USER_ERROR); | |
| 89 | +      trigger_error('Template path could not be found: styles/'.$user->theme['template_path'].'/template', E_USER_ERROR); | |
| 90 | 90 | } | 
| 91 | 91 | |
| 92 | 92 | $this->_rootref = &$this->_tpldata['.'][0]; | 
| @@ -109,7 +109,7 @@ discard block | ||
| 109 | 109 | } | 
| 110 | 110 | |
| 111 | 111 | $this->root = $template_path; | 
| 112 | -    $this->cachepath = $phpbb_root_path . 'cache/ctpl_' . str_replace('_', '-', $template_name) . '_'; | |
| 112 | +    $this->cachepath = $phpbb_root_path.'cache/ctpl_'.str_replace('_', '-', $template_name).'_'; | |
| 113 | 113 | |
| 114 | 114 | if ($fallback_template_path !== false) | 
| 115 | 115 |      { | 
| @@ -154,11 +154,11 @@ discard block | ||
| 154 | 154 | } | 
| 155 | 155 | |
| 156 | 156 | $this->filename[$handle] = $filename; | 
| 157 | - $this->files[$handle] = $this->root . '/' . $filename; | |
| 157 | + $this->files[$handle] = $this->root.'/'.$filename; | |
| 158 | 158 | |
| 159 | 159 | if ($this->inherit_root) | 
| 160 | 160 |        { | 
| 161 | - $this->files_inherit[$handle] = $this->inherit_root . '/' . $filename; | |
| 161 | + $this->files_inherit[$handle] = $this->inherit_root.'/'.$filename; | |
| 162 | 162 | } | 
| 163 | 163 | } | 
| 164 | 164 | |
| @@ -235,7 +235,7 @@ discard block | ||
| 235 | 235 | } | 
| 236 | 236 | else | 
| 237 | 237 |      { | 
| 238 | -      eval(' ?>' . $this->compiled_code[$handle] . '<?php '); | |
| 238 | +      eval(' ?>'.$this->compiled_code[$handle].'<?php '); | |
| 239 | 239 | } | 
| 240 | 240 | |
| 241 | 241 | return true; | 
| @@ -280,7 +280,7 @@ discard block | ||
| 280 | 280 | //$user->theme['template_storedb'] = $this->orig_tpl_storedb; | 
| 281 | 281 | //$user->theme['template_inherits_id'] = $this->orig_tpl_inherits_id; | 
| 282 | 282 | |
| 283 | -    $filename = $this->cachepath . str_replace('/', '.', $this->filename[$handle]) . DOT_PHP_EX; | |
| 283 | +    $filename = $this->cachepath.str_replace('/', '.', $this->filename[$handle]).DOT_PHP_EX; | |
| 284 | 284 | //$this->files_template[$handle] = (isset($user->theme['template_id'])) ? $user->theme['template_id'] : 0; | 
| 285 | 285 | |
| 286 | 286 | $recompile = false; | 
| @@ -309,7 +309,7 @@ discard block | ||
| 309 | 309 | |
| 310 | 310 |      if (!class_exists('template_compile')) | 
| 311 | 311 |      { | 
| 312 | - include($phpbb_root_path . 'includes/functions_template' . DOT_PHP_EX); | |
| 312 | + include($phpbb_root_path.'includes/functions_template'.DOT_PHP_EX); | |
| 313 | 313 | } | 
| 314 | 314 | |
| 315 | 315 | // Inheritance - we point to another template file for this one. Equality is also used for store_db | 
| @@ -348,10 +348,10 @@ discard block | ||
| 348 | 348 | foreach ($ids as $id) | 
| 349 | 349 |        { | 
| 350 | 350 | $sql = 'SELECT * | 
| 351 | - FROM ' . STYLES_TEMPLATE_DATA_TABLE . ' | |
| 352 | - WHERE template_id = ' . $id . " | |
| 353 | - AND (template_filename = '" . $db->sql_escape($this->filename[$handle]) . "' | |
| 354 | - OR template_included " . $db->sql_like_expression($db->any_char . $this->filename[$handle] . ':' . $db->any_char) . ')'; | |
| 351 | + FROM ' . STYLES_TEMPLATE_DATA_TABLE.' | |
| 352 | + WHERE template_id = ' . $id." | |
| 353 | + AND (template_filename = '" . $db->sql_escape($this->filename[$handle])."' | |
| 354 | + OR template_included " . $db->sql_like_expression($db->any_char.$this->filename[$handle].':'.$db->any_char).')'; | |
| 355 | 355 | |
| 356 | 356 | $result = $db->sql_query($sql); | 
| 357 | 357 | while ($row = $db->sql_fetchrow($result)) | 
| @@ -365,14 +365,14 @@ discard block | ||
| 365 | 365 |        { | 
| 366 | 366 | foreach ($rows as $row) | 
| 367 | 367 |          { | 
| 368 | - $file = $this->root . '/' . $row['template_filename']; | |
| 368 | + $file = $this->root.'/'.$row['template_filename']; | |
| 369 | 369 | $force_reload = false; | 
| 370 | 370 | if ($row['template_id'] != $user->theme['template_id']) | 
| 371 | 371 |            { | 
| 372 | 372 | // make sure that we are not overlooking a file not in the db yet | 
| 373 | 373 | if (isset($user->theme['template_inherits_id']) && $user->theme['template_inherits_id'] && !file_exists($file)) | 
| 374 | 374 |              { | 
| 375 | - $file = $this->inherit_root . '/' . $row['template_filename']; | |
| 375 | + $file = $this->inherit_root.'/'.$row['template_filename']; | |
| 376 | 376 | $this->files[$row['template_filename']] = $file; | 
| 377 | 377 | $this->files_inherit[$row['template_filename']] = $file; | 
| 378 | 378 | $this->files_template[$row['template_filename']] = $user->theme['template_inherits_id']; | 
| @@ -414,7 +414,7 @@ discard block | ||
| 414 | 414 | else | 
| 415 | 415 |            { | 
| 416 | 416 | // Only bother compiling if it doesn't already exist | 
| 417 | -            if (!file_exists($this->cachepath . str_replace('/', '.', $row['template_filename']) . DOT_PHP_EX)) | |
| 417 | +            if (!file_exists($this->cachepath.str_replace('/', '.', $row['template_filename']).DOT_PHP_EX)) | |
| 418 | 418 |              { | 
| 419 | 419 | $this->filename[$row['template_filename']] = $row['template_filename']; | 
| 420 | 420 | $compile->compile_write($row['template_filename'], $compile->compile(trim($row['template_data']))); | 
| @@ -425,11 +425,11 @@ discard block | ||
| 425 | 425 | } | 
| 426 | 426 | else | 
| 427 | 427 |        { | 
| 428 | - $file = $this->root . '/' . $row['template_filename']; | |
| 428 | + $file = $this->root.'/'.$row['template_filename']; | |
| 429 | 429 | |
| 430 | 430 | if (isset($user->theme['template_inherits_id']) && $user->theme['template_inherits_id'] && !file_exists($file)) | 
| 431 | 431 |          { | 
| 432 | - $file = $this->inherit_root . '/' . $row['template_filename']; | |
| 432 | + $file = $this->inherit_root.'/'.$row['template_filename']; | |
| 433 | 433 | $this->files[$row['template_filename']] = $file; | 
| 434 | 434 | $this->files_inherit[$row['template_filename']] = $file; | 
| 435 | 435 | $this->files_template[$row['template_filename']] = $user->theme['template_inherits_id']; | 
| @@ -622,7 +622,7 @@ discard block | ||
| 622 | 622 | // Re-position template blocks | 
| 623 | 623 | for ($i = sizeof($this->_tpldata[$blockname]); $i > $key; $i--) | 
| 624 | 624 |        { | 
| 625 | - $this->_tpldata[$blockname][$i] = $this->_tpldata[$blockname][$i-1]; | |
| 625 | + $this->_tpldata[$blockname][$i] = $this->_tpldata[$blockname][$i - 1]; | |
| 626 | 626 | $this->_tpldata[$blockname][$i]['S_ROW_COUNT'] = $i; | 
| 627 | 627 | } | 
| 628 | 628 | |
| @@ -656,10 +656,10 @@ discard block | ||
| 656 | 656 |    { | 
| 657 | 657 | $handle = $filename; | 
| 658 | 658 | $this->filename[$handle] = $filename; | 
| 659 | - $this->files[$handle] = $this->root . '/' . $filename; | |
| 659 | + $this->files[$handle] = $this->root.'/'.$filename; | |
| 660 | 660 | if ($this->inherit_root) | 
| 661 | 661 |      { | 
| 662 | - $this->files_inherit[$handle] = $this->inherit_root . '/' . $filename; | |
| 662 | + $this->files_inherit[$handle] = $this->inherit_root.'/'.$filename; | |
| 663 | 663 | } | 
| 664 | 664 | |
| 665 | 665 | $filename = $this->_tpl_load($handle); | 
| @@ -673,7 +673,7 @@ discard block | ||
| 673 | 673 | include($filename); | 
| 674 | 674 | return; | 
| 675 | 675 | } | 
| 676 | -      eval(' ?>' . $this->compiled_code[$handle] . '<?php '); | |
| 676 | +      eval(' ?>'.$this->compiled_code[$handle].'<?php '); | |
| 677 | 677 | } | 
| 678 | 678 | } | 
| 679 | 679 | |
| @@ -685,12 +685,12 @@ discard block | ||
| 685 | 685 |    { | 
| 686 | 686 | global $phpbb_root_path; | 
| 687 | 687 | |
| 688 | - $file = $phpbb_root_path . $filename; | |
| 688 | + $file = $phpbb_root_path.$filename; | |
| 689 | 689 | |
| 690 | 690 | if (!file_exists($file)) | 
| 691 | 691 |      { | 
| 692 | 692 | // trigger_error cannot be used here, as the output already started | 
| 693 | - echo 'template->_php_include(): File ' . htmlspecialchars($file) . ' does not exist or is empty'; | |
| 693 | + echo 'template->_php_include(): File '.htmlspecialchars($file).' does not exist or is empty'; | |
| 694 | 694 | return; | 
| 695 | 695 | } | 
| 696 | 696 | include($file); | 
| @@ -702,13 +702,13 @@ discard block | ||
| 702 | 702 | */ | 
| 703 | 703 | function assign_recursive($values, $name = '') | 
| 704 | 704 |    { | 
| 705 | - if(isset($values['.'])) | |
| 705 | + if (isset($values['.'])) | |
| 706 | 706 |      { | 
| 707 | 707 | $values_extra = $values['.']; | 
| 708 | 708 | unset($values['.']); | 
| 709 | 709 | } | 
| 710 | 710 | |
| 711 | - if(!$name) | |
| 711 | + if (!$name) | |
| 712 | 712 |      { | 
| 713 | 713 | $this->assign_vars($values); | 
| 714 | 714 | } | 
| @@ -717,12 +717,12 @@ discard block | ||
| 717 | 717 | $this->assign_block_vars($name, $values); | 
| 718 | 718 | } | 
| 719 | 719 | |
| 720 | - if(isset($values_extra)) | |
| 720 | + if (isset($values_extra)) | |
| 721 | 721 |      { | 
| 722 | - foreach($values_extra as $sub_array_name => $sub_array) | |
| 722 | + foreach ($values_extra as $sub_array_name => $sub_array) | |
| 723 | 723 |        { | 
| 724 | - $new_name = $name . ($name ? '.' : '') . $sub_array_name; | |
| 725 | - foreach($sub_array as $sub_element) | |
| 724 | + $new_name = $name.($name ? '.' : '').$sub_array_name; | |
| 725 | + foreach ($sub_array as $sub_element) | |
| 726 | 726 |          { | 
| 727 | 727 | $this->assign_recursive($sub_element, $new_name); | 
| 728 | 728 | } | 
| @@ -35,7 +35,7 @@ discard block | ||
| 35 | 35 | */ | 
| 36 | 36 | // OK 4.9 | 
| 37 | 37 |    public function __construct($filename = __FILE__) { | 
| 38 | -    if($this->provider_id == ACCOUNT_PROVIDER_NONE) { | |
| 38 | +    if ($this->provider_id == ACCOUNT_PROVIDER_NONE) { | |
| 39 | 39 |        die('У всех провайдеров должен быть $provider_id!'); | 
| 40 | 40 | } | 
| 41 | 41 | |
| @@ -133,7 +133,7 @@ discard block | ||
| 133 | 133 | // OK 4.6 | 
| 134 | 134 |    public function player_name_suggest() { | 
| 135 | 135 | $name = ''; | 
| 136 | -    if(is_object($this->account) && !empty($this->account->account_email)) { | |
| 136 | +    if (is_object($this->account) && !empty($this->account->account_email)) { | |
| 137 | 137 |        list($name) = explode('@', $this->account->account_email); | 
| 138 | 138 | } | 
| 139 | 139 | |
| @@ -53,7 +53,7 @@ discard block | ||
| 53 | 53 | // $same_user = false; | 
| 54 | 54 | // } | 
| 55 | 55 | |
| 56 | -  if(!$user_data) { | |
| 56 | +  if (!$user_data) { | |
| 57 | 57 | message($lang['imp_imperator_none'], $lang['sys_error'], 'index.php', 10); | 
| 58 | 58 | die(); | 
| 59 | 59 | } | 
| @@ -64,15 +64,15 @@ discard block | ||
| 64 | 64 | $stat_array = array(); | 
| 65 | 65 |    $query = doquery("SELECT * FROM {{statpoints}} WHERE `stat_type` = 1 AND `id_owner` = {$user_id} ORDER BY `stat_code` DESC;"); | 
| 66 | 66 | $stat_count = classSupernova::$db->db_affected_rows(); | 
| 67 | -  while($row = db_fetch($query)) { | |
| 68 | -    foreach($stat_fields as $field_db_name => $field_template_name) { | |
| 67 | +  while ($row = db_fetch($query)) { | |
| 68 | +    foreach ($stat_fields as $field_db_name => $field_template_name) { | |
| 69 | 69 | // $stat_count - $row['stat_code'] - для реверсирования ID статы в JS | 
| 70 | 70 | $stat_array[$field_template_name]['DATA'][$stat_count - $row['stat_code']] = $row[$field_db_name]; | 
| 71 | 71 | } | 
| 72 | 72 | } | 
| 73 | 73 | |
| 74 | 74 | $stat_array_date = $stat_array['STAT_DATE']; | 
| 75 | -  foreach($stat_array_date['DATA'] as $key => $value) { | |
| 75 | +  foreach ($stat_array_date['DATA'] as $key => $value) { | |
| 76 | 76 |      $template->assign_block_vars('stat_date', array( | 
| 77 | 77 | 'ID' => $key, | 
| 78 | 78 | 'VALUE' => $value, | 
| @@ -85,17 +85,17 @@ discard block | ||
| 85 | 85 | |
| 86 | 86 | unset($stat_array['STAT_DATE']); | 
| 87 | 87 | $template_data = array(); | 
| 88 | -  foreach($stat_array as $stat_type => &$stat_type_data) { | |
| 88 | +  foreach ($stat_array as $stat_type => &$stat_type_data) { | |
| 89 | 89 | $reverse_min_max = strpos($stat_type, '_RANK') !== false; | 
| 90 | 90 | $stat_type_data['MIN'] = $reverse_min_max ? max($stat_type_data['DATA']) : min($stat_type_data['DATA']); | 
| 91 | 91 | $stat_type_data['MAX'] = $reverse_min_max ? min($stat_type_data['DATA']) : max($stat_type_data['DATA']); | 
| 92 | 92 | $stat_type_data['AVG'] = average($stat_type_data['DATA']); | 
| 93 | -    foreach($stat_type_data['DATA'] as $key => $value) { | |
| 93 | +    foreach ($stat_type_data['DATA'] as $key => $value) { | |
| 94 | 94 | // $stat_type_data['PERCENT'][$key] = $stat_type_data['MAX'] - $value ? ($stat_type_data['MAX'] - $stat_type_data['MIN']) / ($stat_type_data['MAX'] - $value) : 100; | 
| 95 | 95 | $stat_type_data['PERCENT'][$key] = ($stat_type_data['MAX'] - $value ? ($value - $stat_type_data['MIN']) / ($stat_type_data['MAX'] - $stat_type_data['MIN']) : 1) * 100; | 
| 96 | 96 | $template_data[$stat_type][$key]['ID'] = $key; | 
| 97 | 97 | $template_data[$stat_type][$key]['VALUE'] = $value; | 
| 98 | - $template_data[$stat_type][$key]['DELTA'] = ($reverse_min_max ? $stat_type_data['MIN'] - $value : $value - $stat_type_data['MAX']); | |
| 98 | + $template_data[$stat_type][$key]['DELTA'] = ($reverse_min_max ? $stat_type_data['MIN'] - $value : $value - $stat_type_data['MAX']); | |
| 99 | 99 | $template_data[$stat_type][$key]['PERCENT'] = $stat_type_data['PERCENT'][$key]; | 
| 100 | 100 | |
| 101 | 101 | //$template_data[$stat_type][$key]['PERCENT'] = $key ? $stat_type_data['PERCENT'][$key] : 50; // TODO DEBUG | 
| @@ -103,7 +103,7 @@ discard block | ||
| 103 | 103 | } | 
| 104 | 104 | // pdump($stat_array['RES_POINTS']); | 
| 105 | 105 | |
| 106 | -  foreach($template_data as $stat_type => $stat_type_data) { | |
| 106 | +  foreach ($template_data as $stat_type => $stat_type_data) { | |
| 107 | 107 |      $template->assign_block_vars('stat', array( | 
| 108 | 108 | 'TYPE' => $stat_type, | 
| 109 | 109 | 'TEXT' => $lang['imp_stat_types'][$stat_type], | 
| @@ -111,7 +111,7 @@ discard block | ||
| 111 | 111 | 'MAX' => $stat_array[$stat_type]['MAX'], | 
| 112 | 112 | 'AVG' => $stat_array[$stat_type]['AVG'], | 
| 113 | 113 | )); | 
| 114 | -    foreach($stat_type_data as $stat_entry) { | |
| 114 | +    foreach ($stat_type_data as $stat_entry) { | |
| 115 | 115 |        $template->assign_block_vars('stat.entry', $stat_entry); | 
| 116 | 116 | } | 
| 117 | 117 | } | 
| @@ -119,7 +119,7 @@ discard block | ||
| 119 | 119 | |
| 120 | 120 | // pdump($template_data); | 
| 121 | 121 | |
| 122 | -  if($same_user) { | |
| 122 | +  if ($same_user) { | |
| 123 | 123 | rpg_level_up($user, RPG_STRUCTURE); | 
| 124 | 124 | rpg_level_up($user, RPG_RAID); | 
| 125 | 125 | rpg_level_up($user, RPG_TECH); | 
| @@ -153,29 +153,29 @@ discard block | ||
| 153 | 153 | 'builder_xp' => pretty_number($user_data['xpminier']), | 
| 154 | 154 | 'builder_lvl' => pretty_number($user_data['lvl_minier']), | 
| 155 | 155 | 'builder_lvl_st' => pretty_number(rpg_get_miner_xp($user_data['lvl_minier'])), | 
| 156 | - 'builder_lvl_up' => pretty_number(rpg_get_miner_xp($user_data['lvl_minier']+1)), | |
| 156 | + 'builder_lvl_up' => pretty_number(rpg_get_miner_xp($user_data['lvl_minier'] + 1)), | |
| 157 | 157 | 'raid_xp' => pretty_number($user_data['xpraid']), | 
| 158 | 158 | 'raid_lvl' => pretty_number($user_data['lvl_raid']), | 
| 159 | - 'raid_lvl_up' => pretty_number(rpg_get_raider_xp($user_data['lvl_raid']+1)), | |
| 159 | + 'raid_lvl_up' => pretty_number(rpg_get_raider_xp($user_data['lvl_raid'] + 1)), | |
| 160 | 160 | 'raids' => pretty_number($user_data['raids']), | 
| 161 | 161 | 'raidswin' => pretty_number($user_data['raidswin']), | 
| 162 | 162 | 'raidsloose' => pretty_number($user_data['raidsloose']), | 
| 163 | 163 | 'tech_xp' => pretty_number($user_data['player_rpg_tech_xp']), | 
| 164 | 164 | 'tech_lvl' => pretty_number($user_data['player_rpg_tech_level']), | 
| 165 | 165 | 'tech_lvl_st' => pretty_number(rpg_get_tech_xp($user_data['player_rpg_tech_level'])), | 
| 166 | - 'tech_lvl_up' => pretty_number(rpg_get_tech_xp($user_data['player_rpg_tech_level']+1)), | |
| 166 | + 'tech_lvl_up' => pretty_number(rpg_get_tech_xp($user_data['player_rpg_tech_level'] + 1)), | |
| 167 | 167 | |
| 168 | 168 | 'explore_xp' => pretty_number($user_data['player_rpg_explore_xp']), | 
| 169 | 169 | 'explore_lvl' => pretty_number($user_data['player_rpg_explore_level']), | 
| 170 | 170 | 'explore_lvl_st' => pretty_number(rpg_get_explore_xp($user_data['player_rpg_explore_level'])), | 
| 171 | - 'explore_lvl_up' => pretty_number(rpg_get_explore_xp($user_data['player_rpg_explore_level']+1)), | |
| 172 | - | |
| 173 | - 'build_points' => pretty_number( $StatRecord['build_points'] ), | |
| 174 | - 'tech_points' => pretty_number( $StatRecord['tech_points'] ), | |
| 175 | - 'fleet_points' => pretty_number( $StatRecord['fleet_points'] ), | |
| 176 | - 'defs_points' => pretty_number( $StatRecord['defs_points'] ), | |
| 177 | - 'res_points' => pretty_number( $StatRecord['res_points'] ), | |
| 178 | - 'total_points' => pretty_number( $StatRecord['total_points'] ), | |
| 171 | + 'explore_lvl_up' => pretty_number(rpg_get_explore_xp($user_data['player_rpg_explore_level'] + 1)), | |
| 172 | + | |
| 173 | + 'build_points' => pretty_number($StatRecord['build_points']), | |
| 174 | + 'tech_points' => pretty_number($StatRecord['tech_points']), | |
| 175 | + 'fleet_points' => pretty_number($StatRecord['fleet_points']), | |
| 176 | + 'defs_points' => pretty_number($StatRecord['defs_points']), | |
| 177 | + 'res_points' => pretty_number($StatRecord['res_points']), | |
| 178 | + 'total_points' => pretty_number($StatRecord['total_points']), | |
| 179 | 179 | 'user_rank' => $StatRecord['total_rank'], | 
| 180 | 180 | 'RANK_DIFF' => $StatRecord['total_old_rank'] - $StatRecord['total_rank'], | 
| 181 | 181 | |