[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ipcop-svn
Subject:    [Ipcop-svn] SF.net SVN: ipcop: [1536] ipcop/trunk/config/cfgroot
From:       owes () users ! sourceforge ! net
Date:       2008-06-29 8:04:11
Message-ID: E1KCrtL-0000mK-Bj () sc8-pr-svn4 ! sourceforge ! net
[Download RAW message or body]

Revision: 1536
          http://ipcop.svn.sourceforge.net/ipcop/?rev=1536&view=rev
Author:   owes
Date:     2008-06-29 01:04:10 -0700 (Sun, 29 Jun 2008)

Log Message:
-----------
Move getcgihash and speedtouchversion from header.pl to general-functions.pl.

Modified Paths:
--------------
    ipcop/trunk/config/cfgroot/general-functions.pl
    ipcop/trunk/config/cfgroot/header.pl

Modified: ipcop/trunk/config/cfgroot/general-functions.pl
===================================================================
--- ipcop/trunk/config/cfgroot/general-functions.pl	2008-06-28 13:43:55 UTC (rev \
                1535)
+++ ipcop/trunk/config/cfgroot/general-functions.pl	2008-06-29 08:04:10 UTC (rev \
1536) @@ -17,13 +17,14 @@
 
 use strict;
 use Socket;
+use CGI();
 use IO::Socket;
 use Net::SSLeay;
 
 $|=1; # line buffering
 
 $General::version = 'VERSION';
-$General::swroot = 'CONFIG_ROOT';
+$General::swroot = '/var/ipcop';
 $General::noipprefix = 'noipg-';
 
 #
@@ -40,6 +41,41 @@
 	system('/usr/bin/logger', '-t', $tag, $logmessage);
 }
 
+sub getcgihash {
+	my ($hash, $params) = @_;
+	my $cgi = CGI->new ();
+	return if ($ENV{'REQUEST_METHOD'} ne 'POST');
+	if (!$params->{'wantfile'}) {
+		$CGI::DISABLE_UPLOADS = 1;
+		$CGI::POST_MAX        = 512 * 1024;
+	} else {
+		$CGI::POST_MAX = 10 * 1024 * 1024;
+	}
+
+	$cgi->referer() =~ m/^https?\:\/\/([^\/]+)/;
+	my $referer = $1;
+	$cgi->url() =~ m/^https?\:\/\/([^\/]+)/;
+	my $servername = $1;
+	if ($referer ne $servername) {
+		&General::log('ipcop',"Invalid referer: doesn't match servername!");
+		return;
+	}
+
+	### Modified for getting multi-vars, split by |
+	my %temp = $cgi->Vars();
+	foreach my $key (keys %temp) {
+		$hash->{$key} = $temp{$key};
+		$hash->{$key} =~ s/\0/|/g;
+		$hash->{$key} =~ s/^\s*(.*?)\s*$/$1/;
+	}
+
+	if (($params->{'wantfile'})&&($params->{'filevar'})) {
+		$hash->{$params->{'filevar'}} = $cgi->upload
+						($params->{'filevar'});
+	}
+	return;
+}
+
 sub readhash
 {
 	my $filename = $_[0];
@@ -934,4 +970,19 @@
     &Header::closebox();
 }
 
+sub speedtouchversion
+{
+	my $speedtouch;
+	if (-f "/proc/bus/usb/devices")
+	{
+		$speedtouch=`/bin/cat /proc/bus/usb/devices | /bin/grep 'Vendor=06b9 ProdID=4061' \
| /usr/bin/cut -d ' ' -f6`; +		if ($speedtouch eq '') {
+			$speedtouch= $Lang::tr{'connect the modem'};
+		}
+	} else {
+		$speedtouch='USB '.$Lang::tr{'not running'};
+	}
+	return $speedtouch
+}
+
 1;

Modified: ipcop/trunk/config/cfgroot/header.pl
===================================================================
--- ipcop/trunk/config/cfgroot/header.pl	2008-06-28 13:43:55 UTC (rev 1535)
+++ ipcop/trunk/config/cfgroot/header.pl	2008-06-29 08:04:10 UTC (rev 1536)
@@ -16,7 +16,6 @@
 package Header;
 
 use strict;
-use CGI();
 use Time::Local;
 
 # enable only the following on debugging purpose
@@ -43,7 +42,6 @@
 $Header::boxframe = '';				# retain frametype for closebox
 
 my %menu = ();
-my $hostnameintitle = 0;
 our $javascript = 1;
 
 # Define visual sort indicators for column headings
@@ -58,6 +56,13 @@
     &General::readhash("${General::swroot}/ethernet/settings", \%ethsettings);
     my %proxysettings = ();
     &General::readhash("${General::swroot}/proxy/settings", \%proxysettings);
+	my $proxyenabled = 0;
+	for (my $i = 1; $i <= $ethsettings{'GREEN_COUNT'}; $i++) {
+		$proxyenabled++ if ( $proxysettings{"ENABLED_GREEN_${i}"} eq 'on' );
+	}
+	for (my $i = 1; $i <= $ethsettings{'BLUE_COUNT'}; $i++) {
+		$proxyenabled++ if ( $proxysettings{"ENABLED_BLUE_${i}"} eq 'on' );
+	}
 
     %{$menu{'1.system'}}=(
 		'contents' =>  $Lang::tr{'alt system'},
@@ -83,7 +88,7 @@
 			push(@{$menu{'2.status'}{'subMenu'}}, [ $Lang::tr{'ssnetwork status'} , \
'/cgi-bin/netstatus.cgi', "IPCop $Lang::tr{'network status information'}" ]);  \
push(@{$menu{'2.status'}{'subMenu'}}, [ $Lang::tr{'system graphs'} , \
'/cgi-bin/graphs.cgi', "IPCop $Lang::tr{'system graphs'}" ]);  \
push(@{$menu{'2.status'}{'subMenu'}}, [ $Lang::tr{'sstraffic graphs'} , \
                '/cgi-bin/graphs.cgi?graph=network', "IPCop $Lang::tr{'network \
                traffic graphs'}" ]);
-			if ( ($proxysettings{'ENABLED_GREEN'} eq 'on') || ($proxysettings{'ENABLED_BLUE'} \
eq 'on') ) { +			if ( $proxyenabled > 0 ) {
 				push(@{$menu{'2.status'}{'subMenu'}}, [ $Lang::tr{'ssproxy graphs'} , \
'/cgi-bin/proxygraphs.cgi', "IPCop $Lang::tr{'proxy access graphs'}" ])   }
 			push(@{$menu{'2.status'}{'subMenu'}}, [ $Lang::tr{'connections'} , \
'/cgi-bin/connections.cgi', "IPCop $Lang::tr{'connections'}" ]); @@ -144,7 +149,7 @@
 		'subMenu' => [] );
 			push(@{$menu{'7.mainlogs'}{'subMenu'}}, [ $Lang::tr{'log settings'} , \
'/cgi-bin/logs.cgi/config.dat', "IPCop $Lang::tr{'log settings'}" ]);  \
push(@{$menu{'7.mainlogs'}{'subMenu'}}, [ $Lang::tr{'log summary'} , \
                '/cgi-bin/logs.cgi/summary.dat', "IPCop $Lang::tr{'log summary'}" ]);
-			if ( ($proxysettings{'ENABLED_GREEN'} eq 'on') || ($proxysettings{'ENABLED_BLUE'} \
eq 'on') ) { +			if ( $proxyenabled > 0 ) {
 				push(@{$menu{'7.mainlogs'}{'subMenu'}}, [ $Lang::tr{'proxy logs'} , \
'/cgi-bin/logs.cgi/proxylog.dat', "IPCop $Lang::tr{'proxy log viewer'}" ]);  }
 			push(@{$menu{'7.mainlogs'}{'subMenu'}}, [ $Lang::tr{'firewall logs'} , \
'/cgi-bin/logs.cgi/firewalllog.dat', "IPCop $Lang::tr{'firewall log viewer'}" ]); @@ \
-277,6 +282,7 @@  my $menu = $_[1];
     my $extrahead = $_[2];
 
+	my $full_title = '';
     ### Initialize environment
     my %settings = ();
     &General::readhash("${General::swroot}/main/settings", \%settings);
@@ -288,9 +294,9 @@
     }
 
     if ($settings{'WINDOWWITHHOSTNAME'} eq 'on') {
-        $hostnameintitle = 1;
+        $full_title = "$settings{'HOSTNAME'}.$settings{'DOMAINNAME'} - $title";
     } else {
-        $hostnameintitle = 0;
+        $full_title = "IPCop - $title";
     }
 
     print <<END
@@ -299,17 +305,7 @@
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
 <html><head>
-END
-    ;
-    print "    <title>";
-    if ($hostnameintitle) {
-        print "$settings{'HOSTNAME'}.$settings{'DOMAINNAME'} - $title";
-    } else {
-        print "IPCop - $title";
-    }
-    print "</title>\n";
-
-    print <<END
+    <title>$full_title</title>
     $extrahead
     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
     <link rel="shortcut icon" href="/favicon.ico" />
@@ -501,41 +497,6 @@
 	;
 }
 
-sub getcgihash {
-	my ($hash, $params) = @_;
-	my $cgi = CGI->new ();
-	return if ($ENV{'REQUEST_METHOD'} ne 'POST');
-	if (!$params->{'wantfile'}) {
-		$CGI::DISABLE_UPLOADS = 1;
-		$CGI::POST_MAX        = 512 * 1024;
-	} else {
-		$CGI::POST_MAX = 10 * 1024 * 1024;
-	}
-
-	$cgi->referer() =~ m/^https?\:\/\/([^\/]+)/;
-	my $referer = $1;
-	$cgi->url() =~ m/^https?\:\/\/([^\/]+)/;
-	my $servername = $1;
-	if ($referer ne $servername) {
-		&General::log('ipcop',"Invalid referer: doesn't match servername!");
-		return;
-	}
-
-	### Modified for getting multi-vars, split by |
-	my %temp = $cgi->Vars();
-	foreach my $key (keys %temp) {
-		$hash->{$key} = $temp{$key};
-		$hash->{$key} =~ s/\0/|/g;
-		$hash->{$key} =~ s/^\s*(.*?)\s*$/$1/;
-	}
-
-	if (($params->{'wantfile'})&&($params->{'filevar'})) {
-		$hash->{$params->{'filevar'}} = $cgi->upload
-						($params->{'filevar'});
-	}
-	return;
-}
-
 sub cleanhtml
 {
 	my $outstring =$_[0];
@@ -682,19 +643,4 @@
     return $connstate;
 }
 
-sub speedtouchversion
-{
-	my $speedtouch;
-	if (-f "/proc/bus/usb/devices")
-	{
-		$speedtouch=`/bin/cat /proc/bus/usb/devices | /bin/grep 'Vendor=06b9 ProdID=4061' \
                | /usr/bin/cut -d ' ' -f6`;
-		if ($speedtouch eq '') {
-			$speedtouch= $Lang::tr{'connect the modem'};
-		}
-	} else {
-		$speedtouch='USB '.$Lang::tr{'not running'};
-	}
-	return $speedtouch
-}
-
 1;


This was sent by the SourceForge.net collaborative development platform, the world's \
largest Open Source development site.

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Ipcop-svn mailing list
Ipcop-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ipcop-svn


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic