@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | */ |
| 58 | 58 | public function execute($jobList, ILogger $logger = null) { |
| 59 | 59 | // add an interval of 15 mins |
| 60 | - $this->setInterval(15*60); |
|
| 60 | + $this->setInterval(15 * 60); |
|
| 61 | 61 | |
| 62 | 62 | $this->jobList = $jobList; |
| 63 | 63 | $this->logger = $logger; |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | try { |
| 91 | 91 | $repair->addStep($step); |
| 92 | 92 | } catch (\Exception $ex) { |
| 93 | - $this->logger->logException($ex,[ |
|
| 93 | + $this->logger->logException($ex, [ |
|
| 94 | 94 | 'app' => 'migration' |
| 95 | 95 | ]); |
| 96 | 96 | |
@@ -37,81 +37,81 @@ |
||
| 37 | 37 | */ |
| 38 | 38 | class BackgroundRepair extends TimedJob { |
| 39 | 39 | |
| 40 | - /** @var IJobList */ |
|
| 41 | - private $jobList; |
|
| 40 | + /** @var IJobList */ |
|
| 41 | + private $jobList; |
|
| 42 | 42 | |
| 43 | - /** @var ILogger */ |
|
| 44 | - private $logger; |
|
| 43 | + /** @var ILogger */ |
|
| 44 | + private $logger; |
|
| 45 | 45 | |
| 46 | - /** @var EventDispatcher */ |
|
| 47 | - private $dispatcher; |
|
| 46 | + /** @var EventDispatcher */ |
|
| 47 | + private $dispatcher; |
|
| 48 | 48 | |
| 49 | - public function setDispatcher(EventDispatcher $dispatcher) { |
|
| 50 | - $this->dispatcher = $dispatcher; |
|
| 51 | - } |
|
| 52 | - /** |
|
| 53 | - * run the job, then remove it from the job list |
|
| 54 | - * |
|
| 55 | - * @param JobList $jobList |
|
| 56 | - * @param ILogger|null $logger |
|
| 57 | - */ |
|
| 58 | - public function execute($jobList, ILogger $logger = null) { |
|
| 59 | - // add an interval of 15 mins |
|
| 60 | - $this->setInterval(15*60); |
|
| 49 | + public function setDispatcher(EventDispatcher $dispatcher) { |
|
| 50 | + $this->dispatcher = $dispatcher; |
|
| 51 | + } |
|
| 52 | + /** |
|
| 53 | + * run the job, then remove it from the job list |
|
| 54 | + * |
|
| 55 | + * @param JobList $jobList |
|
| 56 | + * @param ILogger|null $logger |
|
| 57 | + */ |
|
| 58 | + public function execute($jobList, ILogger $logger = null) { |
|
| 59 | + // add an interval of 15 mins |
|
| 60 | + $this->setInterval(15*60); |
|
| 61 | 61 | |
| 62 | - $this->jobList = $jobList; |
|
| 63 | - $this->logger = $logger; |
|
| 64 | - parent::execute($jobList, $logger); |
|
| 65 | - } |
|
| 62 | + $this->jobList = $jobList; |
|
| 63 | + $this->logger = $logger; |
|
| 64 | + parent::execute($jobList, $logger); |
|
| 65 | + } |
|
| 66 | 66 | |
| 67 | - /** |
|
| 68 | - * @param array $argument |
|
| 69 | - * @throws \Exception |
|
| 70 | - * @throws \OC\NeedsUpdateException |
|
| 71 | - */ |
|
| 72 | - protected function run($argument) { |
|
| 73 | - if (!isset($argument['app']) || !isset($argument['step'])) { |
|
| 74 | - // remove the job - we can never execute it |
|
| 75 | - $this->jobList->remove($this, $this->argument); |
|
| 76 | - return; |
|
| 77 | - } |
|
| 78 | - $app = $argument['app']; |
|
| 67 | + /** |
|
| 68 | + * @param array $argument |
|
| 69 | + * @throws \Exception |
|
| 70 | + * @throws \OC\NeedsUpdateException |
|
| 71 | + */ |
|
| 72 | + protected function run($argument) { |
|
| 73 | + if (!isset($argument['app']) || !isset($argument['step'])) { |
|
| 74 | + // remove the job - we can never execute it |
|
| 75 | + $this->jobList->remove($this, $this->argument); |
|
| 76 | + return; |
|
| 77 | + } |
|
| 78 | + $app = $argument['app']; |
|
| 79 | 79 | |
| 80 | - try { |
|
| 81 | - $this->loadApp($app); |
|
| 82 | - } catch (NeedsUpdateException $ex) { |
|
| 83 | - // as long as the app is not yet done with it's offline migration |
|
| 84 | - // we better not start with the live migration |
|
| 85 | - return; |
|
| 86 | - } |
|
| 80 | + try { |
|
| 81 | + $this->loadApp($app); |
|
| 82 | + } catch (NeedsUpdateException $ex) { |
|
| 83 | + // as long as the app is not yet done with it's offline migration |
|
| 84 | + // we better not start with the live migration |
|
| 85 | + return; |
|
| 86 | + } |
|
| 87 | 87 | |
| 88 | - $step = $argument['step']; |
|
| 89 | - $repair = new Repair([], $this->dispatcher); |
|
| 90 | - try { |
|
| 91 | - $repair->addStep($step); |
|
| 92 | - } catch (\Exception $ex) { |
|
| 93 | - $this->logger->logException($ex,[ |
|
| 94 | - 'app' => 'migration' |
|
| 95 | - ]); |
|
| 88 | + $step = $argument['step']; |
|
| 89 | + $repair = new Repair([], $this->dispatcher); |
|
| 90 | + try { |
|
| 91 | + $repair->addStep($step); |
|
| 92 | + } catch (\Exception $ex) { |
|
| 93 | + $this->logger->logException($ex,[ |
|
| 94 | + 'app' => 'migration' |
|
| 95 | + ]); |
|
| 96 | 96 | |
| 97 | - // remove the job - we can never execute it |
|
| 98 | - $this->jobList->remove($this, $this->argument); |
|
| 99 | - return; |
|
| 100 | - } |
|
| 97 | + // remove the job - we can never execute it |
|
| 98 | + $this->jobList->remove($this, $this->argument); |
|
| 99 | + return; |
|
| 100 | + } |
|
| 101 | 101 | |
| 102 | - // execute the repair step |
|
| 103 | - $repair->run(); |
|
| 102 | + // execute the repair step |
|
| 103 | + $repair->run(); |
|
| 104 | 104 | |
| 105 | - // remove the job once executed successfully |
|
| 106 | - $this->jobList->remove($this, $this->argument); |
|
| 107 | - } |
|
| 105 | + // remove the job once executed successfully |
|
| 106 | + $this->jobList->remove($this, $this->argument); |
|
| 107 | + } |
|
| 108 | 108 | |
| 109 | - /** |
|
| 110 | - * @codeCoverageIgnore |
|
| 111 | - * @param $app |
|
| 112 | - * @throws NeedsUpdateException |
|
| 113 | - */ |
|
| 114 | - protected function loadApp($app) { |
|
| 115 | - OC_App::loadApp($app); |
|
| 116 | - } |
|
| 109 | + /** |
|
| 110 | + * @codeCoverageIgnore |
|
| 111 | + * @param $app |
|
| 112 | + * @throws NeedsUpdateException |
|
| 113 | + */ |
|
| 114 | + protected function loadApp($app) { |
|
| 115 | + OC_App::loadApp($app); |
|
| 116 | + } |
|
| 117 | 117 | } |
@@ -55,7 +55,7 @@ |
||
| 55 | 55 | if ($command instanceof ICommand) { |
| 56 | 56 | // ensure the command can be serialized |
| 57 | 57 | $serialized = serialize($command); |
| 58 | - if(strlen($serialized) > 4000) { |
|
| 58 | + if (strlen($serialized) > 4000) { |
|
| 59 | 59 | throw new \InvalidArgumentException('Trying to push a command which serialized form can not be stored in the database (>4000 character)'); |
| 60 | 60 | } |
| 61 | 61 | $unserialized = unserialize($serialized); |
@@ -26,48 +26,48 @@ |
||
| 26 | 26 | use OCP\Command\ICommand; |
| 27 | 27 | |
| 28 | 28 | class QueueBus implements IBus { |
| 29 | - /** |
|
| 30 | - * @var ICommand[]|callable[] |
|
| 31 | - */ |
|
| 32 | - private $queue = []; |
|
| 29 | + /** |
|
| 30 | + * @var ICommand[]|callable[] |
|
| 31 | + */ |
|
| 32 | + private $queue = []; |
|
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * Schedule a command to be fired |
|
| 36 | - * |
|
| 37 | - * @param \OCP\Command\ICommand | callable $command |
|
| 38 | - */ |
|
| 39 | - public function push($command) { |
|
| 40 | - $this->queue[] = $command; |
|
| 41 | - } |
|
| 34 | + /** |
|
| 35 | + * Schedule a command to be fired |
|
| 36 | + * |
|
| 37 | + * @param \OCP\Command\ICommand | callable $command |
|
| 38 | + */ |
|
| 39 | + public function push($command) { |
|
| 40 | + $this->queue[] = $command; |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | - /** |
|
| 44 | - * Require all commands using a trait to be run synchronous |
|
| 45 | - * |
|
| 46 | - * @param string $trait |
|
| 47 | - */ |
|
| 48 | - public function requireSync($trait) { |
|
| 49 | - } |
|
| 43 | + /** |
|
| 44 | + * Require all commands using a trait to be run synchronous |
|
| 45 | + * |
|
| 46 | + * @param string $trait |
|
| 47 | + */ |
|
| 48 | + public function requireSync($trait) { |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | - /** |
|
| 52 | - * @param \OCP\Command\ICommand | callable $command |
|
| 53 | - */ |
|
| 54 | - private function runCommand($command) { |
|
| 55 | - if ($command instanceof ICommand) { |
|
| 56 | - // ensure the command can be serialized |
|
| 57 | - $serialized = serialize($command); |
|
| 58 | - if(strlen($serialized) > 4000) { |
|
| 59 | - throw new \InvalidArgumentException('Trying to push a command which serialized form can not be stored in the database (>4000 character)'); |
|
| 60 | - } |
|
| 61 | - $unserialized = unserialize($serialized); |
|
| 62 | - $unserialized->handle(); |
|
| 63 | - } else { |
|
| 64 | - $command(); |
|
| 65 | - } |
|
| 66 | - } |
|
| 51 | + /** |
|
| 52 | + * @param \OCP\Command\ICommand | callable $command |
|
| 53 | + */ |
|
| 54 | + private function runCommand($command) { |
|
| 55 | + if ($command instanceof ICommand) { |
|
| 56 | + // ensure the command can be serialized |
|
| 57 | + $serialized = serialize($command); |
|
| 58 | + if(strlen($serialized) > 4000) { |
|
| 59 | + throw new \InvalidArgumentException('Trying to push a command which serialized form can not be stored in the database (>4000 character)'); |
|
| 60 | + } |
|
| 61 | + $unserialized = unserialize($serialized); |
|
| 62 | + $unserialized->handle(); |
|
| 63 | + } else { |
|
| 64 | + $command(); |
|
| 65 | + } |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | - public function run() { |
|
| 69 | - while ($command = array_shift($this->queue)) { |
|
| 70 | - $this->runCommand($command); |
|
| 71 | - } |
|
| 72 | - } |
|
| 68 | + public function run() { |
|
| 69 | + while ($command = array_shift($this->queue)) { |
|
| 70 | + $this->runCommand($command); |
|
| 71 | + } |
|
| 72 | + } |
|
| 73 | 73 | } |
@@ -25,12 +25,12 @@ |
||
| 25 | 25 | use OC\BackgroundJob\QueuedJob; |
| 26 | 26 | |
| 27 | 27 | class CallableJob extends QueuedJob { |
| 28 | - protected function run($serializedCallable) { |
|
| 29 | - $callable = unserialize($serializedCallable); |
|
| 30 | - if (is_callable($callable)) { |
|
| 31 | - $callable(); |
|
| 32 | - } else { |
|
| 33 | - throw new \InvalidArgumentException('Invalid serialized callable'); |
|
| 34 | - } |
|
| 35 | - } |
|
| 28 | + protected function run($serializedCallable) { |
|
| 29 | + $callable = unserialize($serializedCallable); |
|
| 30 | + if (is_callable($callable)) { |
|
| 31 | + $callable(); |
|
| 32 | + } else { |
|
| 33 | + throw new \InvalidArgumentException('Invalid serialized callable'); |
|
| 34 | + } |
|
| 35 | + } |
|
| 36 | 36 | } |
@@ -26,13 +26,13 @@ |
||
| 26 | 26 | use SuperClosure\Serializer; |
| 27 | 27 | |
| 28 | 28 | class ClosureJob extends QueuedJob { |
| 29 | - protected function run($serializedCallable) { |
|
| 30 | - $serializer = new Serializer(); |
|
| 31 | - $callable = $serializer->unserialize($serializedCallable); |
|
| 32 | - if (is_callable($callable)) { |
|
| 33 | - $callable(); |
|
| 34 | - } else { |
|
| 35 | - throw new \InvalidArgumentException('Invalid serialized callable'); |
|
| 36 | - } |
|
| 37 | - } |
|
| 29 | + protected function run($serializedCallable) { |
|
| 30 | + $serializer = new Serializer(); |
|
| 31 | + $callable = $serializer->unserialize($serializedCallable); |
|
| 32 | + if (is_callable($callable)) { |
|
| 33 | + $callable(); |
|
| 34 | + } else { |
|
| 35 | + throw new \InvalidArgumentException('Invalid serialized callable'); |
|
| 36 | + } |
|
| 37 | + } |
|
| 38 | 38 | } |
@@ -25,12 +25,12 @@ |
||
| 25 | 25 | use OCP\IUser; |
| 26 | 26 | |
| 27 | 27 | trait FileAccess { |
| 28 | - protected function setupFS(IUser $user){ |
|
| 29 | - \OC_Util::setupFS($user->getUID()); |
|
| 30 | - } |
|
| 28 | + protected function setupFS(IUser $user){ |
|
| 29 | + \OC_Util::setupFS($user->getUID()); |
|
| 30 | + } |
|
| 31 | 31 | |
| 32 | - protected function getUserFolder(IUser $user) { |
|
| 33 | - $this->setupFS($user); |
|
| 34 | - return \OC::$server->getUserFolder($user->getUID()); |
|
| 35 | - } |
|
| 32 | + protected function getUserFolder(IUser $user) { |
|
| 33 | + $this->setupFS($user); |
|
| 34 | + return \OC::$server->getUserFolder($user->getUID()); |
|
| 35 | + } |
|
| 36 | 36 | } |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | use OCP\IUser; |
| 26 | 26 | |
| 27 | 27 | trait FileAccess { |
| 28 | - protected function setupFS(IUser $user){ |
|
| 28 | + protected function setupFS(IUser $user) { |
|
| 29 | 29 | \OC_Util::setupFS($user->getUID()); |
| 30 | 30 | } |
| 31 | 31 | |
@@ -29,12 +29,12 @@ |
||
| 29 | 29 | * Wrap a command in the background job interface |
| 30 | 30 | */ |
| 31 | 31 | class CommandJob extends QueuedJob { |
| 32 | - protected function run($serializedCommand) { |
|
| 33 | - $command = unserialize($serializedCommand); |
|
| 34 | - if ($command instanceof ICommand) { |
|
| 35 | - $command->handle(); |
|
| 36 | - } else { |
|
| 37 | - throw new \InvalidArgumentException('Invalid serialized command'); |
|
| 38 | - } |
|
| 39 | - } |
|
| 32 | + protected function run($serializedCommand) { |
|
| 33 | + $command = unserialize($serializedCommand); |
|
| 34 | + if ($command instanceof ICommand) { |
|
| 35 | + $command->handle(); |
|
| 36 | + } else { |
|
| 37 | + throw new \InvalidArgumentException('Invalid serialized command'); |
|
| 38 | + } |
|
| 39 | + } |
|
| 40 | 40 | } |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | $apps = $this->appManager->getEnabledAppsForUser($this->currentUser); |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | - foreach($apps as $app) { |
|
| 111 | + foreach ($apps as $app) { |
|
| 112 | 112 | $apps_paths[$app] = \OC_App::getAppWebPath($app); |
| 113 | 113 | } |
| 114 | 114 | |
@@ -121,8 +121,8 @@ discard block |
||
| 121 | 121 | $outgoingServer2serverShareEnabled = $this->config->getAppValue('files_sharing', 'outgoing_server2server_share_enabled', 'yes') === 'yes'; |
| 122 | 122 | |
| 123 | 123 | $countOfDataLocation = 0; |
| 124 | - $dataLocation = str_replace(\OC::$SERVERROOT .'/', '', $this->config->getSystemValue('datadirectory', ''), $countOfDataLocation); |
|
| 125 | - if($countOfDataLocation !== 1 || !$this->groupManager->isAdmin($uid)) { |
|
| 124 | + $dataLocation = str_replace(\OC::$SERVERROOT.'/', '', $this->config->getSystemValue('datadirectory', ''), $countOfDataLocation); |
|
| 125 | + if ($countOfDataLocation !== 1 || !$this->groupManager->isAdmin($uid)) { |
|
| 126 | 126 | $dataLocation = false; |
| 127 | 127 | } |
| 128 | 128 | |
@@ -144,61 +144,61 @@ discard block |
||
| 144 | 144 | "datepickerFormatDate" => json_encode($this->l->l('jsdate', null)), |
| 145 | 145 | 'nc_lastLogin' => $lastConfirmTimestamp, |
| 146 | 146 | "dayNames" => json_encode([ |
| 147 | - (string)$this->l->t('Sunday'), |
|
| 148 | - (string)$this->l->t('Monday'), |
|
| 149 | - (string)$this->l->t('Tuesday'), |
|
| 150 | - (string)$this->l->t('Wednesday'), |
|
| 151 | - (string)$this->l->t('Thursday'), |
|
| 152 | - (string)$this->l->t('Friday'), |
|
| 153 | - (string)$this->l->t('Saturday') |
|
| 147 | + (string) $this->l->t('Sunday'), |
|
| 148 | + (string) $this->l->t('Monday'), |
|
| 149 | + (string) $this->l->t('Tuesday'), |
|
| 150 | + (string) $this->l->t('Wednesday'), |
|
| 151 | + (string) $this->l->t('Thursday'), |
|
| 152 | + (string) $this->l->t('Friday'), |
|
| 153 | + (string) $this->l->t('Saturday') |
|
| 154 | 154 | ]), |
| 155 | 155 | "dayNamesShort" => json_encode([ |
| 156 | - (string)$this->l->t('Sun.'), |
|
| 157 | - (string)$this->l->t('Mon.'), |
|
| 158 | - (string)$this->l->t('Tue.'), |
|
| 159 | - (string)$this->l->t('Wed.'), |
|
| 160 | - (string)$this->l->t('Thu.'), |
|
| 161 | - (string)$this->l->t('Fri.'), |
|
| 162 | - (string)$this->l->t('Sat.') |
|
| 156 | + (string) $this->l->t('Sun.'), |
|
| 157 | + (string) $this->l->t('Mon.'), |
|
| 158 | + (string) $this->l->t('Tue.'), |
|
| 159 | + (string) $this->l->t('Wed.'), |
|
| 160 | + (string) $this->l->t('Thu.'), |
|
| 161 | + (string) $this->l->t('Fri.'), |
|
| 162 | + (string) $this->l->t('Sat.') |
|
| 163 | 163 | ]), |
| 164 | 164 | "dayNamesMin" => json_encode([ |
| 165 | - (string)$this->l->t('Su'), |
|
| 166 | - (string)$this->l->t('Mo'), |
|
| 167 | - (string)$this->l->t('Tu'), |
|
| 168 | - (string)$this->l->t('We'), |
|
| 169 | - (string)$this->l->t('Th'), |
|
| 170 | - (string)$this->l->t('Fr'), |
|
| 171 | - (string)$this->l->t('Sa') |
|
| 165 | + (string) $this->l->t('Su'), |
|
| 166 | + (string) $this->l->t('Mo'), |
|
| 167 | + (string) $this->l->t('Tu'), |
|
| 168 | + (string) $this->l->t('We'), |
|
| 169 | + (string) $this->l->t('Th'), |
|
| 170 | + (string) $this->l->t('Fr'), |
|
| 171 | + (string) $this->l->t('Sa') |
|
| 172 | 172 | ]), |
| 173 | 173 | "monthNames" => json_encode([ |
| 174 | - (string)$this->l->t('January'), |
|
| 175 | - (string)$this->l->t('February'), |
|
| 176 | - (string)$this->l->t('March'), |
|
| 177 | - (string)$this->l->t('April'), |
|
| 178 | - (string)$this->l->t('May'), |
|
| 179 | - (string)$this->l->t('June'), |
|
| 180 | - (string)$this->l->t('July'), |
|
| 181 | - (string)$this->l->t('August'), |
|
| 182 | - (string)$this->l->t('September'), |
|
| 183 | - (string)$this->l->t('October'), |
|
| 184 | - (string)$this->l->t('November'), |
|
| 185 | - (string)$this->l->t('December') |
|
| 174 | + (string) $this->l->t('January'), |
|
| 175 | + (string) $this->l->t('February'), |
|
| 176 | + (string) $this->l->t('March'), |
|
| 177 | + (string) $this->l->t('April'), |
|
| 178 | + (string) $this->l->t('May'), |
|
| 179 | + (string) $this->l->t('June'), |
|
| 180 | + (string) $this->l->t('July'), |
|
| 181 | + (string) $this->l->t('August'), |
|
| 182 | + (string) $this->l->t('September'), |
|
| 183 | + (string) $this->l->t('October'), |
|
| 184 | + (string) $this->l->t('November'), |
|
| 185 | + (string) $this->l->t('December') |
|
| 186 | 186 | ]), |
| 187 | 187 | "monthNamesShort" => json_encode([ |
| 188 | - (string)$this->l->t('Jan.'), |
|
| 189 | - (string)$this->l->t('Feb.'), |
|
| 190 | - (string)$this->l->t('Mar.'), |
|
| 191 | - (string)$this->l->t('Apr.'), |
|
| 192 | - (string)$this->l->t('May.'), |
|
| 193 | - (string)$this->l->t('Jun.'), |
|
| 194 | - (string)$this->l->t('Jul.'), |
|
| 195 | - (string)$this->l->t('Aug.'), |
|
| 196 | - (string)$this->l->t('Sep.'), |
|
| 197 | - (string)$this->l->t('Oct.'), |
|
| 198 | - (string)$this->l->t('Nov.'), |
|
| 199 | - (string)$this->l->t('Dec.') |
|
| 188 | + (string) $this->l->t('Jan.'), |
|
| 189 | + (string) $this->l->t('Feb.'), |
|
| 190 | + (string) $this->l->t('Mar.'), |
|
| 191 | + (string) $this->l->t('Apr.'), |
|
| 192 | + (string) $this->l->t('May.'), |
|
| 193 | + (string) $this->l->t('Jun.'), |
|
| 194 | + (string) $this->l->t('Jul.'), |
|
| 195 | + (string) $this->l->t('Aug.'), |
|
| 196 | + (string) $this->l->t('Sep.'), |
|
| 197 | + (string) $this->l->t('Oct.'), |
|
| 198 | + (string) $this->l->t('Nov.'), |
|
| 199 | + (string) $this->l->t('Dec.') |
|
| 200 | 200 | ]), |
| 201 | - "firstDay" => json_encode($this->l->l('firstday', null)) , |
|
| 201 | + "firstDay" => json_encode($this->l->l('firstday', null)), |
|
| 202 | 202 | "oc_config" => json_encode([ |
| 203 | 203 | 'session_lifetime' => min($this->config->getSystemValue('session_lifetime', $this->iniWrapper->getNumeric('session.gc_maxlifetime')), $this->iniWrapper->getNumeric('session.gc_maxlifetime')), |
| 204 | 204 | 'session_keepalive' => $this->config->getSystemValue('session_keepalive', true), |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | if ($this->currentUser !== null) { |
| 241 | 241 | $array['oc_userconfig'] = json_encode([ |
| 242 | 242 | 'avatar' => [ |
| 243 | - 'version' => (int)$this->config->getUserValue($uid, 'avatar', 'version', 0), |
|
| 243 | + 'version' => (int) $this->config->getUserValue($uid, 'avatar', 'version', 0), |
|
| 244 | 244 | ] |
| 245 | 245 | ]); |
| 246 | 246 | } |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | |
| 253 | 253 | // Echo it |
| 254 | 254 | foreach ($array as $setting => $value) { |
| 255 | - $result .= 'var '. $setting . '='. $value . ';' . PHP_EOL; |
|
| 255 | + $result .= 'var '.$setting.'='.$value.';'.PHP_EOL; |
|
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | return $result; |
@@ -34,235 +34,235 @@ |
||
| 34 | 34 | |
| 35 | 35 | class JSConfigHelper { |
| 36 | 36 | |
| 37 | - /** @var IL10N */ |
|
| 38 | - private $l; |
|
| 37 | + /** @var IL10N */ |
|
| 38 | + private $l; |
|
| 39 | 39 | |
| 40 | - /** @var Defaults */ |
|
| 41 | - private $defaults; |
|
| 40 | + /** @var Defaults */ |
|
| 41 | + private $defaults; |
|
| 42 | 42 | |
| 43 | - /** @var IAppManager */ |
|
| 44 | - private $appManager; |
|
| 43 | + /** @var IAppManager */ |
|
| 44 | + private $appManager; |
|
| 45 | 45 | |
| 46 | - /** @var ISession */ |
|
| 47 | - private $session; |
|
| 46 | + /** @var ISession */ |
|
| 47 | + private $session; |
|
| 48 | 48 | |
| 49 | - /** @var IUser|null */ |
|
| 50 | - private $currentUser; |
|
| 49 | + /** @var IUser|null */ |
|
| 50 | + private $currentUser; |
|
| 51 | 51 | |
| 52 | - /** @var IConfig */ |
|
| 53 | - private $config; |
|
| 52 | + /** @var IConfig */ |
|
| 53 | + private $config; |
|
| 54 | 54 | |
| 55 | - /** @var IGroupManager */ |
|
| 56 | - private $groupManager; |
|
| 55 | + /** @var IGroupManager */ |
|
| 56 | + private $groupManager; |
|
| 57 | 57 | |
| 58 | - /** @var IniGetWrapper */ |
|
| 59 | - private $iniWrapper; |
|
| 58 | + /** @var IniGetWrapper */ |
|
| 59 | + private $iniWrapper; |
|
| 60 | 60 | |
| 61 | - /** @var IURLGenerator */ |
|
| 62 | - private $urlGenerator; |
|
| 61 | + /** @var IURLGenerator */ |
|
| 62 | + private $urlGenerator; |
|
| 63 | 63 | |
| 64 | - /** |
|
| 65 | - * @param IL10N $l |
|
| 66 | - * @param Defaults $defaults |
|
| 67 | - * @param IAppManager $appManager |
|
| 68 | - * @param ISession $session |
|
| 69 | - * @param IUser|null $currentUser |
|
| 70 | - * @param IConfig $config |
|
| 71 | - * @param IGroupManager $groupManager |
|
| 72 | - * @param IniGetWrapper $iniWrapper |
|
| 73 | - * @param IURLGenerator $urlGenerator |
|
| 74 | - */ |
|
| 75 | - public function __construct(IL10N $l, |
|
| 76 | - Defaults $defaults, |
|
| 77 | - IAppManager $appManager, |
|
| 78 | - ISession $session, |
|
| 79 | - $currentUser, |
|
| 80 | - IConfig $config, |
|
| 81 | - IGroupManager $groupManager, |
|
| 82 | - IniGetWrapper $iniWrapper, |
|
| 83 | - IURLGenerator $urlGenerator) { |
|
| 84 | - $this->l = $l; |
|
| 85 | - $this->defaults = $defaults; |
|
| 86 | - $this->appManager = $appManager; |
|
| 87 | - $this->session = $session; |
|
| 88 | - $this->currentUser = $currentUser; |
|
| 89 | - $this->config = $config; |
|
| 90 | - $this->groupManager = $groupManager; |
|
| 91 | - $this->iniWrapper = $iniWrapper; |
|
| 92 | - $this->urlGenerator = $urlGenerator; |
|
| 93 | - } |
|
| 64 | + /** |
|
| 65 | + * @param IL10N $l |
|
| 66 | + * @param Defaults $defaults |
|
| 67 | + * @param IAppManager $appManager |
|
| 68 | + * @param ISession $session |
|
| 69 | + * @param IUser|null $currentUser |
|
| 70 | + * @param IConfig $config |
|
| 71 | + * @param IGroupManager $groupManager |
|
| 72 | + * @param IniGetWrapper $iniWrapper |
|
| 73 | + * @param IURLGenerator $urlGenerator |
|
| 74 | + */ |
|
| 75 | + public function __construct(IL10N $l, |
|
| 76 | + Defaults $defaults, |
|
| 77 | + IAppManager $appManager, |
|
| 78 | + ISession $session, |
|
| 79 | + $currentUser, |
|
| 80 | + IConfig $config, |
|
| 81 | + IGroupManager $groupManager, |
|
| 82 | + IniGetWrapper $iniWrapper, |
|
| 83 | + IURLGenerator $urlGenerator) { |
|
| 84 | + $this->l = $l; |
|
| 85 | + $this->defaults = $defaults; |
|
| 86 | + $this->appManager = $appManager; |
|
| 87 | + $this->session = $session; |
|
| 88 | + $this->currentUser = $currentUser; |
|
| 89 | + $this->config = $config; |
|
| 90 | + $this->groupManager = $groupManager; |
|
| 91 | + $this->iniWrapper = $iniWrapper; |
|
| 92 | + $this->urlGenerator = $urlGenerator; |
|
| 93 | + } |
|
| 94 | 94 | |
| 95 | - public function getConfig() { |
|
| 95 | + public function getConfig() { |
|
| 96 | 96 | |
| 97 | - if ($this->currentUser !== null) { |
|
| 98 | - $uid = $this->currentUser->getUID(); |
|
| 99 | - } else { |
|
| 100 | - $uid = null; |
|
| 101 | - } |
|
| 97 | + if ($this->currentUser !== null) { |
|
| 98 | + $uid = $this->currentUser->getUID(); |
|
| 99 | + } else { |
|
| 100 | + $uid = null; |
|
| 101 | + } |
|
| 102 | 102 | |
| 103 | - // Get the config |
|
| 104 | - $apps_paths = []; |
|
| 103 | + // Get the config |
|
| 104 | + $apps_paths = []; |
|
| 105 | 105 | |
| 106 | - if ($this->currentUser === null) { |
|
| 107 | - $apps = $this->appManager->getInstalledApps(); |
|
| 108 | - } else { |
|
| 109 | - $apps = $this->appManager->getEnabledAppsForUser($this->currentUser); |
|
| 110 | - } |
|
| 106 | + if ($this->currentUser === null) { |
|
| 107 | + $apps = $this->appManager->getInstalledApps(); |
|
| 108 | + } else { |
|
| 109 | + $apps = $this->appManager->getEnabledAppsForUser($this->currentUser); |
|
| 110 | + } |
|
| 111 | 111 | |
| 112 | - foreach($apps as $app) { |
|
| 113 | - $apps_paths[$app] = \OC_App::getAppWebPath($app); |
|
| 114 | - } |
|
| 112 | + foreach($apps as $app) { |
|
| 113 | + $apps_paths[$app] = \OC_App::getAppWebPath($app); |
|
| 114 | + } |
|
| 115 | 115 | |
| 116 | 116 | |
| 117 | - $enableLinkPasswordByDefault = $this->config->getAppValue('core', 'shareapi_enable_link_password_by_default', 'no'); |
|
| 118 | - $enableLinkPasswordByDefault = ($enableLinkPasswordByDefault === 'yes') ? true : false; |
|
| 119 | - $defaultExpireDateEnabled = $this->config->getAppValue('core', 'shareapi_default_expire_date', 'no') === 'yes'; |
|
| 120 | - $defaultExpireDate = $enforceDefaultExpireDate = null; |
|
| 121 | - if ($defaultExpireDateEnabled) { |
|
| 122 | - $defaultExpireDate = (int) $this->config->getAppValue('core', 'shareapi_expire_after_n_days', '7'); |
|
| 123 | - $enforceDefaultExpireDate = $this->config->getAppValue('core', 'shareapi_enforce_expire_date', 'no') === 'yes'; |
|
| 124 | - } |
|
| 125 | - $outgoingServer2serverShareEnabled = $this->config->getAppValue('files_sharing', 'outgoing_server2server_share_enabled', 'yes') === 'yes'; |
|
| 117 | + $enableLinkPasswordByDefault = $this->config->getAppValue('core', 'shareapi_enable_link_password_by_default', 'no'); |
|
| 118 | + $enableLinkPasswordByDefault = ($enableLinkPasswordByDefault === 'yes') ? true : false; |
|
| 119 | + $defaultExpireDateEnabled = $this->config->getAppValue('core', 'shareapi_default_expire_date', 'no') === 'yes'; |
|
| 120 | + $defaultExpireDate = $enforceDefaultExpireDate = null; |
|
| 121 | + if ($defaultExpireDateEnabled) { |
|
| 122 | + $defaultExpireDate = (int) $this->config->getAppValue('core', 'shareapi_expire_after_n_days', '7'); |
|
| 123 | + $enforceDefaultExpireDate = $this->config->getAppValue('core', 'shareapi_enforce_expire_date', 'no') === 'yes'; |
|
| 124 | + } |
|
| 125 | + $outgoingServer2serverShareEnabled = $this->config->getAppValue('files_sharing', 'outgoing_server2server_share_enabled', 'yes') === 'yes'; |
|
| 126 | 126 | |
| 127 | - $countOfDataLocation = 0; |
|
| 128 | - $dataLocation = str_replace(\OC::$SERVERROOT .'/', '', $this->config->getSystemValue('datadirectory', ''), $countOfDataLocation); |
|
| 129 | - if($countOfDataLocation !== 1 || !$this->groupManager->isAdmin($uid)) { |
|
| 130 | - $dataLocation = false; |
|
| 131 | - } |
|
| 127 | + $countOfDataLocation = 0; |
|
| 128 | + $dataLocation = str_replace(\OC::$SERVERROOT .'/', '', $this->config->getSystemValue('datadirectory', ''), $countOfDataLocation); |
|
| 129 | + if($countOfDataLocation !== 1 || !$this->groupManager->isAdmin($uid)) { |
|
| 130 | + $dataLocation = false; |
|
| 131 | + } |
|
| 132 | 132 | |
| 133 | - if ($this->currentUser instanceof IUser) { |
|
| 134 | - $lastConfirmTimestamp = $this->session->get('last-password-confirm'); |
|
| 135 | - if (!is_int($lastConfirmTimestamp)) { |
|
| 136 | - $lastConfirmTimestamp = 0; |
|
| 137 | - } |
|
| 138 | - } else { |
|
| 139 | - $lastConfirmTimestamp = 0; |
|
| 140 | - } |
|
| 133 | + if ($this->currentUser instanceof IUser) { |
|
| 134 | + $lastConfirmTimestamp = $this->session->get('last-password-confirm'); |
|
| 135 | + if (!is_int($lastConfirmTimestamp)) { |
|
| 136 | + $lastConfirmTimestamp = 0; |
|
| 137 | + } |
|
| 138 | + } else { |
|
| 139 | + $lastConfirmTimestamp = 0; |
|
| 140 | + } |
|
| 141 | 141 | |
| 142 | - $array = [ |
|
| 143 | - "oc_debug" => $this->config->getSystemValue('debug', false) ? 'true' : 'false', |
|
| 144 | - "oc_isadmin" => $this->groupManager->isAdmin($uid) ? 'true' : 'false', |
|
| 145 | - "oc_dataURL" => is_string($dataLocation) ? "\"".$dataLocation."\"" : 'false', |
|
| 146 | - "oc_webroot" => "\"".\OC::$WEBROOT."\"", |
|
| 147 | - "oc_appswebroots" => str_replace('\\/', '/', json_encode($apps_paths)), // Ugly unescape slashes waiting for better solution |
|
| 148 | - "datepickerFormatDate" => json_encode($this->l->l('jsdate', null)), |
|
| 149 | - 'nc_lastLogin' => $lastConfirmTimestamp, |
|
| 150 | - "dayNames" => json_encode([ |
|
| 151 | - (string)$this->l->t('Sunday'), |
|
| 152 | - (string)$this->l->t('Monday'), |
|
| 153 | - (string)$this->l->t('Tuesday'), |
|
| 154 | - (string)$this->l->t('Wednesday'), |
|
| 155 | - (string)$this->l->t('Thursday'), |
|
| 156 | - (string)$this->l->t('Friday'), |
|
| 157 | - (string)$this->l->t('Saturday') |
|
| 158 | - ]), |
|
| 159 | - "dayNamesShort" => json_encode([ |
|
| 160 | - (string)$this->l->t('Sun.'), |
|
| 161 | - (string)$this->l->t('Mon.'), |
|
| 162 | - (string)$this->l->t('Tue.'), |
|
| 163 | - (string)$this->l->t('Wed.'), |
|
| 164 | - (string)$this->l->t('Thu.'), |
|
| 165 | - (string)$this->l->t('Fri.'), |
|
| 166 | - (string)$this->l->t('Sat.') |
|
| 167 | - ]), |
|
| 168 | - "dayNamesMin" => json_encode([ |
|
| 169 | - (string)$this->l->t('Su'), |
|
| 170 | - (string)$this->l->t('Mo'), |
|
| 171 | - (string)$this->l->t('Tu'), |
|
| 172 | - (string)$this->l->t('We'), |
|
| 173 | - (string)$this->l->t('Th'), |
|
| 174 | - (string)$this->l->t('Fr'), |
|
| 175 | - (string)$this->l->t('Sa') |
|
| 176 | - ]), |
|
| 177 | - "monthNames" => json_encode([ |
|
| 178 | - (string)$this->l->t('January'), |
|
| 179 | - (string)$this->l->t('February'), |
|
| 180 | - (string)$this->l->t('March'), |
|
| 181 | - (string)$this->l->t('April'), |
|
| 182 | - (string)$this->l->t('May'), |
|
| 183 | - (string)$this->l->t('June'), |
|
| 184 | - (string)$this->l->t('July'), |
|
| 185 | - (string)$this->l->t('August'), |
|
| 186 | - (string)$this->l->t('September'), |
|
| 187 | - (string)$this->l->t('October'), |
|
| 188 | - (string)$this->l->t('November'), |
|
| 189 | - (string)$this->l->t('December') |
|
| 190 | - ]), |
|
| 191 | - "monthNamesShort" => json_encode([ |
|
| 192 | - (string)$this->l->t('Jan.'), |
|
| 193 | - (string)$this->l->t('Feb.'), |
|
| 194 | - (string)$this->l->t('Mar.'), |
|
| 195 | - (string)$this->l->t('Apr.'), |
|
| 196 | - (string)$this->l->t('May.'), |
|
| 197 | - (string)$this->l->t('Jun.'), |
|
| 198 | - (string)$this->l->t('Jul.'), |
|
| 199 | - (string)$this->l->t('Aug.'), |
|
| 200 | - (string)$this->l->t('Sep.'), |
|
| 201 | - (string)$this->l->t('Oct.'), |
|
| 202 | - (string)$this->l->t('Nov.'), |
|
| 203 | - (string)$this->l->t('Dec.') |
|
| 204 | - ]), |
|
| 205 | - "firstDay" => json_encode($this->l->l('firstday', null)) , |
|
| 206 | - "oc_config" => json_encode([ |
|
| 207 | - 'session_lifetime' => min($this->config->getSystemValue('session_lifetime', $this->iniWrapper->getNumeric('session.gc_maxlifetime')), $this->iniWrapper->getNumeric('session.gc_maxlifetime')), |
|
| 208 | - 'session_keepalive' => $this->config->getSystemValue('session_keepalive', true), |
|
| 209 | - 'version' => implode('.', \OCP\Util::getVersion()), |
|
| 210 | - 'versionstring' => \OC_Util::getVersionString(), |
|
| 211 | - 'enable_avatars' => true, // here for legacy reasons - to not crash existing code that relies on this value |
|
| 212 | - 'lost_password_link'=> $this->config->getSystemValue('lost_password_link', null), |
|
| 213 | - 'modRewriteWorking' => ($this->config->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true'), |
|
| 214 | - 'sharing.maxAutocompleteResults' => intval($this->config->getSystemValue('sharing.maxAutocompleteResults', 0)), |
|
| 215 | - 'sharing.minSearchStringLength' => intval($this->config->getSystemValue('sharing.minSearchStringLength', 0)), |
|
| 216 | - 'blacklist_files_regex' => \OCP\Files\FileInfo::BLACKLIST_FILES_REGEX, |
|
| 217 | - ]), |
|
| 218 | - "oc_appconfig" => json_encode([ |
|
| 219 | - 'core' => [ |
|
| 220 | - 'defaultExpireDateEnabled' => $defaultExpireDateEnabled, |
|
| 221 | - 'defaultExpireDate' => $defaultExpireDate, |
|
| 222 | - 'defaultExpireDateEnforced' => $enforceDefaultExpireDate, |
|
| 223 | - 'enforcePasswordForPublicLink' => \OCP\Util::isPublicLinkPasswordRequired(), |
|
| 224 | - 'enableLinkPasswordByDefault' => $enableLinkPasswordByDefault, |
|
| 225 | - 'sharingDisabledForUser' => \OCP\Util::isSharingDisabledForUser(), |
|
| 226 | - 'resharingAllowed' => \OC\Share\Share::isResharingAllowed(), |
|
| 227 | - 'remoteShareAllowed' => $outgoingServer2serverShareEnabled, |
|
| 228 | - 'federatedCloudShareDoc' => $this->urlGenerator->linkToDocs('user-sharing-federated'), |
|
| 229 | - 'allowGroupSharing' => \OC::$server->getShareManager()->allowGroupSharing() |
|
| 230 | - ] |
|
| 231 | - ]), |
|
| 232 | - "oc_defaults" => json_encode([ |
|
| 233 | - 'entity' => $this->defaults->getEntity(), |
|
| 234 | - 'name' => $this->defaults->getName(), |
|
| 235 | - 'title' => $this->defaults->getTitle(), |
|
| 236 | - 'baseUrl' => $this->defaults->getBaseUrl(), |
|
| 237 | - 'syncClientUrl' => $this->defaults->getSyncClientUrl(), |
|
| 238 | - 'docBaseUrl' => $this->defaults->getDocBaseUrl(), |
|
| 239 | - 'docPlaceholderUrl' => $this->defaults->buildDocLinkToKey('PLACEHOLDER'), |
|
| 240 | - 'slogan' => $this->defaults->getSlogan(), |
|
| 241 | - 'logoClaim' => '', |
|
| 242 | - 'shortFooter' => $this->defaults->getShortFooter(), |
|
| 243 | - 'longFooter' => $this->defaults->getLongFooter(), |
|
| 244 | - 'folder' => \OC_Util::getTheme(), |
|
| 245 | - ]), |
|
| 246 | - ]; |
|
| 142 | + $array = [ |
|
| 143 | + "oc_debug" => $this->config->getSystemValue('debug', false) ? 'true' : 'false', |
|
| 144 | + "oc_isadmin" => $this->groupManager->isAdmin($uid) ? 'true' : 'false', |
|
| 145 | + "oc_dataURL" => is_string($dataLocation) ? "\"".$dataLocation."\"" : 'false', |
|
| 146 | + "oc_webroot" => "\"".\OC::$WEBROOT."\"", |
|
| 147 | + "oc_appswebroots" => str_replace('\\/', '/', json_encode($apps_paths)), // Ugly unescape slashes waiting for better solution |
|
| 148 | + "datepickerFormatDate" => json_encode($this->l->l('jsdate', null)), |
|
| 149 | + 'nc_lastLogin' => $lastConfirmTimestamp, |
|
| 150 | + "dayNames" => json_encode([ |
|
| 151 | + (string)$this->l->t('Sunday'), |
|
| 152 | + (string)$this->l->t('Monday'), |
|
| 153 | + (string)$this->l->t('Tuesday'), |
|
| 154 | + (string)$this->l->t('Wednesday'), |
|
| 155 | + (string)$this->l->t('Thursday'), |
|
| 156 | + (string)$this->l->t('Friday'), |
|
| 157 | + (string)$this->l->t('Saturday') |
|
| 158 | + ]), |
|
| 159 | + "dayNamesShort" => json_encode([ |
|
| 160 | + (string)$this->l->t('Sun.'), |
|
| 161 | + (string)$this->l->t('Mon.'), |
|
| 162 | + (string)$this->l->t('Tue.'), |
|
| 163 | + (string)$this->l->t('Wed.'), |
|
| 164 | + (string)$this->l->t('Thu.'), |
|
| 165 | + (string)$this->l->t('Fri.'), |
|
| 166 | + (string)$this->l->t('Sat.') |
|
| 167 | + ]), |
|
| 168 | + "dayNamesMin" => json_encode([ |
|
| 169 | + (string)$this->l->t('Su'), |
|
| 170 | + (string)$this->l->t('Mo'), |
|
| 171 | + (string)$this->l->t('Tu'), |
|
| 172 | + (string)$this->l->t('We'), |
|
| 173 | + (string)$this->l->t('Th'), |
|
| 174 | + (string)$this->l->t('Fr'), |
|
| 175 | + (string)$this->l->t('Sa') |
|
| 176 | + ]), |
|
| 177 | + "monthNames" => json_encode([ |
|
| 178 | + (string)$this->l->t('January'), |
|
| 179 | + (string)$this->l->t('February'), |
|
| 180 | + (string)$this->l->t('March'), |
|
| 181 | + (string)$this->l->t('April'), |
|
| 182 | + (string)$this->l->t('May'), |
|
| 183 | + (string)$this->l->t('June'), |
|
| 184 | + (string)$this->l->t('July'), |
|
| 185 | + (string)$this->l->t('August'), |
|
| 186 | + (string)$this->l->t('September'), |
|
| 187 | + (string)$this->l->t('October'), |
|
| 188 | + (string)$this->l->t('November'), |
|
| 189 | + (string)$this->l->t('December') |
|
| 190 | + ]), |
|
| 191 | + "monthNamesShort" => json_encode([ |
|
| 192 | + (string)$this->l->t('Jan.'), |
|
| 193 | + (string)$this->l->t('Feb.'), |
|
| 194 | + (string)$this->l->t('Mar.'), |
|
| 195 | + (string)$this->l->t('Apr.'), |
|
| 196 | + (string)$this->l->t('May.'), |
|
| 197 | + (string)$this->l->t('Jun.'), |
|
| 198 | + (string)$this->l->t('Jul.'), |
|
| 199 | + (string)$this->l->t('Aug.'), |
|
| 200 | + (string)$this->l->t('Sep.'), |
|
| 201 | + (string)$this->l->t('Oct.'), |
|
| 202 | + (string)$this->l->t('Nov.'), |
|
| 203 | + (string)$this->l->t('Dec.') |
|
| 204 | + ]), |
|
| 205 | + "firstDay" => json_encode($this->l->l('firstday', null)) , |
|
| 206 | + "oc_config" => json_encode([ |
|
| 207 | + 'session_lifetime' => min($this->config->getSystemValue('session_lifetime', $this->iniWrapper->getNumeric('session.gc_maxlifetime')), $this->iniWrapper->getNumeric('session.gc_maxlifetime')), |
|
| 208 | + 'session_keepalive' => $this->config->getSystemValue('session_keepalive', true), |
|
| 209 | + 'version' => implode('.', \OCP\Util::getVersion()), |
|
| 210 | + 'versionstring' => \OC_Util::getVersionString(), |
|
| 211 | + 'enable_avatars' => true, // here for legacy reasons - to not crash existing code that relies on this value |
|
| 212 | + 'lost_password_link'=> $this->config->getSystemValue('lost_password_link', null), |
|
| 213 | + 'modRewriteWorking' => ($this->config->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true'), |
|
| 214 | + 'sharing.maxAutocompleteResults' => intval($this->config->getSystemValue('sharing.maxAutocompleteResults', 0)), |
|
| 215 | + 'sharing.minSearchStringLength' => intval($this->config->getSystemValue('sharing.minSearchStringLength', 0)), |
|
| 216 | + 'blacklist_files_regex' => \OCP\Files\FileInfo::BLACKLIST_FILES_REGEX, |
|
| 217 | + ]), |
|
| 218 | + "oc_appconfig" => json_encode([ |
|
| 219 | + 'core' => [ |
|
| 220 | + 'defaultExpireDateEnabled' => $defaultExpireDateEnabled, |
|
| 221 | + 'defaultExpireDate' => $defaultExpireDate, |
|
| 222 | + 'defaultExpireDateEnforced' => $enforceDefaultExpireDate, |
|
| 223 | + 'enforcePasswordForPublicLink' => \OCP\Util::isPublicLinkPasswordRequired(), |
|
| 224 | + 'enableLinkPasswordByDefault' => $enableLinkPasswordByDefault, |
|
| 225 | + 'sharingDisabledForUser' => \OCP\Util::isSharingDisabledForUser(), |
|
| 226 | + 'resharingAllowed' => \OC\Share\Share::isResharingAllowed(), |
|
| 227 | + 'remoteShareAllowed' => $outgoingServer2serverShareEnabled, |
|
| 228 | + 'federatedCloudShareDoc' => $this->urlGenerator->linkToDocs('user-sharing-federated'), |
|
| 229 | + 'allowGroupSharing' => \OC::$server->getShareManager()->allowGroupSharing() |
|
| 230 | + ] |
|
| 231 | + ]), |
|
| 232 | + "oc_defaults" => json_encode([ |
|
| 233 | + 'entity' => $this->defaults->getEntity(), |
|
| 234 | + 'name' => $this->defaults->getName(), |
|
| 235 | + 'title' => $this->defaults->getTitle(), |
|
| 236 | + 'baseUrl' => $this->defaults->getBaseUrl(), |
|
| 237 | + 'syncClientUrl' => $this->defaults->getSyncClientUrl(), |
|
| 238 | + 'docBaseUrl' => $this->defaults->getDocBaseUrl(), |
|
| 239 | + 'docPlaceholderUrl' => $this->defaults->buildDocLinkToKey('PLACEHOLDER'), |
|
| 240 | + 'slogan' => $this->defaults->getSlogan(), |
|
| 241 | + 'logoClaim' => '', |
|
| 242 | + 'shortFooter' => $this->defaults->getShortFooter(), |
|
| 243 | + 'longFooter' => $this->defaults->getLongFooter(), |
|
| 244 | + 'folder' => \OC_Util::getTheme(), |
|
| 245 | + ]), |
|
| 246 | + ]; |
|
| 247 | 247 | |
| 248 | - if ($this->currentUser !== null) { |
|
| 249 | - $array['oc_userconfig'] = json_encode([ |
|
| 250 | - 'avatar' => [ |
|
| 251 | - 'version' => (int)$this->config->getUserValue($uid, 'avatar', 'version', 0), |
|
| 252 | - ] |
|
| 253 | - ]); |
|
| 254 | - } |
|
| 248 | + if ($this->currentUser !== null) { |
|
| 249 | + $array['oc_userconfig'] = json_encode([ |
|
| 250 | + 'avatar' => [ |
|
| 251 | + 'version' => (int)$this->config->getUserValue($uid, 'avatar', 'version', 0), |
|
| 252 | + ] |
|
| 253 | + ]); |
|
| 254 | + } |
|
| 255 | 255 | |
| 256 | - // Allow hooks to modify the output values |
|
| 257 | - \OC_Hook::emit('\OCP\Config', 'js', array('array' => &$array)); |
|
| 256 | + // Allow hooks to modify the output values |
|
| 257 | + \OC_Hook::emit('\OCP\Config', 'js', array('array' => &$array)); |
|
| 258 | 258 | |
| 259 | - $result = ''; |
|
| 259 | + $result = ''; |
|
| 260 | 260 | |
| 261 | - // Echo it |
|
| 262 | - foreach ($array as $setting => $value) { |
|
| 263 | - $result .= 'var '. $setting . '='. $value . ';' . PHP_EOL; |
|
| 264 | - } |
|
| 261 | + // Echo it |
|
| 262 | + foreach ($array as $setting => $value) { |
|
| 263 | + $result .= 'var '. $setting . '='. $value . ';' . PHP_EOL; |
|
| 264 | + } |
|
| 265 | 265 | |
| 266 | - return $result; |
|
| 267 | - } |
|
| 266 | + return $result; |
|
| 267 | + } |
|
| 268 | 268 | } |
@@ -24,23 +24,23 @@ |
||
| 24 | 24 | namespace OC\Template; |
| 25 | 25 | |
| 26 | 26 | class ResourceNotFoundException extends \LogicException { |
| 27 | - protected $resource; |
|
| 28 | - protected $webPath; |
|
| 27 | + protected $resource; |
|
| 28 | + protected $webPath; |
|
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * @param string $resource |
|
| 32 | - * @param string $webPath |
|
| 33 | - */ |
|
| 34 | - public function __construct($resource, $webPath) { |
|
| 35 | - parent::__construct('Resource not found'); |
|
| 36 | - $this->resource = $resource; |
|
| 37 | - $this->webPath = $webPath; |
|
| 38 | - } |
|
| 30 | + /** |
|
| 31 | + * @param string $resource |
|
| 32 | + * @param string $webPath |
|
| 33 | + */ |
|
| 34 | + public function __construct($resource, $webPath) { |
|
| 35 | + parent::__construct('Resource not found'); |
|
| 36 | + $this->resource = $resource; |
|
| 37 | + $this->webPath = $webPath; |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | - /** |
|
| 41 | - * @return string |
|
| 42 | - */ |
|
| 43 | - public function getResourcePath() { |
|
| 44 | - return $this->webPath . '/' . $this->resource; |
|
| 45 | - } |
|
| 40 | + /** |
|
| 41 | + * @return string |
|
| 42 | + */ |
|
| 43 | + public function getResourcePath() { |
|
| 44 | + return $this->webPath . '/' . $this->resource; |
|
| 45 | + } |
|
| 46 | 46 | } |
@@ -41,6 +41,6 @@ |
||
| 41 | 41 | * @return string |
| 42 | 42 | */ |
| 43 | 43 | public function getResourcePath() { |
| 44 | - return $this->webPath . '/' . $this->resource; |
|
| 44 | + return $this->webPath.'/'.$this->resource; |
|
| 45 | 45 | } |
| 46 | 46 | } |
@@ -26,37 +26,37 @@ |
||
| 26 | 26 | namespace OC\Template; |
| 27 | 27 | |
| 28 | 28 | class TemplateFileLocator { |
| 29 | - protected $dirs; |
|
| 30 | - private $path; |
|
| 29 | + protected $dirs; |
|
| 30 | + private $path; |
|
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * @param string[] $dirs |
|
| 34 | - */ |
|
| 35 | - public function __construct( $dirs ) { |
|
| 36 | - $this->dirs = $dirs; |
|
| 37 | - } |
|
| 32 | + /** |
|
| 33 | + * @param string[] $dirs |
|
| 34 | + */ |
|
| 35 | + public function __construct( $dirs ) { |
|
| 36 | + $this->dirs = $dirs; |
|
| 37 | + } |
|
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * @param string $template |
|
| 41 | - * @return string |
|
| 42 | - * @throws \Exception |
|
| 43 | - */ |
|
| 44 | - public function find( $template ) { |
|
| 45 | - if ($template === '') { |
|
| 46 | - throw new \InvalidArgumentException('Empty template name'); |
|
| 47 | - } |
|
| 39 | + /** |
|
| 40 | + * @param string $template |
|
| 41 | + * @return string |
|
| 42 | + * @throws \Exception |
|
| 43 | + */ |
|
| 44 | + public function find( $template ) { |
|
| 45 | + if ($template === '') { |
|
| 46 | + throw new \InvalidArgumentException('Empty template name'); |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | - foreach($this->dirs as $dir) { |
|
| 50 | - $file = $dir.$template.'.php'; |
|
| 51 | - if (is_file($file)) { |
|
| 52 | - $this->path = $dir; |
|
| 53 | - return $file; |
|
| 54 | - } |
|
| 55 | - } |
|
| 56 | - throw new \Exception('template file not found: template:'.$template); |
|
| 57 | - } |
|
| 49 | + foreach($this->dirs as $dir) { |
|
| 50 | + $file = $dir.$template.'.php'; |
|
| 51 | + if (is_file($file)) { |
|
| 52 | + $this->path = $dir; |
|
| 53 | + return $file; |
|
| 54 | + } |
|
| 55 | + } |
|
| 56 | + throw new \Exception('template file not found: template:'.$template); |
|
| 57 | + } |
|
| 58 | 58 | |
| 59 | - public function getPath() { |
|
| 60 | - return $this->path; |
|
| 61 | - } |
|
| 59 | + public function getPath() { |
|
| 60 | + return $this->path; |
|
| 61 | + } |
|
| 62 | 62 | } |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | /** |
| 33 | 33 | * @param string[] $dirs |
| 34 | 34 | */ |
| 35 | - public function __construct( $dirs ) { |
|
| 35 | + public function __construct($dirs) { |
|
| 36 | 36 | $this->dirs = $dirs; |
| 37 | 37 | } |
| 38 | 38 | |
@@ -41,12 +41,12 @@ discard block |
||
| 41 | 41 | * @return string |
| 42 | 42 | * @throws \Exception |
| 43 | 43 | */ |
| 44 | - public function find( $template ) { |
|
| 44 | + public function find($template) { |
|
| 45 | 45 | if ($template === '') { |
| 46 | 46 | throw new \InvalidArgumentException('Empty template name'); |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - foreach($this->dirs as $dir) { |
|
| 49 | + foreach ($this->dirs as $dir) { |
|
| 50 | 50 | $file = $dir.$template.'.php'; |
| 51 | 51 | if (is_file($file)) { |
| 52 | 52 | $this->path = $dir; |