|
|
|
|
@ -1127,7 +1127,6 @@ class OC_Util { |
|
|
|
|
* Creates a 'request token' (random) and stores it inside the session. |
|
|
|
|
* Ever subsequent (ajax) request must use such a valid token to succeed, |
|
|
|
|
* otherwise the request will be denied as a protection against CSRF. |
|
|
|
|
* @see OC_Util::isCallRegistered() |
|
|
|
|
*/ |
|
|
|
|
public static function callRegister() { |
|
|
|
|
// Use existing token if function has already been called |
|
|
|
|
@ -1154,27 +1153,6 @@ class OC_Util { |
|
|
|
|
return self::$obfuscatedToken; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Check an ajax get/post call if the request token is valid. |
|
|
|
|
* |
|
|
|
|
* @return boolean False if request token is not set or is invalid. |
|
|
|
|
* @see OC_Util::callRegister() |
|
|
|
|
*/ |
|
|
|
|
public static function isCallRegistered() { |
|
|
|
|
return \OC::$server->getRequest()->passesCSRFCheck(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Check an ajax get/post call if the request token is valid. Exit if not. |
|
|
|
|
* |
|
|
|
|
* @return void |
|
|
|
|
*/ |
|
|
|
|
public static function callCheck() { |
|
|
|
|
if (!OC_Util::isCallRegistered()) { |
|
|
|
|
exit(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Public function to sanitize HTML |
|
|
|
|
* |
|
|
|
|
|