function HookLegacy_actionsCollection_publicRender_collections_public_list_tools($collection_data)
{
    global $baseurl_short, $lang, $contact_sheet, $home_dash, $anonymous_login, $username;
    ?>
    <a href="<?php 
    echo $baseurl_short;
    ?>
pages/search.php?search=<?php 
    echo urlencode('!collection' . $collection_data['ref']);
    ?>
" onClick="return CentralSpaceLoad(this, true);">&gt;&nbsp;<?php 
    echo $lang['viewall'];
    ?>
</a>
    <?php 
    if ($contact_sheet == true) {
        ?>
        &nbsp;<a href="<?php 
        echo $baseurl_short;
        ?>
pages/contactsheet_settings.php?ref=<?php 
        echo urlencode($collection_data['ref']);
        ?>
" onClick="return CentralSpaceLoad(this);">&gt;&nbsp;<?php 
        echo $lang['contactsheet'];
        ?>
</a>
        <?php 
    }
    if (!checkperm('b')) {
        ?>
        &nbsp;<a href="#" onclick="document.getElementById('collectionadd').value='<?php 
        echo urlencode($collection_data['ref']);
        ?>
'; document.getElementById('collectionform').submit(); return false;">&gt;&nbsp;<?php 
        echo $lang['addtomycollections'];
        ?>
</a>
        <?php 
    }
    if ($home_dash && checkPermission_dashcreate()) {
        ?>
        &nbsp;<a href="<?php 
        echo $baseurl_short;
        ?>
pages/dash_tile.php?create=true&tltype=srch&promoted_resource=true&freetext=true&all_users=1&link=/pages/search.php?search=!collection<?php 
        echo urlencode($collection_data['ref']);
        ?>
&order_by=relevance&sort=DESC" onClick="return CentralSpaceLoad(this, true);">&gt;&nbsp;<?php 
        echo $lang['dashtile'];
        ?>
</a>
        <?php 
    }
}
Пример #2
0
function HookLegacy_actionsThemesRender_themes_list_tools($theme_data)
{
    global $baseurl_short, $lang, $download_usage, $collection_download, $home_dash, $anonymous_login, $username, $managed_home_dash, $contact_sheet, $allow_share;
    ?>
    <a href="<?php 
    echo $baseurl_short;
    ?>
pages/search.php?search=<?php 
    echo urlencode('!collection' . $theme_data['ref']);
    ?>
"
       title="<?php 
    echo $lang['collectionviewhover'];
    ?>
"
       onClick="return CentralSpaceLoad(this, true);">&gt;&nbsp;<?php 
    echo $lang['viewall'];
    ?>
</a>
    <?php 
    if (!checkperm('b')) {
        echo '&nbsp;' . change_collection_link($theme_data['ref']);
    }
    if ($download_usage && (isset($zipcommand) || $collection_download)) {
        ?>
        &nbsp;<a href="<?php 
        echo $baseurl_short;
        ?>
pages/terms.php?url=<?php 
        echo urlencode('pages/download_usage.php?collection=' . $theme_data['ref']);
        ?>
">&gt;&nbsp;<?php 
        echo $lang['action-download'];
        ?>
</a>
        <?php 
    } else {
        if (isset($zipcommand) || $collection_download) {
            ?>
        &nbsp;<a href="<?php 
            echo $baseurl_short;
            ?>
pages/terms.php?url=<?php 
            echo urlencode('pages/collection_download.php?collection=' . $theme_data['ref']);
            ?>
" onClick="return CentralSpaceLoad(this, true);">&gt;&nbsp;<?php 
            echo $lang['action-download'];
            ?>
</a>
        <?php 
        }
    }
    if ($contact_sheet == true) {
        ?>
        &nbsp;<a href="<?php 
        echo $baseurl_short;
        ?>
pages/contactsheet_settings.php?ref=<?php 
        echo $theme_data['ref'];
        ?>
"
                 title="<?php 
        echo $lang['collectioncontacthover'];
        ?>
"
                 onClick="return CentralSpaceLoad(this, true);">&gt;&nbsp;<?php 
        echo $lang['contactsheet'];
        ?>
</a>
        <?php 
    }
    #Home_dash is on, And not Anonymous use, And (Dash tile user (Not with a managed dash) || Dash Tile Admin)
    if ($home_dash && checkPermission_dashcreate()) {
        ?>
        &nbsp;<a href="<?php 
        echo $baseurl_short;
        ?>
pages/dash_tile.php?create=true&tltype=srch&promoted_resource=true&freetext=true&all_users=1&link=/pages/search.php?search=!collection<?php 
        echo urlencode($theme_data['ref']);
        ?>
&order_by=relevance&sort=DESC"  onClick="return CentralSpaceLoad(this, true);">&gt;&nbsp;<?php 
        echo $lang['dashtile'];
        ?>
</a>
        <?php 
    }
    if ($allow_share && (checkperm('v') || checkperm('g'))) {
        ?>
        &nbsp;<a href="<?php 
        echo $baseurl_short;
        ?>
pages/collection_share.php?ref=<?php 
        echo $theme_data['ref'];
        ?>
" onClick="return CentralSpaceLoad(this, true);">&gt;&nbsp;<?php 
        echo $lang['share'];
        ?>
</a>
        <?php 
    }
    if (checkperm('h')) {
        ?>
        &nbsp;<a href="<?php 
        echo $baseurl_short;
        ?>
pages/collection_edit.php?ref=<?php 
        echo $theme_data['ref'];
        ?>
" onClick="return CentralSpaceLoad(this, true);">&gt;&nbsp;<?php 
        echo $lang['action-edit'];
        ?>
</a>
        <?php 
    }
    hook('addcustomtool', '', array($theme_data['ref']));
}
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;
}
function HookLegacy_actionsCollection_manageLegacy_list_tools($collection_data)
{
    global $baseurl_short, $lang, $autoshow_thumbs, $download_usage, $collection_download, $contact_sheet, $manage_collections_contact_sheet_link, $manage_collections_share_link, $allow_share, $manage_collections_remove_link, $username, $collection_purge, $home_dash, $anonymous_login, $show_edit_all_link, $edit_all_checkperms;
    ?>
    <a href="<?php 
    echo $baseurl_short;
    ?>
pages/search.php?search=<?php 
    echo urlencode('!collection' . $collection_data['ref']);
    ?>
" onClick="return CentralSpaceLoad(this, true);">&gt;&nbsp;<?php 
    echo $lang['viewall'];
    ?>
</a>
    &nbsp;
    <a href="<?php 
    echo $baseurl_short;
    ?>
pages/collections.php?collection=<?php 
    echo urlencode($collection_data['ref']);
    if ($autoshow_thumbs) {
        echo '&amp;thumbs=show';
    }
    ?>
" onClick="ChangeCollection(<?php 
    echo $collection_data['ref'];
    ?>
, ''); return false;">&gt;&nbsp;<?php 
    echo $lang['action-select'];
    ?>
</a>
    <?php 
    if ($download_usage && (isset($zipcommand) || $collection_download)) {
        ?>
        <a href="<?php 
        echo $baseurl_short;
        ?>
pages/terms.php?url=<?php 
        echo urlencode('pages/download_usage.php?collection=' . $collection_data['ref']);
        ?>
">&gt;&nbsp;<?php 
        echo $lang['action-download'];
        ?>
</a>
        <?php 
    } else {
        if (isset($zipcommand) || $collection_download) {
            ?>
        &nbsp;<a href="<?php 
            echo $baseurl_short;
            ?>
pages/terms.php?url=<?php 
            echo urlencode('pages/collection_download.php?collection=' . $collection_data['ref']);
            ?>
" onClick="return CentralSpaceLoad(this, true);">&gt;&nbsp;<?php 
            echo $lang['action-download'];
            ?>
</a>
        <?php 
        }
    }
    if ($contact_sheet == true && $manage_collections_contact_sheet_link) {
        ?>
        &nbsp;<a href="<?php 
        echo $baseurl_short;
        ?>
pages/contactsheet_settings.php?ref=<?php 
        echo urlencode($collection_data['ref']);
        ?>
" onClick="return CentralSpaceLoad(this, true);">&gt;&nbsp;<?php 
        echo $lang['contactsheet'];
        ?>
</a>
        <?php 
    }
    if ($manage_collections_share_link && $allow_share && (checkperm('v') || checkperm('g'))) {
        ?>
        &nbsp;<a href="<?php 
        echo $baseurl_short;
        ?>
pages/collection_share.php?ref=<?php 
        echo $collection_data['ref'];
        ?>
" onClick="return CentralSpaceLoad(this, true);">&gt;&nbsp;<?php 
        echo $lang['share'];
        ?>
</a>
        <?php 
    }
    /*Remove Shared Collection*/
    if ($manage_collections_remove_link && $username != $collection_data['username']) {
        ?>
&nbsp;<a href="#" onclick="if(confirm('<?php 
        echo $lang["removecollectionareyousure"];
        ?>
')) {document.getElementById('collectionremove').value='<?php 
        echo urlencode($collection_data["ref"]);
        ?>
'; document.getElementById('collectionform').submit();} return false;">&gt;&nbsp;<?php 
        echo $lang['action-remove'];
        ?>
</a>
        <?php 
    }
    if (($username == $collection_data['username'] || checkperm('h')) && $collection_data['cant_delete'] == 0) {
        ?>
        &nbsp;<a href="#" onclick="if(confirm('<?php 
        echo $lang["collectiondeleteconfirm"];
        ?>
')) {document.getElementById('collectiondelete').value='<?php 
        echo urlencode($collection_data["ref"]);
        ?>
'; passQueryStrings(['paging', 'col_order_by', 'sort', 'find', 'go', 'offset'], 'collectionform'); CentralSpacePost(document.getElementById('collectionform'),false);} return false;">&gt;&nbsp;<?php 
        echo $lang['action-delete'];
        ?>
</a>
        <?php 
    }
    if ($collection_purge) {
        if ($n == 0) {
            ?>
            <input id="collectionpurge" type=hidden name="purge" value="">
            <?php 
        }
        if (checkperm('e0') && $collection_data['cant_delete'] == 0) {
            ?>
            &nbsp;<a href="#" onclick="if(confirm('<?php 
            echo $lang["purgecollectionareyousure"];
            ?>
')) {document.getElementById('collectionpurge').value='<?php 
            echo urlencode($collection_data["ref"]);
            ?>
';document.getElementById('collectionform').submit();} return false;">&gt;&nbsp;<?php 
            echo $lang['purgeanddelete'];
            ?>
</a>
            <?php 
        }
    }
    hook('additionalcollectiontool');
    if ($username == $collection_data['username'] || checkperm('h')) {
        ?>
        &nbsp;<a href="<?php 
        echo $baseurl_short;
        ?>
pages/collection_edit.php?ref=<?php 
        echo urlencode($collection_data['ref']);
        ?>
" onClick="return CentralSpaceLoad(this, true);" >&gt;&nbsp;<?php 
        echo $lang['action-edit'];
        ?>
</a>
        <?php 
    }
    # If this collection is (fully) editable, then display an edit all link
    if ($show_edit_all_link && $collection_data['count'] > 0) {
        if (!$edit_all_checkperms || allow_multi_edit($collection_data['ref'])) {
            ?>
            &nbsp;<a href="<?php 
            echo $baseurl_short;
            ?>
pages/edit.php?collection=<?php 
            echo urlencode($collection_data['ref']);
            ?>
" onClick="return CentralSpaceLoad(this, true);">&gt;&nbsp;<?php 
            echo $lang['action-editall'];
            ?>
</a>
            <?php 
        }
    }
    #Home_dash is on, And not Anonymous use, And (Dash tile user (Not with a managed dash) || Dash Tile Admin)
    if ($home_dash && checkPermission_dashcreate()) {
        ?>
        &nbsp;<a href="<?php 
        echo $baseurl_short;
        ?>
pages/dash_tile.php?create=true&tltype=srch&promoted_resource=true&freetext=true&all_users=1&link=/pages/search.php?search=!collection<?php 
        echo urlencode($collection_data['ref']);
        ?>
&order_by=relevance&sort=DESC" onClick="return CentralSpaceLoad(this, true);">&gt;&nbsp;<?php 
        echo $lang['dashtile'];
        ?>
</a>
        <?php 
    }
    if ($username == $collection_data['username'] || checkperm('h')) {
        ?>
        &nbsp;<a href="<?php 
        echo $baseurl_short;
        ?>
pages/collection_log.php?ref=<?php 
        echo urlencode($collection_data['ref']);
        ?>
&order_by=relevance&sort=DESC" onClick="return CentralSpaceLoad(this, true);">&gt;&nbsp;<?php 
        echo $lang['log'];
        ?>
</a>
        <?php 
    }
    hook('addcustomtool');
}
Пример #5
0
<?php

/*
 * User Dash - Tile Interface
 * Page for building tiles for the homepage dash interface
 *
 */
include "../include/db.php";
include "../include/general.php";
$k = getvalescaped("k", "");
include "../include/authenticate.php";
include "../include/collections_functions.php";
include "../include/search_functions.php";
include "../include/dash_functions.php";
if (!checkPermission_dashcreate()) {
    exit($lang["error-permissiondenied"]);
}
global $baseurl, $baseurl_short, $userref, $managed_home_dash;
if ($managed_home_dash && !(checkperm("h") && !checkperm("hdta")) || checkperm("dta") && !checkperm("h")) {
    exit($lang["error-permissiondenied"]);
}
$error = false;
/* 
 * Process Submitted Tile 
 */
$submitdashtile = getvalescaped("submitdashtile", FALSE);
if ($submitdashtile) {
    $buildurl = getvalescaped("url", "");
    if ($buildurl == "") {
        # No URL provided - build a URL (standard title types).
        $buildurl = "pages/ajax/dash_tile.php?tltype=" . getvalescaped("tltype", "") . "&tlstyle=" . getvalescaped("tlstyle", "");
                    ?>
						<input type=hidden name="theme<?php 
                    echo $themeindex;
                    ?>
" value="<?php 
                    echo htmlspecialchars($collection["theme" . $themeindex]);
                    ?>
">
						<?php 
                }
            }
        }
    }
}
global $home_dash, $anonymous_login, $username;
if ($home_dash && checkPermission_dashcreate()) {
    ?>
		<div class="Question">
			<label><?php 
    echo $lang["theme_home_promote"];
    ?>
</label>
			<div class="Fixed">
				<a href="<?php 
    echo $baseurl_short;
    ?>
pages/dash_tile.php?create=true&tltype=srch&promoted_resource=true&freetext=true&all_users=1&link=/pages/search.php?search=!collection<?php 
    echo $ref;
    ?>
&order_by=relevance&sort=DESC"  onClick="return CentralSpaceLoad(this,true);">
					<?php 
Пример #7
0
function HookLegacy_actionsSearchAdd_bottom_in_page_nav_left()
{
    global $baseurl_short, $search, $restypes, $archive, $daylimit, $lang, $home_dash, $url, $allow_smart_collections, $starsearch, $resources_count, $show_searchitemsdiskusage, $offset, $order_by, $sort, $k, $allow_save_search;
    ?>
    <div class="BottomInpageNavLeft">
    <?php 
    if (!hook("replacesearchbottomnav")) {
        if (!checkperm("b") && $k == "") {
            if ($allow_save_search) {
                ?>
<div class="InpageNavLeftBlock"><a onClick="return CollectionDivLoad(this);" href="<?php 
                echo $baseurl_short;
                ?>
pages/collections.php?addsearch=<?php 
                echo urlencode($search);
                ?>
&amp;restypes=<?php 
                echo urlencode($restypes);
                ?>
&amp;archive=<?php 
                echo urlencode($archive);
                ?>
&amp;daylimit=<?php 
                echo urlencode($daylimit);
                ?>
">&gt;&nbsp;<?php 
                echo $lang["savethissearchtocollection"];
                ?>
</a></div><?php 
            }
            #Home_dash is on, And not Anonymous use, And (Dash tile user (Not with a managed dash) || Dash Tile Admin)
            if ($home_dash && checkPermission_dashcreate()) {
                ?>
 
                <div class="InpageNavLeftBlock">
                    <a onClick="return CentralSpaceLoad(this);" href="<?php 
                echo $baseurl_short;
                ?>
pages/dash_tile.php?create=true&tltype=srch&freetext=true&link=<?php 
                echo $url;
                ?>
" onClick="jQuery('this').href='<?php 
                echo $baseurl_short;
                ?>
pages/dash_tile.php?create=true&tltype=srch&link='+window.location.href;">
                        &gt;&nbsp;<?php 
                echo $lang["savethissearchtodash"];
                ?>
                    </a>
                </div>
                <?php 
            }
            if ($allow_smart_collections && substr($search, 0, 11) != "!collection") {
                ?>
<div class="InpageNavLeftBlock"><a onClick="return CollectionDivLoad(this);" href="<?php 
                echo $baseurl_short;
                ?>
pages/collections.php?addsmartcollection=<?php 
                echo urlencode($search);
                ?>
&amp;restypes=<?php 
                echo urlencode($restypes);
                ?>
&amp;archive=<?php 
                echo urlencode($archive);
                ?>
&amp;starsearch=<?php 
                echo urlencode($starsearch);
                ?>
">&gt;&nbsp;<?php 
                echo $lang["savesearchassmartcollection"];
                ?>
</a></div><?php 
            }
            global $smartsearch;
            if ($allow_smart_collections && substr($search, 0, 11) == "!collection" && (is_array($smartsearch[0]) && !empty($smartsearch[0]))) {
                $smartsearch = $smartsearch[0];
                ?>
<div class="InpageNavLeftBlock"><a onClick="return CentralSpaceLoad(this,true);" href="search.php?search=<?php 
                echo urlencode($smartsearch['search']);
                ?>
&amp;restypes=<?php 
                echo urlencode($smartsearch['restypes']);
                ?>
&amp;archive=<?php 
                echo urlencode($smartsearch['archive']);
                ?>
&amp;starsearch=<?php 
                echo urlencode($smartsearch['starsearch']);
                ?>
&amp;daylimit=<?php 
                echo urlencode($daylimit);
                ?>
">&gt;&nbsp;<?php 
                echo $lang["dosavedsearch"];
                ?>
</a></div><?php 
            }
            if ($resources_count != 0) {
                if (!hook('replacesavesearchitemstocollection')) {
                    ?>
                <div class="InpageNavLeftBlock"><a onClick="return CollectionDivLoad(this);" href="<?php 
                    echo $baseurl_short;
                    ?>
pages/collections.php?addsearch=<?php 
                    echo urlencode($search);
                    ?>
&amp;restypes=<?php 
                    echo urlencode($restypes);
                    ?>
&amp;archive=<?php 
                    echo urlencode($archive);
                    ?>
&amp;mode=resources&amp;daylimit=<?php 
                    echo urlencode($daylimit);
                    ?>
">&gt;&nbsp;<?php 
                    echo $lang["savesearchitemstocollection"];
                    ?>
</a></div>
                <?php 
                }
                if ($show_searchitemsdiskusage) {
                    ?>
                    <div class="InpageNavLeftBlock"><a onClick="return CentralSpaceLoad(this, true);" href="<?php 
                    echo $baseurl_short;
                    ?>
pages/search_disk_usage.php?search=<?php 
                    echo urlencode($search);
                    ?>
&amp;restypes=<?php 
                    echo urlencode($restypes);
                    ?>
&amp;offset=<?php 
                    echo urlencode($offset);
                    ?>
&amp;order_by=<?php 
                    echo urlencode($order_by);
                    ?>
&amp;sort=<?php 
                    echo urlencode($sort);
                    ?>
&amp;archive=<?php 
                    echo urlencode($archive);
                    ?>
&amp;daylimit=<?php 
                    echo urlencode($daylimit);
                    ?>
&amp;k=<?php 
                    echo urlencode($k);
                    ?>
&amp;restypes=<?php 
                    echo urlencode($restypes);
                    ?>
">&gt;&nbsp;<?php 
                    echo $lang["searchitemsdiskusage"];
                    ?>
</a></div>
                    <?php 
                }
            }
        }
        if ($k == '') {
            ?>
            <div class="InpageNavLeftBlock">
                <a href="/pages/csv_export_results_metadata.php?search=<?php 
            echo urlencode($search);
            ?>
&restype=<?php 
            echo urlencode($restypes);
            ?>
&order_by=<?php 
            echo urlencode($order_by);
            ?>
&archive=<?php 
            echo urlencode($archive);
            ?>
&sort=<?php 
            echo urlencode($sort);
            ?>
&starsearch=<?php 
            echo urlencode($starsearch);
            ?>
">&gt;&nbsp;<?php 
            echo $lang['csvExportResultsMetadata'];
            ?>
</a>
            </div>
            <?php 
        }
        hook("resultsbottomtoolbar");
    }
    ?>
    <!--End of hook("replacesearchbottomnav")-->
    </div>
    <?php 
}
function compile_search_actions($top_actions)
{
    $options = array();
    $o = 0;
    global $baseurl_short, $lang, $k, $search, $restypes, $order_by, $archive, $sort, $daylimit, $home_dash, $url, $allow_smart_collections, $resources_count, $show_searchitemsdiskusage, $offset, $allow_save_search;
    // globals that could also be passed as a reference
    global $starsearch;
    if (!checkperm('b') && $k == '') {
        if ($top_actions && $allow_save_search) {
            $extra_tag_attributes = sprintf('
                    data-url="%spages/collections.php?addsearch=%s&restypes=%s&archive=%s&daylimit=%s"
                ', $baseurl_short, urlencode($search), urlencode($restypes), urlencode($archive), urlencode($daylimit));
            $options[$o]['value'] = 'save_search_to_collection';
            $options[$o]['label'] = $lang['savethissearchtocollection'];
            $options[$o]['data_attr'] = array();
            $options[$o]['extra_tag_attributes'] = $extra_tag_attributes;
            $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()) {
            $option_name = 'save_search_to_dash';
            $data_attribute = array('url' => $baseurl_short . 'pages/dash_tile.php?create=true&tltype=srch&freetext=true"', 'link' => $url);
            if (substr($search, 0, 11) == '!collection') {
                $option_name = 'save_collection_to_dash';
                $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=%s&order_by=relevance&sort=DESC
                    ', $baseurl_short, $search);
            }
            $options[$o]['value'] = $option_name;
            $options[$o]['label'] = $lang['savethissearchtodash'];
            $options[$o]['data_attr'] = $data_attribute;
            $o++;
        }
        // Save search as Smart Collections
        if ($allow_smart_collections && substr($search, 0, 11) != '!collection') {
            $extra_tag_attributes = sprintf('
                    data-url="%spages/collections.php?addsmartcollection=%s&restypes=%s&archive=%s&starsearch=%s"
                ', $baseurl_short, urlencode($search), urlencode($restypes), urlencode($archive), urlencode($starsearch));
            $options[$o]['value'] = 'save_search_smart_collection';
            $options[$o]['label'] = $lang['savesearchassmartcollection'];
            $options[$o]['data_attr'] = array();
            $options[$o]['extra_tag_attributes'] = $extra_tag_attributes;
            $o++;
        }
        /*// Wasn't able to see this working even in the old code
                // so I left it here for reference. Just uncomment it and it should work
                global $smartsearch;
                if($allow_smart_collections && substr($search, 0, 11) == '!collection' && (is_array($smartsearch[0]) && !empty($smartsearch[0])))
                    {
                    $smartsearch = $smartsearch[0];
        
                    $extra_tag_attributes = sprintf('
                            data-url="%spages/search.php?search=%s&restypes=%s&archive=%s&starsearch=%s&daylimit=%s"
                        ',
                        $baseurl_short,
                        urlencode($smartsearch['search']),
                        urlencode($smartsearch['restypes']),
                        urlencode($smartsearch['archive']),
                        urlencode($smartsearch['starsearch']),
                        urlencode($daylimit)
                    );
        
                    $options[$o]['value']='do_saved_search';
        			$options[$o]['label']=$lang['dosavedsearch'];
        			$options[$o]['data_attr']=array();
        			$options[$o]['extra_tag_attributes']=$extra_tag_attributes;
        			$o++;
                    }*/
        if ($resources_count != 0) {
            $extra_tag_attributes = sprintf('
                    data-url="%spages/collections.php?addsearch=%s&restypes=%s&archive=%s&mode=resources&daylimit=%s"
                ', $baseurl_short, urlencode($search), urlencode($restypes), urlencode($archive), urlencode($daylimit));
            $options[$o]['value'] = 'save_search_items_to_collection';
            $options[$o]['label'] = $lang['savesearchitemstocollection'];
            $options[$o]['data_attr'] = array();
            $options[$o]['extra_tag_attributes'] = $extra_tag_attributes;
            $o++;
            if ($show_searchitemsdiskusage) {
                $extra_tag_attributes = sprintf('
                        data-url="%spages/search_disk_usage.php?search=%s&restypes=%s&offset=%s&order_by=%s&sort=%s&archive=%s&daylimit=%s&k=%s"
                    ', $baseurl_short, urlencode($search), urlencode($restypes), urlencode($offset), urlencode($order_by), urlencode($sort), urlencode($archive), urlencode($daylimit), urlencode($k));
                $options[$o]['value'] = 'search_items_disk_usage';
                $options[$o]['label'] = $lang['searchitemsdiskusage'];
                $options[$o]['data_attr'] = array();
                $options[$o]['extra_tag_attributes'] = $extra_tag_attributes;
                $o++;
            }
        }
    }
    if ($top_actions && $k == '') {
        $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=%s&restype=%s&order_by=%s&archive=%s&sort=%s&starsearch=%s', $baseurl_short, urlencode($search), urlencode($restypes), urlencode($order_by), urlencode($archive), urlencode($sort), urlencode($starsearch));
        $o++;
    }
    // Add extra search actions or modify existing options through plugins
    $modified_options = hook('render_search_actions_add_option', '', array($options));
    if ($top_actions && !empty($modified_options)) {
        $options = $modified_options;
    }
    return $options;
}