Skip to content

Commit 7734c6c

Browse files
committed
user favourites
1 parent 93b2a86 commit 7734c6c

27 files changed

+248
-29
lines changed

bin/v-add-user-favourites

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
user=$1
1414
system=$(echo "$2" |tr '[:lower:]' '[:upper:]')
1515
object=$3
16+
email=$3
17+
id=$3
1618

1719
# Includes
1820
source $VESTA/func/main.sh
@@ -24,7 +26,13 @@ source $VESTA/conf/vesta.conf
2426
#----------------------------------------------------------#
2527

2628
check_args '3' "$#" 'USER SYSTEM OBJECT'
27-
validate_format 'user' 'system' 'object'
29+
validate_format 'user' 'system'
30+
case $system in
31+
MAIL_ACC) validate_format 'email' ;;
32+
CRON) validate_format 'id' ;;
33+
DNS_REC) validate_format 'id' ;;
34+
*) validate_format 'object'
35+
esac
2836
is_object_valid 'user' 'USER' "$user"
2937
is_object_unsuspended 'user' 'USER' "$user"
3038

@@ -33,7 +41,9 @@ case $system in
3341
USER) check='ok' ;;
3442
WEB) check='ok' ;;
3543
DNS) check='ok' ;;
44+
DNS_REC) check='ok' ;;
3645
MAIL) check='ok' ;;
46+
MAIL_ACC) check='ok' ;;
3747
DB) check='ok' ;;
3848
CRON) check='ok' ;;
3949
BACKUP) check='ok' ;;
@@ -52,7 +62,9 @@ esac
5262
USER=''
5363
WEB=''
5464
DNS=''
65+
DNS_REC=''
5566
MAIL=''
67+
MAIL_ACC=''
5668
DB=''
5769
CRON=''
5870
BACKUP=''
@@ -89,7 +101,9 @@ eval $system=$value
89101
echo "USER='$USER'
90102
WEB='$WEB'
91103
DNS='$DNS'
104+
DNS_REC='$DNS_REC'
92105
MAIL='$MAIL'
106+
MAIL_ACC='$MAIL_ACC'
93107
DB='$DB'
94108
CRON='$CRON'
95109
BACKUP='$BACKUP'

bin/v-delete-user-favourites

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
user=$1
1414
system=$(echo "$2" |tr '[:lower:]' '[:upper:]')
1515
object=$3
16+
email=$3
17+
id=$3
1618

1719
# Includes
1820
source $VESTA/func/main.sh
@@ -24,7 +26,12 @@ source $VESTA/conf/vesta.conf
2426
#----------------------------------------------------------#
2527

2628
check_args '3' "$#" 'USER SYSTEM OBJECT'
27-
validate_format 'user' 'system' 'object'
29+
case $system in
30+
MAIL_ACC) validate_format 'email' ;;
31+
CRON) validate_format 'id' ;;
32+
DNS_REC) validate_format 'id' ;;
33+
*) validate_format 'object'
34+
esac
2835
is_object_valid 'user' 'USER' "$user"
2936
is_object_unsuspended 'user' 'USER' "$user"
3037

@@ -33,7 +40,9 @@ case $system in
3340
USER) check='ok' ;;
3441
WEB) check='ok' ;;
3542
DNS) check='ok' ;;
43+
DNS_REC) check='ok' ;;
3644
MAIL) check='ok' ;;
45+
MAIL_ACC) check='ok' ;;
3746
DB) check='ok' ;;
3847
CRON) check='ok' ;;
3948
BACKUP) check='ok' ;;
@@ -52,7 +61,9 @@ esac
5261
USER=''
5362
WEB=''
5463
DNS=''
64+
DNS_REC=''
5565
MAIL=''
66+
MAIL_ACC=''
5667
DB=''
5768
CRON=''
5869
BACKUP=''
@@ -89,7 +100,9 @@ eval $system=$value
89100
echo "USER='$USER'
90101
WEB='$WEB'
91102
DNS='$DNS'
103+
DNS_REC='$DNS_REC'
92104
MAIL='$MAIL'
105+
MAIL_ACC='$MAIL_ACC'
93106
DB='$DB'
94107
CRON='$CRON'
95108
BACKUP='$BACKUP'

bin/v-list-user-favourites

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ json_list_favourites() {
3636
fi
3737
(( ++i))
3838
done
39-
if [ -n "$value" ]; then
39+
#if [ -n "$value" ]; then
4040
echo -e ' }'
41-
fi
41+
#fi
4242
echo -e '}'
4343
}
4444

@@ -74,7 +74,9 @@ is_object_valid 'user' 'USER' "$user"
7474
USER=''
7575
WEB=''
7676
DNS=''
77+
DNS_REC=''
7778
MAIL=''
79+
MAIL_ACC=''
7880
DB=''
7981
CRON=''
8082
BACKUP=''
@@ -84,7 +86,8 @@ FIREWALL=''
8486

8587
# Defining fileds to select
8688
OBJ='Favourites'
87-
fields='$OBJ $USER $WEB $DNS $MAIL $DB $CRON $BACKUP $IP $PACKAGE $FIREWALL'
89+
fields='$OBJ $USER $WEB $DNS $DNS_REC $MAIL $MAIL_ACC $DB $CRON $BACKUP
90+
$IP $PACKAGE $FIREWALL'
8891

8992
# Listing favourites
9093
case $format in

func/main.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -916,7 +916,7 @@ validate_format(){
916916
ns2) validate_format_domain "$arg" 'name_server';;
917917
ns3) validate_format_domain "$arg" 'name_server';;
918918
ns4) validate_format_domain "$arg" 'name_server';;
919-
object) validate_format_domain_alias "$arg" 'object';;
919+
object) validate_format_name_s "$arg" 'object';;
920920
package) validate_format_name "$arg" "$arg_name" ;;
921921
password) validate_format_password "$arg" ;;
922922
port) validate_format_int "$arg" 'port' ;;

web/add/favorite/index.php

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<?
2+
3+
echo 'adding favorite <br><br>';
4+
5+
// Init
6+
error_reporting(NULL);
7+
ob_start();
8+
session_start();
9+
10+
11+
// mail_acc
12+
// firewall
13+
14+
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
15+
16+
// Check POST request
17+
//if (!empty($_POST['ok'])) {
18+
19+
// Check token
20+
// if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
21+
// header('location: /login/');
22+
// exit();
23+
// }
24+
25+
26+
// v-list-user-favourites
27+
// v-delete-user-favourites admin web test0011.com
28+
29+
// Protect input
30+
// $v_section = escapeshellarg($_POST['v_section']);
31+
// $v_unit_id = escapeshellarg($_POST['v_unit_id']);
32+
33+
$v_section = escapeshellarg($_REQUEST['v_section']);
34+
$v_unit_id = escapeshellarg($_REQUEST['v_unit_id']);
35+
36+
// $v_section = 'web';
37+
// $v_unit_id = 'test0011.com';
38+
39+
40+
echo VESTA_CMD."v-add-user-favourites ".$_SESSION['user']." ".$v_section." ".$v_unit_id;
41+
42+
echo ' - ';
43+
44+
// Add cron job
45+
exec (VESTA_CMD."v-add-user-favourites ".$_SESSION['user']." ".$v_section." ".$v_unit_id, $output, $return_var);
46+
check_return_code($return_var,$output);
47+
48+
var_dump($return_var);
49+
echo '<br> -------------------- <br>';
50+
51+
var_dump($output);
52+
echo '<br> -------------------- <br>';
53+
54+
55+
/*
56+
echo '<br>favorites:<br>';
57+
58+
// Data
59+
exec (VESTA_CMD."v-list-user-favourites $user json", $output, $return_var);
60+
$data = json_decode(implode('', $output), true);
61+
$data = array_reverse($data,true);
62+
print_r($data);
63+
*/
64+
//}
65+
?>

web/css/styles.min.css

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1890,8 +1890,8 @@ div.l-content > div.l-separator:nth-of-type(4) {
18901890
width: 36px;
18911891
height: 36px;
18921892
background-position: -216px 560px;
1893-
display: none;
18941893
cursor: pointer;
1894+
display: none;
18951895
}
18961896
.l-unit--starred .l-icon-star {
18971897
display: inline-block;
@@ -1912,7 +1912,7 @@ div.l-content > div.l-separator:nth-of-type(4) {
19121912
}
19131913

19141914
.l-unit:hover .l-icon-star {
1915-
/*display: inline-block;*/
1915+
display: inline-block;
19161916
}
19171917

19181918

@@ -2144,6 +2144,13 @@ div.l-content > div.l-separator:nth-of-type(4) {
21442144
.step-top {
21452145
padding-top: 42px;
21462146
}
2147+
.step-top-small {
2148+
padding-top: 22px;
2149+
}
2150+
.jump-top {
2151+
margin-top: -60px;
2152+
}
2153+
21472154
.data a {
21482155
text-decoration: none;
21492156
}
@@ -2341,14 +2348,30 @@ a.vst-text:active b{
23412348
.additional-control.ftp-remove-user {
23422349
padding: 2px 0 0 0;
23432350
}
2351+
2352+
.additional-control.delete:hover,
23442353
.additional-control.ftp-remove-user:hover {
23452354
background-color: #FF3438;
23462355
border-color: #FF3438;
23472356
}
2357+
.additional-control.delete:active,
23482358
.additional-control.ftp-remove-user:active {
23492359
background-color: #FF5F5F;
23502360
border-color: #FF5F5F;
23512361
}
2362+
.additional-control.add:hover {
2363+
background-color: #9FBF0C;
2364+
border-color: #9FBF0C;
2365+
}
2366+
.additional-control.add:active{
2367+
background-color: #c0e60f;
2368+
border-color: #c0e60f;
2369+
}
2370+
2371+
.additional-control.remove-ns {
2372+
display: none;
2373+
}
2374+
23522375
.data .step-left {
23532376
padding-left: 50px;
23542377
}
@@ -2478,6 +2501,23 @@ td.hint {
24782501
.data-dotted {
24792502
vertical-align: top;
24802503
}
2504+
.mail-infoblock-td {
2505+
vertical-align: top;
2506+
}
2507+
.mail-infoblock {
2508+
padding-top: 76px;
2509+
margin-left: -100px;
2510+
font-size: 12px;
2511+
color: #777;
2512+
}
2513+
.mail-infoblock td {
2514+
color: #777;
2515+
font-size: 14px;
2516+
height: 20px;
2517+
padding-right: 25px;
2518+
font-weight: normal;
2519+
}
2520+
24812521

24822522
:focus {outline:none;}
24832523
::-moz-focus-inner {border:0;}

web/delete/favorite/index.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
echo 'delete Favorites<br>';
4+
5+
6+
error_reporting(NULL);
7+
ob_start();
8+
session_start();
9+
10+
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
11+
12+
$v_section = escapeshellarg($_REQUEST['v_section']);
13+
$v_unit_id = escapeshellarg($_REQUEST['v_unit_id']);
14+
15+
exec (VESTA_CMD."v-delete-user-favourites ".$_SESSION['user']." ".$v_section." ".$v_unit_id, $output, $return_var);
16+
check_return_code($return_var,$output);
17+
18+
19+
?>

web/list/favorites/index.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
session_start();
4+
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
5+
6+
echo '<br> Favorites: <br>';
7+
8+
// Data
9+
exec (VESTA_CMD."v-list-user-favourites ".$_SESSION['user']." json", $output, $return_var);
10+
11+
12+
// print_r(implode('', $output));
13+
// $json = '{ "Favourites": { "USER": "", "WEB": "bulletfarm.com", "DNS": "", "MAIL": "", "DB": "", "CRON": "", "BACKUP": "", "IP": "", "PACKAGE": "", "FIREWALL": ""}}';
14+
// $data = json_decode($json, true);
15+
16+
17+
$data = json_decode(implode('', $output).'}', true);
18+
$data = array_reverse($data,true);
19+
20+
print_r($data);
21+
// $data = array_reverse($data,true);
22+
23+
// $data = json_decode(implode('', $output), true);
24+
25+
?>

web/templates/admin/list_cron.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,9 @@
7979
}
8080
?>
8181

82-
<div class="l-unit <? if($status == 'suspended') echo 'l-unit--suspended'; if($_COOKIE['cron-'.sha1($key)] == 1) echo ' l-unit--starred'; ?>" uniq-id="cron-<?=sha1($key)?>" sort-date="<?=strtotime($data[$key]['DATE'].' '.$data[$key]['TIME'])?>" sort-name="<?=htmlspecialchars($data[$key]['CMD'], ENT_NOQUOTES)?>" sort-star="<? if($_COOKIE['cron-'.sha1($key)] == 1) echo '1'; else echo '0'; ?>">
82+
<div class="l-unit <? if($status == 'suspended') echo 'l-unit--suspended'; if($_SESSION['favourites']['CRON'][$key] == 1) echo ' l-unit--starred'; ?>" v_unit_id="<?=$key?>" v_section="cron"
83+
sort-date="<?=strtotime($data[$key]['DATE'].' '.$data[$key]['TIME'])?>" sort-name="<?=htmlspecialchars($data[$key]['CMD'], ENT_NOQUOTES)?>"
84+
sort-star="<? if($_SESSION['favourites']['CRON'][$key] == 1) echo '1'; else echo '0'; ?>">
8385
<div class="l-unit-toolbar clearfix">
8486
<div class="l-unit-toolbar__col l-unit-toolbar__col--left">
8587
<input id="check<?php echo $i ?>" class="ch-toggle" type="checkbox" name="job[]" value="<?php echo $key ?>">

web/templates/admin/list_db.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,9 @@
109109
?>
110110

111111

112-
<div class="l-unit <? if($status == 'suspended') echo 'l-unit--suspended'; if($_COOKIE['db-'.sha1($key)] == 1) echo ' l-unit--starred'; ?>" uniq-id="db-<?=sha1($key)?>"" sort-date="<?=strtotime($data[$key]['DATE'].' '.$data[$key]['TIME'])?>" sort-name="<?=$key?>" sort-disk="<?=$data[$key]['U_DISK']?>" sort-user="<?=$data[$key]['DBUSER']?>" sort-server="<?=$data[$key]['HOST']?>" sort-star="<? if($_COOKIE['db-'.sha1($key)] == 1) echo '1'; else echo '0'; ?>">
112+
<div class="l-unit <? if($status == 'suspended') echo 'l-unit--suspended'; if($_SESSION['favourites']['DB'][$key] == 1) echo ' l-unit--starred'; ?>" v_unit_id="<?=$key?>" v_section="db"
113+
sort-date="<?=strtotime($data[$key]['DATE'].' '.$data[$key]['TIME'])?>" sort-name="<?=$key?>" sort-disk="<?=$data[$key]['U_DISK']?>"
114+
sort-user="<?=$data[$key]['DBUSER']?>" sort-server="<?=$data[$key]['HOST']?>" sort-star="<? if($_SESSION['favourites']['DB'][$key] == 1) echo '1'; else echo '0'; ?>">
113115
<div class="l-unit-toolbar clearfix">
114116
<div class="l-unit-toolbar__col l-unit-toolbar__col--left">
115117
<input id="check<?php echo $i ?>" class="ch-toggle" type="checkbox" name="database[]" value="<?php echo $key ?>">

0 commit comments

Comments
 (0)