-
Notifications
You must be signed in to change notification settings - Fork 7
/
search.php
550 lines (474 loc) · 16.7 KB
/
search.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
<?php
$page_title = "Search";
$hide_sidebars = true;
define('OSW_IN_SYSTEM', true);
require_once('inc/header.php');
/*** *** *** *** *** ***
* OSSearch is also required for this page to get search info from your grid.
* For this to work on your grid add the following line into your Robust.ini or Robust.HG.ini in the [LoginService] section.
* SearchURL = "http://yourwebsiteaddresshere/ossearch.php?search=[QUERY]"
*** *** *** *** *** ***/
$search = $osw->Security->make_safe($_GET['search']);
$search = strtoupper($search);
$search = strip_tags($search);
$search = trim ($search);
$searchlink = $search;
$type = $osw->Security->make_safe($_GET['type']);
$m = $osw->Security->make_safe($_GET['m']);
if ($search) {
$placeholder = "Searching for $search";
}else if (!$search) {
$placeholder = "Search";
}
$select = "selected";
if (!$m) {
$m = "1";
}
// no idea here yet
$eventcat = "<select name='eventcat'>
<option value=''></option>
<option value=''></option>
<option value=''></option>
<option value=''></option>
<option value=''></option>
<option value=''></option>
<option value=''></option>
<option value=''></option>
</select>";
$PG = "<span class='label label-success'>PG</span>";
$MATURE = "<span class='label label-default'>M</span>";
$ADULT = "<span class='label label-danger'>A</span>";
?>
<form class="form-inline" method="get" action="" role="form">
<div class="form-group">
<input type="text" name="search" class="form-control" id="appendedInputButtons" placeholder="<?php echo $placeholder; ?>">
</div>
<div class="form-group">
<select name="type" class="form-control">
<option value="" <?php if (!$type) { echo ""; } ?>>Everything</option>
<option value="classifieds" <?php if ($type == "classifieds") { echo "$select"; } ?>>Classifieds</option>
<option value="destinations" <?php if ($type == "destinations") { echo "$select"; } ?>>Destinations</option>
<option value="events" <?php if ($type == "events") { echo "$select"; } ?>>Events</option>
<option value="groups" <?php if ($type == "groups") { echo "$select"; } ?>>Groups</option>
<option value="4sale" <?php if ($type == "4sale") { echo "$select"; } ?>>Land & Rentals</option>
<option value="people" <?php if ($type == "people") { echo "$select"; } ?>>People</option>
<option value="places" <?php if ($type == "places") { echo "$select"; } ?>>Places</option>
</select>
</div>
<div class="form-group">
<label class="radio inline">
<input type="radio" id="inlineCheckbox1" name="m" value="1" <?php if ($m == "1") { echo "CHECKED"; } ?>><?php echo $PG; ?>
</label>
<label class="radio inline">
<input type="radio" id="inlineCheckbox2" name="m" value="2" <?php if ($m == "2") { echo "CHECKED"; } ?>><?php echo $MATURE; ?>
</label>
<label class="radio inline">
<input type="radio" id="inlineCheckbox3" name="m" value="3" <?php if ($m == "3") { echo "CHECKED"; } ?>><?php echo $ADULT; ?>
</label>
</div>
<div class="form-group">
<button type="submit" class="btn btn-success">Search</button>
</div>
</form>
<TABLE>
<TR VALIGN="top" style="valign: top;">
<TD ALIGN="left" STYLE="width:150px;">
<ul class="nav nav-pills nav-stacked">
<li <?php if (!$type) { echo "class='active'"; } ?>><a href="<?php echo $thispage."?search=$searchlink&type=&m=$m"; ?>">Everything</a></li>
<li <?php if ($type == "classifieds") { echo "class='active'"; } ?>><a href="<?php echo $thispage."?search=$searchlink&type=classifieds&m=$m"; ?>">Classifieds</a></li>
<li <?php if ($type == "destinations") { echo "class='active'"; } ?>><a href="<?php echo $thispage."?search=$searchlink&type=destinations&m=$m"; ?>">Destinations</a></li>
<li <?php if ($type == "events") { echo "class='active'"; } ?>><a href="<?php echo $thispage."?search=$searchlink&type=events&m=$m"; ?>">Events</a></li>
<?php if ($type == "events") { echo $eventcat; } ?>
<li <?php if ($type == "groups") { echo "class='active'"; } ?>><a href="<?php echo $thispage."?search=$searchlink&type=groups&m=$m"; ?>">Groups</a></li>
<?php
if ($type == "groups") {
echo "Group Test";
}
?>
<li <?php if ($type == "4sale") { echo "class='active'"; } ?>><a href="<?php echo $thispage."?search=$searchlink&type=4sale&m=$m"; ?>">Land & Rentals</a></li>
<li <?php if ($type == "people") { echo "class='active'"; } ?>><a href="<?php echo $thispage."?search=$searchlink&type=people&m=$m"; ?>">People</a></li>
<li <?php if ($type == "places") { echo "class='active'"; } ?>><a href="<?php echo $thispage."?search=$searchlink&type=places&m=$m"; ?>">Places</a></li>
<?php
if ($type == "places") {
echo "Test";
}
?>
</ul>
</TD>
<TD ALIGN="left" STYLE='max-width:600px'>
<div class="panel-group" id="accordion" style="width:600px; height: auto;">
<?php
if ($type == "classifieds" || !$type) {
echo "<h3>Classifieds</h3>";
$cq = $osw->SQL->query("SELECT * FROM `{$osw->config['profile_db']}`.classifieds WHERE name LIKE '%$search%' OR description LIKE '%$search%' AND creationdate < '$now' AND expirationdate > '$now' AND classifiedflags < '$m' ORDER BY 'creationdate' DESC LIMIT 0,100");
while ($cn = $osw->SQL->fetch_array($cq)) {
$creatoruuid = $cn['creatoruuid'];
$creationdate = $cn['creationdate'];
$expirationdate = $cn['expirationdate'];
$category = $cn['category'];
$name = $cn['name'];
$parceluuid = $cn['parceluuid'];
$description = $cn['description'];
$snapshotuuid = $cn['snapshotuuid'];
$simname = $cn['simname'];
$classifiedflags = $cn['classifiedflags'];
$creationdate = date("M d Y h:i a T",$creationdate);
$expirationdate = date("M d Y h:i a T",$expirationdate);
$parq = $osw->SQL->query("SELECT * FROM `{$osw->config['search_db']}`.allparcels WHERE parcelUUID = '$parceluuid'");
$parrow = $osw->SQL->fetch_array($parq);
$regionid = $parrow['regionUUID'];
$parcelname = $parrow['parcelname'];
$loc = $parrow['landingpoint'];
$simq = $osw->SQL->query("SELECT * FROM `{$osw->config['robust_db']}`.regions WHERE uuid = '$regionid'");
$simr = $osw->SQL->fetch_array($simq);
$sim = $simr['regionName'];
if (!$loc) {
$locr = "128,128,25";
}else{
$locr = str_replace("/", ",", $loc);
}
$FL = $osw->grid->uuid2name($creatoruuid);
$FName = $FL['FirstName'];
$LName = $FL['LastName'];
if ($classifiedflags == 0) {
$classifiedflags = "$PG";
}else if ($classifiedflags == 1) {
$classifiedflags = "$MATURE";
}else if ($classifiedflags == 2) {
$classifiedflags = "$ADULT";
}
if (!$snapshotuuid || $snapshotuuid == "00000000-0000-0000-0000-000000000000") {
$pic = "<img src='$address/webassets/asset.php?id=243e3d7b-66ac-47f0-aca9-74bb932c2404&format=PNG' class='pull-right' width='75' height='75'>";
}else{
$pic = "<img src='$address/webassets/asset.php?id=$snapshotuuid&format=PNG' class='pull-right' width='75' height='75'>";
}
echo " <div class='panel panel-default'>
<div class='panel-heading'>
<h4 class='panel-title'>
<a class='accordion-toggle' data-toggle='collapse' data-parent='#accordion' href='#$parceluuid'>
<B>$name</B>
</a>
</h4>
</div>
<div id='$parceluuid' class='panel-collapse collapse'>
<div class='panel-body'>
$pic
<p>
<a href='secondlife://$sim/$loc/'>$parcelname, $sim ($locr)</a><br>
$description
<br>
<small>Created: $creationdate by $FName $LName</small>
</p>
</div>
</div>
</div>
";
}
}
if ($type == "destinations" || !$type) {
echo "<h3>Destinations</h3>";
$popq = $osw->SQL->query("SELECT * FROM `{$osw->config['search_db']}`.popularplaces WHERE name LIKE '%$search%' AND mature < '$m' ORDER BY `dwell` DESC LIMIT 0,100");
while ($popn = $osw->SQL->fetch_array($popq)) {
$parcelUUID = $popn['parcelUUID'];
$name = $popn['name'];
$mature = $popn['mature'];
if ($mature == 0) {
$mature = "$PG";
}else if ($mature == 1) {
$mature = "$MATURE";
}else if ($mature == 2) {
$mature = "$ADULT";
}
$parq = $osw->SQL->query("SELECT * FROM `{$osw->config['search_db']}`.parcels WHERE parcelUUID = '$parcelUUID'");
$parrow = $osw->SQL->fetch_array($parq);
$reguuid = $parrow['regionUUID'];
$landing = $parrow['landingpoint'];
$desc = $parrow['description'];
$simname = $osw->grid->regionname($reguuid);
$usersonregion = $osw->grid->userspersim($reguuid);
echo " <div class='panel panel-default'>
<div class='panel-heading'>
<h4 class='panel-title'>
<a class='accordion-toggle' data-toggle='collapse' data-parent='#accordion' href='#Dest$parcelUUID'>
<B>$name</B>
</a>
</h4>
</div>
<div id='Dest$parcelUUID' class='panel-collapse collapse'>
<div class='panel-body'>
$desc<br>
<B>Mature Rating:</B> $mature<br>
<B>Avatars on region:</B> $usersonregion
<br><a href='secondlife://$simname/$landing/'>Teleport</a>
</div>
</div>
</div>";
}
}
if ($type == "events" || !$type) {
echo "<h3>Events</h3>";
$evq = $osw->SQL->query("SELECT * FROM `{$osw->config['search_db']}`.events WHERE name LIKE '%$search%' OR description LIKE '%$search%' AND dateUTC > $now AND eventflags < '$m' ORDER BY `dateUTC` LIMIT 0,100");
while ($evnum = $osw->SQL->fetch_array($evq)) {
$creator = $evnum['creatoruuid'];
$time = $evnum['dateUTC'];
$eventid = $evnum['eventid'];
$eventname = $evnum['name'];
$eventinfo = $evnum['description'];
$event_type = $evnum['eventflags'];
$event_time = date("M d Y h:i a T",$time);
$getname = $osw->grid->uuid2name($creator);
$first = $getname['FirstName'];
$last = $getname['LastName'];
$event_host = "$first $last";
if ($event_type == 0) {
$event_type = "$PG";
}else if ($event_type == 1) {
$event_type = "$MATURE";
}else if ($event_type == 2) {
$event_type = "$ADULT";
}
if ($time >= $now) {
echo " <div class='panel panel-default'>
<div class='panel-heading'>
<h4 class='panel-title'>
<a class='accordion-toggle' data-toggle='collapse' data-parent='#accordion' href='#$eventid'>
<B>$eventname - $event_time</B>
</a>
</h4>
</div>
<div id='$eventid' class='panel-collapse collapse'>
<div class='panel-body'>
$eventinfo<br>
</div>
</div>
</div>
";
}else if ($time <= $now) {
// dont display anything
}
}
}
if ($type == "groups" || !$type) {
echo "<h3>Groups</h3>";
$grpq = $osw->SQL->query("SELECT * FROM `{$osw->config['robust_db']}`.os_groups_groups WHERE Name LIKE '%$search%' AND ShowInList = '1' ORDER BY `Name` ASC LIMIT 0,100");
while ($grpn = $osw->SQL->fetch_array($grpq)) {
$GroupID = $grpn['GroupID'];
$Name = $grpn['Name'];
$Charter = $grpn['Charter'];
$InsigniaID = $grpn['InsigniaID'];
$FounderID = $grpn['FounderID'];
$OpenEnrollment = $grpn['OpenEnrollment'];
$MembershipFee = $grpn['MembershipFee'];
$MaturePublish = $grpn['MaturePublish'];
$FL = $osw->grid->uuid2name($FounderID);
$FName = $FL['FirstName'];
$LName = $FL['LastName'];
$gmq = $osw->SQL->query("SELECT * FROM `{$osw->config['robust_db']}`.os_groups_membership WHERE GroupID = '$GroupID'");
$gmcount = $osw->SQL->num_rows($gmq);
if ($InsigniaID == "00000000-0000-0000-0000-000000000000" || !$InsigniaID) {
$pic = "<img src='$address/webassets/asset.php?id=243e3d7b-66ac-47f0-aca9-74bb932c2404&format=PNG' class='pull-right' width='75' height='75'>";
}else{
$pic = "<img src='$address/webassets/asset.php?id=$InsigniaID&format=PNG' class='pull-right' width='75' height='75'>";
}
if ($OpenEnrollment == "1") {
$join = "<a href='secondlife:///app/group/".$GroupID."/join' class='btn btn-success btn-xs'>JOIN</a>";
}else if ($OpenEnrollment == "0") {
$join = "Closed to invites only.";
}
if ($MaturePublish == 0) {
$MaturePublish = "$PG";
}else if ($MaturePublish == 1) {
$MaturePublish = "$MATURE";
}else if ($MaturePublish == 2) {
$MaturePublish = "$ADULT";
}
echo " <div class='panel panel-default'>
<div class='panel-heading'>
<h4 class='panel-title'>
<a class='accordion-toggle' data-toggle='collapse' data-parent='#accordion' href='#$GroupID'>
<B>$Name</B> $MaturePublish
</a>
</h4>
</div>
<div id='$GroupID' class='panel-collapse collapse'>
<div class='panel-body'>
<p>
$pic
$Charter
</p>
<p>
Total Members: $gmcount
</p>
<p>
Enrollment: $join
</p>
<p>
<small>Created by $FName $LName</small>
</p>
</div>
</div>
</div>
";
}
}
if ($type == "4sale" || !$type) {
echo "<h3>For Sale</h3>";
$forsaleq = $osw->SQL->query("SELECT * FROM `{$osw->config['search_db']}`.parcelsales WHERE parcelname LIKE '%$search%' AND mature < '$m' ORDER BY `saleprice` ASC LIMIT 0,100");
while ($forsnum = $osw->SQL->fetch_array($forsaleq)) {
$regionUUID = $forsnum['regionUUID'];
$parcelname = $forsnum['parcelname'];
$parcelUUID = $forsnum['parcelUUID'];
$area = $forsnum['area'];
$saleprice = $forsnum['saleprice'];
$landingpoint = $forsnum['landingpoint'];
$regionname = $osw->grid->regionname($regionUUID);
echo " <div class='panel panel-default'>
<div class='panel-heading'>
<h4 class='panel-title'>
<a class='accordion-toggle' data-toggle='collapse' data-parent='#accordion' href='#forsale$parcelUUID'>
<B>$parcelname</B>
</a>
</h4>
</div>
<div id='forsale$parcelUUID' class='accordion-body collapse'>
<div class='panel-body'>
<p>
<B>Area:</B> $area<br>
<B>Price:</B> V$ $saleprice<br>
<B>Region:</B> $regionname<br>
<a href=''>Teleport</a>
</p>
</div>
</div>
</div>
";
}
}
if ($type == "people" || !$type) {
echo "<h3>People</h3>";
$pplq = $osw->SQL->query("SELECT * FROM `{$osw->config['robust_db']}`.UserAccounts WHERE FirstName LIKE '%$search%' OR LastName LIKE '%$search%' ORDER BY `Created` ASC LIMIT 0,100");
while ($pplnum = $osw->SQL->fetch_array($pplq)) {
$uuid = $pplnum['PrincipalID'];
$sFirst = $pplnum['FirstName'];
$sLast = $pplnum['LastName'];
if ($sLast == "Resident") {
$profname = $sFirst;
}else{
$profname = $sFirst.".".$sLast;
}
$online = $osw->grid->online($uuid);
if ($online == "False") {
$onoff = "offlinedot.png";
}else if ($online == "True") {
$onoff = "onlinedot.png";
}
$profq = $osw->SQL->query("SELECT * FROM `{$osw->config['profile_db']}`.userprofile WHERE useruuid = '$uuid' AND profileMaturePublish < '$m'");
$prow = $osw->SQL->fetch_array($profq);
$show = $prow['profileAllowPublish'];
if ($show == "0") {
$MaturePublish = $prow['profileMaturePublish'];
$abouttext = $prow['profileAboutText'];
$fakepic = $prow['profileImage'];
if ($abouttext) {
$abouttext = htmlspecialchars_decode($abouttext, ENT_QUOTES);
$abouttext = html_entity_decode($abouttext);
$abouttext = substr($abouttext, 0, 125);
$fakelife = "<p>
$abouttext
</p>";
}else if (!$abouttext) {
$fakelife = "";
}
if ($MaturePublish == 0) {
$MaturePublish = "$PG";
}else if ($MaturePublish == 1) {
$MaturePublish = "$MATURE";
}else if ($MaturePublish == 2) {
$MaturePublish = "$ADULT";
}
if ($fakepic == "00000000-0000-0000-0000-000000000000" || !$fakepic) {
$pic = "<img src='$address/webassets/asset.php?id=243e3d7b-66ac-47f0-aca9-74bb932c2404&format=PNG' class='pull-right' width='75' height='75'>";
}else{
$pic = "<img src='$address/webassets/asset.php?id=$fakepic&format=PNG' class='pull-right' width='75' height='75'>";
}
echo " <div class='panel panel-default'>
<div class='panel-heading'>
<h4 class='panel-title'>
<a class='accordion-toggle' data-toggle='collapse' data-parent='#accordion' href='#people$uuid'>
<B>$sFirst $sLast</B> <img src='$address/img/$onoff' border='0'>
</a>
</h4>
</div>
<div id='people$uuid' class='panel-collapse collapse'>
<div class='panel-body'>
$pic
$fakelife
</div>
<div class='panel-footer'><small><a href='$site_address/profile.php?u=$profname'>View profile</a></small></div>
</div>
</div>
";
}else if ($show == "1" || !$show){
}
}
}
if ($type == "places" || !$type) {
echo "<h3>Places</h3>";
$placeq = $osw->SQL->query("SELECT * FROM `{$osw->config['search_db']}`.parcels WHERE parcelname LIKE '%$search%' OR description LIKE '%$search%' AND public = 'true' ORDER BY `parcelUUID` ASC LIMIT 0,100");
while ($placenum = $osw->SQL->fetch_array($placeq)) {
$regionUUID = $placenum['regionUUID'];
$parcelname = $placenum['parcelname'];
$parcelUUID = $placenum['parcelUUID'];
$landingpoint = $placenum['landingpoint'];
$description = $placenum['description'];
$searchcategory = $placenum['searchcategory'];
$mature = $placenum['mature'];
$regionname = $osw->grid->regionname($regionUUID);
$usersonregion = $osw->grid->userspersim($regionUUID);
if ($mature == "PG") {
$mr = "1";
$mat = "$PG";
}
if ($mature == "Mature") {
$mr = "2";
$mat = "$MATURE";
}
if ($mature == "Adult") {
$mr = "3";
$mat = "$ADULT";
}
if ($mr <= $m) {
echo " <div class='panel panel-default'>
<div class='panel-heading'>
<h4 class='panel-title'>
<a class='accordion-toggle' data-toggle='collapse' data-parent='#accordion' href='#places$parcelUUID'>
<B>$parcelname</B>
</a>
</h4>
</div>
<div id='places$parcelUUID' class='panel-collapse collapse'>
<div class='panel-body'>
<p>
$pic
$description<br>
<B>Mature Rating:</B> $mat<br>
<B>Avatars on region:</B> $usersonregion
<br>
<a href='secondlife://$regionname/$landingpoint/'>Teleport</a>
</p>
</div>
</div>
</div>
";
}else{
}
}
}
?>
</div>
</TD>
</TR>
</TABLE>
<?php
include ('inc/footer.php');
?>