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']));
}
Example #2
0
    function DisplayTheme($themes = array())
    {
        global $theme_direct_jump, $themes_column_sorting, $themes_ref_column, $themes_date_column, $baseurl_short, $baseurl, $default_perpage_list, $collection_prefix, $col_order_by, $revsort, $sort, $find, $getthemes, $m, $lang, $flag_new_themes, $contact_sheet, $theme_images, $allow_share, $zipcommand, $collection_download, $theme_images_align_right, $themes_category_split_pages, $themes_category_split_pages_parents, $collections_compact_style, $pagename, $show_edit_all_link, $preview_all, $userref, $collection_purge, $themes_category_split_pages, $themes_category_split_pages_parents_root_node, $enable_theme_category_sharing, $enable_theme_category_edit, $show_theme_collection_stats, $lastlevelchange;
        $col_order_by = getvalescaped("order_by", getvalescaped("saved_themes_order_by", "created"));
        $sort = getvalescaped("sort", getvalescaped("saved_themes_sort", "ASC"));
        $revsort = $sort == "ASC" ? "DESC" : "ASC";
        # pager
        $per_page = getvalescaped("per_page_list", $default_perpage_list, true);
        $collection_valid_order_bys = array("name", "c");
        // sorting doesn't work for nonsplit
        if (!$themes_column_sorting || !$themes_category_split_pages || $theme_direct_jump) {
            $sort = "ASC";
            $col_order_by = "name";
            $themes_column_sorting = false;
        }
        if ($themes_ref_column) {
            $collection_valid_order_bys[] = "ref";
        }
        if ($themes_date_column) {
            $collection_valid_order_bys[] = "created";
        }
        $modified_collection_valid_order_bys = hook("modifycollectionvalidorderbys");
        if ($modified_collection_valid_order_bys) {
            $collection_valid_order_bys = $modified_collection_valid_order_bys;
        }
        if (!in_array($col_order_by, $collection_valid_order_bys)) {
            $col_order_by = "created";
        }
        # Check the value is one of the valid values (SQL injection filter)
        # Work out theme name
        $themecount = count($themes);
        for ($x = 0; $x < $themecount; $x++) {
            if (isset($themes[$x]) && !isset($themes[$x + 1])) {
                $themename = i18n_get_translated($themes[$x]);
            }
        }
        $getthemes = get_themes($themes);
        if (count($getthemes) > 0) {
            ?>
		<div class="RecordBox">
		<div class="RecordPanel">

		<div class="RecordHeader">

		<?php 
            if ($themes_category_split_pages && $themes_category_split_pages_parents) {
                ?>
<h1><?php 
                echo $lang["collections"];
                ?>
</h1><?php 
            }
            // count total items in themes
            $totalcount = 0;
            for ($m = 0; $m < count($getthemes); $m++) {
                $totalcount = $totalcount + $getthemes[$m]['c'];
            }
            if ($theme_images_align_right) {
                ?>
			<div style="float:right;">
			<?php 
            }
            $images = get_theme_image($themes);
            if ($images !== false && $theme_images) {
                for ($n = 0; $n < count($images); $n++) {
                    ?>
<div style="float:left;margin-right:12px;"><img class="CollectImageBorder" src="<?php 
                    echo get_resource_path($images[$n], false, "col", false);
                    ?>
" /></div>
				<?php 
                }
            }
            if ($theme_images_align_right) {
                ?>
			</div>
			<?php 
            }
            $themeslinks = "";
            for ($x = 0; $x < count($themes); $x++) {
                $themeslinks .= "theme" . ($x + 1) . "=" . urlencode($themes[$x]) . "&";
            }
            ?>
        <table><tr><td style="margin:0px;padding:0px;">
		<h1 ><?php 
            if ($themes_category_split_pages && $themes_category_split_pages_parents) {
                if ($themes_category_split_pages_parents_root_node) {
                    ?>
<a href="themes.php"  onClick="return CentralSpaceLoad(this,true);"><?php 
                    echo $lang["themes"];
                    ?>
</a> / <?php 
                }
                $themescrumbs = "";
                for ($x = 0; $x < count($themes); $x++) {
                    $themescrumbs .= "theme" . ($x + 1) . "=" . urlencode($themes[$x]) . "&";
                    ?>
<a href="themes.php?<?php 
                    echo $themescrumbs;
                    ?>
"  onClick="return CentralSpaceLoad(this,true);"><?php 
                    echo htmlspecialchars(i18n_get_translated($themes[$x]));
                    ?>
</a> / <?php 
                }
            } else {
                echo stripslashes(str_replace("*", "", $themename));
            }
            ?>
</h1></td></tr><tr><td style="margin:0px;padding:0px;">
			
			<?php 
            if ($show_theme_collection_stats || !$themes_category_split_pages && ($enable_theme_category_sharing || $enable_theme_category_edit)) {
                $linkparams = "";
                for ($x = 0; $x < count($themes); $x++) {
                    $linkparams .= "theme" . ($x + 1) . "=" . urlencode($themes[$x]) . "&";
                }
                if ($show_theme_collection_stats) {
                    ?>
					<p style="clear:none;"><?php 
                    $collcount = count($getthemes);
                    echo $collcount == 1 ? $lang["collections-1"] : sprintf(str_replace("%number", "%d", $lang["collections-2"]), $collcount, $totalcount);
                    hook("themeactioninline");
                    ?>
					</p>
					</td><td style="margin:0px;padding:0px;">
					<?php 
                }
                ?>
				<?php 
                if (!$themes_category_split_pages) {
                    if (checkperm("h") && $enable_theme_category_sharing) {
                        $sharelink = "";
                        for ($x = 0; $x < count($themes); $x++) {
                            $sharelink .= "theme" . ($x + 1) . "=" . urlencode($themes[$x]) . "&";
                        }
                        ?>
						
						</td><tr><td style="margin:0px;padding:0px;">
						<a href="theme_category_share.php?<?php 
                        echo $linkparams;
                        ?>
"  onClick="return CentralSpaceLoad(this,true);"><?php 
                        echo "> " . $lang["share"] . "</a>";
                    }
                    hook("themeaction");
                    if ($enable_theme_category_edit && checkperm("t")) {
                        ?>
						<a href="theme_edit.php?<?php 
                        echo $linkparams . "lastlevelchange=" . $lastlevelchange;
                        ?>
" onClick="return CentralSpaceLoad(this,true);"><?php 
                        echo "> " . $lang["action-edit"] . "</a>";
                    }
                }
            }
            ?>
			
			</td></tr></table>
            <!-- The number of collections should never be equal to zero. -->

		<div class="clearerright"> </div>
		</div>
		<br />
		<div class="Listview" style="margin-top:10px;margin-bottom:5px;clear:left;">
		<table border="0" cellspacing="0" cellpadding="0" class="ListviewStyle">
		<tr class="ListviewBoxedTitleStyle">
		<td><?php 
            if ($col_order_by == "name") {
                ?>
<span class="Selected"><?php 
            }
            if ($themes_column_sorting) {
                ?>
<a href="<?php 
                echo $baseurl_short;
                ?>
pages/themes.php?<?php 
                echo $themeslinks;
                ?>
order_by=name&sort=<?php 
                echo $revsort;
                ?>
" onClick="return CentralSpaceLoad(this);"><?php 
            }
            echo $lang["collectionname"];
            if ($themes_category_split_pages) {
                ?>
</a><?php 
            }
            if ($col_order_by == "name") {
                ?>
<div class="<?php 
                echo $sort;
                ?>
">&nbsp;</div><?php 
            }
            ?>
</td>
		<?php 
            if ($themes_ref_column) {
                ?>
		<td><?php 
                if ($col_order_by == "ref") {
                    ?>
<span class="Selected"><?php 
                }
                if ($themes_column_sorting) {
                    ?>
<a href="<?php 
                    echo $baseurl_short;
                    ?>
pages/themes.php?<?php 
                    echo $themeslinks;
                    ?>
order_by=ref&sort=<?php 
                    echo $revsort;
                    ?>
" onClick="return CentralSpaceLoad(this);"><?php 
                }
                echo $lang["id"];
                if ($themes_category_split_pages) {
                    ?>
</a><?php 
                }
                if ($col_order_by == "ref") {
                    ?>
<div class="<?php 
                    echo $sort;
                    ?>
">&nbsp;</div><?php 
                }
                ?>
</td>
		<?php 
            }
            ?>
		<?php 
            if ($themes_date_column) {
                ?>
		<td><?php 
                if ($col_order_by == "created") {
                    ?>
<span class="Selected"><?php 
                }
                if ($themes_column_sorting) {
                    ?>
<a href="<?php 
                    echo $baseurl_short;
                    ?>
pages/themes.php?<?php 
                    echo $themeslinks;
                    ?>
order_by=created&sort=<?php 
                    echo $revsort;
                    ?>
" onClick="return CentralSpaceLoad(this);"><?php 
                }
                echo $lang["created"];
                if ($themes_category_split_pages) {
                    ?>
</a><?php 
                }
                if ($col_order_by == "created") {
                    ?>
<div class="<?php 
                    echo $sort;
                    ?>
">&nbsp;</div><?php 
                }
                ?>
</td>
		<?php 
            }
            ?>
		<td><?php 
            if ($col_order_by == "c") {
                ?>
<span class="Selected"><?php 
            }
            if ($themes_column_sorting) {
                ?>
<a href="<?php 
                echo $baseurl_short;
                ?>
pages/themes.php?<?php 
                echo $themeslinks;
                ?>
order_by=c&sort=<?php 
                echo $revsort;
                ?>
" onClick="return CentralSpaceLoad(this);"><?php 
            }
            echo $lang["itemstitle"];
            if ($themes_category_split_pages) {
                ?>
</a><?php 
            }
            if ($col_order_by == "c") {
                ?>
<div class="<?php 
                echo $sort;
                ?>
">&nbsp;</div><?php 
            }
            ?>
</td>
		<?php 
            hook("beforecollectiontoolscolumnheader", "themes", array($themeslinks));
            ?>
		<td><div class="ListTools"><?php 
            echo $lang["tools"];
            ?>
</div></td>
		</tr>

		<?php 
            for ($m = 0; $m < count($getthemes); $m++) {
                ?>
			<tr <?php 
                hook("collectionlistrowstyle");
                ?>
>
			<td width="50%"><div class="ListTitle"><a href="search.php?search=!collection<?php 
                echo $getthemes[$m]["ref"];
                ?>
&bc_from=themes"  title="<?php 
                echo $lang["collectionviewhover"];
                ?>
" onClick="return CentralSpaceLoad(this,true);"><?php 
                echo htmlspecialchars(i18n_get_translated($getthemes[$m]["name"]));
                ?>
</a>
			<?php 
                if ($flag_new_themes && time() - strtotime($getthemes[$m]["created"]) < 60 * 60 * 24 * 14) {
                    ?>
<div class="NewFlag"><?php 
                    echo $lang["newflag"];
                    ?>
</div><?php 
                }
                ?>
			</div></td>
			<?php 
                if ($themes_ref_column) {
                    ?>
			<td><?php 
                    echo $getthemes[$m]["ref"];
                    ?>
</td>
			<?php 
                }
                ?>
			<?php 
                if ($themes_date_column) {
                    ?>
			<td><?php 
                    echo nicedate($getthemes[$m]["created"], true);
                    ?>
</td>
			<?php 
                }
                ?>
			<td width="5%"><?php 
                echo $getthemes[$m]["c"];
                ?>
</td>
			<?php 
                hook("beforecollectiontoolscolumn");
                ?>
			<td nowrap><div class="ListTools">
            <?php 
                if ($collections_compact_style) {
                    include "collections_compact_style.php";
                } else {
                    ?>
<a href="search.php?search=<?php 
                    echo urlencode("!collection" . $getthemes[$m]["ref"]);
                    ?>
" title="<?php 
                    echo $lang["collectionviewhover"];
                    ?>
" onClick="return CentralSpaceLoad(this,true);">&gt;&nbsp;<?php 
                    echo $lang["viewall"];
                    ?>
</a>

                <?php 
                    if (!checkperm("b")) {
                        ?>
&nbsp;<?php 
                        echo change_collection_link($getthemes[$m]["ref"]);
                        ?>
&gt;&nbsp;<?php 
                        echo $lang["action-select"];
                        ?>
</a><?php 
                    }
                    ?>

                <?php 
                    if (isset($zipcommand) || $collection_download) {
                        ?>
                &nbsp;<a href="collection_download.php?collection=<?php 
                        echo $getthemes[$m]["ref"];
                        ?>
" onClick="return CentralSpaceLoad(this,true);">&gt;&nbsp;<?php 
                        echo $lang["action-download"];
                        ?>
</a>
                <?php 
                    }
                    ?>

                <?php 
                    if ($contact_sheet == true) {
                        ?>
                &nbsp;<a href="contactsheet_settings.php?ref=<?php 
                        echo $getthemes[$m]["ref"];
                        ?>
"  title="<?php 
                        echo $lang["collectioncontacthover"];
                        ?>
" onClick="return CentralSpaceLoad(this,true);">&gt;&nbsp;<?php 
                        echo $lang["contactsheet"];
                        ?>
</a>
                <?php 
                    }
                    ?>

                <?php 
                    if ($allow_share && (checkperm("v") || checkperm("g"))) {
                        ?>
 &nbsp;<a href="collection_share.php?ref=<?php 
                        echo $getthemes[$m]["ref"];
                        ?>
"  onClick="return CentralSpaceLoad(this,true);" target="main">&gt;&nbsp;<?php 
                        echo $lang["share"];
                        ?>
</a><?php 
                    }
                    ?>

                <?php 
                    if (checkperm("h")) {
                        ?>
&nbsp;<a href="collection_edit.php?ref=<?php 
                        echo $getthemes[$m]["ref"];
                        ?>
" onClick="return CentralSpaceLoad(this,true);">&gt;&nbsp;<?php 
                        echo $lang["action-edit"];
                        ?>
</a><?php 
                    }
                    ?>

                <?php 
                    hook("addcustomtool", "", array($getthemes[$m]["ref"]));
                    ?>
			<?php 
                }
                ?>
			</td>
			</tr>
			<?php 
            }
            ?>
		</table>
		</div>

		</div>
		<div class="PanelShadow"> </div>
		</div>
		<?php 
        }
    }