This commit is contained in:
Daniel Cebrian 2023-01-25 10:34:18 +01:00
parent 593673c85d
commit 786d035f85
2 changed files with 183 additions and 95 deletions

View File

@ -31,7 +31,9 @@
font-display: swap;
}
html {
background-color: #959595;
background-image: url("../../images/installer-background.jpg");
background-position: center;
background-size: cover;
}
#install_container {
max-width: 1000px;

View File

@ -165,6 +165,15 @@
</html>
<?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)
{
echo '<tr><td>';
@ -181,23 +190,15 @@ function check_extension($ext, $label)
echo '</td></tr>';
}
function check_include($ext, $label)
{
echo '<tr><td>';
echo "<span class='arr'> $label </span>";
echo '</td><td>';
if (!include $ext) {
echo "<span class='incomplete'>incomplete</span>";
return 1;
} else {
echo "<span class='checked'>checked</span>";
return 0;
}
echo '</td></tr>';
}
/**
* Check if file exist and print a
* new row in the table with the result
*
* @param string $file File.
* @param string $label Label file.
*
* @return integer status
*/
function check_exists($file, $label)
{
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)
{
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)
{
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)
{
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)
{
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;
@ -419,13 +465,17 @@ function print_logo_status($step, $step_total)
}
//
// This function adjusts path settings in pandora db for FreeBSD.
//
// All packages and configuration files except operating system's base files
// are installed under /usr/local in FreeBSD. So, path settings in pandora db
// for some programs should be changed from the Linux default.
//
/**
* This function adjusts path settings in pandora db for FreeBSD.
* All packages and configuration files except operating system's base files
* are installed under /usr/local in FreeBSD. So, path settings in pandora db
* 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)
{
$adjust_sql = [
@ -470,10 +520,13 @@ function adjust_paths_for_freebsd($engine, $connection=false)
}
/**
* Print all step 1
*
* @return void
*/
function install_step1()
{
global $banner;
echo "
<div id='install_container'>
<div id='wizard'>
@ -537,6 +590,11 @@ function install_step1()
}
/**
* Print license content
*
* @return void
*/
function install_step1_licence()
{
echo "
@ -576,6 +634,11 @@ function install_step1_licence()
}
/**
* Print all step 2
*
* @return void
*/
function install_step2()
{
echo "
@ -650,6 +713,11 @@ function install_step2()
}
/**
* Print all step 3
*
* @return void
*/
function install_step3()
{
$options = [];
@ -751,19 +819,27 @@ function install_step3()
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>
<td><p class='input-label'>DB Password for this user</p>
</td>
<td>
<td>
<p class='input-label'>DB Password for this user</p>
<input class='login' type='password' name='pass' value='' size=20>
<tr><td><p class='input-label'>DB Hostname</p>
</td>
</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>
<td><p class='input-label'>DB Name (pandora by default)</p>
</td>
<td>
<p class='input-label'>DB Name (pandora by default)</p>
<input class='login' type='text' name='dbname' value='pandora' size=20>
<tr>";
</td>
</tr>";
// 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;'>
@ -778,14 +854,14 @@ function install_step3()
<p class='input-label'>Full path to HTTP publication directory</p>
<p class='example-message'>For example /var/www/pandora_console/</p>
<input class='login' type='text' name='path' value='".dirname(__FILE__)."'>
</td>
</tr>";
echo "
<tr>
<td colspan='2'>
<p class='input-label'>URL path to Pandora FMS Console</p>
<p class='example-message'>For example '/pandora_console'</p>
<input class='login' type='text' name='url'
value='".dirname($_SERVER['SCRIPT_NAME'])."'>
<input class='login' type='text' name='url' value='".dirname($_SERVER['SCRIPT_NAME'])."'>
</td>
</tr>";
@ -808,7 +884,8 @@ function install_step3()
echo "<div id='foot_install'>
<div class='content-footer'>
<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>";
if (!$error) {
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()
{
$pandora_config = 'include/config.php';
@ -1226,6 +1308,11 @@ function install_step4()
}
/**
* Print all step 5
*
* @return void
*/
function install_step5()
{
echo "
@ -1248,9 +1335,8 @@ function install_step5()
<input type='hidden' name='rename_file' value='1'>
</form>
</p>
</div>";
echo "</div>
</div>
</div>
<div id='foot_install'>
<div class='content-footer'>
<span class='signature'>© ".date('Y')." <a href='https://pandorafms.com' target='_blank'>Pandora FMS</a>