1
<?php
2
/**
3
 *   File functions:
4
 *   Players houses
5
 *
6
 *   @name                 : house.php                            
7
 *   @copyright            : (C) 2004,2005,2006,2007 Vallheru Team based on Gamers-Fusion ver 2.5
8
 *   @author               : thindil <thindil@users.sourceforge.net>
9
 *   @author               : eyescream <tduda@users.sourceforge.net>
10
 *   @version              : 1.3
11
 *   @since                : 03.03.2007
12
 *
13
 */
14
15
//
16
//
17
//       This program is free software; you can redistribute it and/or modify
18
//   it under the terms of the GNU General Public License as published by
19
//   the Free Software Foundation; either version 2 of the License, or
20
//   (at your option) any later version.
21
//
22
//   This program is distributed in the hope that it will be useful,
23
//   but WITHOUT ANY WARRANTY; without even the implied warranty of
24
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
25
//   GNU General Public License for more details.
26
//
27
//   You should have received a copy of the GNU General Public License
28
//   along with this program; if not, write to the Free Software
29
//   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
30
//
31
// $Id: house.php 918 2007-03-03 17:55:42Z thindil $
32
33
$title = "Domy graczy";
34
require_once("includes/head.php");
35
36
/**
37
* Get the localization for game
38
*/
39
require_once("languages/".$player -> lang."/house.php");
40
41
if ($player -> location != 'Altara' && $player -> location != 'Ardulith') 
42
{
43
    error (ERROR);
44
}
45
46
/**
47
 * Function return  house type (palace, village house, etc)
48
 */
49
function housetype($intHousevalue, $intHousebuild)
50
{
51
    $strHousename = H_RANK1;
52
    if ($intHousevalue > 5 && $intHousebuild > 3) 
53
    {
54
        $strHousename = H_RANK2;
55
    }
56
    if ($intHousevalue > 20 && $intHousebuild > 5) 
57
    {
58
        $strHousename = H_RANK3;
59
    }
60
    if ($intHousevalue > 50 && $intHousebuild > 10) 
61
    {
62
        $strHousename = H_RANK4;
63
    }
64
    if ($intHousevalue > 99 && $intHousebuild > 20) 
65
    {
66
        $strHousename = H_RANK5;
67
    }
68
    return $strHousename;
69
}
70
71
$house = $db -> Execute("SELECT * FROM houses WHERE location='".$player -> location."' AND (owner=".$player -> id." OR locator=".$player -> id.")");
72
73
/**
74
* Assign variables to template
75
*/
76
$smarty -> assign(array("Message" => '', 
77
    "Bedroomlink" => '', 
78
    "Locatorlink" => '', 
79
    "Buildbed" => '', 
80
    "Buildwardrobe" => '', 
81
    "Upgrade" => '', 
82
    "Wardrobelink" => '', 
83
    "Buildhouse" => ''));
84
85
/**
86
* Buy areas for house
87
*/
88
if (isset ($_GET['action']) && $_GET['action'] == 'land') 
89
{
90
    if (!$house -> fields['id']) 
91
    {
92
        $cost = T_FORT.COST1;
93
    } 
94
        else 
95
    {
96
        $cost1 = $house -> fields['size'] * 5000;
97
        $cost2 =$house -> fields['size']*10;
98
        $cost = T_FORT.$cost1.GOLD_COINS.T_AND.$cost2.MITHRIL_INFO;
99
    }
100
    $smarty -> assign (array("Cost" => $cost,
101
        "Landinfo" => LAND_INFO,
102
        "Buya" => BUY_A,
103
        "Aback" => A_BACK));
104
    if (isset ($_GET['step']) && $_GET['step'] == 'buy') 
105
    {
106
        if (!$house -> fields['id']) 
107
        {
108
            if ($player -> platinum < 20) 
109
            {
110
                error (NO_MITH);
111
            }
112
            $db -> Execute("INSERT INTO houses (owner, location) VALUES(".$player -> id.", '".$player -> location."')") or error (COULD_NOT);
113
            $db -> Execute("UPDATE players SET platinum=platinum-20 WHERE id=".$player -> id);
114
            error (BUY_AREA."<a href=house.php?action=build>".WORKSHOP."</a>".FOR_A);
115
        } 
116
            else 
117
        {
118
            if ($player -> credits < $cost1) 
119
            {
120
                error (NO_GOLD);
121
            }
122
            if ($player -> platinum < $cost2) 
123
            {
124
                error (NO_MITH);
125
            }
126
            $db -> Execute("UPDATE houses SET size=size+1 WHERE id=".$house -> fields['id']);
127
            $db -> Execute("UPDATE players SET credits=credits-".$cost1.", platinum=platinum-".$cost2." WHERE id=".$player -> id);
128
            error (BUY_AREA2);
129
        }
130
    }
131
}
132
133
/**
134
* Builder workshop
135
*/
136
if(isset ($_GET['action']) && $_GET['action'] == 'build') 
137
{
138
    $smarty -> assign(array("Points" => $house -> fields['points'],
139
                            "Buildinfo" => BUILD_INFO,
140
                            "Buildinfo2" => BUILD_INFO2,
141
                            "Aback" => A_BACK));
142
    if ($house -> fields['points'] == 0) 
143
    {
144
        error (NO_POINTS);
145
    }
146
    if ($house -> fields['build'] == 0) 
147
    {
148
        $smarty -> assign ("Buildhouse", "<a href=house.php?action=build&amp;step=new>".B_HOUSE);
149
    } 
150
        else 
151
    {
152
        if ($house -> fields['build'] < $house -> fields['size'] && $house -> fields['points'] > 9) 
153
        {
154
            $cost = 10000 * $house -> fields['build'];
155
            $cost_mithril = 10* $house -> fields['build'];
156
            $cost_pine = 20* $house -> fields['build'];
157
            $smarty -> assign ("Buildhouse", "<a href=house.php?action=build&amp;step=add>".U_HOUSE.$cost.GOLD_COINS.$cost_mithril.MITH_COST.$cost_pine.PINE_COST."<br />");
158
        }
159
        if ($house -> fields['used'] < $house -> fields['build'] && $house -> fields['points'] > 9) 
160
        {
161
            if ($house -> fields['bedroom'] == 'N') 
162
            {
163
                $smarty -> assign ("Buildbed", "<a href=house.php?action=build&amp;step=bedroom>".B_BEDROOM);
164
            }
165
            $cost = $house -> fields['wardrobe'] * 10000;
166
            $cost_pine = 150;
167
            if ($cost == 0) 
168
            {
169
                $cost = 10000;
170
            }
171
            $smarty -> assign ("Buildwardrobe", "<a href=house.php?action=build&amp;step=wardrobe>".B_WARDROBE.$cost.GOLD_COINS.$cost_pine.PINE_COST."<br />");
172
        }
173
        if ($house -> fields['points'] > 0) 
174
        {
175
            $smarty -> assign ("Upgrade", "<a href=house.php?action=build&amp;step=upgrade>".HOUSE_B."</a><br />");
176
        }
177
    }
178
    if (isset ($_GET['step']) && $_GET['step'] == 'new')
179
    {
180
        $query = $db -> Execute("SELECT `pine` FROM `minerals` WHERE `owner`=".$player -> id);
181
        $pine_costs = $query -> fields['pine'];
182
        $query -> Close();	
183
        if (!$house -> fields['id']) 
184
        {
185
            error (NO_AREA);
186
        }
187
        if ($house -> fields['build'] > 0) 
188
        {
189
            error (YOU_HAVE);
190
        }
191
        if ($player -> credits < 10000) 
192
        {
193
            error (NO_GOLD);
194
        }
195
        if ($player -> platinum < 50) 
196
        {
197
            error (NO_MITH);
198
        }
199
        if ($pine_costs < 200) 
200
        {
201
            error (NO_PINE);
202
        }
203
        if ($house -> fields['points'] < 50) 
204
        {
205
            error (NO_POINTS);
206
        }
207
        $smarty -> assign(array("Hname" => H_NAME,
208
            "Abuild" => A_BUILD));
209
        if (isset ($_GET['step2']) && $_GET['step2'] == 'make') 
210
        {
211
            $_POST['name'] = strip_tags($_POST['name']);
212
            $strName = $db -> qstr($_POST['name'], get_magic_quotes_gpc());
213
            $db -> Execute("UPDATE `houses` SET `name`=".$strName.", `build`=`build`+1, `points`=`points`-50 WHERE `id`=".$house -> fields['id']);
214
            $db -> Execute("UPDATE `players` SET `credits`=`credits`-10000, `platinum`=`platinum`-50 WHERE `id`=".$player -> id);
215
            $db -> Execute("UPDATE `minerals` SET `pine`=`pine`- 200 WHERE `owner`=".$player -> id);
216
            error (YOU_BUILD);
217
        }
218
    }
219
    if (isset ($_GET['step']) && $_GET['step'] == 'add') 
220
    {
221
        if (!$house -> fields['id']) {
222
            error (NO_AREA);
223
        }
224
        if ($house -> fields['size'] == $house -> fields['build']) 
225
        {
226
            error (NO_FIELDS);
227
        }
228
        $cost = 10000 * $house -> fields['build'];
229
        $cost_mithril = 10* $house -> fields['build'];
230
        $cost_pine = 20* $house -> fields['build'];
231
        $query = $db -> Execute("SELECT `pine` FROM `minerals` WHERE `owner`=".$player -> id);
232
        $pine_costs = $query -> fields['pine'];
233
        $query -> Close();	
234
235
        if ($player -> credits < $cost) 
236
        {
237
            error (NO_GOLD);
238
        }
239
        if ($player -> platinum < $cost_mithril) 
240
        {
241
            error (NO_MITH);
242
        }
243
        if ($pine_costs < $cost_pine) 
244
        {
245
            error (NO_PINE);
246
        }
247
        if ($house -> fields['points'] < 20) 
248
        {
249
            error (NO_POINTS);
250
        }
251
        $house -> fields['value'] = $house -> fields['value'] - 10;
252
        if ($house -> fields['value'] < 1) 
253
        {
254
            $house -> fields['value'] = 1;
255
        }
256
        $db -> Execute("UPDATE `houses` SET `build`=`build`+1, `points`=`points`-20, `value`=".$house -> fields['value']." WHERE `id`=".$house -> fields['id']);
257
        $db -> Execute("UPDATE `players` SET `credits`=`credits`-".$cost.", `platinum`=`platinum`-".$cost_mithril." WHERE `id`=".$player -> id);
258
        $db -> Execute("UPDATE `minerals` SET `pine`=`pine`-".$cost_pine." WHERE `owner`=".$player -> id);
259
        error (YOU_UPGRADE);
260
    }
261
    if (isset ($_GET['step']) && $_GET['step'] == 'bedroom') 
262
    {
263
        $query = $db -> Execute("SELECT `pine` FROM `minerals` WHERE `owner`=".$player -> id);
264
        $pine_costs = $query -> fields['pine'];
265
        $query -> Close();	
266
        if (!$house -> fields['id']) 
267
        {
268
            error (NO_HOUSE);
269
        }
270
        if ($house -> fields['used'] == $house -> fields['build']) 
271
        {
272
            error (NO_FREE);
273
        }
274
        if ($house -> fields['bedroom'] == 'Y') 
275
        {
276
            error (YOU_HAVE);
277
        }
278
        if ($player -> credits < 25000) 
279
        {
280
            error (NO_GOLD);
281
        }
282
        if ($player -> platinum < 50) 
283
        {
284
            error (NO_MITH);
285
        }
286
        if ($pine_costs < 100) 
287
        {
288
            error (NO_PINE);
289
        }
290
        if ($house -> fields['points'] < 50) 
291
        {
292
            error (NO_POINTS2);
293
        }
294
        $db -> Execute("UPDATE `houses` SET `bedroom`='Y', `points`=`points`-50, `used`=`used`+1 WHERE `id`=".$house -> fields['id']);
295
        $db -> Execute("UPDATE `players` SET `credits`=`credits`-25000, `platinum`=`platinum`-50 WHERE `id`=".$player -> id);
296
        $db -> Execute("UPDATE `minerals` SET `pine`=`pine`-100 WHERE `owner`=".$player -> id);
297
        error (YOU_BUILD);
298
    }
299
    if (isset ($_GET['step']) && $_GET['step'] == 'wardrobe') 
300
    {
301
        $query = $db -> Execute("SELECT `pine` FROM `minerals` WHERE `owner`=".$player -> id);
302
        $pine_costs = $query -> fields['pine'];
303
        $query -> Close();	
304
        if (!$house -> fields['id']) 
305
        {
306
            error (NO_HOUSE);
307
        }
308
        if ($house -> fields['used'] == $house -> fields['build']) 
309
        {
310
            error (NO_FREE);
311
        }
312
        $cost = $house -> fields['wardrobe'] * 10000;
313
        if ($cost == 0) 
314
        {
315
            $cost = 10000;
316
        }
317
        if ($player -> credits < $cost) 
318
        {
319
            error (NO_GOLD);
320
        }
321
        if ($pine_costs < 150) 
322
        {
323
            error (NO_PINE);
324
        }
325
        if ($house -> fields['points'] < 10) 
326
        {
327
            error (NO_POINTS2);
328
        }
329
        $db -> Execute("UPDATE `houses` SET `wardrobe`=`wardrobe`+1, `points`=`points`-10, `used`=`used`+1 WHERE `id`=".$house -> fields['id']);
330
        $db -> Execute("UPDATE `players` SET `credits`=`credits`-".$cost." WHERE `id`=".$player -> id);
331
        $db -> Execute("UPDATE `minerals` SET `pine`=`pine`-150 WHERE `owner`=".$player -> id);
332
        error (YOU_BUILD);
333
    }
334
    if (isset ($_GET['step']) && $_GET['step'] == 'upgrade') 
335
    {
336
        if (!$house -> fields['id']) 
337
        {
338
            error (NO_HOUSE);
339
        }
340
        if ($house -> fields['points'] < 10) 
341
        {
342
            error (NO_POINTS2);
343
        }
344
        $smarty -> assign(array("Upginfo" => UPG_INFO,
345
        	"Upginfo1" => UPG_INFO1,
346
        	"Upg_cost" => 5000,
347
        	"Upg_adamant" => 20,
348
        	"Upg_crystal" => 10,
349
        	"Upg_meteor" => 5,
350
			"Upg_yew" => 20,
351
        	"Upg_elm" => 10,
352
        	"Tcredits" => T_CREDITS,
353
        	"Tadamantium" => T_ADAMANTIUM,
354
        	"Tcrystal" => T_CRYSTAL,
355
        	"Tmeteor" => T_METEOR,
356
        	"Tyew" => T_YEW,
357
        	"Telm" => T_ELM,
358
            "Upgrade3" => UPGRADE,
359
            "Awork" => A_WORK));
360
        if (isset ($_GET['step2']) && $_GET['step2'] == 'make') 
361
        {
362
            if (!ereg("^[1-9][0-9]*$", $_POST['points'])) 
363
            {
364
                error (ERROR);
365
            }
366
            if (10*$_POST['points'] >  $house -> fields['points']) 
367
            {
368
                error (NO_POINTS);
369
            }
370
           $upg_cost = 5000 * $_POST['points'];
371
           $upg_adamantium = 20 * $_POST['points'];
372
           $upg_crystal = 10 * $_POST['points'];
373
           $upg_meteor = 5 * $_POST['points'];
374
           $upg_elm = $upg_crystal;
375
		   $upg_yew = $upg_adamantium;
376
           $upg_point = 10*$_POST['points'];
377
           $query = $db -> Execute("SELECT `elm`, `yew`, `meteor`, `adamantium`, `crystal`  FROM `minerals` WHERE `owner`=".$player -> id);        	
378
            if ($player -> credits < $upg_cost) 
379
            {
380
                error (NO_GOLD);
381
            }
382
            if ($query -> fields['elm'] < $upg_elm) 
383
            {
384
                error(NO_ELM);
385
            }
386
            if ($query -> fields['yew'] < $upg_crystal) 
387
            {
388
                error (NO_YEW);
389
            }
390
            if ($query -> fields['meteor'] < $upg_meteor) 
391
            {
392
                error (NO_METEOR);
393
            }
394
            if ($query -> fields['crystal'] < $upg_crystal) 
395
            {
396
                error (NO_CRYSTAL);
397
            }
398
            if ($query -> fields['adamantium'] < $upg_adamantium) 
399
            {
400
                error (NO_ADAMANTIUM);
401
            }
402
            $query -> Close();
403
            $db -> Execute("UPDATE `players` SET `credits`=`credits`-".$upg_cost." WHERE `id`=".$player -> id);
404
            $db -> Execute("UPDATE `houses` SET `points`=`points`-".$upg_point.", `value`=`value`+".$_POST['points']." WHERE `id`=".$house -> fields['id']);
405
            $db -> Execute("UPDATE `minerals` SET `elm`=`elm`-".$upg_elm.", `yew`=`yew`-".$upg_yew.", `meteor`=`meteor`-".$upg_meteor.", `crystal`=`crystal`-".$upg_crystal.", `adamantium`=`adamantium`-".$upg_adamantium." WHERE `owner`=".$player -> id);
406
            error (YOU_UPGRADE);
407
        }
408
    }
409
}
410
411
/**
412
* List of best players houses (50 houses max on list)
413
*/
414
if (isset ($_GET['action']) && $_GET['action'] == 'list') 
415
{
416
    $houses = $db -> SelectLimit("SELECT * FROM houses WHERE build>0 AND owner>0 AND location='".$player -> location."' ORDER BY build DESC", 50);
417
    $arrid = array();
418
    $arrowner = array();
419
    $arrname = array();
420
    $arrbuild = array();
421
    $arrtype = array();
422
    $arrlocator = array();
423
    $i = 0;
424
    while (!$houses -> EOF) {
425
        $arrid[$i] = $houses -> fields['id'];
426
        $arrowner[$i] = $houses -> fields['owner'];
427
        $arrname[$i] = $houses -> fields['name'];
428
        $arrbuild[$i] = $houses -> fields['build'];
429
        if ($houses -> fields['locator']) 
430
        {
431
            $arrlocator[$i] = "<a href=\"view.php?view=".$houses -> fields['locator']."\">".$houses -> fields['locator']."</a>";
432
        } 
433
            else 
434
        {
435
            $arrlocator[$i] = L_EMPTY;
436
        }
437
        $arrtype[$i] = housetype($houses -> fields['value'], $houses -> fields['build']);
438
        $houses -> MoveNext();
439
        $i = $i + 1;
440
    }
441
    $houses -> Close();
442
    $smarty -> assign(array("Housesname" => $arrname, 
443
        "Housesid" => $arrid, 
444
        "Housesowner" => $arrowner, 
445
        "Housesbuild" => $arrbuild, 
446
        "Housestype" => $arrtype, 
447
        "Locator" => $arrlocator,
448
        "Hname" => H_NAME,
449
        "Hnumber" => H_NUMBER,
450
        "Htype" => H_TYPE,
451
        "Hsize" => H_SIZE,
452
        "Howner" => H_OWNER,
453
        "Hlocator" => H_LOCATOR,
454
        "Aback" => A_BACK));
455
}
456
457
/**
458
* List of houses for sale
459
*/
460
if (isset ($_GET['action']) && $_GET['action'] == 'rent') 
461
{
462
    $houses = $db -> Execute("SELECT * FROM houses WHERE owner=0 AND location='".$player -> location."' ORDER BY build DESC");
463
    $arrid = array();
464
    $arrname = array();
465
    $arrbuild = array();
466
    $arrtype = array();
467
    $arrlink = array();
468
    $arrcost = array();
469
    $arrseller = array();
470
    $i = 0;
471
    while (!$houses -> EOF) 
472
    {
473
        $arrid[$i] = $houses -> fields['id'];
474
        $arrname[$i] = $houses -> fields['name'];
475
        $arrbuild[$i] = $houses -> fields['build'];
476
        $arrcost[$i] = $houses -> fields['cost'];
477
        $arrseller[$i] = $houses -> fields['seller'];
478
        $arrtype[$i] = housetype($houses -> fields['value'], $houses -> fields['build']);
479
        if ($player -> id == $houses -> fields['seller']) 
480
        {
481
            $arrlink[$i] = "<a href=\"house.php?action=rent&amp;back=".$houses -> fields['id']."\">".YOUR_OFERT."</a>";
482
        } 
483
            elseif ($house -> fields['id']) 
484
        {
485
            $arrlink[$i] = L_EMPTY;
486
        } 
487
            else 
488
        {
489
            $arrlink[$i] = "<a href=\"house.php?action=rent&amp;buy=".$houses -> fields['id']."\">".A_BUY."</a>";
490
        }
491
        $houses -> MoveNext();
492
        $i = $i + 1;
493
    }
494
    $houses -> Close();
495
    $smarty -> assign(array("Housesname" => $arrname, 
496
        "Housesid" => $arrid, 
497
        "Housesseller" => $arrseller, 
498
        "Housesbuild" => $arrbuild, 
499
        "Housestype" => $arrtype, 
500
        "Housescost" => $arrcost, 
501
        "Houseslink" => $arrlink,
502
        "Hnumber" => H_NUMBER,
503
        "Hseller" => H_SELLER,
504
        "Hname" => H_NAME,
505
        "Hsize" => H_SIZE,
506
        "Htype" => H_TYPE,
507
        "Hcost" => H_COST,
508
        "Hoption" => H_OPTION,
509
        "Aback" => A_BACK));
510
    if (isset($_GET['buy'])) 
511
    {
512
        if (!ereg("^[1-9][0-9]*$", $_GET['buy'])) 
513
        {
514
            error (ERROR);
515
        }
516
        if ($house -> fields['id']) 
517
        {
518
            error(YOU_HAVE);
519
        }
520
        $buy = $db -> Execute("SELECT id, owner, cost, seller FROM houses WHERE id=".$_GET['buy']);
521
        if (!$buy -> fields['id']) 
522
        {
523
            error(NO_HOUSE);
524
        }
525
        if ($buy -> fields['owner']) 
526
        {
527
            error(NOT_FOR_SALE);
528
        }
529
        if ($player -> credits < $buy -> fields['cost']) 
530
        {
531
            error(NO_GOLD);
532
        }
533
        $db -> Execute("UPDATE players SET credits=credits-".$buy -> fields['cost']." WHERE id=".$player -> id);
534
        $db -> Execute("UPDATE players SET bank=bank+".$buy -> fields['cost']." WHERE id=".$buy -> fields['seller']);
535
        $db -> Execute("UPDATE houses SET cost=0, seller=0, owner=".$player -> id." WHERE id=".$buy -> fields['id']);
536
        $strDate = $db -> DBDate($newdate);
537
        $db -> Execute("INSERT INTO `log` (`owner`, `log`, `czas`) VALUES(".$buy -> fields['seller'].",'<b><a href=view.php?view=".$player -> id.">".$player -> user.L_ACCEPT.$buy -> fields['cost'].L_BANK."', ".$strDate.")");
538
        $smarty -> assign("Message", YOU_BUY);
539
        $buy -> Close();
540
    }
541
    if (isset($_GET['back']))
542
    {
543
        if (!ereg("^[1-9][0-9]*$", $_GET['back'])) 
544
        {
545
            error (ERROR);
546
        }
547
        if ($house -> fields['id']) 
548
        {
549
            error(YOU_HAVE);
550
        }
551
        $buy = $db -> Execute("SELECT id, owner, seller FROM houses WHERE id=".$_GET['back']);
552
        if (!$buy -> fields['id']) 
553
        {
554
            error(NO_HOUSE);
555
        }
556
        if ($buy -> fields['owner']) 
557
        {
558
            error(NOT_FOR_SALE);
559
        }
560
        if ($buy -> fields['seller'] != $player -> id)
561
        {
562
            error(NOT_YOUR);
563
        }
564
        $db -> Execute("UPDATE houses SET cost=0, seller=0, owner=".$player -> id." WHERE id=".$buy -> fields['id']);
565
        $smarty -> assign("Message", YOU_WITHDRAW);
566
        $buy -> Close();
567
    }
568
}
569
570
/**
571
* Player house
572
*/
573
if (isset ($_GET['action']) && $_GET['action'] == 'my') 
574
{
575
    $smarty -> assign("Aback", A_BACK);
576
    if (!$house -> fields['id']) 
577
    {
578
        error (NO_HOUSE);
579
    }
580
    if (!isset ($_GET['step']) && !isset ($_GET['step2'])) 
581
    {
582
        $homename = housetype($house -> fields['value'], $house -> fields['build']);
583
        if ($house -> fields['bedroom'] == 'Y') 
584
        {
585
            $smarty -> assign ("Bedroom", YES);
586
        } 
587
            else 
588
        {
589
            $smarty -> assign ("Bedroom", NO);
590
        }
591
        $unused = $house -> fields['build'] - $house -> fields['used'];
592
        $amount = $db -> Execute("SELECT amount FROM equipment WHERE owner=".$player -> id." AND status='H'");
593
        $items = 0;
594
        while (!$amount -> EOF) 
595
        {
596
            $items = $items + $amount -> fields['amount'];
597
            $amount -> MoveNext();
598
        }
599
        $amount -> Close();
600
        $smarty -> assign(array("Name" => $house -> fields['name'], 
601
                                "Size" => $house -> fields['size'], 
602
                                "Build" => $house -> fields['build'], 
603
                                "Value" => $house -> fields['value'], 
604
                                "Housename" => $homename, 
605
                                "Unused" => $unused, 
606
                                "Wardrobe" => $house -> fields['wardrobe'], 
607
                                "Items" => $items,
608
                                "Houseinfo" => HOUSE_INFO,
609
                                "Hname" => H_NAME,
610
                                "Hsize" => H_SIZE,
611
                                "Howner" => H_OWNER,
612
                                "Hlocator" => H_LOCATOR,
613
                                "Lamount" => L_AMOUNT,
614
                                "Frooms" => F_ROOMS,
615
                                "Hvalue" => H_VALUE,
616
                                "Ibedroom" => I_BEDROOM,
617
                                "Wamount" => W_AMOUNT,
618
                                "Iamount" => I_AMOUNT,
619
                                "Cname" => C_NAME));
620
        if ($house -> fields['locator']) 
621
        {
622
            $smarty -> assign(array("Locator" => "<a href=\"view.php?view=".$house -> fields['locator']."\">".$house -> fields['locator']."</a>", 
623
                                    "Locleave" => "- <a href=\"house.php?action=my&amp;step=leave\">".A_LEAVE."</a><br />"));
624
        } 
625
            else 
626
        {
627
            $smarty -> assign(array("Locator" => L_EMPTY, 
628
                                    "Locleave" => ''));
629
        }
630
        if ($house -> fields['bedroom'] == 'Y') 
631
        {
632
            $smarty -> assign ("Bedroomlink", "- <a href=house.php?action=my&amp;step=bedroom>".GO_TO_BED."</a><br />");
633
        }
634
        if ($house -> fields['wardrobe'] > 0) 
635
        {
636
            $smarty -> assign ("Wardrobelink", "- <a href=house.php?action=my&amp;step=wardrobe>".GO_TO_WAR."</a><br />");
637
        }
638
        if ($house -> fields['build'] > 3 && $player -> id == $house -> fields['owner']) 
639
        {
640
            $smarty -> assign("Locatorlink", "- <a href=\"house.php?action=my&amp;step=locator\">".A_LOCATOR."</a><br />");
641
        }
642
        if ($player -> id == $house -> fields['owner']) 
643
        {
644
            $smarty -> assign("Sellhouse", "- <a href=\"house.php?action=my&amp;step=sell\">".A_SELL."</a><br />");
645
        } 
646
            else 
647
        {
648
            $smarty -> assign("Sellhouse", '');
649
        }
650
    }
651
    /**
652
    * Leave house (locator)
653
    */
654
    if (isset($_GET['step']) && $_GET['step'] == 'leave')
655
    {
656
        if ($player -> id != $house -> fields['locator'])
657
        {
658
            error(ERROR);
659
        }
660
        if (!isset($_GET['step2']))
661
        {
662
            $smarty -> assign(array("Youwant" => YOU_WANT,
663
                                    "Yes" => YES));
664
        }
665
        if (isset($_GET['step2']) && $_GET['step2'] == 'confirm')
666
        {
667
            $db -> Execute("UPDATE `houses` SET `locator`=0 WHERE `id`=".$house -> fields['id']);
668
            error(YOU_LEAVE);
669
        }
670
    }
671
    /**
672
    * Set house for sale
673
    */
674
    if (isset($_GET['step']) && $_GET['step'] == 'sell') 
675
    {
676
        $smarty -> assign(array("Sellinfo" => SELL_INFO,
677
                                "Housesale" => HOUSE_SALE,
678
                                "Goldcoins" => GOLD_COINS,
679
                                "Asend" => A_SEND));
680
        if ($player -> id != $house -> fields['owner']) 
681
        {
682
            error (ONLY_OWNER);
683
        }
684
        if (isset($_GET['step2']) && $_GET['step2'] == 'sell') 
685
        {
686
            if (!ereg("^[1-9][0-9]*$", $_POST['cost'])) 
687
            {
688
                error (ERROR);
689
            }
690
            $db -> Execute("UPDATE houses SET cost=".$_POST['cost'].", seller=".$player -> id.", owner=0, locator=0 WHERE id=".$house -> fields['id']);
691
            $smarty -> assign("Message", YOU_SELL.$_POST['cost'].GOLD_COINS.".");
692
        }
693
    } 
694
    /**
695
     * Add/delete locator to/from house
696
     */
697
    if (isset($_GET['step']) && $_GET['step'] == 'locator') 
698
    {
699
        if ($player -> id != $house -> fields['owner']) 
700
        {
701
            error (ONLY_OWNER);
702
        }
703
        $smarty -> assign(array("Locid" => $house -> fields['locator'],
704
            "Oadd" => O_ADD,
705
            "Odelete" => O_DELETE,
706
            "Second" => SECOND,
707
            "Lid2" => L_ID,
708
            "Amake" => A_MAKE));
709
        if (isset($_GET['step2']) && $_GET['step2'] == 'change') 
710
        {
711
            if (!ereg("^[1-9][0-9]*$", $_POST['lid'])) 
712
            {
713
                error (ERROR);
714
            }
715
            if ($_POST['loc'] == 'add') 
716
            {
717
                if ($house -> fields['locator']) 
718
                {
719
                    error (YOU_HAVE);
720
                }
721
                $test = $db -> Execute("SELECT `id` FROM `houses` WHERE `owner`=".$_POST['lid']." AND `location`='".$player -> location."'");
722
                if ($test -> fields['id']) 
723
                {
724
                    error (BAD_PL);
725
                }
726
                $test = $db -> Execute("SELECT `id` FROM `houses` WHERE `locator`=".$_POST['lid']." AND `location`='".$player -> location."'");
727
                if ($test -> fields['id']) 
728
                {
729
                    error(LIVE_ANOTHER);
730
                }
731
                $test = $db -> Execute("SELECT `id` FROM `players` WHERE `id`=".$_POST['lid']);
732
                if (!$test -> fields['id']) 
733
                {
734
                    error(NO_PLAYER);
735
                }
736
                $test -> Close();
737
                $db -> Execute("UPDATE `houses` SET `locator`=".$_POST['lid']." WHERE `id`=".$house -> fields['id']);
738
                $smarty -> assign("Message", YOU_ADD);
739
                $strLog = YOU_GET;
740
            }
741
            if ($_POST['loc'] == 'delete') 
742
            {
743
                if (!$house -> fields['locator']) 
744
                {
745
                    error (NO_LOC);
746
                }
747
                if ($_POST['lid'] != $house -> fields['locator']) 
748
                {
749
                    error (NO_LOC2);
750
                }
751
                $db -> Execute("UPDATE `houses` SET `locator`=0 WHERE `id`=".$house -> fields['id']);
752
                $smarty -> assign("Message", YOU_DELETE);
753
                $strLog = YOU_FIRED;
754
            }
755
            $strDate = $db -> DBDate($newdate);
756
            $db -> Execute("INSERT INTO `log` (`owner`, `log`, `czas`) VALUES(".$_POST['lid'].",'".$strLog."<b><a href=\"view.php?view=".$player -> id."\">".$player -> user."</a></b>.', ".$strDate.")");
757
        }
758
    }
759
    /**
760
    * Rename house
761
    */
762
    if (isset ($_GET['step']) && $_GET['step'] == 'name') 
763
    {
764
        $smarty -> assign(array("Achange" => A_CHANGE,
765
            "Ona" => ON_A));
766
        if ($player -> id != $house -> fields['owner']) 
767
        {
768
            error (ONLY_OWNER);
769
        }
770
        if (isset ($_GET['step2']) && $_GET['step2'] == 'change') 
771
        {
772
            if (empty ($_POST['name'])) 
773
            {
774
                error (EMPTY_NAME);
775
            }
776
            $_POST['name'] = strip_tags($_POST['name']);
777
            $strName = $db -> qstr($_POST['name'], get_magic_quotes_gpc());
778
            $db -> Execute("UPDATE houses SET name=".$strName." WHERE id=".$house -> fields['id']);
779
            error (YOU_CHANGE.$_POST['name']);
780
        }
781
    }
782
    
783
    /**
784
    * Rest in house
785
    */
786
    if (isset ($_GET['step']) && $_GET['step'] == 'bedroom') 
787
    {
788
        if ($house -> fields['bedroom'] == 'N') 
789
        {
790
            error (NO_BEDROOM);
791
        }
792
        $smarty -> assign(array("Id" => $player -> id,
793
            "Bedinfo" => BED_INFO,
794
            "Arest" => A_REST,
795
            "Asleep" => A_SLEEP));
796
        if (isset ($_GET['step2']) && $_GET['step2'] == 'rest') 
797
        {
798
            if ($player -> hp == 0) 
799
            {
800
                error ("<br /><br />".YOU_DEAD);
801
            }
802
            if ($player -> race == '' || $player -> clas == '')
803
            {
804
                error(NO_RACE);
805
            }
806
            $objTest = $db -> Execute("SELECT `houserest` FROM `players` WHERE `id`=".$player -> id);
807
            if ($objTest -> fields['houserest'] == 'Y') 
808
            {
809
                error ("<br /><br />".ONLY_ONCE);
810
            }
811
            $objTest -> Close();
812
            if(($house -> fields['rest_owner']==1 && $player -> id == $house -> fields['owner']) || ($house -> fields['rest_locator']==1 && $player -> id == $house -> fields['locator']))
813
            {
814
                error($arrLangSomeoneRested[rand(0, count($arrLangSomeoneRested)-1)]);
815
            }
816
            $db -> Execute("UPDATE `houses` SET `rest_".(($player -> id == $house -> fields['owner']) ? 'owner' : 'locator')."`=1 WHERE id=".$house -> fields['id']);
817
            $db -> Execute("UPDATE `players` SET `houserest`='Y' WHERE id=".$player -> id);
818
            $intValue = min( 100, $house -> fields['value']);
819
           $gainenergy =  round( rand( $intValue/2, $intValue) * $player ->max_energy / 25 + $house -> fields['build'], 2);
820
			if( $gainenergy + $player -> energy > 63* $player -> max_energy)
821
			{
822
				$gainenergy = 63* $player -> max_energy - $player -> energy;
823
			}
824
            $gainhp = ceil(($player -> max_hp / 100) * $house -> fields['value']);
825
            $cape = $db -> Execute("SELECT `power` FROM `equipment` WHERE `owner`=".$player -> id." AND `type`='C' AND `status`='E'");
826
            $maxmana = ($player -> inteli + $player -> wisdom);
827
            $maxmana = $maxmana + (($cape -> fields['power'] / 100) * $maxmana);
828
            $cape -> Close();
829
            $gainmana = ceil(($maxmana / 100) * $house -> fields['value']);
830
            $gainlife = $gainhp + $player -> hp;
831
            if ($gainlife > $player -> max_hp) 
832
            {
833
    	        $gainlife = $player -> max_hp;
834
            }
835
            $gainmagic = $gainmana + $player -> mana;
836
            if ($gainmagic > $maxmana) 
837
            {
838
               $gainmagic = $maxmana;
839
            }
840
            $db -> Execute("UPDATE `players` SET `hp`=".$gainlife.", `energy`=`energy`+".$gainenergy.", `pm`=".$gainmagic." WHERE `id`=".$player -> id);
841
            $intGainlife = ceil($gainlife - $player -> hp);
842
            $intGainmagic = ceil($gainmagic - $player -> mana);
843
            if ($intGainmagic < 1)
844
            {
845
                $intGainmagic = 0;
846
            }
847
            if ($gainenergy < 0.1 )
848
            {
849
            	$gainenergy = 0;
850
            }
851
            error ("<br /><br />".YOU_REST.$gainenergy.G_ENERGY.$intGainlife.G_LIFE.$intGainmagic.G_MAGIC);
852
        }
853
    }
854
    /**
855
     * Wardrobe - store item in house
856
     */
857
    if (isset ($_GET['step']) && $_GET['step'] == 'wardrobe') 
858
    {
859
        if ($house -> fields['wardrobe'] == 0) 
860
        {
861
            error (NO_WARDROBE);
862
        }
863
        $amount = $db -> Execute("SELECT `amount` FROM `equipment` WHERE `owner`=".$player -> id." AND `status`='H' AND location='".$player -> location."'");
864
        $items = 0;
865
        while (!$amount -> EOF) 
866
        {
867
            $items = $items + $amount -> fields['amount'];
868
            $amount -> MoveNext();
869
        }
870
        $amount -> Close();
871
        $smarty -> assign(array("Amount" => $items,
872
            "Wardrobe" => $house -> fields['wardrobe'],
873
            "Winfo" => W_INFO,
874
            "Wamount" => W_AMOUNT,
875
            "And2" => AND2,
876
            "Iamount4" => I_AMOUNT4,
877
            "Iamount2" => I_AMOUNT2,
878
            "Inw" => IN_W,
879
            "Alist" => A_LIST,
880
            "Ahidei" => A_HIDE_I,
881
            "Iname" => I_NAME,
882
            "Ipower" => I_POWER,
883
            "Iagi" => I_AGI,
884
            "Ispeed" => I_SPEED,
885
            "Ioption" => I_OPTION,
886
            "Aget" => A_GET,
887
            "Idur" => I_DUR));
888
        /**
889
         * List of item in house
890
         */
891
        if(isset ($_GET['step2']) && $_GET['step2'] == 'list') 
892
        {
893
            $arritem = $db -> Execute("SELECT * FROM equipment WHERE owner=".$player -> id." AND status='H' AND location='".$player -> location."'");
894
            $arrname = array();
895
            $arrpower = array();
896
            $arrdur = array();
897
            $arrmaxdur = array();
898
            $arragility = array();
899
            $arrspeed = array();
900
            $arramount = array();
901
            $arrid = array();
902
            $i = 0;
903
            while (!$arritem -> EOF) 
904
            {
905
                $arrname[$i] = $arritem -> fields['name'];
906
                $arrdur[$i] = $arritem -> fields['wt'];
907
                $arrmaxdur[$i] = $arritem -> fields['maxwt'];
908
                $arrspeed[$i] = $arritem -> fields['szyb'];
909
                $arramount[$i] = $arritem -> fields['amount'];
910
                $arrid[$i] = $arritem -> fields['id'];
911
                $arrpower[$i] = $arritem -> fields['power'];
912
                if ($arritem -> fields['zr'] < 1) 
913
                {
914
                    $arragility[$i] = str_replace("-","",$arritem -> fields['zr']);
915
                } 
916
                    else 
917
                {
918
                    $arragility[$i] = "-".$arritem -> fields['zr'];
919
                }
920
                if ($arritem -> fields['poison'] > 0) 
921
                {
922
                    $arrpower[$i] = $arritem -> fields['power'] + $arritem -> fields['poison'];
923
                }
924
                $arritem -> MoveNext();
925
                $i = $i + 1;
926
            }
927
            $arritem -> Close();
928
            $smarty -> assign(array("Itemname" => $arrname, 
929
                "Itemdur" => $arrdur, 
930
                "Itemmaxdur" => $arrmaxdur, 
931
                "Itemspeed" => $arrspeed, 
932
                "Itemamount" => $arramount, 
933
                "Itemid" => $arrid, 
934
                "Itempower" => $arrpower, 
935
                "Itemagility" => $arragility));
936
        }
937
        /**
938
         * Take items from house
939
         */
940
        if (isset ($_GET['take'])) 
941
        {
942
			if (!isset($_GET['step3']))
943
            {
944
				$name = $db -> Execute("SELECT * FROM equipment WHERE id=".$_GET['take']);
945
				if ($name ->fields['status'] == 'R')
946
				{
947
					error (NOT_YOUR);
948
				}
949
				else
950
				{
951
					$smarty -> assign(array("Id" => $_GET['take'],
952
						"Amount" => $name -> fields['amount'],
953
						"Name" => $name -> fields['name'],
954
						"Fromh" => FROM_H,
955
						"Amount2" => AMOUNT2));
956
					$name -> Close();
957
				}
958
            }
959
            if (isset($_GET['step3']) && $_GET['step3'] == 'add') 
960
            {
961
                integercheck($_POST['amount']);
962
                if (!isset($_POST['amount']) || !ereg("^[1-9][0-9]*$", $_POST['amount'])) 
963
                {
964
                    error (ERROR);
965
                }
966
                $zbroj = $db -> Execute("SELECT * FROM equipment WHERE id=".$_GET['take']);
967
                if ($zbroj -> fields['amount'] < $_POST['amount']) 
968
                {
969
                    error (NO_AMOUNT);
970
                }
971
                $test = $db -> Execute("SELECT id FROM equipment WHERE name='".$zbroj -> fields['name']."' AND owner=".$player -> id." AND wt=".$zbroj -> fields['wt']." AND type='".$zbroj -> fields['type']."' AND power=".$zbroj -> fields['power']." AND szyb=".$zbroj -> fields['szyb']." AND zr=".$zbroj -> fields['zr']." AND maxwt=".$zbroj -> fields['maxwt']." AND poison=".$zbroj -> fields['poison']." AND status='U' AND ptype='".$zbroj -> fields['ptype']."' AND cost=".$zbroj -> fields['cost']);
972
                if (!$test -> fields['id']) 
973
                {
974
                    $db -> Execute("INSERT INTO equipment (owner, name, power, type, cost, zr, wt, minlev, maxwt, amount, magic, poison, szyb, twohand, ptype, repair) VALUES(".$player -> id.",'".$zbroj -> fields['name']."',".$zbroj -> fields['power'].",'".$zbroj -> fields['type']."',".$zbroj -> fields['cost'].",".$zbroj -> fields['zr'].",".$zbroj -> fields['wt'].",".$zbroj -> fields['minlev'].",".$zbroj -> fields['maxwt'].",".$_POST['amount'].",'".$zbroj -> fields['magic']."',".$zbroj -> fields['poison'].",".$zbroj -> fields['szyb'].",'".$zbroj -> fields['twohand']."','".$zbroj -> fields['ptype']."', ".$zbroj -> fields['repair'].")");
975
                } 
976
                    else 
977
                {
978
                    if ($zbroj -> fields['type'] != 'R')
979
                    {
980
                        $db -> Execute("UPDATE `equipment` SET `amount`=`amount`+".$_POST['amount']." WHERE `id`=".$test -> fields['id']);
981
                    }
982
                        else
983
                    {
984
                        $db -> Execute("UPDATE `equipment` SET `wt`=`wt`+".$zbroj -> fields['wt']." WHERE `id`=".$test -> fields['id']);
985
                    }
986
                }
987
                $test -> Close();
988
                if ($_POST['amount'] < $zbroj -> fields['amount']) 
989
                {
990
                    $db -> Execute("UPDATE equipment SET amount=amount-".$_POST['amount']." WHERE id=".$zbroj -> fields['id']);
991
                } 
992
                    else 
993
                {
994
                    $db -> Execute("DELETE FROM equipment WHERE id=".$zbroj -> fields['id']);
995
                }
996
                error (YOU_GET.$_POST['amount'].I_AMOUNT.$zbroj -> fields['name']);
997
            }
998
        }
999
        /**
1000
         * Add item to wardrobe
1001
         */
1002
        if (isset ($_GET['step2']) && $_GET['step2'] == 'add') 
1003
        {
1004
            $arritem = $db -> Execute("SELECT * FROM equipment WHERE status='U' AND owner=".$player -> id);
1005
            $arrname = array();
1006
            $arramount = array();
1007
            $arrid = array();
1008
            $i = 0;
1009
            while (!$arritem -> EOF) 
1010
            {
1011
                $arrname[$i] = $arritem -> fields['name'];
1012
                $arramount[$i] = $arritem -> fields['amount'];
1013
                $arrid[$i] = $arritem -> fields['id'];
1014
                $arritem -> MoveNext();
1015
                $i = $i + 1;
1016
            }
1017
            $arritem -> Close();
1018
            $smarty -> assign(array("Itemname1" => $arrname, 
1019
                "Itemamount1" => $arramount, 
1020
                "Itemid1" => $arrid,
1021
                "Item" => ITEM,
1022
                "Iamount3" => I_AMOUNT3,
1023
                "Ahide" => A_HIDE,
1024
                "Amount2" => AMOUNT2));
1025
            if (isset ($_GET['step3']) && $_GET['step3'] == 'add') 
1026
            {
1027
                if (!isset($_POST['przedmiot'])) 
1028
                {
1029
                    error(NO_ITEM);
1030
                }
1031
                integercheck($_POST['amount']);
1032
                if (!ereg("^[1-9][0-9]*$", $_POST['przedmiot']) || !ereg("^[1-9][0-9]*$", $_POST['amount'])) 
1033
                {
1034
                    error (ERROR);
1035
                }
1036
                $przed = $db -> Execute("SELECT * FROM equipment WHERE id=".$_POST['przedmiot']);
1037
                if (!$przed -> fields['id']) 
1038
                {
1039
                    error (ERROR);
1040
                }
1041
                if ($przed -> fields['amount'] < $_POST['amount']) 
1042
                {
1043
                    error (NOT_ENOUGH);
1044
                }
1045
                $amount = ($house -> fields['wardrobe'] * 100) - $items;
1046
                if ($amount < $_POST['amount']) 
1047
                {
1048
                    error (NOT_ENOUGH2);
1049
                }
1050
                $test = $db -> Execute("SELECT id FROM equipment WHERE name='".$przed -> fields['name']."' AND owner=".$player -> id." AND wt=".$przed -> fields['wt']." AND type='".$przed -> fields['type']."' AND power=".$przed -> fields['power']." AND szyb=".$przed -> fields['szyb']." AND zr=".$przed -> fields['zr']." AND maxwt=".$przed -> fields['maxwt']." AND poison=".$przed -> fields['poison']." AND status='H' AND ptype='".$przed -> fields['ptype']."' AND cost=".$przed -> fields['cost']." AND location='".$player -> location."'");
1051
                if (!$test -> fields['id']) 
1052
                {
1053
                    $db -> Execute("INSERT INTO equipment (owner, name, power, type, cost, zr, wt, minlev, maxwt, amount, magic, poison, szyb, twohand, status, ptype, repair, location) VALUES(".$player -> id.",'".$przed -> fields['name']."',".$przed -> fields['power'].",'".$przed -> fields['type']."',".$przed -> fields['cost'].",".$przed -> fields['zr'].",".$przed -> fields['wt'].",".$przed -> fields['minlev'].",".$przed -> fields['maxwt'].",".$_POST['amount'].",'".$przed -> fields['magic']."',".$przed -> fields['poison'].",".$przed -> fields['szyb'].",'".$przed -> fields['twohand']."','H','".$przed -> fields['ptype']."', ".$przed -> fields['repair'].", '".$player -> location."')") or die($db -> ErrorMsg());
1054
                } 
1055
                    else 
1056
                {
1057
                    if ($przed -> fields['type'] != 'R')
1058
                    {
1059
                        $db -> Execute("UPDATE `equipment` SET `amount`=`amount`+".$_POST['amount']." WHERE `id`=".$test -> fields['id']);
1060
                    }
1061
                        else
1062
                    {
1063
                        $db -> Execute("UPDATE `equipment` SET `wt`=`wt`+".$przed -> fields['wt']." WHERE `id`=".$test -> fields['id']);
1064
                    }
1065
                }
1066
                $test -> Close();
1067
                if ($_POST['amount'] < $przed -> fields['amount']) 
1068
                {
1069
                    $db -> Execute("UPDATE equipment SET amount=amount-".$_POST['amount']." WHERE id=".$przed -> fields['id']);
1070
                } 
1071
                    else 
1072
                {
1073
                    $db -> Execute("DELETE FROM equipment WHERE id=".$przed -> fields['id']);
1074
                }
1075
                error (YOU_HIDE.$_POST['amount'].I_AMOUNT.$przed -> fields['name'].IN_HOUSE);
1076
            }
1077
        }
1078
    }
1079
}
1080
1081
/**
1082
* Initialization of variables
1083
*/
1084
if (!isset($_GET['action'])) 
1085
{
1086
    $_GET['action'] = '';
1087
    $fltLogins = fmod($player -> logins, 2);
1088
    if ($fltLogins)
1089
    {
1090
        $strHouseinfo = HOUSE_INFO;
1091
    }
1092
        else
1093
    {
1094
        $strHouseinfo = HOUSE_INFO2;
1095
    }
1096
    $smarty -> assign(array("Houseinfo" => $strHouseinfo,
1097
        "Aland" => A_LAND,
1098
        "Alist" => A_LIST,
1099
        "Arent" => A_RENT,
1100
        "Ahouse" => A_HOUSE,
1101
        "Aworkshop" => A_WORKSHOP));
1102
}
1103
if (!isset($_GET['step'])) 
1104
{
1105
    $_GET['step'] = '';
1106
}
1107
if (!isset($_GET['step2'])) 
1108
{
1109
    $_GET['step2'] = '';
1110
}
1111
if (!isset($_GET['take'])) 
1112
{
1113
    $_GET['take'] = '';
1114
}
1115
if (!isset($_GET['step3'])) 
1116
{
1117
    $_GET['step3'] = '';
1118
}
1119
1120
/**
1121
* Assign variables to template and display page
1122
*/
1123
$smarty -> assign(array("Action" => $_GET['action'], 
1124
    "Houseid" => $house -> fields['id'], 
1125
    "Step" => $_GET['step'], 
1126
    "Step2" => $_GET['step2'], 
1127
    "Take" => $_GET['take'], 
1128
    "Step3" => $_GET['step3'], 
1129
    "Owner" => $house -> fields['owner']));
1130
$house -> Close();
1131
$smarty -> display ('house.tpl');
1132
1133
require_once("includes/foot.php");
1134
?>