Changeset 2091 in ExiteCMS for modules/common/wiki/php-files/modules/wiki/search.wiki.php
- Timestamp:
- 12/04/08 14:50:04 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
modules/common/wiki/php-files/modules/wiki/search.wiki.php
r2043 r2091 50 50 } else { 51 51 52 // get the required variables (could be POST or GET vars!) 53 if (isset($stext)) { 54 $stext = stripinput($stext); 52 // make sure the sub search ID is defined 53 if (!isset($sub_search_id)) $sub_search_id = 0; 54 55 // retrieve the search criteria 56 if (isset($_SESSION['search'])) { 57 // from the session store (used when paging through the results) 58 $stext = $_SESSION['search']['stext']; 59 $qtype = $_SESSION['search']['qtype']; 60 $datelimit = $_SESSION['search']['datelimit']; 61 $boolean = $_SESSION['search']['boolean']; 62 $sortby = $_SESSION['search']['sortby']; 63 $order = $_SESSION['search']['order']; 64 $limit = $_SESSION['search']['limit']; 65 $contentfilter_forums = $_SESSION['search']['contentfilter_forums']; 66 $contentfilter_users = $_SESSION['search']['contentfilter_users']; 55 67 } else { 68 // from the search form 56 69 $stext = isset($_POST['stext']) ? stripinput($_POST['stext']) : ""; 57 } 58 $stext = str_replace(',', ' ', $stext); 70 $stext = str_replace(',', ' ', $stext); 71 $boolean = isset($_POST['boolean']) ? 0 : 1; 72 $qtype = isset($_POST['qtype']) ? stripinput($_POST['qtype']) : "AND"; 73 if ($qtype != "OR" && $qtype != "AND") { 74 $qtype = "AND"; 75 } 76 $sortby = isset($_POST['sortby']) ? stripinput($_POST['sortby']) : "score"; 77 if (!in_array($sortby, $select_filters)) { 78 $sortby = $select_filters[0]; 79 } 80 $order = isset($_POST['order']) && isNum($_POST['order']) ? $_POST['order'] : 1; 81 $limit = isset($_POST['limit']) && isNum($_POST['limit']) ? $_POST['limit'] : 0; 82 $datelimit = isset($_POST['datelimit']) && isNum($_POST['datelimit']) ? $_POST['datelimit'] : 0; 83 // add a forum filter if requested 84 if (isset($_POST['contentfilter_forums']) && isNum($_POST['contentfilter_forums']) && $_POST['contentfilter_forums'] > 0 ) { 85 $contentfilter_forums = stripinput($_POST['contentfilter_forums']); 86 } 87 // add an author if requested 88 if (isset($_POST['contentfilter_users']) && isNum($_POST['contentfilter_users']) && $_POST['contentfilter_users'] > 0 ) { 89 $contentfilter_users = stripinput($_POST['contentfilter_users']); 90 } 91 } 59 92 $variables['stext'] = $stext; 60 93 61 if (!isset($qtype)) { 62 $qtype = isset($_POST['qtype']) ? $_POST['qtype'] : "AND"; 63 } 64 if ($qtype != "OR" && $qtype != "AND") { 65 $qtype = "AND"; 66 } 67 if (!isset($datelimit)) { 68 $datelimit = isset($_POST['datelimit']) ? $_POST['datelimit'] : 0; 69 } 70 if (!isNum($datelimit)) { 71 $datelimit = 0; 72 } 73 if (!isset($sortby)) { 74 $sortby = isset($_POST['sortby']) ? $_POST['sortby'] : "score"; 75 } 76 if (!in_array($sortby, $select_filters)) { 77 $sortby = $select_filters[0]; 78 } 79 if (!isset($order)) { 80 $order = isset($_POST['order']) ? $_POST['order'] : 1; 81 } 82 if (!isNum($order)) { 83 $order = 1; 84 } 85 if (!isset($limit)) { 86 $limit = isset($_POST['limit']) ? $_POST['limit'] : 0; 87 } 88 if (!isNum($limit)) { 89 $limit = 0; 90 } 91 if (!isset($boolean)) { 92 $boolean = isset($_POST['boolean']) ? 0 : 1; 93 } 94 95 if (!isset($sub_search_id)) $sub_search_id = 0; 96 97 // construct the page navigator URL to allow paging 98 $variables['pagenav_url'] = FUSION_SELF."?action=search&search_id=".$search_id."&"; 99 $variables['pagenav_url'] .= "stext=".urlencode($stext)."&"; 100 $variables['pagenav_url'] .= "boolean=".$boolean."&"; 101 $variables['pagenav_url'] .= "datelimit=".$datelimit."&"; 102 $variables['pagenav_url'] .= "sortby=".$sortby."&"; 103 $variables['pagenav_url'] .= "order=".$order."&"; 104 $variables['pagenav_url'] .= "limit=".$limit."&"; 94 // store the search parameters in the session record 95 $_SESSION['search'] = array('stext' => $stext, 96 'qtype' => $qtype, 97 'datelimit' => $datelimit, 98 'boolean' => $boolean, 99 'sortby' => $sortby, 100 'order' => $order, 101 'limit' => $limit, 102 'contentfilter_forums' => $contentfilter_forums, 103 'contentfilter_users' => $contentfilter_users 104 ); 105 105 106 106 // basis of the query for this search
Note: See TracChangeset
for help on using the changeset viewer.
