From patchwork Mon Apr 13 07:45:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Schantl X-Patchwork-Id: 2947 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4910zq0D49z3yBt for ; Mon, 13 Apr 2020 07:46:15 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail02.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4910zc6yhkz2nZ; Mon, 13 Apr 2020 07:46:04 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4910zc42Nvz30F5; Mon, 13 Apr 2020 07:46:04 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4910zX5fDPz30F5 for ; Mon, 13 Apr 2020 07:46:00 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) by mail01.ipfire.org (Postfix) with ESMTPSA id 4910zX2BrGz2fm; Mon, 13 Apr 2020 07:46:00 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1586763960; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vs+K/3z0wxF71ucMPo4tuOQN+lBJU4Rcp07YN45ZPX0=; b=s9oGxvTaL7pAiifRLipBnYHutIK0KHui3Bn7wB6j0vH2ilBrt3DPzBeDcXiu9xRY+ujDeX FqGPXDMotfWPKAAA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1586763960; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vs+K/3z0wxF71ucMPo4tuOQN+lBJU4Rcp07YN45ZPX0=; b=NNE80XE5EuZpPYSN4R44GIGyAJdjuwAHOedfZRH08ASYxnqHPg/soLaij7BC9aSoBXbYDk kh5/Cdz08thmna3J0Hc/8WXpqUWEsepvqh2XQsnQ2ySfI1I691uY2XWIpYzQOFUNAzyGS8 YBKw0CmfcOOYDt0rntAqC9R5/qmHGEUJ9k5xnA2iE24z2bWvXMamklQjbXH429yb1z/K8J dzkMzRJLxxEn8mOWx6ckiCKIZ/p5c39S3wb8NjJ+cIvDIu9BslLxZeWGvFhCmicVF4SwIs xwqE3Z6CN8V/hGwDvUJUBn0V802TJFWm9i5L2OGYZpbbO4n3lZd/dvA6zdTNkA== From: Stefan Schantl To: development@lists.ipfire.org Subject: [PATCH 07/19] ovpnclients.dat: Add table header. Date: Mon, 13 Apr 2020 09:45:38 +0200 Message-Id: <20200413074550.2735-7-stefan.schantl@ipfire.org> In-Reply-To: <20200413074550.2735-1-stefan.schantl@ipfire.org> References: <20200413074550.2735-1-stefan.schantl@ipfire.org> MIME-Version: 1.0 Authentication-Results: mail01.ipfire.org; auth=pass smtp.mailfrom=stefan.schantl@ipfire.org X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" The header will be dynamically generated, according the items which will be displayed. Signed-off-by: Stefan Schantl --- html/cgi-bin/logs.cgi/ovpnclients.dat | 46 +++++++++++++++++++-------- 1 file changed, 33 insertions(+), 13 deletions(-) diff --git a/html/cgi-bin/logs.cgi/ovpnclients.dat b/html/cgi-bin/logs.cgi/ovpnclients.dat index b601fd292..33d6d8717 100755 --- a/html/cgi-bin/logs.cgi/ovpnclients.dat +++ b/html/cgi-bin/logs.cgi/ovpnclients.dat @@ -243,7 +243,21 @@ my $lines = 0; print ""; -my $col=""; +my $col = "bgcolor='$color{'color20'}'"; + + print "\n"; + print "\n"; + + if ($cgiparams{'CONNECTION_NAME'}) { + print "\n"; + print "\n"; + print "\n"; + print "\n"; + } else { + print "\n"; while(my @row = $statement_handle->fetchrow_array()) { # Assign some nice to read variable names for the DB fields. @@ -253,23 +267,29 @@ while(my @row = $statement_handle->fetchrow_array()) { my $connection_bytes_recieved = &General::formatBytes($row[3]); my $connection_bytes_sent = &General::formatBytes($row[4]); - # Colorize columns. + # Colorize columns. if ($lines % 2) { + $col="bgcolor='$color{'color20'}'"; + } else { $col="bgcolor='$color{'color22'}'"; + } + + print "\n"; + print "\n"; + + if ($cgiparams{'CONNECTION_NAME'}) { + print "\n"; + print "\n"; + print "\n"; + print "\n"; } else { - $col="bgcolor='$color{'color20'}'"; + # Convert total connection time into human-readable format. + my $total_time = &General::format_time($row[1]); + + print "\n"; } -print < - - - - - - -END -; + print "\n"; # Increase lines count. $lines++;
$Lang::tr{'ovpn connection name'}$Lang::tr{'connected'}$Lang::tr{'disconnected'}$Lang::tr{'recieved'}$Lang::tr{'sent'}$Lang::tr{'total connection time'}\n"; + } + + print "
$connection_name$connection_open_time$connection_close_time$connection_bytes_recieved$connection_bytes_sent$total_time$connection_name$connection_open_time$connection_close_time$connection_bytes_recieved$connection_bytes_sent