mirror of
https://github.com/rejetto/hfs2.git
synced 2025-12-19 10:03:56 +01:00
fix legacy problems
This commit is contained in:
parent
71b8ca4ee6
commit
983b184a0f
13
default.tpl
13
default.tpl
@ -1,4 +1,4 @@
|
|||||||
Welcome! This is the default template for HFS 2.4m
|
Welcome! This is the default template for HFS 2.4
|
||||||
template revision TR3.
|
template revision TR3.
|
||||||
|
|
||||||
Here below you'll find some options affecting the template.
|
Here below you'll find some options affecting the template.
|
||||||
@ -123,7 +123,7 @@ COMMENT with the ones above you can disable some features of the template. They
|
|||||||
</button>
|
</button>
|
||||||
|
|
||||||
{.if|{.get|can archive.}|
|
{.if|{.get|can archive.}|
|
||||||
<button id='archiveBtn' onclick='ask("{.!Download these files as a single archive?.}", function() { submit({ selection: getSelectedItemsName() }, "{.get|url|mode=archive|recursive.}") })'>
|
<button id='archiveBtn' onclick='ask("{.!Download these files as a single archive?.}", ()=> submit({ files: getSelectedItemsName() }, "{.get|url|mode=archive|recursive.}") )'>
|
||||||
<i class="fa fa-file-archive"></i>
|
<i class="fa fa-file-archive"></i>
|
||||||
<span>{.!Archive.}</span>
|
<span>{.!Archive.}</span>
|
||||||
</button>
|
</button>
|
||||||
@ -469,7 +469,7 @@ z-index:1; /* without this .item-menu will be over*/ }
|
|||||||
{.!max s dl msg.}
|
{.!max s dl msg.}
|
||||||
<br>({.disconnection reason.})
|
<br>({.disconnection reason.})
|
||||||
|
|
||||||
[unauthorized]
|
[unauth]
|
||||||
<h1>{.!Unauthorized.}</h1>
|
<h1>{.!Unauthorized.}</h1>
|
||||||
{.!Either your user name and password do not match, or you are not permitted to access this resource..}
|
{.!Either your user name and password do not match, or you are not permitted to access this resource..}
|
||||||
|
|
||||||
@ -667,6 +667,7 @@ function submit(data, url) {
|
|||||||
f.append("<input type='hidden' name='"+k+"' value='"+v2+"' />")
|
f.append("<input type='hidden' name='"+k+"' value='"+v2+"' />")
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
showLoading()
|
||||||
f.submit()
|
f.submit()
|
||||||
}//submit
|
}//submit
|
||||||
|
|
||||||
@ -787,10 +788,8 @@ function getSelectedItemsName() {
|
|||||||
}//getSelectedItemsName
|
}//getSelectedItemsName
|
||||||
|
|
||||||
function deleteFiles(files) {
|
function deleteFiles(files) {
|
||||||
ask("{.!confirm.}", function(){
|
ask("{.!confirm.}", ()=>
|
||||||
showLoading()
|
submit({ action:'delete', files }))
|
||||||
return submit({ action:'delete', selection:files })
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function moveFiles(files) {
|
function moveFiles(files) {
|
||||||
|
|||||||
138
main.pas
138
main.pas
@ -36,8 +36,8 @@ uses
|
|||||||
HSlib, traylib, monoLib, progFrmLib, classesLib;
|
HSlib, traylib, monoLib, progFrmLib, classesLib;
|
||||||
|
|
||||||
const
|
const
|
||||||
VERSION = '2.4 beta7';
|
VERSION = '2.4.0 beta8';
|
||||||
VERSION_BUILD = '309';
|
VERSION_BUILD = '310';
|
||||||
VERSION_STABLE = {$IFDEF STABLE } TRUE {$ELSE} FALSE {$ENDIF};
|
VERSION_STABLE = {$IFDEF STABLE } TRUE {$ELSE} FALSE {$ENDIF};
|
||||||
CURRENT_VFS_FORMAT :integer = 1;
|
CURRENT_VFS_FORMAT :integer = 1;
|
||||||
CRLF = #13#10;
|
CRLF = #13#10;
|
||||||
@ -3111,7 +3111,6 @@ end; // getRecursiveFileMask
|
|||||||
|
|
||||||
function Tfile.getAccountsFor(action:TfileAction; specialUsernames:boolean=FALSE; outInherited:Pboolean=NIL):TstringDynArray;
|
function Tfile.getAccountsFor(action:TfileAction; specialUsernames:boolean=FALSE; outInherited:Pboolean=NIL):TstringDynArray;
|
||||||
var
|
var
|
||||||
i: integer;
|
|
||||||
f: Tfile;
|
f: Tfile;
|
||||||
s: string;
|
s: string;
|
||||||
begin
|
begin
|
||||||
@ -3872,6 +3871,21 @@ try
|
|||||||
data.conn.reply.body:='';
|
data.conn.reply.body:='';
|
||||||
except end;
|
except end;
|
||||||
|
|
||||||
|
if sectionName = 'ban' then
|
||||||
|
data.conn.reply.mode:=HRM_DENY
|
||||||
|
else if sectionName = 'deny' then
|
||||||
|
data.conn.reply.mode:=HRM_DENY
|
||||||
|
else if sectionName = 'login' then
|
||||||
|
data.conn.reply.mode:=HRM_DENY
|
||||||
|
else if sectionName = 'not found' then
|
||||||
|
data.conn.reply.mode:=HRM_NOT_FOUND
|
||||||
|
else if sectionName = 'unauthorized' then
|
||||||
|
data.conn.reply.mode:=HRM_UNAUTHORIZED
|
||||||
|
else if sectionName = 'overload' then
|
||||||
|
data.conn.reply.mode:=HRM_OVERLOAD
|
||||||
|
else if sectionName = 'max contemp downloads' then
|
||||||
|
data.conn.reply.mode:=HRM_OVERLOAD;
|
||||||
|
|
||||||
section:=tpl2use.getSection(sectionName);
|
section:=tpl2use.getSection(sectionName);
|
||||||
if section = NIL then exit;
|
if section = NIL then exit;
|
||||||
|
|
||||||
@ -3886,13 +3900,6 @@ try
|
|||||||
addArray(md.table, ['%reason%', s]);
|
addArray(md.table, ['%reason%', s]);
|
||||||
|
|
||||||
data.conn.reply.contentType:=ansistring(name2mimetype(sectionName, 'text/html'));
|
data.conn.reply.contentType:=ansistring(name2mimetype(sectionName, 'text/html'));
|
||||||
if sectionName = 'ban' then data.conn.reply.mode:=HRM_DENY;
|
|
||||||
if sectionName = 'deny' then data.conn.reply.mode:=HRM_DENY;
|
|
||||||
if sectionName = 'login' then data.conn.reply.mode:=HRM_DENY;
|
|
||||||
if sectionName = 'not found' then data.conn.reply.mode:=HRM_NOT_FOUND;
|
|
||||||
if sectionName = 'unauthorized' then data.conn.reply.mode:=HRM_UNAUTHORIZED;
|
|
||||||
if sectionName = 'overload' then data.conn.reply.mode:=HRM_OVERLOAD;
|
|
||||||
if sectionName = 'max contemp downloads' then data.conn.reply.mode:=HRM_OVERLOAD;
|
|
||||||
|
|
||||||
md.cd:=data;
|
md.cd:=data;
|
||||||
md.tpl:=tpl2use;
|
md.tpl:=tpl2use;
|
||||||
@ -4465,41 +4472,24 @@ end; // runTplImport
|
|||||||
|
|
||||||
// returns true if template was patched
|
// returns true if template was patched
|
||||||
function setTplText(text:string=''):boolean;
|
function setTplText(text:string=''):boolean;
|
||||||
(* postponed to next release
|
resourcestring
|
||||||
procedure patch290();
|
MSG_OLD = 'The template you are trying to load is not compatible with current HFS version.'
|
||||||
{$J+}
|
+#13'HFS will now use default template.'
|
||||||
const
|
+#13'Ask on the forum if you need further help.';
|
||||||
PATCH: string = '';
|
|
||||||
PATCH_RE = '(\[ajax\.mkdir.+)\[special:import';
|
|
||||||
var
|
|
||||||
se: TstringDynArray;
|
|
||||||
i: integer;
|
|
||||||
begin
|
|
||||||
// is it default tpl?
|
|
||||||
if not ansiStartsText('Welcome! This is the default template for HFS 2.3', text) then
|
|
||||||
exit;
|
|
||||||
// needs to be patched?
|
|
||||||
if pos('template revision TR1.',substr(text,1,80)) = 0 then
|
|
||||||
exit;
|
|
||||||
// calculate the patch once
|
|
||||||
if length(PATCH)=0 then
|
|
||||||
PATCH:=reGet(defaultTpl, PATCH_RE, 1, '!mis');
|
|
||||||
{$J-}
|
|
||||||
// find the to-be-patched
|
|
||||||
i:=reMatch(text, PATCH_RE, '!mis', 1, @se);
|
|
||||||
if i=0 then exit; // something is wrong
|
|
||||||
result:=TRUE; // mark
|
|
||||||
replace(text, PATCH, i, i+length(se[1])-1); // real patch
|
|
||||||
text:=stringReplace(text, 'template revision TR1.', 'template revision TR3.', []); // version stamp
|
|
||||||
end;//patchIt
|
|
||||||
*)
|
|
||||||
begin
|
begin
|
||||||
result:=FALSE; // mod by mars
|
result:=FALSE; // mod by mars
|
||||||
//patch290();
|
//patch290();
|
||||||
if trim(text) = trim(defaultTpl.fullText) then
|
if trim(text) = trim(defaultTpl.fullText) then
|
||||||
text:='';
|
text:='';
|
||||||
tpl.fullText:=text;
|
tpl.fullText:=text;
|
||||||
tplIsCustomized:= text > '';
|
if tpl.sectionExist('unauthorized') then
|
||||||
|
begin
|
||||||
|
tpl.fullText:='';
|
||||||
|
tplFilename:='';
|
||||||
|
tplImport:=FALSE;
|
||||||
|
msgDlg(MSG_OLD, MB_ICONERROR);
|
||||||
|
end;
|
||||||
|
tplIsCustomized:= tpl.fullText > '';
|
||||||
if boolOnce(tplImport) then
|
if boolOnce(tplImport) then
|
||||||
runTplImport();
|
runTplImport();
|
||||||
end; // setTplText
|
end; // setTplText
|
||||||
@ -4921,7 +4911,7 @@ var
|
|||||||
begin
|
begin
|
||||||
data.user:=conn.request.user;
|
data.user:=conn.request.user;
|
||||||
data.pwd:=conn.request.pwd;
|
data.pwd:=conn.request.pwd;
|
||||||
data.account:=NIL;
|
data.account:=getAccount(data.user);
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
data.account:=getAccount(data.session.user);
|
data.account:=getAccount(data.session.user);
|
||||||
@ -4931,6 +4921,15 @@ var
|
|||||||
data.pwd:=data.account.pwd;
|
data.pwd:=data.account.pwd;
|
||||||
end; // sessionSetup
|
end; // sessionSetup
|
||||||
|
|
||||||
|
function getFilesSelection():TStringDynArray;
|
||||||
|
var i: integer;
|
||||||
|
begin
|
||||||
|
result:=NIL;
|
||||||
|
for i:=0 to data.postvars.count-1 do
|
||||||
|
if sameText('files', data.postvars.names[i]) then
|
||||||
|
addString(getTill('#', data.postvars.valueFromIndex[i]), result) // omit #anchors
|
||||||
|
end; // getFilesSelection
|
||||||
|
|
||||||
procedure serveTar();
|
procedure serveTar();
|
||||||
var
|
var
|
||||||
tar: TtarStream;
|
tar: TtarStream;
|
||||||
@ -4976,20 +4975,18 @@ var
|
|||||||
|
|
||||||
procedure addSelection();
|
procedure addSelection();
|
||||||
var
|
var
|
||||||
i: integer;
|
s, t: string;
|
||||||
s: string;
|
|
||||||
ft: Tfile;
|
ft: Tfile;
|
||||||
begin
|
begin
|
||||||
selection:=FALSE;
|
selection:=FALSE;
|
||||||
for i:=0 to data.postvars.count-1 do
|
for s in getFilesSelection() do
|
||||||
if sameText('selection', data.postvars.names[i]) then
|
|
||||||
begin
|
begin
|
||||||
selection:=TRUE;
|
selection:=TRUE;
|
||||||
s:=getTill('#', data.postvars.valueFromIndex[i]); // omit #anchors
|
if dirCrossing(s) then
|
||||||
if dirCrossing(s) then continue;
|
continue;
|
||||||
ft:=findFilebyURL(s, f);
|
ft:=findFilebyURL(s, f);
|
||||||
if ft = NIL then continue;
|
if ft = NIL then
|
||||||
|
continue;
|
||||||
try
|
try
|
||||||
if not ft.accessFor(data) then
|
if not ft.accessFor(data) then
|
||||||
continue;
|
continue;
|
||||||
@ -5003,7 +5000,9 @@ var
|
|||||||
if not fileExists(ft.resource) then
|
if not fileExists(ft.resource) then
|
||||||
continue;
|
continue;
|
||||||
if noFolders then
|
if noFolders then
|
||||||
s:=substr(s, lastDelimiter('\/', s)+1);
|
t:=substr(s, lastDelimiter('\/', s)+1)
|
||||||
|
else
|
||||||
|
t:=s;
|
||||||
tar.addFile(ft.resource, s);
|
tar.addFile(ft.resource, s);
|
||||||
finally freeIfTemp(ft) end;
|
finally freeIfTemp(ft) end;
|
||||||
end;
|
end;
|
||||||
@ -5082,8 +5081,10 @@ var
|
|||||||
FAILED = 'Login failed';
|
FAILED = 'Login failed';
|
||||||
begin
|
begin
|
||||||
result:=FALSE;
|
result:=FALSE;
|
||||||
if assigned(forceFile) then f:=forceFile;
|
if assigned(forceFile) then
|
||||||
if f = NIL then exit;
|
f:=forceFile;
|
||||||
|
if f = NIL then
|
||||||
|
exit;
|
||||||
if f.isFile() and (dlForbiddenForWholeFolder or f.isDLforbidden()) then
|
if f.isFile() and (dlForbiddenForWholeFolder or f.isDLforbidden()) then
|
||||||
begin
|
begin
|
||||||
getPage('deny', data);
|
getPage('deny', data);
|
||||||
@ -5150,26 +5151,24 @@ var
|
|||||||
doneRes:=NIL;
|
doneRes:=NIL;
|
||||||
errors:=NIL;
|
errors:=NIL;
|
||||||
done:=NIL;
|
done:=NIL;
|
||||||
for i:=0 to data.postvars.count-1 do
|
for asUrl in getFilesSelection() do
|
||||||
if sameText('selection', data.postvars.names[i]) then
|
begin
|
||||||
|
s:=uri2disk(asUrl, f);
|
||||||
|
if (s = '') or not fileOrDirExists(s) then // ignore
|
||||||
|
continue;
|
||||||
|
runEventScript('file deleting', ['%item-deleting%', s]);
|
||||||
|
moveToBin(toSA([s, s+'.md5', s+COMMENT_FILE_EXT]) , TRUE);
|
||||||
|
if fileOrDirExists(s) then
|
||||||
begin
|
begin
|
||||||
asUrl:=getTill('#', data.postvars.valueFromIndex[i]); // omit #anchors
|
addString(asUrl, errors);
|
||||||
s:=uri2disk(asUrl, f);
|
continue; // this was not deleted. permissions problem?
|
||||||
if (s = '') or not fileOrDirExists(s) then continue; // ignore
|
|
||||||
|
|
||||||
runEventScript('file deleting', ['%item-deleting%', s]);
|
|
||||||
moveToBin(toSA([s, s+'.md5', s+COMMENT_FILE_EXT]) , TRUE);
|
|
||||||
if fileOrDirExists(s) then
|
|
||||||
begin
|
|
||||||
addString(asUrl, errors);
|
|
||||||
continue; // this was not deleted. permissions problem?
|
|
||||||
end;
|
|
||||||
|
|
||||||
addString(s, doneRes);
|
|
||||||
addString(asUrl, done);
|
|
||||||
runEventScript('file deleted', ['%item-deleted%', s]);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
addString(s, doneRes);
|
||||||
|
addString(asUrl, done);
|
||||||
|
runEventScript('file deleted', ['%item-deleted%', s]);
|
||||||
|
end;
|
||||||
|
|
||||||
removeFilesFromComments(doneRes);
|
removeFilesFromComments(doneRes);
|
||||||
|
|
||||||
if logDeletionsChk.checked and assigned(done) then
|
if logDeletionsChk.checked and assigned(done) then
|
||||||
@ -5181,7 +5180,7 @@ var
|
|||||||
function getAccountRedirect(acc:Paccount=NIL):string;
|
function getAccountRedirect(acc:Paccount=NIL):string;
|
||||||
begin
|
begin
|
||||||
result:='';
|
result:='';
|
||||||
if acc = NIL then
|
if acc = NIL then
|
||||||
acc:=data.account;
|
acc:=data.account;
|
||||||
acc:=accountRecursion(acc, ARSC_REDIR);
|
acc:=accountRecursion(acc, ARSC_REDIR);
|
||||||
if acc = NIL then exit;
|
if acc = NIL then exit;
|
||||||
@ -11250,7 +11249,6 @@ end; // pointToCharPoint
|
|||||||
|
|
||||||
function Tmainfrm.ipPointedInLog():string;
|
function Tmainfrm.ipPointedInLog():string;
|
||||||
var
|
var
|
||||||
i: integer;
|
|
||||||
s: string;
|
s: string;
|
||||||
pt: Tpoint;
|
pt: Tpoint;
|
||||||
begin
|
begin
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user