Parcourir la source

Imrovements for Softaculous App Installer

Serghey Rodin il y a 8 ans
Parent
commit
85f6d3a08f
4 fichiers modifiés avec 47 ajouts et 5 suppressions
  1. 4 2
      bin/v-add-vesta-softaculous
  2. 41 0
      bin/v-list-sys-vesta-updates
  3. 1 1
      bin/v-update-sys-vesta-all
  4. 1 2
      web/inc/main.php

+ 4 - 2
bin/v-add-vesta-softaculous

@@ -22,8 +22,10 @@ source $VESTA/conf/vesta.conf
 #----------------------------------------------------------#
 
 if [ "$TYPE" = 'WEB' ]; then
-    $BIN/v-schedule-vesta-softaculous
-    exit
+    if [ ! -e "$VESTA/softaculous" ] && [ ! -e "$VESTA/ioncube" ]; then
+        $BIN/v-schedule-vesta-softaculous
+        exit
+    fi
 else
     cmd="v-add-vesta-softaculous"
     check_cron=$(grep "$cmd" $VESTA/data/users/admin/cron.conf 2> /dev/null)

+ 41 - 0
bin/v-list-sys-vesta-updates

@@ -14,6 +14,7 @@ format=${1-shell}
 
 # Includes
 source $VESTA/func/main.sh
+source $VESTA/conf/vesta.conf
 fields="\$NAME \$VERSION \$RELEASE \$ARCH \$UPDATED \$DESCR \$TIME \$DATE"
 
 # JSON list function
@@ -123,6 +124,46 @@ data="$data\nNAME='vesta-nginx' VERSION='$VERSION' RELEASE='$RELEASE'"
 data="$data ARCH='$ARCH' UPDATED='$UPDATED' DESCR='internal web server'"
 data="$data TIME='$TIME' DATE='$DATE'"
 
+# Checking installed vesta-ioncube version
+if [ "$SOFTACULOUS" = 'yes' ]; then
+    if [ -e "/etc/redhat-release" ]; then
+        eval $(rpm --queryformat="$rpm_format" -q vesta-ioncube)
+        DATE=$(date -d @$UTIME +%F)
+        TIME=$(date -d @$UTIME +%T)
+    else
+        dpkg_data=$(dpkg-query -s vesta-ioncube)
+        pkg_date=$(stat -c "%Y" /var/lib/dpkg/info/vesta-php.list)
+        ARCH=$(echo "$dpkg_data"|grep Architecture | cut -f 2 -d ' ')
+        VERSION=$(echo "$dpkg_data"|grep ^Vers |cut -f2 -d ' '|cut -f1 -d \-)
+        RELEASE=$(echo "$dpkg_data"|grep ^Vers |cut -f2 -d ' '|cut -f2 -d \-)
+        DATE=$(date -d @$pkg_date +"%F")
+        TIME=$(date -d @$pkg_date +"%T")
+    fi
+    data="$data\nNAME='vesta-ioncube' VERSION='$VERSION' RELEASE='$RELEASE'"
+    data="$data ARCH='$ARCH' UPDATED='$UPDATED' DESCR='php encoder'"
+    data="$data TIME='$TIME' DATE='$DATE'"
+fi
+
+# Checking installed vesta-softaculous version
+if [ "$SOFTACULOUS" = 'yes' ]; then
+    if [ -e "/etc/redhat-release" ]; then
+        eval $(rpm --queryformat="$rpm_format" -q vesta-softaculous)
+        DATE=$(date -d @$UTIME +%F)
+        TIME=$(date -d @$UTIME +%T)
+    else
+        dpkg_data=$(dpkg-query -s vesta-softaculous)
+        pkg_date=$(stat -c "%Y" /var/lib/dpkg/info/vesta-php.list)
+        ARCH=$(echo "$dpkg_data"|grep Architecture | cut -f 2 -d ' ')
+        VERSION=$(echo "$dpkg_data"|grep ^Vers |cut -f2 -d ' '|cut -f1 -d \-)
+        RELEASE=$(echo "$dpkg_data"|grep ^Vers |cut -f2 -d ' '|cut -f2 -d \-)
+        DATE=$(date -d @$pkg_date +"%F")
+        TIME=$(date -d @$pkg_date +"%T")
+    fi
+    data="$data\nNAME='vesta-softaculous' VERSION='$VERSION' RELEASE='$RELEASE'"
+    data="$data ARCH='$ARCH' UPDATED='$UPDATED' DESCR='app installer'"
+    data="$data TIME='$TIME' DATE='$DATE'"
+fi
+
 
 # Listing data
 case $format in

+ 1 - 1
bin/v-update-sys-vesta-all

@@ -22,7 +22,7 @@ source $VESTA/conf/vesta.conf
 #----------------------------------------------------------#
 
 # Starting update loop
-for package in vesta vesta-nginx vesta-php; do
+for package in vesta vesta-nginx vesta-php vesta-ioncube vesta-softaculous; do
     $BIN/v-update-sys-vesta "$package"
 done
 

+ 1 - 2
web/inc/main.php

@@ -29,13 +29,12 @@ if(isset($_SERVER['HTTP_FORWARDED'])){
     $user_combined_ip .=  '|'. $_SERVER['HTTP_FORWARDED'];
 }
 
-
 if(!isset($_SESSION['user_combined_ip'])){
     $_SESSION['user_combined_ip'] = $user_combined_ip;
 }
 
 // Checking user to use session from the same IP he has been logged in
-if($_SESSION['user_combined_ip'] != $user_combined_ip){
+if($_SESSION['user_combined_ip'] != $user_combined_ip && $_SERVER['REMOTE_ADDR'] != '127.0.0.1'){
     session_destroy();
     session_start();
     $_SESSION['request_uri'] = $_SERVER['REQUEST_URI'];