@@ -28,40 +28,40 @@ discard block |
||
28 | 28 | $mode = sys_get_param_str('mode'); |
29 | 29 | |
30 | 30 | $announce = array(); |
31 | -if($user['authlevel'] >= 3) { |
|
32 | - if(!empty($text)) { |
|
31 | +if ($user['authlevel'] >= 3) { |
|
32 | + if (!empty($text)) { |
|
33 | 33 | $announce_time = strtotime($announce_time, SN_TIME_NOW); |
34 | 34 | $announce_time = $announce_time ? $announce_time : SN_TIME_NOW; |
35 | 35 | |
36 | - if($mode == 'edit') { |
|
36 | + if ($mode == 'edit') { |
|
37 | 37 | DBStaticNews::db_news_update_set($announce_time, $text_unsafe, $detail_url_unsafe, $announce_id); |
38 | 38 | DBStaticSurvey::db_survey_delete_by_id($announce_id); |
39 | 39 | } else { |
40 | 40 | DBStaticNews::db_news_insert_set($announce_time, $text_unsafe, $detail_url_unsafe, $user['id'], $user['username']); |
41 | 41 | $announce_id = classSupernova::$db->db_insert_id(); |
42 | 42 | } |
43 | - if(($survey_question = sys_get_param_str('survey_question')) && ($survey_answers = sys_get_param('survey_answers'))) { |
|
43 | + if (($survey_question = sys_get_param_str('survey_question')) && ($survey_answers = sys_get_param('survey_answers'))) { |
|
44 | 44 | $survey_answers = explode("\r\n", $survey_answers); |
45 | 45 | $survey_until = strtotime($survey_until = sys_get_param_str('survey_until'), SN_TIME_NOW); |
46 | 46 | $survey_until = date(FMT_DATE_TIME_SQL, $survey_until ? $survey_until : SN_TIME_NOW + PERIOD_DAY * 1); |
47 | 47 | $survey_question_unsafe = sys_get_param_str_unsafe('survey_question'); |
48 | 48 | DBStaticSurvey::db_survey_insert($announce_id, $survey_question_unsafe, $survey_until); |
49 | 49 | $survey_id = classSupernova::$db->db_insert_id(); |
50 | - foreach($survey_answers as $survey_answer) { |
|
50 | + foreach ($survey_answers as $survey_answer) { |
|
51 | 51 | $survey_answer_unsafe = trim($survey_answer); |
52 | - if(empty($survey_answer_unsafe)) { |
|
52 | + if (empty($survey_answer_unsafe)) { |
|
53 | 53 | continue; |
54 | 54 | } |
55 | 55 | DBStaticSurveyAnswer::db_survey_answer_insert($survey_id, $survey_answer_unsafe); |
56 | 56 | } |
57 | 57 | } |
58 | 58 | |
59 | - if($announce_time <= SN_TIME_NOW) { |
|
60 | - if($announce_time > classSupernova::$config->var_news_last && $announce_time == SN_TIME_NOW) { |
|
59 | + if ($announce_time <= SN_TIME_NOW) { |
|
60 | + if ($announce_time > classSupernova::$config->var_news_last && $announce_time == SN_TIME_NOW) { |
|
61 | 61 | classSupernova::$config->db_saveItem('var_news_last', $announce_time); |
62 | 62 | } |
63 | 63 | |
64 | - if(sys_get_param_int('news_mass_mail')) { |
|
64 | + if (sys_get_param_int('news_mass_mail')) { |
|
65 | 65 | $lang_news_more = classLocale::$lang['news_more']; |
66 | 66 | $text = sys_get_param('text') . ($detail_url ? " <a href=\"{$detail_url}\"><span class=\"positive\">{$lang_news_more}</span></a>" : ''); |
67 | 67 | DBStaticMessages::msgSendFromAdmin('*', classLocale::$lang['news_title'], $text); |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | } |
74 | 74 | |
75 | 75 | $survey_answers = ''; |
76 | - switch($mode) { |
|
76 | + switch ($mode) { |
|
77 | 77 | case 'del': |
78 | 78 | DBStaticNews::db_news_delete_by_id($announce_id); |
79 | 79 | $mode = ''; |
@@ -84,9 +84,9 @@ discard block |
||
84 | 84 | $template->assign_var('ID', $announce_id); |
85 | 85 | case 'copy': |
86 | 86 | $announce = DBStaticNews::db_news_with_survey_select_by_id($announce_id); |
87 | - if($announce['survey_id']) { |
|
87 | + if ($announce['survey_id']) { |
|
88 | 88 | $query = DBStaticSurveyAnswer::db_survey_answer_text_select_by_news($announce); |
89 | - while($row = db_fetch($query)) { |
|
89 | + while ($row = db_fetch($query)) { |
|
90 | 90 | $survey_answers[] = $row['survey_answer_text']; |
91 | 91 | } |
92 | 92 | $survey_answers = implode("\r\n", $survey_answers); |
@@ -19,17 +19,17 @@ discard block |
||
19 | 19 | $template = gettemplate('notes', true); |
20 | 20 | |
21 | 21 | $result = array(); |
22 | -if(($result_message = sys_get_param_str('MESSAGE')) && isset(classLocale::$lang[$result_message])) { |
|
22 | +if (($result_message = sys_get_param_str('MESSAGE')) && isset(classLocale::$lang[$result_message])) { |
|
23 | 23 | $result[] = array('STATUS' => sys_get_param_int('STATUS'), 'MESSAGE' => classLocale::$lang[$result_message]); |
24 | 24 | } |
25 | 25 | |
26 | 26 | $note_id_edit = sys_get_param_id('note_id_edit'); |
27 | 27 | $note_title_unsafe = sys_get_param_str_unsafe('note_title'); |
28 | 28 | $note_text_unsafe = sys_get_param_str_unsafe('note_text'); |
29 | -if(sys_get_param('note_delete')) { |
|
29 | +if (sys_get_param('note_delete')) { |
|
30 | 30 | try { |
31 | 31 | DBStaticNote::processDelete($user, $note_id_edit); |
32 | - } catch(Exception $e) { |
|
32 | + } catch (Exception $e) { |
|
33 | 33 | $note_id_edit = 0; |
34 | 34 | sn_db_transaction_rollback(); |
35 | 35 | $result[] = array( |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | 'MESSAGE' => classLocale::$lang[$e->getMessage()], |
38 | 38 | ); |
39 | 39 | } |
40 | -} elseif(($note_title_unsafe = sys_get_param_str_unsafe('note_title')) || ($note_text_unsafe = sys_get_param_str('note_text'))) { |
|
40 | +} elseif (($note_title_unsafe = sys_get_param_str_unsafe('note_title')) || ($note_text_unsafe = sys_get_param_str('note_text'))) { |
|
41 | 41 | $note_title_unsafe == classLocale::$lang['note_new_title'] ? $note_title_unsafe = '' : false; |
42 | 42 | $note_text_unsafe == classLocale::$lang['note_new_text'] ? $note_text_unsafe = '' : false; |
43 | 43 | try { |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | $note_system = max(0, min(sys_get_param_id('note_system'), Vector::$knownSystems)); |
46 | 46 | $note_planet = max(0, min(sys_get_param_id('note_planet'), Vector::$knownPlanets + 1)); |
47 | 47 | |
48 | - if(!$note_text_unsafe && !$note_title_unsafe && !$note_galaxy && !$note_system && !$note_planet) { |
|
48 | + if (!$note_text_unsafe && !$note_title_unsafe && !$note_galaxy && !$note_system && !$note_planet) { |
|
49 | 49 | throw new Exception('note_err_note_empty', ERR_WARNING); |
50 | 50 | } |
51 | 51 | |
@@ -54,15 +54,15 @@ discard block |
||
54 | 54 | $note_sticky = intval(sys_get_param_id('note_sticky')) ? 1 : 0; |
55 | 55 | |
56 | 56 | sn_db_transaction_start(); |
57 | - if($note_id_edit) { |
|
57 | + if ($note_id_edit) { |
|
58 | 58 | $check_note_id = DBStaticNote::db_note_get_id_and_owner($note_id_edit); |
59 | - if(!$check_note_id) { |
|
59 | + if (!$check_note_id) { |
|
60 | 60 | throw new Exception('note_err_note_not_found', ERR_ERROR); |
61 | 61 | } |
62 | 62 | } |
63 | 63 | |
64 | - if($note_id_edit) { |
|
65 | - if($check_note_id['owner'] != $user['id']) { |
|
64 | + if ($note_id_edit) { |
|
65 | + if ($check_note_id['owner'] != $user['id']) { |
|
66 | 66 | throw new Exception('note_err_owner_wrong', ERR_ERROR); |
67 | 67 | } |
68 | 68 | |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | sn_db_transaction_commit(); |
75 | 75 | sys_redirect('notes.php?STATUS=' . ERR_NONE . '&MESSAGE=' . ($note_id_edit ? 'note_err_none_changed' : 'note_err_none_added')); |
76 | 76 | // throw new exception($note_id_edit ? 'note_err_none_changed' : 'note_err_none_added', ERR_NONE); |
77 | - } catch(Exception $e) { |
|
77 | + } catch (Exception $e) { |
|
78 | 78 | $note_id_edit = 0; |
79 | 79 | sn_db_transaction_rollback(); |
80 | 80 | $result[] = array( |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | } |
85 | 85 | } |
86 | 86 | |
87 | -if(!$note_id_edit) { |
|
87 | +if (!$note_id_edit) { |
|
88 | 88 | note_assign($template, array( |
89 | 89 | 'id' => 0, |
90 | 90 | 'time' => SN_TIME_NOW, |
@@ -97,13 +97,13 @@ discard block |
||
97 | 97 | |
98 | 98 | $note_exist = false; |
99 | 99 | $notes_query = DBStaticNote::db_note_list_by_owner($user['id']); |
100 | -while($note_row = db_fetch($notes_query)) { |
|
100 | +while ($note_row = db_fetch($notes_query)) { |
|
101 | 101 | note_assign($template, $note_row); |
102 | 102 | $note_exist = $note_exist || $note_row['id'] == $note_id_edit; |
103 | 103 | } |
104 | 104 | $note_id_edit = $note_exist ? $note_id_edit : 0; |
105 | 105 | |
106 | -foreach($note_priority_classes as $note_priority_id => $note_priority_class) { |
|
106 | +foreach ($note_priority_classes as $note_priority_id => $note_priority_class) { |
|
107 | 107 | $template->assign_block_vars('note_priority', array( |
108 | 108 | 'ID' => $note_priority_id, |
109 | 109 | 'CLASS' => $note_priority_classes[$note_priority_id], |
@@ -111,14 +111,14 @@ discard block |
||
111 | 111 | )); |
112 | 112 | } |
113 | 113 | |
114 | -foreach(classLocale::$lang['sys_planet_type'] as $planet_type_id => $planet_type_string) { |
|
114 | +foreach (classLocale::$lang['sys_planet_type'] as $planet_type_id => $planet_type_string) { |
|
115 | 115 | $template->assign_block_vars('planet_type', array( |
116 | 116 | 'ID' => $planet_type_id, |
117 | 117 | 'TEXT' => $planet_type_string, |
118 | 118 | )); |
119 | 119 | } |
120 | 120 | |
121 | -foreach($result as $result_data) { |
|
121 | +foreach ($result as $result_data) { |
|
122 | 122 | $template->assign_block_vars('result', $result_data); |
123 | 123 | } |
124 | 124 |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | |
15 | 15 | require('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
16 | 16 | |
17 | -if($user['authlevel'] < 3) { |
|
17 | +if ($user['authlevel'] < 3) { |
|
18 | 18 | AdminMessage(classLocale::$lang['adm_err_denied']); |
19 | 19 | } |
20 | 20 | |
@@ -28,8 +28,8 @@ discard block |
||
28 | 28 | ), |
29 | 29 | ); |
30 | 30 | $template->assign_block_vars('int_type_selected', $allowed_types[-1]); |
31 | -foreach(DBStaticMessages::$snMessageClassList as $key => $value) { |
|
32 | - if($key == MSG_TYPE_NEW || $key == MSG_TYPE_OUTBOX) { |
|
31 | +foreach (DBStaticMessages::$snMessageClassList as $key => $value) { |
|
32 | + if ($key == MSG_TYPE_NEW || $key == MSG_TYPE_OUTBOX) { |
|
33 | 33 | continue; |
34 | 34 | } |
35 | 35 | |
@@ -41,21 +41,21 @@ discard block |
||
41 | 41 | |
42 | 42 | |
43 | 43 | $deletedMessages = ''; |
44 | -if($idMessageDelete = sys_get_param_id('msg_del')) { |
|
44 | +if ($idMessageDelete = sys_get_param_id('msg_del')) { |
|
45 | 45 | DBStaticMessages::db_message_delete_by_id($idMessageDelete); |
46 | 46 | $deletedMessages = $idMessageDelete; |
47 | -} elseif(sys_get_param('str_delete_selected') && is_array($message_delete = sys_get_param('selected')) && !empty($message_delete)) { |
|
47 | +} elseif (sys_get_param('str_delete_selected') && is_array($message_delete = sys_get_param('selected')) && !empty($message_delete)) { |
|
48 | 48 | $message_delete = implode(', ', $message_delete); |
49 | 49 | DBStaticMessages::db_message_list_delete_set($message_delete); |
50 | 50 | $deletedMessages = $message_delete; |
51 | 51 | } |
52 | 52 | |
53 | -if($deletedMessages) { |
|
53 | +if ($deletedMessages) { |
|
54 | 54 | $template->assign_block_vars('result', array('MESSAGE' => sprintf(classLocale::$lang['mlst_messages_deleted'], $deletedMessages))); |
55 | 55 | } |
56 | 56 | |
57 | 57 | |
58 | -if(sys_get_param('str_delete_date') && checkdate($month = sys_get_param_id('delete_month'), $day = sys_get_param_id('delete_day'), $year = sys_get_param_id('delete_year'))) { |
|
58 | +if (sys_get_param('str_delete_date') && checkdate($month = sys_get_param_id('delete_month'), $day = sys_get_param_id('delete_day'), $year = sys_get_param_id('delete_year'))) { |
|
59 | 59 | $delete_date = "{$year}-{$month}-{$day}"; |
60 | 60 | DBStaticMessages::db_message_list_delete_by_date($delete_date, $int_type_selected); |
61 | 61 | $template->assign_block_vars('result', array('MESSAGE' => sprintf(classLocale::$lang['mlst_messages_deleted_date'], $allowed_types[$int_type_selected]['TEXT'], $delete_date))); |
@@ -67,13 +67,13 @@ discard block |
||
67 | 67 | |
68 | 68 | $int_page_current = min(sys_get_param_id('int_page_current', 1), $page_max); |
69 | 69 | |
70 | -if(sys_get_param('page_prev') && $int_page_current > 1) { |
|
70 | +if (sys_get_param('page_prev') && $int_page_current > 1) { |
|
71 | 71 | $int_page_current--; |
72 | -} elseif(sys_get_param('page_next') && $int_page_current < $page_max) { |
|
72 | +} elseif (sys_get_param('page_next') && $int_page_current < $page_max) { |
|
73 | 73 | $int_page_current++; |
74 | 74 | } |
75 | 75 | |
76 | -for($i = 1; $i <= $page_max; $i++) { |
|
76 | +for ($i = 1; $i <= $page_max; $i++) { |
|
77 | 77 | $template->assign_block_vars('page', array('NUMBER' => $i)); |
78 | 78 | } |
79 | 79 | |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | $StartRec = ($int_page_current - 1) * 25; |
82 | 82 | |
83 | 83 | $Messages = DBStaticMessages::db_message_list_admin_by_type($int_type_selected, $StartRec); |
84 | -while($row = db_fetch($Messages)) { |
|
84 | +while ($row = db_fetch($Messages)) { |
|
85 | 85 | $row['FROM'] = htmlentities($row['FROM'], ENT_COMPAT, 'UTF-8'); |
86 | 86 | $row['OWNER_NAME'] = htmlentities($row['OWNER_NAME'], ENT_COMPAT, 'UTF-8'); |
87 | 87 | $row['TEXT'] = nl2br($row['TEXT']); |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | require('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
18 | 18 | |
19 | 19 | global $user; |
20 | -if($user['authlevel'] < 3) { |
|
20 | +if ($user['authlevel'] < 3) { |
|
21 | 21 | AdminMessage(classLocale::$lang['adm_err_denied']); |
22 | 22 | } |
23 | 23 | |
@@ -41,10 +41,10 @@ discard block |
||
41 | 41 | $sort = sys_get_param_int('sort', SORT_ID); |
42 | 42 | $sort = $sort_fields[$sort] ? $sort : SORT_ID; |
43 | 43 | |
44 | -if(($action = sys_get_param_int('action')) && ($user_id = sys_get_param_id('uid'))) { |
|
44 | +if (($action = sys_get_param_int('action')) && ($user_id = sys_get_param_id('uid'))) { |
|
45 | 45 | $user_selected = DBStaticUser::db_user_by_id($user_id, false, 'id, username, authlevel'); |
46 | - if($user_selected['authlevel'] < $user['authlevel'] && $user['authlevel'] >= 3) { |
|
47 | - switch($action) { |
|
46 | + if ($user_selected['authlevel'] < $user['authlevel'] && $user['authlevel'] >= 3) { |
|
47 | + switch ($action) { |
|
48 | 48 | case ACTION_DELETE: |
49 | 49 | DeleteSelectedUser($user_id); |
50 | 50 | sys_redirect("{$_SERVER['SCRIPT_NAME']}?sort={$sort}"); |
@@ -64,20 +64,20 @@ discard block |
||
64 | 64 | $template = gettemplate('admin/userlist', true); |
65 | 65 | |
66 | 66 | $multi_ip = array(); |
67 | -foreach(DBStaticUser::db_user_list_admin_multiaccounts() as $ip) { |
|
67 | +foreach (DBStaticUser::db_user_list_admin_multiaccounts() as $ip) { |
|
68 | 68 | $multi_ip[$ip['user_lastip']] = $ip['ip_count']; |
69 | 69 | } |
70 | 70 | |
71 | 71 | $geoip = geoip_status(); |
72 | 72 | $count = 0; |
73 | -foreach(DBStaticUser::db_user_list_admin_sorted($sort_fields[$sort], $is_players_online_page) as $user_row ) { |
|
73 | +foreach (DBStaticUser::db_user_list_admin_sorted($sort_fields[$sort], $is_players_online_page) as $user_row) { |
|
74 | 74 | $count++; |
75 | - if($user_row['banaday']) { |
|
75 | + if ($user_row['banaday']) { |
|
76 | 76 | $ban_details = db_ban_list_get_details($user_row); |
77 | 77 | } |
78 | 78 | |
79 | 79 | $geoip_info = $geoip ? geoip_ip_info(ip2longu($user_row['user_lastip'])) : array(); |
80 | - foreach($geoip_info as $key => $value) { |
|
80 | + foreach ($geoip_info as $key => $value) { |
|
81 | 81 | $geoip_info[strtoupper($key)] = $value; |
82 | 82 | unset($geoip_info[$key]); |
83 | 83 | } |
@@ -5,20 +5,20 @@ discard block |
||
5 | 5 | define('IN_ADMIN', true); |
6 | 6 | require('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
7 | 7 | |
8 | -if($user['authlevel'] < 3) { |
|
8 | +if ($user['authlevel'] < 3) { |
|
9 | 9 | AdminMessage(classLocale::$lang['adm_err_denied']); |
10 | 10 | } |
11 | 11 | |
12 | 12 | lng_include('admin'); |
13 | 13 | |
14 | 14 | $user_id = sys_get_param_id('uid'); |
15 | -if(!($user_row = DBStaticUser::db_user_by_id($user_id))) { |
|
15 | +if (!($user_row = DBStaticUser::db_user_by_id($user_id))) { |
|
16 | 16 | AdminMessage(sprintf(classLocale::$lang['adm_dm_user_none'], $user_id)); |
17 | 17 | } |
18 | 18 | |
19 | 19 | $template = gettemplate('admin/admin_user', true); |
20 | 20 | |
21 | -if(!empty($user_row['user_last_browser_id'])) { |
|
21 | +if (!empty($user_row['user_last_browser_id'])) { |
|
22 | 22 | $user_row['browser_user_agent'] = db_browser_agent_get_by_id($user_row['user_last_browser_id']); |
23 | 23 | } |
24 | 24 | |
@@ -54,10 +54,10 @@ discard block |
||
54 | 54 | 'raidsloose', |
55 | 55 | 'raidswin', |
56 | 56 | 'total_rank', |
57 | - 'total_points', ), |
|
57 | + 'total_points',), |
|
58 | 58 | ); |
59 | -foreach($formats as $callable => $field_list) { |
|
60 | - foreach($field_list as $field_name) { |
|
59 | +foreach ($formats as $callable => $field_list) { |
|
60 | + foreach ($field_list as $field_name) { |
|
61 | 61 | $user_row[$field_name] = call_user_func($callable, $user_row[$field_name]); |
62 | 62 | } |
63 | 63 | } |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | |
7 | 7 | require('../includes/init.' . substr(strrchr(__FILE__, '.'), 1)); |
8 | 8 | |
9 | -if($user['authlevel'] < 3) |
|
9 | +if ($user['authlevel'] < 3) |
|
10 | 10 | { |
11 | 11 | message(classLocale::$lang['sys_noalloaw'], classLocale::$lang['sys_noaccess']); |
12 | 12 | die(); |
@@ -22,9 +22,9 @@ discard block |
||
22 | 22 | // [#] info_best_battles 1b0 |
23 | 23 | $best_reports = array(); |
24 | 24 | |
25 | -if(defined('MODULE_INFO_BEST_BATTLES_QUERY')) { |
|
25 | +if (defined('MODULE_INFO_BEST_BATTLES_QUERY')) { |
|
26 | 26 | $query = db_ube_report_get_best_battles(); |
27 | - while($row = db_fetch($query)) { |
|
27 | + while ($row = db_fetch($query)) { |
|
28 | 28 | $best_reports[] = $row['ube_report_id']; |
29 | 29 | } |
30 | 30 | } |
@@ -191,13 +191,13 @@ discard block |
||
191 | 191 | $old_server_status == GAME_DISABLE_NONE ? classSupernova::$config->db_saveItem('game_disable', GAME_DISABLE_MAINTENANCE) : false; |
192 | 192 | sn_db_transaction_commit(); |
193 | 193 | |
194 | -foreach($ques as $que_transaction) { |
|
194 | +foreach ($ques as $que_transaction) { |
|
195 | 195 | sn_db_transaction_start(); |
196 | 196 | |
197 | 197 | !is_array($que_transaction) ? $que_transaction = array($que_transaction) : false; |
198 | - foreach($que_transaction as $que) { |
|
198 | + foreach ($que_transaction as $que) { |
|
199 | 199 | set_time_limit(120); |
200 | - if(is_callable($que)) { |
|
200 | + if (is_callable($que)) { |
|
201 | 201 | $QryResult = call_user_func($que); |
202 | 202 | } else { |
203 | 203 | $QryResult = classSupernova::$db->doSql($que); |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | * Инициализация харнилища скинов |
153 | 153 | */ |
154 | 154 | protected static function init() { |
155 | - if(static::$is_init) { |
|
155 | + if (static::$is_init) { |
|
156 | 156 | return; |
157 | 157 | } |
158 | 158 | |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | |
166 | 166 | // Загружены ли уже данные по текущему скину? |
167 | 167 | //pdump(static::$skin_list[$ini_path], 'static'); |
168 | - if(empty(static::$skin_list[$skin_path])) { |
|
168 | + if (empty(static::$skin_list[$skin_path])) { |
|
169 | 169 | // Прогружаем текущий скин |
170 | 170 | static::$skin_list[$skin_path] = new skin($skin_path); |
171 | 171 | static::$active = static::$skin_list[$skin_path]; |
@@ -201,22 +201,22 @@ discard block |
||
201 | 201 | |
202 | 202 | $this->is_ini_present = false; |
203 | 203 | // Проверка на корректность и существование пути |
204 | - if(is_file($this->root_physical_absolute . 'skin.ini')) { |
|
204 | + if (is_file($this->root_physical_absolute . 'skin.ini')) { |
|
205 | 205 | // Пытаемся распарсить файл |
206 | 206 | |
207 | 207 | // По секциям? images и config? Что бы не копировать конфигурацию? Или просто unset(__inherit) а затем заново записать |
208 | 208 | $this->config = parse_ini_file($this->root_physical_absolute . 'skin.ini'); |
209 | - if(!empty($this->config)) { |
|
209 | + if (!empty($this->config)) { |
|
210 | 210 | |
211 | 211 | $this->is_ini_present = true; |
212 | 212 | |
213 | - if(!empty($this->config['_inherit'])) { |
|
213 | + if (!empty($this->config['_inherit'])) { |
|
214 | 214 | // Если скин наследует себя... |
215 | - if($this->config['_inherit'] == $skin_path) { |
|
215 | + if ($this->config['_inherit'] == $skin_path) { |
|
216 | 216 | // TODO - определять более сложные случаи циклических ссылок в _inherit |
217 | 217 | die('">circular skin inheritance!'); |
218 | 218 | } |
219 | - if(empty(static::$skin_list[$this->config['_inherit']])) { |
|
219 | + if (empty(static::$skin_list[$this->config['_inherit']])) { |
|
220 | 220 | static::$skin_list[$this->config['_inherit']] = new skin($this->config['_inherit']); |
221 | 221 | } |
222 | 222 | $this->parent = static::$skin_list[$this->config['_inherit']]; |
@@ -232,12 +232,12 @@ discard block |
||
232 | 232 | } |
233 | 233 | |
234 | 234 | // Пытаемся скомпилировать _no_image заранее |
235 | - if(!empty($this->config[SKIN_IMAGE_MISSED_FIELD])) { |
|
235 | + if (!empty($this->config[SKIN_IMAGE_MISSED_FIELD])) { |
|
236 | 236 | $this->container[SKIN_IMAGE_MISSED_FIELD] = $this->compile_try_path(SKIN_IMAGE_MISSED_FIELD, $this->config[SKIN_IMAGE_MISSED_FIELD]); |
237 | 237 | } |
238 | 238 | |
239 | 239 | // Если нет заглушки |
240 | - if(empty($this->container[SKIN_IMAGE_MISSED_FIELD])) { |
|
240 | + if (empty($this->container[SKIN_IMAGE_MISSED_FIELD])) { |
|
241 | 241 | $this->container[SKIN_IMAGE_MISSED_FIELD] = empty($this->parent) |
242 | 242 | // Если нет парента - берем хардкод |
243 | 243 | ? $this->container[SKIN_IMAGE_MISSED_FIELD] = SN_ROOT_VIRTUAL . SKIN_IMAGE_MISSED_FILE_PATH |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | $image_tag = $this->image_tag_parse($image_tag, $template); |
268 | 268 | |
269 | 269 | // Проверяем наличие ключа RIT в хранилища. В нём не может быть несуществующих файлов по построению |
270 | - if(!empty($this->container[$image_tag[SKIN_IMAGE_TAG_RESOLVED]])) { |
|
270 | + if (!empty($this->container[$image_tag[SKIN_IMAGE_TAG_RESOLVED]])) { |
|
271 | 271 | return $this->container[$image_tag[SKIN_IMAGE_TAG_RESOLVED]]; |
272 | 272 | } |
273 | 273 | |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | // Нет - image ID не является путём к файлу. Пора обратиться к предкам за помощью... |
286 | 286 | // Пытаемся вытащить путь из родителя и применить к нему свои параметры |
287 | 287 | // Тащим по ID изображения, а не по ТЭГУ - мало ли что там делает с путём родитель и как преобразовывает его в строку? |
288 | - if(empty($this->container[$image_id]) && !empty($this->parent)) { |
|
288 | + if (empty($this->container[$image_id]) && !empty($this->parent)) { |
|
289 | 289 | $this->container[$image_id] = $this->parent->compile_image($image_id, $template); |
290 | 290 | |
291 | 291 | // Если у родителя нет картинки - он вернет пустую строку. Тогда нам надо использовать заглушку - свою или родительскую |
@@ -306,18 +306,18 @@ discard block |
||
306 | 306 | protected function image_tag_parse($image_tag, $template) { |
307 | 307 | $image_tag_ptl_resolved = $image_tag; |
308 | 308 | // Есть переменные из темплейта ? |
309 | - if(strpos($image_tag_ptl_resolved, '[') !== false && is_object($template)) { |
|
309 | + if (strpos($image_tag_ptl_resolved, '[') !== false && is_object($template)) { |
|
310 | 310 | // Что бы лишний раз не запускать регексп |
311 | 311 | // TODO - многоуровневые вложения ?! Надо ли и где их можно применить |
312 | 312 | preg_match_all('#(\[.+?\])#', $image_tag_ptl_resolved, $matches); |
313 | - foreach($matches[0] as &$match) { |
|
313 | + foreach ($matches[0] as &$match) { |
|
314 | 314 | $var_name = str_replace(array('[', ']'), '', $match); |
315 | - if(strpos($var_name, '.') !== false) { |
|
315 | + if (strpos($var_name, '.') !== false) { |
|
316 | 316 | // Вложенная переменная темплейта - на текущем уровне |
317 | 317 | // TODO Вложенная переменная из корня через "!" |
318 | 318 | list($block_name, $block_var) = explode('.', $var_name); |
319 | 319 | isset($template->_block_value[$block_name][$block_var]) ? $image_tag_ptl_resolved = str_replace($match, $template->_block_value[$block_name][$block_var], $image_tag_ptl_resolved) : false; |
320 | - } elseif(strpos($var_name, '$') !== false) { |
|
320 | + } elseif (strpos($var_name, '$') !== false) { |
|
321 | 321 | // Корневой DEFINE |
322 | 322 | $define_name = substr($var_name, 1); |
323 | 323 | isset($template->_tpldata['DEFINE']['.'][$define_name]) ? $image_tag_ptl_resolved = str_replace($match, $template->_tpldata['DEFINE']['.'][$define_name], $image_tag_ptl_resolved) : false; |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | } |
329 | 329 | } |
330 | 330 | |
331 | - if(strpos($image_tag_ptl_resolved, '|') !== false) { |
|
331 | + if (strpos($image_tag_ptl_resolved, '|') !== false) { |
|
332 | 332 | $params = explode('|', $image_tag_ptl_resolved); |
333 | 333 | $image_id = $params[0]; |
334 | 334 | unset($params[0]); |
@@ -392,11 +392,11 @@ discard block |
||
392 | 392 | $image_string = $this->container[$image_tag]; |
393 | 393 | |
394 | 394 | // Нет параметров - просто возвращаем значение по $image_name из контейнера |
395 | - if(!empty($params) && is_array($params)) { |
|
395 | + if (!empty($params) && is_array($params)) { |
|
396 | 396 | // Здесь автоматически произойдёт упорядочивание параметров |
397 | 397 | |
398 | 398 | // Параметр 'html' - выводить изображение в виде HTML-тэга |
399 | - if(in_array('html', $params)) { |
|
399 | + if (in_array('html', $params)) { |
|
400 | 400 | $image_tag = $image_tag . '|html'; |
401 | 401 | $image_string = '<img src="' . $image_string . '" />'; |
402 | 402 | $this->container[$image_tag] = $image_string; |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | public static function _init($group_name = '') { |
27 | 27 | parent::_init($group_name); |
28 | 28 | |
29 | - foreach(static::$_group_unit_id_list as $resource_id) { |
|
29 | + foreach (static::$_group_unit_id_list as $resource_id) { |
|
30 | 30 | static::$_group_pnames[$resource_id] = pname_resource_name($resource_id); |
31 | 31 | } |
32 | 32 | |
@@ -48,8 +48,8 @@ discard block |
||
48 | 48 | |
49 | 49 | !is_array($resource_array) ? $resource_array = array() : false; |
50 | 50 | |
51 | - foreach($resource_array as $resource_id => $resource_actual_delta) { |
|
52 | - if(!$resource_actual_delta) { |
|
51 | + foreach ($resource_array as $resource_id => $resource_actual_delta) { |
|
52 | + if (!$resource_actual_delta) { |
|
53 | 53 | // No delta - no changes |
54 | 54 | continue; |
55 | 55 | } |
@@ -119,7 +119,7 @@ |
||
119 | 119 | if ($this->contains($object)) { |
120 | 120 | $this->indexUnset($object); |
121 | 121 | } |
122 | - if($this->indexSet($object, $data)) { |
|
122 | + if ($this->indexSet($object, $data)) { |
|
123 | 123 | // Attaches object only if index sets successfully |
124 | 124 | parent::attach($object, $data); |
125 | 125 | } |