Skip to content

Commit

Permalink
Update vpnki.class.php
Browse files Browse the repository at this point in the history
Log update
  • Loading branch information
sergejey committed Nov 4, 2019
1 parent 7acdfe8 commit 40ea3b3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions modules/vpnki/vpnki.class.php
Expand Up @@ -436,6 +436,7 @@ function connect($saved = 0)
} elseif ($type=='openvpn') {
//$url="https://vpnki.ru/index.php?option=com_api&format=raw&app=webservices&resource=ovpn&action=add&key=$key";
if ($token=='') {
DebMes("Token is not set",'vpnki');
dprint("Token is not set");
return false;
}
Expand All @@ -448,8 +449,10 @@ function connect($saved = 0)
if (is_object($object)) {
$file_content=$object->file_content;
SaveFile($conf_path.'/vpnki.conf',$file_content.PHP_EOL);
DebMes("Conf file received: ".$conf_path.'/vpnki.conf','vpnki');
} else {
dprint("cannot get openvpn data: ".$ovpn);
DebMes('Cannot get OpenVPN data: '.$ovpn,'vpnki');
return false;
}

Expand All @@ -458,6 +461,7 @@ function connect($saved = 0)
$password
TEXT;
SaveFile($conf_path.'/vpnki_login',$text.PHP_EOL);
DebMes('Login saved to: '.$conf_path.'/vpnki_login','vpnki');

$text = <<<TEXT
auth-user-pass $conf_path/vpnki_login
Expand All @@ -476,6 +480,8 @@ function lreplace($search, $replace, $subject){
$str = lreplace($oldMessage, $text, $str);
SaveFile($conf_path.'/vpnki.conf',$str);

DebMes('Conf file updated: '.$conf_path.'/vpnki.conf','vpnki');

$cmd = "sudo killall openvpn";
debmes($cmd, 'vpnki');
safe_exec($cmd);
Expand Down

0 comments on commit 40ea3b3

Please sign in to comment.