procedure THauptform.TimerUploadTimer(Sender: TObject);
var Ini: TIniFile;
morgen_m,http_url,today,tomorrow,proxy_type,proxy_host,proxy_port,proxy_user,proxy_pass,dirname,password,
url,username,file1,file2,file3,file4,file5:
String;
proxy,passiv,lplan: Boolean;
dnr,port: Integer;
begin
Application.ProcessMessages;
TimerReload.OnTimer(TimerReload);
dnr:=DayOfWeek(heute_neu);
if dnr=1
then begin //sonntag
today:=DatetoStr(heute_neu+1);
tomorrow:=DatetoStr(heute_neu+2);
end
else if dnr=2
then begin
today:=DatetoStr(heute_neu);
tomorrow:=DatetoStr(heute_neu+1);
end
else if dnr=3
then begin
today:=DatetoStr(heute_neu);
tomorrow:=DatetoStr(heute_neu+1);
end
else if dnr=4
then begin
today:=DatetoStr(heute_neu);
tomorrow:=DatetoStr(heute_neu+1);
end
else if dnr=5
then begin
today:=DatetoStr(heute_neu);
tomorrow:=DatetoStr(heute_neu+1);
end
else if dnr=6
then begin
today:=DatetoStr(heute_neu);
tomorrow:=DatetoStr(heute_neu+3);
end
else if dnr=7
then begin
today:=DatetoStr(heute_neu+2);
tomorrow:=DatetoStr(heute_neu+3);
end;
try
Ini:=TIniFile.Create(prgmpath+'
conf.ini');
username:=Ini.ReadString('
FTP-Daten','
Username','
');
password:=Ini.ReadString('
FTP-Daten','
Password','
');
url:=Ini.ReadString('
FTP-Daten','
URL','
');
dirname:=Ini.ReadString('
FTP-Daten','
Ordner','
');
port:=Ini.ReadInteger('
FTP-Daten','
Port',21);
passiv:=Ini.ReadBool('
FPT-Daten','
Passivmode',TRUE);
proxy:=Ini.ReadBool('
Proxy','
Aktivieren',FALSE);
proxy_host:=Ini.ReadString('
Proxy','
Host','
');
proxy_port:=Ini.ReadString('
Proxy','
Port','
');
proxy_user:=Ini.ReadString('
Proxy','
Username','
');
proxy_pass:=Ini.ReadString('
Proxy','
Passwort','
');
proxy_type:=Ini.ReadString('
Proxy','
Typ','
');
http_url:=Ini.ReadString('
HTML-Plan (Schüler)','
URL','
');
lplan:=Ini.ReadBool('
Grundeinstellungen','
Lehrerplan hochladen',true);
morgen_m:=Ini.ReadString('
Zeiteinstellungen','
Datum morgen',tomorrow);
if StrToDate(morgen_m)<StrToDate(tomorrow)
then
morgen_m:=tomorrow
else
tomorrow:=morgen_m;
finally
Ini.Free;
end;
IdFTP1.Username := username;
IdFTP1.Password := password;
IdFTP1.Host :=
url;
IdFTP1.Port:=port;
IdFTP1.Passive:=passiv;
IdFTP1.Connect;
IdFTP1.ChangeDir(dirname);
if proxy
then begin
IdFTP1.ProxySettings.Host:=Proxy_Host;
IdFTP1.ProxySettings.Port:=StrToInt(Proxy_Port);
IdFTP1.ProxySettings.Username:=Proxy_User;
IdFTP1.ProxySettings.Password:=Proxy_Pass;
if Proxy_Type='
fpcmNone'
then
IdFTP1.ProxySettings.ProxyType:=fpcmNone
else if Proxy_Type='
fpcmOpen'
then
IdFTP1.ProxySettings.ProxyType:=fpcmOpen
else if Proxy_Type='
fpcmSite'
then
IdFTP1.ProxySettings.ProxyType:=fpcmSite
else if Proxy_Type='
fpcmTransparent'
then
IdFTP1.ProxySettings.ProxyType:=fpcmTransparent
else if Proxy_Type='
fpcmUserSite'
then
IdFTP1.ProxySettings.ProxyType:=fpcmUserSite
else if Proxy_Type='
fpcmUserPass'
then
IdFTP1.ProxySettings.ProxyType:=fpcmUserPass;
end
else begin
IdFTP1.ProxySettings.Host:='
';
IdFTP1.ProxySettings.Port:=0;
IdFTP1.ProxySettings.Username:='
';
IdFTP1.ProxySettings.Password:='
';
IdFTP1.ProxySettings.ProxyType:=fpcmNone;
end;
if tage>2
then begin
file1:=prgmpath+'
\pl_sch\'+prefix_sch+'
Mo.htm';
file2:=prgmpath+'
\pl_sch\'+prefix_sch+'
Di.htm';
file3:=prgmpath+'
\pl_sch\'+prefix_sch+'
Mi.htm';
file4:=prgmpath+'
\pl_sch\'+prefix_sch+'
Do.htm';
file5:=prgmpath+'
\pl_sch\'+prefix_sch+'
Fr.htm';
IdFTP1.Put(file1, ExtractFileName(file1));
IdFTP1.Put(file2, ExtractFileName(file2));
IdFTP1.Put(file3, ExtractFileName(file3));
IdFTP1.Put(file4, ExtractFileName(file4));
IdFTP1.Put(file5, ExtractFileName(file5));
end
else begin
file1:=prgmpath+'
\pl_sch\'+prefix_sch+'
heute.htm';
file2:=prgmpath+'
\pl_sch\'+prefix_sch+'
morgen.htm';
IdFTP1.Put(file1, ExtractFileName(file1));
IdFTP1.Put(file2, ExtractFileName(file2));
end;
IdFTP1.Quit;
if (autom_mon_exp)
AND ((monitor_upload*60)=uploadtime)
AND NOT (lplan)
then
TimerMonitorFTP.OnTimer(TimerMonitorFTP);
end;