Просмотр исходного кода

Obsolute code

Addditional code related to this function
Jaap Marcus 5 лет назад
Родитель
Сommit
d5aef5c9c9

+ 0 - 125
bin/v-add-user-favourites

@@ -1,125 +0,0 @@
-#!/bin/bash
-# info: adding user favourites
-# options: USER SYSTEM OBJECT
-#
-# The function adds object to users favourites
-
-
-#----------------------------------------------------------#
-#                    Variable&Function                     #
-#----------------------------------------------------------#
-
-# Argument definition
-user=$1
-system=$(echo "$2" |tr '[:lower:]' '[:upper:]')
-object=$3
-email=$3
-id=$3
-
-# Includes
-source $HESTIA/func/main.sh
-source $HESTIA/conf/hestia.conf
-
-
-#----------------------------------------------------------#
-#                    Verifications                         #
-#----------------------------------------------------------#
-
-check_args '3' "$#" 'USER SYSTEM OBJECT'
-is_format_valid 'user' 'system'
-case $system in 
-    MAIL_ACC)   is_format_valid 'email' ;;
-    CRON)       is_format_valid 'id' ;;
-    DNS_REC)    is_format_valid 'id' ;;
-    *)          is_format_valid 'object'
-esac
-is_object_valid 'user' 'USER' "$user"
-is_object_unsuspended 'user' 'USER' "$user"
-
-# Checking system
-case $system in
-    USER)       check='ok' ;;
-    WEB)        check='ok' ;;
-    DNS)        check='ok' ;;
-    DNS_REC)    check='ok' ;;
-    MAIL)       check='ok' ;;
-    MAIL_ACC)   check='ok' ;;
-    DB)         check='ok' ;;
-    CRON)       check='ok' ;;
-    BACKUP)     check='ok' ;;
-    IP)         check='ok' ;;
-    PACKAGE)    check='ok' ;;
-    FIREWALL)   check='ok' ;;
-    *)      check_args '2' '0' 'USER SYSTEM OBJECT'
-esac
-
-
-#----------------------------------------------------------#
-#                       Action                             #
-#----------------------------------------------------------#
-
-# Flushing vars
-USER=''
-WEB=''
-DNS=''
-DNS_REC=''
-MAIL=''
-MAIL_ACC=''
-DB=''
-CRON=''
-BACKUP=''
-IP=''
-PACKAGE=''
-FIREWALL=''
-
-# Creating config just in case
-touch $USER_DATA/favourites.conf
-
-# Reading current values
-source $USER_DATA/favourites.conf
-
-# Assigning current system value
-eval value=\$$system
-
-# Checking if object is new
-check_fav=$(echo "$value" |tr ',' '\n'| grep "^$object$")
-if [ ! -z "$check_fav" ]; then
-    exit 0
-fi
-
-# Adding object to favorites
-if [ -z "$value" ]; then
-    value="$object"
-else
-    value="$value,$object"
-fi
-
-# Updating sytem
-eval $system=$value
-
-# Updating user favorites
-echo "USER='$USER'
-WEB='$WEB'
-DNS='$DNS'
-DNS_REC='$DNS_REC'
-MAIL='$MAIL'
-MAIL_ACC='$MAIL_ACC'
-DB='$DB'
-CRON='$CRON'
-BACKUP='$BACKUP'
-IP='$IP'
-PACKAGE='$PACKAGE'
-FIREWALL='$FIREWALL'" > $USER_DATA/favourites.conf
-
-# Changing file permission
-chmod 640 $USER_DATA/favourites.conf
-
-#----------------------------------------------------------#
-#                       Hestia                             #
-#----------------------------------------------------------#
-
-# Logging
-log_history "added starred $object in $system listing"
-log_event "$OK" "$ARGUMENTS"
-
-exit

+ 0 - 128
bin/v-delete-user-favourites

@@ -1,128 +0,0 @@
-#!/bin/bash
-# info: deleting user favourites
-# options: USER SYSTEM OBJECT
-#
-# The function deletes object from users favourites
-
-
-#----------------------------------------------------------#
-#                    Variable&Function                     #
-#----------------------------------------------------------#
-
-# Argument definition
-user=$1
-system=$(echo "$2" |tr '[:lower:]' '[:upper:]')
-object=$3
-email=$3
-id=$3
-
-# Includes
-source $HESTIA/func/main.sh
-source $HESTIA/conf/hestia.conf
-
-
-#----------------------------------------------------------#
-#                    Verifications                         #
-#----------------------------------------------------------#
-
-check_args '3' "$#" 'USER SYSTEM OBJECT'
-case $system in 
-    MAIL_ACC)   is_format_valid 'email' ;;
-    CRON)       is_format_valid 'id' ;;
-    DNS_REC)    is_format_valid 'id' ;;
-    *)          is_format_valid 'object'
-esac
-is_format_valid 'user'
-is_object_valid 'user' 'USER' "$user"
-is_object_unsuspended 'user' 'USER' "$user"
-
-# Checking system
-case $system in
-    USER)       check='ok' ;;
-    WEB)        check='ok' ;;
-    DNS)        check='ok' ;;
-    DNS_REC)    check='ok' ;;
-    MAIL)       check='ok' ;;
-    MAIL_ACC)   check='ok' ;;
-    DB)         check='ok' ;;
-    CRON)       check='ok' ;;
-    BACKUP)     check='ok' ;;
-    IP)         check='ok' ;;
-    PACKAGE)    check='ok' ;;
-    FIREWALL)   check='ok' ;;
-    *)      check_args '2' '0' 'USER SYSTEM OBJECT'
-esac
-
-# Perform verification if read-only mode is enabled
-check_hestia_demo_mode
-
-
-#----------------------------------------------------------#
-#                       Action                             #
-#----------------------------------------------------------#
-
-# Flushing vars
-USER=''
-WEB=''
-DNS=''
-DNS_REC=''
-MAIL=''
-MAIL_ACC=''
-DB=''
-CRON=''
-BACKUP=''
-IP=''
-PACKAGE=''
-FIREWALL=''
-
-# Creating config just in case
-touch $USER_DATA/favourites.conf
-
-# Reading current values
-source $USER_DATA/favourites.conf
-
-# Assigning current system value
-eval value=\$$system
-
-# Checking if object is new
-check_fav=$(echo "$value" |tr ',' '\n'| grep "^$object$")
-if [ -z "$check_fav" ]; then
-    exit 0
-fi
-
-# Deleting object from favorites
-value=$(echo "$value" |\
-    sed -e "s/,/\n/g"|\
-    sed -e "s/^$object$//g"|\
-    sed -e "/^$/d"|\
-    sed -e ':a;N;$!ba;s/\n/,/g')
-
-# Updating sytem
-eval $system=$value
-
-# Updating user favorites
-echo "USER='$USER'
-WEB='$WEB'
-DNS='$DNS'
-DNS_REC='$DNS_REC'
-MAIL='$MAIL'
-MAIL_ACC='$MAIL_ACC'
-DB='$DB'
-CRON='$CRON'
-BACKUP='$BACKUP'
-IP='$IP'
-PACKAGE='$PACKAGE'
-FIREWALL='$FIREWALL'" > $USER_DATA/favourites.conf
-
-# Changing file permission
-chmod 640 $USER_DATA/favourites.conf
-
-#----------------------------------------------------------#
-#                       Hestia                             #
-#----------------------------------------------------------#
-
-# Logging
-log_history "deleted starred $object from $system listing"
-log_event "$OK" "$ARGUMENTS"
-
-exit

+ 0 - 23
web/add/favorite/index.php

@@ -1,23 +0,0 @@
-<?
-
-error_reporting(NULL);
-session_start();
-
-
-include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
-
-// Check token
-//    if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
-//        header('location: /login/');
-//        exit();
-//    }
-
-    // Protect input
-    $v_section = escapeshellarg($_REQUEST['v_section']);
-    $v_unit_id = escapeshellarg($_REQUEST['v_unit_id']);
-
-    $_SESSION['favourites'][strtoupper($_REQUEST['v_section'])][$_REQUEST['v_unit_id']] = 1;
-
-    exec (HESTIA_CMD."v-add-user-favourites ".$_SESSION['user']." ".$v_section." ".$v_unit_id, $output, $return_var);
-//    check_return_code($return_var,$output);
-?>

+ 0 - 15
web/delete/favorite/index.php

@@ -1,15 +0,0 @@
-<?php
-
-    error_reporting(NULL);
-    session_start();
-
-    include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
-
-    unset($_SESSION['favourites'][strtoupper($_REQUEST['v_section'])][$_REQUEST['v_unit_id']]);
-
-    $v_section = escapeshellarg($_REQUEST['v_section']);
-    $v_unit_id = escapeshellarg($_REQUEST['v_unit_id']);
-
-    exec (HESTIA_CMD."v-delete-user-favourites ".$_SESSION['user']." ".$v_section." ".$v_unit_id, $output, $return_var);
-//    check_return_code($return_var,$output);
-?>

+ 0 - 33
web/js/init.js

@@ -130,39 +130,6 @@ $(document).ready(function(){
                 }).appendTo(".l-center.units");
               });
 
-
-
-            // STARS
-
-              $('.l-unit .l-icon-star').click(function(){
-                var l_unit = $(this).parents('.l-unit');
-
-                if(l_unit.hasClass('l-unit--starred')){
-                  // removing star
-
-                  $.ajax({
-                    method: "POST",
-                    url: "/delete/favorite/index.php",
-                    data: { v_section: l_unit.attr('v_section'), v_unit_id: l_unit.attr('v_unit_id') }
-                  });
-
-                  l_unit.attr({'sort-star': 0});
-                  l_unit.removeClass('l-unit--starred');
-                }
-                else{
-                  $.ajax({
-                    method: "POST",
-                    url: "/add/favorite/index.php",
-                    data: { v_unit_id: l_unit.attr('v_unit_id'), v_section: l_unit.attr('v_section') }
-                  });
-
-                  l_unit.attr({'sort-star': 1});
-                  l_unit.addClass('l-unit--starred');
-                }
-              });
-
-
-
               // Shortcuts
 
               shortcut.add("Ctrl+Enter", function(){

+ 0 - 24
web/list/favorites/index.php

@@ -1,24 +0,0 @@
-<?php
-error_reporting(NULL);
-    include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
-
-    echo '<br> Favorites: <br>';
-
-    // Data
-    exec (HESTIA_CMD."v-list-user-favourites ".$_SESSION['user']." json", $output, $return_var);
-
-
-//    print_r(implode('', $output));
-//    $json = '{ "Favourites": { "USER": "", "WEB": "bulletfarm.com", "DNS": "", "MAIL": "", "DB": "", "CRON": "", "BACKUP": "", "IP": "", "PACKAGE": "", "FIREWALL": ""}}';
-//    $data = json_decode($json, true);
-
-
-    $data = json_decode(implode('', $output).'}', true);
-    $data = array_reverse($data,true);
-
-    print_r($data);
-//    $data = array_reverse($data,true);
-
-//    $data = json_decode(implode('', $output), true);
-
-?>