function compile_collection_actions(array $collection_data, $top_actions)
{
    global $baseurl_short, $lang, $k, $userrequestmode, $zipcommand, $collection_download, $contact_sheet, $manage_collections_contact_sheet_link, $manage_collections_share_link, $allow_share, $manage_collections_remove_link, $userref, $collection_purge, $show_edit_all_link, $result, $edit_all_checkperms, $preview_all, $order_by, $sort, $archive, $contact_sheet_link_on_collection_bar, $show_searchitemsdiskusage, $emptycollection, $remove_resources_link_on_collection_bar, $count_result, $download_usage, $home_dash, $top_nav_upload_type, $pagename, $offset, $col_order_by, $find, $default_sort, $starsearch, $restricted_share;
    $options = array();
    $o = 0;
    if (empty($collection_data)) {
        return $options;
    }
    if (!collection_is_research_request($collection_data['ref']) || !checkperm('r')) {
        if (!$top_actions && checkperm('s') && $pagename === 'collections') {
            // Manage My Collections
            $data_attribute['url'] = $baseurl_short . 'pages/collection_manage.php';
            $options[$o]['value'] = 'manage_collections';
            $options[$o]['label'] = $lang['managemycollections'];
            $options[$o]['data_attr'] = $data_attribute;
            $o++;
            // Collection feedback
            if (isset($collection_data['request_feedback']) && $collection_data['request_feedback']) {
                $data_attribute['url'] = sprintf('%spages/collection_feedback.php?collection=%s&k=%s', $baseurl_short, urlencode($collection_data['ref']), urlencode($k));
                $options[$o]['value'] = 'collection_feedback';
                $options[$o]['label'] = $lang['sendfeedback'];
                $options[$o]['data_attr'] = $data_attribute;
                $o++;
            }
        }
    } else {
        $research = sql_value('SELECT ref value FROM research_request WHERE collection="' . $collection_data['ref'] . '";', 0);
        // Manage research requests
        $data_attribute['url'] = sprintf('%spages/team/team_research.php', $baseurl_short);
        $options[$o]['value'] = 'manage_research_requests';
        $options[$o]['label'] = $lang['manageresearchrequests'];
        $options[$o]['data_attr'] = $data_attribute;
        $o++;
        // Edit research requests
        $data_attribute['url'] = sprintf('%spages/team/team_research_edit.php?ref=%s', $baseurl_short, urlencode($research));
        $options[$o]['value'] = 'edit_research_requests';
        $options[$o]['label'] = $lang['editresearchrequests'];
        $options[$o]['data_attr'] = $data_attribute;
        $o++;
    }
    // Select collection option - not for collection bar
    if ($pagename != 'collections' && $k == '' && !checkperm('b') && ($pagename == 'themes' || $pagename === 'collection_manage' || $pagename === 'resource_collection_list' || $top_actions)) {
        $options[$o]['value'] = 'select_collection';
        $options[$o]['label'] = $lang['selectcollection'];
        $o++;
    }
    // Edit Collection
    if ($userref == $collection_data['user'] || checkperm('h')) {
        $extra_tag_attributes = sprintf('
                data-url="%spages/collection_edit.php?ref=%s"
            ', $baseurl_short, urlencode($collection_data['ref']));
        $options[$o]['value'] = 'edit_collection';
        $options[$o]['label'] = $lang['action-edit'];
        $options[$o]['data_attr'] = array();
        $options[$o]['extra_tag_attributes'] = $extra_tag_attributes;
        $o++;
    }
    // Upload to collection
    if ((checkperm('c') || checkperm('d')) && $collection_data['savedsearch'] == 0 && ($userref == $collection_data['user'] || $collection_data['allow_changes'] == 1 || checkperm('h'))) {
        $data_attribute['url'] = sprintf('%spages/edit.php?uploader=%s&ref=-%s&collection_add=%s', $baseurl_short, urlencode($top_nav_upload_type), urlencode($userref), urlencode($collection_data['ref']));
        $options[$o]['value'] = 'upload_collection';
        $options[$o]['label'] = $lang['action-upload-to-collection'];
        $options[$o]['data_attr'] = $data_attribute;
        $o++;
    }
    // Home_dash is on, AND NOT Anonymous use, AND (Dash tile user (NOT with a managed dash) || Dash Tile Admin)
    if (!$top_actions && $home_dash && checkPermission_dashcreate()) {
        $data_attribute['url'] = sprintf('
            %spages/dash_tile.php?create=true&tltype=srch&promoted_resource=true&freetext=true&all_users=1&link=/pages/search.php?search=!collection%s&order_by=relevance&sort=DESC
            ', $baseurl_short, $collection_data['ref']);
        $options[$o]['value'] = 'save_collection_to_dash';
        $options[$o]['label'] = $lang['createnewdashtile'];
        $options[$o]['data_attr'] = $data_attribute;
        $o++;
    }
    // Request all
    if ($count_result > 0) {
        # Ability to request a whole collection (only if user has restricted access to any of these resources)
        $min_access = collection_min_access($result);
        if ($min_access != 0) {
            $data_attribute['url'] = sprintf('%spages/collection_request.php?ref=%s&k=%s', $baseurl_short, urlencode($collection_data['ref']), urlencode($k));
            $options[$o]['value'] = 'request_all';
            $options[$o]['label'] = $lang['requestall'];
            $options[$o]['data_attr'] = $data_attribute;
            $o++;
        }
    }
    // Download option
    if ($download_usage && ((isset($zipcommand) || $collection_download) && $count_result > 0)) {
        $data_attribute['url'] = $baseurl_short . "pages/terms.php?k=" . urlencode($k) . "&url=pages/download_usage.php?collection=" . urlencode($collection_data['ref']) . "%26k=" . urlencode($k);
        $options[$o]['value'] = 'download_collection';
        $options[$o]['label'] = $lang['action-download'];
        $options[$o]['data_attr'] = $data_attribute;
        $o++;
    } else {
        if ((isset($zipcommand) || $collection_download) && $count_result > 0) {
            $data_attribute['url'] = $baseurl_short . "pages/terms.php?k=" . urlencode($k) . "&url=pages/collection_download.php?collection=" . urlencode($collection_data['ref']) . "%26k=" . urlencode($k);
            $options[$o]['value'] = 'download_collection';
            $options[$o]['label'] = $lang['action-download'];
            $options[$o]['data_attr'] = $data_attribute;
            $o++;
        } else {
            if (isset($zipcommand) || $collection_download) {
                $data_attribute['url'] = $baseurl_short . "pages/terms.php?k=" . urlencode($k) . "&url=pages/collection_download.php?collection=" . urlencode($collection_data['ref']) . "%26k=" . urlencode($k);
                $options[$o]['value'] = 'download_collection';
                $options[$o]['label'] = $lang['action-download'];
                $options[$o]['data_attr'] = $data_attribute;
                $o++;
            }
        }
    }
    // Contact Sheet
    if ($k == "" && $contact_sheet == true && ($manage_collections_contact_sheet_link || $contact_sheet_link_on_collection_bar)) {
        $data_attribute = array('url' => sprintf('%spages/contactsheet_settings.php?ref=%s', $baseurl_short, urlencode($collection_data['ref'])));
        $options[$o]['value'] = 'contact_sheet';
        $options[$o]['label'] = $lang['contactsheet'];
        $options[$o]['data_attr'] = $data_attribute;
        $o++;
    }
    // Share
    if ($k == "" && $manage_collections_share_link && $allow_share && (checkperm('v') || checkperm('g') || collection_min_access($collection_data['ref']) <= 1 && $restricted_share)) {
        $extra_tag_attributes = sprintf('
                data-url="%spages/collection_share.php?ref=%s"
            ', $baseurl_short, urlencode($collection_data['ref']));
        $options[$o]['value'] = 'share_collection';
        $options[$o]['label'] = $lang['share'];
        $options[$o]['data_attr'] = array();
        $options[$o]['extra_tag_attributes'] = $extra_tag_attributes;
        $o++;
    }
    // Remove
    if ($k == "" && $manage_collections_remove_link && $userref != $collection_data['user']) {
        $options[$o]['value'] = 'remove_collection';
        $options[$o]['label'] = $lang['action-remove'];
        $o++;
    }
    // Delete
    if ($k == "" && ($userref == $collection_data['user'] || checkperm('h')) && $collection_data['cant_delete'] == 0) {
        $options[$o]['value'] = 'delete_collection';
        $options[$o]['label'] = $lang['action-delete'];
        $o++;
    }
    // Collection Purge
    if ($k == "" && $collection_purge && isset($collections) && checkperm('e0') && $collection_data['cant_delete'] == 0) {
        $options[$o]['value'] = 'purge_collection';
        $options[$o]['label'] = $lang['purgeanddelete'];
        $o++;
    }
    // Collection log
    if ($k == "" && $userref == $collection_data['user'] || checkperm('h')) {
        $extra_tag_attributes = sprintf('
                data-url="%spages/collection_log.php?ref=%s"
            ', $baseurl_short, urlencode($collection_data['ref']));
        $options[$o]['value'] = 'collection_log';
        $options[$o]['label'] = $lang['action-log'];
        $options[$o]['data_attr'] = array();
        $options[$o]['extra_tag_attributes'] = $extra_tag_attributes;
        $o++;
    }
    // View all
    if ($k == "" && (isset($collection_data["c"]) && $collection_data["c"] > 0) || count($result) > 0) {
        $data_attribute['url'] = $baseurl_short . 'pages/search.php?search=!collection' . urlencode($collection_data['ref']) . "&k=" . urlencode($k);
        $options[$o]['value'] = 'view_all_resources_in_collection';
        $options[$o]['label'] = $lang['view_all_resources'];
        $options[$o]['data_attr'] = $data_attribute;
        $o++;
    }
    // Edit all
    # If this collection is (fully) editable, then display an edit all link
    if ($k == "" && $show_edit_all_link && count($result) > 0) {
        if (!$edit_all_checkperms || allow_multi_edit($collection_data['ref'])) {
            $extra_tag_attributes = sprintf('
                    data-url="%spages/edit.php?collection=%s"
                ', $baseurl_short, urlencode($collection_data['ref']));
            $options[$o]['value'] = 'edit_all_in_collection';
            $options[$o]['label'] = $lang['edit_all_resources'];
            $options[$o]['data_attr'] = array();
            $options[$o]['extra_tag_attributes'] = $extra_tag_attributes;
            $o++;
        }
    }
    // Delete all
    // Note: functionality moved from edit collection page
    if ($k == "" && !$top_actions && (count($result) != 0 || $count_result != 0) && !(isset($allow_resource_deletion) && !$allow_resource_deletion) && collection_writeable($collection_data['ref']) && allow_multi_edit($collection_data['ref']) && !checkperm('D')) {
        $options[$o]['value'] = 'delete_all_in_collection';
        $options[$o]['label'] = $lang['deleteallresourcesfromcollection'];
        $o++;
    }
    // Preview all
    if (count($result) != 0 && $k == '' && $preview_all) {
        $extra_tag_attributes = sprintf('
                data-url="%spages/preview_all.php?ref=%s"
            ', $baseurl_short, urlencode($collection_data['ref']));
        $options[$o]['value'] = 'preview_all';
        $options[$o]['label'] = $lang['preview_all'];
        $options[$o]['data_attr'] = array();
        $options[$o]['extra_tag_attributes'] = $extra_tag_attributes;
        $o++;
    }
    // Remove all
    if ($k == '' && isset($emptycollection) && $remove_resources_link_on_collection_bar && collection_writeable($collection_data['ref'])) {
        $data_attribute['url'] = sprintf('%spages/collections.php?emptycollection=%s&removeall=true&submitted=removeall&ajax=true', $baseurl_short, urlencode($collection_data['ref']));
        $options[$o]['value'] = 'empty_collection';
        $options[$o]['label'] = $lang['emptycollection'];
        $options[$o]['data_attr'] = $data_attribute;
        $o++;
    }
    // Edit Previews
    if ($k == '' && $count_result > 0 && ($userref == $collection_data['user'] || $collection_data['allow_changes'] == 1 || checkperm('h')) && allow_multi_edit($collection_data['ref'])) {
        $main_pages = array('search', 'collection_manage', 'collection_public', 'themes');
        $back_to_page = in_array($pagename, $main_pages) ? htmlspecialchars($pagename) : '';
        $data_attribute['url'] = sprintf('%spages/collection_edit_previews.php?ref=%s&offset=%s&order_by=%s&col_order_by=<%s&sort=%s&find=%s&backto=%s', $baseurl_short, urlencode($collection_data['ref']), urlencode($offset), urlencode($order_by), urlencode($col_order_by), urlencode($sort), urlencode($find), $back_to_page);
        $options[$o]['value'] = 'edit_previews';
        $options[$o]['label'] = $lang['editcollectionresources'];
        $options[$o]['data_attr'] = $data_attribute;
        $o++;
    }
    // Show disk usage
    if ($k == '' && !$top_actions && $show_searchitemsdiskusage) {
        $extra_tag_attributes = sprintf('
                data-url="%spages/search_disk_usage.php?search=!collection%s&k=%s"
            ', $baseurl_short, urlencode($collection_data['ref']), urlencode($k));
        $options[$o]['value'] = 'search_items_disk_usage';
        $options[$o]['label'] = $lang['collection_disk_usage'];
        $options[$o]['data_attr'] = array();
        $options[$o]['extra_tag_attributes'] = $extra_tag_attributes;
        $o++;
    }
    // CSV export of collection metadata
    if (!$top_actions && $k == '') {
        if (empty($order_by)) {
            $order_by = $default_sort;
        }
        $options[$o]['value'] = 'csv_export_results_metadata';
        $options[$o]['label'] = $lang['csvExportResultsMetadata'];
        $options[$o]['data_attr']['url'] = sprintf('%spages/csv_export_results_metadata.php?search=!collection%s&restype=%s&order_by=%s&archive=0&sort=%s&starsearch=%s', $baseurl_short, urlencode($collection_data['ref']), isset($_COOKIE['restypes']) ? urlencode($_COOKIE['restypes']) : '', urlencode($order_by), urlencode($sort), urlencode($starsearch));
        $o++;
    }
    // Add extra collection actions and manipulate existing actions through plugins
    $modified_options = hook('render_actions_add_collection_option', '', array($top_actions, $options));
    if (is_array($modified_options) && !empty($modified_options)) {
        $options = $modified_options;
    }
    return $options;
}
示例#2
0
            $resourcesnotadded=add_saved_search_items($usercollection);
            if (!empty($resourcesnotadded))
                {
                ?><script language="Javascript">alert("<?php echo $lang["notapprovedresources"] . implode(", ",$resourcesnotadded);?>");</script><?php
                }
            # Log this
            daily_stat("Add saved search items to collection",0);
            }
        hook("postaddsearch");
        }
	}

$removesearch=getvalescaped("removesearch","");
if ($removesearch!="")
	{
    if (!collection_writeable($usercollection))
        { ?>
        <script language="Javascript">alert("<?php echo $lang["cantmodifycollection"]?>");</script><?php
        }
    else
        {
        hook("preremovesearch");
        #remove saved search
        remove_saved_search($usercollection,$removesearch);
        hook("postremovesearch");
        }
	}
	
$addsmartcollection=getvalescaped("addsmartcollection",-1);
if ($addsmartcollection!=-1)
	{
function remove_resource_from_collection($resource,$collection,$smartadd=false)
	{
	if (collection_writeable($collection)||$smartadd)
		{	
		hook("Removefromcollectionsuccess", "", array( "resourceId" => $resource, "collectionId" => $collection ) );
		sql_query("delete from collection_resource where resource='$resource' and collection='$collection'");
		sql_query("delete from external_access_keys where resource='$resource' and collection='$collection'");
		
		#log this
		collection_log($collection,"r",$resource);
		return true;
		}
	else
		{
		hook("Removefromcollectionfail", "", array( "resourceId" => $resource, "collectionId" => $collection ) );
		return false;
		}
	}
示例#4
0
	else
		{
		# Access has been selected. Generate a URL.
		?>
		<p><?php echo $lang["generateurlexternal"]?></p>
	
		<p><input class="URLDisplay" type="text" value="<?php echo $baseurl?>/?c=<?php echo urlencode($ref) ?>&k=<?php echo generate_collection_access_key($ref,0,"URL",$access,$expires)?>">
		<?php
		}
	}
?>
<?php hook("collectionshareoptions") ?>
</ul>
</div>

<?php if (collection_writeable($ref)||
	(isset($collection['savedsearch']) && $collection['savedsearch']!=null && ($userref==$collection["user"] || checkperm("h"))))
	{
	if (!($hide_internal_sharing_url))
		{
		?>
		<h2><?php echo $lang["internalusersharing"]?></h2>
		<div class="Question">
		<label for="users"><?php echo $lang["attachedusers"]?></label>
		<div class="Fixed"><?php echo (($collection["users"]=="")?$lang["noattachedusers"]:htmlspecialchars($collection["users"])); ?><br /><br />
		<a onClick="return CentralSpaceLoad(this,true);" href="<?php echo $baseurl_short?>pages/collection_edit.php?ref=<?php echo urlencode($ref); ?>">&gt;&nbsp;<?php echo $lang["action-edit"];?></a>
		</div>
		<div class="clearerleft"> </div>
		</div>
		
		<p>&nbsp;</p>
        echo $ref;
        ?>
&k=<?php 
        echo generate_collection_access_key($ref, 0, "URL", $access, $expires);
        ?>
">
		<?php 
    }
}
hook("collectionshareoptions");
?>
</ul>
</div>

<?php 
if (collection_writeable($ref) || isset($collection['savedsearch']) && $collection['savedsearch'] != null && ($userref == $collection["user"] || checkperm("h"))) {
    if (!$hide_internal_sharing_url) {
        ?>
		<h2><?php 
        echo $lang["internalusersharing"];
        ?>
</h2>
		<div class="Question">
		<label for="users"><?php 
        echo $lang["attachedusers"];
        ?>
</label>
		<div class="Fixed"><?php 
        echo $collection["users"] == "" ? $lang["noattachedusers"] : htmlspecialchars($collection["users"]);
        ?>
<br /><br />
示例#6
0
function HookLegacy_actionsAllAftertogglethumbs()
{
    global $baseurl_short, $lang, $usercollection, $contact_sheet, $allow_share, $cinfo, $userref, $preview_all, $feedback, $k, $result, $collection_download, $count_result, $disable_collection_toggle;
    ?>
    <ul style="float: right;">
    <?php 
    if (!collection_is_research_request($usercollection) || !checkperm('r')) {
        hook('beforecollectionminlinks');
        if (checkperm('s')) {
            if ($contact_sheet == true) {
                ?>
                <li><a onclick="return CentralSpaceLoad(this, true);" href="<?php 
                echo $baseurl_short;
                ?>
pages/contactsheet_settings.php?ref=<?php 
                echo urlencode($usercollection);
                ?>
">&nbsp;<?php 
                echo $lang['contactsheet'];
                ?>
</a></li>
                <?php 
            }
            if ($allow_share) {
                ?>
                <li><a onclick="return CentralSpaceLoad(this, true);" href="<?php 
                echo $baseurl_short;
                ?>
pages/collection_share.php?ref=<?php 
                echo urlencode($usercollection);
                ?>
"><?php 
                echo $lang['share'];
                ?>
</a></li>
                <?php 
            }
            if ($userref == $cinfo['user'] || checkperm('h')) {
                ?>
                <li><a onclick="return CentralSpaceLoad(this, true);" href="<?php 
                echo $baseurl_short;
                ?>
pages/collection_edit.php?ref=<?php 
                echo urlencode($usercollection);
                ?>
">&nbsp;<?php 
                echo $allow_share ? $lang['action-edit'] : $lang['editcollection'];
                ?>
</a></li>
                <?php 
            }
            if ($preview_all) {
                ?>
                <li><a onclick="return CentralSpaceLoad(this, true);" href="<?php 
                echo $baseurl_short;
                ?>
pages/preview_all.php?ref=<?php 
                echo urlencode($usercollection);
                ?>
"><?php 
                echo $lang['preview_all'];
                ?>
</a></li>
                <?php 
            }
            hook('collectiontool2min');
            if ($feedback) {
                ?>
                <li><a onclick="return CentralSpaceLoad(this, true);" href="<?php 
                echo $baseurl_short;
                ?>
pages/collection_feedback.php?collection=<?php 
                echo urlencode($usercollection);
                ?>
&k=<?php 
                echo urlencode($k);
                ?>
">&nbsp;<?php 
                echo $lang['sendfeedback'];
                ?>
</a></li>
                <?php 
            }
        }
    } else {
        if (!hook('replacecollectionsresearchlinks')) {
            $research = sql_value("SELECT ref value FROM research_request WHERE collection = '" . $usercollection . "'", 0);
            ?>
            <li><a onclick="return CentralSpaceLoad(this, true);" href="<?php 
            echo $baseurl_short;
            ?>
pages/team/team_research.php"><?php 
            echo $lang['manageresearchrequests'];
            ?>
</a></li>
            <li><a onclick="return CentralSpaceLoad(this, true);" href="<?php 
            echo $baseurl_short;
            ?>
pages/team/team_research_edit.php?ref=<?php 
            echo urlencode($research);
            ?>
"><?php 
            echo $lang['editresearchrequests'];
            ?>
</a></li>
            <?php 
        }
        /* end hook replacecollectionsresearchlinks */
    }
    # If this collection is (fully) editable, then display an extra edit all link
    if (count($result) > 0 && checkperm('e' . $result[0]['archive']) && allow_multi_edit($result)) {
        ?>
        <li><a onclick="return CentralSpaceLoad(this, true);" href="<?php 
        echo $baseurl_short;
        ?>
pages/search.php?search=<?php 
        echo urlencode('!collection' . $usercollection);
        ?>
"><?php 
        echo $lang['viewall'];
        ?>
</a></li>
        <li><a onclick="return CentralSpaceLoad(this, true);" href="<?php 
        echo $baseurl_short;
        ?>
pages/edit.php?collection=<?php 
        echo $usercollection;
        ?>
"><?php 
        echo $lang['action-editall'];
        ?>
</a></li>
        <?php 
    } else {
        ?>
        <li><a onclick="return CentralSpaceLoad(this, true);" href="<?php 
        echo $baseurl_short;
        ?>
pages/search.php?search=<?php 
        echo urlencode('!collection' . $usercollection);
        ?>
"><?php 
        echo $lang['viewall'];
        ?>
</a></li>
        <?php 
    }
    echo isset($emptycollection) && $remove_resources_link_on_collection_bar && collection_writeable($usercollection) ? '<li><a href="' . $baseurl_short . 'pages/collections.php?emptycollection=' . urlencode($usercollection) . '&removeall=true&submitted=removeall&ajax=true" onclick="if(!confirm(\'' . $lang['emptycollectionareyousure'] . '\')){return false;}return CollectionDivLoad(this);">' . $lang['emptycollection'] . '</a></li>' : '';
    if ((isset($zipcommand) || $collection_download) && $count_result > 0) {
        ?>
        <li><a onclick="return CentralSpaceLoad(this, true);" href="<?php 
        echo $baseurl_short;
        ?>
pages/terms.php?k=<?php 
        echo $k;
        ?>
&url=<?php 
        echo urlencode("pages/collection_download.php?collection=" . $usercollection . "&k=" . $k);
        ?>
"><?php 
        echo $lang['action-download'];
        ?>
</a></li>
        <?php 
    }
    if ($count_result > 0 && $k == '' && checkperm('q')) {
        # Ability to request a whole collection (only if user has restricted access to any of these resources)
        $min_access = collection_min_access($result);
        if ($min_access != 0) {
            ?>
            <li><a onclick="return CentralSpaceLoad(this, true);" href="<?php 
            echo $baseurl_short;
            ?>
pages/collection_request.php?ref=<?php 
            echo urlencode($usercollection);
            ?>
"><?php 
            echo $lang['action-request'];
            ?>
</a></li>
            <?php 
        }
    }
    hook('collectiontoolmin');
    ?>
    </ul>
    <?php 
}
if (checkperm("b")) {
    exit("Permission denied.");
}
include_once "../include/collections_functions.php";
include "../include/resource_functions.php";
include "../include/search_functions.php";
$ref = getvalescaped("ref", "", true);
$copycollectionremoveall = getvalescaped("copycollectionremoveall", "");
$offset = getval("offset", 0);
$find = getvalescaped("find", "");
$col_order_by = getvalescaped("col_order_by", "name");
$sort = getval("sort", "ASC");
# Does this user have edit access to collections? Variable will be found in functions below.
$multi_edit = allow_multi_edit($ref);
# Check access
if (!collection_writeable($ref)) {
    exit($lang["no_access_to_collection"]);
}
# Fetch collection data
$collection = get_collection($ref);
if ($collection === false) {
    $error = $lang['error-collectionnotfound'];
    error_alert($error);
    exit;
}
$resources = do_search("!collection" . $ref);
$colcount = count($resources);
# Collection copy functionality
$copy = getval("copy", "");
if ($copy != "") {
    copy_collection($copy, $ref, $copycollectionremoveall != "");
示例#8
0
	ReloadLinks();
	</script>
 	<?php 
}
if ($display_user_rating_stars && $k == "") {
    if (!hook("replace_user_rating_searchviewjs")) {
        ?>
	<script src="<?php 
        echo $baseurl;
        ?>
/lib/js/user_rating_searchview.js?1" type="text/javascript"></script>
	<?php 
    }
}
// Allow Drag & Drop from collection bar to CentralSpace only when special search is "!collection"
if ($collectionsearch && collection_writeable(substr($search, 11))) {
    ?>
	<script>
		jQuery(document).ready(function() {
		if(jQuery(window).width()<600 && jQuery(window).height()<600 && is_touch_device()) {
			return false;
		}
			jQuery('#CentralSpaceResources').droppable({
				accept: '.CollectionPanelShell',

				drop: function(event, ui) {
					if(!is_special_search('!collection', 11)) {
						return false;
					}

					// get the current collection from the search page (ie. CentralSpace)
		<?php 
                    } else {
                        ?>
		<li><a onclick="return CentralSpaceLoad(this,true);" href="<?php 
                        echo $baseurl_short;
                        ?>
pages/search.php?search=<?php 
                        echo urlencode("!collection" . $usercollection);
                        ?>
"><?php 
                        echo $lang["viewall"];
                        ?>
</a></li>
		<?php 
                    }
                    echo isset($emptycollection) && collection_writeable($usercollection) ? '<li><a href="' . $baseurl_short . 'pages/collections.php?ref=' . urlencode($usercollection) . '&removeall=true&submitted=removeall&ajax=true" onclick="if(!confirm(\'' . $lang['emptycollectionareyousure'] . '\')){return false;}return CollectionDivLoad(this);">' . $lang["emptycollection"] . '</a></li>' : "";
                    if ((isset($zipcommand) || $collection_download) && $count_result > 0) {
                        ?>
		<li><a onclick="return CentralSpaceLoad(this,true);" href="<?php 
                        echo $baseurl_short;
                        ?>
pages/terms.php?k=<?php 
                        echo $k;
                        ?>
&url=<?php 
                        echo urlencode("pages/collection_download.php?collection=" . $usercollection . "&k=" . $k);
                        ?>
"><?php 
                        echo $lang["action-download"];
                        ?>
</a></li>
function save_collection($ref)
{
    global $theme_category_levels;
    if (!collection_writeable($ref)) {
        return false;
    }
    $allow_changes = getval("allow_changes", "") != "" ? 1 : 0;
    # Next line disabled as it seems incorrect to override the user's setting here. 20071217 DH.
    #if ($theme!="") {$allow_changes=0;} # lock allow changes to off if this is a theme
    # Update collection with submitted form data
    if (!hook('modifysavecollection')) {
        $sql = "update collection set\n\t\t\t\tname='" . getvalescaped("name", "") . "',\n\t\t\t\t" . hook('savecollectionadditionalfields') . "\n\t\t\t\tkeywords='" . getvalescaped("keywords", "") . "',\n\t\t\t\tpublic='" . getvalescaped("public", "", true) . "',";
        for ($n = 1; $n <= $theme_category_levels; $n++) {
            if ($n == 1) {
                $themeindex = "";
            } else {
                $themeindex = $n;
            }
            $themes[$n] = getvalescaped("theme{$themeindex}", "");
            if (getval("newtheme{$themeindex}", "") != "") {
                $themes[$n] = trim(getvalescaped("newtheme{$themeindex}", ""));
            }
            if (isset($themes[$n])) {
                $sql .= "theme" . $themeindex . "='" . $themes[$n] . "',";
            }
        }
        $sql .= "allow_changes='" . $allow_changes . "'";
        if (checkperm("h")) {
            $sql .= "\n\t\t\t,home_page_publish='" . (getvalescaped("home_page_publish", "") != "" ? "1" : "0") . "'\n\t\t\t,home_page_text='" . getvalescaped("home_page_text", "") . "'";
            if (getval("home_page_image", "") != "") {
                $sql .= ",home_page_image='" . getvalescaped("home_page_image", "") . "'";
            }
        }
        $modified_sql = hook('morehomepagepublishsave', "", array($sql));
        if (!empty($modified_sql)) {
            $sql = $modified_sql;
        }
        $sql .= " where ref='{$ref}'";
        sql_query($sql);
    }
    # end replace hook - modifysavecollection
    index_collection($ref);
    # If 'users' is specified (i.e. access is private) then rebuild users list
    $users = getvalescaped("users", false);
    if ($users !== false) {
        sql_query("delete from user_collection where collection='{$ref}'");
        #log this
        collection_log($ref, "T", 0, '#all_users');
        if ($users != "") {
            # Build a new list and insert
            $users = resolve_userlist_groups($users);
            $ulist = array_unique(trim_array(explode(",", $users)));
            $urefs = sql_array("select ref value from user where username in ('" . join("','", $ulist) . "')");
            if (count($urefs) > 0) {
                sql_query("insert into user_collection(collection,user) values ({$ref}," . join("),(" . $ref . ",", $urefs) . ")");
            }
            #log this
            collection_log($ref, "S", 0, join(", ", $ulist));
        }
    }
    # Relate all resources?
    if (getval("relateall", "") != "") {
        $rlist = get_collection_resources($ref);
        for ($n = 0; $n < count($rlist); $n++) {
            for ($m = 0; $m < count($rlist); $m++) {
                if ($rlist[$n] != $rlist[$m]) {
                    sql_query("delete from resource_related where resource='" . $rlist[$n] . "' and related='" . $rlist[$m] . "'");
                    sql_query("insert into resource_related (resource,related) values ('" . $rlist[$n] . "','" . $rlist[$m] . "')");
                }
            }
        }
    }
    # Remove all resources?
    if (getval("removeall", "") != "") {
        remove_all_resources_from_collection($ref);
    }
    # Delete all resources?
    if (getval("deleteall", "") != "" && !checkperm("D")) {
        if (allow_multi_edit($ref)) {
            delete_resources_in_collection($ref);
        }
    }
    # Update limit count for saved search
    if (isset($_POST["result_limit"])) {
        sql_query("update collection_savedsearch set result_limit='" . getvalescaped("result_limit", "") . "' where collection='{$ref}'");
    }
    refresh_collection_frame();
}