auto-format all files; add table-definitions to test-bootstrap file
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
define('AREA', 'admin');
|
||||
require './lib/init.php';
|
||||
|
||||
use \Froxlor\Http\HttpClient;
|
||||
use Froxlor\Http\HttpClient;
|
||||
|
||||
// define update-uri
|
||||
define('UPDATE_URI', "https://version.froxlor.org/Froxlor/api/" . $version);
|
||||
@@ -38,26 +38,26 @@ if (! extension_loaded('zip')) {
|
||||
|
||||
// display initial version check
|
||||
if ($page == 'overview') {
|
||||
|
||||
|
||||
// log our actions
|
||||
$log->logAction(ADM_ACTION, LOG_NOTICE, "checking auto-update");
|
||||
|
||||
|
||||
// check for new version
|
||||
$latestversion = HttpClient::urlGet(UPDATE_URI);
|
||||
|
||||
|
||||
$latestversion = explode('|', $latestversion);
|
||||
|
||||
|
||||
if (is_array($latestversion) && count($latestversion) >= 1) {
|
||||
$_version = $latestversion[0];
|
||||
$_message = isset($latestversion[1]) ? $latestversion[1] : '';
|
||||
$_link = isset($latestversion[2]) ? $latestversion[2] : htmlspecialchars($filename . '?s=' . urlencode($s) . '&page=' . urlencode($page) . '&lookfornewversion=yes');
|
||||
|
||||
|
||||
// add the branding so debian guys are not gettings confused
|
||||
// about their version-number
|
||||
$version_label = $_version . $branding;
|
||||
$version_link = $_link;
|
||||
$message_addinfo = $_message;
|
||||
|
||||
|
||||
// not numeric -> error-message
|
||||
if (! preg_match('/^((\d+\\.)(\d+\\.)(\d+\\.)?(\d+)?(\-(svn|dev|rc)(\d+))?)$/', $_version)) {
|
||||
// check for customized version to not output
|
||||
@@ -74,7 +74,7 @@ if ($page == 'overview') {
|
||||
// nothing new
|
||||
$isnewerversion = 0;
|
||||
}
|
||||
|
||||
|
||||
// anzeige über version-status mit ggfls. formular
|
||||
// zum update schritt #1 -> download
|
||||
if ($isnewerversion == 1) {
|
||||
@@ -90,34 +90,34 @@ if ($page == 'overview') {
|
||||
\Froxlor\UI\Response::standard_error('customized_version');
|
||||
}
|
||||
}
|
||||
}// download the new archive
|
||||
} // download the new archive
|
||||
elseif ($page == 'getdownload') {
|
||||
|
||||
|
||||
// retrieve the new version from the form
|
||||
$newversion = isset($_POST['newversion']) ? $_POST['newversion'] : null;
|
||||
|
||||
|
||||
// valid?
|
||||
if ($newversion !== null) {
|
||||
|
||||
|
||||
// define files to get
|
||||
$toLoad = str_replace('{version}', $newversion, RELEASE_URI);
|
||||
$toCheck = str_replace('{version}', $newversion, CHECKSUM_URI);
|
||||
|
||||
|
||||
// check for local destination folder
|
||||
if (! is_dir(FROXLOR_INSTALL_DIR . '/updates/')) {
|
||||
mkdir(FROXLOR_INSTALL_DIR . '/updates/');
|
||||
}
|
||||
|
||||
|
||||
// name archive
|
||||
$localArchive = FROXLOR_INSTALL_DIR . '/updates/' . basename($toLoad);
|
||||
|
||||
|
||||
$log->logAction(ADM_ACTION, LOG_NOTICE, "Downloading " . $toLoad . " to " . $localArchive);
|
||||
|
||||
|
||||
// remove old archive
|
||||
if (file_exists($localArchive)) {
|
||||
@unlink($localArchive);
|
||||
}
|
||||
|
||||
|
||||
// get archive data
|
||||
try {
|
||||
HttpClient::fileGet($toLoad, $localArchive);
|
||||
@@ -128,7 +128,7 @@ elseif ($page == 'getdownload') {
|
||||
'errno' => 4
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
// validate the integrity of the downloaded file
|
||||
$_shouldsum = HttpClient::urlGet($toCheck);
|
||||
if (! empty($_shouldsum)) {
|
||||
@@ -138,7 +138,7 @@ elseif ($page == 'getdownload') {
|
||||
$shouldsum = null;
|
||||
}
|
||||
$filesum = hash_file('sha256', $localArchive);
|
||||
|
||||
|
||||
if ($filesum != $shouldsum) {
|
||||
\Froxlor\UI\Response::redirectTo($filename, array(
|
||||
's' => $s,
|
||||
@@ -146,7 +146,7 @@ elseif ($page == 'getdownload') {
|
||||
'errno' => 9
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
// to the next step
|
||||
\Froxlor\UI\Response::redirectTo($filename, array(
|
||||
's' => $s,
|
||||
@@ -159,12 +159,12 @@ elseif ($page == 'getdownload') {
|
||||
'page' => 'error',
|
||||
'errno' => 6
|
||||
));
|
||||
}// extract and install new version
|
||||
} // extract and install new version
|
||||
elseif ($page == 'extract') {
|
||||
|
||||
|
||||
$toExtract = isset($_GET['archive']) ? $_GET['archive'] : null;
|
||||
$localArchive = FROXLOR_INSTALL_DIR . '/updates/' . $toExtract;
|
||||
|
||||
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
// decompress from zip
|
||||
$zip = new ZipArchive();
|
||||
@@ -183,13 +183,13 @@ elseif ($page == 'extract') {
|
||||
'errno' => 8
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
// redirect to update-page?
|
||||
\Froxlor\UI\Response::redirectTo('admin_updates.php', array(
|
||||
's' => $s
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
if (! file_exists($localArchive)) {
|
||||
\Froxlor\UI\Response::redirectTo($filename, array(
|
||||
's' => $s,
|
||||
@@ -197,18 +197,17 @@ elseif ($page == 'extract') {
|
||||
'errno' => 7
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
$text = 'Extract downloaded archive "' . $toExtract . '"?';
|
||||
$hiddenparams = '';
|
||||
$yesfile = $filename . '?s=' . $s . '&page=extract&archive=' . $toExtract;
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate("misc/question_yesno", true) . "\";");
|
||||
}
|
||||
// display error
|
||||
} // display error
|
||||
elseif ($page == 'error') {
|
||||
|
||||
|
||||
// retrieve error-number via url-parameter
|
||||
$errno = isset($_GET['errno']) ? (int) $_GET['errno'] : 0;
|
||||
|
||||
|
||||
// 2 = no Zlib
|
||||
// 3 = custom version detected
|
||||
// 4 = could not store archive to local hdd
|
||||
|
||||
Reference in New Issue
Block a user