@@ -81,7 +81,7 @@ |
||
| 81 | 81 | </form> |
| 82 | 82 | </div> |
| 83 | 83 | |
| 84 | - <div id="theming-preview" style="background-color:<?php p($_['color']);?>; background-image:url(<?php p($_['background']); ?>);"> |
|
| 84 | + <div id="theming-preview" style="background-color:<?php p($_['color']); ?>; background-image:url(<?php p($_['background']); ?>);"> |
|
| 85 | 85 | <img src="<?php p($_['logo']); ?>" id="theming-preview-logo" /> |
| 86 | 86 | </div> |
| 87 | 87 | <?php } ?> |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | */ |
| 59 | 59 | public function invertTextColor($color) { |
| 60 | 60 | $l = $this->calculateLuminance($color); |
| 61 | - if($l>0.5) { |
|
| 61 | + if ($l > 0.5) { |
|
| 62 | 62 | return true; |
| 63 | 63 | } else { |
| 64 | 64 | return false; |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | */ |
| 74 | 74 | public function elementColor($color) { |
| 75 | 75 | $l = $this->calculateLuminance($color); |
| 76 | - if($l>0.8) { |
|
| 76 | + if ($l > 0.8) { |
|
| 77 | 77 | return '#555555'; |
| 78 | 78 | } else { |
| 79 | 79 | return $color; |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | public function calculateLuminance($color) { |
| 88 | 88 | $hex = preg_replace("/[^0-9A-Fa-f]/", '', $color); |
| 89 | 89 | if (strlen($hex) === 3) { |
| 90 | - $hex = $hex{0} . $hex{0} . $hex{1} . $hex{1} . $hex{2} . $hex{2}; |
|
| 90 | + $hex = $hex{0}.$hex{0}.$hex{1}.$hex{1}.$hex{2}.$hex{2}; |
|
| 91 | 91 | } |
| 92 | 92 | if (strlen($hex) !== 6) { |
| 93 | 93 | return 0; |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | $r = hexdec(substr($hex, 0, 2)); |
| 96 | 96 | $g = hexdec(substr($hex, 2, 2)); |
| 97 | 97 | $b = hexdec(substr($hex, 4, 2)); |
| 98 | - return (0.299 * $r + 0.587 * $g + 0.114 * $b)/255; |
|
| 98 | + return (0.299 * $r + 0.587 * $g + 0.114 * $b) / 255; |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | /** |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | * @return string base64 encoded radio button svg |
| 104 | 104 | */ |
| 105 | 105 | public function generateRadioButton($color) { |
| 106 | - $radioButtonIcon = '<svg xmlns="http://www.w3.org/2000/svg" height="16" width="16">' . |
|
| 106 | + $radioButtonIcon = '<svg xmlns="http://www.w3.org/2000/svg" height="16" width="16">'. |
|
| 107 | 107 | '<path d="M8 1a7 7 0 0 0-7 7 7 7 0 0 0 7 7 7 7 0 0 0 7-7 7 7 0 0 0-7-7zm0 1a6 6 0 0 1 6 6 6 6 0 0 1-6 6 6 6 0 0 1-6-6 6 6 0 0 1 6-6zm0 2a4 4 0 1 0 0 8 4 4 0 0 0 0-8z" fill="'.$color.'"/></svg>'; |
| 108 | 108 | return base64_encode($radioButtonIcon); |
| 109 | 109 | } |
@@ -117,20 +117,20 @@ discard block |
||
| 117 | 117 | $app = str_replace(array('\0', '/', '\\', '..'), '', $app); |
| 118 | 118 | try { |
| 119 | 119 | $appPath = $this->appManager->getAppPath($app); |
| 120 | - $icon = $appPath . '/img/' . $app . '.svg'; |
|
| 120 | + $icon = $appPath.'/img/'.$app.'.svg'; |
|
| 121 | 121 | if (file_exists($icon)) { |
| 122 | 122 | return $icon; |
| 123 | 123 | } |
| 124 | - $icon = $appPath . '/img/app.svg'; |
|
| 124 | + $icon = $appPath.'/img/app.svg'; |
|
| 125 | 125 | if (file_exists($icon)) { |
| 126 | 126 | return $icon; |
| 127 | 127 | } |
| 128 | 128 | } catch (AppPathNotFoundException $e) {} |
| 129 | 129 | |
| 130 | - if($this->config->getAppValue('theming', 'logoMime', '') !== '' && $this->rootFolder->nodeExists('/themedinstancelogo')) { |
|
| 131 | - return $this->config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . '/themedinstancelogo'; |
|
| 130 | + if ($this->config->getAppValue('theming', 'logoMime', '') !== '' && $this->rootFolder->nodeExists('/themedinstancelogo')) { |
|
| 131 | + return $this->config->getSystemValue('datadirectory', \OC::$SERVERROOT.'/data').'/themedinstancelogo'; |
|
| 132 | 132 | } |
| 133 | - return \OC::$SERVERROOT . '/core/img/logo.svg'; |
|
| 133 | + return \OC::$SERVERROOT.'/core/img/logo.svg'; |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | /** |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | $app = str_replace(array('\0', '/', '\\', '..'), '', $app); |
| 143 | 143 | $image = str_replace(array('\0', '\\', '..'), '', $image); |
| 144 | 144 | if ($app === "core") { |
| 145 | - $icon = \OC::$SERVERROOT . '/core/img/' . $image; |
|
| 145 | + $icon = \OC::$SERVERROOT.'/core/img/'.$image; |
|
| 146 | 146 | if (file_exists($icon)) { |
| 147 | 147 | return $icon; |
| 148 | 148 | } |
@@ -154,23 +154,23 @@ discard block |
||
| 154 | 154 | return false; |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | - $icon = $appPath . '/img/' . $image; |
|
| 157 | + $icon = $appPath.'/img/'.$image; |
|
| 158 | 158 | if (file_exists($icon)) { |
| 159 | 159 | return $icon; |
| 160 | 160 | } |
| 161 | - $icon = $appPath . '/img/' . $image . '.svg'; |
|
| 161 | + $icon = $appPath.'/img/'.$image.'.svg'; |
|
| 162 | 162 | if (file_exists($icon)) { |
| 163 | 163 | return $icon; |
| 164 | 164 | } |
| 165 | - $icon = $appPath . '/img/' . $image . '.png'; |
|
| 165 | + $icon = $appPath.'/img/'.$image.'.png'; |
|
| 166 | 166 | if (file_exists($icon)) { |
| 167 | 167 | return $icon; |
| 168 | 168 | } |
| 169 | - $icon = $appPath . '/img/' . $image . '.gif'; |
|
| 169 | + $icon = $appPath.'/img/'.$image.'.gif'; |
|
| 170 | 170 | if (file_exists($icon)) { |
| 171 | 171 | return $icon; |
| 172 | 172 | } |
| 173 | - $icon = $appPath . '/img/' . $image . '.jpg'; |
|
| 173 | + $icon = $appPath.'/img/'.$image.'.jpg'; |
|
| 174 | 174 | if (file_exists($icon)) { |
| 175 | 175 | return $icon; |
| 176 | 176 | } |
@@ -91,13 +91,13 @@ discard block |
||
| 91 | 91 | */ |
| 92 | 92 | public function getThemedIcon($app, $image) { |
| 93 | 93 | try { |
| 94 | - $iconFile = $this->imageManager->getCachedImage("icon-" . $app . '-' . str_replace("/","_",$image)); |
|
| 94 | + $iconFile = $this->imageManager->getCachedImage("icon-".$app.'-'.str_replace("/", "_", $image)); |
|
| 95 | 95 | } catch (NotFoundException $exception) { |
| 96 | 96 | $icon = $this->iconBuilder->colorSvg($app, $image); |
| 97 | 97 | if ($icon === false || $icon === "") { |
| 98 | 98 | return new NotFoundResponse(); |
| 99 | 99 | } |
| 100 | - $iconFile = $this->imageManager->setCachedImage("icon-" . $app . '-' . str_replace("/","_",$image), $icon); |
|
| 100 | + $iconFile = $this->imageManager->setCachedImage("icon-".$app.'-'.str_replace("/", "_", $image), $icon); |
|
| 101 | 101 | } |
| 102 | 102 | if ($iconFile !== false) { |
| 103 | 103 | $response = new FileDisplayResponse($iconFile, Http::STATUS_OK, ['Content-Type' => 'image/svg+xml']); |
@@ -125,10 +125,10 @@ discard block |
||
| 125 | 125 | public function getFavicon($app = "core") { |
| 126 | 126 | if ($this->themingDefaults->shouldReplaceIcons()) { |
| 127 | 127 | try { |
| 128 | - $iconFile = $this->imageManager->getCachedImage('favIcon-' . $app); |
|
| 128 | + $iconFile = $this->imageManager->getCachedImage('favIcon-'.$app); |
|
| 129 | 129 | } catch (NotFoundException $exception) { |
| 130 | 130 | $icon = $this->iconBuilder->getFavicon($app); |
| 131 | - $iconFile = $this->imageManager->setCachedImage('favIcon-' . $app, $icon); |
|
| 131 | + $iconFile = $this->imageManager->setCachedImage('favIcon-'.$app, $icon); |
|
| 132 | 132 | } |
| 133 | 133 | if ($iconFile !== false) { |
| 134 | 134 | $response = new FileDisplayResponse($iconFile, Http::STATUS_OK, ['Content-Type' => 'image/x-icon']); |
@@ -156,10 +156,10 @@ discard block |
||
| 156 | 156 | public function getTouchIcon($app = "core") { |
| 157 | 157 | if ($this->themingDefaults->shouldReplaceIcons()) { |
| 158 | 158 | try { |
| 159 | - $iconFile = $this->imageManager->getCachedImage('touchIcon-' . $app); |
|
| 159 | + $iconFile = $this->imageManager->getCachedImage('touchIcon-'.$app); |
|
| 160 | 160 | } catch (NotFoundException $exception) { |
| 161 | 161 | $icon = $this->iconBuilder->getTouchIcon($app); |
| 162 | - $iconFile = $this->imageManager->setCachedImage('touchIcon-' . $app, $icon); |
|
| 162 | + $iconFile = $this->imageManager->setCachedImage('touchIcon-'.$app, $icon); |
|
| 163 | 163 | } |
| 164 | 164 | if ($iconFile !== false) { |
| 165 | 165 | $response = new FileDisplayResponse($iconFile, Http::STATUS_OK, ['Content-Type' => 'image/png']); |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | */ |
| 54 | 54 | public function getFavicon($app) { |
| 55 | 55 | $icon = $this->renderAppIcon($app, 32); |
| 56 | - if($icon === false) { |
|
| 56 | + if ($icon === false) { |
|
| 57 | 57 | return false; |
| 58 | 58 | } |
| 59 | 59 | $icon->setImageFormat("png24"); |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | */ |
| 69 | 69 | public function getTouchIcon($app) { |
| 70 | 70 | $icon = $this->renderAppIcon($app, 512); |
| 71 | - if($icon === false) { |
|
| 71 | + if ($icon === false) { |
|
| 72 | 72 | return false; |
| 73 | 73 | } |
| 74 | 74 | $icon->setImageFormat("png24"); |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | return false; |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - if($appIconContent === false) { |
|
| 96 | + if ($appIconContent === false) { |
|
| 97 | 97 | return false; |
| 98 | 98 | } |
| 99 | 99 | |
@@ -101,13 +101,13 @@ discard block |
||
| 101 | 101 | $mime = mime_content_type($appIcon); |
| 102 | 102 | |
| 103 | 103 | // generate background image with rounded corners |
| 104 | - $background = '<?xml version="1.0" encoding="UTF-8"?>' . |
|
| 105 | - '<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:cc="http://creativecommons.org/ns#" width="512" height="512" xmlns:xlink="http://www.w3.org/1999/xlink">' . |
|
| 106 | - '<rect x="0" y="0" rx="100" ry="100" width="512" height="512" style="fill:' . $color . ';" />' . |
|
| 104 | + $background = '<?xml version="1.0" encoding="UTF-8"?>'. |
|
| 105 | + '<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:cc="http://creativecommons.org/ns#" width="512" height="512" xmlns:xlink="http://www.w3.org/1999/xlink">'. |
|
| 106 | + '<rect x="0" y="0" rx="100" ry="100" width="512" height="512" style="fill:'.$color.';" />'. |
|
| 107 | 107 | '</svg>'; |
| 108 | 108 | // resize svg magic as this seems broken in Imagemagick |
| 109 | - if($mime === "image/svg+xml" || substr($appIconContent, 0, 4) === "<svg") { |
|
| 110 | - if(substr($appIconContent, 0, 5) !== "<?xml") { |
|
| 109 | + if ($mime === "image/svg+xml" || substr($appIconContent, 0, 4) === "<svg") { |
|
| 110 | + if (substr($appIconContent, 0, 5) !== "<?xml") { |
|
| 111 | 111 | $svg = "<?xml version=\"1.0\"?>".$appIconContent; |
| 112 | 112 | } else { |
| 113 | 113 | $svg = $appIconContent; |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | $res = $tmp->getImageResolution(); |
| 120 | 120 | $tmp->destroy(); |
| 121 | 121 | |
| 122 | - if($x>$y) { |
|
| 122 | + if ($x > $y) { |
|
| 123 | 123 | $max = $x; |
| 124 | 124 | } else { |
| 125 | 125 | $max = $y; |
@@ -127,8 +127,8 @@ discard block |
||
| 127 | 127 | |
| 128 | 128 | // convert svg to resized image |
| 129 | 129 | $appIconFile = new Imagick(); |
| 130 | - $resX = (int)(512 * $res['x'] / $max * 2.53); |
|
| 131 | - $resY = (int)(512 * $res['y'] / $max * 2.53); |
|
| 130 | + $resX = (int) (512 * $res['x'] / $max * 2.53); |
|
| 131 | + $resY = (int) (512 * $res['y'] / $max * 2.53); |
|
| 132 | 132 | $appIconFile->setResolution($resX, $resY); |
| 133 | 133 | $appIconFile->setBackgroundColor(new ImagickPixel('transparent')); |
| 134 | 134 | $appIconFile->readImageBlob($svg); |
@@ -141,10 +141,10 @@ discard block |
||
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | // offset for icon positioning |
| 144 | - $border_w = (int)($appIconFile->getImageWidth() * 0.05); |
|
| 145 | - $border_h = (int)($appIconFile->getImageHeight() * 0.05); |
|
| 146 | - $innerWidth = (int)($appIconFile->getImageWidth() - $border_w * 2); |
|
| 147 | - $innerHeight = (int)($appIconFile->getImageHeight() - $border_h * 2); |
|
| 144 | + $border_w = (int) ($appIconFile->getImageWidth() * 0.05); |
|
| 145 | + $border_h = (int) ($appIconFile->getImageHeight() * 0.05); |
|
| 146 | + $innerWidth = (int) ($appIconFile->getImageWidth() - $border_w * 2); |
|
| 147 | + $innerHeight = (int) ($appIconFile->getImageHeight() - $border_h * 2); |
|
| 148 | 148 | $appIconFile->adaptiveResizeImage($innerWidth, $innerHeight); |
| 149 | 149 | // center icon |
| 150 | 150 | $offset_w = 512 / 2 - $innerWidth / 2; |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | |
| 79 | 79 | $uid = $user->getUID(); |
| 80 | 80 | foreach (range(1, min([$number, 20])) as $i) { |
| 81 | - $code = $this->random->generate(self::$CODE_LENGTH, ISecureRandom::CHAR_UPPER . ISecureRandom::CHAR_DIGITS); |
|
| 81 | + $code = $this->random->generate(self::$CODE_LENGTH, ISecureRandom::CHAR_UPPER.ISecureRandom::CHAR_DIGITS); |
|
| 82 | 82 | |
| 83 | 83 | $dbCode = new BackupCode(); |
| 84 | 84 | $dbCode->setUserId($uid); |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | $codes = $this->mapper->getBackupCodes($user); |
| 133 | 133 | $total = count($codes); |
| 134 | 134 | $used = 0; |
| 135 | - array_walk($codes, function (BackupCode $code) use (&$used) { |
|
| 135 | + array_walk($codes, function(BackupCode $code) use (&$used) { |
|
| 136 | 136 | if (1 === (int) $code->getUsed()) { |
| 137 | 137 | $used++; |
| 138 | 138 | } |
@@ -47,7 +47,7 @@ |
||
| 47 | 47 | $rows = $result->fetchAll(); |
| 48 | 48 | $result->closeCursor(); |
| 49 | 49 | |
| 50 | - return array_map(function ($row) { |
|
| 50 | + return array_map(function($row) { |
|
| 51 | 51 | return BackupCode::fromRow($row); |
| 52 | 52 | }, $rows); |
| 53 | 53 | } |
@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | /** @var array $_ */ |
| 4 | 4 | |
| 5 | 5 | print_unescaped($l->t("Hey there,\n\nthe admin enabled server-side-encryption. Your files were encrypted using the password '%s'.\n\nPlease login to the web interface, go to the section 'basic encryption module' of your personal settings and update your encryption password by entering this password into the 'old log-in password' field and your current login-password.\n\n", array($_['password']))); |
| 6 | -if ( isset($_['expiration']) ) { |
|
| 6 | +if (isset($_['expiration'])) { |
|
| 7 | 7 | print_unescaped($l->t("The share will expire on %s.", array($_['expiration']))); |
| 8 | 8 | print_unescaped("\n\n"); |
| 9 | 9 | } |
@@ -12,5 +12,5 @@ discard block |
||
| 12 | 12 | ?> |
| 13 | 13 | |
| 14 | 14 | -- |
| 15 | -<?php p($theme->getName() . ' - ' . $theme->getSlogan()); ?> |
|
| 15 | +<?php p($theme->getName().' - '.$theme->getSlogan()); ?> |
|
| 16 | 16 | <?php print_unescaped("\n".$theme->getBaseUrl()); |
@@ -7,19 +7,19 @@ discard block |
||
| 7 | 7 | ?> |
| 8 | 8 | <form id="ocDefaultEncryptionModule" class="sub-section"> |
| 9 | 9 | <h3><?php p($l->t("Default encryption module")); ?></h3> |
| 10 | - <?php if(!$_["initStatus"]): ?> |
|
| 10 | + <?php if (!$_["initStatus"]): ?> |
|
| 11 | 11 | <?php p($l->t("Encryption app is enabled but your keys are not initialized, please log-out and log-in again")); ?> |
| 12 | 12 | <?php else: ?> |
| 13 | 13 | <p id="encryptHomeStorageSetting"> |
| 14 | 14 | <input type="checkbox" class="checkbox" name="encrypt_home_storage" id="encryptHomeStorage" |
| 15 | 15 | value="1" <?php if ($_['encryptHomeStorage']) print_unescaped('checked="checked"'); ?> /> |
| 16 | - <label for="encryptHomeStorage"><?php p($l->t('Encrypt the home storage'));?></label></br> |
|
| 17 | - <em><?php p( $l->t( "Enabling this option encrypts all files stored on the main storage, otherwise only files on external storage will be encrypted" ) ); ?></em> |
|
| 16 | + <label for="encryptHomeStorage"><?php p($l->t('Encrypt the home storage')); ?></label></br> |
|
| 17 | + <em><?php p($l->t("Enabling this option encrypts all files stored on the main storage, otherwise only files on external storage will be encrypted")); ?></em> |
|
| 18 | 18 | </p> |
| 19 | 19 | <br /> |
| 20 | - <?php if($_['masterKeyEnabled'] === false): ?> |
|
| 20 | + <?php if ($_['masterKeyEnabled'] === false): ?> |
|
| 21 | 21 | <p id="encryptionSetRecoveryKey"> |
| 22 | - <?php $_["recoveryEnabled"] === '0' ? p($l->t("Enable recovery key")) : p($l->t("Disable recovery key")); ?> |
|
| 22 | + <?php $_["recoveryEnabled"] === '0' ? p($l->t("Enable recovery key")) : p($l->t("Disable recovery key")); ?> |
|
| 23 | 23 | <span class="msg"></span> |
| 24 | 24 | <br/> |
| 25 | 25 | <em> |
@@ -38,11 +38,11 @@ discard block |
||
| 38 | 38 | name="enableRecoveryKey" |
| 39 | 39 | id="enableRecoveryKey" |
| 40 | 40 | status="<?php p($_["recoveryEnabled"]) ?>" |
| 41 | - value="<?php $_["recoveryEnabled"] === '0' ? p($l->t("Enable recovery key")) : p($l->t("Disable recovery key")); ?>"/> |
|
| 41 | + value="<?php $_["recoveryEnabled"] === '0' ? p($l->t("Enable recovery key")) : p($l->t("Disable recovery key")); ?>"/> |
|
| 42 | 42 | </p> |
| 43 | 43 | <br/><br/> |
| 44 | 44 | |
| 45 | - <p name="changeRecoveryPasswordBlock" id="encryptionChangeRecoveryKey" <?php if($_['recoveryEnabled'] === '0') print_unescaped('class="hidden"');?>> |
|
| 45 | + <p name="changeRecoveryPasswordBlock" id="encryptionChangeRecoveryKey" <?php if ($_['recoveryEnabled'] === '0') print_unescaped('class="hidden"'); ?>> |
|
| 46 | 46 | <?php p($l->t("Change recovery key password:")); ?> |
| 47 | 47 | <span class="msg"></span> |
| 48 | 48 | <br/> |
@@ -137,13 +137,13 @@ discard block |
||
| 137 | 137 | $path = '/files_encryption/keys'; |
| 138 | 138 | $this->renameFileKeys($user, $path); |
| 139 | 139 | $trashPath = '/files_trashbin/keys'; |
| 140 | - if (\OC_App::isEnabled('files_trashbin') && $this->view->is_dir($user . '/' . $trashPath)) { |
|
| 140 | + if (\OC_App::isEnabled('files_trashbin') && $this->view->is_dir($user.'/'.$trashPath)) { |
|
| 141 | 141 | $this->renameFileKeys($user, $trashPath, true); |
| 142 | 142 | $this->view->deleteAll($trashPath); |
| 143 | 143 | } |
| 144 | 144 | // delete old folders |
| 145 | 145 | $this->deleteOldKeys($user); |
| 146 | - $this->view->getMount('/' . $user)->getStorage()->getScanner()->scan('files_encryption'); |
|
| 146 | + $this->view->getMount('/'.$user)->getStorage()->getScanner()->scan('files_encryption'); |
|
| 147 | 147 | } |
| 148 | 148 | } |
| 149 | 149 | |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | |
| 173 | 173 | while ($row = $appSettings->fetch()) { |
| 174 | 174 | // 'installed_version' gets deleted at the end of the migration process |
| 175 | - if ($row['configkey'] !== 'installed_version' ) { |
|
| 175 | + if ($row['configkey'] !== 'installed_version') { |
|
| 176 | 176 | $this->config->setAppValue('encryption', $row['configkey'], $row['configvalue']); |
| 177 | 177 | $this->config->deleteAppValue('files_encryption', $row['configkey']); |
| 178 | 178 | } |
@@ -195,9 +195,9 @@ discard block |
||
| 195 | 195 | * create backup of system-wide keys |
| 196 | 196 | */ |
| 197 | 197 | private function backupSystemWideKeys() { |
| 198 | - $backupDir = 'encryption_migration_backup_' . date("Y-m-d_H-i-s"); |
|
| 198 | + $backupDir = 'encryption_migration_backup_'.date("Y-m-d_H-i-s"); |
|
| 199 | 199 | $this->view->mkdir($backupDir); |
| 200 | - $this->view->copy('files_encryption', $backupDir . '/files_encryption'); |
|
| 200 | + $this->view->copy('files_encryption', $backupDir.'/files_encryption'); |
|
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | /** |
@@ -207,9 +207,9 @@ discard block |
||
| 207 | 207 | * @return bool |
| 208 | 208 | */ |
| 209 | 209 | private function backupUserKeys($user) { |
| 210 | - $encryptionDir = $user . '/files_encryption'; |
|
| 210 | + $encryptionDir = $user.'/files_encryption'; |
|
| 211 | 211 | if ($this->view->is_dir($encryptionDir)) { |
| 212 | - $backupDir = $user . '/encryption_migration_backup_' . date("Y-m-d_H-i-s"); |
|
| 212 | + $backupDir = $user.'/encryption_migration_backup_'.date("Y-m-d_H-i-s"); |
|
| 213 | 213 | $this->view->mkdir($backupDir); |
| 214 | 214 | $this->view->copy($encryptionDir, $backupDir); |
| 215 | 215 | return true; |
@@ -222,12 +222,12 @@ discard block |
||
| 222 | 222 | */ |
| 223 | 223 | private function renameSystemPrivateKeys() { |
| 224 | 224 | $dh = $this->view->opendir('files_encryption'); |
| 225 | - $this->createPathForKeys('/files_encryption/' . $this->moduleId ); |
|
| 225 | + $this->createPathForKeys('/files_encryption/'.$this->moduleId); |
|
| 226 | 226 | if (is_resource($dh)) { |
| 227 | 227 | while (($privateKey = readdir($dh)) !== false) { |
| 228 | - if (!\OC\Files\Filesystem::isIgnoredDir($privateKey) ) { |
|
| 229 | - if (!$this->view->is_dir('/files_encryption/' . $privateKey)) { |
|
| 230 | - $this->view->rename('files_encryption/' . $privateKey, 'files_encryption/' . $this->moduleId . '/' . $privateKey); |
|
| 228 | + if (!\OC\Files\Filesystem::isIgnoredDir($privateKey)) { |
|
| 229 | + if (!$this->view->is_dir('/files_encryption/'.$privateKey)) { |
|
| 230 | + $this->view->rename('files_encryption/'.$privateKey, 'files_encryption/'.$this->moduleId.'/'.$privateKey); |
|
| 231 | 231 | $this->renameSystemPublicKey($privateKey); |
| 232 | 232 | } |
| 233 | 233 | } |
@@ -242,8 +242,8 @@ discard block |
||
| 242 | 242 | * @param string $privateKey private key for which we want to rename the corresponding public key |
| 243 | 243 | */ |
| 244 | 244 | private function renameSystemPublicKey($privateKey) { |
| 245 | - $publicKey = substr($privateKey,0 , strrpos($privateKey, '.privateKey')) . '.publicKey'; |
|
| 246 | - $this->view->rename('files_encryption/public_keys/' . $publicKey, 'files_encryption/' . $this->moduleId . '/' . $publicKey); |
|
| 245 | + $publicKey = substr($privateKey, 0, strrpos($privateKey, '.privateKey')).'.publicKey'; |
|
| 246 | + $this->view->rename('files_encryption/public_keys/'.$publicKey, 'files_encryption/'.$this->moduleId.'/'.$publicKey); |
|
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | /** |
@@ -252,8 +252,8 @@ discard block |
||
| 252 | 252 | * @param string $user |
| 253 | 253 | */ |
| 254 | 254 | private function renameUsersPrivateKey($user) { |
| 255 | - $oldPrivateKey = $user . '/files_encryption/' . $user . '.privateKey'; |
|
| 256 | - $newPrivateKey = $user . '/files_encryption/' . $this->moduleId . '/' . $user . '.privateKey'; |
|
| 255 | + $oldPrivateKey = $user.'/files_encryption/'.$user.'.privateKey'; |
|
| 256 | + $newPrivateKey = $user.'/files_encryption/'.$this->moduleId.'/'.$user.'.privateKey'; |
|
| 257 | 257 | if ($this->view->file_exists($oldPrivateKey)) { |
| 258 | 258 | $this->createPathForKeys(dirname($newPrivateKey)); |
| 259 | 259 | $this->view->rename($oldPrivateKey, $newPrivateKey); |
@@ -266,8 +266,8 @@ discard block |
||
| 266 | 266 | * @param string $user |
| 267 | 267 | */ |
| 268 | 268 | private function renameUsersPublicKey($user) { |
| 269 | - $oldPublicKey = '/files_encryption/public_keys/' . $user . '.publicKey'; |
|
| 270 | - $newPublicKey = $user . '/files_encryption/' . $this->moduleId . '/' . $user . '.publicKey'; |
|
| 269 | + $oldPublicKey = '/files_encryption/public_keys/'.$user.'.publicKey'; |
|
| 270 | + $newPublicKey = $user.'/files_encryption/'.$this->moduleId.'/'.$user.'.publicKey'; |
|
| 271 | 271 | if ($this->view->file_exists($oldPublicKey)) { |
| 272 | 272 | $this->createPathForKeys(dirname($newPublicKey)); |
| 273 | 273 | $this->view->rename($oldPublicKey, $newPublicKey); |
@@ -283,27 +283,27 @@ discard block |
||
| 283 | 283 | */ |
| 284 | 284 | private function renameFileKeys($user, $path, $trash = false) { |
| 285 | 285 | |
| 286 | - if ($this->view->is_dir($user . '/' . $path) === false) { |
|
| 287 | - $this->logger->info('Skip dir /' . $user . '/' . $path . ': does not exist'); |
|
| 286 | + if ($this->view->is_dir($user.'/'.$path) === false) { |
|
| 287 | + $this->logger->info('Skip dir /'.$user.'/'.$path.': does not exist'); |
|
| 288 | 288 | return; |
| 289 | 289 | } |
| 290 | 290 | |
| 291 | - $dh = $this->view->opendir($user . '/' . $path); |
|
| 291 | + $dh = $this->view->opendir($user.'/'.$path); |
|
| 292 | 292 | |
| 293 | 293 | if (is_resource($dh)) { |
| 294 | 294 | while (($file = readdir($dh)) !== false) { |
| 295 | 295 | if (!\OC\Files\Filesystem::isIgnoredDir($file)) { |
| 296 | - if ($this->view->is_dir($user . '/' . $path . '/' . $file)) { |
|
| 297 | - $this->renameFileKeys($user, $path . '/' . $file, $trash); |
|
| 296 | + if ($this->view->is_dir($user.'/'.$path.'/'.$file)) { |
|
| 297 | + $this->renameFileKeys($user, $path.'/'.$file, $trash); |
|
| 298 | 298 | } else { |
| 299 | 299 | $target = $this->getTargetDir($user, $path, $file, $trash); |
| 300 | 300 | if ($target !== false) { |
| 301 | 301 | $this->createPathForKeys(dirname($target)); |
| 302 | - $this->view->rename($user . '/' . $path . '/' . $file, $target); |
|
| 302 | + $this->view->rename($user.'/'.$path.'/'.$file, $target); |
|
| 303 | 303 | } else { |
| 304 | 304 | $this->logger->warning( |
| 305 | - 'did not move key "' . $file |
|
| 306 | - . '" could not find the corresponding file in /data/' . $user . '/files.' |
|
| 305 | + 'did not move key "'.$file |
|
| 306 | + . '" could not find the corresponding file in /data/'.$user.'/files.' |
|
| 307 | 307 | . 'Most likely the key was already moved in a previous migration run and is already on the right place.'); |
| 308 | 308 | } |
| 309 | 309 | } |
@@ -336,10 +336,10 @@ discard block |
||
| 336 | 336 | private function getTargetDir($user, $keyPath, $filename, $trash) { |
| 337 | 337 | if ($trash) { |
| 338 | 338 | $filePath = substr($keyPath, strlen('/files_trashbin/keys/')); |
| 339 | - $targetDir = $user . '/files_encryption/keys/files_trashbin/' . $filePath . '/' . $this->moduleId . '/' . $filename; |
|
| 339 | + $targetDir = $user.'/files_encryption/keys/files_trashbin/'.$filePath.'/'.$this->moduleId.'/'.$filename; |
|
| 340 | 340 | } else { |
| 341 | 341 | $filePath = substr($keyPath, strlen('/files_encryption/keys/')); |
| 342 | - $targetDir = $user . '/files_encryption/keys/files/' . $filePath . '/' . $this->moduleId . '/' . $filename; |
|
| 342 | + $targetDir = $user.'/files_encryption/keys/files/'.$filePath.'/'.$this->moduleId.'/'.$filename; |
|
| 343 | 343 | } |
| 344 | 344 | |
| 345 | 345 | if ($user === '') { |
@@ -347,13 +347,13 @@ discard block |
||
| 347 | 347 | $normalized = \OC\Files\Filesystem::normalizePath($filePath); |
| 348 | 348 | $systemMountPoints = $this->getSystemMountPoints(); |
| 349 | 349 | foreach ($systemMountPoints as $mountPoint) { |
| 350 | - $normalizedMountPoint = \OC\Files\Filesystem::normalizePath($mountPoint['mountpoint']) . '/'; |
|
| 350 | + $normalizedMountPoint = \OC\Files\Filesystem::normalizePath($mountPoint['mountpoint']).'/'; |
|
| 351 | 351 | if (strpos($normalized, $normalizedMountPoint) === 0) |
| 352 | 352 | return $targetDir; |
| 353 | 353 | } |
| 354 | - } else if ($trash === false && $this->view->file_exists('/' . $user. '/files/' . $filePath)) { |
|
| 354 | + } else if ($trash === false && $this->view->file_exists('/'.$user.'/files/'.$filePath)) { |
|
| 355 | 355 | return $targetDir; |
| 356 | - } else if ($trash === true && $this->view->file_exists('/' . $user. '/files_trashbin/' . $filePath)) { |
|
| 356 | + } else if ($trash === true && $this->view->file_exists('/'.$user.'/files_trashbin/'.$filePath)) { |
|
| 357 | 357 | return $targetDir; |
| 358 | 358 | } |
| 359 | 359 | |
@@ -366,8 +366,8 @@ discard block |
||
| 366 | 366 | * @param string $user |
| 367 | 367 | */ |
| 368 | 368 | private function deleteOldKeys($user) { |
| 369 | - $this->view->deleteAll($user . '/files_encryption/keyfiles'); |
|
| 370 | - $this->view->deleteAll($user . '/files_encryption/share-keys'); |
|
| 369 | + $this->view->deleteAll($user.'/files_encryption/keyfiles'); |
|
| 370 | + $this->view->deleteAll($user.'/files_encryption/share-keys'); |
|
| 371 | 371 | } |
| 372 | 372 | |
| 373 | 373 | /** |
@@ -380,7 +380,7 @@ discard block |
||
| 380 | 380 | $sub_dirs = explode('/', $path); |
| 381 | 381 | $dir = ''; |
| 382 | 382 | foreach ($sub_dirs as $sub_dir) { |
| 383 | - $dir .= '/' . $sub_dir; |
|
| 383 | + $dir .= '/'.$sub_dir; |
|
| 384 | 384 | if (!$this->view->is_dir($dir)) { |
| 385 | 385 | $this->view->mkdir($dir); |
| 386 | 386 | } |