blog file-embed dropdown: made unicode-friendly, prevented adding of folders, and...
[elgg.git] / mod / adash / move.php
blobac682b30c7972cf37acc4665be8009891aa4c918
1 <?php
3 /*
5 Elgg Dashboard
6 http://elgg.org/
8 */
10 // Load Elgg framework
11 @require_once("../../includes.php");
13 // We need to be logged on for this!
15 if (isloggedin()) {
17 // Define context
18 define("context","dashboard");
20 // Load global variables
21 global $CFG, $PAGE, $db, $page_owner, $messages;
23 // Get widget details
24 $ident = optional_param('widget',PARAM_INT,0);
25 $ident = $db->qstr($ident);
26 $widget = get_record_sql("select * from ".$CFG->prefix."dashboard_widgets where ident = $ident");
28 // Get moving instructions
29 $move = optional_param('move');
31 // Page owner = where the widget resides
32 $page_owner = $widget->owner;
34 // Do we have permission to touch this?
35 // If so, move it
36 if (run("permissions:check","profile")) {
38 if ($move == "up") {
39 adash_widget_moveup($widget);
40 } else if ($move == "down") {
41 adash_widget_movedown($widget);
46 // Get the username of the widget owner
47 $username = user_info("username",$widget->owner);
49 // Add a message
50 $messages[] = __gettext("Widget moved.");
51 $_SESSION['messages'] = $messages;
53 // Redirect back to the dashboard
54 header("Location: " . $CFG->wwwroot . $username . "/dashboard/");
55 exit;