Ejemplo n.º 1
0
         }
         $descr = ereg_replace('[^A-Za-z0-9&; -]', '', $descr);
         $ids[$key] = $id;
         $desicrs[$key] = $descr;
         $tagss[$key] = $tags;
         prefetch_search('youtube', $descr, $tags, $icrs);
         prefetch_search('google', $descr, $tags, $icrs);
         prefetch_search('khanacad', $descr, $tags, $icrs);
         prefetch_search('wikipedia', $descr, $tags, $icrs);
         prefetch_search('itunesu', $descr, $tags, $icrs);
     }
     foreach ($procd_descr as $key => $topic) {
         $id = $ids[$key];
         $descr = $desicrs[$key];
         $tags = $tagss[$key];
         $results = array_merge(perform_search('khanacad', $descr, $tags, $icrs), perform_search('youtube', $descr, $tags, $icrs), perform_search('google', $descr, $tags, $icrs), perform_search('wikipedia', $descr, $tags, $icrs), perform_search('itunesu', $descr, $tags, $icrs));
         Error::generate('debug', $results);
         foreach ($results as $res) {
             $res['subject'] = $res['title'];
             $res['type'] = 2;
             $res['id'] = $id;
             $res['rating'] = isset($res['rating']) ? $res['rating'] : 0;
             Comment::Create($res);
         }
         //Comment::disableInitMode();
     }
     async_cache_disconnect(1);
     async_cache_disconnect(2);
     async_cache_disconnect(3);
     $memcached->delete('' . $icrs->cid);
 } else {
Ejemplo n.º 2
0
     $notes_query = "SELECT filename FROM annotations WHERE userID=" . intval($_SESSION['user_id']) . " AND {$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} file IN ({$notes_query}) {$ordering}");
     } else {
         perform_search("SELECT id FROM library WHERE {$in} {$rating_search} {$type_search} {$category_search} file IN ({$notes_query}) {$ordering}");
     }
 } elseif ($_GET['searchtype'] == 'pdf') {
     $dbHandle->sqliteCreateFunction('regexp_match', 'sqlite_regexp', 3);
     if ($case == 1) {
         $dbHandle->exec("PRAGMA case_sensitive_like = 1");
     }
     $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);
 case "get_sub_users":
     $xml = generate_object_list_xml($list_sub_users);
     echo $xml;
     break;
     // get details
 // get details
 case "get_sub_details":
     $where_clause = "WHERE vi_submission_search.sub_id = " . $_POST['sub_id'];
     $xml = perform_search($where_clause);
     echo $xml;
     break;
     // get children
 // get children
 case "get_sub_children":
     $where_clause = "WHERE pid = " . $_POST['sub_id'];
     $xml = perform_search($where_clause);
     echo $xml;
     break;
     // get files
 // get files
 case "get_sub_files":
     $files = get_files($_POST['sub_id']);
     $xml = generate_object_list_xml($files);
     echo $xml;
     break;
     // get layers
 // get layers
 case "get_sub_layers":
     $layers = get_layers($_POST['sub_id']);
     $xml = generate_object_list_xml($layers);
     echo $xml;
Ejemplo n.º 4
0
     }
 } elseif ($column_string == 'history') {
     $quoted_history = $dbHandle->quote(IL_DATABASE_PATH . DIRECTORY_SEPARATOR . 'history.sq3');
     $dbHandle->exec("ATTACH DATABASE {$quoted_history} AS history");
     $dbHandle->exec("DELETE FROM history.usersfiles WHERE " . time() . "-viewed>28800");
     $dbHandle->exec("DETACH DATABASE history");
     perform_search("SELECT id FROM library WHERE id IN (SELECT fileID FROM history.usersfiles WHERE userID=" . intval($_SESSION['user_id']) . ") {$ordering}");
 } else {
     if (!empty($category_sql)) {
         if ($category_id === 0) {
             perform_search("SELECT id FROM library {$all_in} {$where} id NOT IN (" . $category_sql . ") {$ordering}");
         } else {
             perform_search("SELECT id FROM library {$all_in} {$where} id IN (" . $category_sql . ") {$ordering}");
         }
     } else {
         perform_search("SELECT id FROM library {$all_in} {$where} {$browse_string} {$ordering}");
     }
 }
 //    $dbHandle = null;
 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);
Ejemplo n.º 5
0
     $project_files = $project_files->fetchAll(PDO::FETCH_COLUMN);
     $in = implode(',', $project_files);
     $all_in = "WHERE id IN ({$in})";
     $project_files = null;
 }
 if ($_GET['select'] == 'clipboard') {
     $all_in = "WHERE id IN (SELECT id FROM clipboard.files)";
 }
 $ordering = 'ORDER BY ' . $orderby . ' COLLATE NOCASE ASC';
 if ($orderby == 'year' || $orderby == 'addition_date' || $orderby == 'rating' || $orderby == 'id') {
     $ordering = 'ORDER BY ' . $orderby . ' DESC';
 }
 if ($orderby == 'id') {
     $ordering = '';
 }
 perform_search("SELECT id FROM library {$all_in} {$ordering}");
 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 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;
     $items_from = $from + 1;
     $from + $limit > $rows ? $items_to = $rows : ($items_to = $from + $limit);
     print '<div style="text-align:center;font-size:0.85em">Items ' . $items_from . '-' . $items_to . ' of <span id="total-items">' . $rows . '</span></div>';
     $rows % $limit == 0 ? $lastpage = $rows - $limit : ($lastpage = $rows - $rows % $limit);
Ejemplo n.º 6
0
 $affiliation_array = array();
 $search_id_array = array();
 $year_array = array();
 $fulltext_array = array();
 $notes_array = array();
 $rating_array = array();
 if (isset($_GET['searchmode']) && $_GET['searchmode'] == 'quick') {
     include '../quicksearch.php';
 }
 //SEARCH
 $result_array = array();
 $rows = 0;
 if (!empty($search_string) && $_GET['searchtype'] == 'metadata') {
     $dbHandle->sqliteCreateFunction('regexp_match', 'sqlite_regexp', 3);
     $dbHandle->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT);
     perform_search("SELECT id FROM library WHERE {$in} {$search_string} {$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 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:');