Reads default value for mailbox_limit from DB, Autofocus on form fields, adds 'required' tags to mailbox_limit > Ver. 0.1.5

This commit is contained in:
Thomas Leister 2014-11-14 11:06:06 +01:00
parent ed51cdabe8
commit 604232db6c
8 changed files with 26 additions and 12 deletions

View file

@ -29,6 +29,6 @@ if(isset($_POST['domain'])){
</p>
<form action="" method="post">
<p><input name="domain" class="textinput" type="text" placeholder="domain.tld"/></p>
<p><input name="domain" class="textinput" type="text" placeholder="domain.tld" autofocus/></p>
<p><input type="submit" class="button button-small" value="Create domain"/>
</form>

View file

@ -57,7 +57,7 @@ if(isset($_POST['confirm'])){
</p>
<form action="" method="post">
<select name="confirm">
<select name="confirm" autofocus>
<option value="no">No!</option>
<option value="yes">Yes!</option>
</select>

View file

@ -53,7 +53,7 @@ if(isset($_POST['confirm'])){
</p>
<form action="" method="post">
<select name="confirm">
<select name="confirm" autofocus>
<option value="no">No!</option>
<option value="yes">Yes!</option>
</select>

View file

@ -88,11 +88,11 @@ Here you can edit a redirect.
<tr>
<td>
<textarea name="source" class="textinput" placeholder="Source"><?php if(isset($source)){echo $source;}?></textarea>
<textarea name="source" class="textinput" placeholder="Source" required="required" autofocus><?php if(isset($source)){echo $source;}?></textarea>
</td>
<td>
<textarea name="destination" class="textinput" placeholder="Destination"><?php if(isset($destination)){echo $destination;} ?></textarea>
<textarea name="destination" class="textinput" placeholder="Destination" required="required"><?php if(isset($destination)){echo $destination;} ?></textarea>
</td>
</tr>

View file

@ -1,4 +1,18 @@
<?php
// Get mailbox_limit default value from DB
$sql = "SELECT DEFAULT(".DBC_USERS_MAILBOXLIMIT.") AS `".DBC_USERS_MAILBOXLIMIT."` FROM `".DBT_USERS."` LIMIT 1;";
if(!$result = $db->query($sql)){
die('There was an error running the query [' . $db->error . ']');
}
else{
while($row = $result->fetch_assoc()){
$mailbox_limit_default = $row[DBC_USERS_MAILBOXLIMIT];
}
}
if(isset($_POST['savemode'])){
$savemode = $_POST['savemode'];
@ -6,7 +20,7 @@
// Edit mode entered
$id = $db->escape_string($_POST['id']);
if($mailbox_limit == ""){
$mailbox_limit = 0;
$mailbox_limit = $mailbox_limit_default;
}
$mailbox_limit = $db->escape_string($_POST['mailbox_limit']);
@ -48,7 +62,7 @@
$pass = $_POST['password'];
$pass_rep = $_POST['password_rep'];
if($username !== "" && $domain !== "" && $quota !== ""){
if($username !== "" && $domain !== "" && $quota !== "" && $mailbox_limit !== ""){
// All fields filled with content
// Check passwords
$pass_ok = check_new_pass($pass, $pass_rep);
@ -127,7 +141,7 @@
<tr>
<td>
<input name="username" class="textinput" type="text" value="<?php if(isset($username)){echo $username;} ?>" placeholder="Username"/>
<input name="username" class="textinput" type="text" autofocus value="<?php if(isset($username)){echo $username;} ?>" placeholder="Username" required="required"/>
</td>
<td>
@ -156,7 +170,7 @@
</td>
<td>
<input name="mailbox_limit" class="textinput" type="number" value="<?php if(isset($mailbox_limit)){echo $mailbox_limit;} ?>" placeholder="Mailbox size (MB)"/>
<input name="mailbox_limit" class="textinput" type="number" value="<?php if(isset($mailbox_limit)){echo $mailbox_limit;} else{echo $mailbox_limit_default;} ?>" placeholder="Mailbox size (MB)" required="required"/>
</td>
</tr>

View file

@ -24,7 +24,7 @@ if($user->isLoggedIn()){
<?php output_messages(); ?>
<form action="" method="post">
<input name="email" class="textinput" type="text" placeholder="E-Mail Address"/><br>
<input name="email" class="textinput" type="text" placeholder="E-Mail Address" autofocus/><br>
<input name="password" class="textinput" type="password" placeholder="Password"/>
<p>

View file

@ -31,7 +31,7 @@ if(isset($_POST['sent'])){
<form action="" method="post">
<p>
<input name="password" class="textinput" type="password" placeholder="New password"/><br/>
<input name="password" class="textinput" type="password" placeholder="New password" autofocus/><br/>
<input name="password_repeat" class="textinput" type="password" placeholder="New password (repeat)"/>
<input name="sent" type="hidden" value="1"/>
</p>

View file

@ -1,6 +1,6 @@
<?php
/*
* #################### This is WebMUM Version 0.1.4 ######################
* #################### This is WebMUM Version 0.1.5 ######################
*
* Project on GitHub: https://github.com/ThomasLeister/webmum
* Author's Blog: https://thomas-leister.de