Passed
Push — master ( 330b88...1c3050 )
by John
16:03 queued 19s
created
apps/encryption/lib/Controller/SettingsController.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -128,7 +128,7 @@
 block discarded – undo
128 128
 				$encryptedKey = $this->crypt->encryptPrivateKey($decryptedKey, $newPassword, $uid);
129 129
 				$header = $this->crypt->generateHeader();
130 130
 				if ($encryptedKey) {
131
-					$this->keyManager->setPrivateKey($uid, $header . $encryptedKey);
131
+					$this->keyManager->setPrivateKey($uid, $header.$encryptedKey);
132 132
 					$this->session->setPrivateKey($decryptedKey);
133 133
 					$result = true;
134 134
 				}
Please login to merge, or discard this patch.
Indentation   +123 added lines, -123 removed lines patch added patch discarded remove patch
@@ -38,128 +38,128 @@
 block discarded – undo
38 38
 
39 39
 class SettingsController extends Controller {
40 40
 
41
-	/** @var IL10N */
42
-	private $l;
43
-
44
-	/** @var IUserManager */
45
-	private $userManager;
46
-
47
-	/** @var IUserSession */
48
-	private $userSession;
49
-
50
-	/** @var KeyManager */
51
-	private $keyManager;
52
-
53
-	/** @var Crypt */
54
-	private $crypt;
55
-
56
-	/** @var Session */
57
-	private $session;
58
-
59
-	/** @var ISession  */
60
-	private $ocSession;
61
-
62
-	/** @var  Util */
63
-	private $util;
64
-
65
-	/**
66
-	 * @param string $AppName
67
-	 * @param IRequest $request
68
-	 * @param IL10N $l10n
69
-	 * @param IUserManager $userManager
70
-	 * @param IUserSession $userSession
71
-	 * @param KeyManager $keyManager
72
-	 * @param Crypt $crypt
73
-	 * @param Session $session
74
-	 * @param ISession $ocSession
75
-	 * @param Util $util
76
-	 */
77
-	public function __construct($AppName,
78
-								IRequest $request,
79
-								IL10N $l10n,
80
-								IUserManager $userManager,
81
-								IUserSession $userSession,
82
-								KeyManager $keyManager,
83
-								Crypt $crypt,
84
-								Session $session,
85
-								ISession $ocSession,
86
-								Util $util
41
+    /** @var IL10N */
42
+    private $l;
43
+
44
+    /** @var IUserManager */
45
+    private $userManager;
46
+
47
+    /** @var IUserSession */
48
+    private $userSession;
49
+
50
+    /** @var KeyManager */
51
+    private $keyManager;
52
+
53
+    /** @var Crypt */
54
+    private $crypt;
55
+
56
+    /** @var Session */
57
+    private $session;
58
+
59
+    /** @var ISession  */
60
+    private $ocSession;
61
+
62
+    /** @var  Util */
63
+    private $util;
64
+
65
+    /**
66
+     * @param string $AppName
67
+     * @param IRequest $request
68
+     * @param IL10N $l10n
69
+     * @param IUserManager $userManager
70
+     * @param IUserSession $userSession
71
+     * @param KeyManager $keyManager
72
+     * @param Crypt $crypt
73
+     * @param Session $session
74
+     * @param ISession $ocSession
75
+     * @param Util $util
76
+     */
77
+    public function __construct($AppName,
78
+                                IRequest $request,
79
+                                IL10N $l10n,
80
+                                IUserManager $userManager,
81
+                                IUserSession $userSession,
82
+                                KeyManager $keyManager,
83
+                                Crypt $crypt,
84
+                                Session $session,
85
+                                ISession $ocSession,
86
+                                Util $util
87 87
 ) {
88
-		parent::__construct($AppName, $request);
89
-		$this->l = $l10n;
90
-		$this->userSession = $userSession;
91
-		$this->userManager = $userManager;
92
-		$this->keyManager = $keyManager;
93
-		$this->crypt = $crypt;
94
-		$this->session = $session;
95
-		$this->ocSession = $ocSession;
96
-		$this->util = $util;
97
-	}
98
-
99
-
100
-	/**
101
-	 * @NoAdminRequired
102
-	 * @UseSession
103
-	 *
104
-	 * @param string $oldPassword
105
-	 * @param string $newPassword
106
-	 * @return DataResponse
107
-	 */
108
-	public function updatePrivateKeyPassword($oldPassword, $newPassword) {
109
-		$result = false;
110
-		$uid = $this->userSession->getUser()->getUID();
111
-		$errorMessage = $this->l->t('Could not update the private key password.');
112
-
113
-		//check if password is correct
114
-		$passwordCorrect = $this->userManager->checkPassword($uid, $newPassword);
115
-		if ($passwordCorrect === false) {
116
-			// if check with uid fails we need to check the password with the login name
117
-			// e.g. in the ldap case. For local user we need to check the password with
118
-			// the uid because in this case the login name is case insensitive
119
-			$loginName = $this->ocSession->get('loginname');
120
-			$passwordCorrect = $this->userManager->checkPassword($loginName, $newPassword);
121
-		}
122
-
123
-		if ($passwordCorrect !== false) {
124
-			$encryptedKey = $this->keyManager->getPrivateKey($uid);
125
-			$decryptedKey = $this->crypt->decryptPrivateKey($encryptedKey, $oldPassword, $uid);
126
-
127
-			if ($decryptedKey) {
128
-				$encryptedKey = $this->crypt->encryptPrivateKey($decryptedKey, $newPassword, $uid);
129
-				$header = $this->crypt->generateHeader();
130
-				if ($encryptedKey) {
131
-					$this->keyManager->setPrivateKey($uid, $header . $encryptedKey);
132
-					$this->session->setPrivateKey($decryptedKey);
133
-					$result = true;
134
-				}
135
-			} else {
136
-				$errorMessage = $this->l->t('The old password was not correct, please try again.');
137
-			}
138
-		} else {
139
-			$errorMessage = $this->l->t('The current log-in password was not correct, please try again.');
140
-		}
141
-
142
-		if ($result === true) {
143
-			$this->session->setStatus(Session::INIT_SUCCESSFUL);
144
-			return new DataResponse(
145
-				['message' => $this->l->t('Private key password successfully updated.')]
146
-			);
147
-		} else {
148
-			return new DataResponse(
149
-				['message' => $errorMessage],
150
-				Http::STATUS_BAD_REQUEST
151
-			);
152
-		}
153
-	}
154
-
155
-	/**
156
-	 * @UseSession
157
-	 *
158
-	 * @param bool $encryptHomeStorage
159
-	 * @return DataResponse
160
-	 */
161
-	public function setEncryptHomeStorage($encryptHomeStorage) {
162
-		$this->util->setEncryptHomeStorage($encryptHomeStorage);
163
-		return new DataResponse();
164
-	}
88
+        parent::__construct($AppName, $request);
89
+        $this->l = $l10n;
90
+        $this->userSession = $userSession;
91
+        $this->userManager = $userManager;
92
+        $this->keyManager = $keyManager;
93
+        $this->crypt = $crypt;
94
+        $this->session = $session;
95
+        $this->ocSession = $ocSession;
96
+        $this->util = $util;
97
+    }
98
+
99
+
100
+    /**
101
+     * @NoAdminRequired
102
+     * @UseSession
103
+     *
104
+     * @param string $oldPassword
105
+     * @param string $newPassword
106
+     * @return DataResponse
107
+     */
108
+    public function updatePrivateKeyPassword($oldPassword, $newPassword) {
109
+        $result = false;
110
+        $uid = $this->userSession->getUser()->getUID();
111
+        $errorMessage = $this->l->t('Could not update the private key password.');
112
+
113
+        //check if password is correct
114
+        $passwordCorrect = $this->userManager->checkPassword($uid, $newPassword);
115
+        if ($passwordCorrect === false) {
116
+            // if check with uid fails we need to check the password with the login name
117
+            // e.g. in the ldap case. For local user we need to check the password with
118
+            // the uid because in this case the login name is case insensitive
119
+            $loginName = $this->ocSession->get('loginname');
120
+            $passwordCorrect = $this->userManager->checkPassword($loginName, $newPassword);
121
+        }
122
+
123
+        if ($passwordCorrect !== false) {
124
+            $encryptedKey = $this->keyManager->getPrivateKey($uid);
125
+            $decryptedKey = $this->crypt->decryptPrivateKey($encryptedKey, $oldPassword, $uid);
126
+
127
+            if ($decryptedKey) {
128
+                $encryptedKey = $this->crypt->encryptPrivateKey($decryptedKey, $newPassword, $uid);
129
+                $header = $this->crypt->generateHeader();
130
+                if ($encryptedKey) {
131
+                    $this->keyManager->setPrivateKey($uid, $header . $encryptedKey);
132
+                    $this->session->setPrivateKey($decryptedKey);
133
+                    $result = true;
134
+                }
135
+            } else {
136
+                $errorMessage = $this->l->t('The old password was not correct, please try again.');
137
+            }
138
+        } else {
139
+            $errorMessage = $this->l->t('The current log-in password was not correct, please try again.');
140
+        }
141
+
142
+        if ($result === true) {
143
+            $this->session->setStatus(Session::INIT_SUCCESSFUL);
144
+            return new DataResponse(
145
+                ['message' => $this->l->t('Private key password successfully updated.')]
146
+            );
147
+        } else {
148
+            return new DataResponse(
149
+                ['message' => $errorMessage],
150
+                Http::STATUS_BAD_REQUEST
151
+            );
152
+        }
153
+    }
154
+
155
+    /**
156
+     * @UseSession
157
+     *
158
+     * @param bool $encryptHomeStorage
159
+     * @return DataResponse
160
+     */
161
+    public function setEncryptHomeStorage($encryptHomeStorage) {
162
+        $this->util->setEncryptHomeStorage($encryptHomeStorage);
163
+        return new DataResponse();
164
+    }
165 165
 }
Please login to merge, or discard this patch.
apps/comments/lib/Activity/Setting.php 1 patch
Indentation   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -27,72 +27,72 @@
 block discarded – undo
27 27
 
28 28
 class Setting implements ISetting {
29 29
 
30
-	/** @var IL10N */
31
-	protected $l;
30
+    /** @var IL10N */
31
+    protected $l;
32 32
 
33
-	/**
34
-	 * @param IL10N $l
35
-	 */
36
-	public function __construct(IL10N $l) {
37
-		$this->l = $l;
38
-	}
33
+    /**
34
+     * @param IL10N $l
35
+     */
36
+    public function __construct(IL10N $l) {
37
+        $this->l = $l;
38
+    }
39 39
 
40
-	/**
41
-	 * @return string Lowercase a-z and underscore only identifier
42
-	 * @since 11.0.0
43
-	 */
44
-	public function getIdentifier() {
45
-		return 'comments';
46
-	}
40
+    /**
41
+     * @return string Lowercase a-z and underscore only identifier
42
+     * @since 11.0.0
43
+     */
44
+    public function getIdentifier() {
45
+        return 'comments';
46
+    }
47 47
 
48
-	/**
49
-	 * @return string A translated string
50
-	 * @since 11.0.0
51
-	 */
52
-	public function getName() {
53
-		return $this->l->t('<strong>Comments</strong> for files');
54
-	}
48
+    /**
49
+     * @return string A translated string
50
+     * @since 11.0.0
51
+     */
52
+    public function getName() {
53
+        return $this->l->t('<strong>Comments</strong> for files');
54
+    }
55 55
 
56
-	/**
57
-	 * @return int whether the filter should be rather on the top or bottom of
58
-	 * the admin section. The filters are arranged in ascending order of the
59
-	 * priority values. It is required to return a value between 0 and 100.
60
-	 * @since 11.0.0
61
-	 */
62
-	public function getPriority() {
63
-		return 50;
64
-	}
56
+    /**
57
+     * @return int whether the filter should be rather on the top or bottom of
58
+     * the admin section. The filters are arranged in ascending order of the
59
+     * priority values. It is required to return a value between 0 and 100.
60
+     * @since 11.0.0
61
+     */
62
+    public function getPriority() {
63
+        return 50;
64
+    }
65 65
 
66
-	/**
67
-	 * @return bool True when the option can be changed for the stream
68
-	 * @since 11.0.0
69
-	 */
70
-	public function canChangeStream() {
71
-		return true;
72
-	}
66
+    /**
67
+     * @return bool True when the option can be changed for the stream
68
+     * @since 11.0.0
69
+     */
70
+    public function canChangeStream() {
71
+        return true;
72
+    }
73 73
 
74
-	/**
75
-	 * @return bool True when the option can be changed for the stream
76
-	 * @since 11.0.0
77
-	 */
78
-	public function isDefaultEnabledStream() {
79
-		return true;
80
-	}
74
+    /**
75
+     * @return bool True when the option can be changed for the stream
76
+     * @since 11.0.0
77
+     */
78
+    public function isDefaultEnabledStream() {
79
+        return true;
80
+    }
81 81
 
82
-	/**
83
-	 * @return bool True when the option can be changed for the mail
84
-	 * @since 11.0.0
85
-	 */
86
-	public function canChangeMail() {
87
-		return true;
88
-	}
82
+    /**
83
+     * @return bool True when the option can be changed for the mail
84
+     * @since 11.0.0
85
+     */
86
+    public function canChangeMail() {
87
+        return true;
88
+    }
89 89
 
90
-	/**
91
-	 * @return bool True when the option can be changed for the stream
92
-	 * @since 11.0.0
93
-	 */
94
-	public function isDefaultEnabledMail() {
95
-		return false;
96
-	}
90
+    /**
91
+     * @return bool True when the option can be changed for the stream
92
+     * @since 11.0.0
93
+     */
94
+    public function isDefaultEnabledMail() {
95
+        return false;
96
+    }
97 97
 }
98 98
 
Please login to merge, or discard this patch.
apps/comments/lib/Activity/Filter.php 1 patch
Indentation   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -28,63 +28,63 @@
 block discarded – undo
28 28
 
29 29
 class Filter implements IFilter {
30 30
 
31
-	/** @var IL10N */
32
-	protected $l;
31
+    /** @var IL10N */
32
+    protected $l;
33 33
 
34
-	/** @var IURLGenerator */
35
-	protected $url;
34
+    /** @var IURLGenerator */
35
+    protected $url;
36 36
 
37
-	public function __construct(IL10N $l, IURLGenerator $url) {
38
-		$this->l = $l;
39
-		$this->url = $url;
40
-	}
37
+    public function __construct(IL10N $l, IURLGenerator $url) {
38
+        $this->l = $l;
39
+        $this->url = $url;
40
+    }
41 41
 
42
-	/**
43
-	 * @return string Lowercase a-z only identifier
44
-	 * @since 11.0.0
45
-	 */
46
-	public function getIdentifier() {
47
-		return 'comments';
48
-	}
42
+    /**
43
+     * @return string Lowercase a-z only identifier
44
+     * @since 11.0.0
45
+     */
46
+    public function getIdentifier() {
47
+        return 'comments';
48
+    }
49 49
 
50
-	/**
51
-	 * @return string A translated string
52
-	 * @since 11.0.0
53
-	 */
54
-	public function getName() {
55
-		return $this->l->t('Comments');
56
-	}
50
+    /**
51
+     * @return string A translated string
52
+     * @since 11.0.0
53
+     */
54
+    public function getName() {
55
+        return $this->l->t('Comments');
56
+    }
57 57
 
58
-	/**
59
-	 * @return int
60
-	 * @since 11.0.0
61
-	 */
62
-	public function getPriority() {
63
-		return 40;
64
-	}
58
+    /**
59
+     * @return int
60
+     * @since 11.0.0
61
+     */
62
+    public function getPriority() {
63
+        return 40;
64
+    }
65 65
 
66
-	/**
67
-	 * @return string Full URL to an icon, empty string when none is given
68
-	 * @since 11.0.0
69
-	 */
70
-	public function getIcon() {
71
-		return $this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/comment.svg'));
72
-	}
66
+    /**
67
+     * @return string Full URL to an icon, empty string when none is given
68
+     * @since 11.0.0
69
+     */
70
+    public function getIcon() {
71
+        return $this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/comment.svg'));
72
+    }
73 73
 
74
-	/**
75
-	 * @param string[] $types
76
-	 * @return string[] An array of allowed apps from which activities should be displayed
77
-	 * @since 11.0.0
78
-	 */
79
-	public function filterTypes(array $types) {
80
-		return $types;
81
-	}
74
+    /**
75
+     * @param string[] $types
76
+     * @return string[] An array of allowed apps from which activities should be displayed
77
+     * @since 11.0.0
78
+     */
79
+    public function filterTypes(array $types) {
80
+        return $types;
81
+    }
82 82
 
83
-	/**
84
-	 * @return string[] An array of allowed apps from which activities should be displayed
85
-	 * @since 11.0.0
86
-	 */
87
-	public function allowedApps() {
88
-		return ['comments'];
89
-	}
83
+    /**
84
+     * @return string[] An array of allowed apps from which activities should be displayed
85
+     * @since 11.0.0
86
+     */
87
+    public function allowedApps() {
88
+        return ['comments'];
89
+    }
90 90
 }
Please login to merge, or discard this patch.
apps/files_trashbin/lib/Command/CleanUp.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -107,8 +107,8 @@
 block discarded – undo
107 107
 	protected function removeDeletedFiles($uid) {
108 108
 		\OC_Util::tearDownFS();
109 109
 		\OC_Util::setupFS($uid);
110
-		if ($this->rootFolder->nodeExists('/' . $uid . '/files_trashbin')) {
111
-			$this->rootFolder->get('/' . $uid . '/files_trashbin')->delete();
110
+		if ($this->rootFolder->nodeExists('/'.$uid.'/files_trashbin')) {
111
+			$this->rootFolder->get('/'.$uid.'/files_trashbin')->delete();
112 112
 			$query = $this->dbConnection->getQueryBuilder();
113 113
 			$query->delete('files_trash')
114 114
 				->where($query->expr()->eq('user', $query->createParameter('uid')))
Please login to merge, or discard this patch.
Indentation   +88 added lines, -88 removed lines patch added patch discarded remove patch
@@ -39,98 +39,98 @@
 block discarded – undo
39 39
 
40 40
 class CleanUp extends Command {
41 41
 
42
-	/** @var IUserManager */
43
-	protected $userManager;
42
+    /** @var IUserManager */
43
+    protected $userManager;
44 44
 
45
-	/** @var IRootFolder */
46
-	protected $rootFolder;
45
+    /** @var IRootFolder */
46
+    protected $rootFolder;
47 47
 
48
-	/** @var \OCP\IDBConnection */
49
-	protected $dbConnection;
48
+    /** @var \OCP\IDBConnection */
49
+    protected $dbConnection;
50 50
 
51
-	/**
52
-	 * @param IRootFolder $rootFolder
53
-	 * @param IUserManager $userManager
54
-	 * @param IDBConnection $dbConnection
55
-	 */
56
-	public function __construct(IRootFolder $rootFolder, IUserManager $userManager, IDBConnection $dbConnection) {
57
-		parent::__construct();
58
-		$this->userManager = $userManager;
59
-		$this->rootFolder = $rootFolder;
60
-		$this->dbConnection = $dbConnection;
61
-	}
51
+    /**
52
+     * @param IRootFolder $rootFolder
53
+     * @param IUserManager $userManager
54
+     * @param IDBConnection $dbConnection
55
+     */
56
+    public function __construct(IRootFolder $rootFolder, IUserManager $userManager, IDBConnection $dbConnection) {
57
+        parent::__construct();
58
+        $this->userManager = $userManager;
59
+        $this->rootFolder = $rootFolder;
60
+        $this->dbConnection = $dbConnection;
61
+    }
62 62
 
63
-	protected function configure() {
64
-		$this
65
-			->setName('trashbin:cleanup')
66
-			->setDescription('Remove deleted files')
67
-			->addArgument(
68
-				'user_id',
69
-				InputArgument::OPTIONAL | InputArgument::IS_ARRAY,
70
-				'remove deleted files of the given user(s)'
71
-			)
72
-			->addOption(
73
-				'all-users',
74
-				null,
75
-				InputOption::VALUE_NONE,
76
-				'run action on all users'
77
-			);
78
-	}
63
+    protected function configure() {
64
+        $this
65
+            ->setName('trashbin:cleanup')
66
+            ->setDescription('Remove deleted files')
67
+            ->addArgument(
68
+                'user_id',
69
+                InputArgument::OPTIONAL | InputArgument::IS_ARRAY,
70
+                'remove deleted files of the given user(s)'
71
+            )
72
+            ->addOption(
73
+                'all-users',
74
+                null,
75
+                InputOption::VALUE_NONE,
76
+                'run action on all users'
77
+            );
78
+    }
79 79
 
80
-	protected function execute(InputInterface $input, OutputInterface $output): int {
81
-		$users = $input->getArgument('user_id');
82
-		if ((!empty($users)) and ($input->getOption('all-users'))) {
83
-			throw new InvalidOptionException('Either specify a user_id or --all-users');
84
-		} elseif (!empty($users)) {
85
-			foreach ($users as $user) {
86
-				if ($this->userManager->userExists($user)) {
87
-					$output->writeln("Remove deleted files of   <info>$user</info>");
88
-					$this->removeDeletedFiles($user);
89
-				} else {
90
-					$output->writeln("<error>Unknown user $user</error>");
91
-					return 1;
92
-				}
93
-			}
94
-		} elseif ($input->getOption('all-users')) {
95
-			$output->writeln('Remove deleted files for all users');
96
-			foreach ($this->userManager->getBackends() as $backend) {
97
-				$name = get_class($backend);
98
-				if ($backend instanceof IUserBackend) {
99
-					$name = $backend->getBackendName();
100
-				}
101
-				$output->writeln("Remove deleted files for users on backend <info>$name</info>");
102
-				$limit = 500;
103
-				$offset = 0;
104
-				do {
105
-					$users = $backend->getUsers('', $limit, $offset);
106
-					foreach ($users as $user) {
107
-						$output->writeln("   <info>$user</info>");
108
-						$this->removeDeletedFiles($user);
109
-					}
110
-					$offset += $limit;
111
-				} while (count($users) >= $limit);
112
-			}
113
-		} else {
114
-			throw new InvalidOptionException('Either specify a user_id or --all-users');
115
-		}
116
-		return 0;
117
-	}
80
+    protected function execute(InputInterface $input, OutputInterface $output): int {
81
+        $users = $input->getArgument('user_id');
82
+        if ((!empty($users)) and ($input->getOption('all-users'))) {
83
+            throw new InvalidOptionException('Either specify a user_id or --all-users');
84
+        } elseif (!empty($users)) {
85
+            foreach ($users as $user) {
86
+                if ($this->userManager->userExists($user)) {
87
+                    $output->writeln("Remove deleted files of   <info>$user</info>");
88
+                    $this->removeDeletedFiles($user);
89
+                } else {
90
+                    $output->writeln("<error>Unknown user $user</error>");
91
+                    return 1;
92
+                }
93
+            }
94
+        } elseif ($input->getOption('all-users')) {
95
+            $output->writeln('Remove deleted files for all users');
96
+            foreach ($this->userManager->getBackends() as $backend) {
97
+                $name = get_class($backend);
98
+                if ($backend instanceof IUserBackend) {
99
+                    $name = $backend->getBackendName();
100
+                }
101
+                $output->writeln("Remove deleted files for users on backend <info>$name</info>");
102
+                $limit = 500;
103
+                $offset = 0;
104
+                do {
105
+                    $users = $backend->getUsers('', $limit, $offset);
106
+                    foreach ($users as $user) {
107
+                        $output->writeln("   <info>$user</info>");
108
+                        $this->removeDeletedFiles($user);
109
+                    }
110
+                    $offset += $limit;
111
+                } while (count($users) >= $limit);
112
+            }
113
+        } else {
114
+            throw new InvalidOptionException('Either specify a user_id or --all-users');
115
+        }
116
+        return 0;
117
+    }
118 118
 
119
-	/**
120
-	 * remove deleted files for the given user
121
-	 *
122
-	 * @param string $uid
123
-	 */
124
-	protected function removeDeletedFiles($uid) {
125
-		\OC_Util::tearDownFS();
126
-		\OC_Util::setupFS($uid);
127
-		if ($this->rootFolder->nodeExists('/' . $uid . '/files_trashbin')) {
128
-			$this->rootFolder->get('/' . $uid . '/files_trashbin')->delete();
129
-			$query = $this->dbConnection->getQueryBuilder();
130
-			$query->delete('files_trash')
131
-				->where($query->expr()->eq('user', $query->createParameter('uid')))
132
-				->setParameter('uid', $uid);
133
-			$query->execute();
134
-		}
135
-	}
119
+    /**
120
+     * remove deleted files for the given user
121
+     *
122
+     * @param string $uid
123
+     */
124
+    protected function removeDeletedFiles($uid) {
125
+        \OC_Util::tearDownFS();
126
+        \OC_Util::setupFS($uid);
127
+        if ($this->rootFolder->nodeExists('/' . $uid . '/files_trashbin')) {
128
+            $this->rootFolder->get('/' . $uid . '/files_trashbin')->delete();
129
+            $query = $this->dbConnection->getQueryBuilder();
130
+            $query->delete('files_trash')
131
+                ->where($query->expr()->eq('user', $query->createParameter('uid')))
132
+                ->setParameter('uid', $uid);
133
+            $query->execute();
134
+        }
135
+    }
136 136
 }
Please login to merge, or discard this patch.
apps/files_trashbin/lib/Capabilities.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -33,17 +33,17 @@
 block discarded – undo
33 33
  */
34 34
 class Capabilities implements ICapability {
35 35
 
36
-	/**
37
-	 * Return this classes capabilities
38
-	 *
39
-	 * @return array
40
-	 */
41
-	public function getCapabilities() {
42
-		return [
43
-			'files' => [
44
-				'undelete' => true
45
-			]
46
-		];
47
-	}
36
+    /**
37
+     * Return this classes capabilities
38
+     *
39
+     * @return array
40
+     */
41
+    public function getCapabilities() {
42
+        return [
43
+            'files' => [
44
+                'undelete' => true
45
+            ]
46
+        ];
47
+    }
48 48
 	
49 49
 }
Please login to merge, or discard this patch.
apps/workflowengine/lib/Check/RequestTime.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -109,8 +109,8 @@
 block discarded – undo
109 109
 			throw new \UnexpectedValueException($this->l->t('The given operator is invalid'), 1);
110 110
 		}
111 111
 
112
-		$regexValue = '\"' . self::REGEX_TIME . ' ' . self::REGEX_TIMEZONE . '\"';
113
-		$result = preg_match('/^\[' . $regexValue . ',' . $regexValue . '\]$/', $value, $matches);
112
+		$regexValue = '\"'.self::REGEX_TIME.' '.self::REGEX_TIMEZONE.'\"';
113
+		$result = preg_match('/^\['.$regexValue.','.$regexValue.'\]$/', $value, $matches);
114 114
 		if (!$result) {
115 115
 			throw new \UnexpectedValueException($this->l->t('The given time span is invalid'), 2);
116 116
 		}
Please login to merge, or discard this patch.
Indentation   +105 added lines, -105 removed lines patch added patch discarded remove patch
@@ -26,109 +26,109 @@
 block discarded – undo
26 26
 use OCP\WorkflowEngine\ICheck;
27 27
 
28 28
 class RequestTime implements ICheck {
29
-	public const REGEX_TIME = '([0-1][0-9]|2[0-3]):([0-5][0-9])';
30
-	public const REGEX_TIMEZONE = '([a-zA-Z]+(?:\\/[a-zA-Z\-\_]+)+)';
31
-
32
-	/** @var bool[] */
33
-	protected $cachedResults;
34
-
35
-	/** @var IL10N */
36
-	protected $l;
37
-
38
-	/** @var ITimeFactory */
39
-	protected $timeFactory;
40
-
41
-	/**
42
-	 * @param ITimeFactory $timeFactory
43
-	 */
44
-	public function __construct(IL10N $l, ITimeFactory $timeFactory) {
45
-		$this->l = $l;
46
-		$this->timeFactory = $timeFactory;
47
-	}
48
-
49
-	/**
50
-	 * @param string $operator
51
-	 * @param string $value
52
-	 * @return bool
53
-	 */
54
-	public function executeCheck($operator, $value) {
55
-		$valueHash = md5($value);
56
-
57
-		if (isset($this->cachedResults[$valueHash])) {
58
-			return $this->cachedResults[$valueHash];
59
-		}
60
-
61
-		$timestamp = $this->timeFactory->getTime();
62
-
63
-		$values = json_decode($value, true);
64
-		$timestamp1 = $this->getTimestamp($timestamp, $values[0]);
65
-		$timestamp2 = $this->getTimestamp($timestamp, $values[1]);
66
-
67
-		if ($timestamp1 < $timestamp2) {
68
-			$in = $timestamp1 <= $timestamp && $timestamp <= $timestamp2;
69
-		} else {
70
-			$in = $timestamp1 <= $timestamp || $timestamp <= $timestamp2;
71
-		}
72
-
73
-		return ($operator === 'in') ? $in : !$in;
74
-	}
75
-
76
-	/**
77
-	 * @param int $currentTimestamp
78
-	 * @param string $value Format: "H:i e"
79
-	 * @return int
80
-	 */
81
-	protected function getTimestamp($currentTimestamp, $value) {
82
-		[$time1, $timezone1] = explode(' ', $value);
83
-		[$hour1, $minute1] = explode(':', $time1);
84
-		$date1 = new \DateTime('now', new \DateTimeZone($timezone1));
85
-		$date1->setTimestamp($currentTimestamp);
86
-		$date1->setTime($hour1, $minute1);
87
-
88
-		return $date1->getTimestamp();
89
-	}
90
-
91
-	/**
92
-	 * @param string $operator
93
-	 * @param string $value
94
-	 * @throws \UnexpectedValueException
95
-	 */
96
-	public function validateCheck($operator, $value) {
97
-		if (!in_array($operator, ['in', '!in'])) {
98
-			throw new \UnexpectedValueException($this->l->t('The given operator is invalid'), 1);
99
-		}
100
-
101
-		$regexValue = '\"' . self::REGEX_TIME . ' ' . self::REGEX_TIMEZONE . '\"';
102
-		$result = preg_match('/^\[' . $regexValue . ',' . $regexValue . '\]$/', $value, $matches);
103
-		if (!$result) {
104
-			throw new \UnexpectedValueException($this->l->t('The given time span is invalid'), 2);
105
-		}
106
-
107
-		$values = json_decode($value, true);
108
-		$time1 = \DateTime::createFromFormat('H:i e', $values[0]);
109
-		if ($time1 === false) {
110
-			throw new \UnexpectedValueException($this->l->t('The given start time is invalid'), 3);
111
-		}
112
-
113
-		$time2 = \DateTime::createFromFormat('H:i e', $values[1]);
114
-		if ($time2 === false) {
115
-			throw new \UnexpectedValueException($this->l->t('The given end time is invalid'), 4);
116
-		}
117
-	}
118
-
119
-	public function isAvailableForScope(int $scope): bool {
120
-		return true;
121
-	}
122
-
123
-	/**
124
-	 * returns a list of Entities the checker supports. The values must match
125
-	 * the class name of the entity.
126
-	 *
127
-	 * An empty result means the check is universally available.
128
-	 *
129
-	 * @since 18.0.0
130
-	 */
131
-	public function supportedEntities(): array {
132
-		return [];
133
-	}
29
+    public const REGEX_TIME = '([0-1][0-9]|2[0-3]):([0-5][0-9])';
30
+    public const REGEX_TIMEZONE = '([a-zA-Z]+(?:\\/[a-zA-Z\-\_]+)+)';
31
+
32
+    /** @var bool[] */
33
+    protected $cachedResults;
34
+
35
+    /** @var IL10N */
36
+    protected $l;
37
+
38
+    /** @var ITimeFactory */
39
+    protected $timeFactory;
40
+
41
+    /**
42
+     * @param ITimeFactory $timeFactory
43
+     */
44
+    public function __construct(IL10N $l, ITimeFactory $timeFactory) {
45
+        $this->l = $l;
46
+        $this->timeFactory = $timeFactory;
47
+    }
48
+
49
+    /**
50
+     * @param string $operator
51
+     * @param string $value
52
+     * @return bool
53
+     */
54
+    public function executeCheck($operator, $value) {
55
+        $valueHash = md5($value);
56
+
57
+        if (isset($this->cachedResults[$valueHash])) {
58
+            return $this->cachedResults[$valueHash];
59
+        }
60
+
61
+        $timestamp = $this->timeFactory->getTime();
62
+
63
+        $values = json_decode($value, true);
64
+        $timestamp1 = $this->getTimestamp($timestamp, $values[0]);
65
+        $timestamp2 = $this->getTimestamp($timestamp, $values[1]);
66
+
67
+        if ($timestamp1 < $timestamp2) {
68
+            $in = $timestamp1 <= $timestamp && $timestamp <= $timestamp2;
69
+        } else {
70
+            $in = $timestamp1 <= $timestamp || $timestamp <= $timestamp2;
71
+        }
72
+
73
+        return ($operator === 'in') ? $in : !$in;
74
+    }
75
+
76
+    /**
77
+     * @param int $currentTimestamp
78
+     * @param string $value Format: "H:i e"
79
+     * @return int
80
+     */
81
+    protected function getTimestamp($currentTimestamp, $value) {
82
+        [$time1, $timezone1] = explode(' ', $value);
83
+        [$hour1, $minute1] = explode(':', $time1);
84
+        $date1 = new \DateTime('now', new \DateTimeZone($timezone1));
85
+        $date1->setTimestamp($currentTimestamp);
86
+        $date1->setTime($hour1, $minute1);
87
+
88
+        return $date1->getTimestamp();
89
+    }
90
+
91
+    /**
92
+     * @param string $operator
93
+     * @param string $value
94
+     * @throws \UnexpectedValueException
95
+     */
96
+    public function validateCheck($operator, $value) {
97
+        if (!in_array($operator, ['in', '!in'])) {
98
+            throw new \UnexpectedValueException($this->l->t('The given operator is invalid'), 1);
99
+        }
100
+
101
+        $regexValue = '\"' . self::REGEX_TIME . ' ' . self::REGEX_TIMEZONE . '\"';
102
+        $result = preg_match('/^\[' . $regexValue . ',' . $regexValue . '\]$/', $value, $matches);
103
+        if (!$result) {
104
+            throw new \UnexpectedValueException($this->l->t('The given time span is invalid'), 2);
105
+        }
106
+
107
+        $values = json_decode($value, true);
108
+        $time1 = \DateTime::createFromFormat('H:i e', $values[0]);
109
+        if ($time1 === false) {
110
+            throw new \UnexpectedValueException($this->l->t('The given start time is invalid'), 3);
111
+        }
112
+
113
+        $time2 = \DateTime::createFromFormat('H:i e', $values[1]);
114
+        if ($time2 === false) {
115
+            throw new \UnexpectedValueException($this->l->t('The given end time is invalid'), 4);
116
+        }
117
+    }
118
+
119
+    public function isAvailableForScope(int $scope): bool {
120
+        return true;
121
+    }
122
+
123
+    /**
124
+     * returns a list of Entities the checker supports. The values must match
125
+     * the class name of the entity.
126
+     *
127
+     * An empty result means the check is universally available.
128
+     *
129
+     * @since 18.0.0
130
+     */
131
+    public function supportedEntities(): array {
132
+        return [];
133
+    }
134 134
 }
Please login to merge, or discard this patch.
apps/testing/lib/AlternativeHomeUserBackend.php 2 patches
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -34,23 +34,23 @@
 block discarded – undo
34 34
  *	]
35 35
  */
36 36
 class AlternativeHomeUserBackend extends \OC\User\Database {
37
-	public function __construct() {
38
-		parent::__construct();
39
-	}
40
-	/**
41
-	 * get the user's home directory
42
-	 * @param string $uid the username
43
-	 * @return string|false
44
-	 */
45
-	public function getHome($uid) {
46
-		if ($this->userExists($uid)) {
47
-			// workaround to avoid killing the admin
48
-			if ($uid !== 'admin') {
49
-				$uid = md5($uid);
50
-			}
51
-			return \OC::$server->getConfig()->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . '/' . $uid;
52
-		}
37
+    public function __construct() {
38
+        parent::__construct();
39
+    }
40
+    /**
41
+     * get the user's home directory
42
+     * @param string $uid the username
43
+     * @return string|false
44
+     */
45
+    public function getHome($uid) {
46
+        if ($this->userExists($uid)) {
47
+            // workaround to avoid killing the admin
48
+            if ($uid !== 'admin') {
49
+                $uid = md5($uid);
50
+            }
51
+            return \OC::$server->getConfig()->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . '/' . $uid;
52
+        }
53 53
 
54
-		return false;
55
-	}
54
+        return false;
55
+    }
56 56
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@
 block discarded – undo
48 48
 			if ($uid !== 'admin') {
49 49
 				$uid = md5($uid);
50 50
 			}
51
-			return \OC::$server->getConfig()->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . '/' . $uid;
51
+			return \OC::$server->getConfig()->getSystemValue('datadirectory', \OC::$SERVERROOT.'/data').'/'.$uid;
52 52
 		}
53 53
 
54 54
 		return false;
Please login to merge, or discard this patch.
apps/dav/lib/DAV/PublicAuth.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@
 block discarded – undo
84 84
 	 */
85 85
 	private function isRequestPublic(RequestInterface $request) {
86 86
 		$url = $request->getPath();
87
-		$matchingUrls = array_filter($this->publicURLs, function ($publicUrl) use ($url) {
87
+		$matchingUrls = array_filter($this->publicURLs, function($publicUrl) use ($url) {
88 88
 			return strpos($url, $publicUrl, 0) === 0;
89 89
 		});
90 90
 		return !empty($matchingUrls);
Please login to merge, or discard this patch.
Indentation   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -26,66 +26,66 @@
 block discarded – undo
26 26
 
27 27
 class PublicAuth implements BackendInterface {
28 28
 
29
-	/** @var string[] */
30
-	private $publicURLs;
29
+    /** @var string[] */
30
+    private $publicURLs;
31 31
 
32
-	public function __construct() {
33
-		$this->publicURLs = [
34
-			'public-calendars',
35
-			'principals/system/public'
36
-		];
37
-	}
32
+    public function __construct() {
33
+        $this->publicURLs = [
34
+            'public-calendars',
35
+            'principals/system/public'
36
+        ];
37
+    }
38 38
 
39
-	/**
40
-	 * When this method is called, the backend must check if authentication was
41
-	 * successful.
42
-	 *
43
-	 * The returned value must be one of the following
44
-	 *
45
-	 * [true, "principals/username"]
46
-	 * [false, "reason for failure"]
47
-	 *
48
-	 * If authentication was successful, it's expected that the authentication
49
-	 * backend returns a so-called principal url.
50
-	 *
51
-	 * Examples of a principal url:
52
-	 *
53
-	 * principals/admin
54
-	 * principals/user1
55
-	 * principals/users/joe
56
-	 * principals/uid/123457
57
-	 *
58
-	 * If you don't use WebDAV ACL (RFC3744) we recommend that you simply
59
-	 * return a string such as:
60
-	 *
61
-	 * principals/users/[username]
62
-	 *
63
-	 * @param RequestInterface $request
64
-	 * @param ResponseInterface $response
65
-	 * @return array
66
-	 */
67
-	public function check(RequestInterface $request, ResponseInterface $response) {
68
-		if ($this->isRequestPublic($request)) {
69
-			return [true, "principals/system/public"];
70
-		}
71
-		return [false, "No public access to this resource."];
72
-	}
39
+    /**
40
+     * When this method is called, the backend must check if authentication was
41
+     * successful.
42
+     *
43
+     * The returned value must be one of the following
44
+     *
45
+     * [true, "principals/username"]
46
+     * [false, "reason for failure"]
47
+     *
48
+     * If authentication was successful, it's expected that the authentication
49
+     * backend returns a so-called principal url.
50
+     *
51
+     * Examples of a principal url:
52
+     *
53
+     * principals/admin
54
+     * principals/user1
55
+     * principals/users/joe
56
+     * principals/uid/123457
57
+     *
58
+     * If you don't use WebDAV ACL (RFC3744) we recommend that you simply
59
+     * return a string such as:
60
+     *
61
+     * principals/users/[username]
62
+     *
63
+     * @param RequestInterface $request
64
+     * @param ResponseInterface $response
65
+     * @return array
66
+     */
67
+    public function check(RequestInterface $request, ResponseInterface $response) {
68
+        if ($this->isRequestPublic($request)) {
69
+            return [true, "principals/system/public"];
70
+        }
71
+        return [false, "No public access to this resource."];
72
+    }
73 73
 
74
-	/**
75
-	 * @inheritdoc
76
-	 */
77
-	public function challenge(RequestInterface $request, ResponseInterface $response) {
78
-	}
74
+    /**
75
+     * @inheritdoc
76
+     */
77
+    public function challenge(RequestInterface $request, ResponseInterface $response) {
78
+    }
79 79
 
80
-	/**
81
-	 * @param RequestInterface $request
82
-	 * @return bool
83
-	 */
84
-	private function isRequestPublic(RequestInterface $request) {
85
-		$url = $request->getPath();
86
-		$matchingUrls = array_filter($this->publicURLs, function ($publicUrl) use ($url) {
87
-			return strpos($url, $publicUrl, 0) === 0;
88
-		});
89
-		return !empty($matchingUrls);
90
-	}
80
+    /**
81
+     * @param RequestInterface $request
82
+     * @return bool
83
+     */
84
+    private function isRequestPublic(RequestInterface $request) {
85
+        $url = $request->getPath();
86
+        $matchingUrls = array_filter($this->publicURLs, function ($publicUrl) use ($url) {
87
+            return strpos($url, $publicUrl, 0) === 0;
88
+        });
89
+        return !empty($matchingUrls);
90
+    }
91 91
 }
Please login to merge, or discard this patch.
apps/dav/lib/Connector/Sabre/Exception/Forbidden.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -49,17 +49,17 @@
 block discarded – undo
49 49
 	 * @param \DOMElement $errorNode
50 50
 	 * @return void
51 51
 	 */
52
-	public function serialize(\Sabre\DAV\Server $server,\DOMElement $errorNode) {
52
+	public function serialize(\Sabre\DAV\Server $server, \DOMElement $errorNode) {
53 53
 
54 54
 		// set ownCloud namespace
55 55
 		$errorNode->setAttribute('xmlns:o', self::NS_OWNCLOUD);
56 56
 
57 57
 		// adding the retry node
58
-		$error = $errorNode->ownerDocument->createElementNS('o:','o:retry', var_export($this->retry, true));
58
+		$error = $errorNode->ownerDocument->createElementNS('o:', 'o:retry', var_export($this->retry, true));
59 59
 		$errorNode->appendChild($error);
60 60
 
61 61
 		// adding the message node
62
-		$error = $errorNode->ownerDocument->createElementNS('o:','o:reason', $this->getMessage());
62
+		$error = $errorNode->ownerDocument->createElementNS('o:', 'o:reason', $this->getMessage());
63 63
 		$errorNode->appendChild($error);
64 64
 	}
65 65
 }
Please login to merge, or discard this patch.
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -23,42 +23,42 @@
 block discarded – undo
23 23
 namespace OCA\DAV\Connector\Sabre\Exception;
24 24
 
25 25
 class Forbidden extends \Sabre\DAV\Exception\Forbidden {
26
-	public const NS_OWNCLOUD = 'http://owncloud.org/ns';
26
+    public const NS_OWNCLOUD = 'http://owncloud.org/ns';
27 27
 
28
-	/**
29
-	 * @var bool
30
-	 */
31
-	private $retry;
28
+    /**
29
+     * @var bool
30
+     */
31
+    private $retry;
32 32
 
33
-	/**
34
-	 * @param string $message
35
-	 * @param bool $retry
36
-	 * @param \Exception $previous
37
-	 */
38
-	public function __construct($message, $retry = false, \Exception $previous = null) {
39
-		parent::__construct($message, 0, $previous);
40
-		$this->retry = $retry;
41
-	}
33
+    /**
34
+     * @param string $message
35
+     * @param bool $retry
36
+     * @param \Exception $previous
37
+     */
38
+    public function __construct($message, $retry = false, \Exception $previous = null) {
39
+        parent::__construct($message, 0, $previous);
40
+        $this->retry = $retry;
41
+    }
42 42
 
43
-	/**
44
-	 * This method allows the exception to include additional information
45
-	 * into the WebDAV error response
46
-	 *
47
-	 * @param \Sabre\DAV\Server $server
48
-	 * @param \DOMElement $errorNode
49
-	 * @return void
50
-	 */
51
-	public function serialize(\Sabre\DAV\Server $server,\DOMElement $errorNode) {
43
+    /**
44
+     * This method allows the exception to include additional information
45
+     * into the WebDAV error response
46
+     *
47
+     * @param \Sabre\DAV\Server $server
48
+     * @param \DOMElement $errorNode
49
+     * @return void
50
+     */
51
+    public function serialize(\Sabre\DAV\Server $server,\DOMElement $errorNode) {
52 52
 
53
-		// set ownCloud namespace
54
-		$errorNode->setAttribute('xmlns:o', self::NS_OWNCLOUD);
53
+        // set ownCloud namespace
54
+        $errorNode->setAttribute('xmlns:o', self::NS_OWNCLOUD);
55 55
 
56
-		// adding the retry node
57
-		$error = $errorNode->ownerDocument->createElementNS('o:','o:retry', var_export($this->retry, true));
58
-		$errorNode->appendChild($error);
56
+        // adding the retry node
57
+        $error = $errorNode->ownerDocument->createElementNS('o:','o:retry', var_export($this->retry, true));
58
+        $errorNode->appendChild($error);
59 59
 
60
-		// adding the message node
61
-		$error = $errorNode->ownerDocument->createElementNS('o:','o:reason', $this->getMessage());
62
-		$errorNode->appendChild($error);
63
-	}
60
+        // adding the message node
61
+        $error = $errorNode->ownerDocument->createElementNS('o:','o:reason', $this->getMessage());
62
+        $errorNode->appendChild($error);
63
+    }
64 64
 }
Please login to merge, or discard this patch.