remove domain_exists where it makes less sense, fix search
This commit is contained in:
parent
1575a17857
commit
aa2ebed365
|
@ -37,7 +37,6 @@ if ($ROLE == ADMIN_ROLE) {
|
|||
if ($_SERVER['REQUEST_METHOD'] == "GET") {
|
||||
$domain = filter_input(INPUT_GET, 'domain', FILTER_VALIDATE_DOMAIN);
|
||||
$domain_key = array_search($domain, array_column($list_domains, 'domain'));
|
||||
$domain_exist = in_array($domain, array_column($list_domains, 'domain'));
|
||||
}
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] == "POST") {
|
||||
|
@ -45,7 +44,6 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") {
|
|||
$domain = filter_input(INPUT_POST, 'domain', FILTER_VALIDATE_DOMAIN);
|
||||
$goto = strtolower(filter_input(INPUT_POST, 'goto', FILTER_DEFAULT));
|
||||
$domain_key = array_search($domain, array_column($list_domains, 'domain'));
|
||||
$domain_exist = in_array($domain, array_column($list_domains, 'domain'));
|
||||
$from = filter_var($address . '@' . $domain, FILTER_VALIDATE_EMAIL);
|
||||
|
||||
if (!str_contains($goto, '@')) {
|
||||
|
@ -61,7 +59,7 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") {
|
|||
$message = $LANG['Add_alias_address_text_error1'];
|
||||
}
|
||||
|
||||
if ($domain_exist && empty($message)) {
|
||||
if (empty($message) && in_array($domain, array_column($list_domains, 'domain'))) {
|
||||
try {
|
||||
$dbh = pdo_connect();
|
||||
$sth = $dbh->prepare("INSERT INTO alias (address,goto,domain,created,modified) VALUES (?,?,?,NOW(),NOW())");
|
||||
|
|
|
@ -39,7 +39,6 @@ if ($ROLE == ADMIN_ROLE) {
|
|||
if ($_SERVER['REQUEST_METHOD'] == "GET") {
|
||||
$domain = filter_input(INPUT_GET, 'domain', FILTER_VALIDATE_DOMAIN);
|
||||
$domain_key = array_search($domain, array_column($list_domains, 'domain'));
|
||||
$domain_exist = in_array($domain, array_column($list_domains, 'domain'));
|
||||
}
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] == "POST") {
|
||||
|
@ -49,7 +48,6 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") {
|
|||
$password2 = filter_input(INPUT_POST, 'password2', FILTER_DEFAULT);
|
||||
$name = filter_input(INPUT_POST, 'name', FILTER_DEFAULT);
|
||||
$domain_key = array_search($domain, array_column($list_domains, 'domain'));
|
||||
$domain_exist = in_array($domain, array_column($list_domains, 'domain'));
|
||||
$from = filter_var($username . '@' . $domain, FILTER_VALIDATE_EMAIL);
|
||||
|
||||
if ($list_domains[$domain_key]['mailboxes'] != 0 && $list_domains[$domain_key]['mailbox_count'] >= $list_domains[$domain_key]['mailboxes']) {
|
||||
|
@ -64,7 +62,7 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") {
|
|||
$message = $LANG['Add_mailbox_password_text_error'];
|
||||
}
|
||||
|
||||
if ($domain_exist && empty($message)) {
|
||||
if (empty($message) && in_array($domain, array_column($list_domains, 'domain'))) {
|
||||
$hashed = bcrypt($password1);
|
||||
$maildir = $from . "/";
|
||||
|
||||
|
|
|
@ -37,9 +37,8 @@ if ($_SERVER['REQUEST_METHOD'] == "GET") {
|
|||
$address = filter_input(INPUT_GET, 'address', FILTER_VALIDATE_EMAIL);
|
||||
$domain = filter_input(INPUT_GET, 'domain', FILTER_VALIDATE_DOMAIN);
|
||||
$domain_key = array_search($domain, array_column($list_domains, 'domain'));
|
||||
$domain_exist = in_array($domain, array_column($list_domains, 'domain'));
|
||||
|
||||
if ($domain_exist) {
|
||||
if (in_array($domain, array_column($list_domains, 'domain'))) {
|
||||
try {
|
||||
$dbh = pdo_connect();
|
||||
$sth = $dbh->prepare("SELECT goto FROM alias WHERE address=? AND domain=?");
|
||||
|
@ -59,7 +58,6 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") {
|
|||
$domain = strtolower(filter_input(INPUT_GET, 'domain', FILTER_VALIDATE_DOMAIN));
|
||||
$goto = strtolower(filter_input(INPUT_POST, 'goto', FILTER_DEFAULT));
|
||||
$domain_key = array_search($domain, array_column($list_domains, 'domain'));
|
||||
$domain_exist = in_array($domain, array_column($list_domains, 'domain'));
|
||||
|
||||
if (empty($goto)) {
|
||||
$goto = array();
|
||||
|
@ -78,7 +76,7 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") {
|
|||
}
|
||||
}
|
||||
|
||||
if ($domain_exist && empty($message)) {
|
||||
if (empty($message) && in_array($domain, array_column($list_domains, 'domain'))) {
|
||||
try {
|
||||
$dbh = pdo_connect();
|
||||
$sth = $dbh->prepare("UPDATE alias SET goto=?,modified=NOW() WHERE address=? AND domain=?");
|
||||
|
|
|
@ -39,9 +39,8 @@ if ($_SERVER['REQUEST_METHOD'] == "GET") {
|
|||
$username = filter_input(INPUT_GET, 'username', FILTER_DEFAULT);
|
||||
$domain = filter_input(INPUT_GET, 'domain', FILTER_VALIDATE_DOMAIN);
|
||||
$domain_key = array_search($domain, array_column($list_domains, 'domain'));
|
||||
$domain_exist = in_array($domain, array_column($list_domains, 'domain'));
|
||||
|
||||
if ($domain_exist) {
|
||||
if (in_array($domain, array_column($list_domains, 'domain'))) {
|
||||
try {
|
||||
$dbh = pdo_connect();
|
||||
$sth = $dbh->prepare("SELECT * FROM mailbox WHERE username=? AND domain=?");
|
||||
|
@ -63,7 +62,6 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") {
|
|||
$password2 = filter_input(INPUT_POST, 'password2', FILTER_DEFAULT);
|
||||
$name = filter_input(INPUT_POST, 'name', FILTER_DEFAULT);
|
||||
$domain_key = array_search($domain, array_column($list_domains, 'domain'));
|
||||
$domain_exist = in_array($domain, array_column($list_domains, 'domain'));
|
||||
|
||||
if ($password1 != $password2) {
|
||||
$message = $LANG['Edit_mailbox_password_text_error'];
|
||||
|
@ -84,7 +82,7 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") {
|
|||
}
|
||||
}
|
||||
|
||||
if ($domain_exist && empty($message)) {
|
||||
if (empty($message) && in_array($domain, array_column($list_domains, 'domain'))) {
|
||||
try {
|
||||
$dbh = pdo_connect();
|
||||
$sth = $dbh->prepare("UPDATE mailbox SET name=?,modified=NOW() WHERE username=? AND domain=?");
|
||||
|
|
|
@ -14,11 +14,14 @@ if (count($list_admins) > 0) {
|
|||
?>
|
||||
</select>
|
||||
<input class="button" type="submit" name="go" value="<?php echo $LANG['List_button']; ?>" />
|
||||
</form>
|
||||
<?php } ?>
|
||||
|
||||
<form name="search" method="post" action="search.php">
|
||||
Search: <input type="textbox" name="search" size="25">
|
||||
<input type="textbox" name="search" size="25">
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
if (count($list_domains) > 0) {
|
||||
echo "<table id=\"admin_table\">";
|
||||
|
|
|
@ -10,23 +10,25 @@ if (count($list_domains) > 0) {
|
|||
echo ">" . $row['domain'] . "</option>";
|
||||
}
|
||||
}
|
||||
if ($list_domains[$domain_key]['aliases'] == 0) $list_domains[$domain_key]['aliases'] = $LANG['List_domain_unlimited'];
|
||||
if ($list_domains[$domain_key]['mailboxes'] == 0) $list_domains[$domain_key]['mailboxes'] = $LANG['List_domain_unlimited'];
|
||||
?>
|
||||
</select>
|
||||
<input type="hidden" name="offset" value="0">
|
||||
<input class="button" type="submit" name="go" value="<?php echo $LANG['List_button']; ?>" />
|
||||
</form>
|
||||
|
||||
|
||||
<h4><?php echo $LANG['List_virtual_welcome'] . $domain; ?></h4>
|
||||
<p><?php echo $LANG['List_domain_aliases'] . ": " . $list_domains[$domain_key]['alias_count'] . " / " . $list_domains[$domain_key]['aliases']; ?></p>
|
||||
<p><?php echo $LANG['List_domain_mailboxes'] . ": " . $list_domains[$domain_key]['mailbox_count'] . " / " . $list_domains[$domain_key]['mailboxes']; ?></p>
|
||||
<?php
|
||||
if ($list_domains[$domain_key]['aliases'] == 0) $list_domains[$domain_key]['aliases'] = $LANG['List_domain_unlimited'];
|
||||
if ($list_domains[$domain_key]['mailboxes'] == 0) $list_domains[$domain_key]['mailboxes'] = $LANG['List_domain_unlimited'];
|
||||
echo '<h4>' . $LANG['List_virtual_welcome'] . $domain . '</h4>';
|
||||
echo '<p>' . $LANG['List_domain_aliases'] . ": " . $list_domains[$domain_key]['alias_count'] . " / " . $list_domains[$domain_key]['aliases'] . '</p>';
|
||||
echo '<p>' . $LANG['List_domain_mailboxes'] . ": " . $list_domains[$domain_key]['mailbox_count'] . " / " . $list_domains[$domain_key]['mailboxes'] . '</p>';
|
||||
?>
|
||||
|
||||
<form name="search" method="post" action="search.php">
|
||||
<input type="textbox" name="search" size="25">
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
if ($list_domains[$domain_key]['alias_count'] > $limit || $list_domains[$domain_key]['mailbox_count'] > $limit) {
|
||||
echo "<div id=\"nav_bar\">";
|
||||
|
|
|
@ -8,48 +8,48 @@
|
|||
<?php
|
||||
if (count($list_alias) > 0) {
|
||||
echo "<table id=\"alias_table\">";
|
||||
echo " <tr>";
|
||||
echo " <td colspan=\"5\"><h3>" . $LANG['List_virtual_alias_title'] . "</h3></td>";
|
||||
echo " </tr>";
|
||||
echo " <tr class=\"header\">";
|
||||
echo " <td>" . $LANG['List_virtual_alias_address'] . "</td>";
|
||||
echo " <td>" . $LANG['List_virtual_alias_goto'] . "</td>";
|
||||
echo " <td>" . $LANG['List_modified'] . "</td>";
|
||||
echo " <td colspan=\"2\"> </td>";
|
||||
echo " </tr>";
|
||||
echo "<tr>";
|
||||
echo "<td colspan=\"5\"><h3>" . $LANG['List_virtual_alias_title'] . "</h3></td>";
|
||||
echo "</tr>";
|
||||
echo "<tr class=\"header\">";
|
||||
echo "<td>" . $LANG['List_virtual_alias_address'] . "</td>";
|
||||
echo "<td>" . $LANG['List_virtual_alias_goto'] . "</td>";
|
||||
echo "<td>" . $LANG['List_modified'] . "</td>";
|
||||
echo "<td colspan=\"2\"> </td>";
|
||||
echo "</tr>";
|
||||
|
||||
foreach ($list_alias as $row) {
|
||||
echo " <tr class=\"hilightoff\" onMouseOver=\"className='hilighton';\" onMouseOut=\"className='hilightoff';\">";
|
||||
echo " <td>" . $row['address'] . "</td>";
|
||||
echo " <td>" . preg_replace("/,/", "<br>", $row['goto']) . "</td>";
|
||||
echo " <td>" . $row['modified'] . "</td>";
|
||||
echo " <td><a href=\"edit-alias.php?action=edit&address=" . $row['address'] . "&domain=" . $row['domain'] . "\">" . $LANG['edit'] . "</a></td>";
|
||||
echo " <td><a href=\"delete.php?table=alias&delete=" . $row['address'] . "&domain=" . $row['domain'] . "\"onclick=\"return confirm ('" . $LANG['confirm'] . $LANG['List_domain_aliases'] . ": ". $row['address'] . "')\">" . $LANG['del'] . "</a></td>";
|
||||
echo " </tr>";
|
||||
echo "<tr class=\"hilightoff\" onMouseOver=\"className='hilighton';\" onMouseOut=\"className='hilightoff';\">";
|
||||
echo "<td>" . $row['address'] . "</td>";
|
||||
echo "<td>" . preg_replace("/,/", "<br>", $row['goto']) . "</td>";
|
||||
echo "<td>" . $row['modified'] . "</td>";
|
||||
echo "<td><a href=\"edit-alias.php?action=edit&address=" . $row['address'] . "&domain=" . $row['domain'] . "\">" . $LANG['edit'] . "</a></td>";
|
||||
echo "<td><a href=\"delete.php?table=alias&delete=" . $row['address'] . "&domain=" . $row['domain'] . "\"onclick=\"return confirm ('" . $LANG['confirm'] . $LANG['List_domain_aliases'] . ": ". $row['address'] . "')\">" . $LANG['del'] . "</a></td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
echo "</table>";
|
||||
}
|
||||
|
||||
if (count($list_mailbox) > 0) {
|
||||
echo "<table id=\"mailbox_table\">";
|
||||
echo " <tr>";
|
||||
echo " <td colspan=\"7\"><h3>" . $LANG['List_virtual_mailbox_title'] . "</h3></td>";
|
||||
echo " </tr>";
|
||||
echo " <tr class=\"header\">";
|
||||
echo " <td>" . $LANG['List_virtual_mailbox_username'] . "</td>";
|
||||
echo " <td>" . $LANG['List_virtual_mailbox_name'] . "</td>";
|
||||
echo " <td>" . $LANG['List_modified'] . "</td>";
|
||||
echo " <td colspan=\"2\"> </td>";
|
||||
echo " </tr>";
|
||||
echo "<tr>";
|
||||
echo "<td colspan=\"7\"><h3>" . $LANG['List_virtual_mailbox_title'] . "</h3></td>";
|
||||
echo "</tr>";
|
||||
echo "<tr class=\"header\">";
|
||||
echo "<td>" . $LANG['List_virtual_mailbox_username'] . "</td>";
|
||||
echo "<td>" . $LANG['List_virtual_mailbox_name'] . "</td>";
|
||||
echo "<td>" . $LANG['List_modified'] . "</td>";
|
||||
echo "<td colspan=\"2\"> </td>";
|
||||
echo "</tr>";
|
||||
|
||||
foreach ($list_mailbox as $row) {
|
||||
echo " <tr class=\"hilightoff\" onMouseOver=\"className='hilighton';\" onMouseOut=\"className='hilightoff';\">";
|
||||
echo " <td>" . $row['username'] . "</td>";
|
||||
echo " <td>" . $row['name'] . "</td>";
|
||||
echo " <td>" . $row['modified'] . "</td>";
|
||||
echo " <td><a href=\"edit-mailbox.php?action=edit&username=" . $row['username'] . "&domain=" . $row['domain'] . "\">" . $LANG['edit'] . "</a></td>";
|
||||
echo " <td><a href=\"delete.php?table=mailbox&delete=" . $row['username'] . "&domain=" . $row['domain'] . "\"onclick=\"return confirm ('" . $LANG['confirm'] . $LANG['List_domain_mailboxes'] . ": ". $row['username'] . "')\">" . $LANG['del'] . "</a></td>";
|
||||
echo " </tr>";
|
||||
foreach ($list_mailbox as $row) {
|
||||
echo "<tr class=\"hilightoff\" onMouseOver=\"className='hilighton';\" onMouseOut=\"className='hilightoff';\">";
|
||||
echo "<td>" . $row['username'] . "</td>";
|
||||
echo "<td>" . $row['name'] . "</td>";
|
||||
echo "<td>" . $row['modified'] . "</td>";
|
||||
echo "<td><a href=\"edit-mailbox.php?action=edit&username=" . $row['username'] . "&domain=" . $row['domain'] . "\">" . $LANG['edit'] . "</a></td>";
|
||||
echo "<td><a href=\"delete.php?table=mailbox&delete=" . $row['username'] . "&domain=" . $row['domain'] . "\"onclick=\"return confirm ('" . $LANG['confirm'] . $LANG['List_domain_mailboxes'] . ": ". $row['username'] . "')\">" . $LANG['del'] . "</a></td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
echo "</table>";
|
||||
}
|
||||
|
|
12
viewlog.php
12
viewlog.php
|
@ -25,17 +25,19 @@ $ROLE = check_role($SESSID_USERNAME);
|
|||
|
||||
if ($ROLE == ADMIN_ROLE) {
|
||||
$list_domains = list_domains();
|
||||
$list_admins = list_admins();
|
||||
} else {
|
||||
$list_domains = list_domains($SESSID_USERNAME);
|
||||
}
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] == "GET") {
|
||||
$domain = filter_input(INPUT_GET, 'domain', FILTER_VALIDATE_DOMAIN) ?? $list_domains[0]['domain'];
|
||||
$domain_key = array_search($domain, array_column($list_domains, 'domain'));
|
||||
$domain_exist = in_array($domain, array_column($list_domains, 'domain'));
|
||||
$domain = filter_input(INPUT_GET, 'domain', FILTER_VALIDATE_DOMAIN);
|
||||
|
||||
if ($domain_exist) {
|
||||
if (empty($domain) && count($list_domains) > 0) {
|
||||
$domain = $list_domains[0]['domain'];
|
||||
}
|
||||
|
||||
if (in_array($domain, array_column($list_domains, 'domain'))) {
|
||||
$domain_key = array_search($domain, array_column($list_domains, 'domain'));
|
||||
$dbh = pdo_connect();
|
||||
$sth = $dbh->prepare("SELECT * FROM log WHERE domain=? ORDER BY timestamp DESC LIMIT 10");
|
||||
$sth->bindParam(1, $domain, PDO::PARAM_STR);
|
||||
|
|
Loading…
Reference in New Issue