Преглед изворни кода

removed limit&offset function + faster listings

Serghey Rodin пре 14 година
родитељ
комит
90da0f8881

+ 75 - 8
bin/v_list_db_base

@@ -6,15 +6,81 @@
 #----------------------------------------------------------#
 
 # Argument defenition
-user="$1"
-database="$2"
-format="${3-shell}"
+user=$1
+database=$2
+format=${3-shell}
 
 # Importing variables
 source $VESTA/conf/vars.conf
 source $V_FUNC/shared_func.sh
 source $V_FUNC/db_func.sh
 
+# Json function
+json_list_db() {
+    i=1
+
+    # Define words number
+    last_word=$(echo "$fields" | wc -w)
+
+    # Reading file line by line
+    line=$(grep "DB='$database'" $conf)
+
+    # Print top bracket
+    echo '{'
+
+    # Parsing key=value
+    for key in $line; do
+        eval ${key%%=*}=${key#*=}
+    done
+
+    # Starting output loop
+    for field in $fields; do
+
+        # Parsing key=value
+        eval value=$field
+
+        # Checking first field
+        if [ "$i" -eq 1 ]; then
+            echo -e "\t\"$value\": {"
+        else
+            if [ "$last_word" -eq "$i" ]; then
+                echo -e "\t\t\"${field//$/}\": \"${value//,/, }\""
+            else
+                echo -e "\t\t\"${field//$/}\": \"${value//,/, }\","
+            fi
+        fi
+
+        # Updating iterator
+        (( ++i))
+    done
+
+    # If there was any output
+    if [ -n "$value" ]; then
+        echo -e "\t}"
+    fi
+
+    # Printing bottom json bracket
+    echo -e '}'
+}
+
+# Shell list for single database
+shell_list_db() {
+
+    # Reading file line by line
+    line=$(grep "DB='$database'" $conf)
+
+    # Parsing key=value
+    for key in $line; do
+        eval ${key%%=*}=${key#*=}
+    done
+
+    # Print result line
+    for field in $fields; do
+        eval key="$field"
+        echo "${field//$/}: $key "
+    done
+}
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #
@@ -38,16 +104,17 @@ is_db_valid
 #----------------------------------------------------------#
 
 # Defining config
-conf="$V_USERS/$user/db.conf"
+conf=$V_USERS/$user/db.conf
 
 # Defining fileds to select
 fields='$DB $USER $HOST $TYPE $U_DISK $SUSPEND $DATE'
 
 # Listing database
 case $format in 
-    json) db_json_single_list ;;
-    shell) db_shell_single_list | column -t ;;
-    *) check_args '2' "0" 'user database [format]'
+    json)   json_list_db ;;
+    plain)  shell_list_db ;;
+    shell)  shell_list_db | column -t ;;
+    *)      check_args '2' '0' 'user database [format]'
 esac
 
 
@@ -58,4 +125,4 @@ esac
 # Logging
 log_event 'system' "$V_EVENT"
 
-exit  $OK
+exit

+ 10 - 11
bin/v_list_db_bases

@@ -6,10 +6,8 @@
 #----------------------------------------------------------#
 
 # Argument defenition
-user="$1"
-format="${2-shell}"
-limit="${3-1000}"
-offset="${4-1}"
+user=$1
+format=${2-shell}
 
 # Importing variables
 source $VESTA/conf/vars.conf
@@ -21,10 +19,10 @@ source $V_FUNC/shared_func.sh
 #----------------------------------------------------------#
 
 # Checking args
-check_args '1' "$#" 'user [format] [limit] [offset]'
+check_args '1' "$#" 'user [format]'
 
 # Checking argument format
-format_validation 'user' 'limit' 'offset'
+format_validation 'user'
 
 # Checking user
 is_user_valid
@@ -35,16 +33,17 @@ is_user_valid
 #----------------------------------------------------------#
 
 # Defining config
-conf="$V_USERS/$user/db.conf"
+conf=$V_USERS/$user/db.conf
 
 # Defining fileds to select
 fields='$DB $USER $HOST $TYPE $U_DISK $SUSPEND $DATE'
 
 # Listing databases
 case $format in 
-    json) v_json_list ;;
-    shell) v_shell_list| column -t ;;
-    *) check_args '1' "0" 'user [format] [limit] [offset]'
+    json)   json_list ;;
+    plain)  nohead=1; shell_list ;;
+    shell)  shell_list | column -t ;;
+    *)      check_args '1' '0' 'user [format]'
 esac
 
 
@@ -55,4 +54,4 @@ esac
 # Logging
 log_event 'system' "$V_EVENT"
 
-exit  $OK
+exit

+ 73 - 8
bin/v_list_db_host

@@ -6,15 +6,79 @@
 #----------------------------------------------------------#
 
 # Argument defenition
-type="$1"
-host="$2"
-format="${3-shell}"
+type=$1
+host=$2
+format=${3-shell}
 
 # Importing variables
 source $VESTA/conf/vars.conf
 source $V_FUNC/shared_func.sh
 source $V_FUNC/db_func.sh
 
+# Json function
+json_list_dbhost() {
+    # Definigng variables
+    i=1
+
+    # Define words number
+    fields_count=$(echo "$fields" | wc -w)
+
+    # Reading file line by line
+    line=$(grep "HOST='$host'" $conf)
+
+    # Print top bracket
+    echo '{'
+
+    # Assign key=value
+    for key in $line; do
+        eval ${key%%=*}=${key#*=}
+    done
+
+    # Starting output loop
+    for field in $fields; do
+
+        # Parsing key=value
+        eval value=$field
+
+        # Checking first field
+        if [ "$i" -eq 1 ]; then
+            echo -e "\t\"$value\": {"
+        else
+            if [ "$fields_count" -eq "$i" ]; then
+                echo -e "\t\t\"${field//$/}\": \"${value//,/, }\""
+            else
+                echo -e "\t\t\"${field//$/}\": \"${value//,/, }\","
+            fi
+        fi
+        (( ++i))
+    done
+    # If there was any output
+    if [ -n "$value" ]; then
+        echo -e "\t}"
+    fi
+
+    # Printing bottom json bracket
+    echo -e "}"
+}
+
+# Shell function
+shell_list_dbhost() {
+
+    # Reading file line by line
+    line=$(grep "HOST='$host'" $conf)
+
+    # Parsing key=value
+    for key in $line; do
+        eval ${key%%=*}=${key#*=}
+    done
+
+    # Print result line
+    for field in $fields; do
+        eval key="$field"
+        echo "${field//$/}: $key"
+    done
+}
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #
@@ -38,16 +102,17 @@ is_db_host_valid
 #----------------------------------------------------------#
 
 # Defining config type
-conf="$V_DB/$type.conf"
+conf=$V_DB/$type.conf
 
 # Defining fileds to select
 fields='$HOST $PORT $MAX_USERS $MAX_DB $U_SYS_USERS $U_DB_BASES $ACTIVE $DATE'
 
 # Listing database
 case $format in 
-    json) dbhost_json_single_list ;;
-    shell) dbhost_shell_single_list | column -t;;
-    *) check_args '2' "0" 'type host [format]'
+    json)   json_list_dbhost ;;
+    plain)  nohead=1; shell_list_dbhost ;;
+    shell)  shell_list_dbhost | column -t;;
+    *)      check_args '2' '0' 'type host [format]'
 esac
 
 
@@ -58,4 +123,4 @@ esac
 # Logging
 log_event 'system' "$V_EVENT"
 
-exit  $OK
+exit

+ 9 - 10
bin/v_list_db_hosts

@@ -6,10 +6,8 @@
 #----------------------------------------------------------#
 
 # Argument defenition
-type="$1"
-format="${2-shell}"
-limit="${3-1000}"
-offset="${4-1}"
+type=$1
+format=${2-shell}
 
 
 # Importing variables
@@ -36,17 +34,18 @@ is_type_valid 'db' "$type"
 #----------------------------------------------------------#
 
 # Defining config type
-conf="$V_DB/$type.conf"
+conf=$V_DB/$type.conf
 
 # Defining fileds to select
 fields='$HOST $PORT $MAX_USERS $MAX_DB $U_SYS_USERS $U_DB_BASES $ACTIVE $DATE'
 
 # Listing database
 case $format in 
-    json) v_json_list ;;
-    shell) fields='$HOST $PORT $MAX_USERS $MAX_DB $U_DB_BASES $ACTIVE $DATE';
-        v_shell_list | column -t ;;
-    *) check_args '2' "0" 'type [format] [limit] [offset]'
+    json)   json_list ;;
+    plain)  nohead=1; shell_list;;
+    shell)  fields='$HOST $PORT $MAX_USERS $MAX_DB $U_DB_BASES $ACTIVE $DATE';
+            shell_list | column -t ;;
+    *)      check_args '2' '0' 'type [format]'
 esac
 
 
@@ -57,4 +56,4 @@ esac
 # Logging
 log_event 'system' "$V_EVENT"
 
-exit  $OK
+exit

+ 91 - 13
bin/v_list_dns_domain

@@ -6,18 +6,95 @@
 #----------------------------------------------------------#
 
 # Argument defenition
-user="$1"
-domain=$(idn -t --quiet -u "$2" )
-domain_idn=$(idn -t --quiet -a "$domain")
-format="${3-shell}"
-limit="${4-1000}"
-offset="${5-1}"
+user=$1
+domain=$2
+format=${3-shell}
 
 # Importing variables
 source $VESTA/conf/vars.conf
 source $V_FUNC/shared_func.sh
 source $V_FUNC/domain_func.sh
 
+# Json func
+json_list_dns() {
+    # Print top bracket
+    echo '{'
+
+    # Count fields
+    fileds_count=$(echo $fields| wc -w )
+
+    # Reading file line by line
+    while read line; do
+        # New delimeter
+        IFS=$'\n'
+
+        # Assing key=value pair
+        for key in $line; do
+            eval ${key%%=*}=${key#*=}
+        done
+
+        # Closing bracket if there already was output
+        if [ -n "$data" ]; then
+            echo -e '        },'
+        fi
+        i=1
+        IFS=' '
+        for field in $fields; do
+            eval value=\"$field\"
+            value=$(echo "$value" | sed -e 's/"/\\"/g' -e "s/%quote%/'/g")
+
+            if [ $i -eq 1 ]; then
+                # Printing parrent
+                (( ++i))
+                echo -e "\t\"$value\": {"
+            else
+                # Printing child
+                if [ $i -lt $fileds_count ]; then
+                    (( ++i))
+                    echo -e "\t\t\"${field//$/}\": \"${value//,/, }\","
+                else
+                    echo -e "\t\t\"${field//$/}\": \"${value//,/, }\""
+                    data=1
+                fi
+            fi
+        done
+    done < $conf
+
+    # Closing bracket if there was output
+    if [ -n "$data" ]; then
+        echo -e '        }'
+    fi
+
+    # Printing bottom bracket
+    echo -e '}'
+}
+
+# Shell function
+shell_list_dns() {
+
+    if [ -z "$nohead" ] ; then
+        # Print brief info
+        echo "${fields//$/}"
+        for a in $fields; do
+            echo -e "------ \c"
+        done
+        echo
+    fi
+
+    # Reading file line by line
+    while read line ; do
+        # New delimeter
+        IFS=$'\n'
+        # Assing key=value pair
+        for key in $line; do
+            eval ${key%%=*}=${key#*=}
+        done
+
+        # Print result
+        eval echo "$fields" | sed -e "s/%quote%/'/g"
+    done < $conf
+}
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #
@@ -27,7 +104,7 @@ source $V_FUNC/domain_func.sh
 check_args '2' "$#" 'user domain [format]'
 
 # Checking argument format
-format_validation 'user' 'domain' 'limit' 'offset'
+format_validation 'user' 'domain'
 
 # Checking user
 is_user_valid
@@ -41,17 +118,18 @@ is_dns_domain_valid
 #----------------------------------------------------------#
 
 # Defining config
-conf="$V_USERS/$user/zones/$domain"
+conf=$V_USERS/$user/zones/$domain
 
 # Defining fileds to select
 fields='$ID $RECORD $TYPE $VALUE $SUSPEND $DATE'
 
 # Listing domains
 case $format in 
-    json) dns_json_list ;;
-    shell) fields='$ID $RECORD $TYPE $VALUE';
-        dns_shell_list | column -t ;;
-    *) check_args '2' "0" 'user domain [format]'
+    json)   json_list_dns ;;
+    plain)  nohead=1; shell_list_dns ;;
+    shell)  fields='$ID $RECORD $TYPE $VALUE';
+            shell_list_dns | column -t ;;
+    *)      check_args '2' '0' 'user domain [format]'
 esac
 
 
@@ -62,4 +140,4 @@ esac
 # Logging
 log_event 'system' "$V_EVENT"
 
-exit  $OK
+exit

+ 11 - 12
bin/v_list_dns_domains

@@ -6,10 +6,8 @@
 #----------------------------------------------------------#
 
 # Argument defenition
-user="$1"
-format="${2-shell}"
-limit="${3-1000}"
-offset="${4-1}"
+user=$1
+format=${2-shell}
 
 # Importing variables
 source $VESTA/conf/vars.conf
@@ -21,10 +19,10 @@ source $V_FUNC/shared_func.sh
 #----------------------------------------------------------#
 
 # Checking args
-check_args '1' "$#" 'user [format] [limit] [offset]'
+check_args '1' "$#" 'user [format]'
 
 # Checking argument format
-format_validation 'user' 'limit' 'offset'
+format_validation 'user'
 
 # Checking user
 is_user_valid
@@ -35,7 +33,7 @@ is_user_valid
 #----------------------------------------------------------#
 
 # Defining config
-conf="$V_USERS/$user/dns.conf"
+conf=$V_USERS/$user/dns.conf
 
 # Defining fileds to select
 fields='$DOMAIN $IP $TPL $TTL $EXP $SOA $SUSPEND $DATE'
@@ -43,10 +41,11 @@ fields='$DOMAIN $IP $TPL $TTL $EXP $SOA $SUSPEND $DATE'
 
 # Listing domains
 case $format in 
-    json) v_json_list ;;
-    shell) fields='$DOMAIN $IP $TPL $TTL $EXP $SUSPEND';
-        v_shell_list| column -t ;;
-    *) check_args '1' "0" 'user [format] [limit] [offset]'
+    json)   json_list ;;
+    plain)  nohead=1; shell_list ;;
+    shell)  fields='$DOMAIN $IP $TPL $TTL $EXP $SUSPEND';
+            shell_list| column -t ;;
+    *)      check_args '1' '0' 'user [format]';;
 esac
 
 
@@ -57,4 +56,4 @@ esac
 # Logging
 log_event 'system' "$V_EVENT"
 
-exit  $OK
+exit

+ 88 - 9
bin/v_list_dns_template

@@ -6,10 +6,8 @@
 #----------------------------------------------------------#
 
 # Argument defenition
-template="$1"
-format="${2-shell}"
-limit="${3-1000}"
-offset="${4-1}"
+template=$1
+format=${2-shell}
 
 # Importing variables
 source $VESTA/conf/vars.conf
@@ -30,22 +28,103 @@ format_validation 'template'
 # Checking template
 is_template_valid 'dns'
 
+# Json func
+json_list_dns() {
+    # Print top bracket
+    echo '{'
+
+    # Count fields
+    fileds_count=$(echo $fields| wc -w )
+
+    # Reading file line by line
+    while read line; do
+        # New delimeter
+        IFS=$'\n'
+
+        # Assing key=value pair
+        for key in $line; do
+            eval ${key%%=*}=${key#*=}
+        done
+
+        # Closing bracket if there already was output
+        if [ -n "$data" ]; then
+            echo -e '        },'
+        fi
+        i=1
+        IFS=' '
+        for field in $fields; do
+            eval value=\"$field\"
+            value=$(echo "$value" | sed -e 's/"/\\"/g' -e "s/%quote%/'/g")
+
+            if [ $i -eq 1 ]; then
+                # Printing parrent
+                (( ++i))
+                echo -e "\t\"$value\": {"
+            else
+                # Printing child
+                if [ $i -lt $fileds_count ]; then
+                    (( ++i))
+                    echo -e "\t\t\"${field//$/}\": \"${value//,/, }\","
+                else
+                    echo -e "\t\t\"${field//$/}\": \"${value//,/, }\""
+                    data=1
+                fi
+            fi
+        done
+    done < $conf
+
+    # Closing bracket if there was output
+    if [ -n "$data" ]; then
+        echo -e '        }'
+    fi
+
+    # Printing bottom bracket
+    echo -e '}'
+}
+
+# Shell function
+shell_list_dns() {
+
+    if [ -z "$nohead" ] ; then
+        # Print brief info
+        echo "${fields//$/}"
+        for a in $fields; do
+            echo -e "------ \c"
+        done
+        echo
+    fi
+
+    # Reading file line by line
+    while read line ; do
+        # New delimeter
+        IFS=$'\n'
+        # Assing key=value pair
+        for key in $line; do
+            eval ${key%%=*}=${key#*=}
+        done
+
+        # Print result
+        eval echo "$fields" | sed -e "s/%quote%/'/g"
+    done < $conf
+}
+
 
 #----------------------------------------------------------#
 #                       Action                             #
 #----------------------------------------------------------#
 
 # Defining config
-conf="$V_DNSTPL/$template.tpl"
+conf=$V_DNSTPL/$template.tpl
 
 # Defining fileds to select
 fields='$RECORD $TYPE $VALUE'
 
 # Listing domains
 case $format in 
-    json) dns_json_list ;;
-    shell) dns_shell_list | column -t ;;
-    *) check_args '1' "0" 'template [format]'
+    json)   json_list_dns ;;
+    plain)  nohead=1; shell_list_dns ;;
+    shell)  shell_list_dns | column -t ;;
+    *)      check_args '1' '0' 'template [format]';;
 esac
 
 
@@ -56,4 +135,4 @@ esac
 # Logging
 log_event 'system' "$V_EVENT"
 
-exit  $OK
+exit

+ 52 - 13
bin/v_list_dns_templates

@@ -6,21 +6,59 @@
 #----------------------------------------------------------#
 
 # Argument defenition
-format="${1-shell}"
-limit="${2-1000}"
-offset="${3-1}"
+format=${1-shell}
 
 # Importing variables
 source $VESTA/conf/vars.conf
 source $V_FUNC/shared_func.sh
-source $V_FUNC/domain_func.sh
 
-#----------------------------------------------------------#
-#                    Verifications                         #
-#----------------------------------------------------------#
+# Json function
+json_list_dnstpl() {
+    # Print top bracket
+    echo '{'
+
+    # Count fields
+    for template in $(ls $V_DNSTPL/| grep '.descr'); do
+        # Closing bracket if there already was output
+        if [ -n "$data" ]; then
+            echo -e '        },'
+        fi
+
+        tpl_descr=$(cat $V_DNSTPL/$template |grep '#'|tr -d '\n')
+        tpl_name="${template//.descr/}"
+        echo -e  "\t\"$tpl_name\": {"
+        echo -e "\t\t\"DESCR\": \"${tpl_descr//# /}\""
+
+        data=1
+    done
+
+    # Closing bracket if there was output
+    if [ -n "$data" ]; then
+        echo -e '        }'
+    fi
+
+    # Printing bottom bracket
+    echo -e '}'
+}
+
+# Shell function
+shell_list_dnstpl() {
+    for template in $(ls $V_DNSTPL/| grep '.descr'); do
+        tpl_name="${template//.descr/}"
+        tpl_descr=$(cat $V_DNSTPL/$template |grep '#')
+
+        # Print result
+        if [ -z "$nohead" ] ; then
+            echo "----------"
+        fi
+        echo "TEMPLATE: $tpl_name"
+        echo "DESCRIPTION: ${tpl_descr//# /}"
+        if [ -z "$nohead" ] ; then
+            echo
+        fi
+    done
+}
 
-# Checking argument format
-format_validation 'limit' 'offset'
 
 #----------------------------------------------------------#
 #                       Action                             #
@@ -28,9 +66,10 @@ format_validation 'limit' 'offset'
 
 # Listing domains
 case $format in 
-    json) dnstpl_json_list ;;
-    shell) dnstpl_shell_list ;;
-    *) check_args '1' "0" '[format] [limit] [offset]'
+    json)   json_list_dnstpl;;
+    plain)  nohead=1; shell_list_dnstpl ;;
+    shell)  shell_list_dnstpl ;;
+    *)      check_args '1' '0' '[format] [limit] [offset]';;
 esac
 
 
@@ -41,4 +80,4 @@ esac
 # Logging
 log_event 'system' "$V_EVENT"
 
-exit  $OK
+exit

+ 47 - 10
bin/v_list_ssl_certificates

@@ -6,15 +6,51 @@
 #----------------------------------------------------------#
 
 # Argument defenition
-user="$1"
-format="${2-shell}"
-limit="${3-1000}"
-offset="${4-1}"
+user=$1
+format=${2-shell}
 
 # Importing variables
 source $VESTA/conf/vars.conf
 source $V_FUNC/shared_func.sh
-source $V_FUNC/cert_func.sh
+
+# Json function
+json_list_cert() {
+    # Print top bracket
+    echo '['
+
+    # Checking certificates number
+    certificates=$(ls $V_USERS/$user/cert/ |grep '.crt' )
+    certificates_count=$(echo "$certificates" | wc -l)
+    i=1
+
+    # Listing files by mask
+    for cert in $certificates; do
+        if [ $i -eq $certificates_count ]; then
+             echo -e "\t\"${cert//.crt/}\""
+        else
+             echo -e "\t\"${cert//.crt/}\","
+        fi
+        (( ++i))
+    done
+
+    # Printing bottom bracket
+    echo -e "]"
+}
+
+# Shell function
+shell_list_cert() {
+    if [ -z "$nohead" ] ; then
+        # Print brief info
+        echo "Certificate"
+        echo "----------"
+    fi
+
+    # Listing files by mask
+    for cert in $(ls $V_USERS/$user/cert/ | grep '.crt'); do
+        # Print result
+        echo "${cert//.crt/}"
+    done
+}
 
 
 #----------------------------------------------------------#
@@ -25,7 +61,7 @@ source $V_FUNC/cert_func.sh
 check_args '1' "$#" 'user [format] [limit] [offset]'
 
 # Checking argument format
-format_validation 'user' 'limit' 'offset'
+format_validation 'user'
 
 # Checking user
 is_user_valid
@@ -36,9 +72,10 @@ is_user_valid
 
 # Listing domains
 case $format in 
-    json) cert_json_list  ;;
-    shell) cert_shell_list | column -t ;;
-    *) check_args '1' "0" 'user [format] [limit] [offset]'
+    json)   json_list_cert  ;;
+    plain)  nohead=1; shell_list_cert ;;
+    shell)  shell_list_cert | column -t ;;
+    *)      check_args '1' '0' 'user [format]' ;;
 esac
 
 
@@ -49,4 +86,4 @@ esac
 # Logging
 log_event 'system' "$V_EVENT"
 
-exit  $OK
+exit

+ 24 - 27
bin/v_list_sys_config

@@ -1,37 +1,23 @@
 #!/bin/bash
-# info: listing system ip
+# info: listing system config
 
 #----------------------------------------------------------#
 #                    Variable&Function                     #
 #----------------------------------------------------------#
 
 # Argument defenition
-format="${1-shell}"
+format=${1-shell}
 
 # Importing variables
 source $VESTA/conf/vars.conf
-source $V_FUNC/shared_func.sh
 
-
-#----------------------------------------------------------#
-#                       Action                             #
-#----------------------------------------------------------#
-
-# Defining functions
-conf_shell_list() {
-    for str in $(cat $V_CONF/vesta.conf);do 
-        key=${str%%=*}
-        value=${str#*=}
-        echo "$key ${value//\'/}"
-    done
-}
-
-conf_json_list() {
-    lines=$(wc -l $V_CONF/vesta.conf|cut -f 1 -d ' ')
+# Json function
+json_list_conf() {
+    lines=$(wc -l $V_CONF/vesta.conf | cut -f 1 -d ' ')
     i='0'
     echo -e "{\n\t\"config\": {"
     for str in $(cat $V_CONF/vesta.conf); do
-        i=$((i + 1))
+        (( ++i))
         key=${str%%=*}
         value=${str#*=}
 
@@ -44,12 +30,26 @@ conf_json_list() {
     echo -e "\t}\n}"
 }
 
+# Shell function
+shell_list_conf() {
+    for str in $(cat $V_CONF/vesta.conf); do
+        key=${str%%=*}
+        value=${str#*=}
+        echo "$key: ${value//\'/}"
+    done
+}
+
+
+#----------------------------------------------------------#
+#                       Action                             #
+#----------------------------------------------------------#
 
 # Listing system config
 case $format in 
-    json) conf_json_list ;;
-    shell) conf_shell_list | column -t ;;
-    *) check_args '1' "0" '[format]'
+    json)   json_list_conf ;;
+    plain)  shell_list_conf ;;
+    shell)  shell_list_conf | column -t ;;
+    *)      check_args '1' '0' '[format]'
 esac
 
 
@@ -57,7 +57,4 @@ esac
 #                       Vesta                              #
 #----------------------------------------------------------#
 
-# Logging
-log_event 'system' "$V_EVENT"
-
-exit  $OK
+exit

+ 94 - 14
bin/v_list_sys_cron

@@ -6,15 +6,92 @@
 #----------------------------------------------------------#
 
 # Argument defenition
-user="$1"
-format="${2-shell}"
-limit="${3-1000}"
-offset="${4-1}"
+user=$1
+format=${2-shell}
 
 # Importing variables
 source $VESTA/conf/vars.conf
 source $V_FUNC/shared_func.sh
-source $V_FUNC/cron_func.sh
+
+# Json function
+json_list_cron() {
+    # Print top bracket
+    echo '{'
+
+    # Count fields
+    fileds_count=$(echo $fields| wc -w )
+
+    # Reading file line by line
+    while read line; do
+        # New delimeter
+        IFS=$'\n'
+
+        # Assing key=value pair
+        for key in $line; do
+            eval ${key%%=*}=${key#*=}
+        done
+
+        # Closing bracket if there already was output
+        if [ -n "$data" ]; then
+            echo -e '        },'
+        fi
+        i=1
+        IFS=' '
+        for field in $fields; do
+            eval value=\"$field\"
+            value=$(echo "$value"|sed -e 's/"/\\"/g' -e "s/%quote%/'/g")
+
+            if [ $i -eq 1 ]; then
+                # Printing parrent
+                (( ++i))
+                echo -e "\t\"$value\": {"
+            else
+                # Printing child
+                if [ $i -lt $fileds_count ]; then
+                    (( ++i))
+                    echo -e "\t\t\"${field//$/}\": \"${value//,/, }\","
+                else
+                    echo -e "\t\t\"${field//$/}\": \"${value//,/, }\""
+                    data=1
+                fi
+            fi
+        done
+    done < $conf
+
+    # Closing bracket if there was output
+    if [ -n "$data" ]; then
+        echo -e '        }'
+    fi
+
+    # Printing bottom bracket
+    echo -e '}'
+}
+
+# Shell function
+shell_list_cron() {
+
+    if [ -z "$nohead" ] ; then
+        # Print brief info
+        echo "${fields//$/}"
+        for a in $fields; do
+            echo -e "------ \c"
+        done
+        echo
+    fi
+
+    # Reading file line by line
+    while read line ; do
+        # New delimeter
+        IFS=$'\n'
+        # Assing key=value pair
+        for key in $line; do
+            eval ${key%%=*}=${key#*=}
+        done
+
+        # Print result
+        eval echo "$fields" | sed -e "s/%quote%/'/g"
+    done < $conf
+}
 
 
 #----------------------------------------------------------#
@@ -22,10 +99,10 @@ source $V_FUNC/cron_func.sh
 #----------------------------------------------------------#
 
 # Checking args
-check_args '1' "$#" 'user [format] [limit] [offset]'
+check_args '1' "$#" 'user [format]'
 
 # Checking argument format
-format_validation 'user' 'limit' 'offset'
+format_validation 'user'
 
 # Checking user
 is_user_valid
@@ -36,18 +113,21 @@ is_user_valid
 #----------------------------------------------------------#
 
 # Defining config
-conf="$V_USERS/$user/cron.conf"
+conf=$V_USERS/$user/cron.conf
 
 # Defining fileds to select
 fields='$JOB $MIN $HOUR $DAY $MONTH $WDAY $CMD $SUSPEND $DATE'
 
-
 # Listing domains
 case $format in 
-    json) crn_json_list ;;
-    shell) fields='$JOB~$SUSPEND~$MIN~$HOUR~$DAY~$MONTH~$WDAY~$CMD';
-        crn_shell_list |column -t -s '~';;
-    *) check_args '1' '0' 'user [format] [limit] [offset]' ;;
+    json)   json_list_cron ;;
+    plain)  nohead=1;
+            fields="\"\$JOB\" \"\$SUSPEND\" \"\$MIN\" \"\$HOUR\" \"\$DAY\""
+            fields="$fields \"\$MONTH\" \"\$WDAY\" \"\$CMD\"";
+            shell_list_cron ;;
+    shell)  fields='$JOB~$SUSPEND~$MIN~$HOUR~$DAY~$MONTH~$WDAY~$CMD';
+            shell_list_cron |column -t -s '~';;
+    *)      check_args '1' '0' 'user [format]' ;;
 esac
 
 
@@ -58,4 +138,4 @@ esac
 # Logging
 log_event 'system' "$V_EVENT"
 
-exit  $OK
+exit

+ 35 - 13
bin/v_list_sys_interfaces

@@ -6,22 +6,43 @@
 #----------------------------------------------------------#
 
 # Argument defenition
-format="${1-shell}"
-limit="${2-1000}"
-offset="${3-1}"
+format=${1-shell}
 
 # Importing variables
 source $VESTA/conf/vars.conf
 source $V_FUNC/shared_func.sh
-source $V_FUNC/ip_func.sh
 
+# Json function
+json_list_iface() {
+    interfaces=$(cat /proc/net/dev | grep : | cut -f 1 -d : | tr -d ' ')
+    int_counter=$(echo "$interfaces" | wc -l)
+    i=1
+    echo '['
 
-#----------------------------------------------------------#
-#                    Verifications                         #
-#----------------------------------------------------------#
+    # Listing ifaces
+    for interface in $interfaces; do
+        if [ "$i" -lt "$int_counter" ]; then
+            echo -e  "\t\"$interface\","
+        else
+            echo -e  "\t\"$interface\""
+        fi
+        (( ++i))
+    done
+    echo "]"
+}
+
+# Shell function
+shell_list_iface() {
+    interfaces=$(cat /proc/net/dev | grep : | cut -f 1 -d : | tr -d ' ')
+    if [ -z "$nohead" ]; then
+        echo "INTERFACES"
+        echo "----------"
+    fi
 
-# Checking argument format
-format_validation 'limit' 'offset'
+    for interface in $interfaces; do
+        echo "$interface"
+    done
+}
 
 
 #----------------------------------------------------------#
@@ -30,9 +51,10 @@ format_validation 'limit' 'offset'
 
 # Listing domains
 case $format in 
-    json) ipint_json_list ;;
-    shell) ipint_shell_list ;;
-    *) check_args '1' '0' '[format] [limit] [offset]'
+    json)   json_list_iface ;;
+    plain)  nohead=1; shell_list_iface ;;
+    shell)  shell_list_iface ;;
+    *)      check_args '1' '0' '[format]' ;;
 esac
 
 
@@ -43,4 +65,4 @@ esac
 # Logging
 log_event 'system' "$V_EVENT"
 
-exit  $OK
+exit

+ 65 - 7
bin/v_list_sys_ip

@@ -6,14 +6,70 @@
 #----------------------------------------------------------#
 
 # Argument defenition
-ip="$1"
-format="${2-shell}"
+ip=$1
+IP=$ip
+format=${2-shell}
 
 # Importing variables
 source $VESTA/conf/vars.conf
 source $V_FUNC/shared_func.sh
 source $V_FUNC/ip_func.sh
 
+# Json function
+json_list_ip() {
+    i=1
+    fileds_count=$(echo "$fields" | wc -w)
+    ip_data=$(cat $V_IPS/$IP)
+
+    # Print top bracket
+    echo '{'
+
+    # Assign key=value
+    for key in $ip_data; do
+        eval ${key%%=*}=${key#*=}
+    done
+
+    for field in $fields; do
+        eval value=$field
+
+        # Checking first field
+        if [ $i -eq 1 ]; then
+            echo -e "\t\"$value\": {"
+        else
+            if [ $fileds_count -eq $i ]; then
+                echo -e "\t\t\"${field//$/}\": \"${value//,/, }\""
+            else
+                echo -e "\t\t\"${field//$/}\": \"${value//,/, }\","
+            fi
+        fi
+    (( ++i))
+    done
+
+    # If there was any output
+    if [ -n "$value" ]; then
+        echo -e '        }'
+    fi
+
+    # Printing bottom json bracket
+    echo -e '}'
+}
+
+# Shell function
+shell_list_ip() {
+    line=$(cat $V_IPS/$IP)
+
+    # Assing key=value
+    for key in $line; do
+        eval ${key%%=*}=${key#*=}
+    done
+
+    # Print result line
+    for field in $fields; do
+        eval key="$field"
+        echo "${field//$/}: $key "
+    done
+}
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #
@@ -31,16 +87,18 @@ is_sys_ip_valid
 #----------------------------------------------------------#
 #                       Action                             #
 #----------------------------------------------------------#
+conf=$V_IPS/$IP
 
 # Defining fileds to select
 fields='$IP $OWNER $STATUS $NAME $U_SYS_USERS $U_WEB_DOMAINS
- $INTERFACE $NETMASK $DATE'
+    $INTERFACE $NETMASK $DATE'
 
 # Listing ip
 case $format in 
-    json) ip_json_single_list ;;
-    shell) ip_shell_single_list | column -t ;;
-    *) check_args '1' "0" 'ip [format]'
+    json)   json_list_ip ;;
+    plain)  shell_list_ip ;;
+    shell)  shell_list_ip | column -t ;;
+    *)      check_args '1' '0' 'ip [format]'
 esac
 
 
@@ -51,4 +109,4 @@ esac
 # Logging
 log_event 'system' "$V_EVENT"
 
-exit  $OK
+exit

+ 88 - 17
bin/v_list_sys_ips

@@ -1,43 +1,114 @@
 #!/bin/bash
-# info: listing system users
+# info: listing system ips
 
 #----------------------------------------------------------#
 #                    Variable&Function                     #
 #----------------------------------------------------------#
 
 # Argument defenition
-format="${1-shell}"
-limit="${2-1000}"
-offset="${3-1}"
+format=${1-shell}
 
 # Importing variables
 source $VESTA/conf/vars.conf
 source $V_FUNC/shared_func.sh
-source $V_FUNC/ip_func.sh
 
+# Json function
+json_list_ips() {
+    # Print top bracket
+    echo '{'
 
-#----------------------------------------------------------#
-#                    Verifications                         #
-#----------------------------------------------------------#
+    # Definining ip list
+    ip_list=$(ls $V_IPS/)
+
+    fileds_count=$(echo "$fields" | wc -w)
+
+    # Starting main loop
+    for IP in $ip_list; do
+        # Assing key=value
+        ip_data=$(cat $V_IPS/$IP)
+        for key in $ip_data; do
+            eval ${key%%=*}=${key#*=}
+        done
+
+        # Closing bracket if there already was output
+        if [ -n "$data" ]; then
+            echo -e '        },'
+        fi
+        i=1
+        for field in $fields; do
+            eval value=$field
+
+            if [ $i -eq 1 ]; then
+                # Printing parrent
+                (( ++i))
+                echo -e "\t\"$value\": {"
+            else
+                # Printing child
+                if [ $i -lt $fileds_count ]; then
+                    (( ++i))
+                    echo -e "\t\t\"${field//$/}\": \"${value//,/, }\","
+                else
+                    echo -e "\t\t\"${field//$/}\": \"${value//,/, }\""
+                    data=1
+                fi
+            fi
+        done
+    done
+
+    # Closing bracket if there was output
+    if [ -n "$data" ]; then
+        echo -e '        }'
+    fi
+
+    # Printing bottom bracket
+    echo -e '}'
+}
+
+# Shell function
+shell_list_ips() {
+    ip_list=$(ls $V_IPS/)
+
+    if [ -z "$nohead" ]; then
+        # Print brief info
+        echo "${fields//$/}"
+        for a in $fields; do
+            echo -e "--------- \c"
+        done
+        echo
+    fi
+
+    # Starting main loop
+    for IP in $ip_list; do
+        # Reading user data
+        ip_data=$(cat $V_IPS/$IP)
+
+        # Assign key/value config
+        for key in $ip_data; do
+            eval ${key%%=*}=${key#*=}
+        done
 
-# Checking argument format
-format_validation 'limit' 'offset'
+        # Print result line
+        eval echo "$fields"
+    done
+}
 
 
 #----------------------------------------------------------#
 #                       Action                             #
 #----------------------------------------------------------#
+conf=$V_IPS/*
 
 # Defining fileds to select
-fields='$IP $OWNER $STATUS $NAME $U_SYS_USERS $U_WEB_DOMAINS
- $INTERFACE $NETMASK $DATE'
+fields="\$IP \$OWNER \$STATUS \$NAME \$U_SYS_USERS \$U_WEB_DOMAINS"
+field=s"$fields \$INTERFACE \$NETMASK \$DATE"
 
 # Listing domains
 case $format in 
-    json) ip_json_list ;;
-    shell) fields='$IP $NETMASK $OWNER $STATUS $U_WEB_DOMAINS';
-        ip_shell_list | column -t ;;
-    *) check_args '1' '0' '[format] [limit] [offset]'
+    json)   json_list_ips ;;
+    plain)  nohead=1; shell_list_ips ;;
+    shell)  fields='$IP $NETMASK $OWNER $STATUS $U_WEB_DOMAINS';
+            shell_list_ips | column -t ;;
+    *)      check_args '1' '0' '[format]'
 esac
 
 
@@ -48,4 +119,4 @@ esac
 # Logging
 log_event 'system' "$V_EVENT"
 
-exit  $OK
+exit

+ 66 - 7
bin/v_list_sys_user

@@ -6,13 +6,71 @@
 #----------------------------------------------------------#
 
 # Argument defenition
-user="$1"
-format="${2-shell}"
+user=$1
+USER="$user"
+format=${2-shell}
 
 # Importing variables
 source $VESTA/conf/vars.conf
 source $V_FUNC/shared_func.sh
 
+# Json function
+json_list_user() {
+    i=1
+    fileds_count=$(echo "$fields" | wc -w)
+    line=$(cat $V_USERS/$USER/user.conf)
+
+    # Print top bracket
+    echo '{'
+
+    # Assing key=value
+    for key in $line; do
+        eval ${key%%=*}=${key#*=}
+    done
+
+    # Starting output loop
+    for field in $fields; do
+        # Parsing key=value
+        eval value=$field
+
+        # Checking first field
+        if [ "$i" -eq 1 ]; then
+            echo -e "\t\"$value\": {"
+        else
+            if [ "$fileds_count" -eq "$i" ]; then
+                echo -e "\t\t\"${field//$/}\": \"${value//,/, }\""
+            else
+                echo -e "\t\t\"${field//$/}\": \"${value//,/, }\","
+            fi
+        fi
+        # Updating iterator
+        (( ++i))
+    done
+
+    # If there was any output
+    if [ -n "$value" ]; then
+        echo -e '        }'
+    fi
+    # Printing bottom json bracket
+    echo -e "}"
+}
+
+# Shell function
+shell_list_user() {
+    line=$(cat $V_USERS/$USER/user.conf)
+
+    # Parsing key=value
+    for key in $line; do
+        eval ${key%%=*}=${key#*=}
+    done
+
+    # Print result line
+    for field in $fields; do
+        eval key="$field"
+        echo "${field//$/}: $key "
+    done
+}
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #
@@ -33,7 +91,7 @@ is_user_valid
 #----------------------------------------------------------#
 
 # Defining config
-conf="$V_USERS/$user/user.conf"
+conf=$V_USERS/$user/user.conf
 
 # Defining fileds to select
 fields='$USER $FNAME $LNAME $PACKAGE $WEB_DOMAINS $WEB_SSL $WEB_ALIASES
@@ -44,9 +102,10 @@ fields='$USER $FNAME $LNAME $PACKAGE $WEB_DOMAINS $WEB_SSL $WEB_ALIASES
 
 # Listing user
 case $format in 
-    json) usr_json_single_list ;;
-    shell) usr_shell_single_list | column -t ;;
-    *) check_args '1' "0" 'user [format]'
+    json)   json_list_user ;;
+    plain)  nohead=1; shell_list_user ;;
+    shell)  shell_list_user | column -t ;;
+    *)      check_args '1' '0' 'user [format]' ;;
 esac
 
 
@@ -57,4 +116,4 @@ esac
 # Logging
 log_event 'system' "$V_EVENT"
 
-exit  $OK
+exit

+ 100 - 12
bin/v_list_sys_user_ips

@@ -6,25 +6,112 @@
 #----------------------------------------------------------#
 
 # Argument defenition
-user="$1"
-format="${2-shell}"
-limit="${3-1000}"
-offset="${4-1}"
+user=$1
+format=${2-shell}
 
 # Importing variables
 source $VESTA/conf/vars.conf
 source $V_FUNC/shared_func.sh
-source $V_FUNC/ip_func.sh
+
+# Json function
+json_list_user_ips() {
+    # Print top bracket
+    echo '{'
+
+    owned_ips=$(grep -l "OWNER='$user'" $V_IPS/*)
+    shared_ips=$(grep -A5 "OWNER='vesta'" $V_IPS/* |\
+                    grep "STATUS='shared'"|\
+                    cut -f 1 -d - )
+
+    ip_list="$owned_ips $shared_ips"
+    fileds_count=$(echo "$fields" | wc -w)
+
+    # Starting main loop
+    for IP in $ip_list; do
+        IP=$(basename $IP)
+        ip_data=$(cat $V_IPS/$IP)
+
+        # Assing key=value
+        for key in $ip_data; do
+            eval ${key%%=*}=${key#*=}
+        done
+
+        # Closing bracket if there already was output
+        if [ -n "$data" ]; then
+            echo -e '        },'
+        fi
+        i=1
+        for field in $fields; do
+            eval value=$field
+
+            if [ $i -eq 1 ]; then
+                # Printing parrent
+                (( ++i))
+                echo -e "\t\"$value\": {"
+            else
+                # Printing child
+                if [ $i -lt $fileds_count ]; then
+                    (( ++i))
+                    echo -e "\t\t\"${field//$/}\": \"${value//,/, }\","
+                else
+                    echo -e "\t\t\"${field//$/}\": \"${value//,/, }\""
+                    data=1
+                fi
+            fi
+        done
+    done
+
+    # Closing bracket if there was output
+    if [ -n "$data" ]; then
+        echo -e '        }'
+    fi
+
+    # Printing bottom bracket
+    echo -e '}'
+}
+
+# Shell function
+shell_list_user_ips() {
+    owned_ips=$(grep -l "OWNER='$user'" $V_IPS/*)
+    shared_ips=$(grep -A5 "OWNER='vesta'" $V_IPS/* |\
+                    grep "STATUS='shared'"|\
+                    cut -f 1 -d - )
+
+    ip_list="$owned_ips $shared_ips"
+    if [ -z "$nohead" ]; then
+        # Print brief info
+        echo "${fields//$/}"
+        for a in $fields; do
+            echo -e "--------- \c"
+        done
+        echo
+    fi
+
+    # Starting main loop
+    for IP in $ip_list; do
+        IP=$(basename $IP)
+        ip_data=$(cat $V_IPS/$IP)
+
+        # Assign key/value config
+        for key in $ip_data; do
+            eval ${key%%=*}=${key#*=}
+        done
+
+        # Print result line
+        eval echo "$fields"
+    done
+}
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #
 #----------------------------------------------------------#
 
 # Checking arg number
-check_args '1' "$#" 'user [format] [limit] [offset]'
+check_args '1' "$#" 'user [format]'
 
 # Checking argument format
-format_validation 'user' 'limit' 'offset'
+format_validation 'user'
 
 # Checking user
 is_user_valid
@@ -37,11 +124,12 @@ is_user_valid
 # Defining fileds to select
 fields='$IP $OWNER $STATUS $NAME'
 
-# Listing domains
+# Listing ips
 case $format in 
-    json) ip_user_json_list ;;
-    shell) ip_user_shell_list | column -t ;;
-    *) check_args '1' '0' 'user [format] [limit] [offset]'
+    json)   json_list_user_ips ;;
+    plain)  nohead=1; shell_list_user_ips ;;
+    shell)  shell_list_user_ips | column -t ;;
+    *)      check_args '1' '0' 'user [format]' ;;
 esac
 
 
@@ -52,4 +140,4 @@ esac
 # Logging
 log_event 'system' "$V_EVENT"
 
-exit $OK
+exit

+ 41 - 6
bin/v_list_sys_user_ns

@@ -6,13 +6,47 @@
 #----------------------------------------------------------#
 
 # Argument defenition
-user="$1"
-format="${2-shell}"
+user=$1
+format=${2-shell}
 
 # Importing variables
 source $VESTA/conf/vars.conf
 source $V_FUNC/shared_func.sh
 
+# Json function
+json_list_ns() {
+    ns=$(grep "^NS='" $V_USERS/$user/user.conf |cut -f 2 -d \')
+    # Print top bracket
+    echo '['
+    i=1
+    nslistc=$(echo -e "${ns//,/\n}"|wc -l)
+    # Listing servers
+    for nameserver in ${ns//,/ };do
+        if [ "$i" -ne "$nslistc" ]; then
+            echo -e  "\t\"$nameserver\","
+        else
+            echo -e  "\t\"$nameserver\""
+        fi
+        (( ++i))
+    done
+
+    echo "]"
+}
+
+# Shell function
+shell_list_ns() {
+    ns=$(grep "^NS='" $V_USERS/$user/user.conf |cut -f 2 -d \')
+    if [ -z "$nohead" ]; then
+        # Print result
+        echo "NAMESERVER"
+        echo "----------"
+    fi
+
+    for nameserver in ${ns//,/ };do
+        echo "$nameserver"
+    done
+}
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #
@@ -34,9 +68,10 @@ is_user_valid
 
 # Listing nameservers
 case $format in 
-    json) usrns_json_list ;;
-    shell) usrns_shell_list ;;
-    *) check_args '1' '0' 'user [format]'
+    json)   json_list_ns ;;
+    plain)  nohead=1; shell_list_ns ;;
+    shell)  shell_list_ns ;;
+    *)      check_args '1' '0' 'user [format]'
 esac
 
 
@@ -47,4 +82,4 @@ esac
 # Logging
 log_event 'system' "$V_EVENT"
 
-exit $OK
+exit

+ 79 - 13
bin/v_list_sys_user_packages

@@ -6,21 +6,86 @@
 #----------------------------------------------------------#
 
 # Argument defenition
-format="${1-shell}"
-limit="${2-1000}"
-offset="${3-1}"
+format=${1-shell}
 
 # Importing variables
 source $VESTA/conf/vars.conf
 source $V_FUNC/shared_func.sh
 
+# Json function
+json_list_pkgs() {
+    # Print top bracket
+    echo '{'
 
-#----------------------------------------------------------#
-#                    Verifications                         #
-#----------------------------------------------------------#
+    fileds_count=$(echo "$fields" | wc -w)
+
+    # Starting main loop
+    for package in $(ls $V_DATA/packages); do
+        PACKAGE=${package/.pkg/}
+        # Assing key=value
+        pkg_data=$(cat $V_DATA/packages/$package)
+        for key in $pkg_data; do
+            eval ${key%%=*}=${key#*=}
+        done
+
+        # Closing bracket if there already was output
+        if [ -n "$data" ]; then
+            echo -e '        },'
+        fi
+        i=1
+        for field in $fields; do
+            eval value=$field
+
+            if [ $i -eq 1 ]; then
+                # Printing parrent
+                (( ++i))
+                echo -e "\t\"$value\": {"
+            else
+                # Printing child
+                if [ $i -lt $fileds_count ]; then
+                    (( ++i))
+                    echo -e "\t\t\"${field//$/}\": \"${value//,/, }\","
+                else
+                    echo -e "\t\t\"${field//$/}\": \"${value//,/, }\""
+                    data=1
+                fi
+            fi
+        done
+    done
+
+    # Closing bracket if there was output
+    if [ -n "$data" ]; then
+        echo -e '        }'
+    fi
+
+    # Printing bottom bracket
+    echo -e '}'
+}
+
+# Shell fnction
+shell_list_pkgs() {
+    # Listing pkg files
+    for package in $(ls $V_DATA/packages); do
+        PACKAGE=${package/.pkg/}
+        # Assign key=value
+        pkg_descr=$(cat $V_DATA/packages/$package)
+        for key in $pkg_descr; do
+            eval ${key%%=*}=${key#*=}
+        done
+
+
+        if [ -z "$nohead" ]; then
+            echo '----------'
+        fi
+
+        for field in $fields; do
+            eval value=$field
+            echo -e "${field//$/}: $value"
+        done
+
+    done
+}
 
-# Checking argument format
-format_validation 'limit' 'offset'
 
 
 #----------------------------------------------------------#
@@ -29,14 +94,15 @@ format_validation 'limit' 'offset'
 
 # Defining fields
 fields='$PACKAGE $WEB_DOMAINS $WEB_SSL $WEB_ALIASES $DATABASES $MAIL_DOMAINS
-    $MAIL_BOXES $MAIL_FORWARDERS $DNS_DOMAINS $DISK_QUOTA $BANDWIDTH $NS1 $NS2
+    $MAIL_BOXES $MAIL_FORWARDERS $DNS_DOMAINS $DISK_QUOTA $BANDWIDTH $NS
     $SHELL $BACKUPS $WEB_TPL'
 
 # Listing domains
 case $format in
-    json) pkg_json_list ;;
-    shell) pkg_shell_list | column -t ;;
-    *) check_args '1' "0" '[format] [limit] [offset]'
+    json)   json_list_pkgs ;;
+    plain)  nohead=1; shell_list_pkgs ;;
+    shell)  shell_list_pkgs | column -t ;;
+    *)      check_args '1' '0' '[format]'
 esac
 
 
@@ -47,4 +113,4 @@ esac
 # Logging
 log_event 'system' "$V_EVENT"
 
-exit $OK
+exit

+ 83 - 18
bin/v_list_sys_users

@@ -6,39 +6,104 @@
 #----------------------------------------------------------#
 
 # Argument defenition
-format="${1-shell}"
-limit="${2-1000}"
-offset="${3-1}"
+format=${1-shell}
 
 # Importing variables
 source $VESTA/conf/vars.conf
 source $V_FUNC/shared_func.sh
 
+# Json function
+json_list_users() {
+    echo '{'
+    fileds_count=$(echo "$fields" | wc -w)
 
-#----------------------------------------------------------#
-#                    Verifications                         #
-#----------------------------------------------------------#
+    # Starting main loop
+    for USER in $(ls $V_USERS/); do
+        # Reading user data
+        user_data=$(cat $V_USERS/$USER/user.conf)
+
+        # Assign key/value config
+        for key in $user_data; do
+            eval ${key%%=*}=${key#*=}
+        done
+
+        # Closing bracket if there already was output
+        if [ -n "$data" ]; then
+            echo -e '        },'
+        fi
+        i=1
+        for field in $fields; do
+            eval value=$field
+
+            if [ $i -eq 1 ]; then
+                # Printing parrent
+                (( ++i))
+                echo -e "\t\"$value\": {"
+            else
+                # Printing child
+                if [ $i -lt $fileds_count ]; then
+                    (( ++i))
+                    echo -e "\t\t\"${field//$/}\": \"${value//,/, }\","
+                else
+                    echo -e "\t\t\"${field//$/}\": \"${value//,/, }\""
+                    data=1
+                fi
+            fi
+        done
+    done
+    # Closing bracket if there was output
+    if [ -n "$data" ]; then
+        echo -e '        }'
+    fi
+
+    # Printing bottom bracket
+    echo -e '}'
+}
+
+# Shell function
+shell_list_users() {
+    if [  -z "$nohead" ]; then
+        # Print brief info
+        echo "${fields//$/}"
+        for a in $fields; do
+            echo -e "--------- \c"
+        done
+        echo                        # new line
+    fi
+
+    # Starting main loop
+    for USER in $(ls $V_USERS/); do
+        user_data=$(cat $V_USERS/$USER/user.conf)
+
+        # Assign key/value config
+        for key in $user_data; do
+            eval ${key%%=*}=${key#*=}
+        done
+
+        eval echo "$fields"
+    done
+}
 
-# Checking argument format
-format_validation 'limit' 'offset'
 
 #----------------------------------------------------------#
 #                       Action                             #
 #----------------------------------------------------------#
 
 # Defining fileds to select
-fields='$USER $FNAME $LNAME $PACKAGE $WEB_DOMAINS $WEB_SSL $WEB_ALIASES
-    $DATABASES $MAIL_DOMAINS $MAIL_BOXES $MAIL_FORWARDERS $DNS_DOMAINS
-    $DISK_QUOTA $BANDWIDTH $NS $SHELL $BACKUPS $WEB_TPL $SUSPENDED $IP_OWNED
-    $U_DISK $U_BANDWIDTH $U_WEB_DOMAINS $U_WEB_SSL $U_DNS_DOMAINS $U_DATABASES
-    $U_MAIL_DOMAINS $CONTACT $DATE'
+fields="\$USER \$FNAME \$LNAME \$PACKAGE \$WEB_DOMAINS \$WEB_SSL \$WEB_ALIASES"
+fields="$fields \$DATABASES \$MAIL_DOMAINS \$MAIL_BOXES \$MAIL_FORWARDERS"
+fields="$fields \$DNS_DOMAINS \$DISK_QUOTA \$BANDWIDTH \$NS \$SHELL \$BACKUPS"
+fields="$fields \$WEB_TPL \$SUSPENDED \$IP_OWNED \$U_DISK \$U_BANDWIDTH"
+fields="$fields \$U_WEB_DOMAINS \$U_WEB_SSL \$U_DNS_DOMAINS \$U_DATABASES"
+fields="$fields \$U_MAIL_DOMAINS \$CONTACT \$DATE"
 
 # Listing domains
 case $format in 
-    json) usr_json_list ;;
-    shell) fields='$USER $PACKAGE $U_DISK $U_BANDWIDTH $SUSPENDED $DATE';
-        usr_shell_list | column -t ;;
-    *) check_args '1' '0' '[format] [limit] [offset]'
+    json)   json_list_users ;;
+    plain)  nohead=1; shell_list_users ;;
+    shell)  fields='$USER $PACKAGE $U_DISK $U_BANDWIDTH $SUSPENDED $DATE';
+            shell_list_users | column -t ;;
+    *)      check_args '1' '0' '[format]' ;;
 esac
 
 
@@ -49,4 +114,4 @@ esac
 # Logging
 log_event 'system' "$V_EVENT"
 
-exit $OK
+exit

+ 66 - 9
bin/v_list_web_domain

@@ -6,16 +6,72 @@
 #----------------------------------------------------------#
 
 # Argument defenition
-user="$1"
-domain=$(idn -t --quiet -u "$2" )
-domain_idn=$(idn -t --quiet -a "$domain")
-format="${3-shell}"
+user=$1
+domain=$2
+format=${3-shell}
 
 # Importing variables
 source $VESTA/conf/vars.conf
 source $V_FUNC/shared_func.sh
 source $V_FUNC/domain_func.sh
 
+# Json function
+json_list_domain() {
+    i=1
+    fileds_count=$(echo "$fields" | wc -w)
+    line=$(grep "DOMAIN='$domain'" $conf)
+
+    # Print top bracket
+    echo '{'
+
+    # Assing key=value
+    for key in $line; do
+        eval ${key%%=*}=${key#*=}
+    done
+
+    # Starting output loop
+    for field in $fields; do
+        # Parsing key=value
+        eval value=$field
+
+        # Checking first field
+        if [ "$i" -eq 1 ]; then
+            echo -e "\t\"$value\": {"
+        else
+            if [ "$fileds_count" -eq "$i" ]; then
+                echo -e "\t\t\"${field//$/}\": \"${value//,/, }\""
+            else
+                echo -e "\t\t\"${field//$/}\": \"${value//,/, }\","
+            fi
+        fi
+        # Updating iterator
+        (( ++i))
+    done
+
+    # If there was any output
+    if [ -n "$value" ]; then
+        echo -e '        }'
+    fi
+    # Printing bottom json bracket
+    echo -e "}"
+}
+
+# Shell function
+shell_list_domain() {
+    line=$(cat $V_USERS/$user/web.conf)
+
+    # Parsing key=value
+    for key in $line; do
+        eval ${key%%=*}=${key#*=}
+    done
+
+    # Print result line
+    for field in $fields; do
+        eval key="$field"
+        echo "${field//$/}: $key "
+    done
+}
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #
@@ -36,7 +92,7 @@ is_web_domain_valid
 #----------------------------------------------------------#
 
 # Defining config
-conf="$V_USERS/$user/web.conf"
+conf=$V_USERS/$user/web.conf
 
 # Defining fileds to select
 fields='$DOMAIN $IP $U_DISK $U_BANDWIDTH $TPL $ALIAS $PHP $CGI $ELOG $STATS
@@ -44,9 +100,10 @@ fields='$DOMAIN $IP $U_DISK $U_BANDWIDTH $TPL $ALIAS $PHP $CGI $ELOG $STATS
 
 # Listing domains
 case $format in 
-    json) dom_json_single_list ;;
-    shell) dom_shell_single_list | column -t ;;
-    *) check_args '2' "0" 'user domain [format]'
+    json)   json_list_domain ;;
+    plain)  nohead=1; shell_list_domain ;;
+    shell)  shell_list_domain | column -t ;;
+    *)      check_args '2' '0' 'user domain [format]'
 esac
 
 
@@ -57,4 +114,4 @@ esac
 # Logging
 log_event 'system' "$V_EVENT"
 
-exit $OK
+exit

+ 14 - 15
bin/v_list_web_domains

@@ -6,10 +6,8 @@
 #----------------------------------------------------------#
 
 # Argument defenition
-user="$1"
-format="${2-shell}"
-limit="${3-1000}"
-offset="${4-1}"
+user=$1
+format=${2-shell}
 
 # Importing variables
 source $VESTA/conf/vars.conf
@@ -21,10 +19,10 @@ source $V_FUNC/shared_func.sh
 #----------------------------------------------------------#
 
 # Checking args
-check_args '1' "$#" 'user [format] [limit] [offset]'
+check_args '1' "$#" 'user [format]'
 
 # Checking argument format
-format_validation 'user' 'limit' 'offset'
+format_validation 'user'
 
 # Checking user
 is_user_valid
@@ -35,19 +33,20 @@ is_user_valid
 #----------------------------------------------------------#
 
 # Defining config
-conf="$V_USERS/$user/web.conf"
+conf=$V_USERS/$user/web.conf
 
 # Defining fileds to select
-fields='$DOMAIN $IP $U_DISK $U_BANDWIDTH $TPL $ALIAS $PHP $CGI $ELOG $STATS
- $STATS_AUTH $SSL_HOME $SSL_CERT $NGINX $NGINX_EXT $SUSPEND $DATE'
-
+fields="\$DOMAIN \$IP \$U_DISK \$U_BANDWIDTH \$TPL \$ALIAS \$PHP \$CGI \$ELOG"
+fields="$fields \$STATS \$STATS_AUTH \$SSL_HOME \$SSL_CERT \$NGINX \$NGINX_EXT"
+fields="$fields \$SUSPEND \$DATE"
 
 # Listing domains
 case $format in 
-    json) v_json_list ;;
-    shell) fields='$DOMAIN $IP $U_DISK $U_BANDWIDTH $TPL $DATE';
-        v_shell_list | column -t ;;
-    *) check_args '1' "0" 'user [format] [limit] [offset]'
+    json)   json_list ;;
+    plain)  nohead=1; shell_list ;;
+    shell)  fields='$DOMAIN $IP $U_DISK $U_BANDWIDTH $TPL $DATE';
+            shell_list | column -t ;;
+    *)      check_args '1' '0' 'user [format]'
 esac
 
 
@@ -58,4 +57,4 @@ esac
 # Logging
 log_event 'system' "$V_EVENT"
 
-exit $OK
+exit

+ 11 - 12
bin/v_list_web_domains_alias

@@ -6,10 +6,8 @@
 #----------------------------------------------------------#
 
 # Argument defenition
-user="$1"
-format="${2-shell}"
-limit="${3-1000}"
-offset="${4-1}"
+user=$1
+format=${2-shell}
 
 # Importing variables
 source $VESTA/conf/vars.conf
@@ -21,10 +19,10 @@ source $V_FUNC/shared_func.sh
 #----------------------------------------------------------#
 
 # Checking args
-check_args '1' "$#" 'user [format] [limit] [offset]'
+check_args '1' "$#" 'user [format]'
 
 # Checking argument format
-format_validation 'user' 'limit' 'offset'
+format_validation 'user'
 
 # Checking user
 is_user_valid
@@ -35,16 +33,17 @@ is_user_valid
 #----------------------------------------------------------#
 
 # Defining config
-conf="$V_USERS/$user/web.conf"
+conf=$V_USERS/$user/web.conf
 
 # Defining fileds to select
-fields='$DOMAIN $ALIAS'
+fields="\$DOMAIN \$ALIAS"
 
 # Listing domains
 case $format in 
-    json) v_json_list ;;
-    shell) v_shell_list | column -t ;;
-    *) check_args '1' "0" 'user [format] [limit] [offset]'
+    json)   json_list ;;
+    plain)  nohead=1; shell_list ;;
+    shell)  shell_list | column -t ;;
+    *)      check_args '1' '0' 'user [format]'
 esac
 
 
@@ -55,4 +54,4 @@ esac
 # Logging
 log_event 'system' "$V_EVENT"
 
-exit $OK
+exit

+ 11 - 12
bin/v_list_web_domains_elog

@@ -6,10 +6,8 @@
 #----------------------------------------------------------#
 
 # Argument defenition
-user="$1"
-format="${2-shell}"
-limit="${3-1000}"
-offset="${4-1}"
+user=$1
+format=${2-shell}
 
 # Importing variables
 source $VESTA/conf/vars.conf
@@ -21,10 +19,10 @@ source $V_FUNC/shared_func.sh
 #----------------------------------------------------------#
 
 # Checking args
-check_args '1' "$#" 'user [format] [limit] [offset]'
+check_args '1' "$#" 'user [format]'
 
 # Checking argument format
-format_validation 'user' 'limit' 'offset'
+format_validation 'user' 
 
 # Checking user
 is_user_valid
@@ -35,16 +33,17 @@ is_user_valid
 #----------------------------------------------------------#
 
 # Defining config
-conf="$V_USERS/$user/web.conf"
+conf=$V_USERS/$user/web.conf
 
 # Defining fileds to select
-fields='$DOMAIN $ELOG'
+fields="\$DOMAIN \$ELOG"
 
 # Listing domains
 case $format in 
-    json) v_json_list ;;
-    shell) v_shell_list | column -t ;;
-    *) check_args '1' "0" 'user [format] [limit] [offset]'
+    json)   json_list ;;
+    plain)  nohead=1; shell_list ;;
+    shell)  shell_list | column -t ;;
+    *)      check_args '1' '0' 'user [format]'
 esac
 
 
@@ -55,4 +54,4 @@ esac
 # Logging
 log_event 'system' "$V_EVENT"
 
-exit $OK
+exit

+ 11 - 12
bin/v_list_web_domains_nginx

@@ -6,10 +6,8 @@
 #----------------------------------------------------------#
 
 # Argument defenition
-user="$1"
-format="${2-shell}"
-limit="${3-1000}"
-offset="${4-1}"
+user=$1
+format=${2-shell}
 
 # Importing variables
 source $VESTA/conf/vars.conf
@@ -21,10 +19,10 @@ source $V_FUNC/shared_func.sh
 #----------------------------------------------------------#
 
 # Checking args
-check_args '1' "$#" 'user [format] [limit] [offset]'
+check_args '1' "$#" 'user [format]'
 
 # Checking argument format
-format_validation 'user' 'limit' 'offset'
+format_validation 'user'
 
 # Checking user
 is_user_valid
@@ -35,16 +33,17 @@ is_user_valid
 #----------------------------------------------------------#
 
 # Defining config
-conf="$V_USERS/$user/web.conf"
+conf=$V_USERS/$user/web.conf
 
 # Defining fileds to select
-fields='$DOMAIN $NGINX'
+fields="\$DOMAIN \$NGINX \$NGINX_EXT"
 
 # Listing domains
 case $format in 
-    json) v_json_list ;;
-    shell) v_shell_list | column -t ;;
-    *) check_args '1' "0" 'user [format] [limit] [offset]'
+    json)   json_list ;;
+    plain)  nohead=1; shell_list ;;
+    shell)  shell_list | column -t ;;
+    *)      check_args '1' '0' 'user [format]'
 esac
 
 
@@ -55,4 +54,4 @@ esac
 # Logging
 log_event 'system' "$V_EVENT"
 
-exit $OK
+exit

+ 10 - 11
bin/v_list_web_domains_ssl

@@ -6,10 +6,8 @@
 #----------------------------------------------------------#
 
 # Argument defenition
-user="$1"
-format="${2-shell}"
-limit="${3-1000}"
-offset="${4-1}"
+user=$1
+format=${2-shell}
 
 # Importing variables
 source $VESTA/conf/vars.conf
@@ -21,10 +19,10 @@ source $V_FUNC/shared_func.sh
 #----------------------------------------------------------#
 
 # Checking args
-check_args '1' "$#" 'user [format] [limit] [offset]'
+check_args '1' "$#" 'user [format]'
 
 # Checking argument format
-format_validation 'user' 'limit' 'offset'
+format_validation 'user'
 
 # Checking user
 is_user_valid
@@ -38,13 +36,14 @@ is_user_valid
 conf="$V_USERS/$user/web.conf"
 
 # Defining fileds to select
-fields='$DOMAIN $SSL_HOME $SSL_CERT'
+fields="\$DOMAIN \$SSL_HOME \$SSL_CERT"
 
 # Listing domains
 case $format in 
-    json) v_json_list ;;
-    shell) v_shell_list | column -t ;;
-    *) check_args '1' "0" 'user [format] [limit] [offset]'
+    json)   json_list ;;
+    plain)  nohead=1; shell_list ;;
+    shell)  shell_list | column -t ;;
+    *)      check_args '1' "0" 'user [format]'
 esac
 
 
@@ -55,4 +54,4 @@ esac
 # Logging
 log_event 'system' "$V_EVENT"
 
-exit $OK
+exit

+ 11 - 12
bin/v_list_web_domains_stats

@@ -6,10 +6,8 @@
 #----------------------------------------------------------#
 
 # Argument defenition
-user="$1"
-format="${2-shell}"
-limit="${3-1000}"
-offset="${4-1}"
+user=$1
+format=${2-shell}
 
 # Importing variables
 source $VESTA/conf/vars.conf
@@ -21,10 +19,10 @@ source $V_FUNC/shared_func.sh
 #----------------------------------------------------------#
 
 # Checking args
-check_args '1' "$#" 'user [format] [limit] [offset]'
+check_args '1' "$#" 'user [format]'
 
 # Checking argument format
-format_validation 'user' 'limit' 'offset'
+format_validation 'user'
 
 # Checking user
 is_user_valid
@@ -35,16 +33,17 @@ is_user_valid
 #----------------------------------------------------------#
 
 # Defining config
-conf="$V_USERS/$user/web.conf"
+conf=$V_USERS/$user/web.conf
 
 # Defining fileds to select
-fields='$DOMAIN $STATS $STATS_AUTH'
+fields="\$DOMAIN \$STATS \$STATS_AUTH"
 
 # Listing domains
 case $format in 
-    json) v_json_list ;;
-    shell) v_shell_list | column -t ;;
-    *) check_args '1' "0" 'user [format] [limit] [offset]'
+    json)   json_list ;;
+    plain)  nohead=1; shell_list ;;
+    shell)  shell_list | column -t ;;
+    *)      check_args '1' "0" 'user [format]'
 esac
 
 
@@ -55,4 +54,4 @@ esac
 # Logging
 log_event 'system' "$V_EVENT"
 
-exit $OK
+exit

+ 48 - 10
bin/v_list_web_templates

@@ -6,15 +6,12 @@
 #----------------------------------------------------------#
 
 # Argument defenition
-user="$1"
-format="${2-shell}"
-limit="${3-1000}"
-offset="${4-1}"
+user=$1
+format=${2-shell}
 
 # Importing variables
 source $VESTA/conf/vars.conf
 source $V_FUNC/shared_func.sh
-source $V_FUNC/domain_func.sh
 
 
 #----------------------------------------------------------#
@@ -25,11 +22,51 @@ source $V_FUNC/domain_func.sh
 check_args '1' "$#" 'user'
 
 # Checking argument format
-format_validation 'user' 'limit' 'offset'
+format_validation 'user'
 
 # Checking user
 is_user_valid
 
+# Json function
+json_list_wtpl() {
+    i='1'       # iterator
+    echo '{'
+
+    # Listing files by mask
+    for template in $(echo "$templates" |sed -e "s/,/\n/g"); do
+        descr=$(cat $V_WEBTPL/apache_$template.descr | grep '#'|\
+            sed -e ':a;N;$!ba;s/\n/ /g')
+        # Checking !first line to print bracket
+        if [ $i -ne 1 ]; then
+            echo -e "\t},"
+        fi
+        # Print result
+        echo -e  "\t\"$template\": {"
+        echo -e "\t\t\"DESCR\": \"${descr//# /}\""
+        (( ++i))
+    done
+
+    # If there was any output
+    if [ -n "$template" ]; then
+        echo -e "\t}"
+    fi
+    echo '}'
+}
+
+# Shell function
+shell_list_wtpl() {
+    for template in $(echo "$templates" |sed -e "s/,/\n/g"); do
+        tpl_descr=$(cat $V_WEBTPL/apache_$template.descr |grep '#')
+
+        if [ -z "$nohead" ]; then
+            echo "----------"
+        fi
+
+        echo "TEMPLATE: $template"
+        echo "DESCRIPTION: ${tpl_descr//# /}"
+    done
+}
+
 
 #----------------------------------------------------------#
 #                       Action                             #
@@ -40,9 +77,10 @@ templates=$(get_user_value '$WEB_TPL')
 
 # Listing domains
 case $format in
-    json) webtpl_json_list ;;
-    shell) webtpl_shell_list ;;
-    *) check_args '1' "0" '[format] [limit] [offset]'
+    json)   json_list_wtpl ;;
+    plain)  nohead=1; shell_list_wtpl ;;
+    shell)  shell_list_wtpl ;;
+    *)      check_args '1' '0' '[format]'
 esac
 
 
@@ -53,4 +91,4 @@ esac
 # Logging
 log_event 'system' "$V_EVENT"
 
-exit $OK
+exit

+ 2 - 1
bin/v_upd_sys_rrd_mysql

@@ -28,7 +28,8 @@ fi
 # Parsing db hosts
 conf="$V_DB/mysql.conf"
 fields='$HOST'
-hosts=$(v_clear_list)
+nohead=1
+hosts=$(shel_list)
 check_row=$(echo "$hosts" |wc -l)
 if [ 0 -eq "$check_row" ]; then
     exit

+ 2 - 1
bin/v_upd_sys_rrd_pgsql

@@ -28,7 +28,8 @@ fi
 # Parsing db hosts
 conf="$V_DB/pgsql.conf"
 fields='$HOST'
-hosts=$(v_clear_list)
+nohead=1
+hosts=$(shell_list)
 check_row=$(echo "$hosts" |wc -l)
 if [ 0 -eq "$check_row" ]; then
     exit

+ 0 - 52
func/cert_func.sh

@@ -74,55 +74,3 @@ is_cert_used() {
         exit $E_CERT_USED
     fi
 }
-
-cert_json_list() {
-
-    # Definigng variables
-    i='1'                       # iterator
-    j='1'                       # iterator
-    end=$(($limit + $offset))   # last string
-
-    # Print top bracket
-    echo '['
-
-    # Checking certificates number
-    last=$(ls $V_USERS/$user/cert/|grep '.crt' | wc -l)
-
-    # Listing files by mask
-    for cert in $(ls $V_USERS/$user/cert/|grep '.crt'); do
-        # Checking offset and limit
-        if [ "$i" -ge "$offset" ] && [ "$i" -lt "$end" ] && [ "$offset" -gt 0 ]
-        then
-            if [ "$i" -ne "$last" ] && [ "$j" -ne "$limit" ]; then
-                 echo -e "\t\"${cert//.crt/}\","
-            else
-                 echo -e "\t\"${cert//.crt/}\""
-            fi
-            j=$(($j + 1))
-        fi
-        i=$(($i + 1))
-    done 
-
-    # Printing bottom bracket
-    echo -e "]"
-}
-
-cert_shell_list() {
-    i='1'                       # iterator
-    end=$(($limit + $offset))   # last string
-
-    # Print brief info
-    echo "Certificate"
-    echo "----------"
-
-    # Listing files by mask
-    for cert in $(ls $V_USERS/$user/cert/|grep '.crt'); do
-        # Checking offset and limit
-        if [ "$i" -ge "$offset" ] && [ "$i" -lt "$end" ] && [ "$offset" -gt 0 ]
-        then
-            # Print result
-            echo "${cert//.crt/}"
-        fi
-        i=$(($i + 1))
-    done
-}

+ 0 - 88
func/cron_func.sh

@@ -72,94 +72,6 @@ del_cron_job() {
     sed -i "$str d" $V_USERS/$user/cron.conf
 }
 
-crn_json_list() {
-    i='1'                       # iterator
-    end=$(($limit + $offset))   # last string
-
-    # Print top bracket
-    echo '{'
-
-    # Reading file line by line
-    while read line ; do
-        # Checking offset and limit
-        if [ "$i" -ge "$offset" ] && [ "$i" -lt "$end" ] && [ "$offset" -gt 0 ]
-        then
-            # Defining new delimeter
-            IFS=$'\n'
-            # Parsing key=value
-            for key in $(echo $line|sed -e "s/' /'\n/g"); do
-                eval ${key%%=*}="${key#*=}"
-            done
-
-            # Checking !first line to print bracket
-            if [ "$i" -ne "$offset" ]; then
-                echo -e "\t},"
-            fi
-
-            j=1                 # local loop iterator
-            last_word=$(echo "$fields" | wc -w)
-
-            # Restoring old delimeter
-            IFS=' '
-            # Print data
-            for field in $fields; do
-                eval value=\"$field\"
-                value=$(echo "$value"|sed -e 's/"/\\"/g' -e "s/%quote%/'/g")
-
-                # Checking parrent key
-                if [ "$j" -eq 1 ]; then
-                    echo -e "\t\"$value\": {"
-                else
-                    if [ "$j" -eq "$last_word" ]; then
-                        echo -e "\t\t\"${field//$/}\": \"${value//,/, }\""
-                    else
-                        echo -e "\t\t\"${field//$/}\": \"${value//,/, }\","
-                    fi
-                fi
-                j=$(($j + 1))
-            done
-        fi
-        i=$(($i + 1))
-    done < $conf
-
-    # If there was any output
-    if [ -n "$value" ]; then
-        echo -e "\t}"
-    fi
-
-    # Printing bottom json bracket
-    echo -e "}"
-}
-
-crn_shell_list() {
-    i='1'                       # iterator
-    end=$(($limit + $offset))   # last string
-
-    # Print brief info
-    echo "${fields//$/}"
-    for a in $(echo ${fields//\~/ /}); do
-        echo -e "-----~\c"
-    done
-    echo
-
-
-    # Reading file line by line
-    while read line ; do
-        # Checking offset and limit
-        if [ "$i" -ge "$offset" ] && [ "$i" -lt "$end" ] && [ "$offset" -gt 0 ]
-        then
-            # Defining new delimeter
-            IFS=$'\n'
-            # Parsing key=value
-            for key in $(echo $line|sed -e "s/' /'\n/g"); do
-                eval ${key%%=*}="${key#*=}"
-            done
-            # Print result line
-            eval echo "\"$fields\""|sed -e "s/%quote%/'/g"
-        fi
-        i=$(($i + 1))
-    done < $conf
-}
 
 is_job_suspended() {
     # Parsing jobs

+ 0 - 132
func/db_func.sh

@@ -22,138 +22,6 @@ is_db_new() {
     fi
 }
 
-# Shell list for single database
-db_shell_single_list() {
-
-    # Reading file line by line
-    line=$(grep "DB='$database'" $conf)
-
-    # Parsing key=value
-    for key in $line; do
-        eval ${key%%=*}=${key#*=}
-    done
-
-    # Print result line
-    for field in $fields; do 
-        eval key="$field"
-        echo "${field//$/}: $key "
-    done
-}
-
-# Json single list
-db_json_single_list() {
-    i=1
-
-    # Define words number
-    last_word=$(echo "$fields" | wc -w)
-
-    # Reading file line by line
-    line=$(grep "DB='$database'" $conf)
-
-    # Print top bracket
-    echo '{'
-
-    # Parsing key=value
-    for key in $line; do
-        eval ${key%%=*}=${key#*=}
-    done
-
-    # Starting output loop
-    for field in $fields; do
-
-        # Parsing key=value
-        eval value=$field
-
-        # Checking first field
-        if [ "$i" -eq 1 ]; then
-            echo -e "\t\"$value\": {"
-        else
-            if [ "$last_word" -eq "$i" ]; then
-                echo -e "\t\t\"${field//$/}\": \"${value//,/, }\""
-            else
-                echo -e "\t\t\"${field//$/}\": \"${value//,/, }\","
-            fi
-        fi
-
-        # Updating iterator
-        i=$(( i + 1))
-    done
-
-    # If there was any output
-    if [ -n "$value" ]; then
-        echo -e "\t}"
-    fi
-
-    # Printing bottom json bracket
-    echo -e "}"
-}
-
-# Shell list for single database host
-dbhost_shell_single_list() {
-
-    # Reading file line by line
-    line=$(grep "HOST='$host'" $conf)
-
-    # Parsing key=value
-    for key in $line; do
-        eval ${key%%=*}=${key#*=}
-    done
-
-    # Print result line
-    for field in $fields; do 
-        eval key="$field"
-        echo "${field//$/}: $key"
-    done
-}
-
-# Json list for single db host
-dbhost_json_single_list() {
-
-    # Definigng variables
-    i=1                         # iterator
-
-    # Define words number
-    last_word=$(echo "$fields" | wc -w)
-
-    # Reading file line by line
-    line=$(grep "HOST='$host'" $conf)
-
-    # Print top bracket
-    echo '{'
-
-    # Parsing key=value
-    for key in $line; do
-        eval ${key%%=*}=${key#*=}
-    done
-
-    # Starting output loop
-    for field in $fields; do
-
-        # Parsing key=value
-        eval value=$field
-
-        # Checking first field
-        if [ "$i" -eq 1 ]; then
-            echo -e "\t\"$value\": {"
-        else
-            if [ "$last_word" -eq "$i" ]; then
-                echo -e "\t\t\"${field//$/}\": \"${value//,/, }\""
-            else
-                echo -e "\t\t\"${field//$/}\": \"${value//,/, }\","
-            fi
-        fi
-
-        # Updating iterator
-        i=$(( i + 1))
-    done
-    # If there was any output
-    if [ -n "$value" ]; then
-        echo -e "\t}"
-    fi
-
-    # Printing bottom json bracket
-    echo -e "}"
-}
 
 # Checking database host existance
 is_db_host_valid() {

+ 0 - 270
func/domain_func.sh

@@ -498,276 +498,6 @@ del_web_domain() {
 }
 
 
-dns_shell_list() {
-    i='1'       # iterator
-    end=$(($limit + $offset))   # last string
-
-    # Print brief info
-    echo "${fields//$/}"
-    for a in $fields; do
-        echo -e "------ \c"
-    done
-    echo
-
-    # Reading file line by line
-    while read line ; do
-        # Checking offset and limit
-        if [ "$i" -ge "$offset" ] && [ "$i" -lt "$end" ] && [ "$offset" -gt 0 ]
-        then
-            # Defining new delimeter
-            IFS=$'\n'
-            # Parsing key=value
-            for key in $(echo $line|sed -e "s/' /'\n/g"); do
-                eval ${key%%=*}="${key#*=}"
-            done
-            # Print result line
-            eval echo "\"$fields\""|sed -e "s/%quote%/'/g"
-        fi
-        i=$(($i + 1))
-    done < $conf
-}
-
-dns_json_list() {
-    i='1'        # iterator
-    end=$(($limit + $offset))   # last string
-
-    # Print top bracket
-    echo '{'
-
-    # Reading file line by line
-    while read line ; do
-        # Checking offset and limit
-        if [ "$i" -ge "$offset" ] && [ "$i" -lt "$end" ] && [ "$offset" -gt 0 ]
-        then
-            # Defining new delimeter
-            IFS=$'\n'
-            # Parsing key=value
-            for key in $(echo $line|sed -e "s/' /'\n/g"); do
-                eval ${key%%=*}="${key#*=}"
-            done
-
-            # Checking !first line to print bracket
-            if [ "$i" -ne "$offset" ]; then
-                echo -e "\t},"
-            fi
-
-            j=1                 # local loop iterator
-            last_word=$(echo "$fields" | wc -w)
-
-            # Restoring old delimeter
-            IFS=' '
-            # Print data
-            for field in $fields; do
-                eval value=\"$field\"
-                value=$(echo "$value"|sed -e 's/"/\\"/g' -e "s/%quote%/'/g")
-
-                # Checking parrent key
-                if [ "$j" -eq 1 ]; then
-                    echo -e "\t\"$value\": {"
-                else
-                    if [ "$j" -eq "$last_word" ]; then
-                        echo -e "\t\t\"${field//$/}\": \"${value//,/, }\""
-                    else
-                        echo -e "\t\t\"${field//$/}\": \"${value//,/, }\","
-                    fi
-                fi
-                j=$(($j + 1))
-            done
-        fi
-        i=$(($i + 1))
-    done < $conf
-
-    # If there was any output
-    if [ -n "$value" ]; then
-        echo -e "\t}"
-    fi
-
-    # Printing bottom json bracket
-    echo -e "}"
-}
-
-# Shell list for dns domain templates
-dnstpl_shell_list() {
-    # Definigng variables
-    i='1'                       # iterator
-    end=$(($limit + $offset))	# last string
-
-    # Listing files by mask
-    for template in $(ls $V_DNSTPL/| grep '.descr'); do
-
-        # Defining template name
-        tpl_name="${template//.descr/}"
-
-        # Defining template description
-        tpl_descr=$(cat $V_DNSTPL/$template |grep '#')
-
-        # Checking offset and limit
-        if [ "$i" -ge "$offset" ] && [ "$i" -lt "$end" ] && [ "$offset" -gt 0 ]
-        then
-            # Print result
-            echo "----------"
-            echo "TEMPLATE: $tpl_name"
-            echo "${tpl_descr//# /}"
-        fi
-        i=$(($i + 1))
-    done
-}
-
-# Json list for dns domain templates
-dnstpl_json_list() {
-    i=1         # iterator
-    end=$(($limit + $offset))   # last string
-
-    # Print top bracket
-    echo '{'
-
-    # Listing files by mask
-    for template in $(ls $V_DNSTPL/| grep '.descr'); do
-
-        # Defining template description
-        descr=$(cat $V_DNSTPL/$template |grep '#'|sed -e ':a;N;$!ba;s/\n/ /g')
-
-        # Checking offset and limit
-        if [ "$i" -ge "$offset" ] && [ "$i" -lt "$end" ] && [ "$offset" -gt 0 ]
-        then
-            # Checking !first line to print bracket
-            if [ "$i" -ne "$offset" ]; then
-                echo -e "\t},"
-            fi
-
-            # Defining template name
-            tpl_name="${template//.descr/}"
-
-            # Print result
-            echo -e  "\t\"$tpl_name\": {"
-            echo -e "\t\t\"DESCR\": \"${descr//# /}\""
-        fi
-        i=$(($i + 1))
-    done
-
-    # If there was any output
-    if [ -n "$tpl_name" ]; then
-        echo -e "\t}"
-    fi
-
-    echo "}"
-}
-
-dom_json_single_list() {
-    i=1	        # iterator
-
-    # Define words number
-    last_word=$(echo "$fields" | wc -w)
-
-    # Reading file line by line
-    line=$(grep "DOMAIN='$domain'" $conf)
-
-    # Print top bracket
-    echo '{'
-
-    # Parsing key=value
-    for key in $line; do
-        eval ${key%%=*}=${key#*=}
-    done
-
-    # Starting output loop
-    for field in $fields; do
-        # Parsing key=value
-        eval value=$field
-
-        # Checking first field
-        if [ "$i" -eq 1 ]; then
-            echo -e "\t\"$value\": {"
-        else
-            if [ "$last_word" -eq "$i" ]; then
-                echo -e "\t\t\"${field//$/}\": \"${value//,/, }\""
-            else
-                echo -e "\t\t\"${field//$/}\": \"${value//,/, }\","
-            fi
-        fi
-        # Updating iterator
-        i=$(( i + 1))
-    done
-
-    # If there was any output
-    if [ -n "$value" ]; then
-        echo -e "\t}"
-    fi
-    # Printing bottom json bracket
-    echo -e "}"
-}
-
-dom_shell_single_list() {
-
-    # Reading file line by line
-    line=$(grep "DOMAIN='$domain'" $conf)
-
-    # Parsing key=value
-    for key in $line; do
-        eval ${key%%=*}=${key#*=}
-    done
-
-    # Print result line
-    for field in $fields; do 
-        eval key="$field"
-        echo "${field//$/}: $key "
-    done
-}
-
-webtpl_json_list() {
-    i='1'       # iterator
-    end=$(($limit + $offset))   # last string
-
-    # Print top bracket
-    echo '{'
-
-    # Listing files by mask
-    for template in $(echo "$templates" |sed -e "s/,/\n/g"); do
-        # Defining template description
-        descr=$(cat $V_WEBTPL/apache_$template.descr|grep '#'|\
-            sed -e ':a;N;$!ba;s/\n/ /g')
-        # Checking offset and limit
-        if [ "$i" -ge "$offset" ] && [ "$i" -lt "$end" ] && [ "$offset" -gt 0 ]
-        then
-            # Checking !first line to print bracket
-            if [ "$i" -ne "$offset" ]; then
-                echo -e "\t},"
-            fi
-
-            # Print result
-            echo -e  "\t\"$template\": {"
-            echo -e "\t\t\"DESCR\": \"${descr//# /}\""
-        fi
-        i=$(($i + 1))
-    done
-
-    # If there was any output
-    if [ -n "$template" ]; then
-        echo -e "\t}"
-    fi
-    echo "}"
-}
-
-webtpl_shell_list() {
-    i='1'       # iterator
-    end=$(($limit + $offset))   # last string
-
-    # Listing files by mask
-    for template in $(echo "$templates" |sed -e "s/,/\n/g"); do
-        # Defining template description
-        tpl_descr=$(cat $V_WEBTPL/apache_$template.descr |grep '#')
-        # Checking offset and limit
-        if [ "$i" -ge "$offset" ] && [ "$i" -lt "$end" ] && [ "$offset" -gt 0 ]
-        then
-            # Print result
-            echo "----------"
-            echo "TEMPLATE: $template"
-            echo "${tpl_descr//# /}"
-        fi
-        i=$(($i + 1))
-    done
-}
-
 dom_clear_search(){
     # Defining delimeter
     IFS=$'\n'

+ 0 - 294
func/ip_func.sh

@@ -276,272 +276,6 @@ get_current_interface() {
     echo "$i"
 }
 
-ip_json_single_list() {
-    # Definigng variables
-    IP="$ip"    # ip
-    i=1         # iterator
-
-    # Define words number
-    last_word=$(echo "$fields" | wc -w)
-
-    # Reading file line by line
-    line=$(cat $V_IPS/$IP)
-
-    # Print top bracket
-    echo '{'
-
-    # Parsing key=value
-    for key in $line; do
-        eval ${key%%=*}=${key#*=}
-    done
-
-    # Starting output loop
-    for field in $fields; do
-        # Parsing key=value
-        eval value=$field
-        # Checking first field
-        if [ "$i" -eq 1 ]; then
-            echo -e "\t\"$value\": {"
-        else
-            if [ "$last_word" -eq "$i" ]; then
-                echo -e "\t\t\"${field//$/}\": \"${value//,/, }\""
-            else
-                echo -e "\t\t\"${field//$/}\": \"${value//,/, }\","
-            fi
-        fi
-    # Updating iterator
-    i=$(( i + 1))
-    done
-
-    # If there was any output
-    if [ -n "$value" ]; then
-    echo -e "\t}"
-    fi
-
-    # Printing bottom json bracket
-    echo -e "}"
-}
-
-ip_shell_single_list() {
-    # Definigng variables
-    IP="$ip"     # ip
-
-    # Reading file line by line
-    line=$(cat $V_IPS/$IP)
-
-    # Parsing key=value
-    for key in $line; do
-        eval ${key%%=*}=${key#*=}
-    done
-
-    # Print result line
-    for field in $fields; do 
-        eval key="$field"
-        echo "${field//$/}: $key "
-    done
-}
-
-ip_json_list() {
-    i='1'       # iterator
-    end=$(($limit + $offset))   # last string
-
-    # Definining user list
-    ip_list=$(ls $V_IPS/)
-
-    # Print top bracket
-    echo '{'
-
-    # Starting main loop
-    for IP in $ip_list; do
-
-        # Checking offset and limit
-        if [ "$i" -ge "$offset" ] && [ "$i" -lt "$end" ] && [ "$offset" -gt 0 ]
-        then
-            # Reading user data
-            ip_data=$(cat $V_IPS/$IP)
-
-            # Parsing key/value config
-            for key in $ip_data; do
-                eval ${key%%=*}=${key#*=}
-            done
-
-            # Checking !first line to print bracket with coma
-            if [ "$i" -ne "$offset" ]; then
-                echo -e "\t},"
-            fi
-
-            # Defining local iterator and words count
-            j='1'
-            last_word=$(echo "$fields" | wc -w)
-
-            # Print data
-            for field in $fields; do
-                eval value=$field
-                # Checking parrent key
-                if [ "$j" -eq 1 ]; then
-                    echo -e "\t\"$value\": {"
-                else
-                    if [ "$j" -eq "$last_word" ]; then
-                        echo -e "\t\t\"${field//$/}\": \"${value//,/, }\""
-                    else
-                        echo -e "\t\t\"${field//$/}\": \"${value//,/, }\","
-                    fi
-                fi
-                j=$(($j + 1))
-            done
-        fi
-        i=$(($i + 1))
-    done
-
-    # If there was any output
-    if [ -n "$value" ]; then
-        echo -e "\t}"
-    fi
-
-    # Printing bottom json bracket
-    echo '}'
-}
-
-ip_shell_list() {
-    i='1'       # iterator
-    end=$(($limit + $offset))   # last string
-
-    # Definining ip list
-    ip_list=$(ls $V_IPS/)
-
-    # Print brief info
-    echo "${fields//$/}"
-    for a in $fields; do
-        echo -e "--------- \c"
-    done
-    echo    # new line
-
-    # Starting main loop
-    for IP in $ip_list; do
-        # Checking offset and limit
-        if [ "$i" -ge "$offset" ] && [ "$i" -lt "$end" ] && [ "$offset" -gt 0 ]
-        then
-            # Reading user data
-            ip_data=$(cat $V_IPS/$IP)
-
-            # Parsing key/value config
-            for key in $ip_data; do
-                eval ${key%%=*}=${key#*=}
-            done
-
-            # Print result line
-            eval echo "$fields"
-        fi
-        i=$(($i + 1))
-    done
-}
-
-ip_user_json_list() {
-    i='1'   # iterator
-    end=$(($limit + $offset))   # last string
-    user_ip=$(grep -l "OWNER='$user'" $V_IPS/*)
-    owner_ip=$(grep -l -A2 "OWNER='vesta'" $V_IPS/*|grep "STATUS='shared'"|\
-                cut -f 1 -d -)
-
-    # Definining ip list
-    ip_list=$(echo -e "$user_ip\n$owner_ip"|sort|uniq)
-
-    # Print top bracket
-    echo '{'
-
-    # Starting main loop
-    for IP in ${ip_list//$V_IPS\//}; do
-        # Checking offset and limit
-        if [ "$i" -ge "$offset" ] && [ "$i" -lt "$end" ] && [ "$offset" -gt 0 ]
-        then
-            # Reading user data
-            ip_data=$(cat $V_IPS/$IP)
-
-            # Parsing key/value config
-            for key in $ip_data; do
-                eval ${key%%=*}=${key#*=}
-            done
-
-            # Checking !first line to print bracket with coma
-            if [ "$i" -ne "$offset" ]; then
-                echo -e "\t},"
-            fi
-
-            # Defining local iterator and words count
-            j='1'
-            last_word=$(echo "$fields"| wc -w)
-
-            # Print data
-            for field in $fields; do
-                eval value=$field
-
-                # There is outpup
-                if [ ! -z "$value" ]; then
-                    tpt='yes'
-                fi
-
-                # Checking parrent key
-                if [ "$j" -eq 1 ]; then
-                    echo -e "\t\"$value\": {"
-                else
-                    if [ "$j" -eq "$last_word" ]; then
-                        echo -e "\t\t\"${field//$/}\": \"${value//,/, }\""
-                    else
-                        echo -e "\t\t\"${field//$/}\": \"${value//,/, }\","
-                    fi
-                fi
-                j=$(($j + 1))
-            done
-        fi
-        i=$(($i + 1))
-    done
-
-    # If there was any output
-    if [ -n "$tpt" ]; then
-        echo -e "\t}"
-    fi
-
-    # Printing bottom json bracket
-    echo '}'
-}
-
-ip_user_shell_list() {
-    i='1'			# iterator
-    end=$(($limit + $offset))	# last string
-    user_ip=$(grep -l "OWNER='$user'" $V_IPS/*)
-    owner_ip=$(grep -A2 "OWNER='vesta'" $V_IPS/* |grep "STATUS='shared'" |\
-                cut -f 1 -d -)
-
-    # Definining ip list
-    ip_list=$(echo -e "$user_ip\n$owner_ip"|sort|uniq)
-
-    # Print brief info
-    echo "${fields//$/}"
-    for a in $fields; do
-        echo -e "--------- \c"
-    done
-    echo    # new line
-
-    # Starting main loop
-    for IP in ${ip_list//$V_IPS\//}; do
-        # Checking offset and limit
-        if [ "$i" -ge "$offset" ] && [ "$i" -lt "$end" ] && [ "$offset" -gt 0 ]
-        then
-            # Reading user data
-            ip_data=$(cat $V_IPS/$IP)
-
-            # Parsing key/value config
-            for key in $ip_data; do
-                eval ${key%%=*}=${key#*=}
-            done
-
-            # Print result line
-            eval echo "$fields"
-        fi
-        i=$(($i + 1))
-    done
-}
-
 ip_add_vesta() {
     # Filling ip values
     ip_data="OWNER='$user'"
@@ -569,34 +303,6 @@ ip_add_startup() {
     echo -e "$ip_data" >$iconf-$iface
 }
 
-ipint_json_list() {
-    interfaces=$(cat /proc/net/dev|grep :|cut -f 1 -d :|sed -e "s/ //g")
-    int_counter=$(echo "$interfaces"|wc -l)
-    i=1
-    # Print top bracket
-    echo '['
-    # Listing servers
-    for interface in $interfaces; do
-        if [ "$i" -lt "$int_counter" ]; then
-            echo -e  "\t\"$interface\","
-        else
-            echo -e  "\t\"$interface\""
-        fi
-        i=$((i + 1))
-    done
-    echo "]"
-}
-
-ipint_shell_list() {
-    interfaces=$(cat /proc/net/dev|grep :|cut -f 1 -d :|sed -e "s/ //g")
-    # Print result
-    echo "INTERFACES"
-    echo "----------"
-    for interface in $interfaces; do
-        echo "$interface"
-    done
-}
-
 ip_owner_search(){
     for ip in $(ls $V_IPS/); do
         check_owner=$(grep "OWNER='$user'" $V_IPS/$ip)

+ 48 - 358
func/shared_func.sh

@@ -355,9 +355,7 @@ format_validation() {
             mask)               format_ip  "$v" ;;
             max_usr)            format_int "$v" ;;
             max_db)             format_int "$v" ;;
-            limit)              format_int "$v" ;;
             lname)              format_usr "$v" ;;
-            offset)             format_int "$v" ;;
             owner)              format_usr "$v" ;;
             package)            format_usr "$v" ;;
             password)           format_pwd "$v" ;;
@@ -375,7 +373,6 @@ format_validation() {
 
 # Sub system checker
 is_system_enabled() {
-
     stype="$1"
 
     web_function() {
@@ -936,301 +933,82 @@ decrease_user_value() {
     fi
 }
 
-# Json listing function
-v_json_list() {
-    # Definigng variables
-    i='1'       # iterator
-    end=$(($limit + $offset))   # last string
-    value=''    # clean start value
 
+# Json listing function
+json_list() {
     # Print top bracket
     echo '{'
 
-    # Reading file line by line
-    while read line ; do
-        # Checking offset and limit
-        if [ "$i" -ge "$offset" ] && [ "$i" -lt "$end" ] && [ "$offset" -gt 0 ]
-        then
-            # Parsing key=value
-            for key in $line; do
-                eval ${key%%=*}=${key#*=}
-            done
-
-            # Checking !first line to print bracket
-            if [ "$i" -ne "$offset" ]; then
-                echo -e "\t},"
-            fi
-
-            j=1                 # local loop iterator
-            last_word=$(echo "$fields" | wc -w)
+    # Count fields
+    fileds_count=$(echo $fields| wc -w )
 
-            # Print data
-            for field in $fields; do
-                eval value=$field
+    # Reading file line by line
+    while read line; do
 
-                # Checking if value exists
-                if [ ! -z "$value" ]; then
-                    tpt=yes
-                fi
+        # Assing key=value pair
+        for key in $line; do
+            eval ${key%%=*}=${key#*=}
+        done
 
-                # Checking parrent key
-                if [ "$j" -eq 1 ]; then
-                    echo -e "\t\"$value\": {"
+        # Closing bracket if there already was output
+        if [ -n "$data" ]; then
+            echo -e '        },'
+        fi
+        i=1
+        for field in $fields; do
+            eval value=$field
+
+            if [ $i -eq 1 ]; then
+                # Printing parrent
+                (( ++i))
+                echo -e "\t\"$value\": {"
+            else
+                # Printing child
+                if [ $i -lt $fileds_count ]; then
+                    (( ++i))
+                    echo -e "\t\t\"${field//$/}\": \"${value//,/, }\","
                 else
-                    if [ "$j" -eq "$last_word" ]; then
-                        echo -e "\t\t\"${field//$/}\": \"${value//,/, }\""
-                    else
-                        echo -e "\t\t\"${field//$/}\": \"${value//,/, }\","
-                    fi
+                    echo -e "\t\t\"${field//$/}\": \"${value//,/, }\""
+                    data=1
                 fi
-                j=$(($j + 1))
-            done
-        fi
-        i=$(($i + 1))
+            fi
+        done
     done < $conf
 
-    # If there was any output
-    if [ -n "$tpt" ]; then
-        echo -e "\t}"
+    # Closing bracket if there was output
+    if [ -n "$data" ]; then
+        echo -e '        }'
     fi
 
-    # Printing bottom json bracket
-    echo -e "}"
+    # Printing bottom bracket
+    echo -e '}'
 }
 
+
 # Shell listing function
-v_shell_list() {
-
-    # Definigng variables
-    i='1'                       # iterator
-    end=$(($limit + $offset))   # last string
-    # Print brief info
-    echo "${fields//$/}"
-    for a in $fields; do
-        echo -e "------ \c"
-    done
-    echo                        # new line
+shell_list() {
 
-    # Reading file line by line
-    while read line ; do
-        # Checking offset and limit
-        if [ "$i" -ge "$offset" ] && [ "$i" -lt "$end" ] && [ "$offset" -gt 0 ]
-        then
-            # Parsing key=value
-            for key in $line; do
-                eval ${key%%=*}=${key#*=}
-            done
-            # Print result line
-            eval echo "$fields"
-        fi
-        i=$(($i + 1))
-    done < $conf
-}
+    if [ -z "$nohead" ] ; then
+        # Print brief info
+        echo "${fields//$/}"
+        for a in $fields; do
+            echo -e "------ \c"
+        done
+        echo
+    fi
 
-# Clear listing function
-v_clear_list() {
     # Reading file line by line
     while read line ; do
-
-        # Parsing key=value
+        # Assing key=value pair
         for key in $line; do
             eval ${key%%=*}=${key#*=}
         done
 
-        # Print result line
+        # Print result
         eval echo "$fields"
-
     done < $conf
 }
 
-usr_json_single_list() {
-    # Definigng variables
-    USER="$user"        # user
-    i=1	        # iterator
-
-    # Define words number
-    last_word=$(echo "$fields" | wc -w)
-
-    # Reading file line by line
-    line=$(cat $V_USERS/$USER/user.conf)
-
-    # Print top bracket
-    echo '{'
-
-    # Parsing key=value
-    for key in $line; do
-        eval ${key%%=*}=${key#*=}
-    done
-
-    # Starting output loop
-    for field in $fields; do
-        # Parsing key=value
-        eval value=$field
-
-        # Checking first field
-        if [ "$i" -eq 1 ]; then
-            echo -e "\t\"$value\": {"
-        else
-            if [ "$last_word" -eq "$i" ]; then
-                echo -e "\t\t\"${field//$/}\": \"${value//,/, }\""
-            else
-                echo -e "\t\t\"${field//$/}\": \"${value//,/, }\","
-            fi
-        fi
-        # Updating iterator
-        i=$(( i + 1))
-    done
-
-    # If there was any output
-    if [ -n "$value" ]; then
-        echo -e "\t}"
-    fi
-    # Printing bottom json bracket
-    echo -e "}"
-}
-
-usr_shell_single_list() {
-    # Definigng variables
-    USER="$user"		# user
-
-    # Reading file line by line
-    line=$(cat $V_USERS/$USER/user.conf)
-
-    # Parsing key=value
-    for key in $line; do
-        eval ${key%%=*}=${key#*=}
-    done
-
-    # Print result line
-    for field in $fields; do 
-        eval key="$field"
-	echo "${field//$/}: $key "
-    done
-}
-
-usr_json_list() {
-    i='1'			# iterator
-    end=$(($limit + $offset))	# last string
-
-    # Definining user list
-    #user_list=$(find $V_USERS/ -maxdepth 1 -mindepth 1 -type d -printf %P\\n )
-    user_list=$(ls $V_USERS/)
-
-    # Print top bracket
-    echo '{'
-
-    # Starting main loop
-    for USER in $user_list; do
-        # Checking offset and limit
-        if [ "$i" -ge "$offset" ] && [ "$i" -lt "$end" ] && [ "$offset" -gt 0 ]
-        then
-            # Reading user data
-            user_data=$(cat $V_USERS/$USER/user.conf)
-
-            # Parsing key/value config
-            for key in $user_data; do
-                eval ${key%%=*}=${key#*=}
-            done
-
-            # Checking !first line to print bracket with coma
-            if [ "$i" -ne "$offset" ]; then
-                echo -e "\t},"
-            fi
-
-            # Defining local iterator and words count
-            j='1'
-            last_word=$(echo "$fields" | wc -w)
-
-            # Print data
-            for field in $fields; do
-                eval value=$field
-                # Checking parrent key
-                if [ "$j" -eq 1 ]; then
-                    echo -e "\t\"$value\": {"
-                else
-                    if [ "$j" -eq "$last_word" ]; then
-                        echo -e "\t\t\"${field//$/}\": \"${value//,/, }\""
-                    else
-                        echo -e "\t\t\"${field//$/}\": \"${value//,/, }\","
-                    fi
-                fi
-                j=$(($j + 1))
-            done
-        fi
-        i=$(($i + 1))
-    done
-
-    # If there was any output
-    if [ -n "$value" ]; then
-        echo -e "\t}"
-    fi
-
-    # Printing bottom json bracket
-    echo '}'
-}
-
-usr_shell_list() {
-    i='1'			# iterator
-    end=$(($limit + $offset))	# last string
-
-    # Definining user list
-    #user_list=$(find $V_USERS/ -maxdepth 1 -mindepth 1 -type d -printf %P\\n )
-    user_list=$(ls $V_USERS/)
-
-    # Print brief info
-    echo "${fields//$/}"
-    for a in $fields; do
-        echo -e "--------- \c"
-    done
-    echo			# new line
-
-    # Starting main loop
-    for USER in $user_list; do
-        # Checking offset and limit
-        if [ "$i" -ge "$offset" ] && [ "$i" -lt "$end" ] && [ "$offset" -gt 0 ]
-        then
-            # Reading user data
-            user_data=$(cat $V_USERS/$USER/user.conf)
-
-            # Parsing key/value config
-            for key in $user_data; do
-                eval ${key%%=*}=${key#*=}
-            done
-            # Print result line
-            eval echo "$fields"
-        fi
-        i=$(($i + 1))
-    done
-}
-
-usrns_json_list() {
-    ns=$(grep "^NS='" $V_USERS/$user/user.conf |cut -f 2 -d \')
-    # Print top bracket
-    echo '['
-    i=1
-    nslistc=$(echo -e "${ns//,/\n}"|wc -l)
-    # Listing servers
-    for nameserver in ${ns//,/ };do
-        if [ "$i" -ne "$nslistc" ]; then
-            echo -e  "\t\"$nameserver\","
-        else
-            echo -e  "\t\"$nameserver\""
-        fi
-        i=$((i + 1))
-    done
-
-    echo "]"
-}
-
-usrns_shell_list() {
-    ns=$(grep "^NS='" $V_USERS/$user/user.conf |cut -f 2 -d \')
-    # Print result
-    echo "NAMESERVER"
-    echo "----------"
-    for nameserver in ${ns//,/ };do
-        echo "$nameserver"
-    done
-}
 
 get_usr_disk() {
     size='0'
@@ -1290,94 +1068,6 @@ get_usr_traff() {
     echo "$size"
 }
 
-pkg_json_list() {
-    i='1'                       # iterator
-    end=$(($limit + $offset))   # last string
-
-    # Print top bracket
-    echo '{'
-
-    # Starting main loop
-    for package in $(ls $V_DATA/packages); do
-	PACKAGE=${package/.pkg/}
-
-        # Checking offset and limit
-        if [ "$i" -ge "$offset" ] && [ "$i" -lt "$end" ] && [ "$offset" -gt 0 ]
-        then
-            # Parsing key/value config
-            pkg_descr=$(cat $V_DATA/packages/$package)
-            for key in $pkg_descr; do
-                eval ${key%%=*}=${key#*=}
-            done
-
-            # Checking !first line to print bracket with coma
-            if [ "$i" -ne "$offset" ]; then
-                echo -e "\t},"
-            fi
-
-            # Defining local iterator and words count
-            j='1'
-            last_word=$(echo "$fields" | wc -w)
-
-            # Print data
-            for field in $fields; do
-                eval value=$field
-                # Checking parrent key
-                if [ "$j" -eq 1 ]; then
-                    echo -e "\t\"$value\": {"
-                else
-                    if [ "$j" -eq "$last_word" ]; then
-                        echo -e "\t\t\"${field//$/}\": \"${value//,/, }\""
-                    else
-                        echo -e "\t\t\"${field//$/}\": \"${value//,/, }\","
-                    fi
-                fi
-                j=$(($j + 1))
-            done
-        fi
-        i=$(($i + 1))
-    done
-
-    # If there was any output
-    if [ -n "$value" ]; then
-        echo -e "\t}"
-    fi
-
-    # Printing bottom json bracket
-    echo '}'
-}
-
-pkg_shell_list() {
-    i='1'                       # iterator
-    end=$(($limit + $offset))   # last string
-
-    # Listing pkg files
-    for package in $(ls $V_DATA/packages); do
-	PACKAGE=${package/.pkg/}
-
-        # Checking offset and limit
-        if [ "$i" -ge "$offset" ] && [ "$i" -lt "$end" ] && [ "$offset" -gt 0 ]
-        then
-	    # Parsing key=value
-            pkg_descr=$(cat $V_DATA/packages/$package)
-	    for key in $pkg_descr; do
-	        eval ${key%%=*}=${key#*=}
-	    done
-
-            echo "----------"
-
-	    # Starting output loop
-	    for field in $fields; do
-                # Parsing key=value
-                eval value=$field
-                # Checking first field
-                echo -e "${field//$/}: $value"
-	    done
-	fi
-        i=$(($i + 1))
-    done
-}
-
 get_config_value() {
     key="$1"
     # Parsing config