@@ -944,6 +944,9 @@ discard block |
||
| 944 | 944 | $db = null; |
| 945 | 945 | } |
| 946 | 946 | |
| 947 | + /** |
|
| 948 | + * @param string $version |
|
| 949 | + */ |
|
| 947 | 950 | public static function upgrade_version($version) |
| 948 | 951 | { |
| 949 | 952 | $const_dbpath = costant::database_path(); |
@@ -961,6 +964,10 @@ discard block |
||
| 961 | 964 | //######################### |
| 962 | 965 | class various |
| 963 | 966 | { |
| 967 | + /** |
|
| 968 | + * @param string $AlertMessage |
|
| 969 | + * @param string $AlertRedirect |
|
| 970 | + */ |
|
| 964 | 971 | public static function send_alert_and_redirect($AlertMessage, $AlertRedirect) |
| 965 | 972 | { |
| 966 | 973 | echo "<script src='res/app/functions-1.0.4.js' type='text/javascript'></script>"; |
@@ -1153,6 +1160,9 @@ discard block |
||
| 1153 | 1160 | return $tr_default_type; |
| 1154 | 1161 | } |
| 1155 | 1162 | |
| 1163 | + /** |
|
| 1164 | + * @return string |
|
| 1165 | + */ |
|
| 1156 | 1166 | public static function attachments_folder() |
| 1157 | 1167 | { |
| 1158 | 1168 | global $attachments_folder; |
@@ -550,58 +550,58 @@ discard block |
||
| 550 | 550 | $db = null; |
| 551 | 551 | } |
| 552 | 552 | |
| 553 | - //Select all bank accounts |
|
| 554 | - public static function bankaccount_select_all() |
|
| 555 | - { |
|
| 556 | - $const_dbpath = costant::database_path(); |
|
| 557 | - $db = new PDO("sqlite:${const_dbpath}"); |
|
| 558 | - |
|
| 559 | - $results = $db->query('SELECT AccountName FROM Account_list ORDER BY AccountName COLLATE nocase;'); |
|
| 560 | - $resultarray = []; |
|
| 561 | - if ($results !== false) { |
|
| 562 | - $resultarray = $results->fetchAll(PDO::FETCH_COLUMN, 0); |
|
| 563 | - } |
|
| 564 | - $db = null; |
|
| 565 | - |
|
| 566 | - return $resultarray; |
|
| 567 | - } |
|
| 553 | + //Select all bank accounts |
|
| 554 | + public static function bankaccount_select_all() |
|
| 555 | + { |
|
| 556 | + $const_dbpath = costant::database_path(); |
|
| 557 | + $db = new PDO("sqlite:${const_dbpath}"); |
|
| 558 | + |
|
| 559 | + $results = $db->query('SELECT AccountName FROM Account_list ORDER BY AccountName COLLATE nocase;'); |
|
| 560 | + $resultarray = []; |
|
| 561 | + if ($results !== false) { |
|
| 562 | + $resultarray = $results->fetchAll(PDO::FETCH_COLUMN, 0); |
|
| 563 | + } |
|
| 564 | + $db = null; |
|
| 565 | + |
|
| 566 | + return $resultarray; |
|
| 567 | + } |
|
| 568 | 568 | |
| 569 | 569 | //Select all payee |
| 570 | - public static function payee_select_all_name() |
|
| 571 | - { |
|
| 572 | - $const_dbpath = costant::database_path(); |
|
| 573 | - $db = new PDO("sqlite:${const_dbpath}"); |
|
| 570 | + public static function payee_select_all_name() |
|
| 571 | + { |
|
| 572 | + $const_dbpath = costant::database_path(); |
|
| 573 | + $db = new PDO("sqlite:${const_dbpath}"); |
|
| 574 | 574 | |
| 575 | - $results = $db->query('SELECT PayeeName FROM Payee_List ORDER BY PayeeName COLLATE nocase;'); |
|
| 576 | - $resultarray = []; |
|
| 577 | - if ($results !== false) { |
|
| 578 | - $resultarray = $results->fetchAll(PDO::FETCH_COLUMN, 0); |
|
| 579 | - } |
|
| 575 | + $results = $db->query('SELECT PayeeName FROM Payee_List ORDER BY PayeeName COLLATE nocase;'); |
|
| 576 | + $resultarray = []; |
|
| 577 | + if ($results !== false) { |
|
| 578 | + $resultarray = $results->fetchAll(PDO::FETCH_COLUMN, 0); |
|
| 579 | + } |
|
| 580 | 580 | |
| 581 | - $db = null; |
|
| 581 | + $db = null; |
|
| 582 | 582 | |
| 583 | - return $resultarray; |
|
| 584 | - } |
|
| 583 | + return $resultarray; |
|
| 584 | + } |
|
| 585 | 585 | |
| 586 | 586 | //Select one payee |
| 587 | - public static function payee_select_one($PayeeName) |
|
| 588 | - { |
|
| 589 | - $const_dbpath = costant::database_path(); |
|
| 590 | - $db = new PDO("sqlite:${const_dbpath}"); |
|
| 587 | + public static function payee_select_one($PayeeName) |
|
| 588 | + { |
|
| 589 | + $const_dbpath = costant::database_path(); |
|
| 590 | + $db = new PDO("sqlite:${const_dbpath}"); |
|
| 591 | 591 | |
| 592 | - $statement = $db->prepare('SELECT * FROM Payee_List WHERE PayeeName = :TrPayeeName COLLATE nocase;'); |
|
| 593 | - $statement->bindParam(':TrPayeeName', $PayeeName); |
|
| 594 | - $statement->execute(); |
|
| 595 | - $resultarray = []; |
|
| 596 | - $resultarray = $statement->fetch(PDO::FETCH_ASSOC); |
|
| 597 | - if (!$resultarray) { |
|
| 598 | - $resultarray = []; |
|
| 599 | - } |
|
| 592 | + $statement = $db->prepare('SELECT * FROM Payee_List WHERE PayeeName = :TrPayeeName COLLATE nocase;'); |
|
| 593 | + $statement->bindParam(':TrPayeeName', $PayeeName); |
|
| 594 | + $statement->execute(); |
|
| 595 | + $resultarray = []; |
|
| 596 | + $resultarray = $statement->fetch(PDO::FETCH_ASSOC); |
|
| 597 | + if (!$resultarray) { |
|
| 598 | + $resultarray = []; |
|
| 599 | + } |
|
| 600 | 600 | |
| 601 | - $db = null; |
|
| 601 | + $db = null; |
|
| 602 | 602 | |
| 603 | - return $resultarray; |
|
| 604 | - } |
|
| 603 | + return $resultarray; |
|
| 604 | + } |
|
| 605 | 605 | |
| 606 | 606 | // Insert single payee account |
| 607 | 607 | public static function payee_insert_single($Payee, $Category, $SubCategory) |
@@ -735,7 +735,7 @@ discard block |
||
| 735 | 735 | return $resultarray; |
| 736 | 736 | } |
| 737 | 737 | |
| 738 | - // Insert all categories |
|
| 738 | + // Insert all categories |
|
| 739 | 739 | public static function category_insert_json($CategoryJSON) |
| 740 | 740 | { |
| 741 | 741 | $categories_json_list = json_decode($CategoryJSON, true); |
@@ -807,7 +807,7 @@ discard block |
||
| 807 | 807 | if (function_exists('com_create_guid')) { |
| 808 | 808 | return com_create_guid(); |
| 809 | 809 | } else { |
| 810 | - mt_srand((float) microtime() * 10000); |
|
| 810 | + mt_srand((float)microtime() * 10000); |
|
| 811 | 811 | $charid = strtoupper(md5(uniqid(rand(), true))); |
| 812 | 812 | $hyphen = chr(45); // "-" |
| 813 | 813 | $uuid = chr(123)// "{" |
@@ -1043,7 +1043,7 @@ discard block |
||
| 1043 | 1043 | if ($handle = opendir(costant::attachments_folder())) { |
| 1044 | 1044 | while (false !== ($entry = readdir($handle))) { |
| 1045 | 1045 | if (strpos($entry, 'Transaction_'.$TrID) == 0 && strpos($entry, 'Transaction_'.$TrID) !== false) { |
| 1046 | - $AttachNumb = substr($entry, strpos($entry, 'Attach') + 6, strpos($entry, '.') - (strpos($entry, 'Attach') + 6)); |
|
| 1046 | + $AttachNumb = substr($entry, strpos($entry, 'Attach')+6, strpos($entry, '.')-(strpos($entry, 'Attach')+6)); |
|
| 1047 | 1047 | if ($AttachNumb > $LastAttachNum) { |
| 1048 | 1048 | $LastAttachNum = $AttachNumb; |
| 1049 | 1049 | } |
@@ -11,10 +11,10 @@ |
||
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | if (isset($_FILES['UploadedAttachments']) && isset($_POST['Attachment_TrId'])) { |
| 14 | - $TrNumber = (int) $_POST['Attachment_TrId']; |
|
| 14 | + $TrNumber = (int)$_POST['Attachment_TrId']; |
|
| 15 | 15 | $FileName = $_FILES['UploadedAttachments']['name']; |
| 16 | - $FileExtension = substr($FileName, strpos($FileName, '.') + 1, strlen($FileName)); |
|
| 17 | - $NewFileName = 'Transaction_'.$TrNumber.'_Attach'.(attachments::get_number_of_attachments($TrNumber) + 1).'.'.$FileExtension; |
|
| 16 | + $FileExtension = substr($FileName, strpos($FileName, '.')+1, strlen($FileName)); |
|
| 17 | + $NewFileName = 'Transaction_'.$TrNumber.'_Attach'.(attachments::get_number_of_attachments($TrNumber)+1).'.'.$FileExtension; |
|
| 18 | 18 | move_uploaded_file($_FILES['UploadedAttachments']['tmp_name'], 'attachments/'.$NewFileName); |
| 19 | 19 | echo $NewFileName; |
| 20 | 20 | } |
@@ -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> |
@@ -60,7 +60,7 @@ |
||
| 60 | 60 | if (!empty($TransactionsArr)) { |
| 61 | 61 | for ($i = 0; $i < count($TransactionsArr); $i++) { |
| 62 | 62 | $TransactionsArr[$i]['Attachments'] = |
| 63 | - implode(';', attachments::get_attachments_filename_array((int) $TransactionsArr[$i]['ID'])); |
|
| 63 | + implode(';', attachments::get_attachments_filename_array((int)$TransactionsArr[$i]['ID'])); |
|
| 64 | 64 | } |
| 65 | 65 | echo json_encode($TransactionsArr, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT | JSON_FORCE_OBJECT); |
| 66 | 66 | } |
@@ -31,8 +31,8 @@ |
||
| 31 | 31 | <br /> |
| 32 | 32 | <h2><strong>Money Manager Ex - Web App</strong></h2> |
| 33 | 33 | <?php |
| 34 | - echo '<h4> Version '.costant::app_version().'</h4>'; |
|
| 35 | - echo '<h5> API Version '.costant::api_version().'</h5>'; |
|
| 34 | + echo '<h4> Version '.costant::app_version().'</h4>'; |
|
| 35 | + echo '<h5> API Version '.costant::api_version().'</h5>'; |
|
| 36 | 36 | ?> |
| 37 | 37 | <br /> |
| 38 | 38 | <h4> Developer: Gabriele [Gabriele-V]</h4> |