global $USER, $DB; if (!$this->can_annotate($annotation->url)) { $this->httpError(403, 'Forbidden', 'User lacks permission to annotate.'); return False; } else { $DB->delete_records(AN_DBTABLE, array('id' => $annotation->id)); $DB->delete_records(AN_READ_TABLE, array('annotationid' => $annotation->id)); if ($this->extService) { $extService = $this->extService; $extService->deleteAnnotation($annotation->id); } $moodlemia = moodle_marginalia::get_instance(); $logurl = "annotate.php?id=" . $annotation->id; $moodlemia->moodle_log('delete', $logurl, $annotation->id); return True; } } function listBodyParams() { return MarginaliaHelper::ListBodyParams(true); } } // Load up the logger, if available $logblock = $DB->get_record('block', array('name' => 'marginalia_log')); $logger = null; if ($logblock) { require_once $CFG->dirroot . '/blocks/marginalia_log/lib.php'; $logger = new marginalia_log(); } $service = new moodle_annotation_service(isguestuser() ? null : $USER->id, $logger && $logger->is_active() ? $logger : null); $service->dispatch();
* GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * $Id$ */ require_once "../../config.php"; require_once 'moodle_marginalia.php'; global $USER, $DB; $logblock = $DB->get_record('block', array('name' => 'marginalia_log')); $logger = null; if ($logblock) { require_once $CFG->dirroot . '/blocks/marginalia_log/lib.php'; $logger = new marginalia_log(); } $url = $_SERVER['REQUEST_URI']; $prefname = array_key_exists('name', $_GET) ? $_GET['name'] : null; switch ($_SERVER['REQUEST_METHOD']) { case 'GET': $value = get_user_preferences($prefname, null); header('Content-type: application/xml'); // should be utf-8 echo "<?xml version='1.0'?>\n"; echo "<preferences>\n"; if (null !== $value) { echo " <setting url='{$url}' name='" . htmlspecialchars($prefname) . "'>" . htmlspecialchars($value) . "</setting>\n"; } else { echo " <setting url='{$url}' name='" . htmlspecialchars($prefname) . "'/>\n"; }