mirror of
https://bitbucket.org/jsuto/piler.git
synced 2025-06-12 23:27:03 +02:00
webui code cleanup
This commit is contained in:
@ -17,7 +17,7 @@ class ControllerGroupAdd extends Controller {
|
||||
|
||||
$this->load->model('group/group');
|
||||
|
||||
$this->document->title = $this->data['text_group_management'];
|
||||
$this->document->title = $this->data['text_add_new_group'];
|
||||
|
||||
/* check if we are admin */
|
||||
|
||||
|
@ -20,7 +20,7 @@ class ControllerGroupEdit extends Controller {
|
||||
$this->load->model('group/group');
|
||||
|
||||
|
||||
$this->document->title = $language->get('text_group_management');
|
||||
$this->document->title = $language->get('text_edit_group');
|
||||
|
||||
$this->data['domains'] = array();
|
||||
|
||||
@ -38,7 +38,10 @@ class ControllerGroupEdit extends Controller {
|
||||
|
||||
if(Registry::get('admin_user') == 1) {
|
||||
|
||||
$this->data['group'] = $this->model_group_group->get_domain_by_id($this->data['id']);
|
||||
|
||||
if($this->request->server['REQUEST_METHOD'] == 'POST') {
|
||||
|
||||
if($this->validate() == true){
|
||||
|
||||
$ret = $this->model_group_group->update_group($this->request->post);
|
||||
@ -50,20 +53,13 @@ class ControllerGroupEdit extends Controller {
|
||||
$this->data['errorstring'] = $this->data['text_failed_to_modify'] . ": " . $ret;
|
||||
}
|
||||
|
||||
//$__groupname = $this->request->post['groupname'];
|
||||
}
|
||||
else {
|
||||
$this->template = "common/error.tpl";
|
||||
$this->data['errorstring'] = array_pop($this->error);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$this->data['group'] = $this->model_group_group->get_domain_by_id($this->data['id']);
|
||||
$this->data['email'] = $this->model_group_group->get_emails_by_group_id($this->data['id']);
|
||||
|
||||
//$this->data['user']['group_membership'] = $this->model_user_user->get_additional_uids($this->data['uid']);
|
||||
//$this->data['emails'] = $this->model_user_user->getEmails($this->data['user']['username']);
|
||||
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -84,6 +80,10 @@ class ControllerGroupEdit extends Controller {
|
||||
$this->error['group'] = $this->data['text_missing_data'];
|
||||
}
|
||||
|
||||
if(!isset($this->request->post['email']) || $this->request->post['email'] == '') {
|
||||
$this->error['email'] = $this->data['text_missing_data'];
|
||||
}
|
||||
|
||||
if(!isset($this->request->post['id']) || !is_numeric($this->request->post['id']) || (int)$this->request->post['id'] < 0) {
|
||||
$this->error['id'] = $this->data['text_invalid_data'];
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ class ControllerHealthWorker extends Controller {
|
||||
|
||||
if($this->request->server['REQUEST_METHOD'] == 'POST' && isset($this->request->post['resetcounters']) && $this->request->post['resetcounters'] == 1) {
|
||||
if(isset($this->request->post['confirmed']) && $this->request->post['confirmed'] == 1 && Registry::get('admin_user') == 1) {
|
||||
$this->model_stat_counter->resetCounters();
|
||||
$this->model_stat_counter->reset_counters();
|
||||
header("Location: index.php?route=health/health");
|
||||
exit;
|
||||
}
|
||||
@ -71,7 +71,7 @@ class ControllerHealthWorker extends Controller {
|
||||
}
|
||||
|
||||
|
||||
list($this->data['archive_size'], $this->data['counters']) = $this->model_stat_counter->getCounters();
|
||||
list($this->data['archive_size'], $this->data['counters']) = $this->model_stat_counter->get_counters();
|
||||
|
||||
$this->data['prefix'] = '';
|
||||
if(isset($this->data['counters'][MEMCACHED_PREFIX . 'rcvd'])) { $this->data['prefix'] = MEMCACHED_PREFIX; }
|
||||
|
@ -27,11 +27,11 @@ class ControllerStatChart extends Controller {
|
||||
/* let the admin users see the whole statistics */
|
||||
|
||||
if(Registry::get('admin_user') == 0 && Registry::get('readonly_admin') == 0) {
|
||||
$uid = $this->model_user_user->getUidByName($this->data['username']);
|
||||
$emails = "AND rcpt IN ('" . preg_replace("/\n/", "','", $this->model_user_user->getEmailsByUid((int)$uid)) . "')";
|
||||
$uid = $this->model_user_user->get_uid_by_name($this->data['username']);
|
||||
$emails = "AND rcpt IN ('" . preg_replace("/\n/", "','", $this->model_user_user->get_emails_by_uid((int)$uid)) . "')";
|
||||
}
|
||||
else if(isset($this->request->get['uid']) && is_numeric($this->request->get['uid']) && $this->request->get['uid'] > 0){
|
||||
$emails = "AND rcpt IN ('" . preg_replace("/\n/", "','", $this->model_user_user->getEmailsByUid((int)$this->request->get['uid'])) . "')";
|
||||
$emails = "AND rcpt IN ('" . preg_replace("/\n/", "','", $this->model_user_user->get_emails_by_uid((int)$this->request->get['uid'])) . "')";
|
||||
}
|
||||
|
||||
$aa = new ModelStatChart();
|
||||
|
@ -24,12 +24,12 @@ class ControllerStatCounter extends Controller {
|
||||
if(Registry::get('admin_user') == 1) {
|
||||
|
||||
if($this->request->server['REQUEST_METHOD'] == 'POST' && @$this->request->post['reset'] == 1) {
|
||||
$this->model_stat_counter->resetCounters();
|
||||
$this->model_stat_counter->reset_counters();
|
||||
header("Location: index.php?route=stat/counter");
|
||||
exit;
|
||||
}
|
||||
|
||||
$this->data['counters'] = $this->model_stat_counter->getCounters();
|
||||
$this->data['counters'] = $this->model_stat_counter->get_counters();
|
||||
|
||||
$this->data['prefix'] = '';
|
||||
|
||||
|
@ -28,11 +28,11 @@ class ControllerStatGraph extends Controller {
|
||||
/* let the admin users see the whole statistics */
|
||||
|
||||
if(Registry::get('admin_user') == 0 && Registry::get('readonly_admin') == 0) {
|
||||
$uid = $this->model_user_user->getUidByName($this->data['username']);
|
||||
$emails = "AND rcpt IN ('" . preg_replace("/\n/", "','", $this->model_user_user->getEmailsByUid((int)$uid)) . "')";
|
||||
$uid = $this->model_user_user->get_uid_by_name($this->data['username']);
|
||||
$emails = "AND rcpt IN ('" . preg_replace("/\n/", "','", $this->model_user_user->get_emails_by_uid((int)$uid)) . "')";
|
||||
}
|
||||
else if(isset($this->request->get['uid']) && is_numeric($this->request->get['uid']) && $this->request->get['uid'] > 0){
|
||||
$emails = "AND rcpt IN ('" . preg_replace("/\n/", "','", $this->model_user_user->getEmailsByUid((int)$this->request->get['uid'])) . "')";
|
||||
$emails = "AND rcpt IN ('" . preg_replace("/\n/", "','", $this->model_user_user->get_emails_by_uid((int)$this->request->get['uid'])) . "')";
|
||||
}
|
||||
|
||||
|
||||
|
@ -18,7 +18,7 @@ class ControllerUserAdd extends Controller {
|
||||
$this->load->model('user/user');
|
||||
$this->load->model('group/group');
|
||||
|
||||
$this->document->title = $this->data['text_user_management'];
|
||||
$this->document->title = $this->data['text_add_new_user_alias'];
|
||||
|
||||
$this->data['domains'] = array();
|
||||
|
||||
@ -37,7 +37,7 @@ class ControllerUserAdd extends Controller {
|
||||
$ret = 0;
|
||||
|
||||
if($this->validate() == true){
|
||||
$ret = $this->model_user_user->addUser($this->request->post);
|
||||
$ret = $this->model_user_user->add_user($this->request->post);
|
||||
|
||||
$_SESSION['last_domain'] = $this->request->post['domain'];
|
||||
|
||||
@ -54,12 +54,12 @@ class ControllerUserAdd extends Controller {
|
||||
if($ret == 0) {
|
||||
|
||||
$this->data['post'] = $this->request->post;
|
||||
$this->data['next_user_id'] = $this->model_user_user->getNextUid();
|
||||
$this->data['next_user_id'] = $this->model_user_user->get_next_uid();
|
||||
|
||||
}
|
||||
}
|
||||
else {
|
||||
$this->data['next_user_id'] = $this->model_user_user->getNextUid();
|
||||
$this->data['next_user_id'] = $this->model_user_user->get_next_uid();
|
||||
$this->data['groups'] = $this->model_group_group->get_groups();
|
||||
}
|
||||
}
|
||||
@ -114,7 +114,7 @@ class ControllerUserAdd extends Controller {
|
||||
$this->error['username'] = $this->data['text_invalid_username'];
|
||||
}
|
||||
|
||||
if(isset($this->request->post['username']) && $this->model_user_user->getUidByName($this->request->post['username']) > 0) {
|
||||
if(isset($this->request->post['username']) && $this->model_user_user->get_uid_by_name($this->request->post['username']) > 0) {
|
||||
$this->error['username'] = $this->data['text_existing_user'];
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@ class ControllerUserEdit extends Controller {
|
||||
$this->load->model('group/group');
|
||||
|
||||
|
||||
$this->document->title = $language->get('text_user_management');
|
||||
$this->document->title = $language->get('text_edit_user');
|
||||
|
||||
$this->data['domains'] = array();
|
||||
|
||||
@ -53,7 +53,7 @@ class ControllerUserEdit extends Controller {
|
||||
if($this->request->server['REQUEST_METHOD'] == 'POST') {
|
||||
if($this->validate() == true){
|
||||
|
||||
$ret = $this->model_user_user->updateUser($this->request->post);
|
||||
$ret = $this->model_user_user->update_user($this->request->post);
|
||||
|
||||
if($ret == 1){
|
||||
$this->data['x'] = $this->data['text_successfully_modified'];
|
||||
@ -75,7 +75,7 @@ class ControllerUserEdit extends Controller {
|
||||
|
||||
$this->data['user']['group_membership'] = $this->model_user_user->get_additional_uids($this->data['uid']);
|
||||
|
||||
$this->data['emails'] = $this->model_user_user->getEmails($this->data['user']['username']);
|
||||
$this->data['emails'] = $this->model_user_user->get_emails($this->data['user']['username']);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -59,10 +59,10 @@ class ControllerUserList extends Controller {
|
||||
|
||||
if(Registry::get('admin_user') == 1) {
|
||||
|
||||
$users = $this->model_user_user->getUsers($this->data['search'], $this->data['page'], $this->data['page_len'],
|
||||
$users = $this->model_user_user->get_users($this->data['search'], $this->data['page'], $this->data['page_len'],
|
||||
$this->data['sort'], $this->data['order']);
|
||||
|
||||
$this->data['total_users'] = $this->model_user_user->howManyUsers($this->data['search']);
|
||||
$this->data['total_users'] = $this->model_user_user->count_users($this->data['search']);
|
||||
|
||||
foreach ($users as $user) {
|
||||
$policy_group = DEFAULT_POLICY;
|
||||
|
@ -31,7 +31,7 @@ class ControllerUserRemove extends Controller {
|
||||
if($this->validate() == true) {
|
||||
|
||||
if($this->data['confirmed'] == 1) {
|
||||
$ret = $this->model_user_user->deleteUser($this->data['uid']);
|
||||
$ret = $this->model_user_user->delete_user($this->data['uid']);
|
||||
if($ret == 1){
|
||||
$this->data['x'] = $this->data['text_successfully_removed'];
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ class ControllerUserSettings extends Controller {
|
||||
|
||||
if($this->request->server['REQUEST_METHOD'] == 'POST' && PASSWORD_CHANGE_ENABLED == 1 && $this->validate() == true) {
|
||||
|
||||
if($this->model_user_auth->changePassword(Registry::get('username'), $this->request->post['password']) == 1) {
|
||||
if($this->model_user_auth->change_password(Registry::get('username'), $this->request->post['password']) == 1) {
|
||||
$this->data['x'] = $this->data['text_password_changed'];
|
||||
}
|
||||
else {
|
||||
|
Reference in New Issue
Block a user