@@ -39,233 +39,233 @@ |
||
| 39 | 39 | |
| 40 | 40 | class ChangeKeyStorageRoot extends Command { |
| 41 | 41 | |
| 42 | - /** @var View */ |
|
| 43 | - protected $rootView; |
|
| 44 | - |
|
| 45 | - /** @var IUserManager */ |
|
| 46 | - protected $userManager; |
|
| 47 | - |
|
| 48 | - /** @var IConfig */ |
|
| 49 | - protected $config; |
|
| 50 | - |
|
| 51 | - /** @var Util */ |
|
| 52 | - protected $util; |
|
| 53 | - |
|
| 54 | - /** @var QuestionHelper */ |
|
| 55 | - protected $questionHelper; |
|
| 56 | - |
|
| 57 | - /** |
|
| 58 | - * @param View $view |
|
| 59 | - * @param IUserManager $userManager |
|
| 60 | - * @param IConfig $config |
|
| 61 | - * @param Util $util |
|
| 62 | - * @param QuestionHelper $questionHelper |
|
| 63 | - */ |
|
| 64 | - public function __construct(View $view, IUserManager $userManager, IConfig $config, Util $util, QuestionHelper $questionHelper) { |
|
| 65 | - parent::__construct(); |
|
| 66 | - $this->rootView = $view; |
|
| 67 | - $this->userManager = $userManager; |
|
| 68 | - $this->config = $config; |
|
| 69 | - $this->util = $util; |
|
| 70 | - $this->questionHelper = $questionHelper; |
|
| 71 | - } |
|
| 72 | - |
|
| 73 | - protected function configure() { |
|
| 74 | - parent::configure(); |
|
| 75 | - $this |
|
| 76 | - ->setName('encryption:change-key-storage-root') |
|
| 77 | - ->setDescription('Change key storage root') |
|
| 78 | - ->addArgument( |
|
| 79 | - 'newRoot', |
|
| 80 | - InputArgument::OPTIONAL, |
|
| 81 | - 'new root of the key storage relative to the data folder' |
|
| 82 | - ); |
|
| 83 | - } |
|
| 84 | - |
|
| 85 | - protected function execute(InputInterface $input, OutputInterface $output) { |
|
| 86 | - $oldRoot = $this->util->getKeyStorageRoot(); |
|
| 87 | - $newRoot = $input->getArgument('newRoot'); |
|
| 88 | - |
|
| 89 | - if ($newRoot === null) { |
|
| 90 | - $question = new ConfirmationQuestion('No storage root given, do you want to reset the key storage root to the default location? (y/n) ', false); |
|
| 91 | - if (!$this->questionHelper->ask($input, $output, $question)) { |
|
| 92 | - return; |
|
| 93 | - } |
|
| 94 | - $newRoot = ''; |
|
| 95 | - } |
|
| 96 | - |
|
| 97 | - $oldRootDescription = $oldRoot !== '' ? $oldRoot : 'default storage location'; |
|
| 98 | - $newRootDescription = $newRoot !== '' ? $newRoot : 'default storage location'; |
|
| 99 | - $output->writeln("Change key storage root from <info>$oldRootDescription</info> to <info>$newRootDescription</info>"); |
|
| 100 | - $success = $this->moveAllKeys($oldRoot, $newRoot, $output); |
|
| 101 | - if ($success) { |
|
| 102 | - $this->util->setKeyStorageRoot($newRoot); |
|
| 103 | - $output->writeln(''); |
|
| 104 | - $output->writeln("Key storage root successfully changed to <info>$newRootDescription</info>"); |
|
| 105 | - } |
|
| 106 | - } |
|
| 107 | - |
|
| 108 | - /** |
|
| 109 | - * move keys to new key storage root |
|
| 110 | - * |
|
| 111 | - * @param string $oldRoot |
|
| 112 | - * @param string $newRoot |
|
| 113 | - * @param OutputInterface $output |
|
| 114 | - * @return bool |
|
| 115 | - * @throws \Exception |
|
| 116 | - */ |
|
| 117 | - protected function moveAllKeys($oldRoot, $newRoot, OutputInterface $output) { |
|
| 118 | - |
|
| 119 | - $output->writeln("Start to move keys:"); |
|
| 120 | - |
|
| 121 | - if ($this->rootView->is_dir(($oldRoot)) === false) { |
|
| 122 | - $output->writeln("No old keys found: Nothing needs to be moved"); |
|
| 123 | - return false; |
|
| 124 | - } |
|
| 125 | - |
|
| 126 | - $this->prepareNewRoot($newRoot); |
|
| 127 | - $this->moveSystemKeys($oldRoot, $newRoot); |
|
| 128 | - $this->moveUserKeys($oldRoot, $newRoot, $output); |
|
| 129 | - |
|
| 130 | - return true; |
|
| 131 | - } |
|
| 132 | - |
|
| 133 | - /** |
|
| 134 | - * prepare new key storage |
|
| 135 | - * |
|
| 136 | - * @param string $newRoot |
|
| 137 | - * @throws \Exception |
|
| 138 | - */ |
|
| 139 | - protected function prepareNewRoot($newRoot) { |
|
| 140 | - if ($this->rootView->is_dir($newRoot) === false) { |
|
| 141 | - throw new \Exception("New root folder doesn't exist. Please create the folder or check the permissions and try again."); |
|
| 142 | - } |
|
| 143 | - |
|
| 144 | - $result = $this->rootView->file_put_contents( |
|
| 145 | - $newRoot . '/' . Storage::KEY_STORAGE_MARKER, |
|
| 146 | - 'ownCloud will detect this folder as key storage root only if this file exists' |
|
| 147 | - ); |
|
| 148 | - |
|
| 149 | - if ($result === false) { |
|
| 150 | - throw new \Exception("Can't write to new root folder. Please check the permissions and try again"); |
|
| 151 | - } |
|
| 152 | - |
|
| 153 | - } |
|
| 154 | - |
|
| 155 | - |
|
| 156 | - /** |
|
| 157 | - * move system key folder |
|
| 158 | - * |
|
| 159 | - * @param string $oldRoot |
|
| 160 | - * @param string $newRoot |
|
| 161 | - */ |
|
| 162 | - protected function moveSystemKeys($oldRoot, $newRoot) { |
|
| 163 | - if ( |
|
| 164 | - $this->rootView->is_dir($oldRoot . '/files_encryption') && |
|
| 165 | - $this->targetExists($newRoot . '/files_encryption') === false |
|
| 166 | - ) { |
|
| 167 | - $this->rootView->rename($oldRoot . '/files_encryption', $newRoot . '/files_encryption'); |
|
| 168 | - } |
|
| 169 | - } |
|
| 170 | - |
|
| 171 | - |
|
| 172 | - /** |
|
| 173 | - * setup file system for the given user |
|
| 174 | - * |
|
| 175 | - * @param string $uid |
|
| 176 | - */ |
|
| 177 | - protected function setupUserFS($uid) { |
|
| 178 | - \OC_Util::tearDownFS(); |
|
| 179 | - \OC_Util::setupFS($uid); |
|
| 180 | - } |
|
| 181 | - |
|
| 182 | - |
|
| 183 | - /** |
|
| 184 | - * iterate over each user and move the keys to the new storage |
|
| 185 | - * |
|
| 186 | - * @param string $oldRoot |
|
| 187 | - * @param string $newRoot |
|
| 188 | - * @param OutputInterface $output |
|
| 189 | - */ |
|
| 190 | - protected function moveUserKeys($oldRoot, $newRoot, OutputInterface $output) { |
|
| 191 | - |
|
| 192 | - $progress = new ProgressBar($output); |
|
| 193 | - $progress->start(); |
|
| 194 | - |
|
| 195 | - |
|
| 196 | - foreach($this->userManager->getBackends() as $backend) { |
|
| 197 | - $limit = 500; |
|
| 198 | - $offset = 0; |
|
| 199 | - do { |
|
| 200 | - $users = $backend->getUsers('', $limit, $offset); |
|
| 201 | - foreach ($users as $user) { |
|
| 202 | - $progress->advance(); |
|
| 203 | - $this->setupUserFS($user); |
|
| 204 | - $this->moveUserEncryptionFolder($user, $oldRoot, $newRoot); |
|
| 205 | - } |
|
| 206 | - $offset += $limit; |
|
| 207 | - } while(count($users) >= $limit); |
|
| 208 | - } |
|
| 209 | - $progress->finish(); |
|
| 210 | - } |
|
| 211 | - |
|
| 212 | - /** |
|
| 213 | - * move user encryption folder to new root folder |
|
| 214 | - * |
|
| 215 | - * @param string $user |
|
| 216 | - * @param string $oldRoot |
|
| 217 | - * @param string $newRoot |
|
| 218 | - * @throws \Exception |
|
| 219 | - */ |
|
| 220 | - protected function moveUserEncryptionFolder($user, $oldRoot, $newRoot) { |
|
| 221 | - |
|
| 222 | - if ($this->userManager->userExists($user)) { |
|
| 223 | - |
|
| 224 | - $source = $oldRoot . '/' . $user . '/files_encryption'; |
|
| 225 | - $target = $newRoot . '/' . $user . '/files_encryption'; |
|
| 226 | - if ( |
|
| 227 | - $this->rootView->is_dir($source) && |
|
| 228 | - $this->targetExists($target) === false |
|
| 229 | - ) { |
|
| 230 | - $this->prepareParentFolder($newRoot . '/' . $user); |
|
| 231 | - $this->rootView->rename($source, $target); |
|
| 232 | - } |
|
| 233 | - } |
|
| 234 | - } |
|
| 235 | - |
|
| 236 | - /** |
|
| 237 | - * Make preparations to filesystem for saving a key file |
|
| 238 | - * |
|
| 239 | - * @param string $path relative to data/ |
|
| 240 | - */ |
|
| 241 | - protected function prepareParentFolder($path) { |
|
| 242 | - $path = Filesystem::normalizePath($path); |
|
| 243 | - // If the file resides within a subdirectory, create it |
|
| 244 | - if ($this->rootView->file_exists($path) === false) { |
|
| 245 | - $sub_dirs = explode('/', ltrim($path, '/')); |
|
| 246 | - $dir = ''; |
|
| 247 | - foreach ($sub_dirs as $sub_dir) { |
|
| 248 | - $dir .= '/' . $sub_dir; |
|
| 249 | - if ($this->rootView->file_exists($dir) === false) { |
|
| 250 | - $this->rootView->mkdir($dir); |
|
| 251 | - } |
|
| 252 | - } |
|
| 253 | - } |
|
| 254 | - } |
|
| 255 | - |
|
| 256 | - /** |
|
| 257 | - * check if target already exists |
|
| 258 | - * |
|
| 259 | - * @param $path |
|
| 260 | - * @return bool |
|
| 261 | - * @throws \Exception |
|
| 262 | - */ |
|
| 263 | - protected function targetExists($path) { |
|
| 264 | - if ($this->rootView->file_exists($path)) { |
|
| 265 | - throw new \Exception("new folder '$path' already exists"); |
|
| 266 | - } |
|
| 267 | - |
|
| 268 | - return false; |
|
| 269 | - } |
|
| 42 | + /** @var View */ |
|
| 43 | + protected $rootView; |
|
| 44 | + |
|
| 45 | + /** @var IUserManager */ |
|
| 46 | + protected $userManager; |
|
| 47 | + |
|
| 48 | + /** @var IConfig */ |
|
| 49 | + protected $config; |
|
| 50 | + |
|
| 51 | + /** @var Util */ |
|
| 52 | + protected $util; |
|
| 53 | + |
|
| 54 | + /** @var QuestionHelper */ |
|
| 55 | + protected $questionHelper; |
|
| 56 | + |
|
| 57 | + /** |
|
| 58 | + * @param View $view |
|
| 59 | + * @param IUserManager $userManager |
|
| 60 | + * @param IConfig $config |
|
| 61 | + * @param Util $util |
|
| 62 | + * @param QuestionHelper $questionHelper |
|
| 63 | + */ |
|
| 64 | + public function __construct(View $view, IUserManager $userManager, IConfig $config, Util $util, QuestionHelper $questionHelper) { |
|
| 65 | + parent::__construct(); |
|
| 66 | + $this->rootView = $view; |
|
| 67 | + $this->userManager = $userManager; |
|
| 68 | + $this->config = $config; |
|
| 69 | + $this->util = $util; |
|
| 70 | + $this->questionHelper = $questionHelper; |
|
| 71 | + } |
|
| 72 | + |
|
| 73 | + protected function configure() { |
|
| 74 | + parent::configure(); |
|
| 75 | + $this |
|
| 76 | + ->setName('encryption:change-key-storage-root') |
|
| 77 | + ->setDescription('Change key storage root') |
|
| 78 | + ->addArgument( |
|
| 79 | + 'newRoot', |
|
| 80 | + InputArgument::OPTIONAL, |
|
| 81 | + 'new root of the key storage relative to the data folder' |
|
| 82 | + ); |
|
| 83 | + } |
|
| 84 | + |
|
| 85 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
| 86 | + $oldRoot = $this->util->getKeyStorageRoot(); |
|
| 87 | + $newRoot = $input->getArgument('newRoot'); |
|
| 88 | + |
|
| 89 | + if ($newRoot === null) { |
|
| 90 | + $question = new ConfirmationQuestion('No storage root given, do you want to reset the key storage root to the default location? (y/n) ', false); |
|
| 91 | + if (!$this->questionHelper->ask($input, $output, $question)) { |
|
| 92 | + return; |
|
| 93 | + } |
|
| 94 | + $newRoot = ''; |
|
| 95 | + } |
|
| 96 | + |
|
| 97 | + $oldRootDescription = $oldRoot !== '' ? $oldRoot : 'default storage location'; |
|
| 98 | + $newRootDescription = $newRoot !== '' ? $newRoot : 'default storage location'; |
|
| 99 | + $output->writeln("Change key storage root from <info>$oldRootDescription</info> to <info>$newRootDescription</info>"); |
|
| 100 | + $success = $this->moveAllKeys($oldRoot, $newRoot, $output); |
|
| 101 | + if ($success) { |
|
| 102 | + $this->util->setKeyStorageRoot($newRoot); |
|
| 103 | + $output->writeln(''); |
|
| 104 | + $output->writeln("Key storage root successfully changed to <info>$newRootDescription</info>"); |
|
| 105 | + } |
|
| 106 | + } |
|
| 107 | + |
|
| 108 | + /** |
|
| 109 | + * move keys to new key storage root |
|
| 110 | + * |
|
| 111 | + * @param string $oldRoot |
|
| 112 | + * @param string $newRoot |
|
| 113 | + * @param OutputInterface $output |
|
| 114 | + * @return bool |
|
| 115 | + * @throws \Exception |
|
| 116 | + */ |
|
| 117 | + protected function moveAllKeys($oldRoot, $newRoot, OutputInterface $output) { |
|
| 118 | + |
|
| 119 | + $output->writeln("Start to move keys:"); |
|
| 120 | + |
|
| 121 | + if ($this->rootView->is_dir(($oldRoot)) === false) { |
|
| 122 | + $output->writeln("No old keys found: Nothing needs to be moved"); |
|
| 123 | + return false; |
|
| 124 | + } |
|
| 125 | + |
|
| 126 | + $this->prepareNewRoot($newRoot); |
|
| 127 | + $this->moveSystemKeys($oldRoot, $newRoot); |
|
| 128 | + $this->moveUserKeys($oldRoot, $newRoot, $output); |
|
| 129 | + |
|
| 130 | + return true; |
|
| 131 | + } |
|
| 132 | + |
|
| 133 | + /** |
|
| 134 | + * prepare new key storage |
|
| 135 | + * |
|
| 136 | + * @param string $newRoot |
|
| 137 | + * @throws \Exception |
|
| 138 | + */ |
|
| 139 | + protected function prepareNewRoot($newRoot) { |
|
| 140 | + if ($this->rootView->is_dir($newRoot) === false) { |
|
| 141 | + throw new \Exception("New root folder doesn't exist. Please create the folder or check the permissions and try again."); |
|
| 142 | + } |
|
| 143 | + |
|
| 144 | + $result = $this->rootView->file_put_contents( |
|
| 145 | + $newRoot . '/' . Storage::KEY_STORAGE_MARKER, |
|
| 146 | + 'ownCloud will detect this folder as key storage root only if this file exists' |
|
| 147 | + ); |
|
| 148 | + |
|
| 149 | + if ($result === false) { |
|
| 150 | + throw new \Exception("Can't write to new root folder. Please check the permissions and try again"); |
|
| 151 | + } |
|
| 152 | + |
|
| 153 | + } |
|
| 154 | + |
|
| 155 | + |
|
| 156 | + /** |
|
| 157 | + * move system key folder |
|
| 158 | + * |
|
| 159 | + * @param string $oldRoot |
|
| 160 | + * @param string $newRoot |
|
| 161 | + */ |
|
| 162 | + protected function moveSystemKeys($oldRoot, $newRoot) { |
|
| 163 | + if ( |
|
| 164 | + $this->rootView->is_dir($oldRoot . '/files_encryption') && |
|
| 165 | + $this->targetExists($newRoot . '/files_encryption') === false |
|
| 166 | + ) { |
|
| 167 | + $this->rootView->rename($oldRoot . '/files_encryption', $newRoot . '/files_encryption'); |
|
| 168 | + } |
|
| 169 | + } |
|
| 170 | + |
|
| 171 | + |
|
| 172 | + /** |
|
| 173 | + * setup file system for the given user |
|
| 174 | + * |
|
| 175 | + * @param string $uid |
|
| 176 | + */ |
|
| 177 | + protected function setupUserFS($uid) { |
|
| 178 | + \OC_Util::tearDownFS(); |
|
| 179 | + \OC_Util::setupFS($uid); |
|
| 180 | + } |
|
| 181 | + |
|
| 182 | + |
|
| 183 | + /** |
|
| 184 | + * iterate over each user and move the keys to the new storage |
|
| 185 | + * |
|
| 186 | + * @param string $oldRoot |
|
| 187 | + * @param string $newRoot |
|
| 188 | + * @param OutputInterface $output |
|
| 189 | + */ |
|
| 190 | + protected function moveUserKeys($oldRoot, $newRoot, OutputInterface $output) { |
|
| 191 | + |
|
| 192 | + $progress = new ProgressBar($output); |
|
| 193 | + $progress->start(); |
|
| 194 | + |
|
| 195 | + |
|
| 196 | + foreach($this->userManager->getBackends() as $backend) { |
|
| 197 | + $limit = 500; |
|
| 198 | + $offset = 0; |
|
| 199 | + do { |
|
| 200 | + $users = $backend->getUsers('', $limit, $offset); |
|
| 201 | + foreach ($users as $user) { |
|
| 202 | + $progress->advance(); |
|
| 203 | + $this->setupUserFS($user); |
|
| 204 | + $this->moveUserEncryptionFolder($user, $oldRoot, $newRoot); |
|
| 205 | + } |
|
| 206 | + $offset += $limit; |
|
| 207 | + } while(count($users) >= $limit); |
|
| 208 | + } |
|
| 209 | + $progress->finish(); |
|
| 210 | + } |
|
| 211 | + |
|
| 212 | + /** |
|
| 213 | + * move user encryption folder to new root folder |
|
| 214 | + * |
|
| 215 | + * @param string $user |
|
| 216 | + * @param string $oldRoot |
|
| 217 | + * @param string $newRoot |
|
| 218 | + * @throws \Exception |
|
| 219 | + */ |
|
| 220 | + protected function moveUserEncryptionFolder($user, $oldRoot, $newRoot) { |
|
| 221 | + |
|
| 222 | + if ($this->userManager->userExists($user)) { |
|
| 223 | + |
|
| 224 | + $source = $oldRoot . '/' . $user . '/files_encryption'; |
|
| 225 | + $target = $newRoot . '/' . $user . '/files_encryption'; |
|
| 226 | + if ( |
|
| 227 | + $this->rootView->is_dir($source) && |
|
| 228 | + $this->targetExists($target) === false |
|
| 229 | + ) { |
|
| 230 | + $this->prepareParentFolder($newRoot . '/' . $user); |
|
| 231 | + $this->rootView->rename($source, $target); |
|
| 232 | + } |
|
| 233 | + } |
|
| 234 | + } |
|
| 235 | + |
|
| 236 | + /** |
|
| 237 | + * Make preparations to filesystem for saving a key file |
|
| 238 | + * |
|
| 239 | + * @param string $path relative to data/ |
|
| 240 | + */ |
|
| 241 | + protected function prepareParentFolder($path) { |
|
| 242 | + $path = Filesystem::normalizePath($path); |
|
| 243 | + // If the file resides within a subdirectory, create it |
|
| 244 | + if ($this->rootView->file_exists($path) === false) { |
|
| 245 | + $sub_dirs = explode('/', ltrim($path, '/')); |
|
| 246 | + $dir = ''; |
|
| 247 | + foreach ($sub_dirs as $sub_dir) { |
|
| 248 | + $dir .= '/' . $sub_dir; |
|
| 249 | + if ($this->rootView->file_exists($dir) === false) { |
|
| 250 | + $this->rootView->mkdir($dir); |
|
| 251 | + } |
|
| 252 | + } |
|
| 253 | + } |
|
| 254 | + } |
|
| 255 | + |
|
| 256 | + /** |
|
| 257 | + * check if target already exists |
|
| 258 | + * |
|
| 259 | + * @param $path |
|
| 260 | + * @return bool |
|
| 261 | + * @throws \Exception |
|
| 262 | + */ |
|
| 263 | + protected function targetExists($path) { |
|
| 264 | + if ($this->rootView->file_exists($path)) { |
|
| 265 | + throw new \Exception("new folder '$path' already exists"); |
|
| 266 | + } |
|
| 267 | + |
|
| 268 | + return false; |
|
| 269 | + } |
|
| 270 | 270 | |
| 271 | 271 | } |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | $result = $this->rootView->file_put_contents( |
| 145 | - $newRoot . '/' . Storage::KEY_STORAGE_MARKER, |
|
| 145 | + $newRoot.'/'.Storage::KEY_STORAGE_MARKER, |
|
| 146 | 146 | 'ownCloud will detect this folder as key storage root only if this file exists' |
| 147 | 147 | ); |
| 148 | 148 | |
@@ -161,10 +161,10 @@ discard block |
||
| 161 | 161 | */ |
| 162 | 162 | protected function moveSystemKeys($oldRoot, $newRoot) { |
| 163 | 163 | if ( |
| 164 | - $this->rootView->is_dir($oldRoot . '/files_encryption') && |
|
| 165 | - $this->targetExists($newRoot . '/files_encryption') === false |
|
| 164 | + $this->rootView->is_dir($oldRoot.'/files_encryption') && |
|
| 165 | + $this->targetExists($newRoot.'/files_encryption') === false |
|
| 166 | 166 | ) { |
| 167 | - $this->rootView->rename($oldRoot . '/files_encryption', $newRoot . '/files_encryption'); |
|
| 167 | + $this->rootView->rename($oldRoot.'/files_encryption', $newRoot.'/files_encryption'); |
|
| 168 | 168 | } |
| 169 | 169 | } |
| 170 | 170 | |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | $progress->start(); |
| 194 | 194 | |
| 195 | 195 | |
| 196 | - foreach($this->userManager->getBackends() as $backend) { |
|
| 196 | + foreach ($this->userManager->getBackends() as $backend) { |
|
| 197 | 197 | $limit = 500; |
| 198 | 198 | $offset = 0; |
| 199 | 199 | do { |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | $this->moveUserEncryptionFolder($user, $oldRoot, $newRoot); |
| 205 | 205 | } |
| 206 | 206 | $offset += $limit; |
| 207 | - } while(count($users) >= $limit); |
|
| 207 | + } while (count($users) >= $limit); |
|
| 208 | 208 | } |
| 209 | 209 | $progress->finish(); |
| 210 | 210 | } |
@@ -221,13 +221,13 @@ discard block |
||
| 221 | 221 | |
| 222 | 222 | if ($this->userManager->userExists($user)) { |
| 223 | 223 | |
| 224 | - $source = $oldRoot . '/' . $user . '/files_encryption'; |
|
| 225 | - $target = $newRoot . '/' . $user . '/files_encryption'; |
|
| 224 | + $source = $oldRoot.'/'.$user.'/files_encryption'; |
|
| 225 | + $target = $newRoot.'/'.$user.'/files_encryption'; |
|
| 226 | 226 | if ( |
| 227 | 227 | $this->rootView->is_dir($source) && |
| 228 | 228 | $this->targetExists($target) === false |
| 229 | 229 | ) { |
| 230 | - $this->prepareParentFolder($newRoot . '/' . $user); |
|
| 230 | + $this->prepareParentFolder($newRoot.'/'.$user); |
|
| 231 | 231 | $this->rootView->rename($source, $target); |
| 232 | 232 | } |
| 233 | 233 | } |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | $sub_dirs = explode('/', ltrim($path, '/')); |
| 246 | 246 | $dir = ''; |
| 247 | 247 | foreach ($sub_dirs as $sub_dir) { |
| 248 | - $dir .= '/' . $sub_dir; |
|
| 248 | + $dir .= '/'.$sub_dir; |
|
| 249 | 249 | if ($this->rootView->file_exists($dir) === false) { |
| 250 | 250 | $this->rootView->mkdir($dir); |
| 251 | 251 | } |
@@ -30,40 +30,40 @@ |
||
| 30 | 30 | use Symfony\Component\Console\Output\OutputInterface; |
| 31 | 31 | |
| 32 | 32 | class SetDefaultModule extends Command { |
| 33 | - /** @var IManager */ |
|
| 34 | - protected $encryptionManager; |
|
| 33 | + /** @var IManager */ |
|
| 34 | + protected $encryptionManager; |
|
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * @param IManager $encryptionManager |
|
| 38 | - */ |
|
| 39 | - public function __construct(IManager $encryptionManager) { |
|
| 40 | - parent::__construct(); |
|
| 41 | - $this->encryptionManager = $encryptionManager; |
|
| 42 | - } |
|
| 36 | + /** |
|
| 37 | + * @param IManager $encryptionManager |
|
| 38 | + */ |
|
| 39 | + public function __construct(IManager $encryptionManager) { |
|
| 40 | + parent::__construct(); |
|
| 41 | + $this->encryptionManager = $encryptionManager; |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | - protected function configure() { |
|
| 45 | - parent::configure(); |
|
| 44 | + protected function configure() { |
|
| 45 | + parent::configure(); |
|
| 46 | 46 | |
| 47 | - $this |
|
| 48 | - ->setName('encryption:set-default-module') |
|
| 49 | - ->setDescription('Set the encryption default module') |
|
| 50 | - ->addArgument( |
|
| 51 | - 'module', |
|
| 52 | - InputArgument::REQUIRED, |
|
| 53 | - 'ID of the encryption module that should be used' |
|
| 54 | - ) |
|
| 55 | - ; |
|
| 56 | - } |
|
| 47 | + $this |
|
| 48 | + ->setName('encryption:set-default-module') |
|
| 49 | + ->setDescription('Set the encryption default module') |
|
| 50 | + ->addArgument( |
|
| 51 | + 'module', |
|
| 52 | + InputArgument::REQUIRED, |
|
| 53 | + 'ID of the encryption module that should be used' |
|
| 54 | + ) |
|
| 55 | + ; |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | - protected function execute(InputInterface $input, OutputInterface $output) { |
|
| 59 | - $moduleId = $input->getArgument('module'); |
|
| 58 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
| 59 | + $moduleId = $input->getArgument('module'); |
|
| 60 | 60 | |
| 61 | - if ($moduleId === $this->encryptionManager->getDefaultEncryptionModuleId()) { |
|
| 62 | - $output->writeln('"' . $moduleId . '"" is already the default module'); |
|
| 63 | - } else if ($this->encryptionManager->setDefaultEncryptionModule($moduleId)) { |
|
| 64 | - $output->writeln('<info>Set default module to "' . $moduleId . '"</info>'); |
|
| 65 | - } else { |
|
| 66 | - $output->writeln('<error>The specified module "' . $moduleId . '" does not exist</error>'); |
|
| 67 | - } |
|
| 68 | - } |
|
| 61 | + if ($moduleId === $this->encryptionManager->getDefaultEncryptionModuleId()) { |
|
| 62 | + $output->writeln('"' . $moduleId . '"" is already the default module'); |
|
| 63 | + } else if ($this->encryptionManager->setDefaultEncryptionModule($moduleId)) { |
|
| 64 | + $output->writeln('<info>Set default module to "' . $moduleId . '"</info>'); |
|
| 65 | + } else { |
|
| 66 | + $output->writeln('<error>The specified module "' . $moduleId . '" does not exist</error>'); |
|
| 67 | + } |
|
| 68 | + } |
|
| 69 | 69 | } |
@@ -59,11 +59,11 @@ |
||
| 59 | 59 | $moduleId = $input->getArgument('module'); |
| 60 | 60 | |
| 61 | 61 | if ($moduleId === $this->encryptionManager->getDefaultEncryptionModuleId()) { |
| 62 | - $output->writeln('"' . $moduleId . '"" is already the default module'); |
|
| 62 | + $output->writeln('"'.$moduleId.'"" is already the default module'); |
|
| 63 | 63 | } else if ($this->encryptionManager->setDefaultEncryptionModule($moduleId)) { |
| 64 | - $output->writeln('<info>Set default module to "' . $moduleId . '"</info>'); |
|
| 64 | + $output->writeln('<info>Set default module to "'.$moduleId.'"</info>'); |
|
| 65 | 65 | } else { |
| 66 | - $output->writeln('<error>The specified module "' . $moduleId . '" does not exist</error>'); |
|
| 66 | + $output->writeln('<error>The specified module "'.$moduleId.'" does not exist</error>'); |
|
| 67 | 67 | } |
| 68 | 68 | } |
| 69 | 69 | } |
@@ -34,58 +34,58 @@ |
||
| 34 | 34 | use Symfony\Component\Console\Output\OutputInterface; |
| 35 | 35 | |
| 36 | 36 | class ListCommand extends Base { |
| 37 | - /** @var IGroupManager */ |
|
| 38 | - protected $groupManager; |
|
| 37 | + /** @var IGroupManager */ |
|
| 38 | + protected $groupManager; |
|
| 39 | 39 | |
| 40 | - /** |
|
| 41 | - * @param IGroupManager $groupManager |
|
| 42 | - */ |
|
| 43 | - public function __construct(IGroupManager $groupManager) { |
|
| 44 | - $this->groupManager = $groupManager; |
|
| 45 | - parent::__construct(); |
|
| 46 | - } |
|
| 40 | + /** |
|
| 41 | + * @param IGroupManager $groupManager |
|
| 42 | + */ |
|
| 43 | + public function __construct(IGroupManager $groupManager) { |
|
| 44 | + $this->groupManager = $groupManager; |
|
| 45 | + parent::__construct(); |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | - protected function configure() { |
|
| 49 | - $this |
|
| 50 | - ->setName('group:list') |
|
| 51 | - ->setDescription('list configured groups') |
|
| 52 | - ->addOption( |
|
| 53 | - 'limit', |
|
| 54 | - 'l', |
|
| 55 | - InputOption::VALUE_OPTIONAL, |
|
| 56 | - 'Number of groups to retrieve', |
|
| 57 | - 500 |
|
| 58 | - )->addOption( |
|
| 59 | - 'offset', |
|
| 60 | - 'o', |
|
| 61 | - InputOption::VALUE_OPTIONAL, |
|
| 62 | - 'Offset for retrieving groups', |
|
| 63 | - 0 |
|
| 64 | - )->addOption( |
|
| 65 | - 'output', |
|
| 66 | - null, |
|
| 67 | - InputOption::VALUE_OPTIONAL, |
|
| 68 | - 'Output format (plain, json or json_pretty, default is plain)', |
|
| 69 | - $this->defaultOutputFormat |
|
| 70 | - ); |
|
| 71 | - } |
|
| 48 | + protected function configure() { |
|
| 49 | + $this |
|
| 50 | + ->setName('group:list') |
|
| 51 | + ->setDescription('list configured groups') |
|
| 52 | + ->addOption( |
|
| 53 | + 'limit', |
|
| 54 | + 'l', |
|
| 55 | + InputOption::VALUE_OPTIONAL, |
|
| 56 | + 'Number of groups to retrieve', |
|
| 57 | + 500 |
|
| 58 | + )->addOption( |
|
| 59 | + 'offset', |
|
| 60 | + 'o', |
|
| 61 | + InputOption::VALUE_OPTIONAL, |
|
| 62 | + 'Offset for retrieving groups', |
|
| 63 | + 0 |
|
| 64 | + )->addOption( |
|
| 65 | + 'output', |
|
| 66 | + null, |
|
| 67 | + InputOption::VALUE_OPTIONAL, |
|
| 68 | + 'Output format (plain, json or json_pretty, default is plain)', |
|
| 69 | + $this->defaultOutputFormat |
|
| 70 | + ); |
|
| 71 | + } |
|
| 72 | 72 | |
| 73 | - protected function execute(InputInterface $input, OutputInterface $output) { |
|
| 74 | - $groups = $this->groupManager->search('', (int)$input->getOption('limit'), (int)$input->getOption('offset')); |
|
| 75 | - $this->writeArrayInOutputFormat($input, $output, $this->formatGroups($groups)); |
|
| 76 | - } |
|
| 73 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
| 74 | + $groups = $this->groupManager->search('', (int)$input->getOption('limit'), (int)$input->getOption('offset')); |
|
| 75 | + $this->writeArrayInOutputFormat($input, $output, $this->formatGroups($groups)); |
|
| 76 | + } |
|
| 77 | 77 | |
| 78 | - /** |
|
| 79 | - * @param IGroup[] $groups |
|
| 80 | - * @return array |
|
| 81 | - */ |
|
| 82 | - private function formatGroups(array $groups) { |
|
| 83 | - $keys = array_map(function (IGroup $group) { |
|
| 84 | - return $group->getGID(); |
|
| 85 | - }, $groups); |
|
| 86 | - $values = array_map(function (IGroup $group) { |
|
| 87 | - return array_keys($group->getUsers()); |
|
| 88 | - }, $groups); |
|
| 89 | - return array_combine($keys, $values); |
|
| 90 | - } |
|
| 78 | + /** |
|
| 79 | + * @param IGroup[] $groups |
|
| 80 | + * @return array |
|
| 81 | + */ |
|
| 82 | + private function formatGroups(array $groups) { |
|
| 83 | + $keys = array_map(function (IGroup $group) { |
|
| 84 | + return $group->getGID(); |
|
| 85 | + }, $groups); |
|
| 86 | + $values = array_map(function (IGroup $group) { |
|
| 87 | + return array_keys($group->getUsers()); |
|
| 88 | + }, $groups); |
|
| 89 | + return array_combine($keys, $values); |
|
| 90 | + } |
|
| 91 | 91 | } |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | protected function execute(InputInterface $input, OutputInterface $output) { |
| 74 | - $groups = $this->groupManager->search('', (int)$input->getOption('limit'), (int)$input->getOption('offset')); |
|
| 74 | + $groups = $this->groupManager->search('', (int) $input->getOption('limit'), (int) $input->getOption('offset')); |
|
| 75 | 75 | $this->writeArrayInOutputFormat($input, $output, $this->formatGroups($groups)); |
| 76 | 76 | } |
| 77 | 77 | |
@@ -80,10 +80,10 @@ discard block |
||
| 80 | 80 | * @return array |
| 81 | 81 | */ |
| 82 | 82 | private function formatGroups(array $groups) { |
| 83 | - $keys = array_map(function (IGroup $group) { |
|
| 83 | + $keys = array_map(function(IGroup $group) { |
|
| 84 | 84 | return $group->getGID(); |
| 85 | 85 | }, $groups); |
| 86 | - $values = array_map(function (IGroup $group) { |
|
| 86 | + $values = array_map(function(IGroup $group) { |
|
| 87 | 87 | return array_keys($group->getUsers()); |
| 88 | 88 | }, $groups); |
| 89 | 89 | return array_combine($keys, $values); |
@@ -33,47 +33,47 @@ |
||
| 33 | 33 | use Symfony\Component\Console\Output\OutputInterface; |
| 34 | 34 | |
| 35 | 35 | class RemoveUser extends Base { |
| 36 | - /** @var IUserManager */ |
|
| 37 | - protected $userManager; |
|
| 38 | - /** @var IGroupManager */ |
|
| 39 | - protected $groupManager; |
|
| 36 | + /** @var IUserManager */ |
|
| 37 | + protected $userManager; |
|
| 38 | + /** @var IGroupManager */ |
|
| 39 | + protected $groupManager; |
|
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * @param IUserManager $userManager |
|
| 43 | - * @param IGroupManager $groupManager |
|
| 44 | - */ |
|
| 45 | - public function __construct(IUserManager $userManager, IGroupManager $groupManager) { |
|
| 46 | - $this->userManager = $userManager; |
|
| 47 | - $this->groupManager = $groupManager; |
|
| 48 | - parent::__construct(); |
|
| 49 | - } |
|
| 41 | + /** |
|
| 42 | + * @param IUserManager $userManager |
|
| 43 | + * @param IGroupManager $groupManager |
|
| 44 | + */ |
|
| 45 | + public function __construct(IUserManager $userManager, IGroupManager $groupManager) { |
|
| 46 | + $this->userManager = $userManager; |
|
| 47 | + $this->groupManager = $groupManager; |
|
| 48 | + parent::__construct(); |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | - protected function configure() { |
|
| 52 | - $this |
|
| 53 | - ->setName('group:removeuser') |
|
| 54 | - ->setDescription('remove a user from a group') |
|
| 55 | - ->addArgument( |
|
| 56 | - 'group', |
|
| 57 | - InputArgument::REQUIRED, |
|
| 58 | - 'group to remove the user from' |
|
| 59 | - )->addArgument( |
|
| 60 | - 'user', |
|
| 61 | - InputArgument::REQUIRED, |
|
| 62 | - 'user to remove from the group' |
|
| 63 | - ); |
|
| 64 | - } |
|
| 51 | + protected function configure() { |
|
| 52 | + $this |
|
| 53 | + ->setName('group:removeuser') |
|
| 54 | + ->setDescription('remove a user from a group') |
|
| 55 | + ->addArgument( |
|
| 56 | + 'group', |
|
| 57 | + InputArgument::REQUIRED, |
|
| 58 | + 'group to remove the user from' |
|
| 59 | + )->addArgument( |
|
| 60 | + 'user', |
|
| 61 | + InputArgument::REQUIRED, |
|
| 62 | + 'user to remove from the group' |
|
| 63 | + ); |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - protected function execute(InputInterface $input, OutputInterface $output) { |
|
| 67 | - $group = $this->groupManager->get($input->getArgument('group')); |
|
| 68 | - if (is_null($group)) { |
|
| 69 | - $output->writeln('<error>group not found</error>'); |
|
| 70 | - return 1; |
|
| 71 | - } |
|
| 72 | - $user = $this->userManager->get($input->getArgument('user')); |
|
| 73 | - if (is_null($user)) { |
|
| 74 | - $output->writeln('<error>user not found</error>'); |
|
| 75 | - return 1; |
|
| 76 | - } |
|
| 77 | - $group->removeUser($user); |
|
| 78 | - } |
|
| 66 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
| 67 | + $group = $this->groupManager->get($input->getArgument('group')); |
|
| 68 | + if (is_null($group)) { |
|
| 69 | + $output->writeln('<error>group not found</error>'); |
|
| 70 | + return 1; |
|
| 71 | + } |
|
| 72 | + $user = $this->userManager->get($input->getArgument('user')); |
|
| 73 | + if (is_null($user)) { |
|
| 74 | + $output->writeln('<error>user not found</error>'); |
|
| 75 | + return 1; |
|
| 76 | + } |
|
| 77 | + $group->removeUser($user); |
|
| 78 | + } |
|
| 79 | 79 | } |
@@ -33,47 +33,47 @@ |
||
| 33 | 33 | use Symfony\Component\Console\Output\OutputInterface; |
| 34 | 34 | |
| 35 | 35 | class AddUser extends Base { |
| 36 | - /** @var IUserManager */ |
|
| 37 | - protected $userManager; |
|
| 38 | - /** @var IGroupManager */ |
|
| 39 | - protected $groupManager; |
|
| 36 | + /** @var IUserManager */ |
|
| 37 | + protected $userManager; |
|
| 38 | + /** @var IGroupManager */ |
|
| 39 | + protected $groupManager; |
|
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * @param IUserManager $userManager |
|
| 43 | - * @param IGroupManager $groupManager |
|
| 44 | - */ |
|
| 45 | - public function __construct(IUserManager $userManager, IGroupManager $groupManager) { |
|
| 46 | - $this->userManager = $userManager; |
|
| 47 | - $this->groupManager = $groupManager; |
|
| 48 | - parent::__construct(); |
|
| 49 | - } |
|
| 41 | + /** |
|
| 42 | + * @param IUserManager $userManager |
|
| 43 | + * @param IGroupManager $groupManager |
|
| 44 | + */ |
|
| 45 | + public function __construct(IUserManager $userManager, IGroupManager $groupManager) { |
|
| 46 | + $this->userManager = $userManager; |
|
| 47 | + $this->groupManager = $groupManager; |
|
| 48 | + parent::__construct(); |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | - protected function configure() { |
|
| 52 | - $this |
|
| 53 | - ->setName('group:adduser') |
|
| 54 | - ->setDescription('add a user to a group') |
|
| 55 | - ->addArgument( |
|
| 56 | - 'group', |
|
| 57 | - InputArgument::REQUIRED, |
|
| 58 | - 'group to add the user to' |
|
| 59 | - )->addArgument( |
|
| 60 | - 'user', |
|
| 61 | - InputArgument::REQUIRED, |
|
| 62 | - 'user to add to the group' |
|
| 63 | - ); |
|
| 64 | - } |
|
| 51 | + protected function configure() { |
|
| 52 | + $this |
|
| 53 | + ->setName('group:adduser') |
|
| 54 | + ->setDescription('add a user to a group') |
|
| 55 | + ->addArgument( |
|
| 56 | + 'group', |
|
| 57 | + InputArgument::REQUIRED, |
|
| 58 | + 'group to add the user to' |
|
| 59 | + )->addArgument( |
|
| 60 | + 'user', |
|
| 61 | + InputArgument::REQUIRED, |
|
| 62 | + 'user to add to the group' |
|
| 63 | + ); |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - protected function execute(InputInterface $input, OutputInterface $output) { |
|
| 67 | - $group = $this->groupManager->get($input->getArgument('group')); |
|
| 68 | - if (is_null($group)) { |
|
| 69 | - $output->writeln('<error>group not found</error>'); |
|
| 70 | - return 1; |
|
| 71 | - } |
|
| 72 | - $user = $this->userManager->get($input->getArgument('user')); |
|
| 73 | - if (is_null($user)) { |
|
| 74 | - $output->writeln('<error>user not found</error>'); |
|
| 75 | - return 1; |
|
| 76 | - } |
|
| 77 | - $group->addUser($user); |
|
| 78 | - } |
|
| 66 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
| 67 | + $group = $this->groupManager->get($input->getArgument('group')); |
|
| 68 | + if (is_null($group)) { |
|
| 69 | + $output->writeln('<error>group not found</error>'); |
|
| 70 | + return 1; |
|
| 71 | + } |
|
| 72 | + $user = $this->userManager->get($input->getArgument('user')); |
|
| 73 | + if (is_null($user)) { |
|
| 74 | + $output->writeln('<error>user not found</error>'); |
|
| 75 | + return 1; |
|
| 76 | + } |
|
| 77 | + $group->addUser($user); |
|
| 78 | + } |
|
| 79 | 79 | } |
@@ -5,5 +5,5 @@ |
||
| 5 | 5 | */?> |
| 6 | 6 | |
| 7 | 7 | <?php foreach($_['forms'] as $form) { |
| 8 | - print_unescaped($form); |
|
| 8 | + print_unescaped($form); |
|
| 9 | 9 | }; |
@@ -4,6 +4,6 @@ |
||
| 4 | 4 | * See the COPYING-README file. |
| 5 | 5 | */?> |
| 6 | 6 | |
| 7 | -<?php foreach($_['forms'] as $form) { |
|
| 7 | +<?php foreach ($_['forms'] as $form) { |
|
| 8 | 8 | print_unescaped($form); |
| 9 | 9 | }; |
@@ -1,35 +1,35 @@ |
||
| 1 | 1 | <div class="quota"> |
| 2 | 2 | <!-- Default storage --> |
| 3 | - <span><?php p($l->t('Default quota'));?></span> |
|
| 4 | - <?php if((bool) $_['isAdmin']): ?> |
|
| 3 | + <span><?php p($l->t('Default quota')); ?></span> |
|
| 4 | + <?php if ((bool) $_['isAdmin']): ?> |
|
| 5 | 5 | <select id='default_quota' data-inputtitle="<?php p($l->t('Please enter storage quota (ex: "512 MB" or "12 GB")')) ?>" data-tipsy-gravity="s"> |
| 6 | - <option <?php if($_['default_quota'] === 'none') print_unescaped('selected="selected"');?> value='none'> |
|
| 7 | - <?php p($l->t('Unlimited'));?> |
|
| 6 | + <option <?php if ($_['default_quota'] === 'none') print_unescaped('selected="selected"'); ?> value='none'> |
|
| 7 | + <?php p($l->t('Unlimited')); ?> |
|
| 8 | 8 | </option> |
| 9 | - <?php foreach($_['quota_preset'] as $preset):?> |
|
| 10 | - <?php if($preset !== 'default'):?> |
|
| 11 | - <option <?php if($_['default_quota']==$preset) print_unescaped('selected="selected"');?> value='<?php p($preset);?>'> |
|
| 12 | - <?php p($preset);?> |
|
| 9 | + <?php foreach ($_['quota_preset'] as $preset):?> |
|
| 10 | + <?php if ($preset !== 'default'):?> |
|
| 11 | + <option <?php if ($_['default_quota'] == $preset) print_unescaped('selected="selected"'); ?> value='<?php p($preset); ?>'> |
|
| 12 | + <?php p($preset); ?> |
|
| 13 | 13 | </option> |
| 14 | - <?php endif;?> |
|
| 15 | - <?php endforeach;?> |
|
| 16 | - <?php if($_['defaultQuotaIsUserDefined']):?> |
|
| 17 | - <option selected="selected" value='<?php p($_['default_quota']);?>'> |
|
| 18 | - <?php p($_['default_quota']);?> |
|
| 14 | + <?php endif; ?> |
|
| 15 | + <?php endforeach; ?> |
|
| 16 | + <?php if ($_['defaultQuotaIsUserDefined']):?> |
|
| 17 | + <option selected="selected" value='<?php p($_['default_quota']); ?>'> |
|
| 18 | + <?php p($_['default_quota']); ?> |
|
| 19 | 19 | </option> |
| 20 | - <?php endif;?> |
|
| 20 | + <?php endif; ?> |
|
| 21 | 21 | <option data-new value='other'> |
| 22 | - <?php p($l->t('Other'));?> |
|
| 22 | + <?php p($l->t('Other')); ?> |
|
| 23 | 23 | ... |
| 24 | 24 | </option> |
| 25 | 25 | </select> |
| 26 | 26 | <?php endif; ?> |
| 27 | - <?php if((bool) !$_['isAdmin']): ?> |
|
| 27 | + <?php if ((bool) !$_['isAdmin']): ?> |
|
| 28 | 28 | : |
| 29 | - <?php if( $_['default_quota'] === 'none'): ?> |
|
| 30 | - <?php p($l->t('Unlimited'));?> |
|
| 29 | + <?php if ($_['default_quota'] === 'none'): ?> |
|
| 30 | + <?php p($l->t('Unlimited')); ?> |
|
| 31 | 31 | <?php else: ?> |
| 32 | - <?php p($_['default_quota']);?> |
|
| 32 | + <?php p($_['default_quota']); ?> |
|
| 33 | 33 | <?php endif; ?> |
| 34 | 34 | <?php endif; ?> |
| 35 | 35 | </div> |
@@ -3,12 +3,18 @@ discard block |
||
| 3 | 3 | <span><?php p($l->t('Default quota'));?></span> |
| 4 | 4 | <?php if((bool) $_['isAdmin']): ?> |
| 5 | 5 | <select id='default_quota' data-inputtitle="<?php p($l->t('Please enter storage quota (ex: "512 MB" or "12 GB")')) ?>" data-tipsy-gravity="s"> |
| 6 | - <option <?php if($_['default_quota'] === 'none') print_unescaped('selected="selected"');?> value='none'> |
|
| 6 | + <option <?php if($_['default_quota'] === 'none') { |
|
| 7 | + print_unescaped('selected="selected"'); |
|
| 8 | +} |
|
| 9 | +?> value='none'> |
|
| 7 | 10 | <?php p($l->t('Unlimited'));?> |
| 8 | 11 | </option> |
| 9 | 12 | <?php foreach($_['quota_preset'] as $preset):?> |
| 10 | 13 | <?php if($preset !== 'default'):?> |
| 11 | - <option <?php if($_['default_quota']==$preset) print_unescaped('selected="selected"');?> value='<?php p($preset);?>'> |
|
| 14 | + <option <?php if($_['default_quota']==$preset) { |
|
| 15 | + print_unescaped('selected="selected"'); |
|
| 16 | +} |
|
| 17 | +?> value='<?php p($preset);?>'> |
|
| 12 | 18 | <?php p($preset);?> |
| 13 | 19 | </option> |
| 14 | 20 | <?php endif;?> |
@@ -28,8 +34,11 @@ discard block |
||
| 28 | 34 | : |
| 29 | 35 | <?php if( $_['default_quota'] === 'none'): ?> |
| 30 | 36 | <?php p($l->t('Unlimited'));?> |
| 31 | - <?php else: ?> |
|
| 32 | - <?php p($_['default_quota']);?> |
|
| 37 | + <?php else { |
|
| 38 | + : ?> |
|
| 39 | + <?php p($_['default_quota']); |
|
| 40 | +} |
|
| 41 | +?> |
|
| 33 | 42 | <?php endif; ?> |
| 34 | 43 | <?php endif; ?> |
| 35 | 44 | </div> |
@@ -6,24 +6,24 @@ |
||
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | 8 | script('settings', [ |
| 9 | - 'users/deleteHandler', |
|
| 10 | - 'users/filter', |
|
| 11 | - 'users/users', |
|
| 12 | - 'users/groups' |
|
| 9 | + 'users/deleteHandler', |
|
| 10 | + 'users/filter', |
|
| 11 | + 'users/users', |
|
| 12 | + 'users/groups' |
|
| 13 | 13 | ]); |
| 14 | 14 | script('core', [ |
| 15 | - 'multiselect', |
|
| 16 | - 'singleselect' |
|
| 15 | + 'multiselect', |
|
| 16 | + 'singleselect' |
|
| 17 | 17 | ]); |
| 18 | 18 | style('settings', 'settings'); |
| 19 | 19 | |
| 20 | 20 | $userlistParams = array(); |
| 21 | 21 | $allGroups=array(); |
| 22 | 22 | foreach($_["adminGroup"] as $group) { |
| 23 | - $allGroups[] = $group['name']; |
|
| 23 | + $allGroups[] = $group['name']; |
|
| 24 | 24 | } |
| 25 | 25 | foreach($_["groups"] as $group) { |
| 26 | - $allGroups[] = $group['name']; |
|
| 26 | + $allGroups[] = $group['name']; |
|
| 27 | 27 | } |
| 28 | 28 | $userlistParams['subadmingroups'] = $allGroups; |
| 29 | 29 | $userlistParams['allGroups'] = json_encode($allGroups); |
@@ -46,35 +46,50 @@ |
||
| 46 | 46 | <div id="userlistoptions"> |
| 47 | 47 | <p> |
| 48 | 48 | <input type="checkbox" name="StorageLocation" value="StorageLocation" id="CheckboxStorageLocation" |
| 49 | - class="checkbox" <?php if ($_['show_storage_location'] === 'true') print_unescaped('checked="checked"'); ?> /> |
|
| 49 | + class="checkbox" <?php if ($_['show_storage_location'] === 'true') { |
|
| 50 | + print_unescaped('checked="checked"'); |
|
| 51 | +} |
|
| 52 | +?> /> |
|
| 50 | 53 | <label for="CheckboxStorageLocation"> |
| 51 | 54 | <?php p($l->t('Show storage location')) ?> |
| 52 | 55 | </label> |
| 53 | 56 | </p> |
| 54 | 57 | <p> |
| 55 | 58 | <input type="checkbox" name="UserBackend" value="UserBackend" id="CheckboxUserBackend" |
| 56 | - class="checkbox" <?php if ($_['show_backend'] === 'true') print_unescaped('checked="checked"'); ?> /> |
|
| 59 | + class="checkbox" <?php if ($_['show_backend'] === 'true') { |
|
| 60 | + print_unescaped('checked="checked"'); |
|
| 61 | +} |
|
| 62 | +?> /> |
|
| 57 | 63 | <label for="CheckboxUserBackend"> |
| 58 | 64 | <?php p($l->t('Show user backend')) ?> |
| 59 | 65 | </label> |
| 60 | 66 | </p> |
| 61 | 67 | <p> |
| 62 | 68 | <input type="checkbox" name="LastLogin" value="LastLogin" id="CheckboxLastLogin" |
| 63 | - class="checkbox" <?php if ($_['show_last_login'] === 'true') print_unescaped('checked="checked"'); ?> /> |
|
| 69 | + class="checkbox" <?php if ($_['show_last_login'] === 'true') { |
|
| 70 | + print_unescaped('checked="checked"'); |
|
| 71 | +} |
|
| 72 | +?> /> |
|
| 64 | 73 | <label for="CheckboxLastLogin"> |
| 65 | 74 | <?php p($l->t('Show last login')) ?> |
| 66 | 75 | </label> |
| 67 | 76 | </p> |
| 68 | 77 | <p> |
| 69 | 78 | <input type="checkbox" name="EmailAddress" value="EmailAddress" id="CheckboxEmailAddress" |
| 70 | - class="checkbox" <?php if ($_['show_email'] === 'true') print_unescaped('checked="checked"'); ?> /> |
|
| 79 | + class="checkbox" <?php if ($_['show_email'] === 'true') { |
|
| 80 | + print_unescaped('checked="checked"'); |
|
| 81 | +} |
|
| 82 | +?> /> |
|
| 71 | 83 | <label for="CheckboxEmailAddress"> |
| 72 | 84 | <?php p($l->t('Show email address')) ?> |
| 73 | 85 | </label> |
| 74 | 86 | </p> |
| 75 | 87 | <p> |
| 76 | 88 | <input type="checkbox" name="MailOnUserCreate" value="MailOnUserCreate" id="CheckboxMailOnUserCreate" |
| 77 | - class="checkbox" <?php if ($_['send_email'] === 'true') print_unescaped('checked="checked"'); ?> /> |
|
| 89 | + class="checkbox" <?php if ($_['send_email'] === 'true') { |
|
| 90 | + print_unescaped('checked="checked"'); |
|
| 91 | +} |
|
| 92 | +?> /> |
|
| 78 | 93 | <label for="CheckboxMailOnUserCreate"> |
| 79 | 94 | <?php p($l->t('Send email to new user')) ?> |
| 80 | 95 | </label> |
@@ -18,11 +18,11 @@ discard block |
||
| 18 | 18 | style('settings', 'settings'); |
| 19 | 19 | |
| 20 | 20 | $userlistParams = array(); |
| 21 | -$allGroups=array(); |
|
| 22 | -foreach($_["adminGroup"] as $group) { |
|
| 21 | +$allGroups = array(); |
|
| 22 | +foreach ($_["adminGroup"] as $group) { |
|
| 23 | 23 | $allGroups[] = $group['name']; |
| 24 | 24 | } |
| 25 | -foreach($_["groups"] as $group) { |
|
| 25 | +foreach ($_["groups"] as $group) { |
|
| 26 | 26 | $allGroups[] = $group['name']; |
| 27 | 27 | } |
| 28 | 28 | $userlistParams['subadmingroups'] = $allGroups; |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | <?php print_unescaped($this->inc('users/part.grouplist')); ?> |
| 39 | 39 | <div id="app-settings"> |
| 40 | 40 | <div id="app-settings-header"> |
| 41 | - <button class="settings-button" tabindex="0" data-apps-slide-toggle="#app-settings-content"><?php p($l->t('Settings'));?></button> |
|
| 41 | + <button class="settings-button" tabindex="0" data-apps-slide-toggle="#app-settings-content"><?php p($l->t('Settings')); ?></button> |
|
| 42 | 42 | </div> |
| 43 | 43 | <div id="app-settings-content"> |
| 44 | 44 | <?php print_unescaped($this->inc('users/part.setquota')); ?> |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | <div class="groups"><div class="groupsListContainer multiselect button" data-placeholder="<?php p($l->t('Groups'))?>"><span class="title groupsList"></span><span class="icon-triangle-s"></span></div></div> |
| 14 | 14 | <input type="submit" class="button" value="<?php p($l->t('Create'))?>" /> |
| 15 | 15 | </form> |
| 16 | - <?php if((bool)$_['recoveryAdminEnabled']): ?> |
|
| 16 | + <?php if ((bool) $_['recoveryAdminEnabled']): ?> |
|
| 17 | 17 | <div class="recoveryPassword"> |
| 18 | 18 | <input id="recoveryPassword" |
| 19 | 19 | type="password" |