if (!hook("replace_dash_admin_permission_relocate")) { if (!($home_dash && checkPermission_dashmanage())) { header("location: " . $baseurl_short . "pages/user/user_home.php"); exit; } } if (getvalescaped("quicksave", FALSE)) { $tile = getvalescaped("tile", ""); #If a valid tile value supplied if (!empty($tile) && is_numeric($tile)) { #Tile available to this user? $available = get_user_available_tiles($userref, $tile); if (!empty($available)) { $tile = $available[0]["tile"]; $usertile = $available[0]["usertile"]; if (get_user_tile($usertile, $userref)) { #Delete if the user already has the tile delete_user_dash_tile($usertile, $userref); $dtiles_available = get_user_available_tiles($userref); exit("negativeglow"); } else { #Add to the front of the pile if the user already has the tile add_user_dash_tile($userref, $tile, 5); $dtiles_available = get_user_available_tiles($userref); exit("positiveglow"); } } } exit("Save Failed"); } if (getvalescaped("submit", FALSE)) {
function delete_user_dash_tile($usertile, $user) { if (!is_numeric($usertile) || !is_numeric($user)) { return false; } $row = get_user_tile($usertile, $user); sql_query("DELETE FROM user_dash_tile WHERE ref='" . $usertile . "' and user='******'"); $existing = sql_query("SELECT count(*) as 'count' FROM user_dash_tile WHERE dash_tile='" . $row["dash_tile"] . "'"); if ($existing[0]["count"] < 1) { delete_dash_tile($row["dash_tile"]); } }
if (isset($rawtile) && !empty($rawtile)) { if (!is_numeric($rawtile)) { exit($lang["invaliddashtile"]); } $tile = get_tile($rawtile); if (!$tile) { exit($lang["nodashtilefound"]); } } /* User Tile */ $user_rawtile = getvalescaped("user_tile", null, TRUE); if (isset($user_rawtile) && !empty($user_rawtile)) { if (!is_numeric($user_rawtile)) { exit($lang["invaliddashtile"]); } $usertile = get_user_tile($user_rawtile, $userref); if (!$usertile) { exit($lang["nodashtilefound"]); } } /* * Reorder Tile */ $index = getvalescaped("new_index", "", TRUE); if (!empty($index) && isset($usertile)) { if ($index > $usertile["order_by"]) { $index += 5; } else { $index -= 5; } update_user_dash_tile_order($userref, $usertile["ref"], $index);