function do_collections_search($search, $restypes, $archive = 0)
{
    global $search_includes_themes, $search_includes_public_collections, $search_includes_user_collections, $userref;
    $result = array();
    # Recognise a quoted search, which is a search for an exact string
    $quoted_string = false;
    if (substr($search, 0, 1) == "\"" && substr($search, -1, 1) == "\"") {
        $quoted_string = true;
        $search = substr($search, 1, -1);
    }
    $search_includes_themes_now = $search_includes_themes;
    $search_includes_public_collections_now = $search_includes_public_collections;
    $search_includes_user_collections_now = $search_includes_user_collections;
    if ($restypes != "") {
        $restypes_x = explode(",", $restypes);
        $search_includes_themes_now = in_array("themes", $restypes_x);
        $search_includes_public_collections_now = in_array("pubcol", $restypes_x);
        $search_includes_user_collections_now = in_array("mycol", $restypes_x);
    }
    if ($search_includes_themes_now || $search_includes_public_collections_now || $search_includes_user_collections_now) {
        $collections = search_public_collections($search, "theme", "ASC", !$search_includes_themes_now, !$search_includes_public_collections_now, true, false, $search_includes_user_collections_now);
        $condensedcollectionsresults = array();
        $result = $collections;
    }
    return $result;
}
Exemplo n.º 2
0
# Do the public collection search if configured.

$search_includes_themes_now=$search_includes_themes;
$search_includes_public_collections_now=$search_includes_themes;
$search_includes_user_collections_now=$search_includes_themes;
if ($restypes!="") {
$restypes_x=explode(",",$restypes);
$search_includes_themes_now=in_array("themes",$restypes_x);
$search_includes_public_collections_now=in_array("pubcol",$restypes_x);
$search_includes_user_collections_now=in_array("mycol",$restypes_x);
} 

if (( ($search_includes_themes_now || $search_includes_public_collections_now || $search_includes_user_collections_now)) && $search!="" && substr($search,0,1)!="!" && $offset==0)
    {
    $collections=search_public_collections($search,"theme","ASC",!$search_includes_themes_now,!$search_includes_public_collections_now,true);
    if ($search_includes_user_collections_now){
		$collections=array_merge(get_user_collections($userref,$search,"name",$revsort),$collections);
		$condensedcollectionsresults=array();
		$colresultsdupecheck=array();
		foreach($collections as $collection){
			if (!in_array($collection['ref'],$colresultsdupecheck)){
				$condensedcollectionsresults[]=$collection;
				$colresultsdupecheck[]=$collection['ref'];
			}
		}
		$collections=$condensedcollectionsresults;
	}
}
    
# Special case: numeric searches (resource ID) and one result: redirect immediately to the resource view.
<?php

//echo "testing sp2<br/>";
# Perform the search
if (!isset($collections)) {
    $collections = search_public_collections($search, "theme", "ASC", !$search_includes_themes, !$search_includes_public_collections, false);
}
if (substr($search, 0, 11) != "!collection" && $collections != "") {
    for ($n = 0; $n < count($collections); $n++) {
        $resources = do_search("!collection" . $collections[$n]['ref'], "", "relevance", "", 5);
        $hook_result = hook("process_search_results", "", array("result" => $resources, "search" => "!collection" . $collections[$n]['ref']));
        if ($hook_result !== false) {
            $resources = $hook_result;
        }
        $pub_url = "search.php?search=" . urlencode("!collection" . $collections[$n]["ref"]);
        if ($display == "thumbs") {
            ?>
		<div class="ResourcePanelShell" id="ResourceShell">
		<div class="ResourcePanel">
	
		<table  border="0" class="ResourceAlign"><?php 
            hook("publicresulttop");
            ?>
<tr><td>
		
		<div style="position: relative;height:140px;">
		<a onClick="return CentralSpaceLoad(this,true);" href="<?php 
            echo $pub_url;
            ?>
" title="<?php 
            echo htmlspecialchars(str_replace(array("\"", "'"), "", i18n_get_collection_name($collections[$n])));
Exemplo n.º 4
0
    <p class="tight"><?php echo text("introtext")?></p>
<div class="BasicsBox">
    <form method="post" action="<?php echo $baseurl_short?>pages/collection_public.php">
		<div class="Question">
			<label for="find"><?php echo $lang["searchpubliccollections"]?></label>
			<div class="tickset">
			 <div class="Inline"><input type=text name="find" id="find" value="<?php echo htmlspecialchars(unescape($find)) ?>" maxlength="100" class="shrtwidth" /></div>
			 <div class="Inline"><input name="Submit" type="submit" value="&nbsp;&nbsp;<?php echo $lang["searchbutton"]?>&nbsp;&nbsp;" /></div>
			<div class="Inline"><input name="Clear" type="button" onclick="document.getElementById('find').value='';submit();" value="&nbsp;&nbsp;<?php echo $lang["clearbutton"]?>&nbsp;&nbsp;" /></div>
			</div>
			<div class="clearerleft"> </div>
		</div>
	</form>
</div>
<?php
$collections=search_public_collections($find,$col_order_by,$sort,$public_collections_exclude_themes,false,true,$override_group_restrict=="true");

$results=count($collections);
$totalpages=ceil($results/$per_page);
$curpage=floor($offset/$per_page)+1;
$jumpcount=1;

# Create an a-z index
$atoz="<div class=\"InpageNavLeftBlock\">";
if ($find=="") {$atoz.="<span class='Selected'>";}

if ($public_collections_confine_group)
	{
	$atoz.="<a onClick='return CentralSpaceLoad(this,true);' href=\"".$baseurl_short."pages/collection_public.php?col_order_by=name&override_group_restrict=false&find=\">" . $lang["viewmygroupsonly"] . "</a> &nbsp; | &nbsp;";	
	$atoz.="<a onClick='return CentralSpaceLoad(this,true);' href=\"".$baseurl_short."pages/collection_public.php?col_order_by=name&override_group_restrict=true&find=\">" . $lang["viewall"] . "</a> &nbsp;&nbsp;&nbsp;";	
	}