mirror of
https://bitbucket.org/jsuto/piler.git
synced 2025-06-12 23:27:03 +02:00
improved multitenancy support
This commit is contained in:
82
webui/controller/domain/domains.php
Normal file
82
webui/controller/domain/domains.php
Normal file
@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
|
||||
class ControllerDomainDomains extends Controller {
|
||||
private $error = array();
|
||||
|
||||
public function index(){
|
||||
|
||||
$this->id = "content";
|
||||
$this->template = "domain/domains.tpl";
|
||||
$this->layout = "common/layout-email";
|
||||
|
||||
|
||||
$request = Registry::get('request');
|
||||
$db = Registry::get('db');
|
||||
$language = Registry::get('language');
|
||||
|
||||
$this->load->model('domain/domain');
|
||||
|
||||
//$this->document->title = $language->get('text_group_management');
|
||||
|
||||
$this->data['page'] = 0;
|
||||
$this->data['page_len'] = get_page_length();
|
||||
|
||||
$this->data['total'] = 0;
|
||||
|
||||
$this->data['sort'] = 'domain';
|
||||
|
||||
$this->data['term'] = '';
|
||||
|
||||
if(!isset($this->request->get['term']) || strlen($this->request->get['term']) < 1) { die("no data"); }
|
||||
|
||||
if(isset($this->request->get['page']) && is_numeric($this->request->get['page']) && $this->request->get['page'] > 0) {
|
||||
$this->data['page'] = $this->request->get['page'];
|
||||
}
|
||||
|
||||
$this->data['search'] = $this->request->get['term'];
|
||||
|
||||
/* check if we are admin */
|
||||
|
||||
if(Registry::get('admin_user') == 1) {
|
||||
|
||||
// for autocomplete
|
||||
|
||||
if(strlen($this->request->get['term']) >= 2) {
|
||||
$domains = $this->model_domain_domain->get_domains_by_string($this->request->get['term']);
|
||||
|
||||
$i = 0;
|
||||
$s = '[ ';
|
||||
|
||||
foreach($domains as $domain) {
|
||||
$i++;
|
||||
$s .= '{ "id": "' . $i . '", "value": "' . $domain['domain'] . '" },';
|
||||
}
|
||||
|
||||
$s = preg_replace("/,$/", "", $s) . " ]";
|
||||
|
||||
print $s;
|
||||
}
|
||||
|
||||
// for domain list
|
||||
|
||||
if(strlen($this->request->get['term']) == 1) {
|
||||
$this->data['domains'] = $this->model_domain_domain->get_domains_by_string($this->request->get['term'], $this->data['page'], $this->data['page_len']);
|
||||
|
||||
$this->data['total'] = $this->model_domain_domain->count_domains($this->request->get['term']);
|
||||
|
||||
$this->data['prev_page'] = $this->data['page'] - 1;
|
||||
$this->data['next_page'] = $this->data['page'] + 1;
|
||||
|
||||
$this->data['total_pages'] = floor($this->data['total'] / $this->data['page_len']);
|
||||
|
||||
$this->render();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -59,17 +59,6 @@ class ControllerHealthWorker extends Controller {
|
||||
$db = Registry::get('db');
|
||||
$db->select_db($db->database);
|
||||
|
||||
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->reset_counters();
|
||||
header("Location: index.php?route=health/health");
|
||||
exit;
|
||||
}
|
||||
else {
|
||||
$this->template = "health/counter-reset-confirm.tpl";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
list($this->data['archive_size'], $this->data['counters']) = $this->model_stat_counter->get_counters();
|
||||
|
||||
|
@ -73,6 +73,7 @@ class ControllerUserEdit extends Controller {
|
||||
else {
|
||||
$this->data['user'] = $this->model_user_user->get_user_by_uid($this->data['uid']);
|
||||
|
||||
$this->data['user']['domains'] = $this->model_user_user->get_domains_by_uid($this->data['uid']);
|
||||
$this->data['user']['group_membership'] = $this->model_user_user->get_additional_uids($this->data['uid']);
|
||||
$this->data['user']['group'] = $this->model_group_group->get_groups_by_uid($this->data['uid']);
|
||||
$this->data['user']['folder'] = $this->model_folder_folder->get_folders_by_uid($this->data['uid']);
|
||||
|
@ -16,8 +16,32 @@ class ControllerUserSettings extends Controller {
|
||||
|
||||
$this->load->model('user/auth');
|
||||
$this->load->model('user/prefs');
|
||||
$this->load->model('user/user');
|
||||
$this->load->model('group/group');
|
||||
|
||||
$this->document->title = $this->data['text_settings'];
|
||||
|
||||
$d = $r = '';
|
||||
$auditemails = $auditdomains = $auditgroups = $auditfolders = '';
|
||||
|
||||
$auditemails = $this->model_user_user->get_emails_by_uid($_SESSION['uid']);
|
||||
|
||||
foreach($_SESSION['auditdomains'] as $d) {
|
||||
$auditdomains .= ', '.$d;
|
||||
}
|
||||
$auditdomains = preg_replace("/^,\s/", "", $auditdomains);
|
||||
|
||||
$auditgroups = preg_replace("/\s/", ", ", $this->model_group_group->get_groups_by_uid($_SESSION['uid']));
|
||||
|
||||
foreach ($_SESSION['folders'] as $r) {
|
||||
$auditfolders .= ', '.$r;
|
||||
}
|
||||
$auditfolders = preg_replace("/^,\s/", "", $auditfolders);
|
||||
|
||||
if($auditemails) { $this->data['emails'] = $auditemails; } else { $this->data['emails'] = $this->data['text_none_found']; }
|
||||
if($auditdomains) { $this->data['domains'] = $auditdomains; } else { $this->data['domains'] = $this->data['text_none_found']; }
|
||||
if($auditgroups) { $this->data['groups'] = $auditgroups; } else { $this->data['groups'] = $this->data['text_none_found']; }
|
||||
if($auditfolders) { $this->data['folders'] = $auditfolders; } else { $this->data['folders'] = $this->data['text_none_found']; }
|
||||
|
||||
if(isset($this->request->post['pagelen']) && isset($this->request->post['theme'])) {
|
||||
$this->model_user_prefs->set_user_preferences(Registry::get('username'), $this->request->post);
|
||||
|
Reference in New Issue
Block a user