Skip to content

Commit

Permalink
Merge branch 'attachments'
Browse files Browse the repository at this point in the history
Conflicts:
	WebApp/services.php
  • Loading branch information
gabriele-v committed Aug 22, 2014
2 parents 13b9bfb + 7912d93 commit 3819e76
Show file tree
Hide file tree
Showing 28 changed files with 544 additions and 264 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
MMEX_New_Transaction.db
configuration_user.php
/WebApp/attachments/Transaction*.*
4 changes: 2 additions & 2 deletions WebApp/about.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
<title>Money Manager EX</title>
<link rel="icon" href="res/favicon.ico" />

<link rel="stylesheet" type="text/css" href="res/bootstrap-3.1.1.min.css" />
<link rel="stylesheet" type="text/css" href="res/bootstrap-theme-3.1.1.min.css" />
<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>

Expand Down
43 changes: 43 additions & 0 deletions WebApp/attachments.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?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}'>
<span class='glyphicon glyphicon-download-alt'> </span> Open</a>","text_align_right");
design::table_cell("<a href='#' onclick='attachment_delete(\"${File}\",${TrId});return false;'>
<span class='glyphicon glyphicon-remove'> </span> Delete</a>","text_align_right");
echo "</tr>";
}
echo "</tbody>";
echo "</table>";
}
?>
1 change: 1 addition & 0 deletions WebApp/attachments/Readme.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Folder for attachments. Do not delete!
10 changes: 10 additions & 0 deletions WebApp/attachments/htaccess.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#######################################
## htaccess for block important file ##
#######################################

# Block folder list
Options All -Indexes

# Block entire folder
Order deny,allow
Deny from all
5 changes: 3 additions & 2 deletions WebApp/configuration_system.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
## don't touch ##
######################################
$dbpath = "MMEX_New_Transaction.db";
$app_version = "1.0.0";
$api_version = "0.9.9";
$app_version = "1.0.1";
$api_version = "1.0.1";
$tr_default_status = "R";
$tr_default_type = "Withdrawal";
$attachments_folder = "attachments";
?>
4 changes: 2 additions & 2 deletions WebApp/error.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
<title>Money Manager EX</title>
<link rel="icon" href="res/favicon.ico" />

<link rel="stylesheet" type="text/css" href="res/bootstrap-3.1.1.min.css" />
<link rel="stylesheet" type="text/css" href="res/bootstrap-theme-3.1.1.min.css" />
<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>

Expand Down
Loading

0 comments on commit 3819e76

Please sign in to comment.