]> source.dussan.org Git - nextcloud-server.git/commitdiff
Streamline CSRF and login check
authorLukas Reschke <lukas@owncloud.com>
Tue, 20 Jan 2015 11:24:13 +0000 (12:24 +0100)
committerLukas Reschke <lukas@owncloud.com>
Tue, 20 Jan 2015 11:24:13 +0000 (12:24 +0100)
Let's make this consistent with other pieces of the code to make it easier to auditable.

apps/files/ajax/newfile.php

index 0eb144aca56e90bc6b5e9ef5194a5be24e63f466..159a8b5d7a305c8df6e1922a0dc61b0cc86b186f 100644 (file)
@@ -3,9 +3,8 @@
 // Init owncloud
 global $eventSource;
 
-if(!OC_User::isLoggedIn()) {
-       exit;
-}
+\OCP\JSON::checkLoggedIn();
+\OCP\JSON::callCheck();
 
 \OC::$server->getSession()->close();
 
@@ -17,8 +16,6 @@ $source = isset( $_REQUEST['source'] ) ? trim($_REQUEST['source'], '/\\') : '';
 
 if($source) {
        $eventSource = \OC::$server->createEventSource();
-} else {
-       OC_JSON::callCheck();
 }
 
 function progress($notification_code, $severity, $message, $message_code, $bytes_transferred, $bytes_max) {
@@ -138,7 +135,7 @@ if($source) {
                                }
                        }
                }
-               $result=\OC\Files\Filesystem::file_put_contents($target, $sourceStream);
+               $result = \OC\Files\Filesystem::file_put_contents($target, $sourceStream);
        }
        if($result) {
                $meta = \OC\Files\Filesystem::getFileInfo($target);