From 00f87f9793c26983cb7ed37b2c0b9f2ceae79666 Mon Sep 17 00:00:00 2001
From: skodak <skodak>
Date: Sun, 25 May 2008 15:34:19 +0000
Subject: [PATCH] MDL-14983  add magic quotes stripping option into
 data_submitted()

---
 lib/weblib.php | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/lib/weblib.php b/lib/weblib.php
index f88e0341c2..621f40ace3 100644
--- a/lib/weblib.php
+++ b/lib/weblib.php
@@ -449,15 +449,20 @@ class moodle_url {
  *
  * Checks that submitted POST data exists and returns it as object.
  *
- * @param string $url not used anymore
+ * @param bool slashes TEMPORARY - false if strip magic quotes
  * @return mixed false or object
  */
-function data_submitted($url='') {
+function data_submitted($slashes=true) {
 
     if (empty($_POST)) {
         return false;
     } else {
-        return (object)$_POST;
+        if ($slashes===false) {
+            $post = stripslashes_recursive($_POST); // temporary hack before magic quotes removal
+            return (object)$post;
+        } else {
+            return (object)$_POST;
+        }
     }
 }
 
-- 
2.39.5