Current File : /home/inlingua/public_html/decay_sym/root/var/softaculous/apps/exim/themes/admin/emails_theme.php |
<?php
//////////////////////////////////////////////////////////////
//===========================================================
// WEBUZO CONTROL PANEL
// Inspired by the DESIRE to be the BEST OF ALL
// ----------------------------------------------------------
// Started by: Pulkit
// Date: 10th Jan 2009
// Time: 21:00 hrs
// Site: https://webuzo.com/ (WEBUZO)
// ----------------------------------------------------------
// Please Read the Terms of Use at https://webuzo.com/terms
// ----------------------------------------------------------
//===========================================================
// (c) Softaculous Ltd.
//===========================================================
//////////////////////////////////////////////////////////////
if(!defined('SOFTACULOUS')){
die('Hacking Attempt');
}
function exim_emails_theme(){
global $user, $globals, $theme, $softpanel, $error, $done, $email_list;
echo '
<div class="soft-smbox p-3">
<div class="sai_main_head">
<i class="fas fa-envelope fa-xl me-2"></i>'.__('Email Accounts').'
<span class="search_btn float-end">
<a href="javascript:void(0);" class="text-dark" data-bs-toggle="collapse" data-bs-target="#search_queue" aria-expanded="true" aria-controls="search_queue" title="'.__('Search').'"><i class="fas fa-search"></i></a>
</span>
</div>
<div class="mt-2" style="background-color:#e9ecef;">
<div class="collapse '.(!empty(optREQ('email')) || !empty(optREQ('user')) || !empty(optREQ('domain')) ? 'show' : '').'" id="search_queue">
<form accept-charset="'.$globals['charset'].'" name="search" method="post" action=""; class="form-horizontal" >
<div class="row p-3 col-md-12 d-flex">
<div class="col-12 col-md-4">
<label class="sai_head me-1">'.__('Search By Email Account').'</label>
<select class="form-select make-select2" s2-placeholder="'.__('Select Email').'" s2-ajaxurl="'.$globals['index'].'act=emails&api=json" s2-query="email" s2-data-key="email_list" s2-data-subkey="email" style="width: 100%" id="email_account_search" name="email">
<option value="'.optREQ('email').'" selected="selected">'.optREQ('email').'</option>
</select>
</div>
<div class="col-12 col-md-4">
<label class="sai_head">'.__('Search By User Name').'</label><br/>
<select class="form-select make-select2" s2-placeholder="'.__('Select User').'" s2-ajaxurl="'.$globals['index'].'act=users&api=json" s2-query="search" s2-data-key="users" s2-data-subkey="user" style="width: 100%" id="user_search" name="user_search">
<option value="'.optREQ('user').'" selected="selected">'.optREQ('user').'</option>
</select>
</div>
<div class="col-12 col-md-4">
<label class="sai_head">'.__('Search By Domain Name').'</label>
<select class="form-select make-select2" s2-placeholder="'.__('Select Domain').'" s2-ajaxurl="'.$globals['index'].'act=domains&api=json" s2-query="dom_search" s2-data-key="domains" s2-data-subkey="domain" style="width: 100%" name="dom_search" id="dom_search">
<option value="'.optREQ('domain').'" selected="selected">'.optREQ('domain').'</option>
</select>
</div>
</div>
</form>
</div>
</div>
</div>
<div class="soft-smbox p-4 mt-4">
<div id="showrectab">
<div class="row">
<div class="col-12 col-md-2 align-middle">
<span class="tot_dom sai_head">'.__('Total Emails').': </span>
<span class="tot_count" id="total_emails">'.$globals['total_emails'].'</span>
</div>
</div>';
page_links();
echo '
<div class="sai_sub_head record-table mb-2 position-relative">
<input type="button" class="btn btn-danger" value="Delete Selected" name="delete_selected" id="delete_selected" onclick="del_emails(this)" disabled>
</div>
<div class="row loader-div" style="display:none">
<div class="col-sm-offset-3 col-md-offset-5 col-sm-7 col-md-4 col-xs-12">
<div class="loader"></div>
</div>
</div>
<div class="table-responsive my-2">
<table cellpadding="8" cellspacing="1" class="table webuzo-table td_font">
<thead>
<tr>
<th><input type="checkbox" id="checkAll"></th>
<th>#</th>
<th>'.__('Email User').'</th>
<th>'.__('Domain').'</th>
<th>'.__('User').'</th>
<th width="20%">'.__('Storage: Used / Allocated / %').'<i id="email_storage" class="fa fa-sort m-1" title="Sort Emails by storage" style="cursor:pointer;"></i></th>
<th width="20%">'.__('Message: Unseen / Total ').'</th>
<th width="1%" class="text-right">'.__('Restrictions').'</th>
<th width="1%" class="text-right">'.__('Delete').'</th>
</tr>
</thead>
<tbody id="email_list_html">';
if(empty($email_list)){
echo '
<tr><td colspan="6" class="text-center"><span>'.__('No Email Configure').'</span></td></<tr>';
}else{
foreach ($email_list as $key => $value){
echo '
<tr id="tr.'.$value['eid'].'">
<td>
<input type="checkbox" class="email_check" name="checked_email" value="'.$value['email'].'">
</td>
<td>'.$value['eid'].'</td>
<td>
<span>'.$value['email'].'</span>
</td>
<td>'.$value['domain'].'</td>
<td>'.$value['uid'].'</td>
<td>'.($value['quota_used'] >= 1048576 ? round($value['quota_used']/1048576, 2).'MB' : ($value['quota_used'] >= 1024 ? round($value['quota_used']/1024, 2).'KB' : $value['quota_used'].'B')).' / '.(!empty($value['quota_limit']) ? round($value['quota_limit']/ 1048576, 2).'MB' : '∞').' / '.(!empty($value['quota_percent']) ? $value['quota_percent'].'<div class="progress" style="height:10px"><div class="progress-bar" role="progressbar" style="width: '.$value['quota_percent'].'%;" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100">'.$value['quota_percent'].'%</div></div>' : '0%').'</td>
<td align="centre">'.$value['msg_unseen'].' / '.$value['msg_total'].'</td>
<td align="center"><a href="javascript:restrictPopup(\''.$value['email'].'\', \''.$value['uid'].'\')">'.(($value['restricted'] == 'admin' || $value['restricted'] == 'deny') ? '<i class="fa fa-exclamation-triangle" style="color:#ffa500"></i>' : '<i class="fa fa-check-circle" style="color:green"></i>').'</a></td>
<td width="2%">
<i class="fas fa-trash delete delete-icon" title="'.__('Delete Email').'" id="did'.$value['eid'].'" onclick="delete_record(this)" data-delete="'.$value['email'].'"></i>
</td>
</tr>';
}
}
echo ' </tbody>
</table>
</div>';
page_links();
echo '
</div>
</div>
<button type="button" class="btn btn-primary" hidden data-bs-toggle="modal" data-bs-target="#email_modal" id="load_modal"></button>
<!-- Modal -->
<div class="modal fade" id="email_modal">
<div class="modal-dialog modal-sm ">
<div class="modal-content">
<div class="modal-header" style="background: #1960bb; color: #fff;">
<h5 class="modal-title" id="exampleModalLabel">'.__('Restrictions').'</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<form accept-charset="'.$globals['charset'].'" method="POST" name="restriction" onsubmit="return submitit(this)" data-donereload="1">
<input type="hidden" name="email" id="res_email">
<input type="hidden" name="user" id="res_emailuser">
<label class="form-label d-block mt-4">'.__('Restrict Receiving Incoming Mail').'</label>
<label class="label label-secondary-auto me-2">
<input type="radio" name="incoming" value="allow"> '.__('Allow').'
</label>
<label class="form-label me-2">
<input type="radio" name="incoming" value="suspend"> '.__('Suspend').'
</label>
<label class="form-label d-block mt-4">'.__('Restrict Sending Outgoing Mail').'</label>
<label class="form-label me-2">
<input type="radio" name="outgoing" value="allow"/>
'.__('Allow').'
</label>
<label class="form-label me-2">
<input type="radio" name="outgoing" value="suspend"/>
'.__('Suspend').'
</label>
<label class="form-label me-2">
<input type="radio" name="outgoing" value="hold"/>
'.__('Hold').'
</label>
<label class="form-label d-block mt-4">'.__('Restrict Logging In').'</label>
<label class="form-label me-2">
<input type="radio" name="login" value="allow"/>
'.__('Allow').'
</label>
<label class="form-label me-2">
<input type="radio" name="login" value="suspend"/>
'.__('Suspend').'
</label><br>
<center>
<input type="submit" name="suspend" class="btn btn-primary mt-2 text-center" align="center" value="'.__('Submit').'">
</center>
</form>
</div>
</div>
</div>
</div>
<script language="javascript" type="text/javascript">
$(document).ready(function (){
$("#checkAll").change(function () {
$(".email_check").prop("checked", $(this).prop("checked"));
});
$("input:checkbox").change(function() {
if($(".email_check:checked").length){
$("#delete_selected").removeAttr("disabled");
}else{
$("#delete_selected").prop("disabled", true);
}
});
});
$("#email_storage").click(function(){
order_by = "ASC&by=quota_used";
if($("#email_storage").hasClass("fa-sort-up")){
order_by = "DESC&by=quota_used";
}
url = window.location.toString();
url = url.replace(/[\?&]order=[^&]+/, "").replace(/[\?&]by=[^&]+/, "");
window.location = url+"&order="+order_by;
});
var order = "'.optGET('order').'";
var orderby = "'.optGET('by').'";
if(orderby == "quota_used"){
$("#email_storage").removeClass("fa-sort");
if(order == "ASC"){
$("#email_storage").addClass("fa-sort-up");
}else if(order == "DESC"){
$("#email_storage").addClass("fa-sort-down");
}
}
$(".search_val").keyup(function(e){
// console.log($(this).val());
var d = {email : $("#email_account_search").val()};
var qs = new URLSearchParams(d).toString();
window.location = "'.$globals['index'].'act=emails"+"&"+qs;
});
$("#user_search").on("select2:select", function(e, u = {}){
user = $("#user_search option:selected").val();
window.location = "'.$globals['index'].'act=emails&user="+user;
});
$("#dom_search").on("select2:select", function(){
var domain_selected = $("#dom_search option:selected").val();
window.location = "'.$globals['index'].'act=emails&domain="+domain_selected;
});
$("#email_account_search").on("select2:select", function(){
var email_account_search = $("#email_account_search option:selected").val();
window.location = "'.$globals['index'].'act=emails&email="+email_account_search;
});
function restrictPopup(mail, user){
$(".loading").show();
$("#load_modal").click();
$("#res_email").val(mail);
$("#res_emailuser").val(user);
$.getJSON("'.$globals['index'].'act=emails&api=json&restrictions=1&email="+mail+"&user="+user, function(data, textStatus, jqXHR) {
$.each( data.restrictions, function( key, value ) {
$("input[name="+key+"][value="+value+"]").prop("checked",true);
})
$(".loading").hide();
});
}
function del_emails(el){
var a;
var jEle = $(el);
var arr = [];
$("input:checkbox[name=checked_email]:checked").each(function(){
var email = $(this).val();
arr.push(email);
})
a = show_message_r("'.__js('Warning').'", "'.__js('Are you sure you want to delete the selected email(s) ?').'");
a.alert = "alert-warning";
a.confirm.push(function(){
var d = {"delete" : arr.join()};
// Submit the data
submitit(d, {done_reload : window.location.href});
});
show_message(a);
}
</script>';
}