Skip to content

Commit 6352781

Browse files
author
mcramer
committed
- Implemented
New global option to grant reseller users access to the options (advanced) tab in web domains and vhost subdomains
1 parent ebbc081 commit 6352781

File tree

9 files changed

+120
-3
lines changed

9 files changed

+120
-3
lines changed

install/tpl/system.ini.master

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ dblist_phpmyadmin_link=y
2323
phpmyadmin_url=/phpmyadmin
2424
webftp_url=
2525
client_username_web_check_disabled=n
26+
reseller_can_use_options=n
2627

2728
[tools]
2829

interface/web/admin/form/system_config.tform.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,12 @@
160160
'default' => 'n',
161161
'value' => array(0 => 'n',1 => 'y')
162162
),
163+
'reseller_can_use_options' => array (
164+
'datatype' => 'VARCHAR',
165+
'formtype' => 'CHECKBOX',
166+
'default' => 'n',
167+
'value' => array(0 => 'n',1 => 'y')
168+
),
163169
##################################
164170
# ENDE Datatable fields
165171
##################################

interface/web/admin/lib/lang/de_system_config.lng

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,5 @@ $wb['client_username_web_check_disabled_txt'] = 'Deaktiviere die Kunden Benutzer
4949
$wb['mailbox_show_autoresponder_tab_txt'] = 'Zeige Autoresponder Reiter in E-Mail Kontodetails';
5050
$wb['mailbox_show_mail_filter_tab_txt'] = 'Zeige E-Mail Filter Reiter in E-Mail Kontodetails';
5151
$wb['mailbox_show_custom_rules_tab_txt'] = 'Zeige Benutzerregel Reiter in E-Mail Kontodetails';
52+
$wb['reseller_can_use_options_txt'] = 'Reseller können den Optionen Reiter bei Webseiten verwenden';
5253
?>

interface/web/admin/lib/lang/en_system_config.lng

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,5 @@ $wb['client_username_web_check_disabled_txt'] = 'Disable client username check f
5252
$wb['mailbox_show_autoresponder_tab_txt'] = 'Show autoresponder tab in mail account details';
5353
$wb['mailbox_show_mail_filter_tab_txt'] = 'Show mail filter tab in mail account details';
5454
$wb['mailbox_show_custom_rules_tab_txt'] = 'Show custom mailfilter tab in mail account details';
55+
$wb['reseller_can_use_options_txt'] = 'Reseller can use options tab in web sites config';
5556
?>

interface/web/admin/templates/system_config_sites_edit.htm

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@ <h2><tmpl_var name="list_head_txt"></h2>
5050
<div class="multiField">
5151
{tmpl_var name='client_username_web_check_disabled'}
5252
</div>
53+
</div>
54+
<div class="ctrlHolder">
55+
<p class="label">{tmpl_var name='reseller_can_use_options_txt'}</p>
56+
<div class="multiField">
57+
{tmpl_var name='reseller_can_use_options'}
58+
</div>
5359
</div>
5460
</fieldset>
5561

interface/web/sites/form/web_domain.tform.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@
7272
if($client['limit_ssl'] != 'y') $ssl_available = false;
7373
}
7474

75+
$app->uses('getconf');
76+
$web_config = $app->getconf->get_global_config('sites');
77+
7578
$form["tabs"]['domain'] = array (
7679
'title' => "Domain",
7780
'width' => 100,
@@ -524,7 +527,8 @@
524527

525528
// }
526529

527-
if($_SESSION["s"]["user"]["typ"] == 'admin') {
530+
if($_SESSION["s"]["user"]["typ"] == 'admin'
531+
|| ($web_config['reseller_can_use_options'] == 'y' && $app->auth->has_clients($_SESSION['s']['user']['userid']))) {
528532

529533
$form["tabs"]['advanced'] = array (
530534
'title' => "Options",

interface/web/sites/form/web_vhost_subdomain.tform.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@
6464
if($client['limit_ssl'] != 'y') $ssl_available = false;
6565
}
6666

67+
$app->uses('getconf');
68+
$web_config = $app->getconf->get_global_config('sites');
69+
6770
$form["tabs"]['domain'] = array (
6871
'title' => "Domain",
6972
'width' => 100,
@@ -523,7 +526,8 @@
523526

524527
// }
525528

526-
if($_SESSION["s"]["user"]["typ"] == 'admin') {
529+
if($_SESSION["s"]["user"]["typ"] == 'admin'
530+
|| ($web_config['reseller_can_use_options'] == 'y' && $app->auth->has_clients($_SESSION['s']['user']['userid']))) {
527531

528532
$form["tabs"]['advanced'] = array (
529533
'title' => "Options",

interface/web/sites/web_domain_edit.php

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,53 @@ function onShowEnd() {
253253
// add limits to template to be able to hide settings
254254
foreach($read_limits as $limit) $app->tpl->setVar($limit, $client[$limit]);
255255

256+
$sites_config = $app->getconf->get_global_config('sites');
257+
if($sites_config['reseller_can_use_options']) {
258+
// Directive Snippets
259+
$php_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'php' AND active = 'y'");
260+
$php_directive_snippets_txt = '';
261+
if(is_array($php_directive_snippets) && !empty($php_directive_snippets)){
262+
foreach($php_directive_snippets as $php_directive_snippet){
263+
$php_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$php_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.htmlentities($php_directive_snippet['snippet']).'</pre></a> ';
264+
}
265+
}
266+
if($php_directive_snippets_txt == '') $php_directive_snippets_txt = '------';
267+
$app->tpl->setVar("php_directive_snippets_txt",$php_directive_snippets_txt);
268+
269+
if($server_type == 'apache'){
270+
$apache_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'apache' AND active = 'y'");
271+
$apache_directive_snippets_txt = '';
272+
if(is_array($apache_directive_snippets) && !empty($apache_directive_snippets)){
273+
foreach($apache_directive_snippets as $apache_directive_snippet){
274+
$apache_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$apache_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.htmlentities($apache_directive_snippet['snippet']).'</pre></a> ';
275+
}
276+
}
277+
if($apache_directive_snippets_txt == '') $apache_directive_snippets_txt = '------';
278+
$app->tpl->setVar("apache_directive_snippets_txt",$apache_directive_snippets_txt);
279+
}
280+
281+
if($server_type == 'nginx'){
282+
$nginx_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'nginx' AND active = 'y'");
283+
$nginx_directive_snippets_txt = '';
284+
if(is_array($nginx_directive_snippets) && !empty($nginx_directive_snippets)){
285+
foreach($nginx_directive_snippets as $nginx_directive_snippet){
286+
$nginx_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$nginx_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.htmlentities($nginx_directive_snippet['snippet']).'</pre></a> ';
287+
}
288+
}
289+
if($nginx_directive_snippets_txt == '') $nginx_directive_snippets_txt = '------';
290+
$app->tpl->setVar("nginx_directive_snippets_txt",$nginx_directive_snippets_txt);
291+
}
292+
293+
$proxy_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'proxy' AND active = 'y'");
294+
$proxy_directive_snippets_txt = '';
295+
if(is_array($proxy_directive_snippets) && !empty($proxy_directive_snippets)){
296+
foreach($proxy_directive_snippets as $proxy_directive_snippet){
297+
$proxy_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$proxy_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.htmlentities($proxy_directive_snippet['snippet']).'</pre></a> ';
298+
}
299+
}
300+
if($proxy_directive_snippets_txt == '') $proxy_directive_snippets_txt = '------';
301+
$app->tpl->setVar("proxy_directive_snippets_txt",$proxy_directive_snippets_txt);
302+
}
256303

257304
//* Admin: If the logged in user is admin
258305
} else {

interface/web/sites/web_vhost_subdomain_edit.php

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,54 @@ function onShowEnd() {
164164
// add limits to template to be able to hide settings
165165
foreach($read_limits as $limit) $app->tpl->setVar($limit, $client[$limit]);
166166

167-
167+
$sites_config = $app->getconf->get_global_config('sites');
168+
if($sites_config['reseller_can_use_options']) {
169+
// Directive Snippets
170+
$php_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'php' AND active = 'y'");
171+
$php_directive_snippets_txt = '';
172+
if(is_array($php_directive_snippets) && !empty($php_directive_snippets)){
173+
foreach($php_directive_snippets as $php_directive_snippet){
174+
$php_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$php_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.$php_directive_snippet['snippet'].'</pre></a> ';
175+
}
176+
}
177+
if($php_directive_snippets_txt == '') $php_directive_snippets_txt = '------';
178+
$app->tpl->setVar("php_directive_snippets_txt",$php_directive_snippets_txt);
179+
180+
if($server_type == 'apache'){
181+
$apache_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'apache' AND active = 'y'");
182+
$apache_directive_snippets_txt = '';
183+
if(is_array($apache_directive_snippets) && !empty($apache_directive_snippets)){
184+
foreach($apache_directive_snippets as $apache_directive_snippet){
185+
$apache_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$apache_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.$apache_directive_snippet['snippet'].'</pre></a> ';
186+
}
187+
}
188+
if($apache_directive_snippets_txt == '') $apache_directive_snippets_txt = '------';
189+
$app->tpl->setVar("apache_directive_snippets_txt",$apache_directive_snippets_txt);
190+
}
191+
192+
if($server_type == 'nginx'){
193+
$nginx_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'nginx' AND active = 'y'");
194+
$nginx_directive_snippets_txt = '';
195+
if(is_array($nginx_directive_snippets) && !empty($nginx_directive_snippets)){
196+
foreach($nginx_directive_snippets as $nginx_directive_snippet){
197+
$nginx_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$nginx_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.$nginx_directive_snippet['snippet'].'</pre></a> ';
198+
}
199+
}
200+
if($nginx_directive_snippets_txt == '') $nginx_directive_snippets_txt = '------';
201+
$app->tpl->setVar("nginx_directive_snippets_txt",$nginx_directive_snippets_txt);
202+
}
203+
204+
$proxy_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'proxy' AND active = 'y'");
205+
$proxy_directive_snippets_txt = '';
206+
if(is_array($proxy_directive_snippets) && !empty($proxy_directive_snippets)){
207+
foreach($proxy_directive_snippets as $proxy_directive_snippet){
208+
$proxy_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$proxy_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.$proxy_directive_snippet['snippet'].'</pre></a> ';
209+
}
210+
}
211+
if($proxy_directive_snippets_txt == '') $proxy_directive_snippets_txt = '------';
212+
$app->tpl->setVar("proxy_directive_snippets_txt",$proxy_directive_snippets_txt);
213+
}
214+
168215
//* Admin: If the logged in user is admin
169216
} else {
170217

0 commit comments

Comments
 (0)