-
Notifications
You must be signed in to change notification settings - Fork 0
/
listings_found.php
88 lines (56 loc) · 2.02 KB
/
listings_found.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
<?php
include_once("includes/inc.global.php");
$p->site_section = LISTINGS;
$p->page_title = $_REQUEST["type"] ."ed Listings";
include_once("classes/class.listing.php");
if($_REQUEST["category"] == "0")
$category = "%";
else
$category = $_REQUEST["category"];
if($_REQUEST["timeframe"] == "0")
$since = new cDateTime(LONG_LONG_AGO);
else
$since = new cDateTime("-". $_REQUEST["timeframe"] ." days");
if ($cUser->IsLoggedOn())
$show_ids = true;
else
$show_ids = false;
// instantiate new cOffer objects and load them
$listings = new cListingGroup($_GET["type"]);
$listings->LoadListingGroup(null, $category, null, $since->MySQLTime());
$lID = 0;
if ($listings->listing && KEYWORD_SEARCH_DIR==true && strlen($_GET["keyword"])>0) { // Keyword specified
foreach($listings->listing as $l) { // Check ->title and ->description etc against Keyword
$mem = $l->member;
$pers = $l->member->person[0];
$match = false;
if (strpos(strtolower($l->title), strtolower($_GET["keyword"]))>-1) { // Offer title
$match = true;
}
if (strpos(strtolower($l->description), strtolower($_GET["keyword"]))>-1) { // Offer description
$match = true;
}
if ($cUser->IsLoggedOn()) { // Search is only performed on these params if the user is logged in
if (strpos(strtolower($pers->first_name), strtolower($_GET["keyword"]))>-1) { // Member First Name
$match = true;
}
if (strpos(strtolower($pers->last_name), strtolower($_GET["keyword"]))>-1) { // Member Last Name
$match = true;
}
if (strpos(strtolower($mem->member_id), strtolower($_GET["keyword"]))>-1) { // Member ID
$match = true;
}
if (strpos(strtolower($pers->address_post_code), strtolower($_GET["keyword"]))>-1) { // Postcode
$match = true;
}
}
if ($match!=true) {
unset($listings->listing[$lID]);
}
$lID += 1;
}
}
$output = $listings->DisplayListingGroup($show_ids);
$p->DisplayPage($output);
include("includes/inc.events.php");
?>