Changeset 2090 in ExiteCMS for trunk/includes/search/search.news.php
- Timestamp:
- 12/04/08 14:28:48 (3 years ago)
- File:
-
- 1 edited
-
trunk/includes/search/search.news.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/includes/search/search.news.php
r1935 r2090 44 44 } else { 45 45 46 // get the required variables (could be POST or GET vars!) 47 if (isset($stext)) { 48 $stext = stripinput($stext); 49 } else { 50 $stext = isset($_POST['stext']) ? stripinput($_POST['stext']) : ""; 51 } 52 $stext = str_replace(',', ' ', $stext); 53 $variables['stext'] = $stext; 54 // note: qtype not used because of a fulltext query 55 if (!isset($qtype)) { 56 $qtype = isset($_POST['qtype']) ? $_POST['qtype'] : "AND"; 57 } 58 if ($qtype != "OR" && $qtype != "AND") { 59 $qtype = "AND"; 60 } 61 if (!isset($datelimit)) { 62 $datelimit = isset($_POST['datelimit']) ? $_POST['datelimit'] : 0; 63 } 64 if (!isNum($datelimit)) { 65 $datelimit = 0; 66 } 67 if (!isset($sortby)) { 68 $sortby = isset($_POST['sortby']) ? $_POST['sortby'] : "score"; 69 } 70 if (!in_array($sortby, $select_filters)) { 71 $sortby = $select_filters[0]; 72 } 73 if (!isset($order)) { 74 $order = isset($_POST['order']) ? $_POST['order'] : 1; 75 } 76 if (!isNum($order)) { 77 $order = 1; 78 } 79 if (!isset($limit)) { 80 $limit = isset($_POST['limit']) ? $_POST['limit'] : 0; 81 } 82 if (!isNum($limit)) { 83 $limit = 0; 84 } 85 if (!isset($boolean)) { 86 $boolean = isset($_POST['boolean']) ? 0 : 1; 87 } 88 46 // make sure the sub search ID is defined 89 47 if (!isset($sub_search_id)) $sub_search_id = 0; 90 48 91 // construct the page navigator URL to allow paging 92 $variables['pagenav_url'] = FUSION_SELF."?action=search&search_id=".$search_id."&"; 93 $variables['pagenav_url'] .= "stext=".urlencode($stext)."&"; 94 $variables['pagenav_url'] .= "boolean=".$boolean."&"; 95 $variables['pagenav_url'] .= "datelimit=".$datelimit."&"; 96 $variables['pagenav_url'] .= "sortby=".$sortby."&"; 97 $variables['pagenav_url'] .= "order=".$order."&"; 98 $variables['pagenav_url'] .= "limit=".$limit."&"; 49 // retrieve the search criteria 50 if (isset($_SESSION['search'])) { 51 // from the session store (used when paging through the results) 52 $stext = $_SESSION['search']['stext']; 53 $qtype = $_SESSION['search']['qtype']; 54 $datelimit = $_SESSION['search']['datelimit']; 55 $boolean = $_SESSION['search']['boolean']; 56 $sortby = $_SESSION['search']['sortby']; 57 $order = $_SESSION['search']['order']; 58 $limit = $_SESSION['search']['limit']; 59 $contentfilter_forums = $_SESSION['search']['contentfilter_forums']; 60 $contentfilter_users = $_SESSION['search']['contentfilter_users']; 61 } else { 62 // from the search form 63 $stext = isset($_POST['stext']) ? stripinput($_POST['stext']) : ""; 64 $stext = str_replace(',', ' ', $stext); 65 $boolean = isset($_POST['boolean']) ? 0 : 1; 66 $qtype = isset($_POST['qtype']) ? stripinput($_POST['qtype']) : "AND"; 67 if ($qtype != "OR" && $qtype != "AND") { 68 $qtype = "AND"; 69 } 70 $sortby = isset($_POST['sortby']) ? stripinput($_POST['sortby']) : "score"; 71 if (!in_array($sortby, $select_filters)) { 72 $sortby = $select_filters[0]; 73 } 74 $order = isset($_POST['order']) && isNum($_POST['order']) ? $_POST['order'] : 1; 75 $limit = isset($_POST['limit']) && isNum($_POST['limit']) ? $_POST['limit'] : 0; 76 $datelimit = isset($_POST['datelimit']) && isNum($_POST['datelimit']) ? $_POST['datelimit'] : 0; 77 // add a forum filter if requested 78 if (isset($_POST['contentfilter_forums']) && isNum($_POST['contentfilter_forums']) && $_POST['contentfilter_forums'] > 0 ) { 79 $contentfilter_forums = stripinput($_POST['contentfilter_forums']); 80 } 81 // add an author if requested 82 if (isset($_POST['contentfilter_users']) && isNum($_POST['contentfilter_users']) && $_POST['contentfilter_users'] > 0 ) { 83 $contentfilter_users = stripinput($_POST['contentfilter_users']); 84 } 85 } 86 $variables['stext'] = $stext; 99 87 88 // store the search parameters in the session record 89 $_SESSION['search'] = array('stext' => $stext, 90 'qtype' => $qtype, 91 'datelimit' => $datelimit, 92 'boolean' => $boolean, 93 'sortby' => $sortby, 94 'order' => $order, 95 'limit' => $limit, 96 'contentfilter_forums' => $contentfilter_forums, 97 'contentfilter_users' => $contentfilter_users 98 ); 100 99 // basis of the query for this search 101 100 if ($boolean) { … … 128 127 $sql .= " AND news_datestamp >= ".(time() - $datelimit); 129 128 } 129 130 130 // add an author if requested 131 if ( isset($_POST['contentfilter_users']) && isNum($_POST['contentfilter_users']) && $_POST['contentfilter_users'] > 0) {132 $sql .= " AND ( tp.post_author = '".$_POST['contentfilter_users']."'"." OR tp.post_edituser = '".$_POST['contentfilter_users']."')";131 if (!empty($contentfilter_users)) { 132 $sql .= " AND (news_name = '".$contentfilter_users."'"." OR news_name = '".$contentfilter_users."')"; 133 133 } 134 134
Note: See TracChangeset
for help on using the changeset viewer.
