Skip to content

Commit cc062ab

Browse files
committed
Connected web interface with vesta.conf
1 parent 8082315 commit cc062ab

24 files changed

+55
-81
lines changed

web/add/db/index.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,17 +64,14 @@
6464

6565
// Get database manager url
6666
if (empty($_SESSION['error_msg'])) {
67-
exec (VESTA_CMD."v-list-sys-config json", $output, $return_var);
68-
$sys = json_decode(implode('', $output), true);
69-
unset($output);
7067
list($http_host, $port) = explode(':', $_SERVER["HTTP_HOST"] . ":");
7168
if ($_POST['v_host'] != 'localhost' ) $http_host = $_POST['v_host'];
7269
if ($_POST['v_type'] == 'mysql') $db_admin = "phpMyAdmin";
7370
if ($_POST['v_type'] == 'mysql') $db_admin_link = "http://".$http_host."/phpmyadmin/";
74-
if (($_POST['v_type'] == 'mysql') && (!empty($sys['config']['DB_PMA_URL']))) $db_admin_link = $sys['config']['DB_PMA_URL'];
71+
if (($_POST['v_type'] == 'mysql') && (!empty($_SESSION['DB_PMA_URL']))) $db_admin_link = $_SESSION['DB_PMA_URL'];
7572
if ($_POST['v_type'] == 'pgsql') $db_admin = "phpPgAdmin";
7673
if ($_POST['v_type'] == 'pgsql') $db_admin_link = "http://".$http_host."/phppgadmin/";
77-
if (($_POST['v_type'] == 'pgsql') && (!empty($sys['config']['DB_PGA_URL']))) $db_admin_link = $sys['config']['DB_PGA_URL'];
74+
if (($_POST['v_type'] == 'pgsql') && (!empty($_SESSION['DB_PGA_URL']))) $db_admin_link = $_SESSION['DB_PGA_URL'];
7875
}
7976

8077
// Email login credentials
@@ -109,9 +106,7 @@
109106
$v_db_email = $panel[$user]['CONTACT'];
110107

111108
// List avaiable database types
112-
exec (VESTA_CMD."v-list-database-types 'json'", $output, $return_var);
113-
$db_types = json_decode(implode('', $output), true);
114-
unset($output);
109+
$db_types = split(",",$_SESSION['DB_SYSTEM']);
115110

116111
// List available database servers
117112
$db_hosts = array();

web/add/mail/index.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,12 +144,9 @@
144144

145145
// Get webmail url
146146
if (empty($_SESSION['error_msg'])) {
147-
exec (VESTA_CMD."v-list-sys-config json", $output, $return_var);
148-
$sys = json_decode(implode('', $output), true);
149-
unset($output);
150147
list($http_host, $port) = explode(':', $_SERVER["HTTP_HOST"].":");
151148
$webmail = "http://".$http_host."/webmail/";
152-
if (!empty($sys['config']['MAIL_URL'])) $webmail = $sys['config']['MAIL_URL'];
149+
if (!empty($_SESSION['MAIL_URL'])) $webmail = $_SESSION['MAIL_URL'];
153150
}
154151

155152
// Flush field values on success

web/inc/main.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
<?php
22

3+
// Check system settiongs
4+
if ((!isset($_SESSION['VERSION'])) && (!defined('NO_AUTH_REQUIRED'))) {
5+
session_destroy();
6+
header("Location: /login/");
7+
exit;
8+
}
9+
310
// Check user session
411
if ((!isset($_SESSION['user'])) && (!defined('NO_AUTH_REQUIRED'))) {
512
$_SESSION['request_uri'] = $_SERVER['REQUEST_URI'];

web/list/db/index.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@
1111
// Panel
1212
top_panel($user,$TAB);
1313

14-
// SYS
15-
exec (VESTA_CMD."v-list-sys-config json", $output, $return_var);
16-
$sys = json_decode(implode('', $output), true);
17-
unset($output);
18-
1914
// Data
2015
exec (VESTA_CMD."v-list-databases $user json", $output, $return_var);
2116
$data = json_decode(implode('', $output), true);

web/list/mail/index.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,6 @@
1313

1414
// Data
1515
if (empty($_GET['domain'])){
16-
17-
// SYS
18-
exec (VESTA_CMD."v-list-sys-config json", $output, $return_var);
19-
$sys = json_decode(implode('', $output), true);
20-
unset($output);
21-
2216
exec (VESTA_CMD."v-list-mail-domains $user json", $output, $return_var);
2317
$data = json_decode(implode('', $output), true);
2418
$data = array_reverse($data, true);

web/login/index.php

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -26,24 +26,25 @@
2626
exit;
2727
}
2828

29+
// Check system configuration
30+
exec (VESTA_CMD . "v-list-sys-config json", $output, $return_var);
31+
$data = json_decode(implode('', $output), true);
32+
$sys_arr = $data['config'];
33+
foreach ($sys_arr as $key => $value) {
34+
$_SESSION[$key] = $value;
35+
}
36+
37+
// Set default language
38+
if (empty($_SESSION['language'])) $_SESSION['language']=$_SESSION['LANGUAGE'];
39+
if (empty($_SESSION['language'])) $_SESSION['language']='en';
40+
2941
// Auth
3042
if (isset($_POST['user']) && isset($_POST['password'])) {
3143
$v_user = escapeshellarg($_POST['user']);
3244
$v_password = escapeshellarg($_POST['password']);
3345
exec(VESTA_CMD ."v-check-user-password ".$v_user." ".$v_password." '".$_SERVER["REMOTE_ADDR"]."'", $output, $return_var);
3446
if ( $return_var > 0 ) {
3547
$ERROR = "<a class=\"error\">".__('Invalid username or password')."</a>";
36-
37-
// Set system language
38-
unset($output);
39-
exec (VESTA_CMD . "v-list-sys-config json", $output, $return_var);
40-
$data = json_decode(implode('', $output), true);
41-
if (!empty( $data['config']['LANGUAGE'])) {
42-
$_SESSION['language'] = $data['config']['LANGUAGE'];
43-
} else {
44-
$_SESSION['language'] = 'en';
45-
}
46-
4748
require_once($_SERVER['DOCUMENT_ROOT'].'/inc/i18n/'.$_SESSION['language'].'.php');
4849
require_once('../templates/header.html');
4950
require_once('../templates/login.html');
@@ -65,15 +66,6 @@
6566
}
6667
}
6768
} else {
68-
// Set system language
69-
exec (VESTA_CMD . "v-list-sys-config json", $output, $return_var);
70-
$data = json_decode(implode('', $output), true);
71-
if (!empty( $data['config']['LANGUAGE'])) {
72-
$_SESSION['language'] = $data['config']['LANGUAGE'];
73-
} else {
74-
$_SESSION['language'] = 'en';
75-
}
76-
7769
require_once($_SERVER['DOCUMENT_ROOT'].'/inc/i18n/'.$_SESSION['language'].'.php');
7870
require_once('../templates/header.html');
7971
require_once('../templates/login.html');

web/reset/index.php

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -70,27 +70,19 @@
7070
}
7171
}
7272

73+
// Set system language
74+
exec (VESTA_CMD . "v-list-sys-config json", $output, $return_var);
75+
$data = json_decode(implode('', $output), true);
76+
if (!empty( $data['config']['LANGUAGE'])) {
77+
$_SESSION['language'] = $data['config']['LANGUAGE'];
78+
} else {
79+
$_SESSION['language'] = 'en';
80+
}
7381

7482
if (empty($_GET['action'])) {
75-
// Set system language
76-
exec (VESTA_CMD . "v-list-sys-config json", $output, $return_var);
77-
$data = json_decode(implode('', $output), true);
78-
if (!empty( $data['config']['LANGUAGE'])) {
79-
$_SESSION['language'] = $data['config']['LANGUAGE'];
80-
} else {
81-
$_SESSION['language'] = 'en';
82-
}
8383
require_once '../templates/header.html';
8484
require_once '../templates/reset_1.html';
8585
} else {
86-
// Set system language
87-
exec (VESTA_CMD . "v-list-sys-config json", $output, $return_var);
88-
$data = json_decode(implode('', $output), true);
89-
if (!empty( $data['config']['LANGUAGE'])) {
90-
$_SESSION['language'] = $data['config']['LANGUAGE'];
91-
} else {
92-
$_SESSION['language'] = 'en';
93-
}
9486
require_once '../templates/header.html';
9587
if ($_GET['action'] == 'code' ) {
9688
require_once '../templates/reset_2.html';

web/templates/admin/add_cron.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
</div>
2525

2626
<form id="vstobjects" name="v_add_cron" method="post">
27-
<table class='data'>
27+
<table class="data mode-add">
2828
<tr class="data-add">
2929
<td class="data-dotted">
3030
<table class="data-col1">

web/templates/admin/add_db.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
document.v_add_db.v_password.value = randomstring;
4545
}
4646
</script>
47-
<table class='data'>
47+
<table class="data mode-add">
4848
<tr class="data-add">
4949
<td class="data-dotted">
5050
<table class="data-col1">
@@ -54,7 +54,7 @@
5454
<td class="data-dotted">
5555
<table class="data-col2" width="600px">
5656
<tr>
57-
<td class="step-top" style="color:#777;" >
57+
<td class="step-top hint" style="color:#777;" >
5858
<?php print __('Prefix will be automaticaly added to database name and database user',$user."_");?>
5959
</td>
6060
</tr>

web/templates/admin/add_dns.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
}
3636
</script>
3737

38-
<table class="data">
38+
<table class="data mode-add">
3939
<tr class="data-add">
4040
<td class="data-dotted">
4141
<table class="data-col1">

0 commit comments

Comments
 (0)