Changeset 100
- Timestamp:
- Oct 2, 2012, 2:52:20 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Application/UWebObjects.pas
r71 r100 6 6 7 7 uses 8 Classes, SysUtils, UHtmlClasses, UXmlClasses, SpecializedList ;8 Classes, SysUtils, UHtmlClasses, UXmlClasses, SpecializedList, SpecializedDictionary; 9 9 10 10 type … … 47 47 Title: string; 48 48 Rows: TQueryFormItemList; 49 procedure Load(Items: T StringList);49 procedure Load(Items: TDictionaryStringString); 50 50 function AddNewItem: TQueryFormItem; 51 51 constructor Create; … … 68 68 function AddNewGroup: TQueryFormGroup; 69 69 function AddNewAction: TQueryAction; 70 procedure Load(Items: T StringList);70 procedure Load(Items: TDictionaryStringString); 71 71 constructor Create; 72 72 destructor Destroy; override; … … 197 197 end; 198 198 199 procedure TQueryForm.Load(Items: T StringList);199 procedure TQueryForm.Load(Items: TDictionaryStringString); 200 200 var 201 201 I: Integer; … … 223 223 { TQueryFormGroup } 224 224 225 procedure TQueryFormGroup.Load(Items: T StringList);225 procedure TQueryFormGroup.Load(Items: TDictionaryStringString); 226 226 var 227 227 I: Integer; … … 229 229 for I := 0 to Rows.Count - 1 do 230 230 with TQueryFormItem(Rows[I]) do begin 231 if Items. IndexOfName(Value.ItemName) <> -1 then231 if Items.SearchKey(Value.ItemName) <> -1 then 232 232 Value.Value := Items.Values[Value.ItemName]; 233 233 end; -
trunk/Modules/TV/UPageTV.pas
r99 r100 108 108 109 109 Text := '#EXTM3U' + LineEnding; 110 if Request.Query. IndexOf('id') <> -1 then begin110 if Request.Query.SearchKey('id') <> -1 then begin 111 111 Database.Select(DbRows, 'TV', '*', ' (`Stream` <> "") AND (`ShortName`="' + Database.EscapeString(Request.Query.Values['id']) + '") '); 112 112 if DbRows.Count > 0 then begin -
trunk/Modules/User/UUserControlPage.pas
r98 r100 90 90 end; 91 91 end; 92 if HandlerData.Request.Post. IndexOfName('Login') <> -1 then begin92 if HandlerData.Request.Post.SearchKey('Login') <> -1 then begin 93 93 Form.Load(HandlerData.Request.Post); 94 94 with THtmlString(SubItems.AddNew(THtmlString.Create)) do … … 150 150 end; 151 151 end; 152 if HandlerData.Request.Post. IndexOfName('Register') <> -1 then152 if HandlerData.Request.Post.SearchKey('Register') <> -1 then 153 153 with HandlerData.Request do begin 154 154 Form.Load(HandlerData.Request.Post); … … 222 222 end; 223 223 end; 224 if HandlerData.Request.Post. IndexOfName('Save') <> -1 then224 if HandlerData.Request.Post.SearchKey('Save') <> -1 then 225 225 with HandlerData.Request do begin 226 226 Form.Load(HandlerData.Request.Post); -
trunk/Modules/ZdechovNET/UWebCamPage.pas
r97 r100 54 54 //HandlerData.Request.Query.Values['W'] := 'dsd'; 55 55 //HandlerData.Request.Query.Values['H'] := 'dsd'; 56 if HandlerData.Request.Query. IndexOfName('Id') = -1 then CameraId := -156 if HandlerData.Request.Query.SearchKey('Id') = -1 then CameraId := -1 57 57 else CameraId := StrToInt(HandlerData.Request.Query.Values['Id']); 58 if (HandlerData.Request.Query. IndexOfName('W') = -1) then begin58 if (HandlerData.Request.Query.SearchKey('W') = -1) then begin 59 59 ImageWidth := 640; 60 60 end else begin -
trunk/Packages/CoolWeb/Modules/UUser.pas
r98 r100 61 61 try 62 62 DbRows := TDbRows.Create; 63 if HandlerData.Request.Cookies.SearchKey('SessionId') <> -1 then begin 63 64 Database.Query(DbRows, 'SELECT * FROM `UserOnline` WHERE `SessionId`="' + 64 65 HandlerData.Request.Cookies.Values['SessionId'] + '"'); … … 75 76 User := 1; 76 77 end; 78 79 end; 77 80 finally 78 81 DbRows.Free; -
trunk/Packages/CoolWeb/WebServer/UHTTPServer.pas
r96 r100 13 13 EEmptyHTTPHandler = class(Exception); 14 14 15 TQueryParameterList = class(T StringList)15 TQueryParameterList = class(TDictionaryStringString) 16 16 procedure Parse(Text: string); 17 17 function Syntetize: string; … … 20 20 { TCookieList } 21 21 22 TCookieList = class(T StringList)22 TCookieList = class(TDictionaryStringString) 23 23 procedure Parse(Text: string); 24 24 function Syntetize: string; … … 148 148 WriteString('<h5>Request HTTP headers</h5>'); 149 149 for I := 0 to Request.Headers.Count - 1 do begin; 150 WriteString(Request.Headers.Items[I].Value + '<br/>'); 150 with Request.Headers.Items[I] do 151 WriteString(Key + ': ' + Value + '<br/>'); 152 end; 153 154 WriteString('<h5>Request HTTP GET</h5>'); 155 for I := 0 to Request.Query.Count - 1 do begin 156 with Request.Query.Items[I] do 157 WriteString(Key + ': ' + Value + '<br/>'); 151 158 end; 152 159 153 160 WriteString('<h5>Request HTTP cookies</h5>'); 154 for I := 0 to Request.Cookies.Count - 1 do begin; 155 WriteString(Request.Cookies.Strings[I] + '<br/>'); 161 for I := 0 to Request.Cookies.Count - 1 do begin 162 with Request.Cookies.Items[I] do 163 WriteString(Key + ': ' + Value + '<br/>'); 156 164 end; 157 165 158 166 //WriteString('Session id: ' + SessionId); 159 167 WriteString('<h5>Session variables</h5>'); 160 for I := 0 to Session.Count - 1 do begin; 161 WriteString(Session.Strings[I] + '<br/>'); 168 for I := 0 to Session.Count - 1 do begin 169 with Session do 170 WriteString(Names[I] + ': ' + ValueFromIndex[I] + '<br/>'); 162 171 end; 163 172 164 173 WriteString('<h5>Request HTTP POST</h5>'); 165 for I := 0 to Request.Post.Count - 1 do begin; 166 WriteString(Request.Post.Strings[I] + '<br/>'); 174 for I := 0 to Request.Post.Count - 1 do begin 175 with Request.Post.Items[I] do 176 WriteString(Key + ': ' + Value + '<br/>'); 167 177 end; 168 178 … … 173 183 WriteString('<h5>Response HTTP headers</h5>'); 174 184 with Response.Content do 175 for I := 0 to Response.Headers.Count - 1 do begin; 176 WriteString(Response.Headers.Items[I].Value + '<br/>'); 185 for I := 0 to Response.Headers.Count - 1 do begin 186 with Response.Headers.Items[I] do 187 WriteString(Key + ': ' + Value + '<br/>'); 177 188 end; 178 189 179 190 WriteString('<h5>Response HTTP cookies</h5>'); 180 191 for I := 0 to Response.Cookies.Count - 1 do begin; 181 WriteString(Response.Cookies.Strings[I] + '<br/>'); 192 with Response.Cookies.Items[I] do 193 WriteString(Key + ': ' + Value + '<br/>'); 182 194 end; 183 195 end; … … 352 364 Pair.Explode(Parts[I], '=', StrToStr); 353 365 if Pair.Count >= 2 then 354 Values[Pair[0]] := Pair[1];366 Add(Pair[0], Pair[1]); 355 367 end; 356 368 … … 367 379 Result := ''; 368 380 for I := 0 to Count - 1 do 369 Result := Result + '&' + Names[I] + '=' + ValueFromIndex[I];381 Result := Result + '&' + Keys[I] + '=' + Items[I].Value; 370 382 Result := Copy(Result, 6, Length(Result)); 371 383 end; … … 387 399 Pair.Explode(Parts[I], '=', StrToStr); 388 400 if Pair.Count >= 2 then 389 Values[Trim(Pair[0])] := Trim(Pair[1]);401 Add(Trim(Pair[0]), Trim(Pair[1])); 390 402 end; 391 403 finally … … 401 413 Result := ''; 402 414 for I := 0 to Count - 1 do 403 Result := Result + '; ' + Names[I] + '=' + ValueFromIndex[I];415 Result := Result + '; ' + Keys[I] + '=' + Items[I].Value; 404 416 Result := Copy(Result, 2, Length(Result)); 405 417 end; … … 447 459 destructor THTTPHandlerData.Destroy; 448 460 begin 449 Request.Free;450 Response.Free;451 Session.Free;452 inherited Destroy;461 FreeAndNil(Request); 462 FreeAndNil(Response); 463 FreeAndNil(Session); 464 inherited; 453 465 end; 454 466 -
trunk/Packages/CoolWeb/WebServer/UHTTPServerCGI.pas
r84 r100 133 133 // Generate cookies 134 134 for I := 0 to Cookies.Count - 1 do 135 Headers.Add('Set-Cookie', Cookies. Names[I] + '=' + Cookies.ValueFromIndex[I]);135 Headers.Add('Set-Cookie', Cookies.Keys[I] + '=' + Cookies.Items[I].Value); 136 136 // + ';path=/;expires=' + RFC822DateTime(Now); 137 137 -
trunk/Packages/CoolWeb/WebServer/UHTTPServerTCP.pas
r99 r100 121 121 // Handle cookies 122 122 for I := 0 to Cookies.Count - 1 do 123 Headers.Add('Set-Cookie', Cookies. Names[I] + '=' + Cookies.ValueFromIndex[I]);123 Headers.Add('Set-Cookie', Cookies.Keys[I] + '=' + Cookies.Items[I].Value); 124 124 // + ';path=/;expires=' + RFC822DateTime(Now); 125 125 -
trunk/Packages/CoolWeb/WebServer/UHTTPSessionFile.pas
r84 r100 58 58 begin 59 59 with HandlerData do begin 60 if Request.Cookies. IndexOfName(SessionIdCookieName) <> -1 then begin60 if Request.Cookies.SearchKey(SessionIdCookieName) <> -1 then begin 61 61 SessionId := Request.Cookies.Values[SessionIdCookieName]; 62 62 end else begin -
trunk/Packages/CoolWeb/WebServer/UHTTPSessionMySQL.pas
r84 r100 68 68 begin 69 69 with HandlerData do begin 70 if Request.Cookies. IndexOfName(SessionIdCookieName) <> -1 then begin70 if Request.Cookies.SearchKey(SessionIdCookieName) <> -1 then begin 71 71 SessionId := Request.Cookies.Values[SessionIdCookieName]; 72 72 end else begin -
trunk/Packages/TemplateGenerics/Generic/GenericDictionary.inc
r84 r100 99 99 Result := Result + 1; 100 100 end; 101 if Result >= Count then Result := -1; 101 102 end; 102 103 -
trunk/Pages/UPageAdmin.pas
r99 r100 104 104 with TWebSession(HandlerData) do begin 105 105 with HtmlDocument.Body, THtmlString(SubItems.AddNew(THtmlString.Create)) do begin 106 if Request.Query. IndexOfName('name') <> -1 then begin106 if Request.Query.SearchKey('name') <> -1 then begin 107 107 ModuleName := Request.Query.Values['name']; 108 108 Module := Core.ModuleManager.FindModuleByName(ModuleName); … … 126 126 with TWebSession(HandlerData) do begin 127 127 with HtmlDocument.Body, THtmlString(SubItems.AddNew(THtmlString.Create)) do begin 128 if Request.Query. IndexOfName('name') <> -1 then begin128 if Request.Query.SearchKey('name') <> -1 then begin 129 129 ModuleName := Request.Query.Values['name']; 130 130 Module := Core.ModuleManager.FindModuleByName(ModuleName); -
trunk/ZdechovNET.lpi
r99 r100 244 244 <IsPartOfProject Value="True"/> 245 245 <HasResources Value="True"/> 246 <UnitName Value="UWebCamPage"/> 246 247 </Unit22> 247 248 <Unit23>
Note:
See TracChangeset
for help on using the changeset viewer.