root/releases/0.9rc1/mod/widget/ajax_delete_widget.php

Revision 1053, 0.8 kB (checked in by ben, 2 years ago)

Fixed a notice issue with the $result variable; it is now initialised on first assignation.

Line 
1 <?php
2
3 // Load Elgg framework
4 @require_once("../../includes.php");
5
6 $id = optional_param('id',0,PARAM_INT);
7
8 if (isloggedin()) {
9     if ($widget = get_record('widgets','ident',$id)) {
10         
11         // Page owner = where the widget resides
12         $page_owner = $widget->owner;
13         
14         // Do we have permission to touch this?
15         // If so, wipe it!
16         if (run("permissions:check","profile")) {
17             
18             widget_destroy($widget->ident);
19             widget_reorder($page_owner,$widget->location,$widget->location_id,$widget->column);
20             
21         }
22     }
23 }
24
25 $result = '<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>';
26 $result .= '<answer>';
27 $result .= '<wid>'.$id.'</wid>';
28 $result .= '</answer>';
29 header('Content-Type: application/xml');
30 print $result;
31 ?>
Note: See TracBrowser for help on using the browser.