Subversion Repositories fastphp

Compare Revisions

Regard whitespace Rev 61 → Rev 91

/trunk/BrowserMain.pas
15,6 → 15,7
TForm2 = class(TForm)
WebBrowser1: TWebBrowser;
Timer1: TTimer;
OpenDialog3: TOpenDialog;
procedure Timer1Timer(Sender: TObject);
procedure WebBrowser1BeforeNavigate2(ASender: TObject;
const pDisp: IDispatch; const URL, Flags, TargetFrameName, PostData,
129,6 → 130,11
var
phpScript: string;
sl: TStringList;
resourcestring
SRunningScriptPleaseWait = 'Running script... please wait...';
SPleaseEnterPHPScript = 'Please enter a PHP file to execute.';
SFileDoesNotExist = 'File %s does not exist.';
SFastPHP = 'ViaThinkSoft FastPHP';
begin
Timer1.Enabled := false;
phpScript := ParamStr(1);
136,18 → 142,22
// Remove Security
WebBrowser1.ServiceQuery := EmbeddedWBQueryService;
 
WebBrowser1.LoadHTML('<h1>FastPHP</h1>Running script... please wait...');
WebBrowser1.LoadHTML('<h1>'+SFastPHP+'</h1>'+SRunningScriptPleaseWait);
 
// TODO: nice HTML error/intro pages (as resource?)
if phpScript = '' then
begin
WebBrowser1.LoadHTML('<h1>FastPHP</h1>Please enter a PHP file to execute.');
WebBrowser1.LoadHTML('<h1>'+SFastPHP+'</h1>'+SPleaseEnterPHPScript);
if not OpenDialog3.Execute then
begin
Abort;
end;
phpScript := OpenDialog3.FileName;
end;
 
if not FileExists(phpScript) then
begin
WebBrowser1.LoadHTML(Format('<h1>FastPHP</h1>File %s does not exist.', [phpScript]));
WebBrowser1.LoadHTML(Format('<h1>'+SFastPHP+'</h1>'+SFileDoesNotExist, [phpScript]));
Abort;
end;
 
177,14 → 187,16
p: integer;
background: boolean;
ArgGet, ArgPost, ArgHeader: string;
resourcestring
SOnlyWorksInEditor = 'This action only works in FastPHP editor.';
begin
background := Pos('background|', URL) >= 1;
background := Pos('background|', URL) >= 1; // do not translate
 
{$REGION 'Line number references (PHP errors and warnings)'}
if Copy(URL, 1, length(FASTPHP_GOTO_URI_PREFIX)) = FASTPHP_GOTO_URI_PREFIX then
begin
// TODO: maybe we could even open that file in the editor!
ShowMessage('This action only works in FastPHP editor.');
ShowMessage(SOnlyWorksInEditor);
Cancel := true;
Exit;
end;
195,7 → 207,7
begin
myUrl := URL;
 
myurl := StringReplace(myurl, 'background|', '', []);
myurl := StringReplace(myurl, 'background|', '', []); // do not translate
 
p := Pos('?', myUrl);
if p >= 1 then