diff --git a/bin/v_search_object b/bin/v_search_object index fbbf1d331..103292df2 100755 --- a/bin/v_search_object +++ b/bin/v_search_object @@ -17,6 +17,55 @@ format=${2-shell} source $VESTA/conf/vesta.conf source $VESTA/func/main.sh +# Json list function +json_list_search() { + echo '{' + fileds_count=$(echo $fields| wc -w ) + while read line; do + eval $line + if [ -n "$list_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 + (( ++i)) + echo -e "\t\"$value\": {" + else + if [ $i -lt $fileds_count ]; then + (( ++i)) + echo -e "\t\t\"${field//$/}\": \"${value//,/, }\"," + else + echo -e "\t\t\"${field//$/}\": \"${value//,/, }\"" + list_data=1 + fi + fi + done + done < $conf + if [ -n "$list_data" ]; then + echo -e ' }' + fi + echo -e '}' +} + +# Shell list function +shell_list_search() { + if [ -z "$nohead" ] ; then + echo "${fields//$/}" + for a in $fields; do + echo -e "------ \c" + done + echo + fi + while read line ; do + eval $line + eval echo "$fields" | sed -e "s/%quote%/'/g" + done < $conf +} + #----------------------------------------------------------# # Verifications # #----------------------------------------------------------# @@ -40,8 +89,11 @@ for user in $(ls $VESTA/data/users/); do search=$(grep "$object" \ $VESTA/data/users/$user/web.conf \ $VESTA/data/users/$user/dns.conf \ + $VESTA/data/users/$user/dns/*.conf \ $VESTA/data/users/$user/mail.conf \ - $VESTA/data/users/$user/db.conf) + $VESTA/data/users/$user/mail/*.conf \ + $VESTA/data/users/$user/db.conf \ + $VESTA/data/users/$user/cron.conf 2> /dev/null) for row in $search; do # Initialise variable @@ -49,22 +101,23 @@ for user in $(ls $VESTA/data/users/); do result='' dom_alias='' suspended='' - object_time='' + object_link='' + object_parent='' + object_time='' object_date='' # Parsing result - type=$(echo $row |cut -f 1 -d : |cut -f 8 -d / |cut -f 1 -d \.) + type=$(echo $row |cut -f 1 -d : |cut -f 8 -d /) data=$(echo $row |cut -f 2,3,4,5 -d :) eval "$data" # Check WEB domain - dom_alias='' - if [ "$type" = 'web' ]; then + if [ "$type" = 'web.conf' ]; then if [ -n "$(echo $DOMAIN |grep $object)" ]; then # Check domain alias - check_dom_alias="$(echo $ALIAS| tr ',' '\n' |grep $object)" - if [ ! -z "$check_dom_alias" ];then - dom_alias=$(echo $check_dom_alias | tr ' ' ',') + check_alias="$(echo $ALIAS| tr ',' '\n' |grep $object)" + if [ ! -z "$check_alias" ];then + object_alias=$(echo $check_alias | tr ' ' ',') fi key="DOMAIN" result="$DOMAIN" @@ -72,11 +125,23 @@ for user in $(ls $VESTA/data/users/); do object_time=$TIME object_date=$DATE ((i ++)) + else + check_alias="$(echo $ALIAS| tr ',' '\n' |grep $object)" + if [ ! -z "$check_alias" ];then + key="DOMAIN" + result="$DOMAIN" + object_parent="$DOMAIN" + object_alias=$(echo $check_alias | tr ' ' ',') + suspended=$SUSPENDED + object_time=$TIME + object_date=$DATE + ((i ++)) + fi fi fi # DNS - if [ "$type" = 'dns' ]; then + if [ "$type" = 'dns.conf' ]; then if [ -n "$(echo $DOMAIN |grep $object)" ]; then key="DOMAIN" result="$DOMAIN" @@ -87,8 +152,22 @@ for user in $(ls $VESTA/data/users/); do fi fi + # DNS Records + if [ "$type" = 'dns' ]; then + if [ -n "$(echo $RECORD |grep $object)" ]; then + key="RECORD" + result="$RECORD.$DOMAIN" + suspended=$SUSPENDED + object_link=$ID + object_parent=$DOMAIN + object_time=$TIME + object_date=$DATE + ((i ++)) + fi + fi + # MAIL - if [ "$type" = 'mail' ]; then + if [ "$type" = 'mail.conf' ]; then if [ -n "$(echo $DOMAIN |grep $object)" ]; then key="DOMAIN" result="$DOMAIN" @@ -99,8 +178,24 @@ for user in $(ls $VESTA/data/users/); do fi fi + # Mail Accounts + if [ "$type" = 'mail' ]; then + type='mail' + if [ -n "$(echo $ACCOUNT |grep $object)" ]; then + key="ACCOUNT" + dom="$(echo $row|cut -f 1 -d :|cut -f 9 -d /|sed -e "s/.conf//")" + result="$ACCOUNT@$dom" + suspended=$SUSPENDED + object_link=$ACCOUNT + object_parent=$dom + object_time=$TIME + object_date=$DATE + ((i ++)) + fi + fi + # DB - if [ "$type" = 'db' ]; then + if [ "$type" = 'db.conf' ]; then if [ -n "$(echo $DB |grep $object)" ]; then key="DATABASE" result="$DB" @@ -111,10 +206,26 @@ for user in $(ls $VESTA/data/users/); do fi fi + # Cron Jobs + if [ "$type" = 'cron.conf' ]; then + if [ -n "$(echo $CMD |grep $object)" ]; then + key="JOB" + result="$CMD" + suspended=$SUSPENDED + object_link=$JOB + object_parent=$JOB + object_time=$TIME + object_date=$DATE + ((i ++)) + fi + fi + if [ ! -z "$result" ]; then + type=$(echo $type|cut -f1 -d \.) str="ID='$i' USER='$user' TYPE='$type' KEY='$key'" str="$str RESULT='$result' ALIAS='$dom_alias'" - str="$str SUSPENDED='$suspended' TIME='$object_time'" + str="$str LINK='$object_link' PARENT='$object_parent'" + str="$str SUSPENDED='$suspended' TIME='$object_time'" str="$str DATE='$object_date'" echo $str >> $conf fi @@ -123,14 +234,16 @@ done IFS=$OLD_IFS # Defining fileds to select -fields='$ID $USER $TYPE $KEY $RESULT $ALIAS $SUSPENDED $TIME $DATE' +fields='$ID $USER $TYPE $KEY $RESULT $ALIAS $LINK $PARENT $SUSPENDED $TIME' +fields="$fields \$DATE" # Listing domains -case $format in - json) json_list ;; - plain) nohead=1; shell_list ;; - shell) fields='$USER $TYPE $KEY $RESULT $ALIAS'; shell_list |column -t;; - *) check_args '2' '0' 'object [format]' +case $format in + json) json_list_search ;; + plain) nohead=1; shell_list_search ;; + shell) fields='$USER~$TYPE~$KEY~$RESULT~$ALIAS'; + shell_list |column -t -s '~' ;; + *) check_args '1' '0' 'object [format]' esac rm $conf diff --git a/bin/v_search_user_object b/bin/v_search_user_object new file mode 100755 index 000000000..13666c0dc --- /dev/null +++ b/bin/v_search_user_object @@ -0,0 +1,258 @@ +#!/bin/bash +# info: search objects +# options: user object [format] +# +# The function that allows to find user objects. + + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user=$1 +object=$2 +format=${3-shell} + +# Includes +source $VESTA/conf/vesta.conf +source $VESTA/func/main.sh + +# Json list function +json_list_search() { + echo '{' + fileds_count=$(echo $fields| wc -w ) + while read line; do + eval $line + if [ -n "$list_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 + (( ++i)) + echo -e "\t\"$value\": {" + else + if [ $i -lt $fileds_count ]; then + (( ++i)) + echo -e "\t\t\"${field//$/}\": \"${value//,/, }\"," + else + echo -e "\t\t\"${field//$/}\": \"${value//,/, }\"" + list_data=1 + fi + fi + done + done < $conf + if [ -n "$list_data" ]; then + echo -e ' }' + fi + echo -e '}' +} + +# Shell list function +shell_list_search() { + if [ -z "$nohead" ] ; then + echo "${fields//$/}" + for a in $fields; do + echo -e "------ \c" + done + echo + fi + while read line ; do + eval $line + eval echo "$fields" | sed -e "s/%quote%/'/g" + done < $conf +} + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +check_args '2' "$#" 'user object [format]' +validate_format 'user' 'object' +is_object_valid 'user' 'USER' "$user" + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +conf=$(mktemp) +i=0 +OLD_IFS=$IFS +IFS=$'\n' + +# Search query +search=$(grep "$object" \ + $VESTA/data/users/$user/web.conf \ + $VESTA/data/users/$user/dns.conf \ + $VESTA/data/users/$user/dns/*.conf \ + $VESTA/data/users/$user/mail.conf \ + $VESTA/data/users/$user/mail/*.conf \ + $VESTA/data/users/$user/db.conf \ + $VESTA/data/users/$user/cron.conf 2> /dev/null) + +for row in $search; do + # Initialise variable + key='' + result='' + dom_alias='' + suspended='' + object_link='' + object_parent='' + object_time='' + object_date='' + + # Parsing result + type=$(echo $row |cut -f 1 -d : |cut -f 8 -d /) + data=$(echo $row |cut -f 2,3,4,5 -d :) + eval "$data" + + # Check WEB domain + if [ "$type" = 'web.conf' ]; then + if [ -n "$(echo $DOMAIN |grep $object)" ]; then + # Check domain alias + check_alias="$(echo $ALIAS| tr ',' '\n' |grep $object)" + if [ ! -z "$check_alias" ];then + object_alias=$(echo $check_alias | tr ' ' ',') + fi + key="DOMAIN" + result="$DOMAIN" + suspended=$SUSPENDED + object_time=$TIME + object_date=$DATE + ((i ++)) + else + check_alias="$(echo $ALIAS| tr ',' '\n' |grep $object)" + if [ ! -z "$check_alias" ];then + key="DOMAIN" + result="$DOMAIN" + object_parent="$DOMAIN" + object_alias=$(echo $check_alias | tr ' ' ',') + suspended=$SUSPENDED + object_time=$TIME + object_date=$DATE + ((i ++)) + fi + fi + fi + + # DNS + if [ "$type" = 'dns.conf' ]; then + if [ -n "$(echo $DOMAIN |grep $object)" ]; then + key="DOMAIN" + result="$DOMAIN" + suspended=$SUSPENDED + object_time=$TIME + object_date=$DATE + ((i ++)) + fi + fi + + # DNS Records + if [ "$type" = 'dns' ]; then + if [ -n "$(echo $RECORD |grep $object)" ]; then + key="RECORD" + result="$RECORD.$DOMAIN" + suspended=$SUSPENDED + object_link=$ID + object_parent=$DOMAIN + object_time=$TIME + object_date=$DATE + ((i ++)) + fi + fi + + # MAIL + if [ "$type" = 'mail.conf' ]; then + if [ -n "$(echo $DOMAIN |grep $object)" ]; then + key="DOMAIN" + result="$DOMAIN" + suspended=$SUSPENDED + object_time=$TIME + object_date=$DATE + ((i ++)) + fi + fi + + # Mail Accounts + if [ "$type" = 'mail' ]; then + type='mail' + if [ -n "$(echo $ACCOUNT |grep $object)" ]; then + key="ACCOUNT" + dom="$(echo $row|cut -f 1 -d :|cut -f 9 -d /|sed -e "s/.conf//")" + result="$ACCOUNT@$dom" + suspended=$SUSPENDED + object_link=$ACCOUNT + object_parent=$dom + object_time=$TIME + object_date=$DATE + ((i ++)) + fi + fi + + # DB + if [ "$type" = 'db.conf' ]; then + if [ -n "$(echo $DB |grep $object)" ]; then + key="DATABASE" + result="$DB" + suspended=$SUSPENDED + object_time=$TIME + object_date=$DATE + ((i ++)) + fi + fi + + # Cron Jobs + if [ "$type" = 'cron.conf' ]; then + if [ -n "$(echo $CMD |grep $object)" ]; then + key="JOB" + result="$CMD" + suspended=$SUSPENDED + object_link=$JOB + object_parent=$JOB + object_time=$TIME + object_date=$DATE + ((i ++)) + fi + fi + + if [ ! -z "$result" ]; then + type=$(echo $type|cut -f1 -d \.) + str="ID='$i' USER='$user' TYPE='$type' KEY='$key'" + str="$str RESULT='$result' ALIAS='$dom_alias'" + str="$str LINK='$object_link' PARENT='$object_parent'" + str="$str SUSPENDED='$suspended' TIME='$object_time'" + str="$str DATE='$object_date'" + echo $str >> $conf + fi +done + +IFS=$OLD_IFS + +# Defining fileds to select +fields='$ID $USER $TYPE $KEY $RESULT $ALIAS $LINK $PARENT $SUSPENDED $TIME' +fields="$fields \$DATE" + +# Listing domains +case $format in + json) json_list_search ;; + plain) nohead=1; shell_list_search ;; + shell) fields='$USER~$TYPE~$KEY~$RESULT~$ALIAS'; + shell_list |column -t -s '~' ;; + *) check_args '2' '0' 'user object [format]' +esac + +rm $conf + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Logging +#log_event "$OK" "$EVENT" + +exit diff --git a/func/main.sh b/func/main.sh index 50a1636b9..f68d33835 100755 --- a/func/main.sh +++ b/func/main.sh @@ -178,16 +178,16 @@ is_object_free() { is_object_valid() { if [ $2 = 'USER' ]; then if [ -d "$VESTA/data/users/$user" ]; then - object="OK" + sobject="OK" fi else if [ $2 = 'DBHOST' ]; then - object=$(grep "HOST='$host'" $VESTA/conf/$type.conf) + sobject=$(grep "HOST='$host'" $VESTA/conf/$type.conf) else - object=$(grep "$2='$3'" $VESTA/data/users/$user/$1.conf) + sobject=$(grep "$2='$3'" $VESTA/data/users/$user/$1.conf) fi fi - if [ -z "$object" ]; then + if [ -z "$sobject" ]; then echo "Error: $3 not exist" log_event "$E_NOTEXIST" "$EVENT" exit $E_NOTEXIST diff --git a/web/delete/backup/index.php b/web/delete/backup/index.php index f701276a8..b082d17bd 100644 --- a/web/delete/backup/index.php +++ b/web/delete/backup/index.php @@ -24,10 +24,11 @@ include($_SERVER['DOCUMENT_ROOT']."/inc/main.php"); //} -$back=getenv("HTTP_REFERER"); +$back = $_SESSION['back']; if (!empty($back)) { header("Location: ".$back); exit; } + header("Location: /list/backup/"); exit; diff --git a/web/delete/cron/index.php b/web/delete/cron/index.php index f8cfe5365..57ddd9211 100644 --- a/web/delete/cron/index.php +++ b/web/delete/cron/index.php @@ -24,10 +24,11 @@ include($_SERVER['DOCUMENT_ROOT']."/inc/main.php"); //} -$back=getenv("HTTP_REFERER"); +$back = $_SESSION['back']; if (!empty($back)) { header("Location: ".$back); exit; } + header("Location: /list/cron/"); exit; diff --git a/web/delete/db/index.php b/web/delete/db/index.php index 3d0ad8385..1ee1aaba0 100644 --- a/web/delete/db/index.php +++ b/web/delete/db/index.php @@ -24,10 +24,11 @@ include($_SERVER['DOCUMENT_ROOT']."/inc/main.php"); //} -$back=getenv("HTTP_REFERER"); +$back = $_SESSION['back']; if (!empty($back)) { header("Location: ".$back); exit; } + header("Location: /list/db/"); exit; diff --git a/web/delete/dns/index.php b/web/delete/dns/index.php index 1d4e35af3..27717b34b 100644 --- a/web/delete/dns/index.php +++ b/web/delete/dns/index.php @@ -21,7 +21,8 @@ include($_SERVER['DOCUMENT_ROOT']."/inc/main.php"); $_SESSION['error_msg'] = $error; } unset($output); - $back=getenv("HTTP_REFERER"); + + $back = $_SESSION['back']; if (!empty($back)) { header("Location: ".$back); exit; @@ -42,20 +43,21 @@ include($_SERVER['DOCUMENT_ROOT']."/inc/main.php"); $_SESSION['error_msg'] = $error; } unset($output); - $back=getenv("HTTP_REFERER"); + $back = $_SESSION['back']; if (!empty($back)) { header("Location: ".$back); exit; - } + } header("Location: /list/dns/?domain=".$_GET['domain']); exit; } //} -$back=getenv("HTTP_REFERER"); +$back = $_SESSION['back']; if (!empty($back)) { header("Location: ".$back); exit; } + header("Location: /list/dns/"); exit; diff --git a/web/delete/ip/index.php b/web/delete/ip/index.php index e088e6592..aa4c8560b 100644 --- a/web/delete/ip/index.php +++ b/web/delete/ip/index.php @@ -19,10 +19,11 @@ if ($_SESSION['user'] == 'admin') { } -$back=getenv("HTTP_REFERER"); +$back = $_SESSION['back']; if (!empty($back)) { header("Location: ".$back); exit; } + header("Location: /list/ip/"); exit; diff --git a/web/delete/mail/index.php b/web/delete/mail/index.php index ff429c858..5969cf2ef 100644 --- a/web/delete/mail/index.php +++ b/web/delete/mail/index.php @@ -21,7 +21,7 @@ include($_SERVER['DOCUMENT_ROOT']."/inc/main.php"); $_SESSION['error_msg'] = $error; } unset($output); - $back=getenv("HTTP_REFERER"); + $back = $_SESSION['back']; if (!empty($back)) { header("Location: ".$back); exit; @@ -42,20 +42,21 @@ include($_SERVER['DOCUMENT_ROOT']."/inc/main.php"); $_SESSION['error_msg'] = $error; } unset($output); - $back=getenv("HTTP_REFERER"); + $back = $_SESSION['back']; if (!empty($back)) { - header("Location: ".$back); + header("Location: ".$back); exit; - } + } header("Location: /list/mail/?domain=".$_GET['domain']); exit; } //} -$back=getenv("HTTP_REFERER"); +$back = $_SESSION['back']; if (!empty($back)) { header("Location: ".$back); exit; } + header("Location: /list/mail/"); exit; diff --git a/web/delete/package/index.php b/web/delete/package/index.php index 57d27a692..f284ce272 100644 --- a/web/delete/package/index.php +++ b/web/delete/package/index.php @@ -18,10 +18,11 @@ if ($_SESSION['user'] == 'admin') { unset($output); } -$back=getenv("HTTP_REFERER"); +$back = $_SESSION['back']; if (!empty($back)) { header("Location: ".$back); exit; } + header("Location: /list/package/"); exit; diff --git a/web/delete/user/index.php b/web/delete/user/index.php index 338b5f548..ffac38a2a 100644 --- a/web/delete/user/index.php +++ b/web/delete/user/index.php @@ -18,10 +18,11 @@ if ($_SESSION['user'] == 'admin') { unset($output); } -$back=getenv("HTTP_REFERER"); +$back = $_SESSION['back']; if (!empty($back)) { header("Location: ".$back); exit; } + header("Location: /list/user/"); exit; diff --git a/web/delete/web/index.php b/web/delete/web/index.php index 574258259..10c3516d3 100644 --- a/web/delete/web/index.php +++ b/web/delete/web/index.php @@ -50,10 +50,11 @@ if (!empty($_GET['domain'])) { } } -$back=getenv("HTTP_REFERER"); +$back = $_SESSION['back']; if (!empty($back)) { header("Location: ".$back); exit; } + header("Location: /list/web/"); exit; diff --git a/web/edit/cron/index.php b/web/edit/cron/index.php index f58e485c4..d2e848fd6 100644 --- a/web/edit/cron/index.php +++ b/web/edit/cron/index.php @@ -13,8 +13,10 @@ include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html'); // Panel top_panel($user,$TAB); -// Are you admin? -//if ($_SESSION['user'] == 'admin') { + // Edit as someone else? + if (($_SESSION['user'] == 'admin') && (!empty($_GET['user']))) { + $user=escapeshellarg($_GET['user']); + } // Check user argument? if (empty($_GET['job'])) { diff --git a/web/list/backup/index.php b/web/list/backup/index.php index 38cc060dc..09c25235e 100644 --- a/web/list/backup/index.php +++ b/web/list/backup/index.php @@ -3,6 +3,7 @@ error_reporting(NULL); session_start(); $TAB = 'BACKUP'; +$_SESSION['back'] = $_SERVER['REQUEST_URI']; include($_SERVER['DOCUMENT_ROOT']."/inc/main.php"); // Header diff --git a/web/list/cron/index.php b/web/list/cron/index.php index 6d8a32aef..3a8fccc31 100644 --- a/web/list/cron/index.php +++ b/web/list/cron/index.php @@ -3,6 +3,7 @@ error_reporting(NULL); session_start(); $TAB = 'CRON'; +$_SESSION['back'] = $_SERVER['REQUEST_URI']; include($_SERVER['DOCUMENT_ROOT']."/inc/main.php"); // Header @@ -19,7 +20,6 @@ if ($_SESSION['user'] == 'admin') { unset($output); include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/list_cron.html'); } else { - exec (VESTA_CMD."v_list_cron_jobs $user json", $output, $return_var); $data = json_decode(implode('', $output), true); $data = array_reverse($data); diff --git a/web/list/db/index.php b/web/list/db/index.php index e60a37d55..34e19b24f 100644 --- a/web/list/db/index.php +++ b/web/list/db/index.php @@ -3,6 +3,7 @@ error_reporting(NULL); session_start(); $TAB = 'DB'; +$_SESSION['back'] = $_SERVER['REQUEST_URI']; include($_SERVER['DOCUMENT_ROOT']."/inc/main.php"); // Header diff --git a/web/list/dns/index.php b/web/list/dns/index.php index 46ab3cd58..4128e1f64 100644 --- a/web/list/dns/index.php +++ b/web/list/dns/index.php @@ -3,6 +3,7 @@ error_reporting(NULL); session_start(); $TAB = 'DNS'; +$_SESSION['back'] = $_SERVER['REQUEST_URI']; include($_SERVER['DOCUMENT_ROOT']."/inc/main.php"); // Header @@ -13,7 +14,6 @@ top_panel($user,$TAB); // Data if ($_SESSION['user'] == 'admin') { - if (empty($_GET['domain'])){ exec (VESTA_CMD."v_list_dns_domains $user json", $output, $return_var); $data = json_decode(implode('', $output), true); diff --git a/web/list/ip/index.php b/web/list/ip/index.php index 9d0b30ca0..ed9692212 100644 --- a/web/list/ip/index.php +++ b/web/list/ip/index.php @@ -3,10 +3,9 @@ error_reporting(NULL); session_start(); $TAB = 'IP'; - +$_SESSION['back'] = $_SERVER['REQUEST_URI']; include($_SERVER['DOCUMENT_ROOT']."/inc/main.php"); - // Header include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html'); diff --git a/web/list/mail/index.php b/web/list/mail/index.php index add148b12..a6a1f1d32 100644 --- a/web/list/mail/index.php +++ b/web/list/mail/index.php @@ -3,6 +3,7 @@ error_reporting(NULL); session_start(); $TAB = 'MAIL'; +$_SESSION['back'] = $_SERVER['REQUEST_URI']; include($_SERVER['DOCUMENT_ROOT']."/inc/main.php"); // Header @@ -28,7 +29,6 @@ if ($_SESSION['user'] == 'admin') { include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/list_mail_acc.html'); } } else { - if (empty($_GET['domain'])){ exec (VESTA_CMD."v_list_mail_domains $user json", $output, $return_var); $data = json_decode(implode('', $output), true); diff --git a/web/list/package/index.php b/web/list/package/index.php index 51b5ec4fb..ea938cc5a 100644 --- a/web/list/package/index.php +++ b/web/list/package/index.php @@ -3,6 +3,7 @@ error_reporting(NULL); session_start(); $TAB = 'PACKAGE'; +$_SESSION['back'] = $_SERVER['REQUEST_URI']; include($_SERVER['DOCUMENT_ROOT']."/inc/main.php"); // Header diff --git a/web/list/rrd/index.php b/web/list/rrd/index.php index 6c2c10a30..d91e5a1d7 100644 --- a/web/list/rrd/index.php +++ b/web/list/rrd/index.php @@ -3,6 +3,7 @@ error_reporting(NULL); session_start(); $TAB = 'RRD'; +$_SESSION['back'] = $_SERVER['REQUEST_URI']; include($_SERVER['DOCUMENT_ROOT']."/inc/main.php"); // Header diff --git a/web/list/stats/index.php b/web/list/stats/index.php index 40b5de1b1..b9f5074d9 100644 --- a/web/list/stats/index.php +++ b/web/list/stats/index.php @@ -3,6 +3,7 @@ error_reporting(NULL); session_start(); $TAB = 'STATS'; +$_SESSION['back'] = $_SERVER['REQUEST_URI']; include($_SERVER['DOCUMENT_ROOT']."/inc/main.php"); // Header diff --git a/web/list/user/index.php b/web/list/user/index.php index 9e532d762..ca8405617 100644 --- a/web/list/user/index.php +++ b/web/list/user/index.php @@ -3,9 +3,8 @@ // Init error_reporting(NULL); session_start(); +$_SESSION['back'] = $_SERVER['REQUEST_URI']; $TAB = 'USER'; - -// Inlcude functions include($_SERVER['DOCUMENT_ROOT']."/inc/main.php"); // Header diff --git a/web/list/web/index.php b/web/list/web/index.php index 30876a7a0..876680f58 100644 --- a/web/list/web/index.php +++ b/web/list/web/index.php @@ -3,6 +3,7 @@ error_reporting(NULL); session_start(); $TAB = 'WEB'; +$_SESSION['back'] = $_SERVER['REQUEST_URI']; include($_SERVER['DOCUMENT_ROOT']."/inc/main.php"); // Header diff --git a/web/search/index.php b/web/search/index.php index 5cfa01bcf..76b827fa1 100644 --- a/web/search/index.php +++ b/web/search/index.php @@ -3,6 +3,7 @@ error_reporting(NULL); session_start(); $TAB = 'SEARCH'; +$_SESSION['back'] = $_SERVER['REQUEST_URI']; include($_SERVER['DOCUMENT_ROOT']."/inc/main.php"); // Check query @@ -30,9 +31,9 @@ if ($_SESSION['user'] == 'admin') { $data = json_decode(implode('', $output), true); include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/list_search.html'); } else { - exec (VESTA_CMD."v_list_web_domains $user json", $output, $return_var); + exec (VESTA_CMD."v_search_user_object ".$user." ".$q." json", $output, $return_var); $data = json_decode(implode('', $output), true); - include($_SERVER['DOCUMENT_ROOT'].'/templates/user/list_web.html'); + include($_SERVER['DOCUMENT_ROOT'].'/templates/user/list_search.html'); } // Footer diff --git a/web/suspend/cron/index.php b/web/suspend/cron/index.php index 6da9be5ac..36cb9cd9a 100644 --- a/web/suspend/cron/index.php +++ b/web/suspend/cron/index.php @@ -22,10 +22,11 @@ if ($_SESSION['user'] == 'admin') { unset($output); } -$back=getenv("HTTP_REFERER"); +$back = $_SESSION['back']; if (!empty($back)) { header("Location: ".$back); exit; } + header("Location: /list/cron/"); exit; diff --git a/web/suspend/db/index.php b/web/suspend/db/index.php index ef2ad270c..933878799 100644 --- a/web/suspend/db/index.php +++ b/web/suspend/db/index.php @@ -24,10 +24,11 @@ if ($_SESSION['user'] == 'admin') { } -$back=getenv("HTTP_REFERER"); +$back = $_SESSION['back']; if (!empty($back)) { header("Location: ".$back); exit; } + header("Location: /list/db/"); exit; diff --git a/web/suspend/dns/index.php b/web/suspend/dns/index.php index 8fbef2ac3..74f1347e9 100644 --- a/web/suspend/dns/index.php +++ b/web/suspend/dns/index.php @@ -21,7 +21,7 @@ if ($_SESSION['user'] == 'admin') { $_SESSION['error_msg'] = $error; } unset($output); - $back=getenv("HTTP_REFERER"); + $back = $_SESSION['back']; if (!empty($back)) { header("Location: ".$back); exit; @@ -42,7 +42,7 @@ if ($_SESSION['user'] == 'admin') { $_SESSION['error_msg'] = $error; } unset($output); - $back=getenv("HTTP_REFERER"); + $back = $_SESSION['back']; if (!empty($back)) { header("Location: ".$back); exit; @@ -53,10 +53,11 @@ if ($_SESSION['user'] == 'admin') { } } -$back=getenv("HTTP_REFERER"); +$back = $_SESSION['back']; if (!empty($back)) { header("Location: ".$back); exit; } + header("Location: /list/dns/"); exit; diff --git a/web/suspend/mail/index.php b/web/suspend/mail/index.php index 65caf70eb..eeaba79d2 100644 --- a/web/suspend/mail/index.php +++ b/web/suspend/mail/index.php @@ -42,17 +42,17 @@ if ($_SESSION['user'] == 'admin') { $_SESSION['error_msg'] = $error; } unset($output); - $back=getenv("HTTP_REFERER"); - if (!empty($back)) { + $back = $_SESSION['back']; + if (!empty($back)) { header("Location: ".$back); exit; - } + } header("Location: /list/mail/?domain=".$_GET['domain']); exit; } } -$back=getenv("HTTP_REFERER"); +$back = $_SESSION['back']; if (!empty($back)) { header("Location: ".$back); exit; diff --git a/web/suspend/user/index.php b/web/suspend/user/index.php index 29a905d95..cc13ef0a0 100644 --- a/web/suspend/user/index.php +++ b/web/suspend/user/index.php @@ -20,10 +20,11 @@ if ($_SESSION['user'] == 'admin') { } -$back=getenv("HTTP_REFERER"); +$back = $_SESSION['back']; if (!empty($back)) { header("Location: ".$back); exit; } + header("Location: /list/user/"); exit; diff --git a/web/suspend/web/index.php b/web/suspend/web/index.php index b99fc1325..23c702697 100644 --- a/web/suspend/web/index.php +++ b/web/suspend/web/index.php @@ -23,10 +23,11 @@ if ($_SESSION['user'] == 'admin') { unset($output); } -$back=getenv("HTTP_REFERER"); +$back = $_SESSION['back']; if (!empty($back)) { header("Location: ".$back); exit; } + header("Location: /list/web/"); exit; diff --git a/web/templates/admin/add_cron.html b/web/templates/admin/add_cron.html index da7c6acdc..2a81990a6 100644 --- a/web/templates/admin/add_cron.html +++ b/web/templates/admin/add_cron.html @@ -1,11 +1,11 @@ + ?> diff --git a/web/templates/admin/add_db.html b/web/templates/admin/add_db.html index 2264b2d8c..e9361663d 100644 --- a/web/templates/admin/add_db.html +++ b/web/templates/admin/add_db.html @@ -1,11 +1,11 @@ + ?> diff --git a/web/templates/admin/add_dns.html b/web/templates/admin/add_dns.html index 2ebb32464..607cacb91 100644 --- a/web/templates/admin/add_dns.html +++ b/web/templates/admin/add_dns.html @@ -1,11 +1,11 @@ + ?> diff --git a/web/templates/admin/add_dns_rec.html b/web/templates/admin/add_dns_rec.html index 012ee32d5..ce8d8f903 100644 --- a/web/templates/admin/add_dns_rec.html +++ b/web/templates/admin/add_dns_rec.html @@ -1,11 +1,11 @@ + ?> diff --git a/web/templates/admin/add_ip.html b/web/templates/admin/add_ip.html index ea6ef1da6..cad81ed70 100644 --- a/web/templates/admin/add_ip.html +++ b/web/templates/admin/add_ip.html @@ -1,11 +1,11 @@ + ?> diff --git a/web/templates/admin/add_mail.html b/web/templates/admin/add_mail.html index 77aafe2c0..b2f3f432b 100644 --- a/web/templates/admin/add_mail.html +++ b/web/templates/admin/add_mail.html @@ -1,11 +1,11 @@ + ?> diff --git a/web/templates/admin/add_mail_acc.html b/web/templates/admin/add_mail_acc.html index 05b022a38..b5310ec4c 100644 --- a/web/templates/admin/add_mail_acc.html +++ b/web/templates/admin/add_mail_acc.html @@ -1,11 +1,11 @@ + ?> diff --git a/web/templates/admin/add_package.html b/web/templates/admin/add_package.html index 9a78f109c..57dc127fd 100644 --- a/web/templates/admin/add_package.html +++ b/web/templates/admin/add_package.html @@ -1,11 +1,11 @@ + ?> diff --git a/web/templates/admin/add_user.html b/web/templates/admin/add_user.html index 090fd6cf5..82b269d4b 100644 --- a/web/templates/admin/add_user.html +++ b/web/templates/admin/add_user.html @@ -1,11 +1,11 @@ + ?> diff --git a/web/templates/admin/add_web.html b/web/templates/admin/add_web.html index 7654098dc..91d1447fd 100644 --- a/web/templates/admin/add_web.html +++ b/web/templates/admin/add_web.html @@ -1,11 +1,11 @@ + ?> diff --git a/web/templates/admin/edit_cron.html b/web/templates/admin/edit_cron.html index aefdbb335..4f1cfc0e3 100644 --- a/web/templates/admin/edit_cron.html +++ b/web/templates/admin/edit_cron.html @@ -1,9 +1,9 @@ diff --git a/web/templates/admin/edit_db.html b/web/templates/admin/edit_db.html index d790a955e..3718e1a7d 100644 --- a/web/templates/admin/edit_db.html +++ b/web/templates/admin/edit_db.html @@ -1,11 +1,11 @@ + ?> diff --git a/web/templates/admin/edit_dns.html b/web/templates/admin/edit_dns.html index 952a496e8..2c3535403 100644 --- a/web/templates/admin/edit_dns.html +++ b/web/templates/admin/edit_dns.html @@ -1,11 +1,11 @@ + ?> diff --git a/web/templates/admin/edit_dns_rec.html b/web/templates/admin/edit_dns_rec.html index 2f22346a3..efe9b09bf 100644 --- a/web/templates/admin/edit_dns_rec.html +++ b/web/templates/admin/edit_dns_rec.html @@ -1,11 +1,11 @@ + ?> diff --git a/web/templates/admin/edit_ip.html b/web/templates/admin/edit_ip.html index 49a5fdfa4..548e24475 100644 --- a/web/templates/admin/edit_ip.html +++ b/web/templates/admin/edit_ip.html @@ -1,11 +1,11 @@ + ?> diff --git a/web/templates/admin/edit_mail.html b/web/templates/admin/edit_mail.html index b971d78eb..6d9563a20 100644 --- a/web/templates/admin/edit_mail.html +++ b/web/templates/admin/edit_mail.html @@ -1,11 +1,11 @@ + ?> diff --git a/web/templates/admin/edit_mail_acc.html b/web/templates/admin/edit_mail_acc.html index 8e7885634..15e3c9b53 100644 --- a/web/templates/admin/edit_mail_acc.html +++ b/web/templates/admin/edit_mail_acc.html @@ -1,11 +1,11 @@ + ?> diff --git a/web/templates/admin/edit_user.html b/web/templates/admin/edit_user.html index fc1969c55..9b17c3856 100644 --- a/web/templates/admin/edit_user.html +++ b/web/templates/admin/edit_user.html @@ -1,11 +1,11 @@ + ?> diff --git a/web/templates/admin/edit_web.html b/web/templates/admin/edit_web.html index 200cfd3d2..a8b3cf82f 100644 --- a/web/templates/admin/edit_web.html +++ b/web/templates/admin/edit_web.html @@ -1,11 +1,11 @@ + ?> diff --git a/web/templates/admin/list_log.html b/web/templates/admin/list_log.html index 028430412..f695d15c2 100644 --- a/web/templates/admin/list_log.html +++ b/web/templates/admin/list_log.html @@ -28,8 +28,8 @@