mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-06-18 02:59:27 +00:00
cleanup code
This commit is contained in:
parent
e9388dc3ec
commit
a74229eb14
|
@ -209,41 +209,17 @@ $terms = [];
|
||||||
$limit = (isset($_GET["limit"]) && is_numeric($_GET["limit"])) ? (int) $_GET['limit'] : 20;
|
$limit = (isset($_GET["limit"]) && is_numeric($_GET["limit"])) ? (int) $_GET['limit'] : 20;
|
||||||
$fullsearch = ((!isset($_GET["fullsearch"]) && $settings->_defaultSearchMethod == 'fulltext') || !empty($_GET["fullsearch"])) && $settings->_enableFullSearch;
|
$fullsearch = ((!isset($_GET["fullsearch"]) && $settings->_defaultSearchMethod == 'fulltext') || !empty($_GET["fullsearch"])) && $settings->_enableFullSearch;
|
||||||
$facetsearch = !empty($_GET["facetsearch"]) && $settings->_enableFullSearch;
|
$facetsearch = !empty($_GET["facetsearch"]) && $settings->_enableFullSearch;
|
||||||
if($fullsearch) {
|
|
||||||
// Search in Fulltext {{{
|
if (isset($_GET["query"]) && is_string($_GET["query"])) {
|
||||||
if (isset($_GET["query"]) && is_string($_GET["query"])) {
|
|
||||||
$query = $_GET["query"];
|
$query = $_GET["query"];
|
||||||
// if(isset($_GET['action']) && ($_GET['action'] == 'typeahead'))
|
} else {
|
||||||
// $query .= '*';
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$query = "";
|
$query = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
// Check to see if the search has been restricted to a particular
|
||||||
// Get the page number to display. If the result set contains more than
|
// mimetype. {{{
|
||||||
// 25 entries, it is displayed across multiple pages.
|
$mimetype = [];
|
||||||
//
|
if (isset($_GET["mimetype"])) {
|
||||||
// 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 (!is_array($_GET['mimetype'])) {
|
||||||
if(!empty($_GET['mimetype']))
|
if(!empty($_GET['mimetype']))
|
||||||
$mimetype[] = $_GET['mimetype'];
|
$mimetype[] = $_GET['mimetype'];
|
||||||
|
@ -253,37 +229,30 @@ if($fullsearch) {
|
||||||
$mimetype[] = $l;
|
$mimetype[] = $l;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
/* Creation date {{{
|
// status
|
||||||
$createstartts = null;
|
$status = isset($_GET['status']) ? $_GET['status'] : array();
|
||||||
$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
|
// Get the page number to display. If the result set contains more than
|
||||||
if(isset($_GET['status']))
|
// 25 entries, it is displayed across multiple pages.
|
||||||
$status = $_GET['status'];
|
//
|
||||||
else
|
// This requires that a page number variable be used to track which page the
|
||||||
$status = array();
|
// 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 {{{
|
||||||
|
|
||||||
// record_type
|
// record_type
|
||||||
if(isset($_GET['record_type']))
|
if(isset($_GET['record_type']))
|
||||||
|
@ -444,12 +413,6 @@ if($fullsearch) {
|
||||||
// }}}
|
// }}}
|
||||||
} else {
|
} else {
|
||||||
// Search in Database {{{
|
// 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)
|
/* Select if only documents (0x01), only folders (0x02) or both (0x03)
|
||||||
* are found
|
* are found
|
||||||
|
@ -497,45 +460,6 @@ if($fullsearch) {
|
||||||
UI::exitError(getMLText("search"),getMLText("invalid_folder_id"));
|
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 {{{ */
|
/* Status date {{{ */
|
||||||
$statusstartdate = array();
|
$statusstartdate = array();
|
||||||
$statusenddate = 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.
|
/* Do not search for folders if result shall be filtered by status.
|
||||||
* If this is not done, unexplainable results will be delivered.
|
* If this is not done, unexplainable results will be delivered.
|
||||||
* e.g. a search for expired documents of a given user will list
|
* 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 -----------------------------------------
|
// ---------------- Start searching -----------------------------------------
|
||||||
$startTime = getTime();
|
$startTime = getTime();
|
||||||
$resArr = $dms->search(array(
|
$resArr = $dms->search(array(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user