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