diff --git a/out/out.Search.php b/out/out.Search.php index cae2b796f..b174dc829 100644 --- a/out/out.Search.php +++ b/out/out.Search.php @@ -209,81 +209,50 @@ $terms = []; $limit = (isset($_GET["limit"]) && is_numeric($_GET["limit"])) ? (int) $_GET['limit'] : 20; $fullsearch = ((!isset($_GET["fullsearch"]) && $settings->_defaultSearchMethod == 'fulltext') || !empty($_GET["fullsearch"])) && $settings->_enableFullSearch; $facetsearch = !empty($_GET["facetsearch"]) && $settings->_enableFullSearch; + +if (isset($_GET["query"]) && is_string($_GET["query"])) { + $query = $_GET["query"]; +} else { + $query = ""; +} + +// Check to see if the search has been restricted to a particular +// mimetype. {{{ +$mimetype = []; +if (isset($_GET["mimetype"])) { + if (!is_array($_GET['mimetype'])) { + if(!empty($_GET['mimetype'])) + $mimetype[] = $_GET['mimetype']; + } else { + foreach($_GET["mimetype"] as $l) { + if($l) + $mimetype[] = $l; + } + } +} /* }}} */ + +// status +$status = isset($_GET['status']) ? $_GET['status'] : array(); + +// Get the page number to display. If the result set contains more than +// 25 entries, it is displayed across multiple pages. +// +// This requires that a page number variable be used to track which page the +// user is interested in, and an extra clause on the select statement. +// +// Default page to display is always one. +$pageNumber=1; +if (isset($_GET["pg"])) { + if (is_numeric($_GET["pg"]) && $_GET["pg"]>0) { + $pageNumber = (int) $_GET["pg"]; + } + elseif (!strcasecmp($_GET["pg"], "all")) { + $pageNumber = "all"; + } +} + if($fullsearch) { -// Search in Fulltext {{{ - if (isset($_GET["query"]) && is_string($_GET["query"])) { - $query = $_GET["query"]; -// if(isset($_GET['action']) && ($_GET['action'] == 'typeahead')) -// $query .= '*'; - } - else { - $query = ""; - } - - // - // Get the page number to display. If the result set contains more than - // 25 entries, it is displayed across multiple pages. - // - // This requires that a page number variable be used to track which page the - // user is interested in, and an extra clause on the select statement. - // - // Default page to display is always one. - $pageNumber=1; - if (isset($_GET["pg"])) { - if (is_numeric($_GET["pg"]) && $_GET["pg"]>0) { - $pageNumber = (integer)$_GET["pg"]; - } - elseif (!strcasecmp($_GET["pg"], "all")) { - $pageNumber = "all"; - } - } - - // --------------- Suche starten -------------------------------------------- - - // Check to see if the search has been restricted to a particular - // mimetype. {{{ - $mimetype = []; - if (isset($_GET["mimetype"])) { - if (!is_array($_GET['mimetype'])) { - if(!empty($_GET['mimetype'])) - $mimetype[] = $_GET['mimetype']; - } else { - foreach($_GET["mimetype"] as $l) { - if($l) - $mimetype[] = $l; - } - } - } /* }}} */ - - /* Creation date {{{ - $createstartts = null; - $createstartdate = null; - $createendts = null; - $createenddate = null; - $created = []; - if(!empty($_GET["created"]["from"])) { - $createstartts = makeTsFromDate($_GET["created"]["from"]); - $createstartdate = array('year'=>(int)date('Y', $createstartts), 'month'=>(int)date('m', $createstartts), 'day'=>(int)date('d', $createstartts), 'hour'=>0, 'minute'=>0, 'second'=>0); - if (!checkdate($createstartdate['month'], $createstartdate['day'], $createstartdate['year'])) { - UI::exitError(getMLText("search"),getMLText("invalid_create_date_end")); - } - $created['from'] = $createstartts; - } - if(!empty($_GET["created"]["to"])) { - $createendts = makeTsFromDate($_GET["created"]["to"]); - $createenddate = array('year'=>(int)date('Y', $createendts), 'month'=>(int)date('m', $createendts), 'day'=>(int)date('d', $createendts), 'hour'=>23, 'minute'=>59, 'second'=>59); - if (!checkdate($createenddate['month'], $createenddate['day'], $createenddate['year'])) { - UI::exitError(getMLText("search"),getMLText("invalid_create_date_end")); - } - $created['to'] = $createendts; - } - }}} */ - - // status - if(isset($_GET['status'])) - $status = $_GET['status']; - else - $status = array(); + // Search in Fulltext {{{ // record_type if(isset($_GET['record_type'])) @@ -444,12 +413,6 @@ if($fullsearch) { // }}} } else { // Search in Database {{{ - if (isset($_GET["query"]) && is_string($_GET["query"])) { - $query = $_GET["query"]; - } - else { - $query = ""; - } /* Select if only documents (0x01), only folders (0x02) or both (0x03) * are found @@ -497,45 +460,6 @@ if($fullsearch) { UI::exitError(getMLText("search"),getMLText("invalid_folder_id")); } - // Check to see if the search has been restricted to a particular - /* document owner. {{{ - $owner = array(); - $ownerobjs = array(); - if (isset($_GET["owner"])) { - $owner = $_GET['owner']; - if (!is_array($_GET['owner'])) { - if(!empty($_GET['owner']) && $o = $dms->getUser($_GET['owner'])) { - $ownerobjs[] = $o; - } else - UI::exitError(getMLText("search"),getMLText("unknown_owner")); - } else { - foreach($_GET["owner"] as $l) { - if($o = $dms->getUser($l)) { - $ownerobjs[] = $o; - } - } - } - } }}} */ - - /* Creation date {{{ - $createstartdate = array(); - $createenddate = array(); - if(!empty($_GET["createstart"])) { - $createstartts = makeTsFromDate($_GET["createstart"]); - $createstartdate = array('year'=>(int)date('Y', $createstartts), 'month'=>(int)date('m', $createstartts), 'day'=>(int)date('d', $createstartts), 'hour'=>0, 'minute'=>0, 'second'=>0); - } - if ($createstartdate && !checkdate($createstartdate['month'], $createstartdate['day'], $createstartdate['year'])) { - UI::exitError(getMLText("search"),getMLText("invalid_create_date_end")); - } - if(!empty($_GET["createend"])) { - $createendts = makeTsFromDate($_GET["createend"]); - $createenddate = array('year'=>(int)date('Y', $createendts), 'month'=>(int)date('m', $createendts), 'day'=>(int)date('d', $createendts), 'hour'=>23, 'minute'=>59, 'second'=>59); - } - if ($createenddate && !checkdate($createenddate['month'], $createenddate['day'], $createenddate['year'])) { - UI::exitError(getMLText("search"),getMLText("invalid_create_date_end")); - } - }}} */ - /* Status date {{{ */ $statusstartdate = array(); $statusenddate = array(); @@ -574,48 +498,6 @@ if($fullsearch) { } /* }}} */ - // Check to see if the search has been restricted to a particular - // mimetype. {{{ - $mimetype = []; - if (isset($_GET["mimetype"])) { - if (!is_array($_GET['mimetype'])) { - if(!empty($_GET['mimetype'])) - $mimetype[] = $_GET['mimetype']; - } else { - foreach($_GET["mimetype"] as $l) { - if($l) - $mimetype[] = $l; - } - } - } /* }}} */ - - // status - $status = isset($_GET['status']) ? $_GET['status'] : array(); - /* - $status = array(); - if (isset($_GET["pendingReview"])){ - $status[] = S_DRAFT_REV; - } - if (isset($_GET["pendingApproval"])){ - $status[] = S_DRAFT_APP; - } - if (isset($_GET["inWorkflow"])){ - $status[] = S_IN_WORKFLOW; - } - if (isset($_GET["released"])){ - $status[] = S_RELEASED; - } - if (isset($_GET["rejected"])){ - $status[] = S_REJECTED; - } - if (isset($_GET["obsolete"])){ - $status[] = S_OBSOLETE; - } - if (isset($_GET["expired"])){ - $status[] = S_EXPIRED; - } - */ - /* Do not search for folders if result shall be filtered by status. * If this is not done, unexplainable results will be delivered. * e.g. a search for expired documents of a given user will list @@ -646,25 +528,6 @@ if($fullsearch) { } } - // - // Get the page number to display. If the result set contains more than - // 25 entries, it is displayed across multiple pages. - // - // This requires that a page number variable be used to track which page the - // user is interested in, and an extra clause on the select statement. - // - // Default page to display is always one. - $pageNumber=1; -// $limit = 15; - if (isset($_GET["pg"])) { - if (is_numeric($_GET["pg"]) && $_GET["pg"]>0) { - $pageNumber = (int) $_GET["pg"]; - } - elseif (!strcasecmp($_GET["pg"], "all")) { - $pageNumber = "all"; - } - } - // ---------------- Start searching ----------------------------------------- $startTime = getTime(); $resArr = $dms->search(array(