mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-06-15 17:49:19 +00:00
varios minor changes in preparation to moving search functionality into own class
This commit is contained in:
parent
4c6d047bb8
commit
ba18e89cda
|
@ -29,55 +29,57 @@ require_once("inc/inc.DBInit.php");
|
|||
require_once("inc/inc.ClassUI.php");
|
||||
require_once("inc/inc.Authentication.php");
|
||||
|
||||
function getTime() {
|
||||
function getTime() { /* {{{ */
|
||||
if (function_exists('microtime')) {
|
||||
$tm = microtime();
|
||||
$tm = explode(' ', $tm);
|
||||
return (float) sprintf('%f', $tm[1] + $tm[0]);
|
||||
}
|
||||
return time();
|
||||
}
|
||||
} /* }}} */
|
||||
|
||||
$get = $_GET;
|
||||
|
||||
// Redirect to the search page if the navigation search button has been
|
||||
// selected without supplying any search terms.
|
||||
if (isset($_GET["navBar"])) {
|
||||
if (!isset($_GET["folderid"]) || !is_numeric($_GET["folderid"]) || intval($_GET["folderid"])<1) {
|
||||
if (isset($get["navBar"])) {
|
||||
if (!isset($get["folderid"]) || !is_numeric($get["folderid"]) || intval($get["folderid"])<1) {
|
||||
$folderid=$settings->_rootFolderID;
|
||||
} else {
|
||||
$folderid = $_GET["folderid"];
|
||||
$folderid = $get["folderid"];
|
||||
}
|
||||
}
|
||||
|
||||
$includecontent = false;
|
||||
if (isset($_GET["includecontent"]) && $_GET["includecontent"])
|
||||
if (isset($get["includecontent"]) && $get["includecontent"])
|
||||
$includecontent = true;
|
||||
|
||||
$skipdefaultcols = false;
|
||||
if (isset($_GET["skipdefaultcols"]) && $_GET["skipdefaultcols"])
|
||||
if (isset($get["skipdefaultcols"]) && $get["skipdefaultcols"])
|
||||
$skipdefaultcols = true;
|
||||
|
||||
$newowner = null;
|
||||
if (isset($_GET["newowner"]) && is_numeric($_GET["newowner"]) && $_GET['newowner'] > 0) {
|
||||
$newowner = $dms->getUser((int) $_GET['newowner']);
|
||||
if (isset($get["newowner"]) && is_numeric($get["newowner"]) && $get['newowner'] > 0) {
|
||||
$newowner = $dms->getUser((int) $get['newowner']);
|
||||
}
|
||||
|
||||
$newreviewer = null;
|
||||
if (isset($_GET["newreviewer"]) && is_numeric($_GET["newreviewer"]) && $_GET['newreviewer'] > 0) {
|
||||
$newreviewer = $dms->getUser((int) $_GET['newreviewer']);
|
||||
if (isset($get["newreviewer"]) && is_numeric($get["newreviewer"]) && $get['newreviewer'] > 0) {
|
||||
$newreviewer = $dms->getUser((int) $get['newreviewer']);
|
||||
}
|
||||
|
||||
$newapprover = null;
|
||||
if (isset($_GET["newapprover"]) && is_numeric($_GET["newapprover"]) && $_GET['newapprover'] > 0) {
|
||||
$newapprover = $dms->getUser((int) $_GET['newapprover']);
|
||||
if (isset($get["newapprover"]) && is_numeric($get["newapprover"]) && $get['newapprover'] > 0) {
|
||||
$newapprover = $dms->getUser((int) $get['newapprover']);
|
||||
}
|
||||
|
||||
$changecategory = null;
|
||||
if (isset($_GET["changecategory"]) && is_numeric($_GET["changecategory"]) && $_GET['changecategory'] > 0) {
|
||||
$changecategory = $dms->getDocumentCategory((int) $_GET['changecategory']);
|
||||
if (isset($get["changecategory"]) && is_numeric($get["changecategory"]) && $get['changecategory'] > 0) {
|
||||
$changecategory = $dms->getDocumentCategory((int) $get['changecategory']);
|
||||
}
|
||||
$removecategory = 0;
|
||||
if (isset($_GET["removecategory"]) && is_numeric($_GET["removecategory"]) && $_GET['removecategory'] > 0) {
|
||||
$removecategory = (int) $_GET['removecategory'];
|
||||
if (isset($get["removecategory"]) && is_numeric($get["removecategory"]) && $get['removecategory'] > 0) {
|
||||
$removecategory = (int) $get['removecategory'];
|
||||
}
|
||||
|
||||
/* Creation date {{{ */
|
||||
|
@ -87,16 +89,16 @@ $createendts = null;
|
|||
$createenddate = null;
|
||||
$created['from'] = null;
|
||||
$created['to'] = null;
|
||||
if(!empty($_GET["created"]["from"])) {
|
||||
$createstartts = makeTsFromDate($_GET["created"]["from"]);
|
||||
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"]);
|
||||
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"));
|
||||
|
@ -112,16 +114,16 @@ $modifyendts = null;
|
|||
$modifyenddate = null;
|
||||
$modified['from'] = null;
|
||||
$modified['to'] = null;
|
||||
if(!empty($_GET["modified"]["from"])) {
|
||||
$modifystartts = makeTsFromDate($_GET["modified"]["from"]);
|
||||
if(!empty($get["modified"]["from"])) {
|
||||
$modifystartts = makeTsFromDate($get["modified"]["from"]);
|
||||
$modifystartdate = array('year'=>(int)date('Y', $modifystartts), 'month'=>(int)date('m', $modifystartts), 'day'=>(int)date('d', $modifystartts), 'hour'=>0, 'minute'=>0, 'second'=>0);
|
||||
if (!checkdate($modifystartdate['month'], $modifystartdate['day'], $modifystartdate['year'])) {
|
||||
UI::exitError(getMLText("search"),getMLText("invalid_modification_date_end"));
|
||||
}
|
||||
$modified['from'] = $modifystartts;
|
||||
}
|
||||
if(!empty($_GET["modified"]["to"])) {
|
||||
$modifyendts = makeTsFromDate($_GET["modified"]["to"]);
|
||||
if(!empty($get["modified"]["to"])) {
|
||||
$modifyendts = makeTsFromDate($get["modified"]["to"]);
|
||||
$modifyenddate = array('year'=>(int)date('Y', $modifyendts), 'month'=>(int)date('m', $modifyendts), 'day'=>(int)date('d', $modifyendts), 'hour'=>23, 'minute'=>59, 'second'=>59);
|
||||
if (!checkdate($modifyenddate['month'], $modifyenddate['day'], $modifyenddate['year'])) {
|
||||
UI::exitError(getMLText("search"),getMLText("invalid_modification_date_end"));
|
||||
|
@ -135,35 +137,35 @@ $filesizestart = 0;
|
|||
$filesizeend = 0;
|
||||
$filesize['from'] = null;
|
||||
$filesize['to'] = null;
|
||||
if(!empty($_GET["filesize"]["from"])) {
|
||||
$filesizestart = $_GET["filesize"]["from"];
|
||||
$filesize['from'] = $_GET["filesize"]["from"];
|
||||
if(!empty($get["filesize"]["from"])) {
|
||||
$filesizestart = $get["filesize"]["from"];
|
||||
$filesize['from'] = $get["filesize"]["from"];
|
||||
}
|
||||
if(!empty($_GET["filesize"]["to"])) {
|
||||
$filesizeend = $_GET["filesize"]["to"];
|
||||
$filesize['to'] = $_GET["filesize"]["to"];
|
||||
if(!empty($get["filesize"]["to"])) {
|
||||
$filesizeend = $get["filesize"]["to"];
|
||||
$filesize['to'] = $get["filesize"]["to"];
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
// Check to see if the search has been restricted to a particular
|
||||
// document owner.
|
||||
// $_GET['owner'] can be a name of an array of names or ids {{{
|
||||
// $get['owner'] can be a name of an array of names or ids {{{
|
||||
$owner = [];
|
||||
$ownernames = []; // Needed by fulltext search
|
||||
$ownerobjs = []; // Needed by database search
|
||||
if(!empty($_GET["owner"])) {
|
||||
$owner = $_GET['owner'];
|
||||
if (!is_array($_GET['owner'])) {
|
||||
if(is_numeric($_GET['owner']))
|
||||
$o = $dms->getUser($_GET['owner']);
|
||||
if(!empty($get["owner"])) {
|
||||
$owner = $get['owner'];
|
||||
if (!is_array($get['owner'])) {
|
||||
if(is_numeric($get['owner']))
|
||||
$o = $dms->getUser($get['owner']);
|
||||
else
|
||||
$o = $dms->getUserByLogin($_GET['owner']);
|
||||
$o = $dms->getUserByLogin($get['owner']);
|
||||
if($o) {
|
||||
$ownernames[] = $o->getLogin();
|
||||
$ownerobjs[] = $o;
|
||||
}
|
||||
} else {
|
||||
foreach($_GET["owner"] as $l) {
|
||||
foreach($get["owner"] as $l) {
|
||||
if($l) {
|
||||
if(is_numeric($l))
|
||||
$o = $dms->getUser($l);
|
||||
|
@ -178,40 +180,39 @@ if(!empty($_GET["owner"])) {
|
|||
}
|
||||
} /* }}} */
|
||||
|
||||
// category {{{
|
||||
$categories = array();
|
||||
$categorynames = array();
|
||||
$category = array();
|
||||
if(isset($_GET['category']) && $_GET['category']) {
|
||||
$category = $_GET['category'];
|
||||
foreach($_GET['category'] as $catid) {
|
||||
if($catid) {
|
||||
if(is_numeric($catid)) {
|
||||
if($cat = $dms->getDocumentCategory($catid)) {
|
||||
$categories[] = $cat;
|
||||
$categorynames[] = $cat->getName();
|
||||
}
|
||||
} else {
|
||||
$categorynames[] = $catid;
|
||||
// category {{{
|
||||
$categories = array();
|
||||
$categorynames = array();
|
||||
$category = array();
|
||||
if(isset($get['category']) && $get['category']) {
|
||||
$category = $get['category'];
|
||||
foreach($get['category'] as $catid) {
|
||||
if($catid) {
|
||||
if(is_numeric($catid)) {
|
||||
if($cat = $dms->getDocumentCategory($catid)) {
|
||||
$categories[] = $cat;
|
||||
$categorynames[] = $cat->getName();
|
||||
}
|
||||
} else {
|
||||
$categorynames[] = $catid;
|
||||
}
|
||||
}
|
||||
} /* }}} */
|
||||
}
|
||||
} /* }}} */
|
||||
|
||||
if (isset($_GET["orderby"]) && is_string($_GET["orderby"])) {
|
||||
$orderby = $_GET["orderby"];
|
||||
}
|
||||
else {
|
||||
$orderby = "";
|
||||
}
|
||||
if (isset($get["orderby"]) && is_string($get["orderby"])) {
|
||||
$orderby = $get["orderby"];
|
||||
} else {
|
||||
$orderby = "";
|
||||
}
|
||||
|
||||
$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;
|
||||
$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"];
|
||||
if (isset($get["query"]) && is_string($get["query"])) {
|
||||
$query = $get["query"];
|
||||
} else {
|
||||
$query = "";
|
||||
}
|
||||
|
@ -219,12 +220,12 @@ if (isset($_GET["query"]) && is_string($_GET["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'];
|
||||
if (isset($get["mimetype"])) {
|
||||
if (!is_array($get['mimetype'])) {
|
||||
if(!empty($get['mimetype']))
|
||||
$mimetype[] = $get['mimetype'];
|
||||
} else {
|
||||
foreach($_GET["mimetype"] as $l) {
|
||||
foreach($get["mimetype"] as $l) {
|
||||
if($l)
|
||||
$mimetype[] = $l;
|
||||
}
|
||||
|
@ -232,7 +233,7 @@ if (isset($_GET["mimetype"])) {
|
|||
} /* }}} */
|
||||
|
||||
// status
|
||||
$status = isset($_GET['status']) ? $_GET['status'] : array();
|
||||
$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.
|
||||
|
@ -242,11 +243,11 @@ $status = isset($_GET['status']) ? $_GET['status'] : array();
|
|||
//
|
||||
// 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"];
|
||||
if (isset($get["pg"])) {
|
||||
if (is_numeric($get["pg"]) && $get["pg"]>0) {
|
||||
$pageNumber = (int) $get["pg"];
|
||||
}
|
||||
elseif (!strcasecmp($_GET["pg"], "all")) {
|
||||
elseif (!strcasecmp($get["pg"], "all")) {
|
||||
$pageNumber = "all";
|
||||
}
|
||||
}
|
||||
|
@ -255,13 +256,13 @@ if($fullsearch) {
|
|||
// Search in Fulltext {{{
|
||||
|
||||
// record_type
|
||||
if(isset($_GET['record_type']))
|
||||
$record_type = $_GET['record_type'];
|
||||
if(isset($get['record_type']))
|
||||
$record_type = $get['record_type'];
|
||||
else
|
||||
$record_type = array();
|
||||
|
||||
if (isset($_GET["attributes"]))
|
||||
$attributes = $_GET["attributes"];
|
||||
if (isset($get["attributes"]))
|
||||
$attributes = $get["attributes"];
|
||||
else
|
||||
$attributes = array();
|
||||
|
||||
|
@ -313,8 +314,8 @@ if($fullsearch) {
|
|||
// Check to see if the search has been restricted to a particular sub-tree in
|
||||
// the folder hierarchy.
|
||||
$startFolder = null;
|
||||
if (isset($_GET["folderfullsearchid"]) && is_numeric($_GET["folderfullsearchid"]) && $_GET["folderfullsearchid"]>0) {
|
||||
$targetid = $_GET["folderfullsearchid"];
|
||||
if (isset($get["folderfullsearchid"]) && is_numeric($get["folderfullsearchid"]) && $get["folderfullsearchid"]>0) {
|
||||
$targetid = $get["folderfullsearchid"];
|
||||
$startFolder = $dms->getFolder($targetid);
|
||||
if (!is_object($startFolder)) {
|
||||
UI::exitError(getMLText("search"),getMLText("invalid_folder_id"));
|
||||
|
@ -323,7 +324,6 @@ if($fullsearch) {
|
|||
|
||||
$rootFolder = $dms->getFolder($settings->_rootFolderID);
|
||||
|
||||
$startTime = getTime();
|
||||
if($settings->_fullSearchEngine == 'lucene') {
|
||||
Zend_Search_Lucene_Search_QueryParser::setDefaultEncoding('utf-8');
|
||||
}
|
||||
|
@ -331,6 +331,7 @@ if($fullsearch) {
|
|||
if(strlen($query) < 4 && strpos($query, '*')) {
|
||||
$session->setSplashMsg(array('type'=>'error', 'msg'=>getMLText('splash_invalid_searchterm')));
|
||||
$dcount = 0;
|
||||
$fcount = 0;
|
||||
$totalPages = 0;
|
||||
$entries = array();
|
||||
$searchTime = 0;
|
||||
|
@ -340,13 +341,30 @@ if($fullsearch) {
|
|||
$total = 0;
|
||||
$index = $fulltextservice->Indexer();
|
||||
if($index) {
|
||||
if(!empty($settings->_suggestTerms) && !empty($_GET['query'])) {
|
||||
$st = preg_split("/[\s,]+/", trim($_GET['query']));
|
||||
if(!empty($settings->_suggestTerms) && !empty($get['query'])) {
|
||||
$st = preg_split("/[\s,]+/", trim($get['query']));
|
||||
if($lastterm = end($st))
|
||||
$terms = $index->terms($lastterm, $settings->_suggestTerms);
|
||||
}
|
||||
$lucenesearch = $fulltextservice->Search();
|
||||
$searchresult = $lucenesearch->search($query, array('record_type'=>$record_type, 'owner'=>$ownernames, 'status'=>$status, 'category'=>$categorynames, 'user'=>$user->isAdmin() ? [] : [$user->getLogin()], 'mimetype'=>$mimetype, 'startFolder'=>$startFolder, 'rootFolder'=>$rootFolder, 'created_start'=>$createstartts, 'created_end'=>$createendts, 'modified_start'=>$modifystartts, 'modified_end'=>$modifyendts, 'filesize_start'=>$filesizestart, 'filesize_end'=>$filesizeend, 'attributes'=>$attributes), ($pageNumber == 'all' ? array() : array('limit'=>$limit, 'offset'=>$limit * ($pageNumber-1))), $order);
|
||||
$searchresult = $lucenesearch->search($query,
|
||||
array(
|
||||
'record_type'=>$record_type,
|
||||
'owner'=>$ownernames,
|
||||
'status'=>$status,
|
||||
'category'=>$categorynames,
|
||||
'user'=>$user->isAdmin() ? [] : [$user->getLogin()],
|
||||
'mimetype'=>$mimetype,
|
||||
'startFolder'=>$startFolder,
|
||||
'rootFolder'=>$rootFolder,
|
||||
'created_start'=>$created['from'],
|
||||
'created_end'=>$created['to'],
|
||||
'modified_start'=>$modified['from'],
|
||||
'modified_end'=>$modified['to'],
|
||||
'filesize_start'=>$filesize['from'],
|
||||
'filesize_end'=>$filesize['to'],
|
||||
'attributes'=>$attributes
|
||||
), ($pageNumber == 'all' ? array() : array('limit'=>$limit, 'offset'=>$limit * ($pageNumber-1))), $order);
|
||||
if($searchresult === false) {
|
||||
$session->setSplashMsg(array('type'=>'error', 'msg'=>getMLText('splash_invalid_searchterm')));
|
||||
$dcount = 0;
|
||||
|
@ -418,18 +436,18 @@ if($fullsearch) {
|
|||
* are found
|
||||
*/
|
||||
$resultmode = 0x03;
|
||||
if (isset($_GET["resultmode"]) && is_numeric($_GET["resultmode"])) {
|
||||
$resultmode = $_GET['resultmode'];
|
||||
if (isset($get["resultmode"]) && is_numeric($get["resultmode"])) {
|
||||
$resultmode = $get['resultmode'];
|
||||
}
|
||||
|
||||
$mode = "AND";
|
||||
if (isset($_GET["mode"]) && is_numeric($_GET["mode"]) && $_GET["mode"]==0) {
|
||||
if (isset($get["mode"]) && is_numeric($get["mode"]) && $get["mode"]==0) {
|
||||
$mode = "OR";
|
||||
}
|
||||
|
||||
$searchin = array();
|
||||
if (isset($_GET['searchin']) && is_array($_GET["searchin"])) {
|
||||
foreach ($_GET["searchin"] as $si) {
|
||||
if (isset($get['searchin']) && is_array($get["searchin"])) {
|
||||
foreach ($get["searchin"] as $si) {
|
||||
if (isset($si) && is_numeric($si)) {
|
||||
switch ($si) {
|
||||
case 1: // keywords
|
||||
|
@ -449,8 +467,8 @@ if($fullsearch) {
|
|||
|
||||
// Check to see if the search has been restricted to a particular sub-tree in
|
||||
// the folder hierarchy.
|
||||
if (isset($_GET["targetid"]) && is_numeric($_GET["targetid"]) && $_GET["targetid"]>0) {
|
||||
$targetid = $_GET["targetid"];
|
||||
if (isset($get["targetid"]) && is_numeric($get["targetid"]) && $get["targetid"]>0) {
|
||||
$targetid = $get["targetid"];
|
||||
$startFolder = $dms->getFolder($targetid);
|
||||
}
|
||||
else {
|
||||
|
@ -463,15 +481,15 @@ if($fullsearch) {
|
|||
/* Status date {{{ */
|
||||
$statusstartdate = array();
|
||||
$statusenddate = array();
|
||||
if(!empty($_GET["statusdatestart"])) {
|
||||
$statusstartts = makeTsFromDate($_GET["statusdatestart"]);
|
||||
if(!empty($get["statusdatestart"])) {
|
||||
$statusstartts = makeTsFromDate($get["statusdatestart"]);
|
||||
$statusstartdate = array('year'=>(int)date('Y', $statusstartts), 'month'=>(int)date('m', $statusstartts), 'day'=>(int)date('d', $statusstartts), 'hour'=>0, 'minute'=>0, 'second'=>0);
|
||||
}
|
||||
if ($statusstartdate && !checkdate($statusstartdate['month'], $statusstartdate['day'], $statusstartdate['year'])) {
|
||||
UI::exitError(getMLText("search"),getMLText("invalid_status_date_start"));
|
||||
}
|
||||
if(!empty($_GET["statusdateend"])) {
|
||||
$statusendts = makeTsFromDate($_GET["statusdateend"]);
|
||||
if(!empty($get["statusdateend"])) {
|
||||
$statusendts = makeTsFromDate($get["statusdateend"]);
|
||||
$statusenddate = array('year'=>(int)date('Y', $statusendts), 'month'=>(int)date('m', $statusendts), 'day'=>(int)date('d', $statusendts), 'hour'=>23, 'minute'=>59, 'second'=>59);
|
||||
}
|
||||
if ($statusenddate && !checkdate($statusenddate['month'], $statusenddate['day'], $statusenddate['year'])) {
|
||||
|
@ -482,15 +500,15 @@ if($fullsearch) {
|
|||
/* Expiration date {{{ */
|
||||
$expstartdate = array();
|
||||
$expenddate = array();
|
||||
if(!empty($_GET["expirationstart"])) {
|
||||
$expstartts = makeTsFromDate($_GET["expirationstart"]);
|
||||
if(!empty($get["expirationstart"])) {
|
||||
$expstartts = makeTsFromDate($get["expirationstart"]);
|
||||
$expstartdate = array('year'=>(int)date('Y', $expstartts), 'month'=>(int)date('m', $expstartts), 'day'=>(int)date('d', $expstartts), 'hour'=>0, 'minute'=>0, 'second'=>0);
|
||||
if (!checkdate($expstartdate['month'], $expstartdate['day'], $expstartdate['year'])) {
|
||||
UI::exitError(getMLText("search"),getMLText("invalid_expiration_date_start"));
|
||||
}
|
||||
}
|
||||
if(!empty($_GET["expirationend"])) {
|
||||
$expendts = makeTsFromDate($_GET["expirationend"]);
|
||||
if(!empty($get["expirationend"])) {
|
||||
$expendts = makeTsFromDate($get["expirationend"]);
|
||||
$expenddate = array('year'=>(int)date('Y', $expendts), 'month'=>(int)date('m', $expendts), 'day'=>(int)date('d', $expendts), 'hour'=>23, 'minute'=>59, 'second'=>59);
|
||||
if (!checkdate($expenddate['month'], $expenddate['day'], $expenddate['year'])) {
|
||||
UI::exitError(getMLText("search"),getMLText("invalid_expiration_date_end"));
|
||||
|
@ -507,8 +525,8 @@ if($fullsearch) {
|
|||
// if($status)
|
||||
// $resultmode = 0x01;
|
||||
|
||||
if (isset($_GET["attributes"]))
|
||||
$attributes = $_GET["attributes"];
|
||||
if (isset($get["attributes"]))
|
||||
$attributes = $get["attributes"];
|
||||
else
|
||||
$attributes = array();
|
||||
|
||||
|
@ -533,15 +551,15 @@ if($fullsearch) {
|
|||
$resArr = $dms->search(array(
|
||||
'query'=>$query,
|
||||
'limit'=>0,
|
||||
'offset'=>0 /*$limit, ($pageNumber-1)*$limit*/,
|
||||
'offset'=>0,
|
||||
'logicalmode'=>$mode,
|
||||
'searchin'=>$searchin,
|
||||
'startFolder'=>$startFolder,
|
||||
'owner'=>$ownerobjs,
|
||||
'status'=>$status,
|
||||
'mimetype'=>$mimetype,
|
||||
'creationstartdate'=>$created['from'], //$createstartdate ? $createstartdate : array(),
|
||||
'creationenddate'=>$created['to'], //$createenddate ? $createenddate : array(),
|
||||
'creationstartdate'=>$created['from'],
|
||||
'creationenddate'=>$created['to'],
|
||||
'modificationstartdate'=>$modified['from'],
|
||||
'modificationenddate'=>$modified['to'],
|
||||
'filesizestart'=>$filesize['from'],
|
||||
|
@ -561,7 +579,7 @@ if($fullsearch) {
|
|||
|
||||
$entries = array();
|
||||
$fcount = 0;
|
||||
// if(!isset($_GET['action']) || $_GET['action'] != 'export') {
|
||||
// if(!isset($get['action']) || $get['action'] != 'export') {
|
||||
if($resArr['folders']) {
|
||||
foreach ($resArr['folders'] as $entry) {
|
||||
if ($entry->getAccessMode($user) >= M_READ) {
|
||||
|
@ -584,7 +602,7 @@ if($fullsearch) {
|
|||
}
|
||||
}
|
||||
$totalPages = 1;
|
||||
if ((!isset($_GET['action']) || $_GET['action'] != 'export') /*&& (!isset($_GET["pg"]) || strcasecmp($_GET["pg"], "all"))*/) {
|
||||
if ((!isset($get['action']) || $get['action'] != 'export') /*&& (!isset($get["pg"]) || strcasecmp($get["pg"], "all"))*/) {
|
||||
$totalPages = (int) (count($entries)/$limit);
|
||||
if(count($entries)%$limit)
|
||||
$totalPages++;
|
||||
|
@ -619,7 +637,7 @@ if($settings->_showSingleSearchHit && count($entries) == 1) {
|
|||
$view->setParam('query', $query);
|
||||
$view->setParam('includecontent', $includecontent);
|
||||
$view->setParam('skipdefaultcols', $skipdefaultcols);
|
||||
$view->setParam('marks', isset($_GET['marks']) ? $_GET['marks'] : array());
|
||||
$view->setParam('marks', isset($get['marks']) ? $get['marks'] : array());
|
||||
$view->setParam('newowner', $newowner);
|
||||
$view->setParam('newreviewer', $newreviewer);
|
||||
$view->setParam('newapprover', $newapprover);
|
||||
|
@ -631,7 +649,7 @@ if($settings->_showSingleSearchHit && count($entries) == 1) {
|
|||
$view->setParam('pagenumber', $pageNumber);
|
||||
$view->setParam('limit', $limit);
|
||||
$view->setParam('searchtime', $searchTime);
|
||||
$view->setParam('urlparams', $_GET);
|
||||
$view->setParam('urlparams', $get);
|
||||
$view->setParam('cachedir', $settings->_cacheDir);
|
||||
$view->setParam('onepage', $settings->_onePageMode); // do most navigation by reloading areas of pages with ajax
|
||||
$view->setParam('showtree', showtree());
|
||||
|
@ -644,19 +662,19 @@ if($settings->_showSingleSearchHit && count($entries) == 1) {
|
|||
$view->setParam('facetsearch', $facetsearch);
|
||||
$view->setParam('mode', isset($mode) ? $mode : '');
|
||||
$view->setParam('orderby', isset($orderby) ? $orderby : '');
|
||||
$view->setParam('defaultsearchmethod', !empty($_GET["fullsearch"]) || $settings->_defaultSearchMethod);
|
||||
$view->setParam('defaultsearchmethod', !empty($get["fullsearch"]) || $settings->_defaultSearchMethod);
|
||||
$view->setParam('resultmode', isset($resultmode) ? $resultmode : '');
|
||||
$view->setParam('searchin', isset($searchin) ? $searchin : array());
|
||||
$view->setParam('startfolder', isset($startFolder) ? $startFolder : null);
|
||||
$view->setParam('owner', $owner);
|
||||
$view->setParam('createstartdate', $createstartts);
|
||||
$view->setParam('createenddate', $createendts);
|
||||
$view->setParam('createstartdate', $created['from']);
|
||||
$view->setParam('createenddate', $created['to']);
|
||||
$view->setParam('created', $created);
|
||||
$view->setParam('modifystartdate', $modifystartts);
|
||||
$view->setParam('modifyenddate', $modifyendts);
|
||||
$view->setParam('modifystartdate', $modified['from']);
|
||||
$view->setParam('modifyenddate', $modified['to']);
|
||||
$view->setParam('modified', $modified);
|
||||
$view->setParam('filesizestart', $filesizestart);
|
||||
$view->setParam('filesizeend', $filesizeend);
|
||||
$view->setParam('filesizestart', $filesize['from']);
|
||||
$view->setParam('filesizeend', $filesize['to']);
|
||||
$view->setParam('filesize', $filesize);
|
||||
$view->setParam('expstartdate', !empty($expstartdate) ? getReadableDate($expstartts) : '');
|
||||
$view->setParam('expenddate', !empty($expenddate) ? getReadableDate($expendts) : '');
|
||||
|
@ -683,7 +701,7 @@ if($settings->_showSingleSearchHit && count($entries) == 1) {
|
|||
$view->setParam('timeout', $settings->_cmdTimeout);
|
||||
$view->setParam('xsendfile', $settings->_enableXsendfile);
|
||||
$view->setParam('showsinglesearchhit', $settings->_showSingleSearchHit);
|
||||
$view($_GET);
|
||||
$view($get);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user