#10138 refactored
This commit is contained in:
parent
593673c85d
commit
786d035f85
|
@ -31,7 +31,9 @@
|
||||||
font-display: swap;
|
font-display: swap;
|
||||||
}
|
}
|
||||||
html {
|
html {
|
||||||
background-color: #959595;
|
background-image: url("../../images/installer-background.jpg");
|
||||||
|
background-position: center;
|
||||||
|
background-size: cover;
|
||||||
}
|
}
|
||||||
#install_container {
|
#install_container {
|
||||||
max-width: 1000px;
|
max-width: 1000px;
|
||||||
|
|
|
@ -165,6 +165,15 @@
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* Check the php extension and print a
|
||||||
|
* new row in the table with the result
|
||||||
|
*
|
||||||
|
* @param string $ext Extension.
|
||||||
|
* @param string $label Label extension.
|
||||||
|
*
|
||||||
|
* @return integer status
|
||||||
|
*/
|
||||||
function check_extension($ext, $label)
|
function check_extension($ext, $label)
|
||||||
{
|
{
|
||||||
echo '<tr><td>';
|
echo '<tr><td>';
|
||||||
|
@ -181,23 +190,15 @@ function check_extension($ext, $label)
|
||||||
echo '</td></tr>';
|
echo '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
function check_include($ext, $label)
|
/**
|
||||||
{
|
* Check if file exist and print a
|
||||||
echo '<tr><td>';
|
* new row in the table with the result
|
||||||
echo "<span class='arr'> $label </span>";
|
*
|
||||||
echo '</td><td>';
|
* @param string $file File.
|
||||||
if (!include $ext) {
|
* @param string $label Label file.
|
||||||
echo "<span class='incomplete'>incomplete</span>";
|
*
|
||||||
return 1;
|
* @return integer status
|
||||||
} else {
|
*/
|
||||||
echo "<span class='checked'>checked</span>";
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '</td></tr>';
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function check_exists($file, $label)
|
function check_exists($file, $label)
|
||||||
{
|
{
|
||||||
echo '<tr><td>';
|
echo '<tr><td>';
|
||||||
|
@ -215,6 +216,15 @@ function check_exists($file, $label)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check variable ok and return row
|
||||||
|
* with 'checked' if is 1 or 'incomplete' if is 0
|
||||||
|
*
|
||||||
|
* @param integer $ok Status.
|
||||||
|
* @param string $label Label to show.
|
||||||
|
*
|
||||||
|
* @return integer status
|
||||||
|
*/
|
||||||
function check_generic($ok, $label)
|
function check_generic($ok, $label)
|
||||||
{
|
{
|
||||||
echo '<tr><td>';
|
echo '<tr><td>';
|
||||||
|
@ -236,6 +246,15 @@ function check_generic($ok, $label)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if path is writable and print a
|
||||||
|
* new row in the table with the result.
|
||||||
|
*
|
||||||
|
* @param string $fullpath Path folder or file.
|
||||||
|
* @param string $label Label to show.
|
||||||
|
*
|
||||||
|
* @return integer status
|
||||||
|
*/
|
||||||
function check_writable($fullpath, $label)
|
function check_writable($fullpath, $label)
|
||||||
{
|
{
|
||||||
echo '<tr><td>';
|
echo '<tr><td>';
|
||||||
|
@ -268,6 +287,17 @@ function check_writable($fullpath, $label)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if $var is equal to $value and
|
||||||
|
* print result in a row.
|
||||||
|
*
|
||||||
|
* @param string $var Variable.
|
||||||
|
* @param string $value Value to check.
|
||||||
|
* @param string $label Label to show.
|
||||||
|
* @param integer $mode Mode.
|
||||||
|
*
|
||||||
|
* @return integer status
|
||||||
|
*/
|
||||||
function check_variable($var, $value, $label, $mode)
|
function check_variable($var, $value, $label, $mode)
|
||||||
{
|
{
|
||||||
echo '<tr><td>';
|
echo '<tr><td>';
|
||||||
|
@ -321,6 +351,15 @@ function parse_mysql_dump($url)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse sql to script dump, execute it
|
||||||
|
* and return if exist error.
|
||||||
|
*
|
||||||
|
* @param object $connection Connection sql.
|
||||||
|
* @param string $url Path file sql script.
|
||||||
|
*
|
||||||
|
* @return integer status
|
||||||
|
*/
|
||||||
function parse_mysqli_dump($connection, $url)
|
function parse_mysqli_dump($connection, $url)
|
||||||
{
|
{
|
||||||
if (file_exists($url)) {
|
if (file_exists($url)) {
|
||||||
|
@ -389,7 +428,14 @@ function random_name(int $size)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function print_logo_status($step, $step_total)
|
/**
|
||||||
|
* Print the header installation
|
||||||
|
*
|
||||||
|
* @param integer $step Number of step.
|
||||||
|
*
|
||||||
|
* @return string Html output.
|
||||||
|
*/
|
||||||
|
function print_logo_status($step)
|
||||||
{
|
{
|
||||||
global $banner;
|
global $banner;
|
||||||
|
|
||||||
|
@ -419,13 +465,17 @@ function print_logo_status($step, $step_total)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
/**
|
||||||
// This function adjusts path settings in pandora db for FreeBSD.
|
* This function adjusts path settings in pandora db for FreeBSD.
|
||||||
//
|
* All packages and configuration files except operating system's base files
|
||||||
// All packages and configuration files except operating system's base files
|
* are installed under /usr/local in FreeBSD. So, path settings in pandora db
|
||||||
// are installed under /usr/local in FreeBSD. So, path settings in pandora db
|
* for some programs should be changed from the Linux default.
|
||||||
// for some programs should be changed from the Linux default.
|
*
|
||||||
//
|
* @param string $engine Type of engine.
|
||||||
|
* @param object $connection Connection database.
|
||||||
|
*
|
||||||
|
* @return integer Status.
|
||||||
|
*/
|
||||||
function adjust_paths_for_freebsd($engine, $connection=false)
|
function adjust_paths_for_freebsd($engine, $connection=false)
|
||||||
{
|
{
|
||||||
$adjust_sql = [
|
$adjust_sql = [
|
||||||
|
@ -470,10 +520,13 @@ function adjust_paths_for_freebsd($engine, $connection=false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Print all step 1
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
function install_step1()
|
function install_step1()
|
||||||
{
|
{
|
||||||
global $banner;
|
|
||||||
|
|
||||||
echo "
|
echo "
|
||||||
<div id='install_container'>
|
<div id='install_container'>
|
||||||
<div id='wizard'>
|
<div id='wizard'>
|
||||||
|
@ -537,6 +590,11 @@ function install_step1()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Print license content
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
function install_step1_licence()
|
function install_step1_licence()
|
||||||
{
|
{
|
||||||
echo "
|
echo "
|
||||||
|
@ -576,6 +634,11 @@ function install_step1_licence()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Print all step 2
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
function install_step2()
|
function install_step2()
|
||||||
{
|
{
|
||||||
echo "
|
echo "
|
||||||
|
@ -650,6 +713,11 @@ function install_step2()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Print all step 3
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
function install_step3()
|
function install_step3()
|
||||||
{
|
{
|
||||||
$options = [];
|
$options = [];
|
||||||
|
@ -751,19 +819,27 @@ function install_step3()
|
||||||
echo '<script type="text/javascript">$("#db_action").select2({closeOnSelect: true});</script>';
|
echo '<script type="text/javascript">$("#db_action").select2({closeOnSelect: true});</script>';
|
||||||
}
|
}
|
||||||
|
|
||||||
echo " <tr><td><p class='input-label'>DB User with privileges</p>
|
echo "<tr>
|
||||||
|
<td>
|
||||||
|
<p class='input-label'>DB User with privileges</p>
|
||||||
<input class='login' type='text' name='user' value='root' size=20>
|
<input class='login' type='text' name='user' value='root' size=20>
|
||||||
|
</td>
|
||||||
<td><p class='input-label'>DB Password for this user</p>
|
<td>
|
||||||
|
<td>
|
||||||
|
<p class='input-label'>DB Password for this user</p>
|
||||||
<input class='login' type='password' name='pass' value='' size=20>
|
<input class='login' type='password' name='pass' value='' size=20>
|
||||||
|
</td>
|
||||||
<tr><td><p class='input-label'>DB Hostname</p>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<p class='input-label'>DB Hostname</p>
|
||||||
<input class='login' type='text' name='host' value='localhost' onkeyup='CheckDBhost(this.value);'size=20>
|
<input class='login' type='text' name='host' value='localhost' onkeyup='CheckDBhost(this.value);'size=20>
|
||||||
|
</td>
|
||||||
<td><p class='input-label'>DB Name (pandora by default)</p>
|
<td>
|
||||||
|
<p class='input-label'>DB Name (pandora by default)</p>
|
||||||
<input class='login' type='text' name='dbname' value='pandora' size=20>
|
<input class='login' type='text' name='dbname' value='pandora' size=20>
|
||||||
|
</td>
|
||||||
<tr>";
|
</tr>";
|
||||||
|
|
||||||
// the field dbgrant is only shown when the DB host is different from 127.0.0.1 or localhost
|
// the field dbgrant is only shown when the DB host is different from 127.0.0.1 or localhost
|
||||||
echo "<tr id='tr_dbgrant' style='display: none;'>
|
echo "<tr id='tr_dbgrant' style='display: none;'>
|
||||||
|
@ -778,14 +854,14 @@ function install_step3()
|
||||||
<p class='input-label'>Full path to HTTP publication directory</p>
|
<p class='input-label'>Full path to HTTP publication directory</p>
|
||||||
<p class='example-message'>For example /var/www/pandora_console/</p>
|
<p class='example-message'>For example /var/www/pandora_console/</p>
|
||||||
<input class='login' type='text' name='path' value='".dirname(__FILE__)."'>
|
<input class='login' type='text' name='path' value='".dirname(__FILE__)."'>
|
||||||
|
</td>
|
||||||
</tr>";
|
</tr>";
|
||||||
echo "
|
echo "
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan='2'>
|
<td colspan='2'>
|
||||||
<p class='input-label'>URL path to Pandora FMS Console</p>
|
<p class='input-label'>URL path to Pandora FMS Console</p>
|
||||||
<p class='example-message'>For example '/pandora_console'</p>
|
<p class='example-message'>For example '/pandora_console'</p>
|
||||||
<input class='login' type='text' name='url'
|
<input class='login' type='text' name='url' value='".dirname($_SERVER['SCRIPT_NAME'])."'>
|
||||||
value='".dirname($_SERVER['SCRIPT_NAME'])."'>
|
|
||||||
</td>
|
</td>
|
||||||
</tr>";
|
</tr>";
|
||||||
|
|
||||||
|
@ -808,7 +884,8 @@ function install_step3()
|
||||||
echo "<div id='foot_install'>
|
echo "<div id='foot_install'>
|
||||||
<div class='content-footer'>
|
<div class='content-footer'>
|
||||||
<a href='install.php?step=2' class='btn_primary outline'>Previous step</a>
|
<a href='install.php?step=2' class='btn_primary outline'>Previous step</a>
|
||||||
<span class='signature'>© ".date('Y')." <a href='https://pandorafms.com' target='_blank'>Pandora FMS</a>
|
<span class='signature'>© ".date('Y')."
|
||||||
|
<a href='https://pandorafms.com' target='_blank'>Pandora FMS</a>
|
||||||
</span>";
|
</span>";
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
echo "<button class='btn_primary' type='submit' id='step4'>Next Step</button>";
|
echo "<button class='btn_primary' type='submit' id='step4'>Next Step</button>";
|
||||||
|
@ -825,6 +902,11 @@ function install_step3()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Print all step 4
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
function install_step4()
|
function install_step4()
|
||||||
{
|
{
|
||||||
$pandora_config = 'include/config.php';
|
$pandora_config = 'include/config.php';
|
||||||
|
@ -1226,6 +1308,11 @@ function install_step4()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Print all step 5
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
function install_step5()
|
function install_step5()
|
||||||
{
|
{
|
||||||
echo "
|
echo "
|
||||||
|
@ -1248,9 +1335,8 @@ function install_step5()
|
||||||
<input type='hidden' name='rename_file' value='1'>
|
<input type='hidden' name='rename_file' value='1'>
|
||||||
</form>
|
</form>
|
||||||
</p>
|
</p>
|
||||||
</div>";
|
</div>
|
||||||
|
</div>
|
||||||
echo "</div>
|
|
||||||
<div id='foot_install'>
|
<div id='foot_install'>
|
||||||
<div class='content-footer'>
|
<div class='content-footer'>
|
||||||
<span class='signature'>© ".date('Y')." <a href='https://pandorafms.com' target='_blank'>Pandora FMS</a>
|
<span class='signature'>© ".date('Y')." <a href='https://pandorafms.com' target='_blank'>Pandora FMS</a>
|
||||||
|
|
Loading…
Reference in New Issue