function get_managed_dash()
{
    global $baseurl, $baseurl_short, $lang, $anonymous_login, $username, $dash_tile_shadows, $anonymous_default_dash, $userref;
    #Build Tile Templates
    if (checkPermission_anonymoususer() && !$anonymous_default_dash) {
        // Anonymous user but may have had dash customised dash configured first
        $tiles = sql_query("SELECT dash_tile.ref AS 'tile',dash_tile.title,dash_tile.url,dash_tile.reload_interval_secs,dash_tile.link,dash_tile.default_order_by as 'order_by'\n                       FROM user_dash_tile\n                            JOIN dash_tile\n                            ON user_dash_tile.dash_tile = dash_tile.ref\n                            WHERE user_dash_tile.user='******'\n                            ORDER BY user_dash_tile.order_by");
    } else {
        $tiles = sql_query("SELECT dash_tile.ref AS 'tile',dash_tile.title,dash_tile.url,dash_tile.reload_interval_secs,dash_tile.link,dash_tile.default_order_by as 'order_by'\n                       FROM dash_tile\n                       WHERE dash_tile.all_users=1\n                       AND (dash_tile.allow_delete=1\n                       OR (dash_tile.allow_delete=0\n                       AND dash_tile.ref IN (SELECT DISTINCT user_dash_tile.dash_tile FROM user_dash_tile)))\n                       ORDER BY default_order_by");
    }
    foreach ($tiles as $tile) {
        ?>
		<a 
			<?php 
        # Check link for external or internal
        if (mb_strtolower(substr($tile["link"], 0, 4)) == "http") {
            $link = $tile["link"];
            $newtab = true;
        } else {
            $link = $baseurl . "/" . htmlspecialchars($tile["link"]);
            $newtab = false;
        }
        ?>
			href="<?php 
        echo $link;
        ?>
" <?php 
        echo $newtab ? "target='_blank'" : "";
        ?>
			onClick="if(dragging){dragging=false;e.defaultPrevented;}" 
			class="HomePanel DashTile DashTileDraggable" 
			id="tile<?php 
        echo htmlspecialchars($tile["tile"]);
        ?>
"
		>
			<div id="contents_tile<?php 
        echo htmlspecialchars($tile["tile"]);
        ?>
" class="HomePanelIN HomePanelDynamicDash <?php 
        echo $dash_tile_shadows ? "TileContentShadow" : "";
        ?>
">
				<?php 
        if (strpos($tile["url"], "dash_tile.php") !== false) {
            # Only pre-render the title if using a "standard" tile and therefore we know the H2 will be in the target data.
            ?>
                    <h2 class="title"><?php 
            echo htmlspecialchars($tile["title"]);
            ?>
</h2>
                    <?php 
        }
        ?>
				<p>Loading...</p>
				<script>
					height = jQuery("#contents_tile<?php 
        echo htmlspecialchars($tile["tile"]);
        ?>
").height();
					width = jQuery("#contents_tile<?php 
        echo htmlspecialchars($tile["tile"]);
        ?>
").width();
					jQuery("#contents_tile<?php 
        echo htmlspecialchars($tile["tile"]);
        ?>
").load("<?php 
        echo $baseurl . "/" . $tile["url"] . "&tile=" . htmlspecialchars($tile["tile"]);
        ?>
&tlwidth="+width+"&tlheight="+height);
				</script>
			</div>
		</a>
		<?php 
    }
    ?>
	<div class="clearerleft"></div>
	<?php 
}
예제 #2
0
function checkPermission_dashcreate()
{
    #Home_dash is on, And not Anonymous use, And (Dash tile user (Not with a managed dash) || Dash Tile Admin)
    global $managed_home_dash, $unmanaged_home_dash_admins;
    return !checkPermission_anonymoususer() && (!$managed_home_dash && (checkPermission_dashuser() || checkPermission_dashadmin()) || $managed_home_dash && checkPermission_dashadmin() || $unmanaged_home_dash_admins && checkPermission_dashadmin());
}