diff --git a/util/daily-report.php b/util/daily-report.php index eb755e9..38fac3d 100644 --- a/util/daily-report.php +++ b/util/daily-report.php @@ -66,7 +66,7 @@ list($totalmem, $meminfo, $totalswap, $swapinfo) = $health->meminfo(); $shortdiskinfo = $health->diskinfo(); - list($archive_size, $counters) = $counter->getCounters(); + list($archive_size, $counters) = $counter->get_counters(); $sysinfo = $health->sysinfo(); diff --git a/util/ldap_sync.php b/util/ldap_sync.php index 66adf2e..457da82 100644 --- a/util/ldap_sync.php +++ b/util/ldap_sync.php @@ -55,19 +55,19 @@ foreach ($cfg as $ldap_params) { - $users = $import->model_user_import->queryRemoteUsers($ldap_params, $ldap_params['domain']); - $rc = $import->model_user_import->fillRemoteTable($ldap_params, $ldap_params['domain']); + $users = $import->model_user_import->query_remote_users($ldap_params, $ldap_params['domain']); + $rc = $import->model_user_import->fill_remote_table($ldap_params, $ldap_params['domain']); $totalusers += count($users); - list($newusers, $deletedusers) = $import->model_user_import->processUsers($users, $ldap_params); - list($a1, $a2) = $import->model_user_import->processUsers($users, $ldap_params); + list($newusers, $deletedusers) = $import->model_user_import->process_users($users, $ldap_params); + list($a1, $a2) = $import->model_user_import->process_users($users, $ldap_params); $totalnewusers += $newusers; $totaldeletedusers += $deletedusers; if($trash_passwords == 1) { - $import->model_user_import->trashPassword($users); + $import->model_user_import->trash_password($users); } } diff --git a/webui/controller/group/add.php b/webui/controller/group/add.php index a7a0f5a..837d0d5 100644 --- a/webui/controller/group/add.php +++ b/webui/controller/group/add.php @@ -17,7 +17,7 @@ $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 */ diff --git a/webui/controller/group/edit.php b/webui/controller/group/edit.php index 4343e99..f69f6a3 100644 --- a/webui/controller/group/edit.php +++ b/webui/controller/group/edit.php @@ -20,7 +20,7 @@ $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 @@ 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 @@ $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 @@ $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']; } diff --git a/webui/controller/health/worker.php b/webui/controller/health/worker.php index 8e0ed7b..ce66375 100644 --- a/webui/controller/health/worker.php +++ b/webui/controller/health/worker.php @@ -61,7 +61,7 @@ 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 @@ } - 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; } diff --git a/webui/controller/stat/chart.php b/webui/controller/stat/chart.php index e8d029f..bab4a75 100644 --- a/webui/controller/stat/chart.php +++ b/webui/controller/stat/chart.php @@ -27,11 +27,11 @@ /* 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(); diff --git a/webui/controller/stat/counter.php b/webui/controller/stat/counter.php index 7474bcd..1f10bed 100644 --- a/webui/controller/stat/counter.php +++ b/webui/controller/stat/counter.php @@ -24,12 +24,12 @@ 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'] = ''; diff --git a/webui/controller/stat/graph.php b/webui/controller/stat/graph.php index 0ed7ad2..1347310 100644 --- a/webui/controller/stat/graph.php +++ b/webui/controller/stat/graph.php @@ -28,11 +28,11 @@ /* 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'])) . "')"; } diff --git a/webui/controller/user/add.php b/webui/controller/user/add.php index 0b05628..6d333cd 100644 --- a/webui/controller/user/add.php +++ b/webui/controller/user/add.php @@ -18,7 +18,7 @@ $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 @@ $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 @@ 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 @@ $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']; } diff --git a/webui/controller/user/edit.php b/webui/controller/user/edit.php index 924b4c5..6d56928 100644 --- a/webui/controller/user/edit.php +++ b/webui/controller/user/edit.php @@ -22,7 +22,7 @@ $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 @@ 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 @@ $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']); } } diff --git a/webui/controller/user/list.php b/webui/controller/user/list.php index bbf7617..010232e 100644 --- a/webui/controller/user/list.php +++ b/webui/controller/user/list.php @@ -59,10 +59,10 @@ 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; diff --git a/webui/controller/user/remove.php b/webui/controller/user/remove.php index b80fb09..e897a20 100644 --- a/webui/controller/user/remove.php +++ b/webui/controller/user/remove.php @@ -31,7 +31,7 @@ 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']; } diff --git a/webui/controller/user/settings.php b/webui/controller/user/settings.php index 5235a6d..c8312af 100644 --- a/webui/controller/user/settings.php +++ b/webui/controller/user/settings.php @@ -33,7 +33,7 @@ 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 { diff --git a/webui/language/en/messages.php b/webui/language/en/messages.php index 64e554a..763ff04 100644 --- a/webui/language/en/messages.php +++ b/webui/language/en/messages.php @@ -74,6 +74,8 @@ $_['text_download_message2'] = "download message"; $_['text_edit'] = "Edit"; +$_['text_edit_group'] = "Edit group"; +$_['text_edit_user'] = "Edit user"; $_['text_edit_or_view'] = "Edit/view"; $_['text_email'] = "Email address"; $_['text_email_addresses'] = "Email addresses"; @@ -297,7 +299,7 @@ $_['text_user_id'] = "User id"; $_['text_user_auditor'] = "Auditor"; $_['text_user_domainadmin'] = "Domain admin"; -$_['text_user_management'] = "User"; +$_['text_user_management'] = "User management"; $_['text_user_masteradmin'] = "Master admin"; $_['text_user_read_only_admin'] = "Read-only admin"; $_['text_user_regular'] = "Regular user"; diff --git a/webui/language/hu/messages.iso-8859-2.php b/webui/language/hu/messages.iso-8859-2.php index c59f4c9..02fb33e 100644 --- a/webui/language/hu/messages.iso-8859-2.php +++ b/webui/language/hu/messages.iso-8859-2.php @@ -74,6 +74,8 @@ $_['text_download_message2'] = "lev�l let�lt�se"; $_['text_edit'] = "Szerkeszt"; +$_['text_edit_group'] = "Csoport szerkeszt�se"; +$_['text_edit_user'] = "Felhaszn�l� szerkeszt�se"; $_['text_edit_or_view'] = "Szerkeszt/Megn�z"; $_['text_email'] = "Email c�m"; $_['text_email_addresses'] = "Email c�mek"; @@ -120,7 +122,7 @@ $_['text_group_id'] = "Csoport azonos�t�"; $_['text_groupname'] = "Csoportn�v"; $_['text_groups'] = "Csoportok"; -$_['text_group_management'] = "Csoport"; +$_['text_group_management'] = "Csoportok"; $_['text_group_membership'] = "Csoport tags�g"; $_['text_image'] = "k�p"; @@ -298,7 +300,7 @@ $_['text_user_id'] = "Felhaszn�l� azonos�t�"; $_['text_user_auditor'] = "Auditor"; $_['text_user_domainadmin'] = "Domain admin"; -$_['text_user_management'] = "Felhaszn�l�"; +$_['text_user_management'] = "Felhaszn�l�k"; $_['text_user_masteradmin'] = "Mester admin"; $_['text_user_read_only_admin'] = "Read-only admin"; $_['text_user_regular'] = "Sima felhaszn�l�"; diff --git a/webui/language/hu/messages.php b/webui/language/hu/messages.php index e99ab72..d20798a 100644 --- a/webui/language/hu/messages.php +++ b/webui/language/hu/messages.php @@ -74,6 +74,8 @@ $_['text_download_message2'] = "levél letöltése"; $_['text_edit'] = "Szerkeszt"; +$_['text_edit_group'] = "Csoport szerkesztése"; +$_['text_edit_user'] = "Felhasználó szerkesztése"; $_['text_edit_or_view'] = "Szerkeszt/Megnéz"; $_['text_email'] = "Email cím"; $_['text_email_addresses'] = "Email címek"; @@ -120,7 +122,7 @@ $_['text_group_id'] = "Csoport azonosító"; $_['text_groupname'] = "Csoportnév"; $_['text_groups'] = "Csoportok"; -$_['text_group_management'] = "Csoport"; +$_['text_group_management'] = "Csoportok"; $_['text_group_membership'] = "Csoport tagság"; $_['text_image'] = "kép"; @@ -298,7 +300,7 @@ $_['text_user_id'] = "Felhasználó azonosító"; $_['text_user_auditor'] = "Auditor"; $_['text_user_domainadmin'] = "Domain admin"; -$_['text_user_management'] = "Felhasználó"; +$_['text_user_management'] = "Felhasználók"; $_['text_user_masteradmin'] = "Mester admin"; $_['text_user_read_only_admin'] = "Read-only admin"; $_['text_user_regular'] = "Sima felhasználó"; diff --git a/webui/model/stat/counter.php b/webui/model/stat/counter.php index cc41cf5..add3940 100644 --- a/webui/model/stat/counter.php +++ b/webui/model/stat/counter.php @@ -2,7 +2,7 @@ class ModelStatCounter extends Model { - public function getCounters(){ + public function get_counters(){ $counter = array(); $asize = 0; @@ -32,7 +32,7 @@ } - public function resetCounters(){ + public function reset_counters(){ if(MEMCACHED_ENABLED) { $memcache = Registry::get('memcache'); diff --git a/webui/model/user/auth.php b/webui/model/user/auth.php index 8971b23..a9a58af 100644 --- a/webui/model/user/auth.php +++ b/webui/model/user/auth.php @@ -50,7 +50,7 @@ $_SESSION['admin_user'] = 0; $_SESSION['email'] = $user['username']; - $this->changePassword($user['username'], $password); + $this->change_password($user['username'], $password); AUDIT(ACTION_LOGIN, $user['username'], '', '', 'changed password in local table'); @@ -64,7 +64,7 @@ } - public function changePassword($username = '', $password = '') { + public function change_password($username = '', $password = '') { if($username == "" || $password == ""){ return 0; } $query = $this->db->query("UPDATE " . TABLE_USER . " SET password=? WHERE username=?", array(crypt($password), $username)); diff --git a/webui/model/user/import.php b/webui/model/user/import.php index 6e579bb..a614cb9 100644 --- a/webui/model/user/import.php +++ b/webui/model/user/import.php @@ -4,18 +4,10 @@ class ModelUserImport extends Model { - public function getLdapParameters() { - $my_domain = $this->model_user_user->getDomains(); - $query = $this->db->query("SELECT remotehost, basedn, binddn FROM " . TABLE_REMOTE . " WHERE remotedomain=?", array($my_domain[0])); - - return $query->row; - } - - - public function queryRemoteUsers($host) { + public function query_remote_users($host) { $data = array(); - LOGGER("running queryRemoteUsers() ..."); + LOGGER("running query_remote_users() ..."); $attrs = array("cn", "mail", "mailAlternateAddress", "memberdn", "memberaddr"); $mailAttr = 'mail'; @@ -111,7 +103,7 @@ - public function fillRemoteTable($host = array(), $domain = '') { + public function fill_remote_table($host = array(), $domain = '') { if($domain == '') { return 0; } /* @@ -141,7 +133,7 @@ - public function processUsers($users = array(), $globals = array()) { + public function process_users($users = array(), $globals = array()) { $late_add = array(); $uids = array(); $exclude = array(); @@ -149,7 +141,7 @@ $deleteduser = 0; $n = 0; - LOGGER("running processUsers() ..."); + LOGGER("running process_users() ..."); /* build a list of DNs to exclude from the import */ @@ -170,7 +162,7 @@ /* Does this DN exist in the user table ? */ - $__user = $this->model_user_user->getUserByDN($_user['dn']); + $__user = $this->model_user_user->get_user_by_dn($_user['dn']); if(isset($__user['uid'])) { @@ -180,7 +172,7 @@ /* if so, then verify the email addresses */ $changed = 0; - $emails = $this->model_user_user->getEmailsByUid($__user['uid']); + $emails = $this->model_user_user->get_emails_by_uid($__user['uid']); /* first let's add the new email addresses */ @@ -189,7 +181,7 @@ foreach ($ldap_emails as $email) { if(!in_array($email, $sql_emails)) { - $rc = $this->model_user_user->addEmail($__user['uid'], $email); + $rc = $this->model_user_user->add_email($__user['uid'], $email); $changed++; /* in case of an error add it to the $late_add array() */ @@ -208,7 +200,7 @@ foreach ($sql_emails as $email) { if(!in_array($email, $ldap_emails)) { - $rc = $this->model_user_user->removeEmail($__user['uid'], $email); + $rc = $this->model_user_user->remove_email($__user['uid'], $email); $changed++; } } @@ -224,7 +216,7 @@ $user = $this->createNewUserArray($_user['dn'], $_user['username'], $_user['realname'], $_user['emails'], $globals); array_push($uids, $user['uid']); - $rc = $this->model_user_user->addUser($user); + $rc = $this->model_user_user->add_user($user); if($rc == 1) { $newuser++; } } } @@ -233,7 +225,7 @@ /* add the rest to the email table */ foreach ($late_add as $new) { - $rc = $this->model_user_user->addEmail($new['uid'], $new['email']); + $rc = $this->model_user_user->add_email($new['uid'], $new['email']); if($rc == 1) { $newuser++; } } @@ -258,7 +250,7 @@ foreach ($users as $user) { if($user['members']) { - $group = $this->model_user_user->getUserByDN($user['dn']); + $group = $this->model_user_user->get_user_by_dn($user['dn']); $members = explode("\n", $user['members']); if(count($members) > 0) { @@ -269,9 +261,9 @@ foreach ($members as $member) { if(validemail($member)) { - $__user = $this->model_user_user->getUserByEmail($member); + $__user = $this->model_user_user->get_user_by_email($member); } else { - $__user = $this->model_user_user->getUserByDN($member); + $__user = $this->model_user_user->get_user_by_dn($member); } if(isset($group['uid']) && isset($__user['uid'])) { @@ -291,7 +283,7 @@ private function createNewUserArray($dn = '', $username = '', $realname = '', $emails = '', $globals = array()) { $user = array(); - $user['uid'] = $this->model_user_user->getNextUid(); + $user['uid'] = $this->model_user_user->get_next_uid(); $user['gid'] = $globals['gid']; $user['email'] = $emails; @@ -322,7 +314,7 @@ } - public function trashPassword($users = array()) { + public function trash_password($users = array()) { foreach ($users as $user) { $query = $this->db->query("UPDATE " . TABLE_USER . " SET password='*' WHERE dn=?", array($user['dn'])); $rc = $this->db->countAffected(); diff --git a/webui/model/user/user.php b/webui/model/user/user.php index 68e49ef..1465b00 100644 --- a/webui/model/user/user.php +++ b/webui/model/user/user.php @@ -3,7 +3,7 @@ class ModelUserUser extends Model { - public function checkUID($uid) { + public function check_uid($uid) { if($uid == "") { return 0; } if(!is_numeric($uid)) { return 0; } @@ -14,7 +14,7 @@ } - public function getUidByName($username = '') { + public function get_uid_by_name($username = '') { if($username == ""){ return -1; } $query = $this->db->query("SELECT uid FROM " . TABLE_USER . " WHERE username=?", array($username)); @@ -27,18 +27,6 @@ } - public function getUsernameByUid($uid = 0) { - - $query = $this->db->query("SELECT username FROM " . TABLE_USER . " WHERE uid=?", array((int)$uid)); - - if(isset($query->row['username'])){ - return $query->row['username']; - } - - return ""; - } - - public function get_uid_by_email($email = '') { $query = $this->db->query("SELECT uid FROM " . TABLE_EMAIL . " WHERE email=?", array($email)); @@ -109,19 +97,7 @@ } - public function getEmailAddress($username = '') { - - $query = $this->db->query("SELECT " . TABLE_EMAIL . ".email AS email FROM " . TABLE_EMAIL . "," . TABLE_USER . " WHERE " . TABLE_EMAIL . ".uid=" . TABLE_USER . ".uid AND " . TABLE_USER . ".username=? LIMIT 1", array($username)); - - if(isset($query->row['email'])){ - return $query->row['email']; - } - - return ""; - } - - - public function getEmails($username = '') { + public function get_emails($username = '') { $emails = ""; $query = $this->db->query("SELECT " . TABLE_EMAIL . ".email AS email FROM " . TABLE_EMAIL . "," . TABLE_USER . " WHERE " . TABLE_EMAIL . ".uid=" . TABLE_USER . ".uid AND " . TABLE_USER . ".username=?", array($username)); @@ -134,7 +110,7 @@ } - public function getEmailsByUid($uid = 0) { + public function get_emails_by_uid($uid = 0) { $emails = ""; $query = $this->db->query("SELECT email FROM " . TABLE_EMAIL . " WHERE uid=?", array((int)$uid)); @@ -146,7 +122,7 @@ } - public function getUserByDN($dn = '') { + public function get_user_by_dn($dn = '') { if($dn == '') { return array(); } $query = $this->db->query("SELECT * FROM " . TABLE_USER . " WHERE dn=?", array($dn)); @@ -170,7 +146,7 @@ } - public function getUserByEmail($email = '') { + public function get_user_by_email($email = '') { if($email == '') { return array(); } @@ -181,20 +157,7 @@ } - public function getUsernameByEmail($email = '') { - $username = ""; - - if($email == '') { return $username; } - - $query = $this->db->query("SELECT username FROM " . TABLE_USER . " WHERE uid IN (SELECT uid FROM " . TABLE_EMAIL . " WHERE email=?)", array($email)); - - if(isset($query->row['username'])) { $username = $query->row['username']; } - - return $username; - } - - - public function getUsers($search = '', $page = 0, $page_len = 0, $sort = 'username', $order = 0) { + public function get_users($search = '', $page = 0, $page_len = 0, $sort = 'username', $order = 0) { $where_cond = " WHERE " . TABLE_USER . ".uid=" . TABLE_EMAIL . ".uid "; $_order = ""; $users = array(); @@ -240,7 +203,7 @@ } - public function howManyUsers($search = '') { + public function count_users($search = '') { $where_cond = ""; if($search){ @@ -279,7 +242,7 @@ } - public function getNextUid() { + public function get_next_uid() { $query = $this->db->query("SELECT MAX(uid) AS last_id FROM " . TABLE_USER); @@ -291,11 +254,11 @@ } - public function addUser($user) { + public function add_user($user) { LOGGER("add user: " . $user['username'] . ", uid=" . (int)$user['uid']); if(!isset($user['domain']) || $user['domain'] == "") { return -1; } - if(!isset($user['username']) || $user['username'] == "" || $this->getUidByName($user['username']) > 0) { return -1; } + if(!isset($user['username']) || $user['username'] == "" || $this->get_uid_by_name($user['username']) > 0) { return -1; } $emails = explode("\n", $user['email']); foreach ($emails as $email) { @@ -330,7 +293,7 @@ foreach ($emails as $email) { $email = rtrim($email); - $ret = $this->addEmail((int)$user['uid'], $email); + $ret = $this->add_email((int)$user['uid'], $email); if($ret == 0) { return -2; } } @@ -339,7 +302,7 @@ } - public function addEmail($uid = 0, $email = '') { + public function add_email($uid = 0, $email = '') { if($uid < 1 || $email == ""){ return 0; } $query = $this->db->query("INSERT INTO " . TABLE_EMAIL . " (uid, email) VALUES(?,?)", array((int)$uid, $email)); @@ -352,7 +315,7 @@ } - public function removeEmail($uid = 0, $email = '') { + public function remove_email($uid = 0, $email = '') { if((int)$uid < 1 || $email == ""){ return 0; } $query = $this->db->query("DELETE FROM " . TABLE_EMAIL . " WHERE uid=? AND email=?", array((int)$uid, $email)); @@ -365,7 +328,7 @@ } - public function updateUser($user) { + public function update_user($user) { LOGGER("update user: " . $user['username'] . ", uid=" . (int)$user['uid']); $emails = explode("\n", $user['email']); @@ -413,8 +376,8 @@ } - public function deleteUser($uid) { - if(!$this->checkUID($uid)){ return 0; } + public function delete_user($uid) { + if(!$this->check_uid($uid)){ return 0; } $query = $this->db->query("DELETE FROM " . TABLE_EMAIL . " WHERE uid=?", array((int)$uid)); $query = $this->db->query("DELETE FROM " . TABLE_USER . " WHERE uid=?", array((int)$uid)); diff --git a/webui/view/theme/default/templates/group/add.tpl b/webui/view/theme/default/templates/group/add.tpl index 2781274..9a3d7df 100644 --- a/webui/view/theme/default/templates/group/add.tpl +++ b/webui/view/theme/default/templates/group/add.tpl @@ -1,6 +1,4 @@ -
-:
diff --git a/webui/view/theme/default/templates/group/edit.tpl b/webui/view/theme/default/templates/group/edit.tpl index ee11bca..289738a 100644 --- a/webui/view/theme/default/templates/group/edit.tpl +++ b/webui/view/theme/default/templates/group/edit.tpl @@ -1,4 +1,5 @@ +:
diff --git a/webui/view/theme/default/templates/user/add.tpl b/webui/view/theme/default/templates/user/add.tpl index 0e7b68d..fa2bfa1 100644 --- a/webui/view/theme/default/templates/user/add.tpl +++ b/webui/view/theme/default/templates/user/add.tpl @@ -1,6 +1,4 @@ - -:
diff --git a/webui/view/theme/default/templates/user/edit.tpl b/webui/view/theme/default/templates/user/edit.tpl index 032ee07..174a3d9 100644 --- a/webui/view/theme/default/templates/user/edit.tpl +++ b/webui/view/theme/default/templates/user/edit.tpl @@ -85,7 +85,7 @@