Changeset 142
Legend:
- Unmodified
- Added
- Removed
-
devel/web/.htaccess
r137 r142 2 2 Options +ExecCGI 3 3 DirectoryIndex index.cgi 4 5 <FilesMatch "\.(pas|o|ppu|lpi|a)$"> 6 Deny from all 7 </FilesMatch> -
devel/web/UDatabase.pas
r139 r142 9 9 10 10 type 11 TDatabase = class; 11 12 12 13 { TDbObject } … … 14 15 TDbObject = class 15 16 Id: Integer; 17 Loaded: Boolean; 18 Database: TDatabase; 16 19 procedure Store; virtual; 20 procedure Load; virtual; 17 21 procedure Delete; 22 constructor Create; 23 destructor Destroy; override; 18 24 end; 25 26 TDbObjectClass = class of TDbObject; 19 27 20 28 { TDbList } 21 29 22 30 TDbList = class 31 Id: Integer; 32 Database: TDatabase; 33 ItemClassType: TDbObjectClass; 23 34 Items: TList; 24 35 constructor Create; 25 36 destructor Destroy; override; 37 function Add: TDbObject; 38 procedure Store; 39 procedure Load; 26 40 end; 27 41 … … 35 49 { TDatabase } 36 50 37 TDatabase = class 38 SqlDatabase: TSqlDatabase; 39 procedure Open; 40 procedure Close; 51 TDatabase = class(TSqlDatabase) 52 BaseObject: TDbObject; 53 constructor Create; 54 destructor Destroy; override; 55 procedure Init; 41 56 end; 42 57 … … 48 63 end; 49 64 65 procedure TDbObject.Load; 66 begin 67 68 end; 69 50 70 procedure TDbObject.Delete; 51 71 begin 52 72 73 end; 74 75 constructor TDbObject.Create; 76 begin 77 end; 78 79 destructor TDbObject.Destroy; 80 begin 81 inherited Destroy; 53 82 end; 54 83 … … 70 99 end; 71 100 101 function TDbList.Add: TDbObject; 102 var 103 Data: TAssocArray; 104 begin 105 Result := ItemClassType.Create; 106 Data := TAssocArray.Create; 107 Data.AddKeyValue('id', ''); 108 Database.Insert(ClassName, Data); 109 Result.Id := Database.LastInsertId;; 110 Items.Add(Result); 111 end; 112 113 procedure TDbList.Store; 114 var 115 I: Integer; 116 Data: TAssocArray; 117 begin 118 Data := TAssocArray.Create; 119 Database.Insert(ClassName, Data); 120 for I := 0 to Items.Count - 1 do begin 121 Database.Insert(ClassName, Data); 122 end; 123 end; 124 125 procedure TDbList.Load; 126 begin 127 128 end; 129 72 130 { TDbResultSet } 73 131 … … 83 141 { TDatabase } 84 142 85 procedure TDatabase.Open;143 constructor TDatabase.Create; 86 144 begin 87 145 BaseObject := TDbObject.Create;; 88 146 end; 89 147 90 procedure TDatabase.Close;148 destructor TDatabase.Destroy; 91 149 begin 150 BaseObject.Free; 151 end; 92 152 153 procedure TDatabase.Init; 154 begin 155 BaseObject.Id := 1; 156 BaseObject.Database := Self; 157 BaseObject.Load; 93 158 end; 94 159 -
devel/web/USqlDatabase.pas
r134 r142 153 153 I: Integer; 154 154 Value: string; 155 DbRows: TDbRows; 155 156 begin 156 157 Table := ATable; … … 166 167 System.Delete(DbNames, 1, 1); 167 168 System.Delete(DbValues, 1, 1); 168 Query('INSERT INTO `' + Table + '` (' + DbNames + ') VALUES (' + DbValues + ')'); 169 DbRows := Query('INSERT INTO `' + Table + '` (' + DbNames + ') VALUES (' + DbValues + ')'); 170 DbRows.Free; 169 171 end; 170 172 … … 219 221 Value: string; 220 222 I: Integer; 223 DbRows: TDbRows; 221 224 begin 222 225 Table := ATable; … … 232 235 System.Delete(DbNames, 1, 1); 233 236 System.Delete(DbValues, 1, 1); 234 Query('REPLACE INTO `' + Table + '` (' + DbNames + ') VALUES (' + DbValues + ')'); 237 DbRows := Query('REPLACE INTO `' + Table + '` (' + DbNames + ') VALUES (' + DbValues + ')'); 238 DbRows.Free; 235 239 end; 236 240 … … 246 250 Value: string; 247 251 I: Integer; 252 DbRows: TDbRows; 248 253 begin 249 254 Table := ATable; … … 256 261 end; 257 262 System.Delete(DbValues, 1, 1); 258 Query('UPDATE `' + Table + '` SET (' + DbValues + ') WHERE ' + Condition); 263 DbRows := Query('UPDATE `' + Table + '` SET (' + DbValues + ') WHERE ' + Condition); 264 DBRows.Free; 259 265 end; 260 266 … … 302 308 303 309 procedure TSqlDatabase.Delete(ATable: string; Condition: string = '1'); 310 var 311 DbRows: TDbRows; 304 312 begin 305 313 Table := ATable; 306 Query('DELETE FROM `' + Table + '` WHERE ' + Condition); 314 DbRows := Query('DELETE FROM `' + Table + '` WHERE ' + Condition); 315 DbRows.Free; 307 316 end; 308 317 -
devel/web/UUser.pas
r139 r142 13 13 14 14 TUser = class(TDbObject) 15 SubjectName: string; 15 16 FirstName: string; 16 17 SecondName: string; … … 19 20 Password: string; 20 21 UserName: string; 22 Town: string; 23 Street: string; 24 PSC: string; 25 IC: Integer; 26 DIC: string; 21 27 procedure LoadFromDbRecord(DbRow: TAssocArray); 22 28 procedure Store; override; -
devel/web/index.lpi
r139 r142 12 12 <MainUnit Value="0"/> 13 13 <TargetFileExt Value=".exe"/> 14 <ActiveEditorIndexAtStart Value=" 2"/>14 <ActiveEditorIndexAtStart Value="3"/> 15 15 </General> 16 16 <VersionInfo> … … 29 29 </local> 30 30 </RunParams> 31 <Units Count="2 3">31 <Units Count="24"> 32 32 <Unit0> 33 33 <Filename Value="index.pas"/> 34 34 <IsPartOfProject Value="True"/> 35 35 <UnitName Value="Index"/> 36 <CursorPos X=" 37" Y="7"/>37 <TopLine Value="1"/> 38 <EditorIndex Value=" 3"/>39 <UsageCount Value=" 57"/>36 <CursorPos X="44" Y="7"/> 37 <TopLine Value="1"/> 38 <EditorIndex Value="4"/> 39 <UsageCount Value="90"/> 40 40 <Loaded Value="True"/> 41 41 </Unit0> … … 46 46 <CursorPos X="80" Y="21"/> 47 47 <TopLine Value="1"/> 48 <EditorIndex Value=" 5"/>49 <UsageCount Value=" 57"/>48 <EditorIndex Value="6"/> 49 <UsageCount Value="90"/> 50 50 <Loaded Value="True"/> 51 51 </Unit1> … … 54 54 <IsPartOfProject Value="True"/> 55 55 <UnitName Value="USqlDatabase"/> 56 <CursorPos X=" 74" Y="69"/>57 <TopLine Value=" 45"/>56 <CursorPos X="3" Y="111"/> 57 <TopLine Value="197"/> 58 58 <EditorIndex Value="0"/> 59 <UsageCount Value=" 57"/>59 <UsageCount Value="90"/> 60 60 <Loaded Value="True"/> 61 61 </Unit2> … … 63 63 <Filename Value="UXmlClasses.pas"/> 64 64 <IsPartOfProject Value="True"/> 65 <UsageCount Value=" 57"/>65 <UsageCount Value="90"/> 66 66 </Unit3> 67 67 <Unit4> … … 69 69 <IsPartOfProject Value="True"/> 70 70 <UnitName Value="UCore"/> 71 <CursorPos X=" 21" Y="33"/>72 <TopLine Value=" 15"/>73 <EditorIndex Value=" 8"/>74 <UsageCount Value=" 57"/>71 <CursorPos X="10" Y="96"/> 72 <TopLine Value="76"/> 73 <EditorIndex Value="9"/> 74 <UsageCount Value="90"/> 75 75 <Loaded Value="True"/> 76 76 </Unit4> … … 81 81 <CursorPos X="1" Y="1"/> 82 82 <TopLine Value="81"/> 83 <UsageCount Value=" 57"/>83 <UsageCount Value="90"/> 84 84 </Unit5> 85 85 <Unit6> … … 89 89 <CursorPos X="31" Y="19"/> 90 90 <TopLine Value="11"/> 91 <EditorIndex Value="1 0"/>92 <UsageCount Value=" 57"/>91 <EditorIndex Value="11"/> 92 <UsageCount Value="90"/> 93 93 <Loaded Value="True"/> 94 94 </Unit6> … … 99 99 <CursorPos X="34" Y="30"/> 100 100 <TopLine Value="17"/> 101 <UsageCount Value=" 57"/>101 <UsageCount Value="90"/> 102 102 </Unit7> 103 103 <Unit8> … … 105 105 <IsPartOfProject Value="True"/> 106 106 <UnitName Value="UNews"/> 107 <CursorPos X="1 7" Y="232"/>108 <TopLine Value=" 1"/>109 <EditorIndex Value=" 9"/>110 <UsageCount Value=" 57"/>107 <CursorPos X="15" Y="49"/> 108 <TopLine Value="34"/> 109 <EditorIndex Value="10"/> 110 <UsageCount Value="90"/> 111 111 <Loaded Value="True"/> 112 112 </Unit8> … … 115 115 <IsPartOfProject Value="True"/> 116 116 <UnitName Value="UNewsPage"/> 117 <CursorPos X=" 81" Y="123"/>118 <TopLine Value=" 96"/>119 <EditorIndex Value=" 7"/>120 <UsageCount Value=" 57"/>117 <CursorPos X="28" Y="149"/> 118 <TopLine Value="109"/> 119 <EditorIndex Value="8"/> 120 <UsageCount Value="90"/> 121 121 <Loaded Value="True"/> 122 122 </Unit9> … … 126 126 <CursorPos X="10" Y="94"/> 127 127 <TopLine Value="81"/> 128 <UsageCount Value=" 6"/>128 <UsageCount Value="4"/> 129 129 </Unit10> 130 130 <Unit11> … … 132 132 <CursorPos X="26" Y="17"/> 133 133 <TopLine Value="121"/> 134 <UsageCount Value=" 6"/>134 <UsageCount Value="4"/> 135 135 </Unit11> 136 136 <Unit12> … … 138 138 <CursorPos X="4" Y="33"/> 139 139 <TopLine Value="18"/> 140 <UsageCount Value=" 6"/>140 <UsageCount Value="4"/> 141 141 </Unit12> 142 142 <Unit13> … … 145 145 <CursorPos X="24" Y="364"/> 146 146 <TopLine Value="351"/> 147 <UsageCount Value=" 21"/>147 <UsageCount Value="19"/> 148 148 </Unit13> 149 149 <Unit14> 150 <Filename Value=" urss.pas"/>150 <Filename Value="URSS.pas"/> 151 151 <IsPartOfProject Value="True"/> 152 152 <UnitName Value="URSS"/> 153 <CursorPos X="56" Y=" 86"/>154 <TopLine Value=" 42"/>155 <EditorIndex Value="1 1"/>156 <UsageCount Value=" 45"/>153 <CursorPos X="56" Y="16"/> 154 <TopLine Value="1"/> 155 <EditorIndex Value="12"/> 156 <UsageCount Value="78"/> 157 157 <Loaded Value="True"/> 158 158 </Unit14> … … 161 161 <CursorPos X="10" Y="117"/> 162 162 <TopLine Value="115"/> 163 <UsageCount Value=" 8"/>163 <UsageCount Value="6"/> 164 164 </Unit15> 165 165 <Unit16> … … 167 167 <CursorPos X="3" Y="624"/> 168 168 <TopLine Value="34"/> 169 <UsageCount Value=" 8"/>169 <UsageCount Value="6"/> 170 170 </Unit16> 171 171 <Unit17> 172 <Filename Value=" uconfig.pas"/>172 <Filename Value="UConfig.pas"/> 173 173 <IsPartOfProject Value="True"/> 174 174 <UnitName Value="UConfig"/> 175 175 <CursorPos X="28" Y="14"/> 176 176 <TopLine Value="1"/> 177 <EditorIndex Value=" 4"/>178 <UsageCount Value=" 32"/>177 <EditorIndex Value="5"/> 178 <UsageCount Value="65"/> 179 179 <Loaded Value="True"/> 180 180 </Unit17> … … 184 184 <CursorPos X="1" Y="134"/> 185 185 <TopLine Value="108"/> 186 <UsageCount Value=" 32"/>186 <UsageCount Value="65"/> 187 187 <SyntaxHighlighter Value="None"/> 188 188 </Unit18> … … 192 192 <CursorPos X="1" Y="1"/> 193 193 <TopLine Value="1"/> 194 <UsageCount Value=" 32"/>194 <UsageCount Value="65"/> 195 195 <SyntaxHighlighter Value="JScript"/> 196 196 </Unit19> 197 197 <Unit20> 198 <Filename Value=" udatabase.pas"/>198 <Filename Value="UDatabase.pas"/> 199 199 <IsPartOfProject Value="True"/> 200 200 <UnitName Value="UDatabase"/> 201 <CursorPos X=" 3" Y="52"/>202 <TopLine Value=" 50"/>201 <CursorPos X="26" Y="52"/> 202 <TopLine Value="23"/> 203 203 <EditorIndex Value="1"/> 204 <UsageCount Value=" 26"/>204 <UsageCount Value="59"/> 205 205 <Loaded Value="True"/> 206 206 </Unit20> 207 207 <Unit21> 208 <Filename Value=" uuser.pas"/>208 <Filename Value="UUser.pas"/> 209 209 <IsPartOfProject Value="True"/> 210 210 <UnitName Value="UUser"/> 211 <CursorPos X="4 7" Y="52"/>212 <TopLine Value=" 34"/>213 <EditorIndex Value=" 6"/>214 <UsageCount Value=" 26"/>211 <CursorPos X="41" Y="34"/> 212 <TopLine Value="16"/> 213 <EditorIndex Value="7"/> 214 <UsageCount Value="59"/> 215 215 <Loaded Value="True"/> 216 216 </Unit21> 217 217 <Unit22> 218 <Filename Value=" uuserpage.pas"/>218 <Filename Value="UUserPage.pas"/> 219 219 <IsPartOfProject Value="True"/> 220 220 <UnitName Value="UUserPage"/> 221 <CursorPos X=" 69" Y="18"/>222 <TopLine Value=" 5"/>221 <CursorPos X="55" Y="23"/> 222 <TopLine Value="1"/> 223 223 <EditorIndex Value="2"/> 224 <UsageCount Value=" 22"/>224 <UsageCount Value="55"/> 225 225 <Loaded Value="True"/> 226 226 </Unit22> 227 <Unit23> 228 <Filename Value="UBill.pas"/> 229 <IsPartOfProject Value="True"/> 230 <UnitName Value="UBill"/> 231 <CursorPos X="25" Y="156"/> 232 <TopLine Value="136"/> 233 <EditorIndex Value="3"/> 234 <UsageCount Value="52"/> 235 <Loaded Value="True"/> 236 </Unit23> 227 237 </Units> 228 238 <JumpHistory Count="30" HistoryIndex="29"> 229 239 <Position1> 230 <Filename Value="U MainPage.pas"/>231 <Caret Line=" 138" Column="17" TopLine="111"/>240 <Filename Value="UDatabase.pas"/> 241 <Caret Line="28" Column="1" TopLine="1"/> 232 242 </Position1> 233 243 <Position2> 234 <Filename Value=" index.pas"/>235 <Caret Line=" 7" Column="33" TopLine="1"/>244 <Filename Value="UDatabase.pas"/> 245 <Caret Line="63" Column="1" TopLine="27"/> 236 246 </Position2> 237 247 <Position3> 238 <Filename Value=" uuser.pas"/>239 <Caret Line=" 14" Column="3" TopLine="1"/>248 <Filename Value="UDatabase.pas"/> 249 <Caret Line="97" Column="34" TopLine="79"/> 240 250 </Position3> 241 251 <Position4> 242 <Filename Value=" udatabase.pas"/>243 <Caret Line=" 19" Column="3" TopLine="9"/>252 <Filename Value="UDatabase.pas"/> 253 <Caret Line="32" Column="23" TopLine="14"/> 244 254 </Position4> 245 255 <Position5> 246 <Filename Value=" uuser.pas"/>247 <Caret Line=" 43" Column="5" TopLine="7"/>256 <Filename Value="UDatabase.pas"/> 257 <Caret Line="12" Column="14" TopLine="1"/> 248 258 </Position5> 249 259 <Position6> 250 <Filename Value=" uuser.pas"/>251 <Caret Line=" 42" Column="12" TopLine="11"/>260 <Filename Value="UDatabase.pas"/> 261 <Caret Line="98" Column="35" TopLine="80"/> 252 262 </Position6> 253 263 <Position7> 254 <Filename Value=" udatabase.pas"/>255 <Caret Line="1 3" Column="31" TopLine="1"/>264 <Filename Value="UUser.pas"/> 265 <Caret Line="16" Column="1" TopLine="1"/> 256 266 </Position7> 257 267 <Position8> 258 <Filename Value="U News.pas"/>259 <Caret Line="1 73" Column="5" TopLine="137"/>268 <Filename Value="UBill.pas"/> 269 <Caret Line="151" Column="57" TopLine="141"/> 260 270 </Position8> 261 271 <Position9> 262 <Filename Value="U News.pas"/>263 <Caret Line="1 78" Column="8" TopLine="171"/>272 <Filename Value="UDatabase.pas"/> 273 <Caret Line="117" Column="25" TopLine="96"/> 264 274 </Position9> 265 275 <Position10> 266 <Filename Value="U Core.pas"/>267 <Caret Line=" 33" Column="21" TopLine="15"/>276 <Filename Value="UDatabase.pas"/> 277 <Caret Line="83" Column="5" TopLine="47"/> 268 278 </Position10> 269 279 <Position11> 270 <Filename Value="U News.pas"/>271 <Caret Line=" 23" Column="3" TopLine="21"/>280 <Filename Value="UDatabase.pas"/> 281 <Caret Line="138" Column="20" TopLine="108"/> 272 282 </Position11> 273 283 <Position12> 274 <Filename Value="U News.pas"/>275 <Caret Line=" 65" Column="1" TopLine="64"/>284 <Filename Value="UDatabase.pas"/> 285 <Caret Line="139" Column="18" TopLine="108"/> 276 286 </Position12> 277 287 <Position13> 278 <Filename Value="U News.pas"/>279 <Caret Line=" 72" Column="50" TopLine="64"/>288 <Filename Value="UDatabase.pas"/> 289 <Caret Line="49" Column="27" TopLine="36"/> 280 290 </Position13> 281 291 <Position14> 282 <Filename Value="U News.pas"/>283 <Caret Line=" 74" Column="45" TopLine="53"/>292 <Filename Value="UDatabase.pas"/> 293 <Caret Line="105" Column="8" TopLine="87"/> 284 294 </Position14> 285 295 <Position15> 286 <Filename Value="U News.pas"/>287 <Caret Line=" 73" Column="61" TopLine="55"/>296 <Filename Value="UDatabase.pas"/> 297 <Caret Line="48" Column="34" TopLine="35"/> 288 298 </Position15> 289 299 <Position16> 290 <Filename Value=" uuser.pas"/>291 <Caret Line=" 27" Column="3" TopLine="25"/>300 <Filename Value="UDatabase.pas"/> 301 <Caret Line="106" Column="24" TopLine="88"/> 292 302 </Position16> 293 303 <Position17> 294 <Filename Value=" udatabase.pas"/>295 <Caret Line="1 4" Column="3" TopLine="2"/>304 <Filename Value="UDatabase.pas"/> 305 <Caret Line="137" Column="1" TopLine="105"/> 296 306 </Position17> 297 307 <Position18> 298 <Filename Value=" udatabase.pas"/>299 <Caret Line=" 28" Column="3" TopLine="25"/>308 <Filename Value="UDatabase.pas"/> 309 <Caret Line="133" Column="17" TopLine="105"/> 300 310 </Position18> 301 311 <Position19> 302 <Filename Value=" udatabase.pas"/>303 <Caret Line=" 36" Column="3" TopLine="34"/>312 <Filename Value="UDatabase.pas"/> 313 <Caret Line="48" Column="27" TopLine="30"/> 304 314 </Position19> 305 315 <Position20> 306 <Filename Value=" uuserpage.pas"/>307 <Caret Line=" 17" Column="5" TopLine="1"/>316 <Filename Value="UBill.pas"/> 317 <Caret Line="292" Column="26" TopLine="265"/> 308 318 </Position20> 309 319 <Position21> 310 <Filename Value=" udatabase.pas"/>311 <Caret Line="3 7" Column="31" TopLine="11"/>320 <Filename Value="UBill.pas"/> 321 <Caret Line="304" Column="5" TopLine="268"/> 312 322 </Position21> 313 323 <Position22> 314 <Filename Value=" udatabase.pas"/>315 <Caret Line="31 " Column="18" TopLine="13"/>324 <Filename Value="UBill.pas"/> 325 <Caret Line="312" Column="44" TopLine="278"/> 316 326 </Position22> 317 327 <Position23> 318 <Filename Value=" udatabase.pas"/>319 <Caret Line="7 5" Column="14" TopLine="54"/>328 <Filename Value="UBill.pas"/> 329 <Caret Line="72" Column="3" TopLine="54"/> 320 330 </Position23> 321 331 <Position24> 322 <Filename Value=" udatabase.pas"/>323 <Caret Line=" 53" Column="5" TopLine="17"/>332 <Filename Value="UBill.pas"/> 333 <Caret Line="310" Column="49" TopLine="282"/> 324 334 </Position24> 325 335 <Position25> 326 <Filename Value=" uuser.pas"/>327 <Caret Line=" 29" Column="23" TopLine="1"/>336 <Filename Value="UBill.pas"/> 337 <Caret Line="313" Column="15" TopLine="281"/> 328 338 </Position25> 329 339 <Position26> 330 <Filename Value=" uuser.pas"/>331 <Caret Line=" 73" Column="5" TopLine="37"/>340 <Filename Value="USqlDatabase.pas"/> 341 <Caret Line="369" Column="15" TopLine="337"/> 332 342 </Position26> 333 343 <Position27> 334 <Filename Value=" uuser.pas"/>335 <Caret Line=" 72" Column="3" TopLine="40"/>344 <Filename Value="UDatabase.pas"/> 345 <Caret Line="114" Column="5" TopLine="78"/> 336 346 </Position27> 337 347 <Position28> 338 <Filename Value=" uuser.pas"/>339 <Caret Line=" 44" Column="39" TopLine="26"/>348 <Filename Value="UDatabase.pas"/> 349 <Caret Line="124" Column="5" TopLine="88"/> 340 350 </Position28> 341 351 <Position29> 342 <Filename Value=" uuserpage.pas"/>343 <Caret Line=" 29" Column="33" TopLine="3"/>352 <Filename Value="UBill.pas"/> 353 <Caret Line="133" Column="21" TopLine="97"/> 344 354 </Position29> 345 355 <Position30> 346 <Filename Value=" uuserpage.pas"/>347 <Caret Line=" 23" Column="48" TopLine="1"/>356 <Filename Value="UDatabase.pas"/> 357 <Caret Line="38" Column="17" TopLine="27"/> 348 358 </Position30> 349 359 </JumpHistory> -
devel/web/index.pas
r139 r142 5 5 uses 6 6 UCore, USqlDatabase, SysUtils, UMainPage, pwinit, pwmain, 7 UFinancePage, UNewsPage, UUserPage ;7 UFinancePage, UNewsPage, UUserPage, UBill; 8 8 9 9 var
Note:
See TracChangeset
for help on using the changeset viewer.