From a010c326ba83f406d627a5168fb3a8855b805c11 Mon Sep 17 00:00:00 2001 From: necro-nemesis Date: Sun, 17 Mar 2019 00:10:56 -0400 Subject: [PATCH] Update functions.php --- includes/functions.php | 96 +++++++++++++++++++++--------------------- 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/includes/functions.php b/includes/functions.php index 4c65eab..a34bd55 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -324,19 +324,20 @@ function DisplayOpenVPNConfig() { * * */ -function DisplayTorProxyConfig(){ +/*LOKINET FUNCTIONS ADDED HERE*/ + +function DisplayLokinetConfig(){ exec( 'cat '. RASPI_TORPROXY_CONFIG, $return ); - exec( 'pidof tor | wc -l', $torproxystatus); + exec( 'pidof lokinet | wc -l', $lokinetstatus); - if( $torproxystatus[0] == 0 ) { - $status = '
TOR is not running + if( $lokinetstatus[0] == 0 ) { + $status = '
Lokinet daemon is not running
'; } else { - $status = '
TOR is running + $status = '
Lokinet is running
'; } - $arrConfig = array(); foreach( $return as $a ) { if( $a[0] != "#" ) { @@ -466,55 +467,19 @@ function DisplayTorProxyConfig(){ * * */ -function SaveTORAndVPNConfig(){ - if( isset($_POST['SaveOpenVPNSettings']) ) { - // TODO - } elseif( isset($_POST['SaveTORProxySettings']) ) { - // TODO - } elseif( isset($_POST['StartOpenVPN']) ) { - echo "Attempting to start openvpn"; - exec( 'sudo /etc/init.d/openvpn start', $return ); - foreach( $return as $line ) { - echo htmlspecialchars($line, ENT_QUOTES).'
' , PHP_EOL; - } - } elseif( isset($_POST['StopOpenVPN']) ) { - echo "Attempting to stop openvpn"; - exec( 'sudo /etc/init.d/openvpn stop', $return ); - foreach( $return as $line ) { - echo htmlspecialchars($line, ENT_QUOTES).'
' , PHP_EOL; - } - } elseif( isset($_POST['StartTOR']) ) { - echo "Attempting to start TOR"; - exec( 'sudo /etc/init.d/tor start', $return ); - foreach( $return as $line ) { - echo htmlspecialchars($line, ENT_QUOTES).'
' , PHP_EOL; - } - } elseif( isset($_POST['StopTOR']) ) { - echo "Attempting to stop TOR"; - exec( 'sudo /etc/init.d/tor stop', $return ); - foreach( $return as $line ) { - echo htmlspecialchars($line, ENT_QUOTES).'
' , PHP_EOL; - } - } - -/** -* -* -*/ -/*LOKINET FUNCTIONS ADDED HERE*/ - -function DisplayLokinetConfig(){ +function DisplayTorProxyConfig(){ exec( 'cat '. RASPI_TORPROXY_CONFIG, $return ); - exec( 'pidof lokinet | wc -l', $lokinetstatus); + exec( 'pidof tor | wc -l', $torproxystatus); - if( $lokinetstatus[0] == 0 ) { - $status = '
Lokinet daemon is not running + if( $torproxystatus[0] == 0 ) { + $status = '
TOR is not running
'; } else { - $status = '
Lokinet is running + $status = '
TOR is running
'; } + $arrConfig = array(); foreach( $return as $a ) { if( $a[0] != "#" ) { @@ -639,4 +604,39 @@ function DisplayLokinetConfig(){
' , PHP_EOL; + } + } elseif( isset($_POST['StopOpenVPN']) ) { + echo "Attempting to stop openvpn"; + exec( 'sudo /etc/init.d/openvpn stop', $return ); + foreach( $return as $line ) { + echo htmlspecialchars($line, ENT_QUOTES).'
' , PHP_EOL; + } + } elseif( isset($_POST['StartTOR']) ) { + echo "Attempting to start TOR"; + exec( 'sudo /etc/init.d/tor start', $return ); + foreach( $return as $line ) { + echo htmlspecialchars($line, ENT_QUOTES).'
' , PHP_EOL; + } + } elseif( isset($_POST['StopTOR']) ) { + echo "Attempting to stop TOR"; + exec( 'sudo /etc/init.d/tor stop', $return ); + foreach( $return as $line ) { + echo htmlspecialchars($line, ENT_QUOTES).'
' , PHP_EOL; + } + } }