Serghey Rodin 12 лет назад
Родитель
Сommit
78d963eaee

+ 49 - 0
bin/v-list-web-domain-accesslog

@@ -0,0 +1,49 @@
+#!/bin/bash
+# info: list web domain access log
+# options: USER DOMAIN [LINES]
+#
+# The function of obtaining raw access web domain logs.
+
+
+#----------------------------------------------------------#
+#                    Variable&Function                     #
+#----------------------------------------------------------#
+
+# Argument defenition
+user=$1
+domain=$2
+lines=${3-30}
+
+# Includes
+source $VESTA/conf/vesta.conf
+source $VESTA/func/main.sh
+
+
+
+#----------------------------------------------------------#
+#                    Verifications                         #
+#----------------------------------------------------------#
+
+check_args '2' "$#" 'USER DOMAIN [FORMAT]'
+is_object_valid 'user' 'USER' "$user"
+is_object_valid 'web' 'DOMAIN' "$domain"
+
+#----------------------------------------------------------#
+#                       Action                             #
+#----------------------------------------------------------#
+
+# Check number of output lines
+if [ "$lines" -gt '3000' ]; then
+    read_cmd="cat"
+else
+    read_cmd="tail -n $lines"
+fi
+
+$read_cmd /var/log/$WEB_SYSTEM/domains/$domain.log
+
+
+#----------------------------------------------------------#
+#                       Vesta                              #
+#----------------------------------------------------------#
+
+exit

+ 49 - 0
bin/v-list-web-domain-errorlog

@@ -0,0 +1,49 @@
+#!/bin/bash
+# info: list web domain error log
+# options: USER DOMAIN [LINES]
+#
+# The function of obtaining raw error web domain logs.
+
+
+#----------------------------------------------------------#
+#                    Variable&Function                     #
+#----------------------------------------------------------#
+
+# Argument defenition
+user=$1
+domain=$2
+lines=${3-30}
+
+# Includes
+source $VESTA/conf/vesta.conf
+source $VESTA/func/main.sh
+
+
+
+#----------------------------------------------------------#
+#                    Verifications                         #
+#----------------------------------------------------------#
+
+check_args '2' "$#" 'USER DOMAIN [FORMAT]'
+is_object_valid 'user' 'USER' "$user"
+is_object_valid 'web' 'DOMAIN' "$domain"
+
+#----------------------------------------------------------#
+#                       Action                             #
+#----------------------------------------------------------#
+
+# Check number of output lines
+if [ "$lines" -gt '3000' ]; then
+    read_cmd="cat"
+else
+    read_cmd="tail -n $lines"
+fi
+
+$read_cmd /var/log/$WEB_SYSTEM/domains/$domain.error.log
+
+
+#----------------------------------------------------------#
+#                       Vesta                              #
+#----------------------------------------------------------#
+
+exit

+ 28 - 0
web/download/web-log/index.php

@@ -0,0 +1,28 @@
+<?php
+// Init
+error_reporting(NULL);
+session_start();
+include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
+$v_domain = $_GET['domain'];
+$v_domain = escapeshellarg($_GET['domain']);
+if ($_GET['type'] == 'access') $type = 'access';
+if ($_GET['type'] == 'error') $type = 'error';
+
+header("Cache-Control: public");
+header("Content-Description: File Transfer");
+header("Content-Disposition: attachment; filename=".$_GET['domain'].".".$type."-log.txt");
+header("Content-Type: application/octet-stream; "); 
+header("Content-Transfer-Encoding: binary");
+
+$v_domain = escapeshellarg($_GET['domain']);
+if ($_GET['type'] == 'access') $type = 'access';
+if ($_GET['type'] == 'error') $type = 'error';
+
+exec (VESTA_CMD."v-list-web-domain-".$type."log $user ".$v_domain." 5000", $output, $return_var);
+if ($return_var == 0 ) {
+    foreach($output as $file) {
+        echo $file . "\n";
+    }
+}
+
+?>

+ 3 - 0
web/inc/i18n/en.php

@@ -65,6 +65,7 @@ $LANG['en'] = array(
     'logout'  => 'logout',
     'edit'  => 'edit',
     'open webstats'  => 'open webstats',
+    'view logs'  => 'view logs',
     'list records'  => 'list %s records',
     'add record'  => 'add record',
     'list accounts'  => 'list %s accounts',
@@ -308,6 +309,8 @@ $LANG['en'] = array(
     'stats password'  => 'stats password',
     'ftp user password'  => 'ftp user password',
     'ftp user'  => 'ftp user',
+    'Download AccessLog' => 'Download AccessLog',
+    'Download ErrorLog' => 'Download ErrorLog',
 
    '1 account'  => '1 account',
     '%s accounts'  => '%s accounts',

+ 3 - 0
web/inc/i18n/es.php

@@ -64,6 +64,7 @@ $LANG['es'] = array(
     'logout'  => 'salir',
     'edit'  => 'editar',
     'open webstats'  => 'abrir webstats',
+    'view logs'  => 'ver los logs',
     'list records'  => 'listar los %s registros',
     'add record'  => 'añadir registro',
     'list accounts'  => 'listar %s cuentas',
@@ -307,6 +308,8 @@ $LANG['es'] = array(
     'stats password'  => 'contraseña estadísticas',
     'ftp user password'  => 'contraseña usuario ftp',
     'ftp user'  => 'usuario ftp',
+    'Download AccessLog' => 'Descargar AccessLog',
+    'Download ErrorLog' => 'Descargar ErrorLog',
 
    '1 account'  => '1 cuenta',
     '%s accounts'  => '%s cuentas',

+ 3 - 0
web/inc/i18n/ro.php

@@ -66,6 +66,7 @@ $LANG['ro'] = array(
     'logout' => 'logout',
     'edit' => 'edita',
     'open webstats' => 'deschide raportul de analiză',
+    'view logs'  => 'vizualiza loguri',
     'list records' => 'arată inregistrarile: %s',
     'add record' => 'adaugă înregistrare',
     'list accounts' => 'arata conturi: %s',
@@ -309,6 +310,8 @@ $LANG['ro'] = array(
     'stats password' => 'parola de utilizator statistici',
     'ftp user password' => 'parola de FTP',
     'ftp user' => 'cont FTP',
+    'Download AccessLog' => 'Descarcă AccessLog',
+    'Download ErrorLog' => 'Descarcă ErrorLog',
 
     '1 account' => '1 utilizator',
     '%s accounts' => '%s utilizatori',

+ 3 - 0
web/inc/i18n/ru.php

@@ -66,6 +66,7 @@ $LANG['ru'] = array(
     'logout' => 'выйти',
     'edit' => 'редактировать',
     'open webstats' => 'открыть отчет веб-аналитики',
+    'view logs'  => 'просмотреть логи',
     'list records' => 'показать записи: %s',
     'add record' => 'добавить запись',
     'list accounts' => 'показать аккаунты: %s',
@@ -309,6 +310,8 @@ $LANG['ru'] = array(
     'stats password' => 'пароль пользователя статистики',
     'ftp user password' => 'пароль для доступа к FTP',
     'ftp user' => 'пользователь FTP',
+    'Download AccessLog' => 'Скачать AccessLog',
+    'Download ErrorLog' => 'Скачать ErrorLog',
 
     '1 account' => ' пользователей на странице: 1',
     '%s accounts' => 'пользователей на странице: %s',

+ 4 - 1
web/inc/i18n/ua.php

@@ -66,6 +66,7 @@ $LANG['ua'] = array(
     'logout' => 'вийти',
     'edit' => 'редагувати',
     'open webstats' => 'відкрити звіт веб-аналітики',
+    'view logs'  => 'переглянути логи',
     'list records' => 'показати записи: %s',
     'add record' => 'додати запис',
     'list accounts' => 'показати акаунти: %s',
@@ -309,7 +310,9 @@ $LANG['ua'] = array(
     'stats password' => 'пароль користувача статистики',
     'ftp user password' => 'пароль для доступу до FTP',
     'ftp user' => 'користувач FTP',
- 
+    'Download AccessLog' => 'Завантажити AccessLog',
+    'Download ErrorLog' => 'Завантажити ErrorLog',
+
     '1 account' => ' користувач на сторінці: 1',
     '%s accounts' => 'користувачів на сторінці: %s',
     '1 domain' => 'домен на сторінці: 1',

+ 20 - 0
web/list/web-log/index.php

@@ -0,0 +1,20 @@
+<?php
+// Init
+error_reporting(NULL);
+session_start();
+include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
+
+// Header
+include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/list_weblog.html');
+
+$v_domain = escapeshellarg($_GET['domain']);
+if ($_GET['type'] == 'access') $type = 'access';
+if ($_GET['type'] == 'error') $type = 'error';
+
+exec (VESTA_CMD."v-list-web-domain-".$type."log $user ".$v_domain, $output, $return_var);
+
+if ($return_var == 0 ) {
+    foreach($output as $file) {
+        echo $file . "\n";
+    }
+}

+ 7 - 0
web/templates/admin/list_web.html

@@ -109,6 +109,13 @@
                                             <?php print __('edit');?> 
                                         </span>
                                     </a>
+                                    <a href="/list/web-log/?domain=<?php echo $key ?>&type=access"  target="_blank" class="data-controls">
+                                        <span>
+                                            <img src="/images/new_window.png" width="8px" height="8px">
+                                            <?php print __('view logs');?> 
+                                        </span>
+                                    </a>
+
                                     <?php
                                         if (!empty($data[$key]['STATS'])) {
                                     ?> 

+ 127 - 0
web/templates/admin/list_weblog.html

@@ -0,0 +1,127 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+    <title>Web Log Manager</title>
+    <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
+    <style type="text/css">
+            body {
+                margin: 0;
+                margin-left: auto;
+                margin-right: auto;
+                font-family: Arial, Helvetica, sans-serif;
+                padding: 0 0 0 8px;
+            }
+
+            .main {
+                background-color: #ffffff;
+                padding: 0 0 18px 0;
+                box-shadow: 0 2px 6px rgba(100, 100, 100, 0.3);
+            }
+
+            .top {
+                color: #ffd76e;
+                padding: 0;
+                font-family: Arial, Helvetica, sans-serif;
+                margin: 0;
+                font-size: 10pt;
+                text-align: left;
+                border: 0px;
+                border-collapse:collapse;
+
+            }
+
+            .top thead td {
+                background-color: #505050;
+                border-bottom: 1px solid #fff;
+                height: 25px;
+                text-align: right;
+                padding: 0 24px 0 0px;
+                weight:120px;
+            }
+
+            .top thead td:first-child{
+                border-left: 1px solid #fff;
+                border-right:none;
+                text-align:left;
+                padding: 0 0 0 0;
+                width:auto;
+            }
+
+            .top-link {
+                padding: 5px 22px 4px;
+                text-decoration: none;
+                color: #fff;
+                border-right: 1px solid #fff;
+            }
+
+            .top-link:hover {
+                color: #fff;
+                background-color: #999;
+            }
+
+            .top-link:active{
+                color: #fff;
+                background-color: #f79b44;
+            }
+
+            .top-selected-link {
+                padding: 5px 22px;
+                text-decoration: none;
+                color: #555;
+                background-color: #fff;
+                border-right: 1px solid #fff;
+            }
+
+            .top-selected-link:hover {
+                color: #174f82;
+            }
+
+            .top-selected-link:active {
+                color: #fff;
+                background-color: #f79b44;
+            }
+
+            .top-user {
+                padding: 0 2px 0 0;
+                text-decoration: none;
+                color: #ffd76e;
+            }
+
+            .top-user:hover {
+                color: #fff;
+            }
+
+            .top-user:active{
+                color: #fff;
+                background-color: #f79b44;
+            }
+    </style>
+</head>
+<body>
+<table class="top">
+    <thead>
+        <tr>
+            <td>
+                <b><a class="top-<?php if($_GET['type'] == 'access' ) echo 'selected-' ?>link" href="/list/web-log/?domain=<?php echo $_GET['domain']."&type=access"?>">
+                    <?php print __('AccessLog') ?> 
+                </a></b>
+
+                <b><a class="top-<?php if($_GET['type'] == 'error' ) echo 'selected-' ?>link" href="/list/web-log/?domain=<?php echo $_GET['domain']."&type=error"?>">
+                    <?php print __('ErrorLog') ?> 
+                </a></b>
+
+                <b><a class="top-link" href="/download/web-log/?domain=<?php echo $_GET['domain']."&type=access"?>">
+                    <?php print __('Download AccessLog') ?>
+                </a></b>
+
+                <b><a class="top-link" href="/download/web-log/?domain=<?php echo $_GET['domain']."&type=error"?>">
+                    <?php print __('Download ErrorLog') ?>
+                </a></b>
+
+            </td>
+        </tr>
+    </thead>
+</table>
+<div style="color: #323232; padding: 16px 0px;"><?php print __('Listing');?> <?php echo $_GET['domain'] ?></div>
+<pre>

+ 6 - 0
web/templates/user/list_web.html

@@ -97,6 +97,12 @@
                                             <?php print __('edit');?> 
                                         </span>
                                     </a>
+                                    <a href="/list/web-log/?domain=<?php echo $key ?>&type=access"  target="_blank" class="data-controls">
+                                        <span>
+                                            <img src="/images/new_window.png" width="8px" height="8px">
+                                            <?php print __('view logs');?> 
+                                        </span>
+                                    </a>
                                     <?php
                                         if (!empty($data[$key]['STATS'])) {
                                     ?>