myvesta/web/templates/scripts.html

233 lines
5.8 KiB
HTML

<div class="io-log">
<h2 class="io-log-h2" id="iologbutton">
<?php
if ($CURRENT_USER_FINAL=='admin') echo __('Server');
else echo __('Account');
?>
</h2>
<div>
<?php
if ($CURRENT_USER_FINAL=='admin') {
$sysload=sys_getloadavg();
$sysload[0]=number_format((float)$sysload[0], 2, '.', '');
$sysload[1]=number_format((float)$sysload[1], 2, '.', '');
$sysload[2]=number_format((float)$sysload[2], 2, '.', '');
?>
<div>
<div>
<div>
</div>
<div>
<div>
</div>
</div>
</div>
<div>
<div>
<?=__('CPU')?>
</div>
<div>
</div>
</div>
<div>
<div>
<?=$sysload[0]?>&nbsp;&nbsp;&nbsp;&nbsp;<?=$sysload[1]?>&nbsp;&nbsp;&nbsp;&nbsp;<?=$sysload[2]?>
</div>
</div>
</div>
<?php
} else {
?>
<div>
<div>
<div>
</div>
<div>
<div>
</div>
</div>
</div>
<div>
<div>
<?=__('Disk')?>
</div>
<div>
</div>
</div>
<div>
<div>
<?php
$output='';
exec (VESTA_CMD . "v-list-user ".$CURRENT_USER_FINAL." json", $output, $return_var);
$data = json_decode(implode('', $output), true);
$data = array_reverse($data,true);
//print_r($data); exit;
$key=$CURRENT_USER_FINAL;
if ($data[$key]['DISK_QUOTA']=='unlimited') echo __('unlimited');
else echo get_percentage($data[$key]['U_DISK'],$data[$key]['DISK_QUOTA']).' %';
?>
</div>
</div>
</div>
<?php
}
if ($CURRENT_USER_FINAL=='admin') {
$output='';
exec ("df -h | grep '^/dev'", $output, $return_var);
foreach($output as $line) {
while(strpos($line, ' ')!==false) $line=str_replace(' ', ' ', $line);
$disk_arr=explode(' ', $line);
$percent=$disk_arr[4];
$disk=$disk_arr[5];
if (strpos($disk, "/boot")!==false) continue;
if (strpos($disk, "/efi")!==false) continue;
?>
<div>
<div>
<div>
</div>
<div>
<div>
</div>
</div>
</div>
<div>
<div>
<?=__('Disk').' '.$disk?>
</div>
<div>
</div>
</div>
<div>
<div>
<?=$percent?>
</div>
</div>
</div>
<?php }
}
?>
</div>
</div>
<div class="io-log2">
<h2 class="io-log2-h2" id="iologbutton2">
<?=__('Log')?>
</h2>
<div>
<?php
$output='';
exec (VESTA_CMD."v-list-user-log ".$CURRENT_USER_FINAL." json 25", $output, $return_var);
check_error($return_var);
$data = json_decode(implode('', $output), true);
foreach ($data as $key => $value) {
++$i;
?>
<div>
<div>
<div>
</div>
<div>
<div>
</div>
</div>
</div>
<div>
<div>
<?=translate_date($data[$key]['DATE'])?>
</div>
<div>
<?=$data[$key]['TIME']?>
</div>
</div>
<div>
<div>
<?=htmlspecialchars($data[$key]['CMD'], ENT_QUOTES)?>
</div>
</div>
</div>
<?php } ?>
</div>
<script type="text/javascript" src="/js/jquery-1.7.2.min.js?<?=JS_LATEST_UPDATE?>"></script>
<script type="text/javascript" src="/js/jquery.cookie.js?<?=JS_LATEST_UPDATE?>"></script>
<script type="text/javascript" src="/js/jquery-ui-1.8.20.custom.min.js?<?=JS_LATEST_UPDATE?>"></script>
<script type="text/javascript" src="/js/hotkeys.js?<?=JS_LATEST_UPDATE?>"></script>
<script type="text/javascript" src="/js/events.js?<?=JS_LATEST_UPDATE?>"></script>
<script type="text/javascript" src="/js/app.js?<?=JS_LATEST_UPDATE?>"></script>
<script type="text/javascript" src="/js/init.js?<?=JS_LATEST_UPDATE?>"></script>
<script type="text/javascript" src="/js/i18n.js.php?<?=JS_LATEST_UPDATE?>"></script>
<script type="text/javascript" src="/js/templates.js?<?=JS_LATEST_UPDATE?>"></script>
<script type="text/javascript" src="/js/jquery.finder.js?<?=JS_LATEST_UPDATE?>"></script>
<script type="text/javascript" src="/js/fix.js"></script>
<script>
hover_menu = function() {}
$(function() {
hover_menu();
$( ".l-separator" ).remove();
$( ".io-log div" ).removeClass();
});
</script>
<?php
// Dialogs
// todo: display all the dialogs?
if (!empty($_SESSION['look_alert'])):
?>
<script>
$(function() {
$('#dialog:ui-dialog').dialog('destroy');
$('#dialog-message').dialog({
modal: true,
buttons: {
Ok: function() {
$(this).dialog('close');
}
}
});
});
</script>
<div id="dialog-message" title="<?=__('Welcome')?>">
<p class="confirmation"><?=__('LOGGED_IN_AS', $_SESSION['look'])?></p>
</div>
<?php
unset($_SESSION['look_alert']);
elseif (!empty($_SESSION['error_msg'])):
?>
<div>
<script>
$(function() {
$('#dialog:ui-dialog').dialog('destroy');
$('#dialog-message').dialog({
modal: true,
buttons: {
Ok: function() {
$(this).dialog('close');
}
},
create: function() {
$(this)
.closest('.ui-dialog')
.find('.ui-button:first')
.addClass('submit');
}
});
});
</script>
<div id="dialog-message" title="">
<p><?=htmlentities($_SESSION['error_msg'])?></p>
</div>
</div>
<?php
unset($_SESSION['error_msg']);
endif;
?>