Skip to content

Commit a563d59

Browse files
author
Marius Cramer
committed
- ported some patches
1 parent 61f1f5a commit a563d59

File tree

16 files changed

+88
-13
lines changed

16 files changed

+88
-13
lines changed

interface/lib/classes/auth.inc.php

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,32 @@ public function remove_group_from_user($userid, $groupid) {
129129

130130
public function check_module_permissions($module) {
131131
// Check if the current user has the permissions to access this module
132+
$module = trim(preg_replace('@\s+@', '', $module));
132133
$user_modules = explode(',',$_SESSION["s"]["user"]["modules"]);
133-
if(!in_array($module,$user_modules)) {
134-
// echo "LOGIN_REDIRECT:/index.php";
135-
header("Location: /index.php");
136-
exit;
134+
if(strpos($module, ',') !== false){
135+
$can_use_module = false;
136+
$tmp_modules = explode(',', $module);
137+
if(is_array($tmp_modules) && !empty($tmp_modules)){
138+
foreach($tmp_modules as $tmp_module){
139+
if($tmp_module != ''){
140+
if(in_array($tmp_module,$user_modules)) {
141+
$can_use_module = true;
142+
break;
143+
}
144+
}
145+
}
146+
}
147+
if(!$can_use_module){
148+
// echo "LOGIN_REDIRECT:/index.php";
149+
header("Location: /index.php");
150+
exit;
151+
}
152+
} else {
153+
if(!in_array($module,$user_modules)) {
154+
// echo "LOGIN_REDIRECT:/index.php";
155+
header("Location: /index.php");
156+
exit;
157+
}
137158
}
138159
}
139160

interface/web/admin/lib/module.conf.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
$module['template'] = 'module.tpl.htm';
88
$module['startpage'] = 'admin/server_list.php';
99
$module['tab_width'] = '60';
10+
$module['order'] = '90';
1011

1112

1213
$items[] = array( 'title' => 'CP Users',

interface/web/admin/system_config_edit.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ function onShowEnd() {
8989
$available_dashlets_txt = '';
9090
$handle = @opendir(ISPC_WEB_PATH.'/dashboard/dashlets');
9191
while ($file = @readdir($handle)) {
92-
if ($file != '.' && $file != '..' && !is_dir($file)) {
92+
if ($file != '.' && $file != '..' && !is_dir(ISPC_WEB_PATH.'/dashboard/dashlets/'.$file)) {
9393
$available_dashlets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.substr($file, 0, -4).']<pre class="addPlaceholderContent" style="display:none;">['.substr($file, 0, -4).'],</pre></a> ';
9494
}
9595
}

interface/web/admin/templates/server_list.htm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,13 @@ <h1><tmpl_var name="list_head_txt"></h1>
5151
</tmpl_loop>
5252
<tmpl_unless name="records">
5353
<tr class="tbl_row_noresults tbl_row_<tmpl_if name='__EVEN__'}even<tmpl_else>uneven</tmpl_if>">
54-
<td colspan="8">{tmpl_var name='globalsearch_noresults_text_txt'}</td>
54+
<td colspan="7">{tmpl_var name='globalsearch_noresults_text_txt'}</td>
5555
</tr>
5656
</tmpl_unless>
5757
</tbody>
5858
<tfoot>
5959
<tr>
60-
<td colspan="8"><tmpl_var name="paging"></td>
60+
<td colspan="7"><tmpl_var name="paging"></td>
6161
</tr>
6262
</tfoot>
6363
</table>

interface/web/client/lib/module.conf.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
$module["template"] = "module.tpl.htm";
66
$module["startpage"] = "client/client_list.php";
77
$module["tab_width"] = '';
8+
$module['order'] = '20';
89

910

1011
$items[] = array( 'title' => "Edit Client",

interface/web/dashboard/dashboard.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@
146146
$dashlet_list = array();
147147
$handle = @opendir(ISPC_WEB_PATH.'/dashboard/dashlets');
148148
while ($file = @readdir($handle)) {
149-
if ($file != '.' && $file != '..' && !is_dir($file)) {
149+
if ($file != '.' && $file != '..' && !is_dir(ISPC_WEB_PATH.'/dashboard/dashlets/'.$file)) {
150150
$dashlet_name = substr($file, 0, -4);
151151
$dashlet_class = 'dashlet_'.$dashlet_name;
152152
include_once ISPC_WEB_PATH.'/dashboard/dashlets/'.$file;

interface/web/dashboard/dashlets/modules.php

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,32 @@ function show() {
2828
include_once '../' . $mt.'/lib/module.conf.php';
2929
/* We don't want to show the dashboard */
3030
if ($mt != 'dashboard') {
31+
if($mt == 'dns'){
32+
$dns_servers = $app->db->queryOneRecord("SELECT COUNT(*) as cnt FROM server WHERE dns_server = 1 AND active = 1");
33+
if($dns_servers['cnt'] == 0) continue;
34+
}
35+
if($mt == 'mail'){
36+
$mail_servers = $app->db->queryOneRecord("SELECT COUNT(*) as cnt FROM server WHERE mail_server = 1 AND active = 1");
37+
if($mail_servers['cnt'] == 0) continue;
38+
}
39+
if($mt == 'sites'){
40+
$web_servers = $app->db->queryOneRecord("SELECT COUNT(*) as cnt FROM server WHERE web_server = 1 AND active = 1");
41+
if($web_servers['cnt'] == 0) continue;
42+
}
43+
3144
$module_title = $app->lng($module['title']);
3245
if(function_exists('mb_strlen')) {
3346
if(mb_strlen($module_title, "UTF-8") > 8) $module_title = mb_substr($module_title, 0, 7, "UTF-8").'..';
3447
} else {
3548
if(strlen($module_title) > 8) $module_title = substr($module_title, 0, 7).'..';
3649
}
37-
$mod[] = array( 'modules_title' => $module_title,
50+
$mod[$module['order']] = array( 'modules_title' => $module_title,
3851
'modules_startpage' => $module['startpage'],
3952
'modules_name' => $module['name']);
4053
}
4154
}
4255
}
43-
56+
ksort($mod);
4457
$tpl->setloop('modules', $mod);
4558
}
4659

interface/web/dashboard/lib/custom_menu.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
$rows[] = array('title' => $item->get_title(),
7272
'link' => $item->get_link(),
7373
'content' => $item->get_content(),
74-
'date' => $item->get_date('Y-m-d')
74+
'date' => $item->get_date($app->lng('conf_format_dateshort'))
7575
);
7676
}
7777
$n++;

interface/web/dashboard/lib/module.conf.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
$module['template'] = 'dashboard.tpl.htm';
3333
$module['startpage'] = 'dashboard/dashboard.php';
3434
$module['tab_width'] = '';
35+
$module['order'] = '1';
3536

3637
//$items = array();
3738
//

interface/web/dns/lib/module.conf.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
$module["template"] = "module.tpl.htm";
66
$module["startpage"] = "dns/dns_soa_list.php";
77
$module["tab_width"] = '';
8+
$module['order'] = '50';
89

910

1011
$items[] = array( 'title' => "Add DNS Zone",

0 commit comments

Comments
 (0)