diff options
author | Thomas Tanghus <thomas@tanghus.net> | 2012-07-20 20:15:00 +0200 |
---|---|---|
committer | Thomas Tanghus <thomas@tanghus.net> | 2012-07-20 20:15:39 +0200 |
commit | 10337c059c7eb822944973b6febe8234cbbbca3e (patch) | |
tree | eb20658c3ed76a0b1d9aeba67f7c655d37e3493e /lib/public/json.php | |
parent | d393638cc89d029ce07688c98ee4a16161f8d8ab (diff) | |
download | nextcloud-server-10337c059c7eb822944973b6febe8234cbbbca3e.tar.gz nextcloud-server-10337c059c7eb822944973b6febe8234cbbbca3e.zip |
Added some documentation for OCP\JSON::callCheck()
Diffstat (limited to 'lib/public/json.php')
-rw-r--r-- | lib/public/json.php | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/public/json.php b/lib/public/json.php index 1bc1e3ab4d5..19c563ed83f 100644 --- a/lib/public/json.php +++ b/lib/public/json.php @@ -55,6 +55,21 @@ class JSON { /** * @brief Check an ajax get/post call if the request token is valid. + * + * This method checks for a valid variable 'requesttoken' in $_GET, + * $_POST and $_SERVER. If a valid token is not found, an json error + * response will be return and the method will exit from execution + * of the script. + * The returned json will be in the format: + * + * {"status":"error","data":{"message":"Token expired. Please reload page."}} + * + * Add this call to the start of all ajax method files that creates, + * updates or deletes anything. + * In cases where you e.g. use an ajax call to load a dialog containing + * a submittable form, you will need to add the requesttoken first as a + * parameter to the ajax call, then assign it to the template and finally + * add a hidden input field also named 'requesttoken' containing the value. * @return json Error msg if not valid. */ public static function callCheck(){ |