fully migrate admin_updates; removed unused Froxlor\UI\Paging;
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
@@ -59,70 +59,68 @@ if ($page == 'overview') {
|
||||
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
if ((isset($_POST['update_preconfig']) && isset($_POST['update_changesagreed']) && intval($_POST['update_changesagreed']) != 0) || !isset($_POST['update_preconfig'])) {
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate('update/update_start') . "\";");
|
||||
|
||||
include_once \Froxlor\Froxlor::getInstallDir() . 'install/updatesql.php';
|
||||
|
||||
$redirect_url = 'admin_index.php';
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate('update/update_end') . "\";");
|
||||
|
||||
\Froxlor\User::updateCounters();
|
||||
\Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::REBUILD_VHOST);
|
||||
@chmod(\Froxlor\Froxlor::getInstallDir() . '/lib/userdata.inc.php', 0400);
|
||||
|
||||
$successful_update = true;
|
||||
UI::view('install/update.html.twig', [
|
||||
'checks' => $update_tasks
|
||||
]);
|
||||
exit;
|
||||
} else {
|
||||
$message = '<br><br><strong>You have to agree that you have read the update notifications.</strong>';
|
||||
}
|
||||
}
|
||||
|
||||
if (!$successful_update) {
|
||||
$current_version = Settings::Get('panel.version');
|
||||
$current_db_version = Settings::Get('panel.db_version');
|
||||
if (empty($current_db_version)) {
|
||||
$current_db_version = "0";
|
||||
}
|
||||
$new_version = $version;
|
||||
$new_db_version = $dbversion;
|
||||
$current_version = Settings::Get('panel.version');
|
||||
$current_db_version = Settings::Get('panel.db_version');
|
||||
if (empty($current_db_version)) {
|
||||
$current_db_version = "0";
|
||||
}
|
||||
$new_version = $version;
|
||||
$new_db_version = $dbversion;
|
||||
|
||||
$ui_text = $lng['update']['update_information']['part_a'];
|
||||
if ($version != $current_version) {
|
||||
$ui_text = str_replace('%curversion', $current_version, $ui_text);
|
||||
$ui_text = str_replace('%newversion', $new_version, $ui_text);
|
||||
} else {
|
||||
// show db version
|
||||
$ui_text = str_replace('%curversion', $current_db_version, $ui_text);
|
||||
$ui_text = str_replace('%newversion', $new_db_version, $ui_text);
|
||||
}
|
||||
$ui_text .= $lng['update']['update_information']['part_b'];
|
||||
$ui_text = $lng['update']['update_information']['part_a'];
|
||||
if ($version != $current_version) {
|
||||
$ui_text = str_replace('%curversion', $current_version, $ui_text);
|
||||
$ui_text = str_replace('%newversion', $new_version, $ui_text);
|
||||
} else {
|
||||
// show db version
|
||||
$ui_text = str_replace('%curversion', $current_db_version, $ui_text);
|
||||
$ui_text = str_replace('%newversion', $new_db_version, $ui_text);
|
||||
}
|
||||
$ui_text .= $lng['update']['update_information']['part_b'];
|
||||
|
||||
$upd_formfield = [
|
||||
'updates' => [
|
||||
'title' => $lng['update']['update'],
|
||||
'image' => 'fa-solid fa-download',
|
||||
'sections' => [],
|
||||
'buttons' => [
|
||||
[
|
||||
'label' => $lng['update']['proceed']
|
||||
]
|
||||
$upd_formfield = [
|
||||
'updates' => [
|
||||
'title' => $lng['update']['update'],
|
||||
'image' => 'fa-solid fa-download',
|
||||
'description' => $lng['update']['description'],
|
||||
'sections' => [],
|
||||
'buttons' => [
|
||||
[
|
||||
'label' => $lng['update']['proceed']
|
||||
]
|
||||
]
|
||||
];
|
||||
]
|
||||
];
|
||||
|
||||
include_once \Froxlor\Froxlor::getInstallDir() . '/install/updates/preconfig.php';
|
||||
$preconfig = getPreConfig($current_version, $current_db_version);
|
||||
if (!empty($preconfig)) {
|
||||
$upd_formfield['updates']['sections'] = $preconfig;
|
||||
}
|
||||
|
||||
UI::view('user/form-note.html.twig', [
|
||||
'formaction' => $linker->getLink(array('section' => 'updates')),
|
||||
'formdata' => $upd_formfield['updates'],
|
||||
// alert
|
||||
'type' => !empty($message) ? 'danger' : 'info',
|
||||
'alert_msg' => $ui_text . $message
|
||||
]);
|
||||
include_once \Froxlor\Froxlor::getInstallDir() . '/install/updates/preconfig.php';
|
||||
$preconfig = getPreConfig($current_version, $current_db_version);
|
||||
if (!empty($preconfig)) {
|
||||
$upd_formfield['updates']['sections'] = $preconfig;
|
||||
}
|
||||
|
||||
UI::view('user/form-note.html.twig', [
|
||||
'formaction' => $linker->getLink(array('section' => 'updates')),
|
||||
'formdata' => $upd_formfield['updates'],
|
||||
// alert
|
||||
'type' => !empty($message) ? 'danger' : 'info',
|
||||
'alert_msg' => $ui_text . $message
|
||||
]);
|
||||
} else {
|
||||
\Froxlor\UI\Response::standard_success('noupdatesavail');
|
||||
}
|
||||
|
||||
@@ -18,27 +18,24 @@
|
||||
/**
|
||||
* Function showUpdateStep
|
||||
*
|
||||
* outputs and logs the current
|
||||
* update progress
|
||||
* stores and logs the current update progress
|
||||
*
|
||||
* @param
|
||||
* string task/status
|
||||
* @param
|
||||
* bool needs_status (if false, a linebreak will be added)
|
||||
* @param string $task
|
||||
* @param bool $needs_status (if false, a linebreak will be added)
|
||||
*
|
||||
* @return string formatted output and log-entry
|
||||
* @return void
|
||||
*/
|
||||
function showUpdateStep($task = null, $needs_status = true)
|
||||
{
|
||||
global $update_tasks, $task_counter;
|
||||
|
||||
set_time_limit(30);
|
||||
if (! $needs_status)
|
||||
echo "<b>";
|
||||
|
||||
// output
|
||||
echo $task;
|
||||
$update_tasks[$task_counter] = ['title' => $task, 'result' => 0];
|
||||
|
||||
if (! $needs_status) {
|
||||
echo "</b><br />";
|
||||
if (!$needs_status) {
|
||||
$task_counter++;
|
||||
}
|
||||
|
||||
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_WARNING, $task);
|
||||
@@ -47,40 +44,39 @@ function showUpdateStep($task = null, $needs_status = true)
|
||||
/**
|
||||
* Function lastStepStatus
|
||||
*
|
||||
* outputs [OK] (success), [??] (warning) or [!!] (failure)
|
||||
* of the last update-step
|
||||
* outputs status of the last update-step
|
||||
*
|
||||
* @param
|
||||
* int status (0 = success, 1 = warning, 2 = failure)
|
||||
* @param int $status (0 = success, 1 = warning, 2 = failure)
|
||||
* @param string $message
|
||||
* @param string $additional_info
|
||||
*
|
||||
* @return string formatted output and log-entry
|
||||
*/
|
||||
function lastStepStatus($status = -1, $message = '')
|
||||
function lastStepStatus(int $status = -1, string $message = '', string $additional_info = '')
|
||||
{
|
||||
global $update_tasks, $task_counter;
|
||||
|
||||
$update_tasks[$task_counter]['result_txt'] = $message ?? 'OK';
|
||||
$update_tasks[$task_counter]['result_desc'] = $additional_info ?? '';
|
||||
|
||||
switch ($status) {
|
||||
|
||||
case 0:
|
||||
$status_sign = ($message != '') ? '[' . $message . ']' : '[OK]';
|
||||
$status_color = 'ok';
|
||||
break;
|
||||
case 1:
|
||||
$status_sign = ($message != '') ? '[' . $message . ']' : '[??]';
|
||||
$status_color = 'warn';
|
||||
$update_tasks[$task_counter]['result'] = 2;
|
||||
break;
|
||||
case 2:
|
||||
$status_sign = ($message != '') ? '[' . $message . ']' : '[!!]';
|
||||
$status_color = 'err';
|
||||
$update_tasks[$task_counter]['result'] = 1;
|
||||
break;
|
||||
default:
|
||||
$status_sign = '[unknown]';
|
||||
$status_color = 'unknown';
|
||||
$update_tasks[$task_counter]['result'] = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
// output
|
||||
echo "<span class=\"update-step update-step-" . $status_color . "\">" . $status_sign . "</span><br />";
|
||||
$task_counter++;
|
||||
|
||||
if ($status == - 1 || $status == 2) {
|
||||
if ($status == -1 || $status == 2) {
|
||||
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_WARNING, 'Attention - last update task failed!!!');
|
||||
} elseif ($status == 0 || $status == 1) {
|
||||
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_WARNING, 'Success');
|
||||
|
||||
@@ -62,8 +62,7 @@ if (\Froxlor\Froxlor::isFroxlorVersion('0.10.99')) {
|
||||
// none of the files existed
|
||||
lastStepStatus(0);
|
||||
} else {
|
||||
lastStepStatus(1, 'manual commands needed');
|
||||
echo '<span class="update-step update-step-err">Please run the following commands manually:</span><br><pre>' . $del_list . '</pre><br>';
|
||||
lastStepStatus(1, 'manual commands needed', 'Please run the following commands manually:<br><pre>' . $del_list . '</pre>');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -553,7 +553,6 @@ function parseAndOutputPreconfig(&$has_preconfig, &$return, $current_version, $c
|
||||
$has_preconfig = true;
|
||||
$description = 'The template-variable {PASSWORD} has been replaced with {LINK}. Please update your password reset templates!';
|
||||
$return['update_template_var_password_changed_note'] = ['type' => 'infotext', 'value' => $description];
|
||||
eval("\$return.=\"" . \Froxlor\UI\Template::getTemplate("update/preconfigitem") . "\";");
|
||||
}
|
||||
|
||||
if (versionInUpdate($current_version, '0.9.31-dev5')) {
|
||||
|
||||
@@ -16,12 +16,13 @@
|
||||
* @package Install
|
||||
*
|
||||
*/
|
||||
|
||||
use Froxlor\FroxlorLogger;
|
||||
|
||||
require_once __DIR__ . '/lib/updateFunctions.php';
|
||||
|
||||
if (! defined('_CRON_UPDATE')) {
|
||||
if (! defined('AREA') || (defined('AREA') && AREA != 'admin') || ! isset($userinfo['loginname']) || (isset($userinfo['loginname']) && $userinfo['loginname'] == '')) {
|
||||
if (!defined('_CRON_UPDATE')) {
|
||||
if (!defined('AREA') || (defined('AREA') && AREA != 'admin') || !isset($userinfo['loginname']) || (isset($userinfo['loginname']) && $userinfo['loginname'] == '')) {
|
||||
header('Location: ../index.php');
|
||||
exit();
|
||||
}
|
||||
@@ -40,18 +41,24 @@ try {
|
||||
}
|
||||
|
||||
if (\Froxlor\Froxlor::isFroxlor()) {
|
||||
include_once (\Froxlor\FileDir::makeCorrectFile(dirname(__FILE__) . '/updates/froxlor/0.9/update_0.9.inc.php'));
|
||||
include_once (\Froxlor\FileDir::makeCorrectFile(dirname(__FILE__) . '/updates/froxlor/0.10/update_0.10.inc.php'));
|
||||
|
||||
// will be filled and increased by the update include-files below
|
||||
$update_tasks = [];
|
||||
$task_counter = 0;
|
||||
|
||||
include_once(\Froxlor\FileDir::makeCorrectFile(dirname(__FILE__) . '/updates/froxlor/0.9/update_0.9.inc.php'));
|
||||
include_once(\Froxlor\FileDir::makeCorrectFile(dirname(__FILE__) . '/updates/froxlor/0.10/update_0.10.inc.php'));
|
||||
include_once(\Froxlor\FileDir::makeCorrectFile(dirname(__FILE__) . '/updates/froxlor/0.11/update_0.11.inc.php'));
|
||||
|
||||
// Check Froxlor - database integrity (only happens after all updates are done, so we know the db-layout is okay)
|
||||
showUpdateStep("Checking database integrity");
|
||||
|
||||
$integrity = new \Froxlor\Database\IntegrityCheck();
|
||||
if (! $integrity->checkAll()) {
|
||||
if (!$integrity->checkAll()) {
|
||||
lastStepStatus(1, 'Monkeys ate the integrity');
|
||||
showUpdateStep("Trying to remove monkeys, feeding bananas");
|
||||
if (! $integrity->fixAll()) {
|
||||
lastStepStatus(2, 'Some monkeys just would not move, you should contact team@froxlor.org');
|
||||
if (!$integrity->fixAll()) {
|
||||
lastStepStatus(2, 'failed', 'Some monkeys just would not move, you should contact team@froxlor.org');
|
||||
} else {
|
||||
lastStepStatus(0, 'Integrity restored');
|
||||
}
|
||||
|
||||
@@ -1,504 +0,0 @@
|
||||
<?php
|
||||
namespace Froxlor\UI;
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2003-2009 the SysCP Team (see authors).
|
||||
* Copyright (c) 2010 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org> (2003-2009)
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Classes
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class to manage paging system
|
||||
*
|
||||
* @package Functions
|
||||
* @deprecated
|
||||
*/
|
||||
class Paging
|
||||
{
|
||||
|
||||
/**
|
||||
* Userinfo
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $userinfo = array();
|
||||
|
||||
/**
|
||||
* MySQL-Table
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $table = '';
|
||||
|
||||
/**
|
||||
* Fields with description which should be selectable
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $fields = array();
|
||||
|
||||
/**
|
||||
* Entries per page
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $entriesperpage = 0;
|
||||
|
||||
/**
|
||||
* Number of entries of table
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $entries = 0;
|
||||
|
||||
/**
|
||||
* Sortorder, asc or desc
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $sortorder = 'asc';
|
||||
|
||||
/**
|
||||
* Sortfield
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $sortfield = '';
|
||||
|
||||
/**
|
||||
* Searchfield
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $searchfield = '';
|
||||
|
||||
/**
|
||||
* Searchtext
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $searchtext = '';
|
||||
|
||||
/**
|
||||
* Pagenumber
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $pageno = 0;
|
||||
|
||||
/**
|
||||
* Switch natsorting on/off
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
private $natSorting = false;
|
||||
|
||||
private $limit = 0;
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
* Loads settings from request or from userdata and saves them to session.
|
||||
*
|
||||
* @param
|
||||
* array userinfo
|
||||
* @param
|
||||
* string Name of Table
|
||||
* @param
|
||||
* array Fields, in format array( 'fieldname_in_mysql' => 'field_caption' )
|
||||
* @param
|
||||
* int *deprecated* entries per page
|
||||
* @param
|
||||
* bool *deprecated* Switch natsorting on/off (global, affects all calls of sort)
|
||||
* @param int $default_field
|
||||
* default sorting-field-index
|
||||
* @param string $default_order
|
||||
* default sorting order 'asc' or 'desc'
|
||||
*
|
||||
*/
|
||||
public function __construct($userinfo, $table, $fields, $entriesperpage = 0, $natSorting = false, $default_field = 0, $default_order = 'asc', $limit = 0)
|
||||
{
|
||||
|
||||
// entries per page and natsorting-flag are not
|
||||
// passed as parameter anymore, because these are
|
||||
// from the settings anyway
|
||||
$entriesperpage = \Froxlor\Settings::Get('panel.paging');
|
||||
$natSorting = \Froxlor\Settings::Get('panel.natsorting');
|
||||
|
||||
$this->userinfo = $userinfo;
|
||||
|
||||
if (! is_array($this->userinfo['lastpaging'])) {
|
||||
$this->userinfo['lastpaging'] = json_decode($this->userinfo['lastpaging'], true);
|
||||
}
|
||||
|
||||
$this->table = $table;
|
||||
$this->fields = $fields;
|
||||
$this->entriesperpage = $entriesperpage;
|
||||
$this->natSorting = $natSorting;
|
||||
$checklastpaging = (isset($this->userinfo['lastpaging']['table']) && $this->userinfo['lastpaging']['table'] == $this->table);
|
||||
$this->userinfo['lastpaging']['table'] = $this->table;
|
||||
|
||||
if (isset($_REQUEST['sortorder']) && (strtolower($_REQUEST['sortorder']) == 'desc' || strtolower($_REQUEST['sortorder']) == 'asc')) {
|
||||
$this->sortorder = strtolower($_REQUEST['sortorder']);
|
||||
} else {
|
||||
|
||||
if ($checklastpaging && isset($this->userinfo['lastpaging']['sortorder']) && (strtolower($this->userinfo['lastpaging']['sortorder']) == 'desc' || strtolower($this->userinfo['lastpaging']['sortorder']) == 'asc')) {
|
||||
$this->sortorder = strtolower($this->userinfo['lastpaging']['sortorder']);
|
||||
} else {
|
||||
$this->sortorder = $default_order;
|
||||
}
|
||||
}
|
||||
|
||||
$this->userinfo['lastpaging']['sortorder'] = $this->sortorder;
|
||||
|
||||
if (isset($_REQUEST['sortfield']) && isset($fields[$_REQUEST['sortfield']])) {
|
||||
$this->sortfield = $_REQUEST['sortfield'];
|
||||
} else {
|
||||
if ($checklastpaging && isset($this->userinfo['lastpaging']['sortfield']) && isset($fields[$this->userinfo['lastpaging']['sortfield']])) {
|
||||
$this->sortfield = $this->userinfo['lastpaging']['sortfield'];
|
||||
} else {
|
||||
$fieldnames = array_keys($fields);
|
||||
$this->sortfield = $fieldnames[$default_field];
|
||||
}
|
||||
}
|
||||
|
||||
$this->userinfo['lastpaging']['sortfield'] = $this->sortfield;
|
||||
|
||||
if (isset($_REQUEST['searchfield']) && isset($fields[$_REQUEST['searchfield']])) {
|
||||
$this->searchfield = $_REQUEST['searchfield'];
|
||||
} else {
|
||||
if ($checklastpaging && isset($this->userinfo['lastpaging']['searchfield']) && isset($fields[$this->userinfo['lastpaging']['searchfield']])) {
|
||||
$this->searchfield = $this->userinfo['lastpaging']['searchfield'];
|
||||
} else {
|
||||
$fieldnames = array_keys($fields);
|
||||
$this->searchfield = $fieldnames[0];
|
||||
}
|
||||
}
|
||||
|
||||
$this->userinfo['lastpaging']['searchfield'] = $this->searchfield;
|
||||
|
||||
if (isset($_REQUEST['searchtext']) && (preg_match('/[-_@\p{L}\p{N}*.]+$/u', $_REQUEST['searchtext']) || $_REQUEST['searchtext'] === '')) {
|
||||
$this->searchtext = trim($_REQUEST['searchtext']);
|
||||
} else {
|
||||
if ($checklastpaging && isset($this->userinfo['lastpaging']['searchtext']) && preg_match('/[-_@\p{L}\p{N}*.]+$/u', $this->userinfo['lastpaging']['searchtext'])) {
|
||||
$this->searchtext = $this->userinfo['lastpaging']['searchtext'];
|
||||
} else {
|
||||
$this->searchtext = '';
|
||||
}
|
||||
}
|
||||
|
||||
$this->userinfo['lastpaging']['searchtext'] = $this->searchtext;
|
||||
|
||||
if (isset($_REQUEST['pageno']) && intval($_REQUEST['pageno']) != 0) {
|
||||
$this->pageno = intval($_REQUEST['pageno']);
|
||||
} else {
|
||||
if ($checklastpaging && isset($this->userinfo['lastpaging']['pageno']) && intval($this->userinfo['lastpaging']['pageno']) != 0) {
|
||||
$this->pageno = intval($this->userinfo['lastpaging']['pageno']);
|
||||
} else {
|
||||
$this->pageno = 1;
|
||||
}
|
||||
}
|
||||
|
||||
$this->userinfo['lastpaging']['pageno'] = $this->pageno;
|
||||
$this->limit = $limit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets number of entries and adjusts pageno if the number of entries doesn't correspond to the pageno.
|
||||
*
|
||||
* @param
|
||||
* int entries
|
||||
*/
|
||||
public function setEntries($entries)
|
||||
{
|
||||
$this->entries = $entries;
|
||||
|
||||
if (($this->pageno - 1) * $this->entriesperpage > $this->entries) {
|
||||
$this->pageno = 1;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a row should be displayed or not, used in loops
|
||||
*
|
||||
* @param
|
||||
* int number of row
|
||||
* @return bool to display or not to display, that's the question
|
||||
*/
|
||||
public function checkDisplay($count)
|
||||
{
|
||||
$begin = (intval($this->pageno) - 1) * intval($this->entriesperpage);
|
||||
$end = (intval($this->pageno) * intval($this->entriesperpage));
|
||||
return (($count >= $begin && $count < $end) || $this->entriesperpage == 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns condition code for sql query
|
||||
*
|
||||
* @param
|
||||
* bool should returned condition code start with WHERE (false) or AND (true)?
|
||||
* @return string the condition code
|
||||
*/
|
||||
public function getSqlWhere($append = false)
|
||||
{
|
||||
if ($this->searchtext != '') {
|
||||
if ($append == true) {
|
||||
$condition = ' AND ';
|
||||
} else {
|
||||
$condition = ' WHERE ';
|
||||
}
|
||||
|
||||
$searchfield = explode('.', $this->searchfield);
|
||||
foreach ($searchfield as $id => $field) {
|
||||
if (substr($field, - 1, 1) != '`') {
|
||||
$field .= '`';
|
||||
}
|
||||
|
||||
if ($field[0] != '`') {
|
||||
$field = '`' . $field;
|
||||
}
|
||||
|
||||
$searchfield[$id] = $field;
|
||||
}
|
||||
|
||||
$searchfield = implode('.', $searchfield);
|
||||
|
||||
$ops = array(
|
||||
'<',
|
||||
'>',
|
||||
'='
|
||||
);
|
||||
|
||||
// check if we use an operator or not
|
||||
$useOper = 0;
|
||||
$oper = "=";
|
||||
if (in_array(substr($this->searchtext, 0, 1), $ops)) {
|
||||
$useOper = 1;
|
||||
$oper = substr($this->searchtext, 0, 1);
|
||||
}
|
||||
|
||||
// check for diskspace and whether searchtext is a number
|
||||
// in any other case the logical-operators would make no sense
|
||||
if (strpos($searchfield, 'diskspace') > 0 && is_numeric(substr($this->searchtext, $useOper))) {
|
||||
// anything with diskspace is *1024
|
||||
$searchtext = ((int) substr($this->searchtext, $useOper)) * 1024;
|
||||
$useOper = 1;
|
||||
} elseif (strpos($searchfield, 'traffic') > 0 && is_numeric(substr($this->searchtext, $useOper))) {
|
||||
// anything with traffic is *1024*1024
|
||||
$searchtext = ((int) substr($this->searchtext, $useOper)) * 1024 * 1024;
|
||||
$useOper = 1;
|
||||
} else {
|
||||
// any other field
|
||||
$searchtext = substr($this->searchtext, $useOper);
|
||||
}
|
||||
|
||||
if ($useOper == 1 && is_numeric(substr($this->searchtext, $useOper))) {
|
||||
// now as we use >, < or = we use the given operator and not LIKE
|
||||
$condition .= $searchfield . " " . $oper . " " . \Froxlor\Database\Database::quote($searchtext);
|
||||
} else {
|
||||
$searchtext = str_replace('*', '%', $this->searchtext);
|
||||
// append wildcards if user did not enter any
|
||||
if (strpos($searchtext, '%') === false)
|
||||
$searchtext = '%' . $searchtext . '%';
|
||||
$condition .= $searchfield . " LIKE " . \Froxlor\Database\Database::quote($searchtext);
|
||||
}
|
||||
} else {
|
||||
$condition = '';
|
||||
}
|
||||
|
||||
return $condition;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns "order by"-code for sql query
|
||||
*
|
||||
* @param
|
||||
* bool Switch natsorting on/off (local, affects just this call)
|
||||
* @return string the "order by"-code
|
||||
*/
|
||||
public function getSqlOrderBy($natSorting = null)
|
||||
{
|
||||
$sortfield = explode('.', $this->sortfield);
|
||||
foreach ($sortfield as $id => $field) {
|
||||
if (substr($field, - 1, 1) != '`') {
|
||||
$field .= '`';
|
||||
}
|
||||
|
||||
if ($field[0] != '`') {
|
||||
$field = '`' . $field;
|
||||
}
|
||||
|
||||
$sortfield[$id] = $field;
|
||||
}
|
||||
|
||||
$sortfield = implode('.', $sortfield);
|
||||
$sortorder = strtoupper($this->sortorder);
|
||||
|
||||
if ($natSorting == true || ($natSorting === null && $this->natSorting == true)) {
|
||||
// Acts similar to php's natsort(), found in one comment at http://my.opera.com/cpr/blog/show.dml/160556
|
||||
$sortcode = "ORDER BY CONCAT( IF( ASCII( LEFT( " . $sortfield . ", 5 ) ) > 57,
|
||||
LEFT( " . $sortfield . ", 1 ), 0 ),
|
||||
IF( ASCII( RIGHT( " . $sortfield . ", 1 ) ) > 57,
|
||||
LPAD( " . $sortfield . ", 255, '0' ),
|
||||
LPAD( CONCAT( " . $sortfield . ", '-' ), 255, '0' )
|
||||
)) " . $sortorder;
|
||||
} else {
|
||||
$sortcode = 'ORDER BY ' . $sortfield . ' ' . $sortorder;
|
||||
}
|
||||
|
||||
return $sortcode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Currently not used
|
||||
*
|
||||
* @return string always empty
|
||||
*/
|
||||
public function getSqlLimit()
|
||||
{
|
||||
if ($this->limit > 0) {
|
||||
$_offset = ($this->pageno - 1) * $this->limit;
|
||||
return ' LIMIT ' . $_offset . ',' . $this->limit;
|
||||
}
|
||||
/**
|
||||
* currently not in use
|
||||
*/
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns html code for sorting field
|
||||
*
|
||||
* @param
|
||||
* array Language array
|
||||
* @return string the html sortcode
|
||||
*/
|
||||
public function getHtmlSortCode($lng, $break = false)
|
||||
{
|
||||
$sortcode = '';
|
||||
$fieldoptions = '';
|
||||
$orderoptions = '';
|
||||
|
||||
foreach ($this->fields as $fieldname => $fieldcaption) {
|
||||
$fieldoptions .= HTML::makeoption($fieldcaption, $fieldname, $this->sortfield, true, true);
|
||||
}
|
||||
|
||||
$breakorws = ($break ? '<br />' : ' ');
|
||||
foreach (array(
|
||||
'asc' => $lng['panel']['ascending'],
|
||||
'desc' => $lng['panel']['descending']
|
||||
) as $sortordertype => $sortorderdescription) {
|
||||
$orderoptions .= HTML::makeoption($sortorderdescription, $sortordertype, $this->sortorder, true, true);
|
||||
}
|
||||
|
||||
eval("\$sortcode =\"" . Template::getTemplate("misc/htmlsortcode", '1') . "\";");
|
||||
return $sortcode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns html code for sorting arrows
|
||||
*
|
||||
* @param
|
||||
* string URL to use as base for links
|
||||
* @param
|
||||
* string If set, only this field will be returned
|
||||
* @return mixed An array or a string (if field is set) of html code of arrows
|
||||
*/
|
||||
public function getHtmlArrowCode($baseurl, $field = '')
|
||||
{
|
||||
global $theme;
|
||||
|
||||
if ($field != '' && isset($this->fields[$field])) {
|
||||
$baseurl = htmlspecialchars($baseurl);
|
||||
$fieldname = htmlspecialchars($field);
|
||||
eval("\$arrowcode =\"" . Template::getTemplate("misc/htmlarrowcode", '1') . "\";");
|
||||
} else {
|
||||
$baseurl = htmlspecialchars($baseurl);
|
||||
$arrowcode = array();
|
||||
foreach ($this->fields as $fieldname => $fieldcaption) {
|
||||
$fieldname = htmlspecialchars($fieldname);
|
||||
eval("\$arrowcode[\$fieldname] =\"" . Template::getTemplate("misc/htmlarrowcode", '1') . "\";");
|
||||
}
|
||||
}
|
||||
|
||||
return $arrowcode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns html code for searching field
|
||||
*
|
||||
* @param
|
||||
* array Language array
|
||||
* @return string the html searchcode
|
||||
*/
|
||||
public function getHtmlSearchCode($lng)
|
||||
{
|
||||
$searchcode = '';
|
||||
$fieldoptions = '';
|
||||
$searchtext = htmlspecialchars($this->searchtext);
|
||||
foreach ($this->fields as $fieldname => $fieldcaption) {
|
||||
$fieldoptions .= HTML::makeoption($fieldcaption, $fieldname, $this->searchfield, true, true);
|
||||
}
|
||||
eval("\$searchcode =\"" . Template::getTemplate("misc/htmlsearchcode", '1') . "\";");
|
||||
return $searchcode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns html code for paging
|
||||
*
|
||||
* @param
|
||||
* string URL to use as base for links
|
||||
* @return string the html pagingcode
|
||||
*/
|
||||
public function getHtmlPagingCode($baseurl)
|
||||
{
|
||||
if ($this->entriesperpage == 0) {
|
||||
return '';
|
||||
} else {
|
||||
$pages = intval($this->entries / $this->entriesperpage);
|
||||
}
|
||||
|
||||
if ($this->entries % $this->entriesperpage != 0) {
|
||||
$pages ++;
|
||||
}
|
||||
|
||||
if ($pages > 1) {
|
||||
|
||||
$start = $this->pageno - 4;
|
||||
if ($start < 1) {
|
||||
$start = 1;
|
||||
}
|
||||
|
||||
$stop = $this->pageno + 4;
|
||||
if ($stop > $pages) {
|
||||
$stop = $pages;
|
||||
}
|
||||
|
||||
$pagingcode = '<a href="' . htmlspecialchars($baseurl) . '&pageno=1">«</a> <a href="' . htmlspecialchars($baseurl) . '&pageno=' . ((intval($this->pageno) - 1) == 0 ? '1' : intval($this->pageno) - 1) . '"><</a> ';
|
||||
for ($i = $start; $i <= $stop; $i ++) {
|
||||
if ($i != $this->pageno) {
|
||||
$pagingcode .= ' <a href="' . htmlspecialchars($baseurl) . '&pageno=' . $i . '">' . $i . '</a> ';
|
||||
} else {
|
||||
$pagingcode .= ' <strong>' . $i . '</strong> ';
|
||||
}
|
||||
}
|
||||
$pagingcode .= ' <a href="' . htmlspecialchars($baseurl) . '&pageno=' . ((intval($this->pageno) + 1) > $pages ? $pages : intval($this->pageno) + 1) . '">></a> <a href="' . $baseurl . '&pageno=' . $pages . '">»</a>';
|
||||
} else {
|
||||
$pagingcode = '';
|
||||
}
|
||||
|
||||
return $pagingcode;
|
||||
}
|
||||
}
|
||||
@@ -51,6 +51,8 @@ class Template
|
||||
* string noarea If area should be used to get template
|
||||
* @return string The Template
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
public static function getTemplate($template, $noarea = 0)
|
||||
{
|
||||
|
||||
@@ -2151,3 +2151,4 @@ $lng['admin']['configfiles']['description'] = 'Configure the system services';
|
||||
$lng['admin']['configfiles']['skipconfig'] = 'Don\'t (re)configure';
|
||||
$lng['admin']['configfiles']['recommendednote'] = 'Recommended/required services based on current system settings';
|
||||
$lng['admin']['configfiles']['selectrecommended'] = 'Select recommended';
|
||||
$lng['update']['description'] = 'Running database updates for your froxlor installation';
|
||||
|
||||
@@ -1793,3 +1793,4 @@ $lng['admin']['configfiles']['description'] = 'System-Dienste konfigurieren';
|
||||
$lng['admin']['configfiles']['skipconfig'] = 'Nicht (erneut) konfigurieren';
|
||||
$lng['admin']['configfiles']['recommendednote'] = 'Empfohlene/benötigte Dienste ahand der aktuellen Systemeinstellungen';
|
||||
$lng['admin']['configfiles']['selectrecommended'] = 'Empfohlene wählen';
|
||||
$lng['update']['description'] = 'Aktualisierung der froxlor Datenbank';
|
||||
|
||||
48
templates/Froxlor/install/update.html.twig
Normal file
48
templates/Froxlor/install/update.html.twig
Normal file
@@ -0,0 +1,48 @@
|
||||
{% extends "Froxlor/userarea.html.twig" %}
|
||||
|
||||
{% block heading %}
|
||||
<div>
|
||||
<h5 class="mb-1">
|
||||
<i class="fa-solid fa-download me-1"></i>
|
||||
{{ lng('update.update') }}
|
||||
</h5>
|
||||
<span class="text-muted">{{ lng('update.description') }}</span>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="card table-responsive">
|
||||
<div class="card-body">
|
||||
<table class="table table-borderless align-middle mb-0 px-3">
|
||||
<tbody>
|
||||
{% for check in checks %}
|
||||
<tr class="{% if check.result == 1 %}table-danger{% elseif check.result == 2 %}table-warning{% endif %}">
|
||||
<td class="w-75" scope="row">{{ check.title }}</td>
|
||||
<td class="col-auto text-end{% if check.result == 0 %} text-success{% endif %}">
|
||||
<span class="d-none d-md-inline">{{ check.result_txt }}</span>
|
||||
{% if check.result == 0 %} <i class="fa fa-check-circle" {% elseif check.result == 2 %}<span class="d-md-none"> ???</span>{% elseif check.result == 1 %}<span class="d-md-none"> !!!</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% if check.result_desc is not empty %}
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<span>{{ check.result_desc|raw }}</span>
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="row pt-md-3">
|
||||
<div class="col-12 text-end mt-4 mt-md-0">
|
||||
<a class="btn btn-lg btn-block btn-primary" href="admin_index.php">
|
||||
{{ lng('success.clickheretocontinue') }}
|
||||
»
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -1,10 +1,15 @@
|
||||
{% extends "Froxlor/userarea.html.twig" %}
|
||||
|
||||
{% block heading %}
|
||||
<div>
|
||||
<h5 class="mb-1">
|
||||
<i class="fa-solid fa-magnifying-glass me-1"></i>
|
||||
{{ lng('panel.viewlogs') }}
|
||||
</h5>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h3 class="page-header">
|
||||
<i class="fa-solid fa-magnifying-glass me-1"></i>
|
||||
{{ lng('panel.viewlogs') }}
|
||||
</h3>
|
||||
<div class="row">
|
||||
<div class="col-12 col-md-10 order-2 order-md-1">
|
||||
<h4>Error-Log</h4>
|
||||
|
||||
Reference in New Issue
Block a user