Skip to content

Commit cbb8c59

Browse files
committed
Server management
1 parent 7535a1b commit cbb8c59

File tree

2 files changed

+238
-12
lines changed

2 files changed

+238
-12
lines changed

web/edit/server/index.php

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,24 @@
4545
$dns_cluster = json_decode(implode('', $output), true);
4646
unset($output);
4747
foreach ($dns_cluster as $key => $value) {
48-
$v_dns_cluster='yes';
48+
$v_dns_cluster = 'yes';
4949
}
5050

51+
// List MySQL hosts
52+
exec (VESTA_CMD."v-list-database-hosts mysql json", $output, $return_var);
53+
$v_mysql_hosts = json_decode(implode('', $output), true);
54+
unset($output);
55+
foreach ($v_mysql_hosts as $key => $value) {
56+
$v_mysql = 'yes';
57+
}
58+
59+
// List PostgreSQL hosts
60+
exec (VESTA_CMD."v-list-database-hosts pgsql json", $output, $return_var);
61+
$v_pgsql_hosts = json_decode(implode('', $output), true);
62+
unset($output);
63+
foreach ($v_pgsql_hosts as $key => $value) {
64+
$v_psql = 'yes';
65+
}
5166

5267
// List backup settings
5368
$v_backup_dir = "/backup";
@@ -142,6 +157,46 @@
142157
}
143158
}
144159

160+
// Update mysql pasword
161+
if (empty($_SESSION['error_msg'])) {
162+
if (!empty($_POST['v_mysql_password'])) {
163+
exec (VESTA_CMD."v-change-database-host-password mysql localhost root '".escapeshellarg($_POST['v_mysql_password'])."'", $output, $return_var);
164+
check_return_code($return_var,$output);
165+
unset($output);
166+
$v_db_adv = 'yes';
167+
}
168+
}
169+
170+
171+
// Update webmail url
172+
if (empty($_SESSION['error_msg'])) {
173+
if ($_POST['v_mail_url'] != $_SESSION['MAIL_URL']) {
174+
exec (VESTA_CMD."v-change-sys-config-value MAIL_URL '".escapeshellarg($_POST['v_mail_url'])."'", $output, $return_var);
175+
check_return_code($return_var,$output);
176+
unset($output);
177+
$v_mail_adv = 'yes';
178+
}
179+
}
180+
181+
// Update phpMyAdmin url
182+
if (empty($_SESSION['error_msg'])) {
183+
if ($_POST['v_mysql_url'] != $_SESSION['DB_PMA_URL']) {
184+
exec (VESTA_CMD."v-change-sys-config-value DB_PMA_URL '".escapeshellarg($_POST['v_mysql_url'])."'", $output, $return_var);
185+
check_return_code($return_var,$output);
186+
unset($output);
187+
$v_db_adv = 'yes';
188+
}
189+
}
190+
191+
// Update phpPgAdmin url
192+
if (empty($_SESSION['error_msg'])) {
193+
if ($_POST['v_psql_url'] != $_SESSION['DB_PGA_URL']) {
194+
exec (VESTA_CMD."v-change-sys-config-value DB_PGA_URL '".escapeshellarg($_POST['v_pgsql_url'])."'", $output, $return_var);
195+
check_return_code($return_var,$output);
196+
unset($output);
197+
$v_db_adv = 'yes';
198+
}
199+
}
145200

146201
// Disable local backup
147202
if (empty($_SESSION['error_msg'])) {

web/templates/admin/edit_server.html

Lines changed: 182 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,18 @@
171171
<br><br>
172172
</td>
173173
</tr>
174+
<tr>
175+
<td class="vst-text">
176+
<?php print __('Backend Pool Mode') ?>
177+
</td>
178+
</tr>
179+
<tr>
180+
<td>
181+
<input type="text" size="20" class="vst-input" name="v_web_backend_pool" value="<?php echo $_SESSION['WEB_BACKEND_POOL']; ?>" disabled>
182+
<br><br>
183+
</td>
184+
</tr>
185+
174186
<?php } ?>
175187
</table>
176188
</td>
@@ -206,16 +218,30 @@
206218
</tr>
207219
<tr>
208220
<td>
209-
<?php if ($v_dns_cluster != 'yes') {?>
210221
<select class="vst-list" name="v_dns_cluster" disabled>
211222
<option value='no'><?php print __('no'); ?></option>
223+
<option value='yes' <?php if($v_dns_cluster == 'yes') echo 'selected' ?> ><?php print __('yes'); ?></option>
212224
</select>
213-
<?php } else { ?>
214-
<textarea size="20" class="vst-textinput" name="v_dns_cluster"><?php foreach ($dns_cluster as $key => $value) echo $key . "\n"; ?></textarea>
215-
<?php } ?>
225+
<br><br><br>
226+
</td>
227+
</tr>
228+
<?php if ($v_dns_cluster = 'yes') {
229+
$i = 0;
230+
foreach ($dns_cluster as $key => $value) {
231+
$i++;
232+
?>
233+
<tr>
234+
<td class="vst-text step-left">
235+
<?php print __('Host'). ' #'.$i ?>
236+
</td>
237+
</tr>
238+
<tr>
239+
<td class="step-left">
240+
<input type="text" size="20" class="vst-input" name="v_dns_remote_host" value="<?php echo $key; ?>" disabled>
216241
<br><br>
217242
</td>
218243
</tr>
244+
<?php }} ?>
219245
</table>
220246
</td>
221247
</tr>
@@ -269,9 +295,14 @@
269295
</tr>
270296
<?php } ?>
271297
<tr>
272-
<td class="vst-text input-label">
273-
<?php print __('NONE');?>
274-
<br><br><br>
298+
<td class="vst-text">
299+
<?php print __('Webmail URL') ?>
300+
</td>
301+
</tr>
302+
<tr>
303+
<td>
304+
<input type="text" size="20" class="vst-input" name="v_mail_url" value="<?php echo $_SESSION['MAIL_URL']; ?>">
305+
<br><br>
275306
</td>
276307
</tr>
277308
</table>
@@ -289,13 +320,153 @@
289320
</tr>
290321
<tr>
291322
<td class="vst-text input-label step-left">
292-
<table style="display:<?php if (empty($v_adv)) echo 'none';?> ;" id="db">
323+
<table style="display:<?php if (empty($v_db_adv)) echo 'none';?> ;" id="db">
293324
<tr>
294325
<td class="vst-text input-label">
295-
<?php print __('NONE');?>
296-
<br><br><br>
326+
<?php print __('MySQL Support');?>
327+
</td>
328+
</tr>
329+
<tr>
330+
<td>
331+
<select class="vst-list" name="v_mysql" disabled>
332+
<option value='no'><?php print __('no'); ?></option>
333+
<option value='yes' <?php if($v_mysql == 'yes') echo 'selected' ?> ><?php print __('yes'); ?></option>
334+
</select>
335+
<br><br>
336+
</td>
337+
</tr>
338+
<?php if ($v_mysql == 'yes') { ?>
339+
<tr>
340+
<td class="vst-text">
341+
<?php print __('phpMyAdmin URL') ?>
342+
</td>
343+
</tr>
344+
<tr>
345+
<td>
346+
<input type="text" size="20" class="vst-input" name="v_mysql_url" value="<?php echo $_SESSION['DB_PMA_URL']; ?>">
347+
<br><br>
348+
</td>
349+
</tr>
350+
<?php } ?>
351+
<?php if ($v_mysql == 'yes') {
352+
$i = 0;
353+
foreach ($v_mysql_hosts as $key => $value) {
354+
$i++;
355+
?>
356+
<tr>
357+
<td class="vst-text step-left">
358+
<?php print __('Host'). ' #'.$i ?>
359+
</td>
360+
</tr>
361+
<tr>
362+
<td class="step-left">
363+
<input type="text" size="20" class="vst-input" name="v_mysql_host" value="<?php echo $key; ?>" disabled>
364+
<br><br>
365+
</td>
366+
</tr>
367+
<tr>
368+
<td class="vst-text step-left">
369+
<?php print __('Password') ?>
370+
</td>
371+
</tr>
372+
<tr>
373+
<td class="step-left">
374+
<input type="text" size="20" class="vst-input" name="v_mysql_password" value="">
375+
<br><br>
376+
</td>
377+
</tr>
378+
379+
<tr>
380+
<td class="vst-text step-left">
381+
<?php print __('Maximum Number Of Databases') ?>
382+
</td>
383+
</tr>
384+
<tr>
385+
<td class="step-left">
386+
<input type="text" size="20" class="vst-input" name="v_mysql_max" value="<?php echo $value['MAX_DB']; ?>" disabled>
387+
<br><br>
388+
</td>
389+
</tr>
390+
<tr>
391+
<td class="vst-text step-left">
392+
<?php print __('Current Number Of Databases') ?>
393+
</td>
394+
</tr>
395+
<tr>
396+
<td class="step-left">
397+
<input type="text" size="20" class="vst-input" name="v_mysql_max" value="<?php echo $value['U_DB_BASES']; ?>" disabled>
398+
<br><br><br><br>
399+
</td>
400+
</tr>
401+
<?php }} ?>
402+
403+
404+
<tr>
405+
<td class="vst-text input-label">
406+
<?php print __('PostgreSQL Support');?>
407+
</td>
408+
</tr>
409+
<tr>
410+
<td>
411+
<select class="vst-list" name="v_pgsql" disabled>
412+
<option value='no'><?php print __('no'); ?></option>
413+
<option value='yes' <?php if($v_pgsql == 'yes') echo 'selected' ?> ><?php print __('yes'); ?></option>
414+
</select>
415+
<br><br>
416+
</td>
417+
</tr>
418+
<?php if ($v_pgsql == 'yes') { ?>
419+
<tr>
420+
<td class="vst-text">
421+
<?php print __('phpPgAdmin URL') ?>
422+
</td>
423+
</tr>
424+
<tr>
425+
<td>
426+
<input type="text" size="20" class="vst-input" name="v_pgsql_url" value="<?php echo $_SESSION['DB_PGA_URL']; ?>">
427+
<br><br>
428+
</td>
429+
</tr>
430+
<?php } ?>
431+
<?php if ($v_pgsql == 'yes') {
432+
$i = 0;
433+
foreach ($v_pgsql_hosts as $key => $value) {
434+
$i++;
435+
?>
436+
<tr>
437+
<td class="vst-text step-left">
438+
<?php print __('Host'). ' #'.$i ?>
439+
</td>
440+
</tr>
441+
<tr>
442+
<td class="step-left">
443+
<input type="text" size="20" class="vst-input" name="v_pgsql_host" value="<?php echo $key; ?>" disabled>
444+
<br><br>
445+
</td>
446+
</tr>
447+
<tr>
448+
<td class="vst-text step-left">
449+
<?php print __('Maximum Number Of Databases') ?>
450+
</td>
451+
</tr>
452+
<tr>
453+
<td class="step-left">
454+
<input type="text" size="20" class="vst-input" name="v_psql_max" value="<?php echo $value['MAX_DB']; ?>" disabled>
455+
<br><br>
456+
</td>
457+
</tr>
458+
<tr>
459+
<td class="vst-text step-left">
460+
<?php print __('Current Number Of Databases') ?>
461+
</td>
462+
</tr>
463+
<tr>
464+
<td class="step-left">
465+
<input type="text" size="20" class="vst-input" name="v_pgsql_max" value="<?php echo $value['U_DB_BASES']; ?>" disabled>
466+
<br><br><br><br>
297467
</td>
298468
</tr>
469+
<?php }} ?>
299470
</table>
300471
</td>
301472
</tr>
@@ -433,7 +604,7 @@
433604
<tr>
434605
<td class="vst-text input-label step-top">
435606
<a href="javascript:elementHideShow('vesta');" class="vst-text">
436-
<b><?php print __('Vesta Control Panel Plugins');?> <img src="/images/arrow.png"></b>
607+
<b><?php print __('Vesta Control Panel Plugins');?> <span style="color:#ff6701;font-size:10px; padding:0 10px;">preview</span><img src="/images/arrow.png"></b>
437608
</a>
438609
</td>
439610
</tr>

0 commit comments

Comments
 (0)