Skip to content

Commit 427b254

Browse files
committed
refactoring user section: new html formating
1 parent 89b9db5 commit 427b254

22 files changed

+1824
-1442
lines changed

bin/v_list_sys_users

Lines changed: 0 additions & 64 deletions
This file was deleted.

web/add/ip/index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
$interfaces = json_decode(implode('', $output), true);
7575
unset($output);
7676

77-
exec (VESTA_CMD."v_list_sys_users 'json'", $output, $return_var);
77+
exec (VESTA_CMD."v_list_users 'json'", $output, $return_var);
7878
$users = json_decode(implode('', $output), true);
7979
unset($output);
8080

web/add/user/index.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@
8787
$data = json_decode(implode('', $output), true);
8888
unset($output);
8989

90-
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/menu_add_user.html');
9190
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_user.html');
9291
unset($_SESSION['error_msg']);
9392
unset($_SESSION['ok_msg']);

web/css/csshover3.htc

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
<public:attach event="ondocumentready" onevent="CSSHover()" />
22
<script>
33
/**
4-
* Whatever:hover - V3.11
5-
* http://www.xs4all.nl/~peterned/
6-
*
7-
* Copyright (c) 2009 Peter Nederlof
8-
* Licensed under the LGPL license
9-
* http://creativecommons.org/licenses/LGPL/2.1
4+
* Whatever:hover - V3.00.081222
5+
* --------------------------------------------------------
6+
* Author - Peter Nederlof, http://www.xs4all.nl/~peterned
7+
* License - http://creativecommons.org/licenses/LGPL/2.1
8+
* Packed - http://dean.edwards.name/packer
9+
*
10+
* howto: body { behavior:url("csshover3.htc"); }
1011
*/
11-
window.CSSHover=(function(){var m=/(^|\s)((([^a]([^ ]+)?)|(a([^#.][^ ]+)+)):(hover|active|focus))/i;var n=/(.*?)\:(hover|active|focus)/i;var o=/[^:]+:([a-z\-]+).*/i;var p=/(\.([a-z0-9_\-]+):[a-z]+)|(:[a-z]+)/gi;var q=/\.([a-z0-9_\-]*on(hover|active|focus))/i;var s=/msie (5|6|7)/i;var t=/backcompat/i;var u={index:0,list:['text-kashida','text-kashida-space','text-justify'],get:function(){return this.list[(this.index++)%this.list.length]}};var v=function(c){return c.replace(/-(.)/mg,function(a,b){return b.toUpperCase()})};var w={elements:[],callbacks:{},init:function(){if(!s.test(navigator.userAgent)&&!t.test(window.document.compatMode)){return}var a=window.document.styleSheets,l=a.length;for(var i=0;i<l;i++){this.parseStylesheet(a[i])}},parseStylesheet:function(a){if(a.imports){try{var b=a.imports;var l=b.length;for(var i=0;i<l;i++){this.parseStylesheet(a.imports[i])}}catch(securityException){}}try{var c=a.rules;var r=c.length;for(var j=0;j<r;j++){this.parseCSSRule(c[j],a)}}catch(someException){}},parseCSSRule:function(a,b){var c=a.selectorText;if(m.test(c)){var d=a.style.cssText;var e=n.exec(c)[1];var f=c.replace(o,'on$1');var g=c.replace(p,'.$2'+f);var h=q.exec(g)[1];var i=e+h;if(!this.callbacks[i]){var j=u.get();var k=v(j);b.addRule(e,j+':expression(CSSHover(this, "'+f+'", "'+h+'", "'+k+'"))');this.callbacks[i]=true}b.addRule(g,d)}},patch:function(a,b,c,d){try{var f=a.parentNode.currentStyle[d];a.style[d]=f}catch(e){a.runtimeStyle[d]=''}if(!a.csshover){a.csshover=[]}if(!a.csshover[c]){a.csshover[c]=true;var g=new CSSHoverElement(a,b,c);this.elements.push(g)}return b},unload:function(){try{var l=this.elements.length;for(var i=0;i<l;i++){this.elements[i].unload()}this.elements=[];this.callbacks={}}catch(e){}}};var x={onhover:{activator:'onmouseenter',deactivator:'onmouseleave'},onactive:{activator:'onmousedown',deactivator:'onmouseup'},onfocus:{activator:'onfocus',deactivator:'onblur'}};function CSSHoverElement(a,b,c){this.node=a;this.type=b;var d=new RegExp('(^|\\s)'+c+'(\\s|$)','g');this.activator=function(){a.className+=' '+c};this.deactivator=function(){a.className=a.className.replace(d,' ')};a.attachEvent(x[b].activator,this.activator);a.attachEvent(x[b].deactivator,this.deactivator)}CSSHoverElement.prototype={unload:function(){this.node.detachEvent(x[this.type].activator,this.activator);this.node.detachEvent(x[this.type].deactivator,this.deactivator);this.activator=null;this.deactivator=null;this.node=null;this.type=null}};window.attachEvent('onbeforeunload',function(){w.unload()});return function(a,b,c,d){if(a){return w.patch(a,b,c,d)}else{w.init()}}})();
12+
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('r.R=(8(){4 f=/(^|\\s)((([^a]([^ ]+)?)|(a([^#.][^ ]+)+)):(C|D|E))/i,S=/(.*?)\\:(C|D|E)/i,T=/[^:]+:([a-z-]+).*/i,U=/(\\.([a-V-W-]+):[a-z]+)|(:[a-z]+)/1c,X=/\\.([a-V-W-]*Y(C|D|E))/i,Z=/1d (5|6|7)/i,10=/1e/i;4 g=\'1f-\';4 h={p:[],t:{},11:8(){n(!Z.F(1g.1h)&&!10.F(r.12.1i))u;4 a=r.12.1j,l=a.v;w(4 i=0;i<l;i++){3.G(a[i])}},G:8(a){n(a.H){I{4 b=a.H,l=b.v;w(4 i=0;i<l;i++){3.G(a.H[i])}}J(13){}}I{4 c=a.1k,l=c.v;w(4 j=0;j<l;j++){3.14(c[j],a)}}J(13){}},14:8(a,b){4 c=a.1l;n(f.F(c)){4 d=a.K.1m,L=S.15(c)[1],M=c.N(T,\'Y$1\'),O=c.N(U,\'.$2\'+M),o=X.15(O)[1];4 e=L+o;n(!3.t[e]){b.16(L,g+o+\':1n(R(3, "\'+M+\'", "\'+o+\'"))\');3.t[e]=17}b.16(O,d)}},18:8(a,b,c){4 d=g+c;n(a.K[d]){a.K[d]=q}n(!a.x)a.x=[];n(!a.x[c]){a.x[c]=17;4 e=19 P(a,b,c);3.p.1o(e)}u b},y:8(){I{4 l=3.p.v;w(4 i=0;i<l;i++){3.p[i].y()}3.p=[];3.t={}}J(e){}}};r.Q(\'1p\',8(){h.y()});4 k={1q:{9:\'1r\',m:\'1s\'},1t:{9:\'1u\',m:\'1v\'},1a:{9:\'1a\',m:\'1w\'}};8 P(a,b,c){3.A=a;3.B=b;4 d=19 1x(\'(^|\\\\s)\'+c+\'(\\\\s|$)\',\'g\');3.9=8(){a.o+=\' \'+c};3.m=8(){a.o=a.o.N(d,\' \')};a.Q(k[b].9,3.9);a.Q(k[b].m,3.m)}P.1y={y:8(){3.A.1b(k[3.B].9,3.9);3.A.1b(k[3.B].m,3.m);3.9=q;3.m=q;3.A=q;3.B=q}};u 8(a,b,c){n(a){u h.18(a,b,c)}1z{h.11()}}})();',62,98,'|||this|var||||function|activator|||||||||||||deactivator|if|className|elements|null|window||callbacks|return|length|for|csshover|unload||node|type|hover|active|focus|test|parseStylesheet|imports|try|catch|style|affected|pseudo|replace|newSelect|CSSHoverElement|attachEvent|CSSHover|REG_AFFECTED|REG_PSEUDO|REG_SELECT|z0|9_|REG_CLASS|on|REG_MSIE|REG_COMPAT|init|document|securityException|parseCSSRule|exec|addRule|true|patch|new|onfocus|detachEvent|gi|msie|backcompat|csh|navigator|userAgent|compatMode|styleSheets|rules|selectorText|cssText|expression|push|onbeforeunload|onhover|onmouseenter|onmouseleave|onactive|onmousedown|onmouseup|onblur|RegExp|prototype|else'.split('|'),0,{}));
13+
1214
</script>

web/edit/ip/index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
$v_status = 'active';
4949
}
5050

51-
exec (VESTA_CMD."v_list_sys_users 'json'", $output, $return_var);
51+
exec (VESTA_CMD."v_list_users 'json'", $output, $return_var);
5252
$users = json_decode(implode('', $output), true);
5353
unset($output);
5454

web/edit/user/index.php

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,6 @@
168168
$_SESSION['ok_msg'] = "OK: changes has been saved.";
169169
}
170170
}
171-
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/menu_edit_user.html');
172171
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/edit_user.html');
173172
unset($_SESSION['error_msg']);
174173
unset($_SESSION['ok_msg']);
@@ -240,19 +239,6 @@
240239
unset($output);
241240
}
242241

243-
// Change Name
244-
if (($v_fname != $_POST['v_fname']) || ($v_lname != $_POST['v_lname']) && (empty($_SESSION['error_msg']))) {
245-
$v_fname = escapeshellarg($_POST['v_fname']);
246-
$v_lname = escapeshellarg($_POST['v_lname']);
247-
exec (VESTA_CMD."v_change_user_name ".$v_username." ".$v_fname." ".$v_lname, $output, $return_var);
248-
if ($return_var != 0) {
249-
$error = implode('<br>', $output);
250-
if (empty($error)) $error = 'Error: vesta did not return any output.';
251-
$_SESSION['error_msg'] = $error;
252-
}
253-
unset($output);
254-
}
255-
256242
// Change NameServers
257243
if (($v_ns1 != $_POST['v_ns1']) || ($v_ns2 != $_POST['v_ns2']) || ($v_ns3 != $_POST['v_ns3']) || ($v_ns4 != $_POST['v_ns4']) && (empty($_SESSION['error_msg']))) {
258244
$v_ns1 = escapeshellarg($_POST['v_ns1']);
@@ -275,7 +261,6 @@
275261
$_SESSION['ok_msg'] = "OK: changes has been saved.";
276262
}
277263
}
278-
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/menu_edit_user.html');
279264
include($_SERVER['DOCUMENT_ROOT'].'/templates/user/edit_user.html');
280265
unset($_SESSION['error_msg']);
281266
unset($_SESSION['ok_msg']);

web/inc/main.php

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,17 +62,17 @@ function humanize_usage($usage) {
6262
if ( $usage > 1000 ) {
6363
$usage = $usage / 1000 ;
6464
$usage = number_format($usage, 2);
65-
$usage = $usage." Pb";
65+
$usage = $usage." pb";
6666
} else {
6767
$usage = number_format($usage, 2);
68-
$usage = $usage." Tb";
68+
$usage = $usage." tb";
6969
}
7070
} else {
7171
$usage = number_format($usage, 2);
72-
$usage = $usage." Gb";
72+
$usage = $usage." gb";
7373
}
7474
} else {
75-
$usage = $usage." Mb";
75+
$usage = $usage." mb";
7676
}
7777
return $usage;
7878
}
@@ -114,4 +114,27 @@ function send_email($to,$subject,$mailtext,$from) {
114114
mail($to, $subject, $message, $header);
115115
}
116116

117+
function display_error_block() {
118+
if (!empty($_SESSION['error_msg'])) {
119+
echo '
120+
<script type="text/javascript">
121+
$(function() {
122+
$( "#dialog:ui-dialog" ).dialog( "destroy" );
123+
$( "#dialog-message" ).dialog({
124+
modal: true,
125+
buttons: {
126+
Ok: function() {
127+
$( this ).dialog( "close" );
128+
}
129+
}
130+
});
131+
});
132+
</script>
133+
<div id="dialog-message" title="Error">
134+
<p>';
135+
echo $_SESSION['error_msg'];
136+
echo "</p>\n </div>\n";
137+
unset($_SESSION['error_msg']);
138+
}
139+
}
117140
?>

web/list/user/index.php

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
<?php
2+
23
// Init
34
error_reporting(NULL);
45
session_start();
56
$TAB = 'USER';
7+
8+
// Inlcude functions
69
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
710

811
// Header
@@ -13,30 +16,20 @@
1316

1417
// Data
1518
if ($_SESSION['user'] == 'admin') {
16-
17-
if ($user == 'admin') {
18-
exec (VESTA_CMD."v_list_users json", $output, $return_var);
19-
} else {
20-
exec (VESTA_CMD."v_list_user ".$user." json", $output, $return_var);
21-
}
22-
check_error($return_var);
19+
$cmd = "v_list_user '".$user."' json";
20+
if ($user == 'admin') $cmd = "v_list_users json";
21+
exec (VESTA_CMD.$cmd, $output, $return_var);
2322
$data = json_decode(implode('', $output), true);
2423
$data = array_reverse($data);
25-
unset($output);
26-
27-
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/menu_user.html');
24+
display_error_block;
2825
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/list_user.html');
2926
} else {
3027
exec (VESTA_CMD."v_list_user ".$user." json", $output, $return_var);
31-
check_error($return_var);
3228
$data = json_decode(implode('', $output), true);
3329
$data = array_reverse($data);
34-
unset($output);
35-
36-
include($_SERVER['DOCUMENT_ROOT'].'/templates/user/menu_user.html');
30+
display_error_block;
3731
include($_SERVER['DOCUMENT_ROOT'].'/templates/user/list_user.html');
3832
}
3933

40-
4134
// Footer
4235
include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html');

0 commit comments

Comments
 (0)