Example #1
0
            $result = bookmark_and_tag_record_ids($data);
            break;
        case 'add_detail':
            $result = add_detail($data);
            break;
        case 'replace_detail':
            $result = replace_detail($data);
            break;
        case 'delete_detail':
            $result = delete_detail($data);
            break;
        case 'set_ratings':
            $result = set_ratings($data);
            break;
        case 'save_search':
            $result = save_search($data);
            break;
        case 'bookmark_tag_and_ssearch':
            //from saveCollectionPopup.html   NOT USED SINCE 2012-02-13
            $result = bookmark_tag_and_save_search($data);
            break;
        case 'set_wg_and_vis':
            $result = set_wg_and_vis($data);
            break;
    }
} else {
    $result = array("problem" => "'data' parameter is missing for search result action '" . @$_REQUEST['action'] ? $_REQUEST['action'] : "action missing" . "'");
}
header('Content-type: text/javascript');
if ($result) {
    print json_format($result);
        case 'remove_tags':
            $res = remove_tags($data);
            break;
        case 'bookmark_reference':
            $res = bookmark_references($data);
            break;
        case 'bookmark_and_tag':
        case 'bookmark_and_tags':
            //save collection of ids with some tag
            $res = bookmark_and_tag_record_ids($data);
            break;
        case 'set_ratings':
            $res = set_ratings($data);
            break;
        case 'save_search':
            $res = save_search($data);
            break;
        case 'bookmark_tag_and_ssearch':
            //from saveCollectionPopup.html   NOT USED SINCE 2012-02-13
            $res = bookmark_tag_and_save_search($data);
            break;
        case 'set_wg_and_vis':
            $res = set_wg_and_vis($data);
            break;
    }
} else {
    $res = array("problem" => "Parameter 'data' is missed for action script");
}
header('Content-type: text/javascript');
if ($res) {
    print json_format($res);
Example #3
0
 //PULL DATA FOR ITEMS TO DISPLAY FROM DATABASE
 $limited_result = array();
 if (!empty($result_array)) {
     save_export_files($result_array);
     $limited_result = array_slice($result_array, $from, $limit);
     $result_string = join(",", $limited_result);
     $result_string = "id IN ({$result_string})";
     $result = $dbHandle->query("SELECT id,file,authors,title,journal,secondary_title,year,volume,pages,abstract,uid,doi,url,addition_date,rating FROM library WHERE {$result_string} ORDER BY {$orderby} COLLATE NOCASE {$ordering}");
     $result = $result->fetchAll(PDO::FETCH_ASSOC);
     $dbHandle = null;
 }
 //SAVE SEARCH IN CACHE
 if ($_GET['select'] != 'clipboard' && !isset($searches[$md5_query])) {
     $searches[$md5_query]['result'] = $result_array;
     $searches[$md5_query]['query_time'] = time();
     save_search($searches_file, $searches);
 }
 //TRUNCATE SHELF FILES ARRAY TO ONLY DISPLAYED FILES IMPROVES PERFROMANCE FOR LARGE SHELVES
 if (count($shelf_files) > 5000) {
     $shelf_files = array_intersect((array) $limited_result, (array) $shelf_files);
 }
 //PRE-FETCH CATEGORIES, PROJECTS FOR DISPLAYED ITEMS IN A BATCH INTO TEMP DATABASE TO OFFLOAD THE MAIN DATABASE
 if (!empty($result_array)) {
     $display_files2 = join(",", $limited_result);
     try {
         $tempdbHandle = new PDO('sqlite::memory:');
     } catch (PDOException $e) {
         print "Error: " . $e->getMessage() . "<br/>";
         die;
     }
     $quoted_path = $tempdbHandle->quote($database_path . 'library.sq3');
Example #4
0
UI::show_header();
/**
 * action switch
 */
switch ($_REQUEST['action']) {
    case 'search':
        $browse = new Browse();
        require_once AmpConfig::get('prefix') . '/templates/show_search.inc.php';
        require_once AmpConfig::get('prefix') . '/templates/show_search_options.inc.php';
        $results = Search::run($_REQUEST);
        $browse->set_type($_REQUEST['type']);
        $browse->show_objects($results);
        $browse->store();
        break;
    case 'save_as_track':
        $playlist_id = save_search($_REQUEST);
        $playlist = new Playlist($playlist_id);
        show_confirmation(T_('Search Saved'), sprintf(T_('Your Search has been saved as a track in %s'), $playlist->name), AmpConfig::get('web_path') . "/search.php");
        break;
    case 'save_as_smartplaylist':
        $playlist = new Search();
        $playlist->parse_rules(Search::clean_request($_REQUEST));
        $playlist->save();
        break;
    case 'descriptor':
        // This is a little special we don't want header/footers so trash what we've got in the OB
        ob_clean();
        require_once AmpConfig::get('prefix') . '/templates/show_search_descriptor.inc.php';
        exit;
    default:
        require_once AmpConfig::get('prefix') . '/templates/show_search.inc.php';