From 52662920df12a4678e20755a024ac6f6905db8c3 Mon Sep 17 00:00:00 2001 From: Francisco Benza Date: Mon, 2 Jun 2014 11:20:52 -0400 Subject: [PATCH] Magic quotes may be ON so we need to stripslashes in that case. --- plugins/restapi.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/plugins/restapi.php b/plugins/restapi.php index 8f2fcfd..1d8b297 100644 --- a/plugins/restapi.php +++ b/plugins/restapi.php @@ -14,6 +14,23 @@ class restapi extends phplistPlugin { function restapi() { parent::phplistplugin(); $this->coderoot = dirname(__FILE__) . '/restapi/'; + // Need to find a better time to strip slashes. This is already done for the web interface in storemessage.php + // recursively strip slashes from an array + function stripslashes_r($array) { + foreach ($array as $key => $value) { + $array[$key] = is_array($value) ? + stripslashes_r($value) : + stripslashes($value); + } + return $array; + } + + if (get_magic_quotes_gpc()) { + $_GET = stripslashes_r($_GET); + $_POST = stripslashes_r($_POST); + $_COOKIE = stripslashes_r($_COOKIE); + $_REQUEST = stripslashes_r($_REQUEST); + } } function adminmenu() {