Changeset 2090 in ExiteCMS for trunk/includes/search/search.forumposts.php
- Timestamp:
- 12/04/08 14:28:48 (3 years ago)
- File:
-
- 1 edited
-
trunk/includes/search/search.forumposts.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/includes/search/search.forumposts.php
r1935 r2090 61 61 } else { 62 62 63 // get the required variables (could be POST or GET vars!) 64 if (isset($stext)) { 65 $stext = stripinput($stext); 63 // make sure the sub search ID is defined 64 if (!isset($sub_search_id)) $sub_search_id = 0; 65 66 // retrieve the search criteria 67 if (isset($_SESSION['search'])) { 68 // from the session store (used when paging through the results) 69 $stext = $_SESSION['search']['stext']; 70 $qtype = $_SESSION['search']['qtype']; 71 $datelimit = $_SESSION['search']['datelimit']; 72 $boolean = $_SESSION['search']['boolean']; 73 $sortby = $_SESSION['search']['sortby']; 74 $order = $_SESSION['search']['order']; 75 $limit = $_SESSION['search']['limit']; 76 $contentfilter_forums = $_SESSION['search']['contentfilter_forums']; 77 $contentfilter_users = $_SESSION['search']['contentfilter_users']; 66 78 } else { 79 // from the search form 67 80 $stext = isset($_POST['stext']) ? stripinput($_POST['stext']) : ""; 68 } 69 $stext = str_replace(',', ' ', $stext); 81 $stext = str_replace(',', ' ', $stext); 82 $boolean = isset($_POST['boolean']) ? 0 : 1; 83 $qtype = isset($_POST['qtype']) ? stripinput($_POST['qtype']) : "AND"; 84 if ($qtype != "OR" && $qtype != "AND") { 85 $qtype = "AND"; 86 } 87 $sortby = isset($_POST['sortby']) ? stripinput($_POST['sortby']) : "score"; 88 if (!in_array($sortby, $select_filters)) { 89 $sortby = $select_filters[0]; 90 } 91 $order = isset($_POST['order']) && isNum($_POST['order']) ? $_POST['order'] : 1; 92 $limit = isset($_POST['limit']) && isNum($_POST['limit']) ? $_POST['limit'] : 0; 93 $datelimit = isset($_POST['datelimit']) && isNum($_POST['datelimit']) ? $_POST['datelimit'] : 0; 94 // add a forum filter if requested 95 if (isset($_POST['contentfilter_forums']) && isNum($_POST['contentfilter_forums']) && $_POST['contentfilter_forums'] > 0 ) { 96 $contentfilter_forums = stripinput($_POST['contentfilter_forums']); 97 } 98 // add an author if requested 99 if (isset($_POST['contentfilter_users']) && isNum($_POST['contentfilter_users']) && $_POST['contentfilter_users'] > 0 ) { 100 $contentfilter_users = stripinput($_POST['contentfilter_users']); 101 } 102 } 70 103 $variables['stext'] = $stext; 71 104 72 // note: qtype not used because of a fulltext query 73 if (!isset($qtype)) { 74 $qtype = isset($_POST['qtype']) ? $_POST['qtype'] : "AND"; 75 } 76 if ($qtype != "OR" && $qtype != "AND") { 77 $qtype = "AND"; 78 } 79 if (!isset($datelimit)) { 80 $datelimit = isset($_POST['datelimit']) ? $_POST['datelimit'] : 0; 81 } 82 if (!isNum($datelimit)) { 83 $datelimit = 0; 84 } 85 if (!isset($sortby)) { 86 $sortby = isset($_POST['sortby']) ? $_POST['sortby'] : "score"; 87 } 88 if (!in_array($sortby, $select_filters)) { 89 $sortby = $select_filters[0]; 90 } 91 if (!isset($order)) { 92 $order = isset($_POST['order']) ? $_POST['order'] : 1; 93 } 94 if (!isNum($order)) { 95 $order = 1; 96 } 97 if (!isset($limit)) { 98 $limit = isset($_POST['limit']) ? $_POST['limit'] : 0; 99 } 100 if (!isNum($limit)) { 101 $limit = 0; 102 } 103 if (!isset($boolean)) { 104 $boolean = isset($_POST['boolean']) ? 0 : 1; 105 } 106 107 if (!isset($sub_search_id)) $sub_search_id = 0; 108 109 // construct the page navigator URL to allow paging 110 $variables['pagenav_url'] = FUSION_SELF."?action=search&search_id=".$search_id."&"; 111 $variables['pagenav_url'] .= "stext=".$stext."&"; 112 $variables['pagenav_url'] .= "boolean=".$boolean."&"; 113 $variables['pagenav_url'] .= "datelimit=".$datelimit."&"; 114 $variables['pagenav_url'] .= "sortby=".$sortby."&"; 115 $variables['pagenav_url'] .= "order=".$order."&"; 116 $variables['pagenav_url'] .= "limit=".$limit."&"; 105 // store the search parameters in the session record 106 $_SESSION['search'] = array('stext' => $stext, 107 'qtype' => $qtype, 108 'datelimit' => $datelimit, 109 'boolean' => $boolean, 110 'sortby' => $sortby, 111 'order' => $order, 112 'limit' => $limit, 113 'contentfilter_forums' => $contentfilter_forums, 114 'contentfilter_users' => $contentfilter_users 115 ); 117 116 118 117 // basis of the query for this search … … 172 171 173 172 // add a forum filter if requested 174 if (isset($_POST['contentfilter_forums']) && isNum($_POST['contentfilter_forums']) && $_POST['contentfilter_forums'] > 0 ) { 175 $sql .= " AND tp.forum_id = '".$_POST['contentfilter_forums']."'"; 176 } 173 if (!empty($contentfilter_forums)) { 174 $sql .= " AND tp.forum_id = '".$contentfilter_forums."'"; 175 } 176 177 177 // add an author if requested 178 if ( isset($_POST['contentfilter_users']) && isNum($_POST['contentfilter_users']) && $_POST['contentfilter_users'] > 0) {179 $sql .= " AND (tp.post_author = '".$ _POST['contentfilter_users']."'"." OR tp.post_edituser = '".$_POST['contentfilter_users']."')";178 if (!empty($contentfilter_users)) { 179 $sql .= " AND (tp.post_author = '".$contentfilter_users."'"." OR tp.post_edituser = '".$contentfilter_users."')"; 180 180 } 181 181 … … 201 201 // check if we have a rowstart value 202 202 if (!isset($rowstart)) $rowstart = 0; 203 203 204 204 // check how many rows this would output 205 205 $rptresult = mysql_query($sql.($limit?" LIMIT $limit":""));
Note: See TracChangeset
for help on using the changeset viewer.
