summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIanNorton2013-08-31 15:03:01 (GMT)
committer IanNorton2013-08-31 15:03:01 (GMT)
commit22ce1d2ff567ece44e4771f2c38fab332fb9c969 (patch)
treece8fdce0f8e3b80a5b781b264a8875ca97df0c65
parent9ee5be26376b9843f00433031dc5b8d815e9fede (diff)
Fixing issue where no root is set
-rw-r--r--cmis_search.module16
1 files changed, 6 insertions, 10 deletions
diff --git a/cmis_search.module b/cmis_search.module
index 294819e..447a503 100644
--- a/cmis_search.module
+++ b/cmis_search.module
@@ -30,12 +30,6 @@ function cmis_search_menu() {
* Page callback.
*/
function cmis_search_view($keys = '') {
-
-ini_set('display_errors', 1);
-ini_set('log_errors', 1);
-ini_set('error_log', dirname(__FILE__) . '/error_log.txt');
-error_reporting(E_ALL);
-
module_load_include('api.inc', 'cmis');
$keys = trim($keys);
@@ -47,12 +41,15 @@ error_reporting(E_ALL);
if (variable_get('rootfolder')!=''){
$rootcmis = " AND in_tree(d, '".variable_get('rootfolder')."')";
-// $output .= " AND in_tree(d, '".variable_get('rootfolder')."')";
}else{
$rootcmis = NULL;
}
-
- $cmisquery = "SELECT d.*, t.* FROM cmis:document as d join cm:titled as t on d.cmis:objectid = t.cmis:objectid WHERE (d.cmis:name like '%".$keys."%' OR t.cm:title LIKE '%".$keys."%' OR t.cm:description LIKE '%".$keys."%' OR CONTAINS(d,'".$keys."'))".$rootcmis;
+
+ if ($rootcmis){
+ $cmisquery = "select d.*, t.* from cmis:document as d join cm:titled as t on d.cmis:objectId = t.cmis:objectId WHERE (d.cmis:name like '%".$keys."%' OR t.cm:title LIKE '%".$keys."%' OR t.cm:description LIKE '%".$keys."%' OR CONTAINS(d,'".$keys."'))".$rootcmis;
+ }else{
+ $cmisquery = "SELECT d.*, t.* FROM cmis:document as d join cm:titled as t on d.cmis:objectId = t.cmis:objectId WHERE (d.cmis:name like '%".$keys."%' OR t.cm:title LIKE '%".$keys."%' OR t.cm:description LIKE '%".$keys."%' OR CONTAINS(d,'".$keys."'))";
+ }
if ($cmisquery && $keys) {
try {
@@ -70,7 +67,6 @@ error_reporting(E_ALL);
$contents .= theme('cmis_search_results', array('rows' => $query_result->objectList));
}
return $contents;
- //return t("You searched for <strong>".$keys."</strong>:<br />".$cmisquery);
}