require_once "functions.php"; $error = db_function::db_create(); if ($error !== "ok") { echo $error; } else { $upgrade_result = db_upgrade::upgrade_db(); if ($upgrade_result == "update_done") { various::send_alert_and_redirect("Database succesfully updated to version " . costant::app_version(), "index.php"); } } $username = null; $password = null; $const_username = costant::login_username(); $const_password = costant::login_password(); $const_disable_authentication = costant::disable_authentication(); if ($const_disable_authentication == "True") { header("Location: landing.php"); } if ($const_disable_authentication !== "True" && (!isset($const_username) or !isset($const_password))) { header("Location: settings.php"); } if ($_SERVER["REQUEST_METHOD"] == "POST") { if (!empty($_POST["Username"]) && !empty($_POST["Password"])) { $username = $_POST["Username"]; $password = hash("sha512", $_POST["Password"]); if ($username == $const_username && $password == $const_password) { session_start(); $user_browser = $_SERVER['HTTP_USER_AGENT']; $_SESSION["username"] = $username; $_SESSION["login_string"] = hash("sha512", $password . $user_browser);
} #Download New Transactions if (isset($_GET["download_transaction"])) { $TransactionsArr = db_function::transaction_select_all_order_by_date(); if (!empty($TransactionsArr)) { for ($i = 0; $i < sizeof($TransactionsArr); $i++) { $TransactionsArr[$i]['Attachments'] = implode(";", attachments::get_attachments_filename_array((int) $TransactionsArr[$i]['ID'])); } echo json_encode($TransactionsArr, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT | JSON_FORCE_OBJECT); } } #Download Attachments by name if (isset($_GET["download_attachment"])) { $AttachmentFileName = $_GET["download_attachment"]; if (!empty($AttachmentFileName)) { $FullPath = costant::attachments_folder() . "/" . $AttachmentFileName; header("Content-Type:"); header("Cache-Control: public"); header("Content-Description: File Transfer"); header("Content-Disposition: attachment; filename= " . $AttachmentFileName); header("Content-Transfer-Encoding: binary"); readfile($FullPath); } } #Delete Attachments if (isset($_GET["delete_attachment"])) { $AttachmentFileName = $_GET["delete_attachment"]; if (!empty($AttachmentFileName)) { attachments::delete_attachment_by_name($AttachmentFileName); } }
<?php require_once "functions.php"; session_start(); security::redirect_if_not_loggedin(); $Guid = costant::desktop_guid(); if (isset($_GET["DeleteAttach"])) { attachments::delete_attachment_by_name($_GET["DeleteAttach"]); } if (isset($_FILES['UploadedAttachments']) && isset($_POST["Attachment_TrId"])) { $TrNumber = (int) $_POST['Attachment_TrId']; $FileName = $_FILES['UploadedAttachments']['name']; $FileExtension = substr($FileName, strpos($FileName, ".") + 1, strlen($FileName)); $NewFileName = "Transaction_" . $TrNumber . "_Attach" . (attachments::get_number_of_attachments($TrNumber) + 1) . "." . $FileExtension; move_uploaded_file($_FILES['UploadedAttachments']['tmp_name'], "attachments/" . $NewFileName); echo $NewFileName; } if (isset($_GET["AttachmentsTable"])) { $TrId = $_GET["AttachmentsTable"]; $Attachments = attachments::get_attachments_filename_array($TrId, true); echo "<table class = 'table'>"; echo "<tbody>"; for ($i = 0; $i < sizeof($Attachments); $i++) { echo "<tr>"; $File = $Attachments[$i]; design::table_cell(substr($File, strpos($File, "Attach"), strlen($File)), ""); design::table_cell("<a href='services.php?guid={$Guid}&download_attachment={$File}'>\n <span class='glyphicon glyphicon-download-alt'> </span> Open</a>", "text_align_right"); design::table_cell("<a href='#' onclick='attachment_delete(\"{$File}\",{$TrId});return false;'>\n <span class='glyphicon glyphicon-remove'> </span> Delete</a>", "text_align_right"); echo "</tr>"; } echo "</tbody>";
design::table_cell("<span data-toggle='tooltip' title='Transfer to: {$TrToAccountShow}' id='tooltip_account_{$lineid}'>{$TrAccountShow}</span>", ""); } else { design::table_cell($TrAccountShow, ""); } //PAYEE $TrPayeeShow = $resultarray[$i]["Payee"]; if (costant::disable_payee() == False) { design::table_cell($TrPayeeShow, ""); } //CATEGORY $TrCategoryShow = $resultarray[$i]["Category"]; $TrSubCategoryShow = $resultarray[$i]["SubCategory"]; if (costant::disable_category() == False && $TrSubCategoryShow != "None") { design::table_cell("<span data-toggle='tooltip' title='Subcategory: {$TrSubCategoryShow}' id='tooltip_category_{$lineid}'>{$TrCategoryShow}*</span>", ""); } else { if (costant::disable_category() == False) { design::table_cell($TrCategoryShow, ""); } } //AMOUNT $TrAmountShow = number_format($resultarray[$i]["Amount"], 2, ",", ""); design::table_cell($TrAmountShow, "text_align_right td_size_5"); //NOTES $TrNotesShow = $resultarray[$i]["Notes"]; $NotesHTMLCode = ""; if ($TrNotesShow != "" && $TrNotesShow != "None") { $NotesHTMLCode .= "<span class='glyphicon glyphicon-info-sign' data-toggle='tooltip' title='{$TrNotesShow}' id='tooltip_notes_{$lineid}'></span> "; } if (attachments::get_number_of_attachments($lineid) > 0) { $NotesHTMLCode .= "<span class='glyphicon glyphicon-paperclip'></span>"; }
</head> <body> <div class="container text_align_center"> <h3><strong>Guide</strong></h3> <br /> <p> To start use Money Manager Ex WebApp you need to insert this data in your existing desktop installation </p> <?php echo "<p>WebApp URL:</p>"; $CurrentPage = str_replace("/guide.php", "", costant::current_page_url()); echo "<p><strong>" . $CurrentPage . "</strong></p>"; echo "<br />"; echo "<p>Desktop GUID:</p>"; echo "<p><strong>" . costant::desktop_guid() . "</strong></p>"; echo "<br />"; echo "<br />"; ?> <p> Please open desktop version to import bank account and start use Web version </p> <br /> <br /> <!-- <input type="button" class="btn btn-default" value="Copy URL" /> <input type="button" class="btn btn-default" value="Copy GUID" /> --> <input type="button" class="btn btn-lg btn-success btn-block" value="Return to menu" onclick="top.location.href = 'landing.php'" /> <br />
if (sizeof($resultarray) > 0 || $FlagNew == True) { echo "<div class='container'>"; echo "<form id='Transaction' class='form-transaction' method='post' action = 'insert.php'\r\n onsubmit='return confirm_if_not_present_in_datalist(\"Payee\",\"PayeeList\",\"Do you want to add the new payee\")'>"; echo "<h3 class='text_align_center'>{$TransactionHeaderText}</h3>"; echo "<br />"; design::input_date($TransactionDate); design::input_status($TransactionStatus); design::input_type($TransactionType); design::input_account($TransactionAccount); design::input_toaccount($TransactionToAccount); if (costant::disable_payee() !== True) { design::input_payee($TransactionPayee); } else { design::input_hidden("Payee", "None"); } if (costant::disable_category() !== True) { design::input_category($TransactionCategory); design::input_subcategory($TransactionSubCategory); } else { design::input_hidden("Category", "None"); design::input_hidden("SubCategory", "None"); } design::input_amount($TransactionAmount); design::input_notes($TransactionNotes); echo "<div class='form-group'>"; echo "<label for='fileToUpload'>Take a picture or upload attachments</label><br />"; echo "<input type='file' name='fileToUpload' id='fileToUpload' onchange='attachment_uploadFile({$TrEditNr});' />"; echo "<span class='help-block'></span>"; echo "</div>\n"; echo "<div class='table-responsive' id='attachments_table'>"; echo "</div>\n";
} else { echo "<br />"; echo "<p style='text-align:center'><img src='res\\mmex.ico' alt='Money Manager EX Logo' height='150' width='150' /></p>"; echo "<h3 class='text_align_center'>Insert new settings to start use Money Manager</h3>"; } ?> <br /> <form id="login" method="post" action="settings.php"> <?php $const_disable_authentication = costant::disable_authentication(); $const_username = costant::login_username(); $const_password = costant::login_password(); $const_desktop_guid = costant::desktop_guid(); $const_disable_payee = costant::disable_payee(); $const_disable_category = costant::disable_category(); $const_defaultaccountname = costant::transaction_default_account(); //SECTION AUTHENTICATION design::section_legened("Authentication"); if ($const_disable_authentication == True) { design::settings_checkbox("Set_Disable_authentication", True, "Disable authentication (Not recommended)"); } else { design::settings_checkbox("Set_Disable_authentication", False, "Disable authentication (Not recommended)"); } if (isset($const_username) && $const_disable_authentication == False) { design::settings("Username", $const_username, "", "Text", True); } else { design::settings("Username", "", "Insert a new username", "Text", True); } if (isset($const_password) && $const_disable_authentication == False) { design::settings_password("Password", "To change insert a new password", False); } else {
public static function delete_attachment_by_name($FileName) { $FullPath = costant::attachments_folder() . "/" . $FileName; if (!empty($FileName) && file_exists($FullPath)) { unlink($FullPath); } }
<link rel="apple-touch-icon" href="res/apple-touch-icon.png" /> <link rel="stylesheet" type="text/css" href="res/bootstrap-3.2.0.min.css" /> <link rel="stylesheet" type="text/css" href="res/bootstrap-theme-3.2.0.min.css" /> <link rel="stylesheet" type="text/css" href="res/style_global-0.9.9.css" /> </head> <body> <div class="container text_align_center"> <br /> <img src="res/mmex.ico" alt="Money Manager Ex Logo" height="150" width="150"/> <br /> <h2><strong>Money Manager Ex - Web App</strong></h2> <?php echo "<h4> Version " . costant::app_version() . "</h4>"; echo "<h5> API Version " . costant::api_version() . "</h5>"; ?> <br /> <h4> Developer: Gabriele [Gabriele-V]</h4> <a href="https://github.com/moneymanagerex/web-money-manager-ex"><h4> GitHub WebPage</h4></a> <br /> <p> Used components: <br /> <a href="http://getbootstrap.com/">Bootstrap</a> <br /> <a href="http://jquery.com//">jQuery</a> <br /> <a href="http://modernizr.com/">Modernizr</a> <br /> <a href="http://www.sqlite.org/">SQLite</a>
<meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, maximum-scale=1" /> <meta name="apple-mobile-web-app-capable" content="yes" /> <title>Money Manager EX</title> <link rel="icon" href="res/favicon.ico" /> <link rel="apple-touch-icon" href="res/apple-touch-icon.png" /> <link rel="stylesheet" type="text/css" href="res/bootstrap-3.2.0.min.css" /> <link rel="stylesheet" type="text/css" href="res/bootstrap-theme-3.2.0.min.css" /> <link rel="stylesheet" type="text/css" href="res/style_global-0.9.9.css" /> </head> <body> <div class="container text_align_center"> <br /> <img src="res/mmex.ico" alt="Money Manager Ex Logo" height="150" width="150"/> <br /> <h3><strong>Internal Error</strong></h3> <?php echo "<h4> Version " . costant::app_version() . "</h4>"; ?> <br /> <h4> Please contact developer Gabriele [Gabriele-V]</h4> <a href="https://github.com/moneymanagerex/web-money-manager-ex"><h4> on GitHub WebPage</h4></a> <br /> <br /> </div> </body> </html>