diff options
author | Git'Fellow <carlos@reendex.com> | 2022-07-02 09:28:47 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-02 09:28:47 +0300 |
commit | 50816ec79eeed7125fea164cf45060d434ded11c (patch) | |
tree | 43603185456e687c7b9375947a7866ca54d642e6 | |
parent | dab7606ae895f2dc7903124aafe6d1f6b0d183b5 (diff) |
Update index.php
-rw-r--r-- | index.php | 208 |
1 files changed, 102 insertions, 106 deletions
@@ -131,7 +131,7 @@ class Auth { $storedHash = $this->updater->getConfigOption('updater.secret'); // As a sanity check the stored hash or the sent password can never be empty - if($storedHash === '' || $storedHash === null || $this->password === null) { + if ($storedHash === '' || $storedHash === null || $this->password === null) { return false; } @@ -164,7 +164,7 @@ class Updater { public function __construct($baseDir) { $this->baseDir = $baseDir; - if($dir = getenv('NEXTCLOUD_CONFIG_DIR')) { + if ($dir = getenv('NEXTCLOUD_CONFIG_DIR')) { $configFileName = rtrim($dir, '/') . '/config.php'; } else { $configFileName = $this->baseDir . '/../config/config.php'; @@ -184,7 +184,7 @@ class Updater { } $dataDir = $this->getDataDirectoryLocation(); - if(empty($dataDir) || !is_string($dataDir)) { + if (empty($dataDir) || !is_string($dataDir)) { throw new \Exception('Could not read data directory from config.php.'); } @@ -201,16 +201,13 @@ class Updater { $buildTime = $OC_Build; } - if($version === null) { - return; - } - if($buildTime === null) { + if ($version === null || $buildTime === null) { return; } // normalize version to 3 digits $splittedVersion = explode('.', $version); - if(sizeof($splittedVersion) >= 3) { + if (sizeof($splittedVersion) >= 3) { $splittedVersion = array_slice($splittedVersion, 0, 3); } @@ -306,7 +303,7 @@ class Updater { * @return string */ private function getDataDirectoryLocation() { - return $this->configValues['datadirectory']; + return $this->configValues['updatedirectory'] ?? $this->configValues['datadirectory']; } /** @@ -367,11 +364,11 @@ class Updater { */ private function getAppDirectories() { $expected = []; - if($appsPaths = $this->getConfigOption('apps_paths')) { + if ($appsPaths = $this->getConfigOption('apps_paths')) { foreach ($appsPaths as $appsPath) { $parentDir = realpath($this->baseDir . '/../'); $appDir = basename($appsPath['path']); - if(strpos($appsPath['path'], $parentDir) === 0 && $appDir !== 'apps') { + if (strpos($appsPath['path'], $parentDir) === 0 && $appDir !== 'apps') { $expected[] = $appDir; } } @@ -404,7 +401,7 @@ class Updater { $expectedElements = $this->getExpectedElementsList(); $unexpectedElements = []; foreach (new \DirectoryIterator($this->baseDir . '/../') as $fileInfo) { - if(array_search($fileInfo->getFilename(), $expectedElements) === false) { + if (array_search($fileInfo->getFilename(), $expectedElements) === false) { $unexpectedElements[] = $fileInfo->getFilename(); } } @@ -427,11 +424,11 @@ class Updater { $it = new \RecursiveIteratorIterator($filter); foreach ($it as $path => $dir) { - if(!is_writable($path)) { + if (!is_writable($path)) { $notWritablePaths[] = $path; } } - if(count($notWritablePaths) > 0) { + if (count($notWritablePaths) > 0) { throw new UpdateException($notWritablePaths); } @@ -447,7 +444,7 @@ class Updater { public function setMaintenanceMode($state) { $this->silentLog('[info] setMaintenanceMode("' . ($state ? 'true' : 'false') . '")'); - if($dir = getenv('NEXTCLOUD_CONFIG_DIR')) { + if ($dir = getenv('NEXTCLOUD_CONFIG_DIR')) { $configFileName = rtrim($dir, '/') . '/config.php'; } else { $configFileName = $this->baseDir . '/../config/config.php'; @@ -491,7 +488,7 @@ class Updater { $this->silentLog('[info] backup folder location: ' . $backupFolderLocation); $state = mkdir($backupFolderLocation, 0750, true); - if($state === false) { + if ($state === false) { throw new \Exception('Could not create backup folder location'); } @@ -507,35 +504,35 @@ class Updater { $folderStructure = explode('/', $fileName, -1); // Exclude the exclusions - if(isset($folderStructure[0])) { - if(array_search($folderStructure[0], $excludedElements) !== false) { + if (isset($folderStructure[0])) { + if (array_search($folderStructure[0], $excludedElements) !== false) { continue; } } else { - if(array_search($fileName, $excludedElements) !== false) { + if (array_search($fileName, $excludedElements) !== false) { continue; } } // Create folder if it doesn't exist - if(!file_exists($backupFolderLocation . '/' . dirname($fileName))) { + if (!file_exists($backupFolderLocation . '/' . dirname($fileName))) { $state = mkdir($backupFolderLocation . '/' . dirname($fileName), 0750, true); - if($state === false) { + if ($state === false) { throw new \Exception('Could not create folder: '.$backupFolderLocation.'/'.dirname($fileName)); } } // If it is a file copy it - if($fileInfo->isFile()) { + if ($fileInfo->isFile()) { $state = copy($fileInfo->getRealPath(), $backupFolderLocation . $fileName); - if($state === false) { + if ($state === false) { $message = sprintf( 'Could not copy "%s" to "%s"', $fileInfo->getRealPath(), $backupFolderLocation . $fileName ); - if(is_readable($fileInfo->getRealPath()) === false) { + if (is_readable($fileInfo->getRealPath()) === false) { $message = sprintf( '%s. Source %s is not readable', $message, @@ -543,7 +540,7 @@ class Updater { ); } - if(is_writable($backupFolderLocation . $fileName) === false) { + if (is_writable($backupFolderLocation . $fileName) === false) { $message = sprintf( '%s. Destination %s is not writable', $message, @@ -573,7 +570,7 @@ class Updater { $this->silentLog('[info] getUpdateServerResponse()'); $updaterServer = $this->getConfigOption('updater.server.url'); - if($updaterServer === null) { + if ($updaterServer === null) { // FIXME: used deployed URL $updaterServer = 'https://updates.nextcloud.com/updater_server/'; } @@ -603,26 +600,26 @@ class Updater { } $response = curl_exec($curl); - if($response === false) { + if ($response === false) { throw new \Exception('Could not do request to updater server: '.curl_error($curl)); } curl_close($curl); // Response can be empty when no update is available - if($response === '') { + if ($response === '') { return []; } $xml = simplexml_load_string($response); - if($xml === false) { + if ($xml === false) { throw new \Exception('Could not parse updater server XML response'); } $json = json_encode($xml); - if($json === false) { + if ($json === false) { throw new \Exception('Could not JSON encode updater server response'); } $response = json_decode($json, true); - if($response === null) { + if ($response === null) { throw new \Exception('Could not JSON decode updater server response.'); } $this->silentLog('[info] getUpdateServerResponse response: ' . print_r($response, true)); @@ -639,12 +636,12 @@ class Updater { $response = $this->getUpdateServerResponse(); $storageLocation = $this->getDataDirectoryLocation() . '/updater-'.$this->getConfigOption('instanceid') . '/downloads/'; - if(file_exists($storageLocation)) { + if (file_exists($storageLocation)) { $this->silentLog('[info] storage location exists'); $this->recursiveDelete($storageLocation); } $state = mkdir($storageLocation, 0750, true); - if($state === false) { + if ($state === false) { throw new \Exception('Could not mkdir storage location'); } @@ -663,11 +660,11 @@ class Updater { ]); } - if(curl_exec($ch) === false) { + if (curl_exec($ch) === false) { throw new \Exception('Curl error: ' . curl_error($ch)); } $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); - if($httpCode !== 200) { + if ($httpCode !== 200) { $statusCodes = [ 400 => 'Bad request', 401 => 'Unauthorized', @@ -680,14 +677,14 @@ class Updater { ]; $message = 'Download failed'; - if(isset($statusCodes[$httpCode])) { + if (isset($statusCodes[$httpCode])) { $message .= ' - ' . $statusCodes[$httpCode] . ' (HTTP ' . $httpCode . ')'; } else { $message .= ' - HTTP status code: ' . $httpCode; } $curlErrorMessage = curl_error($ch); - if(!empty($curlErrorMessage)) { + if (!empty($curlErrorMessage)) { $message .= ' - curl error message: ' . $curlErrorMessage; } @@ -714,7 +711,7 @@ class Updater { return $path !== '.' && $path !== '..'; })); // only the downloaded archive - if(count($files) !== 1) { + if (count($files) !== 1) { throw new \Exception('There are more files than the downloaded archive in the downloads/ folder.'); } return $storageLocation . '/' . $files[0]; @@ -728,13 +725,13 @@ class Updater { public function verifyIntegrity() { $this->silentLog('[info] verifyIntegrity()'); - if($this->getCurrentReleaseChannel() === 'daily') { + if ($this->getCurrentReleaseChannel() === 'daily') { $this->silentLog('[info] current channel is "daily" which is not signed. Skipping verification.'); return; } $response = $this->getUpdateServerResponse(); - if(!isset($response['signature'])) { + if (!isset($response['signature'])) { throw new \Exception('No signature specified for defined update'); } @@ -775,7 +772,7 @@ EOF; OPENSSL_ALGO_SHA512 ); - if($validSignature === false) { + if ($validSignature === false) { throw new \Exception('Signature of update is not valid'); } @@ -792,7 +789,7 @@ EOF; private function getVersionByVersionFile($versionFile) { require $versionFile; - if(isset($OC_Version)) { + if (isset($OC_Version)) { /** @var array $OC_Version */ return implode('.', $OC_Version); } @@ -813,12 +810,12 @@ EOF; $zipState = $zip->open($downloadedFilePath); if ($zipState === true) { $extraction = $zip->extractTo(dirname($downloadedFilePath)); - if($extraction === false) { + if ($extraction === false) { throw new \Exception('Error during unpacking zipfile: '.($zip->getStatusString())); } $zip->close(); $state = unlink($downloadedFilePath); - if($state === false) { + if ($state === false) { throw new \Exception("Can't unlink ". $downloadedFilePath); } } else { @@ -828,7 +825,7 @@ EOF; // Ensure that the downloaded version is not lower $downloadedVersion = $this->getVersionByVersionFile(dirname($downloadedFilePath) . '/nextcloud/version.php'); $currentVersion = $this->getVersionByVersionFile($this->baseDir . '/../version.php'); - if(version_compare($downloadedVersion, $currentVersion, '<')) { + if (version_compare($downloadedVersion, $currentVersion, '<')) { throw new \Exception('Downloaded version is lower than installed version'); } @@ -856,14 +853,14 @@ EOF; foreach($filesToReplace as $file) { $this->silentLog('[info] replace ' . $file); $parentDir = dirname($this->baseDir . '/../' . $file); - if(!file_exists($parentDir)) { + if (!file_exists($parentDir)) { $r = mkdir($parentDir); - if($r !== true) { + if ($r !== true) { throw new \Exception('Can\'t create parent directory for entry point: ' . $file); } } $state = file_put_contents($this->baseDir . '/../' . $file, $content); - if($state === false) { + if ($state === false) { throw new \Exception('Can\'t replace entry point: '.$file); } } @@ -878,7 +875,7 @@ EOF; * @throws \Exception */ private function recursiveDelete($folder) { - if(!file_exists($folder)) { + if (!file_exists($folder)) { return; } $iterator = new \RecursiveIteratorIterator( @@ -908,7 +905,7 @@ EOF; } $state = rmdir($folder); - if($state === false) { + if ($state === false) { throw new \Exception('Could not rmdir ' . $folder); } } @@ -922,12 +919,12 @@ EOF; $this->silentLog('[info] deleteOldFiles()'); $shippedAppsFile = $this->baseDir . '/../core/shipped.json'; - if(!file_exists($shippedAppsFile)) { + if (!file_exists($shippedAppsFile)) { throw new \Exception('core/shipped.json is not available'); } $newShippedAppsFile = $this->getDataDirectoryLocation() . '/updater-'.$this->getConfigOption('instanceid') . '/downloads/nextcloud/core/shipped.json'; - if(!file_exists($newShippedAppsFile)) { + if (!file_exists($newShippedAppsFile)) { throw new \Exception('core/shipped.json is not available in the new release'); } @@ -941,7 +938,7 @@ EOF; } $configSampleFile = $this->baseDir . '/../config/config.sample.php'; - if(file_exists($configSampleFile)) { + if (file_exists($configSampleFile)) { $this->silentLog('[info] config sample exists'); // Delete example config @@ -952,7 +949,7 @@ EOF; } $themesReadme = $this->baseDir . '/../themes/README'; - if(file_exists($themesReadme)) { + if (file_exists($themesReadme)) { $this->silentLog('[info] themes README exists'); // Delete themes @@ -988,23 +985,23 @@ EOF; $fileName = explode($currentDir, $path)[1]; $folderStructure = explode('/', $fileName, -1); // Exclude the exclusions - if(isset($folderStructure[0])) { - if(array_search($folderStructure[0], $excludedElements) !== false) { + if (isset($folderStructure[0])) { + if (array_search($folderStructure[0], $excludedElements) !== false) { continue; } } else { - if(array_search($fileName, $excludedElements) !== false) { + if (array_search($fileName, $excludedElements) !== false) { continue; } } - if($fileInfo->isFile() || $fileInfo->isLink()) { + if ($fileInfo->isFile() || $fileInfo->isLink()) { $state = unlink($path); - if($state === false) { + if ($state === false) { throw new \Exception('Could not unlink: '.$path); } - } elseif($fileInfo->isDir()) { + } elseif ($fileInfo->isDir()) { $state = rmdir($path); - if($state === false) { + if ($state === false) { throw new \Exception('Could not rmdir: '.$path); } } @@ -1039,15 +1036,15 @@ EOF; } } - if($fileInfo->isFile()) { - if(!file_exists($this->baseDir . '/../' . dirname($fileName))) { + if ($fileInfo->isFile()) { + if (!file_exists($this->baseDir . '/../' . dirname($fileName))) { $state = mkdir($this->baseDir . '/../' . dirname($fileName), 0755, true); - if($state === false) { + if ($state === false) { throw new \Exception('Could not mkdir ' . $this->baseDir . '/../' . dirname($fileName)); } } $state = rename($path, $this->baseDir . '/../' . $fileName); - if($state === false) { + if ($state === false) { throw new \Exception( sprintf( 'Could not rename %s to %s', @@ -1057,9 +1054,9 @@ EOF; ); } } - if($fileInfo->isDir()) { + if ($fileInfo->isDir()) { $state = rmdir($path); - if($state === false) { + if ($state === false) { throw new \Exception('Could not rmdir ' . $path); } } @@ -1104,11 +1101,11 @@ EOF; $this->silentLog('[info] storage location: ' . $storageLocation); $this->moveWithExclusions($storageLocation, []); $state = rmdir($storageLocation); - if($state === false) { + if ($state === false) { throw new \Exception('Could not rmdir $storagelocation'); } $state = unlink($this->getDataDirectoryLocation() . '/updater-'.$this->getConfigOption('instanceid') . '/.step'); - if($state === false) { + if ($state === false) { throw new \Exception('Could not rmdir .step'); } @@ -1127,21 +1124,21 @@ EOF; */ private function writeStep($state, $step) { $updaterDir = $this->getDataDirectoryLocation() . '/updater-'.$this->getConfigOption('instanceid'); - if(!file_exists($updaterDir . '/.step')) { - if(!file_exists($updaterDir)) { + if (!file_exists($updaterDir . '/.step')) { + if (!file_exists($updaterDir)) { $result = mkdir($updaterDir); if ($result === false) { throw new \Exception('Could not create $updaterDir'); } } $result = touch($updaterDir . '/.step'); - if($result === false) { + if ($result === false) { throw new \Exception('Could not create .step'); } } $result = file_put_contents($updaterDir . '/.step', json_encode(['state' => $state, 'step' => $step])); - if($result === false) { + if ($result === false) { throw new \Exception('Could not write to .step'); } } @@ -1173,7 +1170,7 @@ EOF; $updaterDir = $this->getDataDirectoryLocation() . '/updater-'.$this->getConfigOption('instanceid'); $jsonData = []; - if(file_exists($updaterDir. '/.step')) { + if (file_exists($updaterDir. '/.step')) { $state = file_get_contents($updaterDir . '/.step'); if ($state === false) { throw new \Exception('Could not read from .step'); @@ -1197,7 +1194,7 @@ EOF; $this->silentLog('[info] rollbackChanges("' . $step . '")'); $updaterDir = $this->getDataDirectoryLocation() . '/updater-'.$this->getConfigOption('instanceid'); - if(file_exists($updaterDir . '/.step')) { + if (file_exists($updaterDir . '/.step')) { $this->silentLog('[info] unlink .step'); $state = unlink($updaterDir . '/.step'); if ($state === false) { @@ -1205,7 +1202,7 @@ EOF; } } - if($step >= 7) { + if ($step >= 7) { $this->silentLog('[info] rollbackChanges - step >= 7'); // TODO: If it fails after step 7: Rollback } @@ -1227,7 +1224,7 @@ EOF; $message .= 'Trace:' . PHP_EOL . $e->getTraceAsString() . PHP_EOL; $message .= 'File:' . $e->getFile() . PHP_EOL; $message .= 'Line:' . $e->getLine() . PHP_EOL; - if($e instanceof UpdateException) { + if ($e instanceof UpdateException) { $message .= 'Data:' . PHP_EOL . print_r($e->getData(), true) . PHP_EOL; } $this->log($message); @@ -1243,7 +1240,7 @@ EOF; $updaterLogPath = $this->getDataDirectoryLocation() . '/updater.log'; $fh = fopen($updaterLogPath, 'a'); - if($fh === false) { + if ($fh === false) { throw new LogException('Could not open updater.log'); } @@ -1260,7 +1257,7 @@ EOF; $logLine = date(\DateTime::ISO8601) . ' ' . $this->requestID . ' ' . $message . PHP_EOL; $result = fwrite($fh, $logLine); - if($result === false) { + if ($result === false) { throw new LogException('Could not write to updater.log'); } @@ -1311,7 +1308,7 @@ try { try { $updater->log('[info] request to updater'); } catch (\Exception $e) { - if(isset($_POST['step'])) { + if (isset($_POST['step'])) { // mark step as failed http_response_code(500); echo(json_encode(['proceed' => false, 'response' => $e->getMessage()])); @@ -1328,12 +1325,12 @@ $auth = new Auth($updater, $password); // Check if already a step is in process $currentStep = $updater->currentStep(); $stepNumber = 0; -if($currentStep !== []) { +if ($currentStep !== []) { $stepState = $currentStep['state']; $stepNumber = $currentStep['step']; $updater->log('[info] Step ' . $stepNumber . ' is in state "' . $stepState . '".'); - if($stepState === 'start') { + if ($stepState === 'start') { die( sprintf( 'Step %s is currently in process. Please reload this page later.', @@ -1343,16 +1340,16 @@ if($currentStep !== []) { } } -if(isset($_POST['step'])) { +if (isset($_POST['step'])) { $updater->log('[info] POST request for step "' . $_POST['step'] . '"'); set_time_limit(0); try { - if(!$auth->isAuthenticated()) { + if (!$auth->isAuthenticated()) { throw new \Exception('Not authenticated'); } $step = (int)$_POST['step']; - if($step > 12 || $step < 1) { + if ($step > 12 || $step < 1) { throw new \Exception('Invalid step'); } @@ -1407,7 +1404,7 @@ if(isset($_POST['step'])) { $message .= ' (and writing to log failed also with: ' . $logE->getMessage() . ')'; } - if(isset($step)) { + if (isset($step)) { $updater->rollbackChanges($step); } http_response_code(500); @@ -1422,7 +1419,7 @@ if(isset($_POST['step'])) { $message .= ' (and writing to log failed also with: ' . $logE->getMessage() . ')'; } - if(isset($step)) { + if (isset($step)) { $updater->rollbackChanges($step); } http_response_code(500); @@ -1435,7 +1432,7 @@ if(isset($_POST['step'])) { $updater->log('[info] show HTML page'); $updater->logVersion(); $updaterUrl = explode('?', $_SERVER['REQUEST_URI'], 2)[0]; -if(strpos($updaterUrl, 'index.php') === false) { +if (strpos($updaterUrl, 'index.php') === false) { $updaterUrl = rtrim($updaterUrl, '/') . '/index.php'; } ?> @@ -1730,7 +1727,7 @@ if(strpos($updaterUrl, 'index.php') === false) { <div id="content"> <div id="app-content"> - <?php if($auth->isAuthenticated()): ?> + <?php if ($auth->isAuthenticated()): ?> <ul id="progress" class="section"> <li id="step-init" class="step icon-loading passed-step"> <h2>Initializing</h2> @@ -1740,7 +1737,7 @@ if(strpos($updaterUrl, 'index.php') === false) { <?php if ($updater->updateAvailable() || $stepNumber > 0) { $buttonText = 'Start update'; - if($stepNumber > 0) { + if ($stepNumber > 0) { $buttonText = 'Continue update'; } ?> @@ -1751,53 +1748,53 @@ if(strpos($updaterUrl, 'index.php') === false) { <button id="retryUpdateButton" class="hidden">Retry update</button> </div> </li> - <li id="step-check-files" class="step <?php if($stepNumber >= 1) { echo 'passed-step'; }?>"> + <li id="step-check-files" class="step <?php if ($stepNumber >= 1) { echo 'passed-step'; }?>"> <h2>Check for expected files</h2> <div class="output hidden"></div> </li> - <li id="step-check-permissions" class="step <?php if($stepNumber >= 2) { echo 'passed-step'; }?>"> + <li id="step-check-permissions" class="step <?php if ($stepNumber >= 2) { echo 'passed-step'; }?>"> <h2>Check for write permissions</h2> <div class="output hidden"></div> </li> - <li id="step-backup" class="step <?php if($stepNumber >= 3) { echo 'passed-step'; }?>"> + <li id="step-backup" class="step <?php if ($stepNumber >= 3) { echo 'passed-step'; }?>"> <h2>Create backup</h2> <div class="output hidden"></div> </li> - <li id="step-download" class="step <?php if($stepNumber >= 4) { echo 'passed-step'; }?>"> + <li id="step-download" class="step <?php if ($stepNumber >= 4) { echo 'passed-step'; }?>"> <h2>Downloading</h2> <div class="output hidden"></div> </li> - <li id="step-verify-integrity" class="step <?php if($stepNumber >= 5) { echo 'passed-step'; }?>"> + <li id="step-verify-integrity" class="step <?php if ($stepNumber >= 5) { echo 'passed-step'; }?>"> <h2>Verifying integrity</h2> <div class="output hidden"></div> </li> - <li id="step-extract" class="step <?php if($stepNumber >= 6) { echo 'passed-step'; }?>"> + <li id="step-extract" class="step <?php if ($stepNumber >= 6) { echo 'passed-step'; }?>"> <h2>Extracting</h2> <div class="output hidden"></div> </li> - <li id="step-enable-maintenance" class="step <?php if($stepNumber >= 7) { echo 'passed-step'; }?>"> + <li id="step-enable-maintenance" class="step <?php if ($stepNumber >= 7) { echo 'passed-step'; }?>"> <h2>Enable maintenance mode</h2> <div class="output hidden"></div> </li> - <li id="step-entrypoints" class="step <?php if($stepNumber >= 8) { echo 'passed-step'; }?>"> + <li id="step-entrypoints" class="step <?php if ($stepNumber >= 8) { echo 'passed-step'; }?>"> <h2>Replace entry points</h2> <div class="output hidden"></div> </li> - <li id="step-delete" class="step <?php if($stepNumber >= 9) { echo 'passed-step'; }?>"> + <li id="step-delete" class="step <?php if ($stepNumber >= 9) { echo 'passed-step'; }?>"> <h2>Delete old files</h2> <div class="output hidden"></div> </li> - <li id="step-move" class="step <?php if($stepNumber >= 10) { echo 'passed-step'; }?>"> + <li id="step-move" class="step <?php if ($stepNumber >= 10) { echo 'passed-step'; }?>"> <h2>Move new files in place</h2> <div class="output hidden"></div> </li> - <li id="step-maintenance-mode" class="step <?php if($stepNumber >= 11) { echo 'passed-step'; }?>"> + <li id="step-maintenance-mode" class="step <?php if ($stepNumber >= 11) { echo 'passed-step'; }?>"> <h2>Continue with web based updater</h2> <div class="output hidden"> <button id="maintenance-disable">Disable maintenance mode and continue in the web based updater</button> </div> </li> - <li id="step-done" class="step <?php if($stepNumber >= 12) { echo 'passed-step'; }?>"> + <li id="step-done" class="step <?php if ($stepNumber >= 12) { echo 'passed-step'; }?>"> <h2>Done</h2> <div class="output hidden"> <a class="button" href="<?php echo htmlspecialchars(str_replace('/index.php', '/../', $updaterUrl), ENT_QUOTES); ?>">Go back to your Nextcloud instance to finish the update</a> @@ -1810,7 +1807,7 @@ if(strpos($updaterUrl, 'index.php') === false) { <p>To login you need to provide the unhashed value of "updater.secret" in your config file.</p> <p>If you don't know that value, you can access this updater directly via the Nextcloud admin screen or generate your own secret:</p> - <code>php -r '$password = trim(shell_exec("openssl rand -base64 48"));if(strlen($password) === 64) {$hash = password_hash($password, PASSWORD_DEFAULT) . "\n"; echo "Insert as \"updater.secret\": ".$hash; echo "The plaintext value is: ".$password."\n";}else{echo "Could not execute OpenSSL.\n";};'</code> + <code>php -r '$password = trim(shell_exec("openssl rand -base64 48"));if (strlen($password) === 64) {$hash = password_hash($password, PASSWORD_DEFAULT) . "\n"; echo "Insert as \"updater.secret\": ".$hash; echo "The plaintext value is: ".$password."\n";}else{echo "Could not execute OpenSSL.\n";};'</code> <form method="post" name="login"> <fieldset> <input type="password" name="updater-secret-input" value="" @@ -1819,7 +1816,7 @@ if(strpos($updaterUrl, 'index.php') === false) { <button id="updater-secret-submit">Login</button> </fieldset> </form> - <?php if(isset($_POST['updater-secret-input']) && !$auth->isAuthenticated()): ?> + <?php if (isset($_POST['updater-secret-input']) && !$auth->isAuthenticated()): ?> <p>Invalid password</p> <?php endif; ?> </div> @@ -1829,7 +1826,7 @@ if(strpos($updaterUrl, 'index.php') === false) { </div> </body> -<?php if($auth->isAuthenticated()): ?> +<?php if ($auth->isAuthenticated()) : ?> <script> function escapeHTML(s) { return s.toString().split('&').join('&').split('<').join('<').split('>').join('>').split('"').join('"').split('\'').join('''); @@ -2217,4 +2214,3 @@ if(strpos($updaterUrl, 'index.php') === false) { <?php endif; ?> </html> - |