Merge 2017.1 changes voor encrypted bijlagen

svn path=/Website/branches/v2017.2/; revision=35818
This commit is contained in:
Jos Groot Lipman
2017-10-26 07:26:30 +00:00
parent 8375db5c48
commit d93b1778cb
2 changed files with 22 additions and 18 deletions

View File

@@ -238,7 +238,10 @@ function flexProps(pModule, pKey, pSubpath, pNiveau, params)
result.AttachPath += (pKey > 0? subfolderKey(bepaalNiveau(pModule, pNiveau), pKey)
: subfolderNew(bepaalNiveau(pModule, pNiveau), user_key + "_" + (params.tmpfolder||getQParam("tmpfolder"))));
result.AttachPath += "/" + pSubpath + "/";
// de volgende twee wil ik liever met de kenmerk-key opzoeken in de database
// maar dat is even te veel werk hier. De url is toch hmac-protected
result.extFilter = getQParam("extFilter", S("flexExtensionFilter"));
result.encrypt = getQParamInt("encrypt", 0) == 1;
result.regexp = getQParam("pregexp", ""); //P800x600 cropt/resized naar 800x600
if (pModule == "ALG" && params)
{

View File

@@ -139,24 +139,25 @@ var fso = Server.CreateObject("Scripting.FileSystemObject")
if (msg == "")
{
result.safefilename.push(safefilename);
if (doEncrypt) // Wordt (nog) niet gebruikt.
try
{
var oZip = Server.CreateObject("SLNKDWF.Zip");
oZip.Open(fullpath + safefilename + ".encrypted");
oZip.EncryptFromString(safefilename, finfo.data);
}
else
{
var BinaryStream = Server.CreateObject("ADODB.Stream");
BinaryStream.Type = 1; // adTypeBinary
BinaryStream.Open();
try
CreateFullPath(params.AttachPath);
result.safefilename.push(safefilename);
if (doEncrypt)
{
var oZip = Server.CreateObject("SLNKDWF.Zip");
__Log("Encrypting to: " + params.AttachPath + safefilename + ".encrypted");
oZip.New(params.AttachPath + safefilename + ".encrypted");
oZip.EncryptFromString(safefilename, finfo.data);
}
else
{
var BinaryStream = Server.CreateObject("ADODB.Stream");
BinaryStream.Type = 1; // adTypeBinary
BinaryStream.Open();
BinaryStream.Write(finfo.data);
// Save binary data To disk
__Log("Saving to: " + params.AttachPath + safefilename);
CreateFullPath(params.AttachPath);
if (params.keephistory && fso.FileExists(params.AttachPath + safefilename))
{
var jsDate = new Date();
@@ -169,11 +170,11 @@ var fso = Server.CreateObject("Scripting.FileSystemObject")
}
BinaryStream.SaveToFile(params.AttachPath + safefilename, 2); // adSaveCreateOverWrite
}
catch(e)
{
result.message += "Saving {0} failed: {1} ".format(safefilename, e.description);
__DoLog("Saving to {0} failed: {1}".format(params.AttachPath + safefilename, e.description), "#f0f");
}
}
catch(e)
{
result.message += "Saving {0} failed: {1} ".format(safefilename, e.description);
__DoLog("Saving to {0} failed: {1}".format(params.AttachPath + safefilename, e.description), "#f0f");
}
}
else