Use unsecured heidisql.com url in donor check if secure one did not work. Closes #65

This commit is contained in:
Ansgar Becker
2018-01-02 18:55:06 +01:00
parent 5aabc004d5
commit 36c5d90d39
7 changed files with 24 additions and 26 deletions

View File

@ -122,9 +122,9 @@ begin
lblAppName.Caption := APPNAME; lblAppName.Caption := APPNAME;
lblAppVersion.Caption := _('Version') + ' ' + Mainform.AppVersion + ' (' + IntToStr(GetExecutableBits) + ' Bit)'; lblAppVersion.Caption := _('Version') + ' ' + Mainform.AppVersion + ' (' + IntToStr(GetExecutableBits) + ' Bit)';
lblAppCompiled.Caption := _('Compiled on:') + ' ' + DateTimeToStr(GetImageLinkTimeStamp(Application.ExeName)); lblAppCompiled.Caption := _('Compiled on:') + ' ' + DateTimeToStr(GetImageLinkTimeStamp(Application.ExeName));
lblAppWebpage.Caption := GetAppWebsite(True); lblAppWebpage.Caption := APPDOMAIN;
lblAppWebpage.Hint := GetAppWebsite(True)+'?place='+EncodeURLParam(lblAppWebpage.Name); lblAppWebpage.Hint := APPDOMAIN+'?place='+EncodeURLParam(lblAppWebpage.Name);
ImageHeidisql.Hint := GetAppWebsite(True)+'?place='+EncodeURLParam(ImageHeidisql.Name); ImageHeidisql.Hint := APPDOMAIN+'?place='+EncodeURLParam(ImageHeidisql.Name);
Screen.Cursor := crDefault; Screen.Cursor := crDefault;
end; end;

View File

@ -12,7 +12,7 @@ const
// General things // General things
APPNAME = 'HeidiSQL'; APPNAME = 'HeidiSQL';
APPDOMAIN = 'www.heidisql.com'; APPDOMAIN = 'https://www.heidisql.com/';
REGKEY_SESSIONS = 'Servers'; REGKEY_SESSIONS = 'Servers';
REGKEY_QUERYHISTORY = 'QueryHistory'; REGKEY_QUERYHISTORY = 'QueryHistory';
REGKEY_RECENTFILTERS = 'RecentFilters'; REGKEY_RECENTFILTERS = 'RecentFilters';

View File

@ -926,7 +926,7 @@ begin
' </table>' + CRLF + CRLF + ' </table>' + CRLF + CRLF +
' <p>' + CRLF + ' <p>' + CRLF +
' <em>generated ' + DateToStr(now) + ' ' + TimeToStr(now) + ' <em>generated ' + DateToStr(now) + ' ' + TimeToStr(now) +
' by <a href="'+GetAppWebsite(True)+'">' + APPNAME + ' ' + Mainform.AppVersion + '</a></em>' + CRLF + ' by <a href="'+APPDOMAIN+'">' + APPNAME + ' ' + Mainform.AppVersion + '</a></em>' + CRLF +
' </p>' + CRLF + CRLF + ' </p>' + CRLF + CRLF +
' </body>' + CRLF + ' </body>' + CRLF +
'</html>' + CRLF; '</html>' + CRLF;

View File

@ -337,7 +337,6 @@ type
procedure Help(Sender: TObject; Anchor: String); procedure Help(Sender: TObject; Anchor: String);
function PortOpen(Port: Word): Boolean; function PortOpen(Port: Word): Boolean;
function IsValidFilePath(FilePath: String): Boolean; function IsValidFilePath(FilePath: String): Boolean;
function GetAppWebsite(Secure: Boolean): String;
var var
@ -2771,7 +2770,7 @@ begin
Place := 'unhandled-'+Sender.ClassName; Place := 'unhandled-'+Sender.ClassName;
if IsNotEmpty(Anchor) then if IsNotEmpty(Anchor) then
Anchor := '#'+Anchor; Anchor := '#'+Anchor;
ShellExec(GetAppWebsite(True)+'help.php?place='+EncodeURLParam(Place)+Anchor); ShellExec(APPDOMAIN+'help.php?place='+EncodeURLParam(Place)+Anchor);
end; end;
@ -2814,16 +2813,6 @@ begin
end; end;
function GetAppWebsite(Secure: Boolean): String;
begin
// Get project web url, with or without ssl
if Secure then
Result := 'https://' + APPDOMAIN + '/'
else
Result := 'http://' + APPDOMAIN + '/';
end;
{ Threading stuff } { Threading stuff }

View File

@ -1997,7 +1997,7 @@ begin
if DaysBetween(Now, LastStatsCall) >= 30 then begin if DaysBetween(Now, LastStatsCall) >= 30 then begin
// Report used SVN revision // Report used SVN revision
StatsCall := THttpDownload.Create(Self); StatsCall := THttpDownload.Create(Self);
StatsCall.URL := GetAppWebsite(True) + 'savestats.php?c=' + IntToStr(FAppVerRevision) + '&bits=' + IntToStr(GetExecutableBits); StatsCall.URL := APPDOMAIN + 'savestats.php?c=' + IntToStr(FAppVerRevision) + '&bits=' + IntToStr(GetExecutableBits);
// Enumerate actively used server versions // Enumerate actively used server versions
for i:=0 to SessionPaths.Count-1 do begin for i:=0 to SessionPaths.Count-1 do begin
AppSettings.SessionPath := SessionPaths[i]; AppSettings.SessionPath := SessionPaths[i];
@ -2509,7 +2509,7 @@ begin
ErrorDialog(f_('Could not determine parent form of this %s', [Sender.ClassName])) ErrorDialog(f_('Could not determine parent form of this %s', [Sender.ClassName]))
else begin else begin
place := LowerCase(Dialog.UnitName); place := LowerCase(Dialog.UnitName);
ShellExec(GetAppWebsite(True) + 'donatebutton.php?place=' + EncodeURLParam(place)); ShellExec(APPDOMAIN + 'donatebutton.php?place=' + EncodeURLParam(place));
end; end;
end; end;
@ -12156,17 +12156,26 @@ begin
FHasDonatedDatabaseCheck := nbFalse; FHasDonatedDatabaseCheck := nbFalse;
end else begin end else begin
// Check heidisql.com/hasdonated.php?email=... // Check heidisql.com/hasdonated.php?email=...
// HasDonatedDatabaseCheck // FHasDonatedDatabaseCheck
// = 0 : No check yet done // = 0 : No check yet done
// = 1 : Not a donor // = 1 : Not a donor
// = 2 : Valid donor // = 2 : Valid donor
rx := TRegExpr.Create; rx := TRegExpr.Create;
CheckWebpage := THttpDownload.Create(MainForm); CheckWebpage := THttpDownload.Create(MainForm);
CheckWebpage.URL := GetAppWebsite(True) + 'hasdonated.php?email='+EncodeURLParam(Email); CheckWebpage.URL := APPDOMAIN + 'hasdonated.php?email='+EncodeURLParam(Email);
CheckWebpage.TimeOut := 3; CheckWebpage.TimeOut := 3;
TempFileName := GetTempDir + '\' + APPNAME + '_hasdonated_check.tmp'; TempFileName := GetTempDir + '\' + APPNAME + '_hasdonated_check.tmp';
try try
CheckWebpage.SendRequest(TempFileName); try
CheckWebpage.SendRequest(TempFileName);
except
on E:Exception do begin
// Try again without SSL. See issue #65
MainForm.LogSQL(E.Message, lcError);
CheckWebpage.URL := ReplaceRegExpr('^https:', CheckWebpage.URL, 'http:');
CheckWebpage.SendRequest(TempFileName);
end;
end;
CheckResult := ReadTextFile(TempFileName, TEncoding.Default); CheckResult := ReadTextFile(TempFileName, TEncoding.Default);
SysUtils.DeleteFile(TempFileName); SysUtils.DeleteFile(TempFileName);
rx.Expression := '^\d+$'; rx.Expression := '^\d+$';

View File

@ -278,7 +278,7 @@ end;
procedure TfrmSQLhelp.ButtonOnlinehelpClick(Sender: TObject); procedure TfrmSQLhelp.ButtonOnlinehelpClick(Sender: TObject);
begin begin
// Link/redirect to mysql.com for further help // Link/redirect to mysql.com for further help
ShellExec(GetAppWebsite(True) + 'sqlhelp.php?mysqlversion='+inttostr(MainForm.ActiveConnection.ServerVersionInt)+ ShellExec(APPDOMAIN + 'sqlhelp.php?mysqlversion='+inttostr(MainForm.ActiveConnection.ServerVersionInt)+
'&keyword='+EncodeURLParam(keyword)); '&keyword='+EncodeURLParam(keyword));
end; end;

View File

@ -119,7 +119,7 @@ begin
// Prepare download // Prepare download
CheckfileDownload := THttpDownload.Create(Self); CheckfileDownload := THttpDownload.Create(Self);
CheckfileDownload.TimeOut := 5; CheckfileDownload.TimeOut := 5;
CheckfileDownload.URL := GetAppWebsite(True)+'updatecheck.php?r='+IntToStr(Mainform.AppVerRevision)+'&bits='+IntToStr(GetExecutableBits)+'&t='+DateTimeToStr(Now); CheckfileDownload.URL := APPDOMAIN+'updatecheck.php?r='+IntToStr(Mainform.AppVerRevision)+'&bits='+IntToStr(GetExecutableBits)+'&t='+DateTimeToStr(Now);
CheckFilename := GetTempDir + APPNAME + '_updatecheck.ini'; CheckFilename := GetTempDir + APPNAME + '_updatecheck.ini';
// Download the check file // Download the check file
@ -177,13 +177,13 @@ end;
} }
procedure TfrmUpdateCheck.btnReleaseClick(Sender: TObject); procedure TfrmUpdateCheck.btnReleaseClick(Sender: TObject);
begin begin
ShellExec(GetAppWebsite(True)+'download.php?download=installer'); ShellExec(APPDOMAIN+'download.php?download=installer');
end; end;
procedure TfrmUpdateCheck.btnChangelogClick(Sender: TObject); procedure TfrmUpdateCheck.btnChangelogClick(Sender: TObject);
begin begin
ShellExec(GetAppWebsite(True)+'download.php?place='+EncodeURLParam(TButton(Sender).Name)+'#nightlybuilds'); ShellExec(APPDOMAIN+'download.php?place='+EncodeURLParam(TButton(Sender).Name)+'#nightlybuilds');
end; end;