IText require , used for admin and password

This commit is contained in:
sparkyx 2020-11-12 18:08:33 +01:00
parent 82efa19bd0
commit 93723987b4
3 changed files with 21 additions and 9 deletions

View file

@ -260,13 +260,15 @@ if (isset($_POST['save_config'])) {
// If conx successfull save the file or display it
// -----
if ( $err == 0 && $cnx !== false ) {
echo '<h1>'._('Important').'</h1>';
echo '<h2 class="warning">',_("Voici l'utilisateur et mot de passe de l'utilisateur administrateur de Noalyss , "
echo '<div style="border:red 1px solid">';
echo '<h1 style="padding-top:0px;margin-top:0px;background-color:orangered">'._('Important').'</h1>';
echo '<p style="padding:10px">',_("Voici l'utilisateur et mot de passe de l'utilisateur administrateur de Noalyss , "
. " il a tous les droits et a accès à tout."
. " Connectez-vous avec ses identifiants et changer le mot de passe dans préférence (en haut à droit)"),
"</h2>";
echo '<p style="font-size:120%">'._('Utilisateur administrateur'),' ','<span style="color:red"> ',$cadmin,'</span>','</p>';
echo '<p style="font-size:120%">',_('Mot de passe'),'<span style="color:red"> '.$cpassword_admin.' </span>','</p>';
"</p>";
echo '<p style="padding:10px;font-size:120%">'._('Utilisateur administrateur'),' ','<span style="color:red"> ',$cadmin,'</span>','</p>';
echo '<p style="padding:10px;font-size:120%">',_('Mot de passe'),'<span style="color:red"> '.$cpassword_admin.' </span>','</p>';
echo '</div>';
// Create the db
if (is_writable(NOALYSS_INCLUDE)) {
$url=config_file_create($_POST,1,$os);

View file

@ -94,6 +94,7 @@ function config_file_form($p_array=null)
$ichost=new IText("chost",$chost);
$icadmin=new IText('cadmin',$cadmin);
$icadmin->set_require(true);
/*
* For version MONO
*/
@ -109,6 +110,7 @@ function config_file_form($p_array=null)
$icpassword_admin=new IText('cpassword_admin');
$icpassword_admin->value=$cpassword_admin;
$icpassword_admin->set_require(true);
require NOALYSS_TEMPLATE.'/template_config_form.php';
}

View file

@ -36,6 +36,7 @@ class IText extends HtmlInput
$this->extra="";
$this->style=' class="input_text" ';
$this->autofocus=false;
$this->require=false;
}
/*!\brief show the html input of the widget*/
public function input($p_name=null,$p_value=null)
@ -48,11 +49,12 @@ class IText extends HtmlInput
$t= 'title="'.$this->title.'" ';
$autofocus=($this->autofocus)?" autofocus ":"";
$this->value=str_replace('"','',$this->value);
$require=($this->require)?"required":"";
if ( ! isset ($this->css_size))
{
$r= sprintf('<INPUT TYPE="TEXT" %s id="%s" name="%s" value="%s" placeholder="%s" title="%s"
Size="%s" %s %s %s>
Size="%s" %s %s %s %s>
',$this->style,
$this->id,
$this->name,
@ -62,11 +64,12 @@ class IText extends HtmlInput
$this->size,
$this->javascript,
$this->extra,
$autofocus
$autofocus,
$require
);
} else {
$r= sprintf('<INPUT TYPE="TEXT" %s id="%s" name="%s" value="%s" placeholder="%s" title="%s"
style="width:%s;" %s %s %s>
style="width:%s;" %s %s %s %s>
',$this->style,
$this->id,
$this->name,
@ -76,7 +79,8 @@ class IText extends HtmlInput
$this->css_size,
$this->javascript,
$this->extra,
$autofocus
$autofocus,
$require
);
}
@ -115,6 +119,10 @@ class IText extends HtmlInput
return $r;
}
function set_require($p_boolean)
{
$this->require=$p_boolean;
}
static public function test_me()
{
}