@@ -983,6 +983,9 @@ discard block |
||
983 | 983 | } |
984 | 984 | |
985 | 985 | |
986 | + /** |
|
987 | + * @param string $version |
|
988 | + */ |
|
986 | 989 | public static function upgrade_version ($version) |
987 | 990 | { |
988 | 991 | $const_dbpath = costant::database_path(); |
@@ -1000,6 +1003,10 @@ discard block |
||
1000 | 1003 | ########################## |
1001 | 1004 | class various |
1002 | 1005 | { |
1006 | + /** |
|
1007 | + * @param string $AlertMessage |
|
1008 | + * @param string $AlertRedirect |
|
1009 | + */ |
|
1003 | 1010 | public static function send_alert_and_redirect ($AlertMessage, $AlertRedirect) |
1004 | 1011 | { |
1005 | 1012 | echo "<script src='res/app/functions-1.0.4.js' type='text/javascript'></script>"; |
@@ -1192,6 +1199,10 @@ discard block |
||
1192 | 1199 | global $tr_default_type; |
1193 | 1200 | return $tr_default_type; |
1194 | 1201 | } |
1202 | + |
|
1203 | + /** |
|
1204 | + * @return string |
|
1205 | + */ |
|
1195 | 1206 | public static function attachments_folder () |
1196 | 1207 | { |
1197 | 1208 | global $attachments_folder; |
@@ -579,8 +579,8 @@ discard block |
||
579 | 579 | } |
580 | 580 | |
581 | 581 | |
582 | - //Select all bank accounts |
|
583 | - public static function bankaccount_select_all () |
|
582 | + //Select all bank accounts |
|
583 | + public static function bankaccount_select_all () |
|
584 | 584 | { |
585 | 585 | $const_dbpath = costant::database_path(); |
586 | 586 | $db = new PDO("sqlite:${const_dbpath}"); |
@@ -595,7 +595,7 @@ discard block |
||
595 | 595 | |
596 | 596 | |
597 | 597 | //Select all payee |
598 | - public static function payee_select_all_name () |
|
598 | + public static function payee_select_all_name () |
|
599 | 599 | { |
600 | 600 | $const_dbpath = costant::database_path(); |
601 | 601 | $db = new PDO("sqlite:${const_dbpath}"); |
@@ -611,7 +611,7 @@ discard block |
||
611 | 611 | |
612 | 612 | |
613 | 613 | //Select one payee |
614 | - public static function payee_select_one ($PayeeName) |
|
614 | + public static function payee_select_one ($PayeeName) |
|
615 | 615 | { |
616 | 616 | $const_dbpath = costant::database_path(); |
617 | 617 | $db = new PDO("sqlite:${const_dbpath}"); |
@@ -763,7 +763,7 @@ discard block |
||
763 | 763 | } |
764 | 764 | |
765 | 765 | |
766 | - // Insert all categories |
|
766 | + // Insert all categories |
|
767 | 767 | public static function category_insert_json ($CategoryJSON) |
768 | 768 | { |
769 | 769 | $categories_json_list = json_decode ($CategoryJSON,true); |
@@ -899,7 +899,7 @@ discard block |
||
899 | 899 | case "1.0.1": |
900 | 900 | db_upgrade::upgrade_version("1.0.2"); |
901 | 901 | break; |
902 | - case "1.0.2": |
|
902 | + case "1.0.2": |
|
903 | 903 | db_upgrade::upgrade_version("1.0.3"); |
904 | 904 | break; |
905 | 905 | case "1.0.3": |
@@ -1250,15 +1250,15 @@ discard block |
||
1250 | 1250 | |
1251 | 1251 | public static function current_page_url () |
1252 | 1252 | { |
1253 | - $pageURL = 'http'; |
|
1254 | - if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") |
|
1253 | + $pageURL = 'http'; |
|
1254 | + if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") |
|
1255 | 1255 | $pageURL .= "s"; |
1256 | - $pageURL .= "://"; |
|
1257 | - if ($_SERVER["SERVER_PORT"] != "80" && $_SERVER["SERVER_PORT"] != "443") |
|
1256 | + $pageURL .= "://"; |
|
1257 | + if ($_SERVER["SERVER_PORT"] != "80" && $_SERVER["SERVER_PORT"] != "443") |
|
1258 | 1258 | {$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];} |
1259 | - else |
|
1259 | + else |
|
1260 | 1260 | {$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];} |
1261 | - return $pageURL; |
|
1261 | + return $pageURL; |
|
1262 | 1262 | } |
1263 | 1263 | } |
1264 | 1264 | ?> |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | require_once "configuration_system.php"; |
3 | 3 | if (file_exists("configuration_user.php")) |
4 | - {require_once "configuration_user.php";} |
|
4 | + {require_once "configuration_user.php"; } |
|
5 | 5 | |
6 | 6 | |
7 | 7 | ######################### |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | class design |
11 | 11 | { |
12 | 12 | //Create date input element |
13 | - public static function input_date ($TrDateDefault) |
|
13 | + public static function input_date($TrDateDefault) |
|
14 | 14 | { |
15 | 15 | echo "<div class='form-group'>"; |
16 | 16 | echo "<label for='Date'>Datum</label>"; |
@@ -22,10 +22,10 @@ discard block |
||
22 | 22 | |
23 | 23 | |
24 | 24 | //Create status input element |
25 | - public static function input_status ($TrStatusDefault) |
|
25 | + public static function input_status($TrStatusDefault) |
|
26 | 26 | { |
27 | - $StatusArrayDesc = array ("Keine Auswahl", "Überprüft", "Ungültig", "Beobachten", "Duplizieren"); |
|
28 | - $StatusArrayDB = array ("", "R", "V", "F", "D"); |
|
27 | + $StatusArrayDesc = array("Keine Auswahl", "Überprüft", "Ungültig", "Beobachten", "Duplizieren"); |
|
28 | + $StatusArrayDB = array("", "R", "V", "F", "D"); |
|
29 | 29 | |
30 | 30 | echo "<div class='form-group'>"; |
31 | 31 | echo "<label for='Status'>Status</label>"; |
@@ -33,9 +33,9 @@ discard block |
||
33 | 33 | for ($i = 0; $i < sizeof($StatusArrayDesc); $i++) |
34 | 34 | { |
35 | 35 | if ($StatusArrayDB[$i] == $TrStatusDefault) |
36 | - {echo "<option value = '${StatusArrayDB[$i]}' selected> ${StatusArrayDesc[$i]} </option>";} |
|
36 | + {echo "<option value = '${StatusArrayDB[$i]}' selected> ${StatusArrayDesc[$i]} </option>"; } |
|
37 | 37 | else |
38 | - {echo "<option value = '${StatusArrayDB[$i]}'> ${StatusArrayDesc[$i]} </option>";} |
|
38 | + {echo "<option value = '${StatusArrayDB[$i]}'> ${StatusArrayDesc[$i]} </option>"; } |
|
39 | 39 | } |
40 | 40 | echo "</select>"; |
41 | 41 | echo "<span class='help-block'></span>"; |
@@ -44,9 +44,9 @@ discard block |
||
44 | 44 | |
45 | 45 | |
46 | 46 | //Create type input element |
47 | - public static function input_type ($TrTypeDefault) |
|
47 | + public static function input_type($TrTypeDefault) |
|
48 | 48 | { |
49 | - $TypeArrayDesc = array ("Zahlung", "Gutschrift", "Übertrag"); |
|
49 | + $TypeArrayDesc = array("Zahlung", "Gutschrift", "Übertrag"); |
|
50 | 50 | |
51 | 51 | echo "<div class='form-group'>"; |
52 | 52 | echo "<label for='Type'>Type</label>"; |
@@ -54,9 +54,9 @@ discard block |
||
54 | 54 | for ($i = 0; $i < sizeof($TypeArrayDesc); $i++) |
55 | 55 | { |
56 | 56 | if ($TypeArrayDesc[$i] == $TrTypeDefault) |
57 | - {echo "<option value='${TypeArrayDesc[$i]}' selected> ${TypeArrayDesc[$i]} </option>";} |
|
57 | + {echo "<option value='${TypeArrayDesc[$i]}' selected> ${TypeArrayDesc[$i]} </option>"; } |
|
58 | 58 | else |
59 | - {echo "<option value='${TypeArrayDesc[$i]}'> ${TypeArrayDesc[$i]} </option>";} |
|
59 | + {echo "<option value='${TypeArrayDesc[$i]}'> ${TypeArrayDesc[$i]} </option>"; } |
|
60 | 60 | } |
61 | 61 | echo "</select>"; |
62 | 62 | echo "<span class='help-block'></span>"; |
@@ -65,11 +65,11 @@ discard block |
||
65 | 65 | |
66 | 66 | |
67 | 67 | //Create account input element |
68 | - public static function input_account ($TrAccountDefault) |
|
68 | + public static function input_account($TrAccountDefault) |
|
69 | 69 | { |
70 | 70 | $AccountArrayDesc = db_function::bankaccount_select_all(); |
71 | 71 | if (sizeof($AccountArrayDesc) == 0) |
72 | - {$AccountArrayDesc[0] = "Keine Auswahl";} |
|
72 | + {$AccountArrayDesc[0] = "Keine Auswahl"; } |
|
73 | 73 | |
74 | 74 | echo "<div class='form-group'>"; |
75 | 75 | echo "<label for='Account'>Konto</label>"; |
@@ -77,9 +77,9 @@ discard block |
||
77 | 77 | for ($i = 0; $i < sizeof($AccountArrayDesc); $i++) |
78 | 78 | { |
79 | 79 | if ($AccountArrayDesc[$i] == $TrAccountDefault) |
80 | - {echo "<option value=\"${AccountArrayDesc[$i]}\" selected> ${AccountArrayDesc[$i]} </option>";} |
|
80 | + {echo "<option value=\"${AccountArrayDesc[$i]}\" selected> ${AccountArrayDesc[$i]} </option>"; } |
|
81 | 81 | else |
82 | - {echo "<option value=\"${AccountArrayDesc[$i]}\"> ${AccountArrayDesc[$i]} </option>";} |
|
82 | + {echo "<option value=\"${AccountArrayDesc[$i]}\"> ${AccountArrayDesc[$i]} </option>"; } |
|
83 | 83 | } |
84 | 84 | echo "</select>"; |
85 | 85 | echo "<span class='help-block'></span>"; |
@@ -88,10 +88,10 @@ discard block |
||
88 | 88 | |
89 | 89 | |
90 | 90 | //Create toaccount input element |
91 | - public static function input_toaccount ($TrToAccountDefault) |
|
91 | + public static function input_toaccount($TrToAccountDefault) |
|
92 | 92 | { |
93 | 93 | $ToAccountArrayDesc = db_function::bankaccount_select_all(); |
94 | - array_unshift($ToAccountArrayDesc,"Keine Auswahl"); |
|
94 | + array_unshift($ToAccountArrayDesc, "Keine Auswahl"); |
|
95 | 95 | |
96 | 96 | echo "<div class='form-group'>"; |
97 | 97 | echo "<label for='ToAccount'>Auf Konto</label>"; |
@@ -99,9 +99,9 @@ discard block |
||
99 | 99 | for ($i = 0; $i < sizeof($ToAccountArrayDesc); $i++) |
100 | 100 | { |
101 | 101 | if ($ToAccountArrayDesc[$i] == $TrToAccountDefault) |
102 | - {echo "<option value=\"${ToAccountArrayDesc[$i]}\" selected> ${ToAccountArrayDesc[$i]} </option>";} |
|
102 | + {echo "<option value=\"${ToAccountArrayDesc[$i]}\" selected> ${ToAccountArrayDesc[$i]} </option>"; } |
|
103 | 103 | else |
104 | - {echo "<option value=\"${ToAccountArrayDesc[$i]}\"> ${ToAccountArrayDesc[$i]} </option>";} |
|
104 | + {echo "<option value=\"${ToAccountArrayDesc[$i]}\"> ${ToAccountArrayDesc[$i]} </option>"; } |
|
105 | 105 | } |
106 | 106 | echo "</select>"; |
107 | 107 | echo "<span class='help-block'></span>"; |
@@ -110,10 +110,10 @@ discard block |
||
110 | 110 | |
111 | 111 | |
112 | 112 | //Create payee input element |
113 | - public static function input_payee ($TrPayeeDefault) |
|
113 | + public static function input_payee($TrPayeeDefault) |
|
114 | 114 | { |
115 | 115 | $PayeeArrayDesc = db_function::payee_select_all_name(); |
116 | - array_unshift($PayeeArrayDesc,"Keine Auswahl"); |
|
116 | + array_unshift($PayeeArrayDesc, "Keine Auswahl"); |
|
117 | 117 | |
118 | 118 | echo "<div class='form-group'>"; |
119 | 119 | echo "<label for='Payee'>Zahlungsempfänger</label>"; |
@@ -122,19 +122,19 @@ discard block |
||
122 | 122 | echo "</div>\n"; |
123 | 123 | |
124 | 124 | echo "<script type='text/javascript'>"; |
125 | - echo "var PayeeList = " . json_encode($PayeeArrayDesc) . ";"; |
|
125 | + echo "var PayeeList = ".json_encode($PayeeArrayDesc).";"; |
|
126 | 126 | echo "$('#Payee').typeahead({hint: true, highlight: true, minLength: 1},{name: 'PayeeList', displayKey: 'value',source: substringMatcher(PayeeList)});"; |
127 | 127 | if ($TrPayeeDefault != "") |
128 | - {echo "document.getElementById('Payee').value='${TrPayeeDefault}'";} |
|
128 | + {echo "document.getElementById('Payee').value='${TrPayeeDefault}'"; } |
|
129 | 129 | echo "</script>"; |
130 | 130 | } |
131 | 131 | |
132 | 132 | |
133 | 133 | //Create category input element |
134 | - public static function input_category ($TrCategoryDefault) |
|
134 | + public static function input_category($TrCategoryDefault) |
|
135 | 135 | { |
136 | 136 | $CategoryArrayDesc = db_function::category_select_distinct(); |
137 | - array_unshift($CategoryArrayDesc,"Keine Auswahl"); |
|
137 | + array_unshift($CategoryArrayDesc, "Keine Auswahl"); |
|
138 | 138 | |
139 | 139 | echo "<div class='form-group'>"; |
140 | 140 | echo "<label for='Category'>Kategorie</label>"; |
@@ -143,16 +143,16 @@ discard block |
||
143 | 143 | echo "</div>\n"; |
144 | 144 | |
145 | 145 | echo "<script type='text/javascript'>"; |
146 | - echo "var CategoryList = " . json_encode($CategoryArrayDesc) . ";"; |
|
146 | + echo "var CategoryList = ".json_encode($CategoryArrayDesc).";"; |
|
147 | 147 | echo "$('#Category').typeahead({hint: true, highlight: true, minLength: 1},{name: 'CategoryList', displayKey: 'value',source: substringMatcher(CategoryList)});"; |
148 | 148 | if ($TrCategoryDefault != "") |
149 | - {echo "document.getElementById('Category').value='${TrCategoryDefault}';";} |
|
149 | + {echo "document.getElementById('Category').value='${TrCategoryDefault}';"; } |
|
150 | 150 | echo "</script>"; |
151 | 151 | } |
152 | 152 | |
153 | 153 | |
154 | 154 | //Create subcategory input element |
155 | - public static function input_subcategory ($TrSubCategoryDefault) |
|
155 | + public static function input_subcategory($TrSubCategoryDefault) |
|
156 | 156 | { |
157 | 157 | echo "<div class='form-group'>"; |
158 | 158 | echo "<label for='SubCategory'>Unterkategorie</label>"; |
@@ -162,13 +162,13 @@ discard block |
||
162 | 162 | |
163 | 163 | echo "<script type='text/javascript'>"; |
164 | 164 | if ($TrSubCategoryDefault != "") |
165 | - {echo "document.getElementById('SubCategory').value='${TrSubCategoryDefault}';";} |
|
165 | + {echo "document.getElementById('SubCategory').value='${TrSubCategoryDefault}';"; } |
|
166 | 166 | echo "</script>"; |
167 | 167 | } |
168 | 168 | |
169 | 169 | |
170 | 170 | //Create amount input element |
171 | - public static function input_amount ($TrAmountDefault) |
|
171 | + public static function input_amount($TrAmountDefault) |
|
172 | 172 | { |
173 | 173 | echo "<div class='form-group'>"; |
174 | 174 | echo "<label for='Amount'>Betrag</label>"; |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | |
188 | 188 | |
189 | 189 | //Create notes input element |
190 | - public static function input_notes ($TrNotesDefault) |
|
190 | + public static function input_notes($TrNotesDefault) |
|
191 | 191 | { |
192 | 192 | echo "<div class='form-group'>"; |
193 | 193 | echo "<label for='Notes'>Notizen</label>"; |
@@ -206,15 +206,15 @@ discard block |
||
206 | 206 | |
207 | 207 | |
208 | 208 | //Create Hidden Field |
209 | - public static function input_hidden ($FieldName,$Value) |
|
210 | - {echo "<input type='hidden' id = '${FieldName}' name='${FieldName}' value='${Value}' />";} |
|
209 | + public static function input_hidden($FieldName, $Value) |
|
210 | + {echo "<input type='hidden' id = '${FieldName}' name='${FieldName}' value='${Value}' />"; } |
|
211 | 211 | |
212 | 212 | |
213 | 213 | //Create setting input element |
214 | - public static function settings ($VarName,$VarValue,$PlaceHolder,$InputType,$Required) |
|
214 | + public static function settings($VarName, $VarValue, $PlaceHolder, $InputType, $Required) |
|
215 | 215 | { |
216 | 216 | echo "<div class='form-group'>"; |
217 | - echo "<label for='Set_${VarName}'>".str_replace("_"," ",$VarName)."</label>"; |
|
217 | + echo "<label for='Set_${VarName}'>".str_replace("_", " ", $VarName)."</label>"; |
|
218 | 218 | if ($VarValue == "") |
219 | 219 | { |
220 | 220 | if ($Required == True) |
@@ -242,41 +242,41 @@ discard block |
||
242 | 242 | } |
243 | 243 | |
244 | 244 | //Create seting checkbox element |
245 | - public static function settings_checkbox ($VarName,$VarValue,$VarDescription) |
|
245 | + public static function settings_checkbox($VarName, $VarValue, $VarDescription) |
|
246 | 246 | { |
247 | 247 | echo "<div class='checkbox'>"; |
248 | 248 | echo "<label>"; |
249 | 249 | if ($VarValue == True) |
250 | - {echo "<input id='${VarName}' type='checkbox' name='${VarName}' value='True' checked>${VarDescription}";} |
|
250 | + {echo "<input id='${VarName}' type='checkbox' name='${VarName}' value='True' checked>${VarDescription}"; } |
|
251 | 251 | else |
252 | - {echo "<input id='${VarName}' type='checkbox' name='${VarName}' value='True'>${VarDescription}";} |
|
252 | + {echo "<input id='${VarName}' type='checkbox' name='${VarName}' value='True'>${VarDescription}"; } |
|
253 | 253 | echo "</label>"; |
254 | 254 | echo "</div>\n"; |
255 | 255 | } |
256 | 256 | |
257 | 257 | |
258 | 258 | //Create password input element |
259 | - public static function settings_password ($VarName,$PlaceHolder,$Required) |
|
259 | + public static function settings_password($VarName, $PlaceHolder, $Required) |
|
260 | 260 | { |
261 | 261 | echo "<div class='form-group'>"; |
262 | - echo "<label for='Set_${VarName}'>".str_replace("_"," ",$VarName)."</label>"; |
|
262 | + echo "<label for='Set_${VarName}'>".str_replace("_", " ", $VarName)."</label>"; |
|
263 | 263 | if ($Required == True) |
264 | 264 | { |
265 | 265 | echo "<input id='Set_${VarName}' type='Password' name='Set_${VarName}' class='form-control' placeholder='${PlaceHolder}' required />"; |
266 | 266 | } |
267 | 267 | elseif ($Required == False) |
268 | - {echo "<input id='Set_${VarName}' type='Password' name='Set_${VarName}' class='form-control' placeholder='${PlaceHolder}' />";} |
|
268 | + {echo "<input id='Set_${VarName}' type='Password' name='Set_${VarName}' class='form-control' placeholder='${PlaceHolder}' />"; } |
|
269 | 269 | echo "<span class='help-block'></span>"; |
270 | 270 | echo "</div>\n"; |
271 | 271 | } |
272 | 272 | |
273 | 273 | |
274 | 274 | //Design setting default account |
275 | - public static function settings_default_account ($TrAccountDefault) |
|
275 | + public static function settings_default_account($TrAccountDefault) |
|
276 | 276 | { |
277 | 277 | $AccountArrayDesc = db_function::bankaccount_select_all(); |
278 | 278 | if (sizeof($AccountArrayDesc) == 0) |
279 | - {$AccountArrayDesc[0] = "Keine Auswahl";} |
|
279 | + {$AccountArrayDesc[0] = "Keine Auswahl"; } |
|
280 | 280 | |
281 | 281 | echo "<div class='form-group'>"; |
282 | 282 | echo "<label for='Default_Account'> Default Account</label>"; |
@@ -284,9 +284,9 @@ discard block |
||
284 | 284 | for ($i = 0; $i < sizeof($AccountArrayDesc); $i++) |
285 | 285 | { |
286 | 286 | if ($AccountArrayDesc[$i] == $TrAccountDefault) |
287 | - {echo "<option selected> ${AccountArrayDesc[$i]} </option>";} |
|
287 | + {echo "<option selected> ${AccountArrayDesc[$i]} </option>"; } |
|
288 | 288 | else |
289 | - {echo "<option> ${AccountArrayDesc[$i]} </option>";} |
|
289 | + {echo "<option> ${AccountArrayDesc[$i]} </option>"; } |
|
290 | 290 | } |
291 | 291 | echo "</select>"; |
292 | 292 | echo "<span class='help-block'></span>"; |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | |
296 | 296 | |
297 | 297 | //Design section legend |
298 | - public static function section_legened ($Text) |
|
298 | + public static function section_legened($Text) |
|
299 | 299 | { |
300 | 300 | echo "<h4>${Text}</h4>"; |
301 | 301 | echo "<hr>"; |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | |
304 | 304 | |
305 | 305 | //Design table cell |
306 | - public static function table_cell ($value,$css_class) |
|
306 | + public static function table_cell($value, $css_class) |
|
307 | 307 | { |
308 | 308 | echo "<td class='${css_class}'>"; |
309 | 309 | echo $value; |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | { |
330 | 330 | $db = new PDO("sqlite:${const_dbpath}"); |
331 | 331 | |
332 | - $db -> exec ("CREATE TABLE IF NOT EXISTS [New_Transaction]( |
|
332 | + $db -> exec("CREATE TABLE IF NOT EXISTS [New_Transaction]( |
|
333 | 333 | ID INTEGER PRIMARY KEY AUTOINCREMENT, |
334 | 334 | Date DATE NOT NULL, |
335 | 335 | Account TEXT NOT NULL, |
@@ -342,42 +342,42 @@ discard block |
||
342 | 342 | Amount NUMERIC NOT NULL, |
343 | 343 | Notes TEXT |
344 | 344 | );"); |
345 | - $db -> exec ("CREATE TABLE IF NOT EXISTS [Account_List] ( |
|
345 | + $db -> exec("CREATE TABLE IF NOT EXISTS [Account_List] ( |
|
346 | 346 | AccountName TEXT PRIMARY KEY NOT NULL |
347 | 347 | );"); |
348 | - $db -> exec ("CREATE TABLE IF NOT EXISTS [Payee_List] ( |
|
348 | + $db -> exec("CREATE TABLE IF NOT EXISTS [Payee_List] ( |
|
349 | 349 | PayeeName TEXT PRIMARY KEY NOT NULL, |
350 | 350 | DefCateg TEXT, |
351 | 351 | DefSubCateg TEXT |
352 | 352 | );"); |
353 | - $db -> exec ("CREATE TABLE IF NOT EXISTS [Category_List] ( |
|
353 | + $db -> exec("CREATE TABLE IF NOT EXISTS [Category_List] ( |
|
354 | 354 | CategoryName TEXT NOT NULL, |
355 | 355 | SubCategoryName TEXT, |
356 | 356 | CONSTRAINT 'Category_Key' PRIMARY KEY |
357 | 357 | (CategoryName COLLATE 'NOCASE', SubCategoryName COLLATE 'NOCASE') |
358 | 358 | );"); |
359 | - $db -> exec ("CREATE TABLE IF NOT EXISTS [Parameters] ( |
|
359 | + $db -> exec("CREATE TABLE IF NOT EXISTS [Parameters] ( |
|
360 | 360 | Parameter TEXT PRIMARY KEY NOT NULL, |
361 | 361 | Value TEXT |
362 | 362 | );"); |
363 | - $db -> exec ("INSERT or IGNORE INTO Parameters VALUES ('Version','${const_app_version}');"); |
|
363 | + $db -> exec("INSERT or IGNORE INTO Parameters VALUES ('Version','${const_app_version}');"); |
|
364 | 364 | $db = null; |
365 | 365 | } |
366 | - catch(PDOException $e) |
|
367 | - {$error = $e->getMessage();} |
|
366 | + catch (PDOException $e) |
|
367 | + {$error = $e->getMessage(); } |
|
368 | 368 | |
369 | 369 | return $error; |
370 | 370 | } |
371 | 371 | |
372 | 372 | |
373 | 373 | // Get database version |
374 | - public static function db_version () |
|
374 | + public static function db_version() |
|
375 | 375 | { |
376 | 376 | $const_dbpath = costant::database_path(); |
377 | 377 | $db = new PDO("sqlite:${const_dbpath}"); |
378 | 378 | |
379 | 379 | $statement = $db->query("SELECT Value FROM Parameters WHERE Parameter = 'Version';"); |
380 | - $db_version=$statement->fetchColumn(0); |
|
380 | + $db_version = $statement->fetchColumn(0); |
|
381 | 381 | |
382 | 382 | $db = null; |
383 | 383 | return $db_version; |
@@ -385,19 +385,19 @@ discard block |
||
385 | 385 | |
386 | 386 | |
387 | 387 | // Vacuum database |
388 | - public static function db_vacuum () |
|
388 | + public static function db_vacuum() |
|
389 | 389 | { |
390 | 390 | $const_dbpath = costant::database_path(); |
391 | 391 | $db = new PDO("sqlite:${const_dbpath}"); |
392 | 392 | |
393 | - $db->exec ("VACUUM"); |
|
393 | + $db->exec("VACUUM"); |
|
394 | 394 | |
395 | 395 | $db = null; |
396 | 396 | } |
397 | 397 | |
398 | 398 | |
399 | 399 | // Insert transaction |
400 | - public static function transaction_insert ($TrDate, $TrStatus, $TrType, $TrAccount, $TrToAccount, $TrPayee, $TrCategory, $TrSubCategory, $TrAmount, $TrNotes) |
|
400 | + public static function transaction_insert($TrDate, $TrStatus, $TrType, $TrAccount, $TrToAccount, $TrPayee, $TrCategory, $TrSubCategory, $TrAmount, $TrNotes) |
|
401 | 401 | { |
402 | 402 | $ID = 0; |
403 | 403 | $const_dbpath = costant::database_path(); |
@@ -405,17 +405,17 @@ discard block |
||
405 | 405 | |
406 | 406 | $statement = $db -> prepare("INSERT INTO New_Transaction (Date, Status, Type, Account, ToAccount, Payee, Category, SubCategory, Amount, Notes) |
407 | 407 | VALUES(:TrDate, :TrStatus, :TrType, :TrAccount, :TrToAccount, :TrPayee, :TrCategory, :TrSubCategory, :TrAmount, :TrNotes);"); |
408 | - $statement->bindParam(":TrDate",$TrDate); |
|
409 | - $statement->bindParam(":TrStatus",$TrStatus); |
|
410 | - $statement->bindParam(":TrType",$TrType); |
|
411 | - $statement->bindParam(":TrAccount",$TrAccount); |
|
412 | - $statement->bindParam(":TrToAccount",$TrToAccount); |
|
413 | - $statement->bindParam(":TrPayee",$TrPayee); |
|
414 | - $statement->bindParam(":TrCategory",$TrCategory); |
|
415 | - $statement->bindParam(":TrSubCategory",$TrSubCategory); |
|
416 | - $statement->bindParam(":TrAmount",$TrAmount); |
|
417 | - $statement->bindParam(":TrNotes",$TrNotes); |
|
418 | - $statement-> execute (); |
|
408 | + $statement->bindParam(":TrDate", $TrDate); |
|
409 | + $statement->bindParam(":TrStatus", $TrStatus); |
|
410 | + $statement->bindParam(":TrType", $TrType); |
|
411 | + $statement->bindParam(":TrAccount", $TrAccount); |
|
412 | + $statement->bindParam(":TrToAccount", $TrToAccount); |
|
413 | + $statement->bindParam(":TrPayee", $TrPayee); |
|
414 | + $statement->bindParam(":TrCategory", $TrCategory); |
|
415 | + $statement->bindParam(":TrSubCategory", $TrSubCategory); |
|
416 | + $statement->bindParam(":TrAmount", $TrAmount); |
|
417 | + $statement->bindParam(":TrNotes", $TrNotes); |
|
418 | + $statement-> execute(); |
|
419 | 419 | |
420 | 420 | $ID = $db->lastInsertId(); |
421 | 421 | $db = null; |
@@ -424,13 +424,13 @@ discard block |
||
424 | 424 | |
425 | 425 | |
426 | 426 | // Get transaction Max ID |
427 | - public static function transaction_select_maxid () |
|
427 | + public static function transaction_select_maxid() |
|
428 | 428 | { |
429 | 429 | $const_dbpath = costant::database_path(); |
430 | 430 | $db = new PDO("sqlite:${const_dbpath}"); |
431 | 431 | |
432 | 432 | $statement = $db->query("SELECT MAX(ID) FROM New_Transaction;"); |
433 | - $resultcount=$statement->fetchColumn(0); |
|
433 | + $resultcount = $statement->fetchColumn(0); |
|
434 | 434 | $transaction_maxid = intval($resultcount); |
435 | 435 | |
436 | 436 | $db = null; |
@@ -439,47 +439,47 @@ discard block |
||
439 | 439 | |
440 | 440 | |
441 | 441 | // Select all transaction |
442 | - public static function transaction_select_all () |
|
442 | + public static function transaction_select_all() |
|
443 | 443 | { |
444 | 444 | $const_dbpath = costant::database_path(); |
445 | 445 | $db = new PDO("sqlite:${const_dbpath}"); |
446 | 446 | |
447 | 447 | $results = $db -> query("SELECT * FROM New_Transaction;"); |
448 | 448 | $resultarray = array(); |
449 | - if($results !== false) |
|
450 | - {$resultarray = $results->fetchall(PDO::FETCH_ASSOC);} |
|
449 | + if ($results !== false) |
|
450 | + {$resultarray = $results->fetchall(PDO::FETCH_ASSOC); } |
|
451 | 451 | $db = null; |
452 | 452 | return $resultarray; |
453 | 453 | } |
454 | 454 | |
455 | 455 | |
456 | 456 | // Select all transaction order by date |
457 | - public static function transaction_select_all_order_by_date () |
|
457 | + public static function transaction_select_all_order_by_date() |
|
458 | 458 | { |
459 | 459 | $const_dbpath = costant::database_path(); |
460 | 460 | $db = new PDO("sqlite:${const_dbpath}"); |
461 | 461 | |
462 | 462 | $results = $db -> query("SELECT * FROM New_Transaction ORDER BY Date;"); |
463 | 463 | $resultarray = array(); |
464 | - if($results !== false) |
|
465 | - {$resultarray = $results->fetchall(PDO::FETCH_ASSOC);} |
|
464 | + if ($results !== false) |
|
465 | + {$resultarray = $results->fetchall(PDO::FETCH_ASSOC); } |
|
466 | 466 | $db = null; |
467 | 467 | return $resultarray; |
468 | 468 | } |
469 | 469 | |
470 | 470 | |
471 | 471 | // Select one transaction |
472 | - public static function transaction_select_one ($TrEditNr) |
|
472 | + public static function transaction_select_one($TrEditNr) |
|
473 | 473 | { |
474 | 474 | $const_dbpath = costant::database_path(); |
475 | 475 | $db = new PDO("sqlite:${const_dbpath}"); |
476 | 476 | |
477 | 477 | $statement = $db-> prepare("SELECT * FROM New_Transaction WHERE ID = :TrEditNr;"); |
478 | - $statement->bindParam(":TrEditNr",$TrEditNr); |
|
479 | - $statement-> execute (); |
|
478 | + $statement->bindParam(":TrEditNr", $TrEditNr); |
|
479 | + $statement-> execute(); |
|
480 | 480 | $resultarray = array(); |
481 | 481 | $resultarray = $statement->fetch(PDO::FETCH_ASSOC); |
482 | - if(!$resultarray) {$resultarray = array();} |
|
482 | + if (!$resultarray) {$resultarray = array(); } |
|
483 | 483 | |
484 | 484 | $db = null; |
485 | 485 | return $resultarray; |
@@ -487,36 +487,36 @@ discard block |
||
487 | 487 | |
488 | 488 | |
489 | 489 | //Delete all transaction |
490 | - public static function transaction_delete_all () |
|
490 | + public static function transaction_delete_all() |
|
491 | 491 | { |
492 | 492 | $const_dbpath = costant::database_path(); |
493 | 493 | $db = new PDO("sqlite:${const_dbpath}"); |
494 | 494 | |
495 | - $db->exec ("DELETE FROM New_Transaction;"); |
|
495 | + $db->exec("DELETE FROM New_Transaction;"); |
|
496 | 496 | |
497 | 497 | $db = null; |
498 | 498 | } |
499 | 499 | |
500 | 500 | |
501 | 501 | //Delete group transaction |
502 | - public static function transaction_delete_group ($TrDeleteArr) |
|
502 | + public static function transaction_delete_group($TrDeleteArr) |
|
503 | 503 | { |
504 | 504 | $const_dbpath = costant::database_path(); |
505 | 505 | $N = count($TrDeleteArr); |
506 | 506 | $SQLDelete = ""; |
507 | - for($i=0; $i < $N; $i++) |
|
508 | - {$SQLDelete = $SQLDelete.$TrDeleteArr[$i] . ",";} |
|
507 | + for ($i = 0; $i < $N; $i++) |
|
508 | + {$SQLDelete = $SQLDelete.$TrDeleteArr[$i].","; } |
|
509 | 509 | $SQLDelete = rtrim($SQLDelete, ","); |
510 | 510 | |
511 | 511 | $db = new PDO("sqlite:${const_dbpath}"); |
512 | - $db->exec ("DELETE FROM New_Transaction WHERE ID IN (${SQLDelete});"); |
|
512 | + $db->exec("DELETE FROM New_Transaction WHERE ID IN (${SQLDelete});"); |
|
513 | 513 | |
514 | 514 | $db = null; |
515 | 515 | } |
516 | 516 | |
517 | 517 | |
518 | 518 | // Update transaction |
519 | - public static function transaction_update ($TrEditedId,$TrDate,$TrStatus,$TrType,$TrAccount,$TrToAccount,$TrPayee,$TrCategory,$TrSubCategory,$TrAmount,$TrNotes) |
|
519 | + public static function transaction_update($TrEditedId, $TrDate, $TrStatus, $TrType, $TrAccount, $TrToAccount, $TrPayee, $TrCategory, $TrSubCategory, $TrAmount, $TrNotes) |
|
520 | 520 | { |
521 | 521 | $const_dbpath = costant::database_path(); |
522 | 522 | $db = new PDO("sqlite:${const_dbpath}"); |
@@ -525,27 +525,27 @@ discard block |
||
525 | 525 | Account = :TrAccount, ToAccount = :TrToAccount, Payee = :TrPayee, |
526 | 526 | Category = :TrCategory, SubCategory = :TrSubCategory, Amount = :TrAmount, Notes = :TrNotes |
527 | 527 | WHERE ID = :TrEditedId;"); |
528 | - $statement->bindParam(":TrEditedId",$TrEditedId); |
|
529 | - $statement->bindParam(":TrDate",$TrDate); |
|
530 | - $statement->bindParam(":TrStatus",$TrStatus); |
|
531 | - $statement->bindParam(":TrType",$TrType); |
|
532 | - $statement->bindParam(":TrAccount",$TrAccount); |
|
533 | - $statement->bindParam(":TrToAccount",$TrToAccount); |
|
534 | - $statement->bindParam(":TrPayee",$TrPayee); |
|
535 | - $statement->bindParam(":TrCategory",$TrCategory); |
|
536 | - $statement->bindParam(":TrSubCategory",$TrSubCategory); |
|
537 | - $statement->bindParam(":TrAmount",$TrAmount); |
|
538 | - $statement->bindParam(":TrNotes",$TrNotes); |
|
539 | - $statement-> execute (); |
|
528 | + $statement->bindParam(":TrEditedId", $TrEditedId); |
|
529 | + $statement->bindParam(":TrDate", $TrDate); |
|
530 | + $statement->bindParam(":TrStatus", $TrStatus); |
|
531 | + $statement->bindParam(":TrType", $TrType); |
|
532 | + $statement->bindParam(":TrAccount", $TrAccount); |
|
533 | + $statement->bindParam(":TrToAccount", $TrToAccount); |
|
534 | + $statement->bindParam(":TrPayee", $TrPayee); |
|
535 | + $statement->bindParam(":TrCategory", $TrCategory); |
|
536 | + $statement->bindParam(":TrSubCategory", $TrSubCategory); |
|
537 | + $statement->bindParam(":TrAmount", $TrAmount); |
|
538 | + $statement->bindParam(":TrNotes", $TrNotes); |
|
539 | + $statement-> execute(); |
|
540 | 540 | |
541 | 541 | $db = null; |
542 | 542 | } |
543 | 543 | |
544 | 544 | |
545 | 545 | // Insert bank accounts |
546 | - public static function bankaccount_insert_json ($BankAccountJSON) |
|
546 | + public static function bankaccount_insert_json($BankAccountJSON) |
|
547 | 547 | { |
548 | - $bankaccounts_json_list = json_decode ($BankAccountJSON,true); |
|
548 | + $bankaccounts_json_list = json_decode($BankAccountJSON, true); |
|
549 | 549 | $BankAccountList = $bankaccounts_json_list["Accounts"]; |
550 | 550 | $const_dbpath = costant::database_path(); |
551 | 551 | |
@@ -557,8 +557,8 @@ discard block |
||
557 | 557 | { |
558 | 558 | if ($BankAccountList[$i]["AccountName"] != "") |
559 | 559 | { |
560 | - $statement->bindParam(":AccountName",$BankAccountList[$i]["AccountName"]); |
|
561 | - $statement->execute (); |
|
560 | + $statement->bindParam(":AccountName", $BankAccountList[$i]["AccountName"]); |
|
561 | + $statement->execute(); |
|
562 | 562 | } |
563 | 563 | } |
564 | 564 | |
@@ -568,42 +568,42 @@ discard block |
||
568 | 568 | |
569 | 569 | |
570 | 570 | //Delete all bank accounts |
571 | - public static function bankaccount_delete_all () |
|
571 | + public static function bankaccount_delete_all() |
|
572 | 572 | { |
573 | 573 | $const_dbpath = costant::database_path(); |
574 | 574 | $db = new PDO("sqlite:${const_dbpath}"); |
575 | 575 | |
576 | - $db->exec ("DELETE FROM Account_list;"); |
|
576 | + $db->exec("DELETE FROM Account_list;"); |
|
577 | 577 | |
578 | 578 | $db = null; |
579 | 579 | } |
580 | 580 | |
581 | 581 | |
582 | 582 | //Select all bank accounts |
583 | - public static function bankaccount_select_all () |
|
583 | + public static function bankaccount_select_all() |
|
584 | 584 | { |
585 | 585 | $const_dbpath = costant::database_path(); |
586 | 586 | $db = new PDO("sqlite:${const_dbpath}"); |
587 | 587 | |
588 | 588 | $results = $db -> query("SELECT AccountName FROM Account_list ORDER BY AccountName COLLATE nocase;"); |
589 | 589 | $resultarray = array(); |
590 | - if($results !== false) |
|
591 | - {$resultarray = $results->fetchAll(PDO::FETCH_COLUMN, 0);} |
|
590 | + if ($results !== false) |
|
591 | + {$resultarray = $results->fetchAll(PDO::FETCH_COLUMN, 0); } |
|
592 | 592 | $db = null; |
593 | 593 | return $resultarray; |
594 | 594 | } |
595 | 595 | |
596 | 596 | |
597 | 597 | //Select all payee |
598 | - public static function payee_select_all_name () |
|
598 | + public static function payee_select_all_name() |
|
599 | 599 | { |
600 | 600 | $const_dbpath = costant::database_path(); |
601 | 601 | $db = new PDO("sqlite:${const_dbpath}"); |
602 | 602 | |
603 | 603 | $results = $db -> query("SELECT PayeeName FROM Payee_List ORDER BY PayeeName COLLATE nocase;"); |
604 | 604 | $resultarray = array(); |
605 | - if($results !== false) |
|
606 | - {$resultarray = $results->fetchAll(PDO::FETCH_COLUMN, 0);} |
|
605 | + if ($results !== false) |
|
606 | + {$resultarray = $results->fetchAll(PDO::FETCH_COLUMN, 0); } |
|
607 | 607 | |
608 | 608 | $db = null; |
609 | 609 | return $resultarray; |
@@ -611,17 +611,17 @@ discard block |
||
611 | 611 | |
612 | 612 | |
613 | 613 | //Select one payee |
614 | - public static function payee_select_one ($PayeeName) |
|
614 | + public static function payee_select_one($PayeeName) |
|
615 | 615 | { |
616 | 616 | $const_dbpath = costant::database_path(); |
617 | 617 | $db = new PDO("sqlite:${const_dbpath}"); |
618 | 618 | |
619 | 619 | $statement = $db-> prepare("SELECT * FROM Payee_List WHERE PayeeName = :TrPayeeName COLLATE nocase;"); |
620 | - $statement->bindParam(":TrPayeeName",$PayeeName); |
|
621 | - $statement-> execute (); |
|
620 | + $statement->bindParam(":TrPayeeName", $PayeeName); |
|
621 | + $statement-> execute(); |
|
622 | 622 | $resultarray = array(); |
623 | 623 | $resultarray = $statement->fetch(PDO::FETCH_ASSOC); |
624 | - if(!$resultarray) {$resultarray = array();} |
|
624 | + if (!$resultarray) {$resultarray = array(); } |
|
625 | 625 | |
626 | 626 | $db = null; |
627 | 627 | return $resultarray; |
@@ -629,25 +629,25 @@ discard block |
||
629 | 629 | |
630 | 630 | |
631 | 631 | // Insert single payee account |
632 | - public static function payee_insert_single ($Payee,$Category,$SubCategory) |
|
632 | + public static function payee_insert_single($Payee, $Category, $SubCategory) |
|
633 | 633 | { |
634 | 634 | $const_dbpath = costant::database_path(); |
635 | 635 | $db = new PDO("sqlite:${const_dbpath}"); |
636 | 636 | |
637 | 637 | $statement = $db -> prepare("INSERT or IGNORE INTO Payee_list (PayeeName,DefCateg,DefSubCateg) |
638 | 638 | VALUES (:PayeeName,:DefCateg,:DefSubCateg);"); |
639 | - $statement->bindParam(":PayeeName",$Payee); |
|
640 | - $statement->bindParam(":DefCateg",$Category); |
|
641 | - $statement->bindParam(":DefSubCateg",$SubCategory); |
|
642 | - $statement-> execute (); |
|
639 | + $statement->bindParam(":PayeeName", $Payee); |
|
640 | + $statement->bindParam(":DefCateg", $Category); |
|
641 | + $statement->bindParam(":DefSubCateg", $SubCategory); |
|
642 | + $statement-> execute(); |
|
643 | 643 | |
644 | 644 | $db = null; |
645 | 645 | } |
646 | 646 | |
647 | 647 | // Insert all payee account |
648 | - public static function payee_insert_json ($PayeeJSON) |
|
648 | + public static function payee_insert_json($PayeeJSON) |
|
649 | 649 | { |
650 | - $payees_json_list = json_decode ($PayeeJSON,true); |
|
650 | + $payees_json_list = json_decode($PayeeJSON, true); |
|
651 | 651 | $PayeeList = $payees_json_list["Payees"]; |
652 | 652 | $const_dbpath = costant::database_path(); |
653 | 653 | |
@@ -660,10 +660,10 @@ discard block |
||
660 | 660 | { |
661 | 661 | if ($PayeeList[$i]["PayeeName"] != "") |
662 | 662 | { |
663 | - $statement->bindParam(":PayeeName",$PayeeList[$i]["PayeeName"]); |
|
664 | - $statement->bindParam(":DefCateg",$PayeeList[$i]["DefCateg"]); |
|
665 | - $statement->bindParam(":DefSubCateg",$PayeeList[$i]["DefSubCateg"]); |
|
666 | - $statement->execute (); |
|
663 | + $statement->bindParam(":PayeeName", $PayeeList[$i]["PayeeName"]); |
|
664 | + $statement->bindParam(":DefCateg", $PayeeList[$i]["DefCateg"]); |
|
665 | + $statement->bindParam(":DefSubCateg", $PayeeList[$i]["DefSubCateg"]); |
|
666 | + $statement->execute(); |
|
667 | 667 | } |
668 | 668 | } |
669 | 669 | |
@@ -673,56 +673,56 @@ discard block |
||
673 | 673 | |
674 | 674 | |
675 | 675 | //Delete all payee |
676 | - public static function payee_delete_all () |
|
676 | + public static function payee_delete_all() |
|
677 | 677 | { |
678 | 678 | $const_dbpath = costant::database_path(); |
679 | 679 | $db = new PDO("sqlite:${const_dbpath}"); |
680 | 680 | |
681 | - $db->exec ("DELETE FROM Payee_list;"); |
|
681 | + $db->exec("DELETE FROM Payee_list;"); |
|
682 | 682 | |
683 | 683 | $db = null; |
684 | 684 | } |
685 | 685 | |
686 | 686 | |
687 | 687 | // Update single payee account |
688 | - public static function payee_update_single ($Payee,$Category,$SubCategory) |
|
688 | + public static function payee_update_single($Payee, $Category, $SubCategory) |
|
689 | 689 | { |
690 | 690 | $const_dbpath = costant::database_path(); |
691 | 691 | $db = new PDO("sqlite:${const_dbpath}"); |
692 | 692 | |
693 | 693 | $statement = $db -> prepare("UPDATE Payee_list SET DefCateg = :DefCateg, DefSubCateg = :DefSubCateg |
694 | 694 | WHERE PayeeName = :PayeeName"); |
695 | - $statement->bindParam(":PayeeName",$Payee); |
|
696 | - $statement->bindParam(":DefCateg",$Category); |
|
697 | - $statement->bindParam(":DefSubCateg",$SubCategory); |
|
698 | - $statement-> execute (); |
|
695 | + $statement->bindParam(":PayeeName", $Payee); |
|
696 | + $statement->bindParam(":DefCateg", $Category); |
|
697 | + $statement->bindParam(":DefSubCateg", $SubCategory); |
|
698 | + $statement-> execute(); |
|
699 | 699 | |
700 | 700 | $db = null; |
701 | 701 | } |
702 | 702 | |
703 | 703 | |
704 | 704 | //Delete all categories |
705 | - public static function category_delete_all () |
|
705 | + public static function category_delete_all() |
|
706 | 706 | { |
707 | 707 | $const_dbpath = costant::database_path(); |
708 | 708 | $db = new PDO("sqlite:${const_dbpath}"); |
709 | 709 | |
710 | - $db->exec ("DELETE FROM Category_list;"); |
|
710 | + $db->exec("DELETE FROM Category_list;"); |
|
711 | 711 | |
712 | 712 | $db = null; |
713 | 713 | } |
714 | 714 | |
715 | 715 | |
716 | 716 | //Select all categories |
717 | - public static function category_select_all () |
|
717 | + public static function category_select_all() |
|
718 | 718 | { |
719 | 719 | $const_dbpath = costant::database_path(); |
720 | 720 | $db = new PDO("sqlite:${const_dbpath}"); |
721 | 721 | |
722 | 722 | $results = $db -> query("SELECT * FROM Category_List ORDER BY CategoryName COLLATE nocase;"); |
723 | 723 | $resultarray = array(); |
724 | - if($results !== false) |
|
725 | - {$resultarray = $results->fetchall(PDO::FETCH_ASSOC);} |
|
724 | + if ($results !== false) |
|
725 | + {$resultarray = $results->fetchall(PDO::FETCH_ASSOC); } |
|
726 | 726 | |
727 | 727 | $db = null; |
728 | 728 | return $resultarray; |
@@ -730,15 +730,15 @@ discard block |
||
730 | 730 | |
731 | 731 | |
732 | 732 | //Select distinct categories |
733 | - public static function category_select_distinct () |
|
733 | + public static function category_select_distinct() |
|
734 | 734 | { |
735 | 735 | $const_dbpath = costant::database_path(); |
736 | 736 | $db = new PDO("sqlite:${const_dbpath}"); |
737 | 737 | |
738 | 738 | $results = $db -> query("SELECT DISTINCT CategoryName FROM Category_List ORDER BY CategoryName COLLATE nocase;"); |
739 | 739 | $resultarray = array(); |
740 | - if($results !== false) |
|
741 | - {$resultarray = $results->fetchall(PDO::FETCH_COLUMN, 0);} |
|
740 | + if ($results !== false) |
|
741 | + {$resultarray = $results->fetchall(PDO::FETCH_COLUMN, 0); } |
|
742 | 742 | |
743 | 743 | $db = null; |
744 | 744 | return $resultarray; |
@@ -746,17 +746,17 @@ discard block |
||
746 | 746 | |
747 | 747 | |
748 | 748 | //Select all subcategory |
749 | - public static function subactegory_select_all ($Category) |
|
749 | + public static function subactegory_select_all($Category) |
|
750 | 750 | { |
751 | 751 | $const_dbpath = costant::database_path(); |
752 | 752 | $db = new PDO("sqlite:${const_dbpath}"); |
753 | 753 | |
754 | 754 | $statement = $db-> prepare("SELECT SubCategoryName FROM Category_List WHERE CategoryName = :CategName; COLLATE nocase "); |
755 | - $statement->bindParam(":CategName",$Category); |
|
756 | - $statement-> execute (); |
|
755 | + $statement->bindParam(":CategName", $Category); |
|
756 | + $statement-> execute(); |
|
757 | 757 | $resultarray = array(); |
758 | - if($statement !== false) |
|
759 | - {$resultarray = $statement->fetchall(PDO::FETCH_ASSOC);} |
|
758 | + if ($statement !== false) |
|
759 | + {$resultarray = $statement->fetchall(PDO::FETCH_ASSOC); } |
|
760 | 760 | |
761 | 761 | $db = null; |
762 | 762 | return $resultarray; |
@@ -764,9 +764,9 @@ discard block |
||
764 | 764 | |
765 | 765 | |
766 | 766 | // Insert all categories |
767 | - public static function category_insert_json ($CategoryJSON) |
|
767 | + public static function category_insert_json($CategoryJSON) |
|
768 | 768 | { |
769 | - $categories_json_list = json_decode ($CategoryJSON,true); |
|
769 | + $categories_json_list = json_decode($CategoryJSON, true); |
|
770 | 770 | $CategoryList = $categories_json_list["Categories"]; |
771 | 771 | $const_dbpath = costant::database_path(); |
772 | 772 | |
@@ -779,9 +779,9 @@ discard block |
||
779 | 779 | { |
780 | 780 | if ($CategoryList[$i]["CategoryName"] != "") |
781 | 781 | { |
782 | - $statement->bindParam(":CategoryName",$CategoryList[$i]["CategoryName"]); |
|
783 | - $statement->bindParam(":SubCategoryName",$CategoryList[$i]["SubCategoryName"]); |
|
784 | - $statement->execute (); |
|
782 | + $statement->bindParam(":CategoryName", $CategoryList[$i]["CategoryName"]); |
|
783 | + $statement->bindParam(":SubCategoryName", $CategoryList[$i]["SubCategoryName"]); |
|
784 | + $statement->execute(); |
|
785 | 785 | } |
786 | 786 | } |
787 | 787 | |
@@ -791,16 +791,16 @@ discard block |
||
791 | 791 | |
792 | 792 | |
793 | 793 | // Insert one category |
794 | - public static function category_insert_single ($Category,$SubCategory) |
|
794 | + public static function category_insert_single($Category, $SubCategory) |
|
795 | 795 | { |
796 | 796 | $const_dbpath = costant::database_path(); |
797 | 797 | $db = new PDO("sqlite:${const_dbpath}"); |
798 | 798 | |
799 | 799 | $statement = $db -> prepare("INSERT or IGNORE INTO Category_List (CategoryName, SubCAtegoryName) |
800 | 800 | VALUES (:CategoryName, :SubCategoryName);"); |
801 | - $statement->bindParam(":CategoryName",$Category); |
|
802 | - $statement->bindParam(":SubCategoryName",$SubCategory); |
|
803 | - $statement-> execute (); |
|
801 | + $statement->bindParam(":CategoryName", $Category); |
|
802 | + $statement->bindParam(":SubCategoryName", $SubCategory); |
|
803 | + $statement-> execute(); |
|
804 | 804 | |
805 | 805 | $db = null; |
806 | 806 | } |
@@ -813,24 +813,24 @@ discard block |
||
813 | 813 | ######################### |
814 | 814 | class security |
815 | 815 | { |
816 | - public static function redirect_if_not_loggedin () |
|
816 | + public static function redirect_if_not_loggedin() |
|
817 | 817 | { |
818 | 818 | $disable_authentication = costant::disable_authentication(); |
819 | 819 | if (($disable_authentication) == False) |
820 | 820 | { |
821 | - if(isset($_SESSION["login_string"],$_SESSION["username"])) |
|
821 | + if (isset($_SESSION["login_string"], $_SESSION["username"])) |
|
822 | 822 | { |
823 | 823 | $password = costant::login_password(); |
824 | 824 | $login_string = $_SESSION["login_string"]; |
825 | 825 | $username = $_SESSION["username"]; |
826 | 826 | $user_browser = $_SERVER["HTTP_USER_AGENT"]; |
827 | 827 | |
828 | - $login_check = hash('sha512', $password . $user_browser); |
|
828 | + $login_check = hash('sha512', $password.$user_browser); |
|
829 | 829 | if ($login_check !== $login_string) |
830 | - {header("Location: index.php");} |
|
830 | + {header("Location: index.php"); } |
|
831 | 831 | } |
832 | 832 | else |
833 | - {header("Location: index.php");} |
|
833 | + {header("Location: index.php"); } |
|
834 | 834 | } |
835 | 835 | } |
836 | 836 | |
@@ -838,19 +838,19 @@ discard block |
||
838 | 838 | public static function generate_guid() |
839 | 839 | { |
840 | 840 | if (function_exists('com_create_guid')) |
841 | - {return com_create_guid();} |
|
841 | + {return com_create_guid(); } |
|
842 | 842 | else |
843 | 843 | { |
844 | - mt_srand((double)microtime()*10000); |
|
844 | + mt_srand((double)microtime() * 10000); |
|
845 | 845 | $charid = strtoupper(md5(uniqid(rand(), true))); |
846 | - $hyphen = chr(45);// "-" |
|
846 | + $hyphen = chr(45); // "-" |
|
847 | 847 | $uuid = chr(123)// "{" |
848 | 848 | .substr($charid, 0, 8).$hyphen |
849 | 849 | .substr($charid, 8, 4).$hyphen |
850 | - .substr($charid,12, 4).$hyphen |
|
851 | - .substr($charid,16, 4).$hyphen |
|
852 | - .substr($charid,20,12) |
|
853 | - .chr(125);// "}" |
|
850 | + .substr($charid, 12, 4).$hyphen |
|
851 | + .substr($charid, 16, 4).$hyphen |
|
852 | + .substr($charid, 20, 12) |
|
853 | + .chr(125); // "}" |
|
854 | 854 | return $uuid; |
855 | 855 | } |
856 | 856 | } |
@@ -861,7 +861,7 @@ discard block |
||
861 | 861 | ######################### |
862 | 862 | class db_upgrade |
863 | 863 | { |
864 | - public static function upgrade_db () |
|
864 | + public static function upgrade_db() |
|
865 | 865 | { |
866 | 866 | $start_db_version = db_function::db_version(); |
867 | 867 | $app_version = costant::app_version(); |
@@ -908,31 +908,30 @@ discard block |
||
908 | 908 | case $app_version; |
909 | 909 | break; |
910 | 910 | default: |
911 | - various::send_alert_and_redirect("Database version not compliant: DB Version = ".db_function::db_version()." - APP Version = ${app_version}","error.php"); |
|
911 | + various::send_alert_and_redirect("Database version not compliant: DB Version = ".db_function::db_version()." - APP Version = ${app_version}", "error.php"); |
|
912 | 912 | break 2; |
913 | 913 | } |
914 | 914 | } |
915 | 915 | if ($start_db_version !== $app_version && db_function::db_version() == $app_version) |
916 | - {return "update_done";} |
|
916 | + {return "update_done"; } |
|
917 | 917 | else |
918 | - {return "update_not_need";} |
|
918 | + {return "update_not_need"; } |
|
919 | 919 | } |
920 | 920 | |
921 | 921 | |
922 | - public static function to_0_9_3 () |
|
922 | + public static function to_0_9_3() |
|
923 | 923 | { |
924 | 924 | $const_dbpath = costant::database_path(); |
925 | 925 | $db = new PDO("sqlite:${const_dbpath}"); |
926 | 926 | |
927 | - $db->exec ("ALTER TABLE New_Transaction RENAME TO New_Transaction_Old"); |
|
927 | + $db->exec("ALTER TABLE New_Transaction RENAME TO New_Transaction_Old"); |
|
928 | 928 | db_function::db_create(); |
929 | - $db->exec ("INSERT INTO New_Transaction (Date, Status, Type, Account, ToAccount, Payee, Amount, Notes) SELECT Date, Status, Type, Account, ToAccount, 'Keine Auswahl', Amount, Notes FROM New_Transaction_Old"); |
|
930 | - $db->exec ("DROP TABLE New_Transaction_Old"); |
|
931 | - $db->exec ("UPDATE Parameters SET Value = '0.9.3' WHERE Parameter = 'Version';"); |
|
929 | + $db->exec("INSERT INTO New_Transaction (Date, Status, Type, Account, ToAccount, Payee, Amount, Notes) SELECT Date, Status, Type, Account, ToAccount, 'Keine Auswahl', Amount, Notes FROM New_Transaction_Old"); |
|
930 | + $db->exec("DROP TABLE New_Transaction_Old"); |
|
931 | + $db->exec("UPDATE Parameters SET Value = '0.9.3' WHERE Parameter = 'Version';"); |
|
932 | 932 | $db = null; |
933 | 933 | |
934 | - $parameterarray = array |
|
935 | - ( |
|
934 | + $parameterarray = array( |
|
936 | 935 | "disable_authentication"=> costant::disable_authentication() ? 'True' : 'False', |
937 | 936 | "user_username" => costant::login_username(), |
938 | 937 | "user_password" => costant::login_password(), |
@@ -944,25 +943,24 @@ discard block |
||
944 | 943 | } |
945 | 944 | |
946 | 945 | |
947 | - public static function to_0_9_7 () |
|
946 | + public static function to_0_9_7() |
|
948 | 947 | { |
949 | 948 | $const_dbpath = costant::database_path(); |
950 | 949 | $db = new PDO("sqlite:${const_dbpath}"); |
951 | 950 | |
952 | - $db->exec ("ALTER TABLE New_Transaction RENAME TO New_Transaction_Old"); |
|
951 | + $db->exec("ALTER TABLE New_Transaction RENAME TO New_Transaction_Old"); |
|
953 | 952 | db_function::db_create(); |
954 | - $db->exec ("INSERT INTO New_Transaction (Date, Status, Type, Account, ToAccount, Payee, Category, SubCategory, Amount, Notes) |
|
953 | + $db->exec("INSERT INTO New_Transaction (Date, Status, Type, Account, ToAccount, Payee, Category, SubCategory, Amount, Notes) |
|
955 | 954 | SELECT Date, Status, Type, Account, ToAccount, Payee, 'Keine Auswahl', 'Keine Auswahl', Amount, Notes FROM New_Transaction_Old"); |
956 | - $db->exec ("DROP TABLE New_Transaction_Old"); |
|
957 | - $db->exec ("UPDATE Parameters SET Value = '0.9.7' WHERE Parameter = 'Version';"); |
|
955 | + $db->exec("DROP TABLE New_Transaction_Old"); |
|
956 | + $db->exec("UPDATE Parameters SET Value = '0.9.7' WHERE Parameter = 'Version';"); |
|
958 | 957 | $db = null; |
959 | 958 | } |
960 | 959 | |
961 | 960 | |
962 | - public static function to_0_9_9 () |
|
961 | + public static function to_0_9_9() |
|
963 | 962 | { |
964 | - $parameterarray = array |
|
965 | - ( |
|
963 | + $parameterarray = array( |
|
966 | 964 | "disable_authentication"=> costant::disable_authentication() ? "True" : "False", |
967 | 965 | "user_username" => costant::login_username(), |
968 | 966 | "user_password" => costant::login_password(), |
@@ -974,21 +972,21 @@ discard block |
||
974 | 972 | various::update_configuration_file($parameterarray); |
975 | 973 | $const_dbpath = costant::database_path(); |
976 | 974 | $db = new PDO("sqlite:${const_dbpath}"); |
977 | - $db->exec ("ALTER TABLE Payee_List ADD DefCateg TEXT"); |
|
978 | - $db->exec ("ALTER TABLE Payee_List ADD DefSubCateg TEXT"); |
|
979 | - $db->exec ("UPDATE Payee_List SET DefCateg = 'Keine Auswahl', DefSubCateg = 'Keine Auswahl'"); |
|
980 | - $db->exec ("UPDATE New_Transaction SET Category = 'Keine Auswahl', SubCategory = 'Keine Auswahl'"); |
|
981 | - $db->exec ("UPDATE Parameters SET Value = '0.9.9' WHERE Parameter = 'Version';"); |
|
975 | + $db->exec("ALTER TABLE Payee_List ADD DefCateg TEXT"); |
|
976 | + $db->exec("ALTER TABLE Payee_List ADD DefSubCateg TEXT"); |
|
977 | + $db->exec("UPDATE Payee_List SET DefCateg = 'Keine Auswahl', DefSubCateg = 'Keine Auswahl'"); |
|
978 | + $db->exec("UPDATE New_Transaction SET Category = 'Keine Auswahl', SubCategory = 'Keine Auswahl'"); |
|
979 | + $db->exec("UPDATE Parameters SET Value = '0.9.9' WHERE Parameter = 'Version';"); |
|
982 | 980 | $db = null; |
983 | 981 | } |
984 | 982 | |
985 | 983 | |
986 | - public static function upgrade_version ($version) |
|
984 | + public static function upgrade_version($version) |
|
987 | 985 | { |
988 | 986 | $const_dbpath = costant::database_path(); |
989 | 987 | $db = new PDO("sqlite:${const_dbpath}"); |
990 | 988 | |
991 | - $db->exec ("UPDATE Parameters SET Value = '${version}' WHERE Parameter = 'Version';"); |
|
989 | + $db->exec("UPDATE Parameters SET Value = '${version}' WHERE Parameter = 'Version';"); |
|
992 | 990 | $db = null; |
993 | 991 | } |
994 | 992 | } |
@@ -1000,21 +998,21 @@ discard block |
||
1000 | 998 | ########################## |
1001 | 999 | class various |
1002 | 1000 | { |
1003 | - public static function send_alert_and_redirect ($AlertMessage, $AlertRedirect) |
|
1001 | + public static function send_alert_and_redirect($AlertMessage, $AlertRedirect) |
|
1004 | 1002 | { |
1005 | 1003 | echo "<script src='res/app/functions-1.0.4.js' type='text/javascript'></script>"; |
1006 | 1004 | echo "<script language='javascript'>"; |
1007 | 1005 | if ($AlertRedirect <> "Keine Auswahl") |
1008 | - {echo "send_alert_and_redirect ('${AlertMessage}','${AlertRedirect}')";} |
|
1006 | + {echo "send_alert_and_redirect ('${AlertMessage}','${AlertRedirect}')"; } |
|
1009 | 1007 | echo "</script>"; |
1010 | 1008 | } |
1011 | 1009 | |
1012 | - public static function update_configuration_file ($ParameterArray) |
|
1010 | + public static function update_configuration_file($ParameterArray) |
|
1013 | 1011 | { |
1014 | - $configfile="configuration_user.php"; |
|
1012 | + $configfile = "configuration_user.php"; |
|
1015 | 1013 | |
1016 | 1014 | if (file_exists($configfile)) |
1017 | - {unlink($configfile);} |
|
1015 | + {unlink($configfile); } |
|
1018 | 1016 | |
1019 | 1017 | $fileopen = fopen($configfile, 'w'); |
1020 | 1018 | fwrite($fileopen, "<?php"."\n"); |
@@ -1024,13 +1022,13 @@ discard block |
||
1024 | 1022 | fwrite($fileopen, "\n"); |
1025 | 1023 | |
1026 | 1024 | foreach ($ParameterArray as $key => $value) |
1027 | - {fwrite($fileopen, "\$${key} = \"${value}\";\n");} |
|
1025 | + {fwrite($fileopen, "\$${key} = \"${value}\";\n"); } |
|
1028 | 1026 | |
1029 | 1027 | fwrite($fileopen, "?>"); |
1030 | 1028 | fclose($fileopen); |
1031 | 1029 | } |
1032 | 1030 | |
1033 | - public static function debug_to_file ($Value) |
|
1031 | + public static function debug_to_file($Value) |
|
1034 | 1032 | { |
1035 | 1033 | ob_start(); |
1036 | 1034 | var_dump($Value); |
@@ -1051,20 +1049,19 @@ discard block |
||
1051 | 1049 | ########################## |
1052 | 1050 | class attachments |
1053 | 1051 | { |
1054 | - public static function get_attachments_filename_array($TrID,$bIncludeZero=false) |
|
1052 | + public static function get_attachments_filename_array($TrID, $bIncludeZero = false) |
|
1055 | 1053 | { |
1056 | - $i=0; |
|
1054 | + $i = 0; |
|
1057 | 1055 | $AttachmentsArray = array(); |
1058 | 1056 | |
1059 | 1057 | if ($handle = opendir(costant::attachments_folder())) |
1060 | 1058 | { |
1061 | 1059 | while (false !== ($entry = readdir($handle))) |
1062 | 1060 | { |
1063 | - if |
|
1064 | - ( |
|
1065 | - (strpos($entry,"Transaction_".$TrID) == 0 && strpos($entry,"Transaction_".$TrID) !== false) |
|
1061 | + if ( |
|
1062 | + (strpos($entry, "Transaction_".$TrID) == 0 && strpos($entry, "Transaction_".$TrID) !== false) |
|
1066 | 1063 | || |
1067 | - ($bIncludeZero && strpos($entry,"Transaction_0") == 0 && strpos($entry,"Transaction_0") !== false) |
|
1064 | + ($bIncludeZero && strpos($entry, "Transaction_0") == 0 && strpos($entry, "Transaction_0") !== false) |
|
1068 | 1065 | ) |
1069 | 1066 | { |
1070 | 1067 | $AttachmentsArray[$i] = $entry; |
@@ -1083,9 +1080,9 @@ discard block |
||
1083 | 1080 | { |
1084 | 1081 | while (false !== ($entry = readdir($handle))) |
1085 | 1082 | { |
1086 | - if (strpos($entry,"Transaction_".$TrID) == 0 && strpos($entry,"Transaction_".$TrID) !== false) |
|
1083 | + if (strpos($entry, "Transaction_".$TrID) == 0 && strpos($entry, "Transaction_".$TrID) !== false) |
|
1087 | 1084 | { |
1088 | - $AttachNumb = substr($entry,strpos($entry,"Attach")+6,strpos($entry,".")-(strpos($entry,"Attach")+6)); |
|
1085 | + $AttachNumb = substr($entry, strpos($entry, "Attach")+6, strpos($entry, ".")-(strpos($entry, "Attach")+6)); |
|
1089 | 1086 | if ($AttachNumb > $LastAttachNum) |
1090 | 1087 | $LastAttachNum = $AttachNumb; |
1091 | 1088 | } |
@@ -1101,7 +1098,7 @@ discard block |
||
1101 | 1098 | { |
1102 | 1099 | while (false !== ($entry = readdir($handle))) |
1103 | 1100 | { |
1104 | - if (strpos($entry,"Transaction_0") == 0 && strpos($entry,"Transaction_0") !== false) |
|
1101 | + if (strpos($entry, "Transaction_0") == 0 && strpos($entry, "Transaction_0") !== false) |
|
1105 | 1102 | { |
1106 | 1103 | unlink(costant::attachments_folder()."/".$entry); |
1107 | 1104 | } |
@@ -1117,10 +1114,10 @@ discard block |
||
1117 | 1114 | { |
1118 | 1115 | while (false !== ($entry = readdir($handle))) |
1119 | 1116 | { |
1120 | - if (strpos($entry,"Transaction_0") == 0 && strpos($entry,"Transaction_0") !== false) |
|
1117 | + if (strpos($entry, "Transaction_0") == 0 && strpos($entry, "Transaction_0") !== false) |
|
1121 | 1118 | { |
1122 | - $NewFileName = str_replace("Transaction_0","Transaction_".$TrID,$entry); |
|
1123 | - rename(costant::attachments_folder()."/".$entry,costant::attachments_folder()."/".$NewFileName); |
|
1119 | + $NewFileName = str_replace("Transaction_0", "Transaction_".$TrID, $entry); |
|
1120 | + rename(costant::attachments_folder()."/".$entry, costant::attachments_folder()."/".$NewFileName); |
|
1124 | 1121 | } |
1125 | 1122 | } |
1126 | 1123 | closedir($handle); |
@@ -1135,10 +1132,10 @@ discard block |
||
1135 | 1132 | { |
1136 | 1133 | while (false !== ($entry = readdir($handle))) |
1137 | 1134 | { |
1138 | - for($i=0; $i < $N; $i++) |
|
1135 | + for ($i = 0; $i < $N; $i++) |
|
1139 | 1136 | { |
1140 | 1137 | $TrID = $TrID_Array[$i]; |
1141 | - if (strpos($entry,"Transaction_".$TrID) == 0 && strpos($entry,"Transaction_".$TrID) !== false) |
|
1138 | + if (strpos($entry, "Transaction_".$TrID) == 0 && strpos($entry, "Transaction_".$TrID) !== false) |
|
1142 | 1139 | { |
1143 | 1140 | unlink(costant::attachments_folder()."/".$entry); |
1144 | 1141 | } |
@@ -1163,101 +1160,101 @@ discard block |
||
1163 | 1160 | ########################## |
1164 | 1161 | class costant |
1165 | 1162 | { |
1166 | - public static function login_username () |
|
1163 | + public static function login_username() |
|
1167 | 1164 | { |
1168 | 1165 | global $user_username; |
1169 | 1166 | return $user_username; |
1170 | 1167 | } |
1171 | 1168 | |
1172 | - public static function login_password () |
|
1169 | + public static function login_password() |
|
1173 | 1170 | { |
1174 | 1171 | global $user_password; |
1175 | 1172 | return $user_password; |
1176 | 1173 | } |
1177 | 1174 | |
1178 | - public static function transaction_default_account () |
|
1175 | + public static function transaction_default_account() |
|
1179 | 1176 | { |
1180 | 1177 | global $defaultaccountname; |
1181 | 1178 | return $defaultaccountname; |
1182 | 1179 | } |
1183 | 1180 | |
1184 | - public static function transaction_default_status () |
|
1181 | + public static function transaction_default_status() |
|
1185 | 1182 | { |
1186 | 1183 | global $tr_default_status; |
1187 | 1184 | return $tr_default_status; |
1188 | 1185 | } |
1189 | 1186 | |
1190 | - public static function transaction_default_type () |
|
1187 | + public static function transaction_default_type() |
|
1191 | 1188 | { |
1192 | 1189 | global $tr_default_type; |
1193 | 1190 | return $tr_default_type; |
1194 | 1191 | } |
1195 | - public static function attachments_folder () |
|
1192 | + public static function attachments_folder() |
|
1196 | 1193 | { |
1197 | 1194 | global $attachments_folder; |
1198 | 1195 | return $attachments_folder; |
1199 | 1196 | } |
1200 | - public static function database_path () |
|
1197 | + public static function database_path() |
|
1201 | 1198 | { |
1202 | 1199 | global $dbpath; |
1203 | 1200 | return $dbpath; |
1204 | 1201 | } |
1205 | 1202 | |
1206 | - public static function desktop_guid () |
|
1203 | + public static function desktop_guid() |
|
1207 | 1204 | { |
1208 | 1205 | global $desktop_guid; |
1209 | 1206 | return $desktop_guid; |
1210 | 1207 | } |
1211 | 1208 | |
1212 | - public static function app_version () |
|
1209 | + public static function app_version() |
|
1213 | 1210 | { |
1214 | 1211 | global $app_version; |
1215 | 1212 | return $app_version; |
1216 | 1213 | } |
1217 | 1214 | |
1218 | - public static function api_version () |
|
1215 | + public static function api_version() |
|
1219 | 1216 | { |
1220 | 1217 | global $api_version; |
1221 | 1218 | return $api_version; |
1222 | 1219 | } |
1223 | 1220 | |
1224 | - public static function disable_authentication () |
|
1221 | + public static function disable_authentication() |
|
1225 | 1222 | { |
1226 | 1223 | global $disable_authentication; |
1227 | 1224 | if ($disable_authentication == "True") |
1228 | - {return True;} |
|
1225 | + {return True; } |
|
1229 | 1226 | else |
1230 | - {return False;} |
|
1227 | + {return False; } |
|
1231 | 1228 | } |
1232 | 1229 | |
1233 | - public static function disable_payee () |
|
1230 | + public static function disable_payee() |
|
1234 | 1231 | { |
1235 | 1232 | global $disable_payee; |
1236 | 1233 | if ($disable_payee == "True") |
1237 | - {return True;} |
|
1234 | + {return True; } |
|
1238 | 1235 | else |
1239 | - {return False;} |
|
1236 | + {return False; } |
|
1240 | 1237 | } |
1241 | 1238 | |
1242 | - public static function disable_category () |
|
1239 | + public static function disable_category() |
|
1243 | 1240 | { |
1244 | 1241 | global $disable_category; |
1245 | 1242 | if ($disable_category == "True") |
1246 | - {return True;} |
|
1243 | + {return True; } |
|
1247 | 1244 | else |
1248 | - {return False;} |
|
1245 | + {return False; } |
|
1249 | 1246 | } |
1250 | 1247 | |
1251 | - public static function current_page_url () |
|
1248 | + public static function current_page_url() |
|
1252 | 1249 | { |
1253 | 1250 | $pageURL = 'http'; |
1254 | 1251 | if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") |
1255 | 1252 | $pageURL .= "s"; |
1256 | 1253 | $pageURL .= "://"; |
1257 | 1254 | if ($_SERVER["SERVER_PORT"] != "80" && $_SERVER["SERVER_PORT"] != "443") |
1258 | - {$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];} |
|
1255 | + {$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"]; } |
|
1259 | 1256 | else |
1260 | - {$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];} |
|
1257 | + {$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; } |
|
1261 | 1258 | return $pageURL; |
1262 | 1259 | } |
1263 | 1260 | } |
@@ -33,8 +33,7 @@ discard block |
||
33 | 33 | for ($i = 0; $i < sizeof($StatusArrayDesc); $i++) |
34 | 34 | { |
35 | 35 | if ($StatusArrayDB[$i] == $TrStatusDefault) |
36 | - {echo "<option value = '${StatusArrayDB[$i]}' selected> ${StatusArrayDesc[$i]} </option>";} |
|
37 | - else |
|
36 | + {echo "<option value = '${StatusArrayDB[$i]}' selected> ${StatusArrayDesc[$i]} </option>";} else |
|
38 | 37 | {echo "<option value = '${StatusArrayDB[$i]}'> ${StatusArrayDesc[$i]} </option>";} |
39 | 38 | } |
40 | 39 | echo "</select>"; |
@@ -54,8 +53,7 @@ discard block |
||
54 | 53 | for ($i = 0; $i < sizeof($TypeArrayDesc); $i++) |
55 | 54 | { |
56 | 55 | if ($TypeArrayDesc[$i] == $TrTypeDefault) |
57 | - {echo "<option value='${TypeArrayDesc[$i]}' selected> ${TypeArrayDesc[$i]} </option>";} |
|
58 | - else |
|
56 | + {echo "<option value='${TypeArrayDesc[$i]}' selected> ${TypeArrayDesc[$i]} </option>";} else |
|
59 | 57 | {echo "<option value='${TypeArrayDesc[$i]}'> ${TypeArrayDesc[$i]} </option>";} |
60 | 58 | } |
61 | 59 | echo "</select>"; |
@@ -77,8 +75,7 @@ discard block |
||
77 | 75 | for ($i = 0; $i < sizeof($AccountArrayDesc); $i++) |
78 | 76 | { |
79 | 77 | if ($AccountArrayDesc[$i] == $TrAccountDefault) |
80 | - {echo "<option value=\"${AccountArrayDesc[$i]}\" selected> ${AccountArrayDesc[$i]} </option>";} |
|
81 | - else |
|
78 | + {echo "<option value=\"${AccountArrayDesc[$i]}\" selected> ${AccountArrayDesc[$i]} </option>";} else |
|
82 | 79 | {echo "<option value=\"${AccountArrayDesc[$i]}\"> ${AccountArrayDesc[$i]} </option>";} |
83 | 80 | } |
84 | 81 | echo "</select>"; |
@@ -99,8 +96,7 @@ discard block |
||
99 | 96 | for ($i = 0; $i < sizeof($ToAccountArrayDesc); $i++) |
100 | 97 | { |
101 | 98 | if ($ToAccountArrayDesc[$i] == $TrToAccountDefault) |
102 | - {echo "<option value=\"${ToAccountArrayDesc[$i]}\" selected> ${ToAccountArrayDesc[$i]} </option>";} |
|
103 | - else |
|
99 | + {echo "<option value=\"${ToAccountArrayDesc[$i]}\" selected> ${ToAccountArrayDesc[$i]} </option>";} else |
|
104 | 100 | {echo "<option value=\"${ToAccountArrayDesc[$i]}\"> ${ToAccountArrayDesc[$i]} </option>";} |
105 | 101 | } |
106 | 102 | echo "</select>"; |
@@ -175,8 +171,7 @@ discard block |
||
175 | 171 | if ($TrAmountDefault <> 0) |
176 | 172 | { |
177 | 173 | echo "<input id='Amount' type='number' name='Amount' class='form-control' placeholder='New transaction amount' min='0.01' step ='0.01' value='${TrAmountDefault}' required />"; |
178 | - } |
|
179 | - else |
|
174 | + } else |
|
180 | 175 | { |
181 | 176 | echo "<input id='Amount' type='number' name='Amount' class='form-control' placeholder='New transaction amount' min='0.01' step ='0.01' required />"; |
182 | 177 | } |
@@ -194,8 +189,7 @@ discard block |
||
194 | 189 | if ($TrNotesDefault <> "Empty") |
195 | 190 | { |
196 | 191 | echo "<textarea id='Notes' name='Notes' class='form-control' rows='5' placeholder='New transaction notes'>${TrNotesDefault}</textarea>"; |
197 | - } |
|
198 | - else |
|
192 | + } else |
|
199 | 193 | { |
200 | 194 | echo "<textarea id='Notes' name='Notes' class='form-control' rows='5' placeholder='New transaction notes'></textarea>"; |
201 | 195 | } |
@@ -284,8 +278,7 @@ discard block |
||
284 | 278 | for ($i = 0; $i < sizeof($AccountArrayDesc); $i++) |
285 | 279 | { |
286 | 280 | if ($AccountArrayDesc[$i] == $TrAccountDefault) |
287 | - {echo "<option selected> ${AccountArrayDesc[$i]} </option>";} |
|
288 | - else |
|
281 | + {echo "<option selected> ${AccountArrayDesc[$i]} </option>";} else |
|
289 | 282 | {echo "<option> ${AccountArrayDesc[$i]} </option>";} |
290 | 283 | } |
291 | 284 | echo "</select>"; |
@@ -362,8 +355,7 @@ discard block |
||
362 | 355 | );"); |
363 | 356 | $db -> exec ("INSERT or IGNORE INTO Parameters VALUES ('Version','${const_app_version}');"); |
364 | 357 | $db = null; |
365 | - } |
|
366 | - catch(PDOException $e) |
|
358 | + } catch(PDOException $e) |
|
367 | 359 | {$error = $e->getMessage();} |
368 | 360 | |
369 | 361 | return $error; |
@@ -828,8 +820,7 @@ discard block |
||
828 | 820 | $login_check = hash('sha512', $password . $user_browser); |
829 | 821 | if ($login_check !== $login_string) |
830 | 822 | {header("Location: index.php");} |
831 | - } |
|
832 | - else |
|
823 | + } else |
|
833 | 824 | {header("Location: index.php");} |
834 | 825 | } |
835 | 826 | } |
@@ -838,8 +829,7 @@ discard block |
||
838 | 829 | public static function generate_guid() |
839 | 830 | { |
840 | 831 | if (function_exists('com_create_guid')) |
841 | - {return com_create_guid();} |
|
842 | - else |
|
832 | + {return com_create_guid();} else |
|
843 | 833 | { |
844 | 834 | mt_srand((double)microtime()*10000); |
845 | 835 | $charid = strtoupper(md5(uniqid(rand(), true))); |
@@ -913,8 +903,7 @@ discard block |
||
913 | 903 | } |
914 | 904 | } |
915 | 905 | if ($start_db_version !== $app_version && db_function::db_version() == $app_version) |
916 | - {return "update_done";} |
|
917 | - else |
|
906 | + {return "update_done";} else |
|
918 | 907 | {return "update_not_need";} |
919 | 908 | } |
920 | 909 | |
@@ -1086,8 +1075,9 @@ discard block |
||
1086 | 1075 | if (strpos($entry,"Transaction_".$TrID) == 0 && strpos($entry,"Transaction_".$TrID) !== false) |
1087 | 1076 | { |
1088 | 1077 | $AttachNumb = substr($entry,strpos($entry,"Attach")+6,strpos($entry,".")-(strpos($entry,"Attach")+6)); |
1089 | - if ($AttachNumb > $LastAttachNum) |
|
1090 | - $LastAttachNum = $AttachNumb; |
|
1078 | + if ($AttachNumb > $LastAttachNum) { |
|
1079 | + $LastAttachNum = $AttachNumb; |
|
1080 | + } |
|
1091 | 1081 | } |
1092 | 1082 | } |
1093 | 1083 | closedir($handle); |
@@ -1151,8 +1141,9 @@ discard block |
||
1151 | 1141 | public static function delete_attachment_by_name($FileName) |
1152 | 1142 | { |
1153 | 1143 | $FullPath = costant::attachments_folder()."/".$FileName; |
1154 | - if (!empty($FileName) && file_exists($FullPath)) |
|
1155 | - unlink($FullPath); |
|
1144 | + if (!empty($FileName) && file_exists($FullPath)) { |
|
1145 | + unlink($FullPath); |
|
1146 | + } |
|
1156 | 1147 | } |
1157 | 1148 | } |
1158 | 1149 | |
@@ -1225,8 +1216,7 @@ discard block |
||
1225 | 1216 | { |
1226 | 1217 | global $disable_authentication; |
1227 | 1218 | if ($disable_authentication == "True") |
1228 | - {return True;} |
|
1229 | - else |
|
1219 | + {return True;} else |
|
1230 | 1220 | {return False;} |
1231 | 1221 | } |
1232 | 1222 | |
@@ -1234,8 +1224,7 @@ discard block |
||
1234 | 1224 | { |
1235 | 1225 | global $disable_payee; |
1236 | 1226 | if ($disable_payee == "True") |
1237 | - {return True;} |
|
1238 | - else |
|
1227 | + {return True;} else |
|
1239 | 1228 | {return False;} |
1240 | 1229 | } |
1241 | 1230 | |
@@ -1243,20 +1232,19 @@ discard block |
||
1243 | 1232 | { |
1244 | 1233 | global $disable_category; |
1245 | 1234 | if ($disable_category == "True") |
1246 | - {return True;} |
|
1247 | - else |
|
1235 | + {return True;} else |
|
1248 | 1236 | {return False;} |
1249 | 1237 | } |
1250 | 1238 | |
1251 | 1239 | public static function current_page_url () |
1252 | 1240 | { |
1253 | 1241 | $pageURL = 'http'; |
1254 | - if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") |
|
1255 | - $pageURL .= "s"; |
|
1242 | + if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") { |
|
1243 | + $pageURL .= "s"; |
|
1244 | + } |
|
1256 | 1245 | $pageURL .= "://"; |
1257 | 1246 | if ($_SERVER["SERVER_PORT"] != "80" && $_SERVER["SERVER_PORT"] != "443") |
1258 | - {$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];} |
|
1259 | - else |
|
1247 | + {$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];} else |
|
1260 | 1248 | {$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];} |
1261 | 1249 | return $pageURL; |
1262 | 1250 | } |
@@ -5,33 +5,33 @@ |
||
5 | 5 | |
6 | 6 | |
7 | 7 | # Delete & Modify |
8 | -if(isset($_POST["TrModify"])) |
|
8 | +if (isset($_POST["TrModify"])) |
|
9 | 9 | { |
10 | 10 | $TrModify = $_POST["TrModify"]; |
11 | 11 | |
12 | - if(isset($_POST["TrDelete"]) && $TrModify == "Delete") |
|
12 | + if (isset($_POST["TrDelete"]) && $TrModify == "Delete") |
|
13 | 13 | { |
14 | 14 | $TrDeleteArr = $_POST["TrDelete"]; |
15 | - db_function::transaction_delete_group ($TrDeleteArr); |
|
15 | + db_function::transaction_delete_group($TrDeleteArr); |
|
16 | 16 | attachments::delete_group($TrDeleteArr); |
17 | 17 | |
18 | 18 | header("Location: show.php"); |
19 | 19 | } |
20 | 20 | |
21 | - if(!isset($_POST["TrDelete"]) && $TrModify == "Delete") |
|
21 | + if (!isset($_POST["TrDelete"]) && $TrModify == "Delete") |
|
22 | 22 | { |
23 | - $test = various::send_alert_and_redirect("No transaction selected!","show.php"); |
|
23 | + $test = various::send_alert_and_redirect("No transaction selected!", "show.php"); |
|
24 | 24 | } |
25 | 25 | |
26 | - if(isset($_POST["TrEdit"]) && $TrModify == "Edit") |
|
26 | + if (isset($_POST["TrEdit"]) && $TrModify == "Edit") |
|
27 | 27 | { |
28 | 28 | $TrEdit = $_POST["TrEdit"]; |
29 | 29 | |
30 | 30 | header("Location: new_transaction.php?TrEditNr=${TrEdit[0]}"); |
31 | 31 | } |
32 | 32 | |
33 | - if(!isset($_POST["TrEdit"]) && $TrModify == "Edit") |
|
33 | + if (!isset($_POST["TrEdit"]) && $TrModify == "Edit") |
|
34 | 34 | { |
35 | - $test = various::send_alert_and_redirect("No transaction selected!","show.php"); |
|
35 | + $test = various::send_alert_and_redirect("No transaction selected!", "show.php"); |
|
36 | 36 | } |
37 | 37 | } |
38 | 38 | \ No newline at end of file |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | $FlagNew = True; |
49 | 49 | } |
50 | 50 | |
51 | - if($FlagNew) |
|
51 | + if ($FlagNew) |
|
52 | 52 | { |
53 | 53 | $resultarray = array(); |
54 | 54 | $TransactionHeaderText = "Insert new transcation"; |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | } |
101 | 101 | else |
102 | 102 | { |
103 | - design::input_hidden("Payee","Keine Auswahl"); |
|
103 | + design::input_hidden("Payee", "Keine Auswahl"); |
|
104 | 104 | } |
105 | 105 | if (costant::disable_category() !== True) |
106 | 106 | { |
@@ -109,8 +109,8 @@ discard block |
||
109 | 109 | } |
110 | 110 | else |
111 | 111 | { |
112 | - design::input_hidden("Category","Keine Auswahl"); |
|
113 | - design::input_hidden("SubCategory","Keine Auswahl"); |
|
112 | + design::input_hidden("Category", "Keine Auswahl"); |
|
113 | + design::input_hidden("SubCategory", "Keine Auswahl"); |
|
114 | 114 | } |
115 | 115 | design::input_amount($TransactionAmount); |
116 | 116 | design::input_notes($TransactionNotes); |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | } |
135 | 135 | else |
136 | 136 | { |
137 | - design::input_hidden("TrEditedNr",$TrEditNr); |
|
137 | + design::input_hidden("TrEditedNr", $TrEditNr); |
|
138 | 138 | echo "<script type='text/javascript'>"; |
139 | 139 | echo "populate_sub_category(false);"; |
140 | 140 | echo "</script>"; |
@@ -41,8 +41,7 @@ discard block |
||
41 | 41 | { |
42 | 42 | $TrEditNr = $_GET["TrEditNr"]; |
43 | 43 | $FlagNew = False; |
44 | - } |
|
45 | - else |
|
44 | + } else |
|
46 | 45 | { |
47 | 46 | $TrEditNr = 0; |
48 | 47 | $FlagNew = True; |
@@ -63,8 +62,7 @@ discard block |
||
63 | 62 | $TransactionAmount = "0"; |
64 | 63 | $TransactionNotes = "Empty"; |
65 | 64 | $TransactionSubmit = "Insert transaction"; |
66 | - } |
|
67 | - else |
|
65 | + } else |
|
68 | 66 | { |
69 | 67 | $resultarray = db_function::transaction_select_one($TrEditNr); |
70 | 68 | $TransactionHeaderText = "Edit transcation"; |
@@ -97,8 +95,7 @@ discard block |
||
97 | 95 | if (costant::disable_payee() !== True) |
98 | 96 | { |
99 | 97 | design::input_payee($TransactionPayee); |
100 | - } |
|
101 | - else |
|
98 | + } else |
|
102 | 99 | { |
103 | 100 | design::input_hidden("Payee","Keine Auswahl"); |
104 | 101 | } |
@@ -106,8 +103,7 @@ discard block |
||
106 | 103 | { |
107 | 104 | design::input_category($TransactionCategory); |
108 | 105 | design::input_subcategory($TransactionSubCategory); |
109 | - } |
|
110 | - else |
|
106 | + } else |
|
111 | 107 | { |
112 | 108 | design::input_hidden("Category","Keine Auswahl"); |
113 | 109 | design::input_hidden("SubCategory","Keine Auswahl"); |
@@ -131,8 +127,7 @@ discard block |
||
131 | 127 | echo "var date_today = get_today();"; |
132 | 128 | echo "document.getElementById('Date').value=date_today;"; |
133 | 129 | echo "</script>"; |
134 | - } |
|
135 | - else |
|
130 | + } else |
|
136 | 131 | { |
137 | 132 | design::input_hidden("TrEditedNr",$TrEditNr); |
138 | 133 | echo "<script type='text/javascript'>"; |
@@ -33,30 +33,30 @@ discard block |
||
33 | 33 | $TrType = $_POST["Type"]; |
34 | 34 | $TrAccount = $_POST["Account"]; |
35 | 35 | if (isset($_POST["ToAccount"])) |
36 | - {$TrToAccount = $_POST["ToAccount"];} |
|
36 | + {$TrToAccount = $_POST["ToAccount"]; } |
|
37 | 37 | else |
38 | - {$TrToAccount = "None";} |
|
38 | + {$TrToAccount = "None"; } |
|
39 | 39 | if (isset($_POST["Payee"])) |
40 | - {$TrPayee = $_POST["Payee"];} |
|
40 | + {$TrPayee = $_POST["Payee"]; } |
|
41 | 41 | else |
42 | - {$TrPayee = "None";} |
|
42 | + {$TrPayee = "None"; } |
|
43 | 43 | if (isset($_POST["Category"])) |
44 | - {$TrCategory = $_POST["Category"];} |
|
44 | + {$TrCategory = $_POST["Category"]; } |
|
45 | 45 | else |
46 | - {$TrCategory = "None";} |
|
46 | + {$TrCategory = "None"; } |
|
47 | 47 | if (isset($_POST["SubCategory"])) |
48 | - {$TrSubCategory = $_POST["SubCategory"];} |
|
48 | + {$TrSubCategory = $_POST["SubCategory"]; } |
|
49 | 49 | else |
50 | - {$TrSubCategory = "None";} |
|
50 | + {$TrSubCategory = "None"; } |
|
51 | 51 | $TrAmount = $_POST["Amount"]; |
52 | 52 | $TrNotes = $_POST["Notes"]; |
53 | 53 | |
54 | 54 | #Execute common insert |
55 | - db_function::category_insert_single($TrCategory,$TrSubCategory); |
|
56 | - db_function::payee_insert_single($TrPayee,$TrCategory,$TrSubCategory); |
|
57 | - db_function::payee_update_single($TrPayee,$TrCategory,$TrSubCategory); |
|
55 | + db_function::category_insert_single($TrCategory, $TrSubCategory); |
|
56 | + db_function::payee_insert_single($TrPayee, $TrCategory, $TrSubCategory); |
|
57 | + db_function::payee_update_single($TrPayee, $TrCategory, $TrSubCategory); |
|
58 | 58 | |
59 | - if(isset($_POST["TrEditedNr"])) |
|
59 | + if (isset($_POST["TrEditedNr"])) |
|
60 | 60 | { |
61 | 61 | $TrEditedNr = $_POST["TrEditedNr"]; |
62 | 62 | # Update |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | } |
69 | 69 | else |
70 | 70 | { |
71 | - $TrEditedNr = db_function::transaction_insert ($TrDate, $TrStatus, $TrType, $TrAccount, $TrToAccount, $TrPayee, $TrCategory, $TrSubCategory, $TrAmount, $TrNotes); |
|
71 | + $TrEditedNr = db_function::transaction_insert($TrDate, $TrStatus, $TrType, $TrAccount, $TrToAccount, $TrPayee, $TrCategory, $TrSubCategory, $TrAmount, $TrNotes); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | attachments::rename_zero($TrEditedNr); |
@@ -33,20 +33,16 @@ discard block |
||
33 | 33 | $TrType = $_POST["Type"]; |
34 | 34 | $TrAccount = $_POST["Account"]; |
35 | 35 | if (isset($_POST["ToAccount"])) |
36 | - {$TrToAccount = $_POST["ToAccount"];} |
|
37 | - else |
|
36 | + {$TrToAccount = $_POST["ToAccount"];} else |
|
38 | 37 | {$TrToAccount = "None";} |
39 | 38 | if (isset($_POST["Payee"])) |
40 | - {$TrPayee = $_POST["Payee"];} |
|
41 | - else |
|
39 | + {$TrPayee = $_POST["Payee"];} else |
|
42 | 40 | {$TrPayee = "None";} |
43 | 41 | if (isset($_POST["Category"])) |
44 | - {$TrCategory = $_POST["Category"];} |
|
45 | - else |
|
42 | + {$TrCategory = $_POST["Category"];} else |
|
46 | 43 | {$TrCategory = "None";} |
47 | 44 | if (isset($_POST["SubCategory"])) |
48 | - {$TrSubCategory = $_POST["SubCategory"];} |
|
49 | - else |
|
45 | + {$TrSubCategory = $_POST["SubCategory"];} else |
|
50 | 46 | {$TrSubCategory = "None";} |
51 | 47 | $TrAmount = $_POST["Amount"]; |
52 | 48 | $TrNotes = $_POST["Notes"]; |
@@ -65,8 +61,7 @@ discard block |
||
65 | 61 | echo "<script type='text/javascript'>"; |
66 | 62 | echo "location.href='show.php'"; |
67 | 63 | echo "</script>"; |
68 | - } |
|
69 | - else |
|
64 | + } else |
|
70 | 65 | { |
71 | 66 | $TrEditedNr = db_function::transaction_insert ($TrDate, $TrStatus, $TrType, $TrAccount, $TrToAccount, $TrPayee, $TrCategory, $TrSubCategory, $TrAmount, $TrNotes); |
72 | 67 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | $upgrade_result = db_upgrade::upgrade_db(); |
11 | 11 | if ($upgrade_result == "update_done") |
12 | 12 | { |
13 | - various::send_alert_and_redirect("Database succesfully updated to version ".costant::app_version(),"index.php"); |
|
13 | + various::send_alert_and_redirect("Database succesfully updated to version ".costant::app_version(), "index.php"); |
|
14 | 14 | } |
15 | 15 | } |
16 | 16 | $username = null; |
@@ -32,17 +32,17 @@ discard block |
||
32 | 32 | |
33 | 33 | if ($_SERVER["REQUEST_METHOD"] == "POST") |
34 | 34 | { |
35 | - if(!empty($_POST["Username"]) && !empty($_POST["Password"])) |
|
35 | + if (!empty($_POST["Username"]) && !empty($_POST["Password"])) |
|
36 | 36 | { |
37 | 37 | $username = $_POST["Username"]; |
38 | 38 | $password = hash("sha512", $_POST["Password"]); |
39 | 39 | |
40 | - if($username == $const_username && $password == $const_password) |
|
40 | + if ($username == $const_username && $password == $const_password) |
|
41 | 41 | { |
42 | 42 | session_start(); |
43 | 43 | $user_browser = $_SERVER['HTTP_USER_AGENT']; |
44 | 44 | $_SESSION["username"] = $username; |
45 | - $_SESSION["login_string"] = hash("sha512", $password . $user_browser); |
|
45 | + $_SESSION["login_string"] = hash("sha512", $password.$user_browser); |
|
46 | 46 | header("Location: landing.php"); |
47 | 47 | |
48 | 48 | } |
@@ -4,8 +4,7 @@ discard block |
||
4 | 4 | if ($error !== "ok") |
5 | 5 | { |
6 | 6 | echo $error; |
7 | - } |
|
8 | -else |
|
7 | + } else |
|
9 | 8 | { |
10 | 9 | $upgrade_result = db_upgrade::upgrade_db(); |
11 | 10 | if ($upgrade_result == "update_done") |
@@ -45,19 +44,16 @@ discard block |
||
45 | 44 | $_SESSION["login_string"] = hash("sha512", $password . $user_browser); |
46 | 45 | header("Location: landing.php"); |
47 | 46 | |
48 | - } |
|
49 | - else |
|
47 | + } else |
|
50 | 48 | { |
51 | 49 | header("Location: index.php"); |
52 | 50 | } |
53 | 51 | |
54 | - } |
|
55 | - else |
|
52 | + } else |
|
56 | 53 | { |
57 | 54 | header("Location: index.php"); |
58 | 55 | } |
59 | - } |
|
60 | -else |
|
56 | + } else |
|
61 | 57 | { |
62 | 58 | ?> |
63 | 59 |
@@ -14,27 +14,27 @@ |
||
14 | 14 | { |
15 | 15 | $TrNumber = (int)$_POST['Attachment_TrId']; |
16 | 16 | $FileName = $_FILES['UploadedAttachments']['name']; |
17 | - $FileExtension = substr($FileName,strpos($FileName,".")+1,strlen($FileName)); |
|
17 | + $FileExtension = substr($FileName, strpos($FileName, ".")+1, strlen($FileName)); |
|
18 | 18 | $NewFileName = "Transaction_".$TrNumber."_Attach".(attachments::get_number_of_attachments($TrNumber)+1).".".$FileExtension; |
19 | - move_uploaded_file ($_FILES['UploadedAttachments']['tmp_name'], "attachments/".$NewFileName); |
|
19 | + move_uploaded_file($_FILES['UploadedAttachments']['tmp_name'], "attachments/".$NewFileName); |
|
20 | 20 | echo $NewFileName; |
21 | 21 | } |
22 | 22 | |
23 | 23 | if (isset($_GET["AttachmentsTable"])) |
24 | 24 | { |
25 | 25 | $TrId = $_GET["AttachmentsTable"]; |
26 | - $Attachments = attachments::get_attachments_filename_array($TrId,true); |
|
26 | + $Attachments = attachments::get_attachments_filename_array($TrId, true); |
|
27 | 27 | echo "<table class = 'table'>"; |
28 | 28 | echo "<tbody>"; |
29 | 29 | for ($i = 0; $i < sizeof($Attachments); $i++) |
30 | 30 | { |
31 | 31 | echo "<tr>"; |
32 | 32 | $File = $Attachments[$i]; |
33 | - design::table_cell(substr($File,strpos($File,"Attach"),strlen($File)),""); |
|
33 | + design::table_cell(substr($File, strpos($File, "Attach"), strlen($File)), ""); |
|
34 | 34 | design::table_cell("<a href='services.php?guid=${Guid}&download_attachment=${File}'> |
35 | - <span class='glyphicon glyphicon-download-alt'> </span> Open</a>","text_align_right"); |
|
35 | + <span class='glyphicon glyphicon-download-alt'> </span> Open</a>", "text_align_right"); |
|
36 | 36 | design::table_cell("<a href='#' onclick='attachment_delete(\"${File}\",${TrId});return false;'> |
37 | - <span class='glyphicon glyphicon-remove'> </span> Delete</a>","text_align_right"); |
|
37 | + <span class='glyphicon glyphicon-remove'> </span> Delete</a>", "text_align_right"); |
|
38 | 38 | echo "</tr>"; |
39 | 39 | } |
40 | 40 | echo "</tbody>"; |
@@ -29,7 +29,7 @@ |
||
29 | 29 | <br /> |
30 | 30 | <h3><strong>Internal Error</strong></h3> |
31 | 31 | <?php |
32 | - echo "<h4> Version ".costant::app_version()."</h4>"; |
|
32 | + echo "<h4> Version ".costant::app_version()."</h4>"; |
|
33 | 33 | ?> |
34 | 34 | <br /> |
35 | 35 | <h4> Please contact developer Gabriele [Gabriele-V]</h4> |
@@ -33,7 +33,7 @@ |
||
33 | 33 | </p> |
34 | 34 | <?php |
35 | 35 | echo "<p>WebApp URL:</p>"; |
36 | - $CurrentPage = str_replace("/guide.php","",costant::current_page_url()); |
|
36 | + $CurrentPage = str_replace("/guide.php", "", costant::current_page_url()); |
|
37 | 37 | echo "<p><strong>".$CurrentPage."</strong></p>"; |
38 | 38 | echo "<br />"; |
39 | 39 | echo "<p>Desktop GUID:</p>"; |
@@ -10,11 +10,11 @@ discard block |
||
10 | 10 | { |
11 | 11 | #Test guid |
12 | 12 | if (isset($_GET["check_guid"])) |
13 | - {echo $operation_succeded;} |
|
13 | + {echo $operation_succeded; } |
|
14 | 14 | |
15 | 15 | #Return WebApp API Version |
16 | 16 | if (isset($_GET["check_api_version"])) |
17 | - {echo costant::api_version();} |
|
17 | + {echo costant::api_version(); } |
|
18 | 18 | |
19 | 19 | #Delete BankAccount |
20 | 20 | if (isset($_GET["delete_bankaccount"])) |
@@ -62,14 +62,14 @@ discard block |
||
62 | 62 | if (isset($_GET["download_transaction"])) |
63 | 63 | { |
64 | 64 | $TransactionsArr = db_function::transaction_select_all_order_by_date(); |
65 | - if( !empty($TransactionsArr) ) |
|
65 | + if (!empty($TransactionsArr)) |
|
66 | 66 | { |
67 | 67 | for ($i = 0; $i < sizeof($TransactionsArr); $i++) |
68 | 68 | { |
69 | 69 | $TransactionsArr[$i]['Attachments'] = |
70 | - implode(";",attachments::get_attachments_filename_array((int)$TransactionsArr[$i]['ID'])); |
|
70 | + implode(";", attachments::get_attachments_filename_array((int)$TransactionsArr[$i]['ID'])); |
|
71 | 71 | } |
72 | - echo (json_encode($TransactionsArr,JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT | JSON_FORCE_OBJECT)); |
|
72 | + echo (json_encode($TransactionsArr, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT | JSON_FORCE_OBJECT)); |
|
73 | 73 | } |
74 | 74 | } |
75 | 75 | |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | if (isset($_GET["download_attachment"])) |
78 | 78 | { |
79 | 79 | $AttachmentFileName = $_GET["download_attachment"]; |
80 | - if ( !empty ($AttachmentFileName) ) |
|
80 | + if (!empty ($AttachmentFileName)) |
|
81 | 81 | { |
82 | 82 | $FullPath = costant::attachments_folder()."/".$AttachmentFileName; |
83 | 83 | header("Content-Type:"); |
@@ -94,14 +94,14 @@ discard block |
||
94 | 94 | { |
95 | 95 | $AttachmentFileName = $_GET["delete_attachment"]; |
96 | 96 | if (!empty ($AttachmentFileName)) |
97 | - {attachments::delete_attachment_by_name($AttachmentFileName);} |
|
97 | + {attachments::delete_attachment_by_name($AttachmentFileName); } |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | #Delete transaction group |
101 | 101 | if (isset($_GET["delete_group"])) |
102 | 102 | { |
103 | 103 | $deletegroup_string = $_GET["delete_group"]; |
104 | - $deletegroup_array = explode(",",$deletegroup_string); |
|
104 | + $deletegroup_array = explode(",", $deletegroup_string); |
|
105 | 105 | db_function::transaction_delete_group($deletegroup_array); |
106 | 106 | attachments::delete_group($deletegroup_array); |
107 | 107 | echo $operation_succeded; |
@@ -106,8 +106,7 @@ |
||
106 | 106 | attachments::delete_group($deletegroup_array); |
107 | 107 | echo $operation_succeded; |
108 | 108 | } |
109 | - } |
|
110 | -else |
|
109 | + } else |
|
111 | 110 | { |
112 | 111 | echo $wrong_guid; |
113 | 112 | } |