conjunction OR ++
ajax : keys aren't args any more, because of a+b+c Signed-off-by: bachy <git@g-u-i.net>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
|
||||
function materio_search_api_ajax_search($keys, $page = 0){
|
||||
function materio_search_api_ajax_search($page = 0){
|
||||
$debug = false;
|
||||
global $user, $base_url;
|
||||
// TODO: set research path configurable
|
||||
@@ -10,8 +10,15 @@ function materio_search_api_ajax_search($keys, $page = 0){
|
||||
# execute search
|
||||
$_GET['page'] = $page;
|
||||
|
||||
$path = $search_path . '/' . $keys ;//. ($page ? '?page='.$page : '');
|
||||
// dsm($menuhandler, 'menuhandler');
|
||||
$keys = $_GET['keys'];
|
||||
|
||||
foreach(explode(' ', $keys) as $word){
|
||||
$words[] = rawurlencode($word);
|
||||
}
|
||||
$keys_encoded = implode(' ', $words);
|
||||
// dsm($words, 'words');
|
||||
|
||||
$path = $search_path . '/' . $keys;//. ($page ? '?page='.$page : '');
|
||||
|
||||
// check if request is ajax, if not rediret to search_api_page page with right keys
|
||||
if (!$debug && (!isset($_SERVER['HTTP_X_REQUESTED_WITH']) || strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) != 'xmlhttprequest')) {
|
||||
@@ -19,6 +26,8 @@ function materio_search_api_ajax_search($keys, $page = 0){
|
||||
exit ;
|
||||
}
|
||||
|
||||
// TODO: if no permission, redirect to home
|
||||
|
||||
# content type filter s
|
||||
// $types = $_GET['types'];
|
||||
if(isset($_GET['types'])){
|
||||
@@ -64,6 +73,7 @@ function materio_search_api_ajax_search($keys, $page = 0){
|
||||
}
|
||||
}
|
||||
|
||||
// dsm($path, 'path');
|
||||
// get results
|
||||
menu_set_active_item($path);
|
||||
$return = menu_execute_active_handler($path, FALSE);
|
||||
@@ -91,8 +101,9 @@ function materio_search_api_ajax_search($keys, $page = 0){
|
||||
}
|
||||
|
||||
$rep = array(
|
||||
'path'=>$path,
|
||||
'path'=>$search_path.'/'.$keys_encoded,
|
||||
'keys'=>$keys,
|
||||
'keys_encoded'=>$keys_encoded,
|
||||
'search_path'=>$search_path,
|
||||
'return'=>$return,
|
||||
'active_types'=>$active_types,
|
||||
@@ -103,7 +114,7 @@ function materio_search_api_ajax_search($keys, $page = 0){
|
||||
$rep['count'] = $count;
|
||||
|
||||
if ($debug) {
|
||||
dsm($rep, 'rep');
|
||||
//dsm($rep, 'rep');
|
||||
return "debug display";
|
||||
}else{
|
||||
drupal_json_output($rep);
|
||||
@@ -202,7 +213,7 @@ function materio_search_api_ajax_actuality($page = 0){
|
||||
);
|
||||
|
||||
if ($debug) {
|
||||
dsm($rep, 'rep');
|
||||
//dsm($rep, 'rep');
|
||||
return "debug display";
|
||||
}else{
|
||||
drupal_json_output($rep);
|
||||
|
||||
Reference in New Issue
Block a user