Beispiel #1
0
     $fulltext_query = "SELECT fileID FROM fulltextdatabase.full_text WHERE {$search_string}";
     if ($_GET['select'] == 'shelf') {
         perform_search("SELECT id FROM library INNER JOIN shelves ON library.id=shelves.fileID WHERE shelves.userID=" . intval($_SESSION['user_id']) . " AND {$rating_search} {$type_search} {$category_search} id IN ({$fulltext_query}) {$ordering}");
     } else {
         perform_search("SELECT id FROM library WHERE {$in} {$rating_search} {$type_search} {$category_search} id IN ({$fulltext_query}) {$ordering}");
     }
 }
 //PRE-FETCH CATEGORIES, PROJECTS FOR DISPLAYED ITEMS IN A BATCH INTO TEMP DATABASE TO OFFLOAD THE MAIN DATABASE
 if ($rows > 0) {
     $result = $result->fetchAll(PDO::FETCH_ASSOC);
     foreach ($result as $item) {
         $display_files_array[] = $item['id'];
     }
     $display_files2 = join(",", $display_files_array);
     // Read shelf files.
     $shelf_files = read_shelf($dbHandle, $display_files_array);
     // Read clipboard files.
     attach_clipboard($dbHandle);
     $clip_result = $dbHandle->query("SELECT id FROM clipboard.files WHERE id IN ({$display_files2})");
     $clip_files = $clip_result->fetchAll(PDO::FETCH_COLUMN);
     $clip_result = null;
     try {
         $tempdbHandle = new PDO('sqlite::memory:');
     } catch (PDOException $e) {
         print "Error: " . $e->getMessage() . "<br/>";
         die;
     }
     $quoted_path = $tempdbHandle->quote(IL_DATABASE_PATH . DIRECTORY_SEPARATOR . 'library.sq3');
     $tempdbHandle->exec("ATTACH DATABASE {$quoted_path} AS librarydb");
     $tempdbHandle->beginTransaction();
     $tempdbHandle->exec("CREATE TABLE temp_categories (\r\n                fileID integer NOT NULL,\r\n                categoryID integer NOT NULL,\r\n                category text NOT NULL)");
Beispiel #2
0
    $orderby = $_SESSION['orderby'];
}
if (!isset($_SESSION['display'])) {
    $display = 'summary';
} else {
    $display = $_SESSION['display'];
}
if ($_GET['select'] != 'library' && $_GET['select'] != 'shelf' && $_GET['select'] != 'desk' && $_GET['select'] != 'clipboard') {
    $_GET['select'] = 'library';
}
if (isset($_GET['browse'])) {
    $in = '';
    $all_in = '';
    database_connect($database_path, 'library');
    $shelf_files = array();
    $shelf_files = read_shelf($dbHandle);
    $desktop_projects = array();
    $desktop_projects = read_desktop($dbHandle);
    if ($_GET['select'] == 'shelf') {
        $all_in = "INNER JOIN shelves ON library.id=shelves.fileID WHERE shelves.userID=" . intval($_SESSION['user_id']);
    }
    if ($_GET['select'] == 'desk') {
        $project_id = '';
        $display_project = '';
        $all_in = "WHERE id IN ()";
        if (!empty($desktop_projects)) {
            $project_id = $desktop_projects[0]['projectID'];
            $display_project = $desktop_projects[0]['project'];
        }
        if (isset($_GET['project'])) {
            $project_id = $_GET['project'];
<?php

include_once 'data.php';
include_once 'functions.php';
session_write_close();
database_connect(IL_DATABASE_PATH, 'library');
$shelf_files = array();
$shelf_files = read_shelf($dbHandle, $_GET['file']);
$desktop_projects = array();
$desktop_projects = read_desktop($dbHandle);
if (isset($_GET['select'])) {
    if ($_GET['select'] != 'library' && $_GET['select'] != 'shelf' && $_GET['select'] != 'project' && $_GET['select'] != 'clipboard') {
        $_GET['select'] = 'library';
    }
    $select = $_GET['select'];
} else {
    $select = 'library';
}
if (isset($_GET['file'])) {
    $query = $dbHandle->quote($_GET['file']);
    // Read clipboard files.
    attach_clipboard($dbHandle);
    $clip_result = $dbHandle->query("SELECT id FROM clipboard.files WHERE id={$query}");
    $clip_files = $clip_result->fetchAll(PDO::FETCH_COLUMN);
    $clip_result = null;
    if (!isset($paper)) {
        $result = $dbHandle->query("SELECT * FROM library WHERE id={$query} LIMIT 1");
        $paper = $result->fetch(PDO::FETCH_ASSOC);
    }
    if (!empty($paper['id'])) {
        $paper['journal'] = htmlspecialchars($paper['journal']);