@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | */ |
10 | 10 | |
11 | 11 | $allow_anonymous = true; |
12 | -include('common.' . substr(strrchr(__FILE__, '.'), 1)); |
|
12 | +include('common.'.substr(strrchr(__FILE__, '.'), 1)); |
|
13 | 13 | |
14 | 14 | nws_mark_read($user); |
15 | 15 | $template = gettemplate('announce', true); |
@@ -23,42 +23,42 @@ discard block |
||
23 | 23 | $mode = sys_get_param_str('mode'); |
24 | 24 | |
25 | 25 | $announce = array(); |
26 | -if($user['authlevel'] >= 3) { |
|
27 | - if(!empty($text)) { |
|
26 | +if ($user['authlevel'] >= 3) { |
|
27 | + if (!empty($text)) { |
|
28 | 28 | $announce_time = strtotime($announce_time, SN_TIME_NOW); |
29 | 29 | $announce_time = $announce_time ? $announce_time : SN_TIME_NOW; |
30 | 30 | |
31 | - if($mode == 'edit') { |
|
31 | + if ($mode == 'edit') { |
|
32 | 32 | DBStaticNews::db_news_update_set($announce_time, $text, $detail_url, $announce_id); |
33 | 33 | DBStaticSurvey::db_survey_delete_by_id($announce_id); |
34 | 34 | } else { |
35 | 35 | DBStaticNews::db_news_insert_set($announce_time, $text_unsafe, $detail_url_unsafe, $user['id'], $user['username']); |
36 | 36 | $announce_id = classSupernova::$db->db_insert_id(); |
37 | 37 | } |
38 | - if(($survey_question = sys_get_param_str('survey_question')) && ($survey_answers = sys_get_param('survey_answers'))) { |
|
38 | + if (($survey_question = sys_get_param_str('survey_question')) && ($survey_answers = sys_get_param('survey_answers'))) { |
|
39 | 39 | $survey_answers = explode("\r\n", $survey_answers); |
40 | 40 | $survey_until = strtotime($survey_until = sys_get_param_str('survey_until'), SN_TIME_NOW); |
41 | 41 | $survey_until = date(FMT_DATE_TIME_SQL, $survey_until ? $survey_until : SN_TIME_NOW + PERIOD_DAY * 1); |
42 | 42 | $survey_question_unsafe = sys_get_param_str_unsafe('survey_question'); |
43 | 43 | DBStaticSurvey::db_survey_insert($announce_id, $survey_question_unsafe, $survey_until); |
44 | 44 | $survey_id = classSupernova::$db->db_insert_id(); |
45 | - foreach($survey_answers as $survey_answer) { |
|
45 | + foreach ($survey_answers as $survey_answer) { |
|
46 | 46 | $survey_answer_unsafe = trim($survey_answer); |
47 | - if(empty($survey_answer_unsafe)) { |
|
47 | + if (empty($survey_answer_unsafe)) { |
|
48 | 48 | continue; |
49 | 49 | } |
50 | 50 | DBStaticSurveyAnswer::db_survey_answer_insert($survey_id, $survey_answer_unsafe); |
51 | 51 | } |
52 | 52 | } |
53 | 53 | |
54 | - if($announce_time <= SN_TIME_NOW) { |
|
55 | - if($announce_time > classSupernova::$config->var_news_last && $announce_time == SN_TIME_NOW) { |
|
54 | + if ($announce_time <= SN_TIME_NOW) { |
|
55 | + if ($announce_time > classSupernova::$config->var_news_last && $announce_time == SN_TIME_NOW) { |
|
56 | 56 | classSupernova::$config->db_saveItem('var_news_last', $announce_time); |
57 | 57 | } |
58 | 58 | |
59 | - if(sys_get_param_int('news_mass_mail')) { |
|
59 | + if (sys_get_param_int('news_mass_mail')) { |
|
60 | 60 | $lang_news_more = classLocale::$lang['news_more']; |
61 | - $text = sys_get_param('text') . ($detail_url ? " <a href=\"{$detail_url}\"><span class=\"positive\">{$lang_news_more}</span></a>" : ''); |
|
61 | + $text = sys_get_param('text').($detail_url ? " <a href=\"{$detail_url}\"><span class=\"positive\">{$lang_news_more}</span></a>" : ''); |
|
62 | 62 | DBStaticMessages::msgSendFromAdmin('*', classLocale::$lang['news_title'], $text); |
63 | 63 | } |
64 | 64 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | } |
69 | 69 | |
70 | 70 | $survey_answers = ''; |
71 | - switch($mode) { |
|
71 | + switch ($mode) { |
|
72 | 72 | case 'del': |
73 | 73 | DBStaticNews::db_news_delete_by_id($announce_id); |
74 | 74 | $mode = ''; |
@@ -79,9 +79,9 @@ discard block |
||
79 | 79 | $template->assign_var('ID', $announce_id); |
80 | 80 | case 'copy': |
81 | 81 | $announce = DBStaticNews::db_news_with_survey_select_by_id($announce_id); |
82 | - if($announce['survey_id']) { |
|
82 | + if ($announce['survey_id']) { |
|
83 | 83 | $query = DBStaticSurveyAnswer::db_survey_answer_text_select_by_news($announce); |
84 | - while($row = db_fetch($query)) { |
|
84 | + while ($row = db_fetch($query)) { |
|
85 | 85 | $survey_answers[] = $row['survey_answer_text']; |
86 | 86 | } |
87 | 87 | $survey_answers = implode("\r\n", $survey_answers); |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | break; |
90 | 90 | } |
91 | 91 | } else { |
92 | - $annQuery = 'WHERE UNIX_TIMESTAMP(`tsTimeStamp`) <= ' . SN_TIME_NOW; |
|
92 | + $annQuery = 'WHERE UNIX_TIMESTAMP(`tsTimeStamp`) <= '.SN_TIME_NOW; |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | nws_render($template, $annQuery, 20); |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | use Vector\Vector; |
12 | 12 | |
13 | -include('common.' . substr(strrchr(__FILE__, '.'), 1)); |
|
13 | +include('common.'.substr(strrchr(__FILE__, '.'), 1)); |
|
14 | 14 | lng_include('notes'); |
15 | 15 | |
16 | 16 | global $user; |
@@ -18,17 +18,17 @@ discard block |
||
18 | 18 | $template = gettemplate('notes', true); |
19 | 19 | |
20 | 20 | $result = array(); |
21 | -if(($result_message = sys_get_param_str('MESSAGE')) && isset(classLocale::$lang[$result_message])) { |
|
21 | +if (($result_message = sys_get_param_str('MESSAGE')) && isset(classLocale::$lang[$result_message])) { |
|
22 | 22 | $result[] = array('STATUS' => sys_get_param_int('STATUS'), 'MESSAGE' => classLocale::$lang[$result_message]); |
23 | 23 | } |
24 | 24 | |
25 | 25 | $note_id_edit = sys_get_param_id('note_id_edit'); |
26 | 26 | $note_title_unsafe = sys_get_param_str_unsafe('note_title'); |
27 | 27 | $note_text_unsafe = sys_get_param_str_unsafe('note_text'); |
28 | -if(sys_get_param('note_delete')) { |
|
28 | +if (sys_get_param('note_delete')) { |
|
29 | 29 | try { |
30 | 30 | DBStaticNote::processDelete($user, $note_id_edit); |
31 | - } catch(Exception $e) { |
|
31 | + } catch (Exception $e) { |
|
32 | 32 | $note_id_edit = 0; |
33 | 33 | sn_db_transaction_rollback(); |
34 | 34 | $result[] = array( |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | 'MESSAGE' => classLocale::$lang[$e->getMessage()], |
37 | 37 | ); |
38 | 38 | } |
39 | -} elseif(($note_title_unsafe = sys_get_param_str_unsafe('note_title')) || ($note_text_unsafe = sys_get_param_str('note_text'))) { |
|
39 | +} elseif (($note_title_unsafe = sys_get_param_str_unsafe('note_title')) || ($note_text_unsafe = sys_get_param_str('note_text'))) { |
|
40 | 40 | $note_title_unsafe == classLocale::$lang['note_new_title'] ? $note_title_unsafe = '' : false; |
41 | 41 | $note_text_unsafe == classLocale::$lang['note_new_text'] ? $note_text_unsafe = '' : false; |
42 | 42 | try { |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | $note_system = max(0, min(sys_get_param_id('note_system'), Vector::$knownSystems)); |
45 | 45 | $note_planet = max(0, min(sys_get_param_id('note_planet'), Vector::$knownPlanets + 1)); |
46 | 46 | |
47 | - if(!$note_text_unsafe && !$note_title_unsafe && !$note_galaxy && !$note_system && !$note_planet) { |
|
47 | + if (!$note_text_unsafe && !$note_title_unsafe && !$note_galaxy && !$note_system && !$note_planet) { |
|
48 | 48 | throw new Exception('note_err_note_empty', ERR_WARNING); |
49 | 49 | } |
50 | 50 | |
@@ -53,15 +53,15 @@ discard block |
||
53 | 53 | $note_sticky = intval(sys_get_param_id('note_sticky')) ? 1 : 0; |
54 | 54 | |
55 | 55 | sn_db_transaction_start(); |
56 | - if($note_id_edit) { |
|
56 | + if ($note_id_edit) { |
|
57 | 57 | $check_note_id = DBStaticNote::db_note_get_id_and_owner($note_id_edit); |
58 | - if(!$check_note_id) { |
|
58 | + if (!$check_note_id) { |
|
59 | 59 | throw new Exception('note_err_note_not_found', ERR_ERROR); |
60 | 60 | } |
61 | 61 | } |
62 | 62 | |
63 | - if($note_id_edit) { |
|
64 | - if($check_note_id['owner'] != $user['id']) { |
|
63 | + if ($note_id_edit) { |
|
64 | + if ($check_note_id['owner'] != $user['id']) { |
|
65 | 65 | throw new Exception('note_err_owner_wrong', ERR_ERROR); |
66 | 66 | } |
67 | 67 | |
@@ -71,9 +71,9 @@ discard block |
||
71 | 71 | } |
72 | 72 | |
73 | 73 | sn_db_transaction_commit(); |
74 | - sys_redirect('notes.php?STATUS=' . ERR_NONE . '&MESSAGE=' . ($note_id_edit ? 'note_err_none_changed' : 'note_err_none_added')); |
|
74 | + sys_redirect('notes.php?STATUS='.ERR_NONE.'&MESSAGE='.($note_id_edit ? 'note_err_none_changed' : 'note_err_none_added')); |
|
75 | 75 | // throw new exception($note_id_edit ? 'note_err_none_changed' : 'note_err_none_added', ERR_NONE); |
76 | - } catch(Exception $e) { |
|
76 | + } catch (Exception $e) { |
|
77 | 77 | $note_id_edit = 0; |
78 | 78 | sn_db_transaction_rollback(); |
79 | 79 | $result[] = array( |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | } |
84 | 84 | } |
85 | 85 | |
86 | -if(!$note_id_edit) { |
|
86 | +if (!$note_id_edit) { |
|
87 | 87 | note_assign($template, array( |
88 | 88 | 'id' => 0, |
89 | 89 | 'time' => SN_TIME_NOW, |
@@ -96,13 +96,13 @@ discard block |
||
96 | 96 | |
97 | 97 | $note_exist = false; |
98 | 98 | $notes_query = DBStaticNote::db_note_list_by_owner($user['id']); |
99 | -while($note_row = db_fetch($notes_query)) { |
|
99 | +while ($note_row = db_fetch($notes_query)) { |
|
100 | 100 | note_assign($template, $note_row); |
101 | 101 | $note_exist = $note_exist || $note_row['id'] == $note_id_edit; |
102 | 102 | } |
103 | 103 | $note_id_edit = $note_exist ? $note_id_edit : 0; |
104 | 104 | |
105 | -foreach($note_priority_classes as $note_priority_id => $note_priority_class) { |
|
105 | +foreach ($note_priority_classes as $note_priority_id => $note_priority_class) { |
|
106 | 106 | $template->assign_block_vars('note_priority', array( |
107 | 107 | 'ID' => $note_priority_id, |
108 | 108 | 'CLASS' => $note_priority_classes[$note_priority_id], |
@@ -110,14 +110,14 @@ discard block |
||
110 | 110 | )); |
111 | 111 | } |
112 | 112 | |
113 | -foreach(classLocale::$lang['sys_planet_type'] as $planet_type_id => $planet_type_string) { |
|
113 | +foreach (classLocale::$lang['sys_planet_type'] as $planet_type_id => $planet_type_string) { |
|
114 | 114 | $template->assign_block_vars('planet_type', array( |
115 | 115 | 'ID' => $planet_type_id, |
116 | 116 | 'TEXT' => $planet_type_string, |
117 | 117 | )); |
118 | 118 | } |
119 | 119 | |
120 | -foreach($result as $result_data) { |
|
120 | +foreach ($result as $result_data) { |
|
121 | 121 | $template->assign_block_vars('result', $result_data); |
122 | 122 | } |
123 | 123 |