Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
glzjin committed Mar 29, 2016
1 parent 663575a commit 0ef9057
Show file tree
Hide file tree
Showing 3,074 changed files with 193 additions and 70 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ radius_db_host='localhost'
radius_db_database=''
radius_db_user=''
radius_db_password=''
radius_secret=''

#DirectAdmin 面板连接设置
da_host=''
Expand Down
Empty file modified app/Command/DailyMail.php
100644 → 100755
Empty file.
Empty file modified app/Command/ExtMail.php
100644 → 100755
Empty file.
17 changes: 16 additions & 1 deletion app/Command/Job.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public static function syncnode()
{
$nodes = Node::all();
foreach($nodes as $node){
if(strpos($node->name,"Shadowsocks")!=FALSE)
if($node->sort==0)
{
$ip=gethostbyname($node->server);
$node->node_ip=$ip;
Expand All @@ -21,6 +21,21 @@ public static function syncnode()
}
}

public static function syncnasnode()
{
$nodes = Node::all();
foreach($nodes as $node){
if($node->sort==1)
{
$ip=gethostbyname($node->server);
$node->node_ip=$ip;
$node->save();

Radius::AddNas($node->node_ip,$node->server);
}
}
}

public static function DailyJob()
{
$nodes = Node::all();
Expand Down
38 changes: 38 additions & 0 deletions app/Command/SyncRadius.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -188,4 +188,42 @@ public static function syncusers()
echo $e->getMessage();}
}
}

public static function syncnas()
{
$dsn = "mysql:host=".Config::get('radius_db_host').";dbname=".Config::get('radius_db_database');
$db = new \PDO($dsn, Config::get('radius_db_user'), Config::get('radius_db_password'));
$stmt = $db->query("SELECT * FROM `nas` ");
$result = $stmt->fetchAll();

$md5txt="";

foreach($result as $row)
{
//if($row["pass"]!="")
{
$md5txt=$md5txt.$row["id"].$row["nasname"].$row["shortname"].$row["secret"].$row["description"];
}


}

$md5=MD5($md5txt);


$oldmd5=file_get_contents(BASE_PATH."/storage/nas.md5");

if($oldmd5!=$md5)
{
//Restart radius
$myfile = fopen(BASE_PATH."/storage/nas.md5", "w+") or die("Unable to open file!");
echo("Restarting...");
system("/bin/bash /sbin/service radiusd restart",$retval);
echo($retval);
$txt = $md5;
fwrite($myfile, $txt);
fclose($myfile);
}

}
}
4 changes: 4 additions & 0 deletions app/Command/XCat.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ public function boot(){
return ExtMail::sendOldMail();
case("syncnode"):
return Job::syncnode();
case("syncnasnode"):
return Job::syncnasnode();
case("syncnas"):
return SyncRadius::syncnas();
case("dailyjob"):
return Job::DailyJob();
case("checkjob"):
Expand Down
Empty file modified app/Controllers/Admin/AnnController.php
100644 → 100755
Empty file.
Empty file modified app/Controllers/Admin/CodeController.php
100644 → 100755
Empty file.
19 changes: 17 additions & 2 deletions app/Controllers/Admin/NodeController.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace App\Controllers\Admin;

use App\Models\Node;
use App\Utils\Radius;
use App\Controllers\BaseController;

class NodeController extends BaseController
Expand All @@ -26,6 +27,7 @@ public function add($request, $response, $args){
$node->info = $request->getParam('info');
$node->type = $request->getParam('type');
$node->status = $request->getParam('status');
$node->sort = $request->getParam('sort');
if($node->sort==0)
{
$node->node_ip=gethostbyname($request->getParam('server'));
Expand All @@ -34,10 +36,16 @@ public function add($request, $response, $args){
{
$node->node_ip="";
}

if($node->sort==1)
{
$node->node_ip=gethostbyname($request->getParam('server'));
Radius::AddNas($node->node_ip,$request->getParam('server'));
}
$node->node_class=$request->getParam('class');
$node->node_bandwidth_limit=$request->getParam('node_bandwidth_limit')*1024*1024*1024;
$node->bandwidthlimit_resetday=$request->getParam('bandwidthlimit_resetday');
$node->sort = $request->getParam('sort');

if(!$node->save()){
$rs['ret'] = 0;
$rs['msg'] = "添加失败";
Expand Down Expand Up @@ -68,6 +76,7 @@ public function update($request, $response, $args){
$node->traffic_rate = $request->getParam('rate');
$node->info = $request->getParam('info');
$node->type = $request->getParam('type');
$node->sort = $request->getParam('sort');
if($node->sort==0)
{
$node->node_ip=gethostbyname($request->getParam('server'));
Expand All @@ -76,12 +85,18 @@ public function update($request, $response, $args){
{
$node->node_ip="";
}

if($node->sort==1)
{
$node->node_ip=gethostbyname($request->getParam('server'));
Radius::AddNas($node->node_ip,$request->getParam('server'));
}

$node->status = $request->getParam('status');
$node->node_class=$request->getParam('class');
$node->node_bandwidth_limit=$request->getParam('node_bandwidth_limit')*1024*1024*1024;
$node->bandwidthlimit_resetday=$request->getParam('bandwidthlimit_resetday');
$node->sort = $request->getParam('sort');

if(!$node->save()){
$rs['ret'] = 0;
$rs['msg'] = "修改失败";
Expand Down
Empty file modified app/Controllers/Admin/UserController.php
100644 → 100755
Empty file.
Empty file modified app/Controllers/Mu/NodeController.php
100644 → 100755
Empty file.
Empty file modified app/Controllers/Mu/UserController.php
100644 → 100755
Empty file.
Empty file modified app/Controllers/PasswordController.php
100644 → 100755
Empty file.
Empty file modified app/Controllers/ResController.php
100644 → 100755
Empty file.
141 changes: 77 additions & 64 deletions app/Controllers/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ public function node()

public function nodeInfo($request, $response, $args)
{
$user = Auth::getUser();
$id = $args['id'];
$node = Node::find($id);

Expand All @@ -180,118 +181,130 @@ public function nodeInfo($request, $response, $args)
switch ($node->sort) {

case 0:
$ary['server'] = $node->server;
$ary['server_port'] = $this->user->port;
$ary['password'] = $this->user->passwd;
$ary['method'] = $node->method;
if ($node->custom_method) {
$ary['method'] = $this->user->method;
if($user->class>=$node->node_class)
{
$ary['server'] = $node->server;
$ary['server_port'] = $this->user->port;
$ary['password'] = $this->user->passwd;
$ary['method'] = $node->method;
if ($node->custom_method) {
$ary['method'] = $this->user->method;
}
$json = json_encode($ary);
$json_show = json_encode($ary, JSON_PRETTY_PRINT);
$ssurl = $ary['method'] . ":" . $ary['password'] . "@" . $ary['server'] . ":" . $ary['server_port'];
$ssqr = "ss://" . base64_encode($ssurl);

$surge_base = Config::get('baseUrl') . "/downloads/ProxyBase.conf";
$surge_proxy = "#!PROXY-OVERRIDE:ProxyBase.conf\n";
$surge_proxy .= "[Proxy]\n";
$surge_proxy .= "Proxy = custom," . $ary['server'] . "," . $ary['server_port'] . "," . $ary['method'] . "," . $ary['password'] . "," . Config::get('baseUrl') . "/downloads/SSEncrypt.module";
return $this->view()->assign('ary', $ary)->assign('json', $json)->assign('global_url',Config::get('baseUrl')."/downloads")->assign('json_show', $json_show)->assign('ssqr', $ssqr)->assign('surge_base', $surge_base)->assign('surge_proxy', $surge_proxy)->assign('info_server', $ary['server'])->assign('info_port', $this->user->port)->assign('info_method', $ary['method'])->assign('info_pass', $this->user->passwd)->display('user/nodeinfo.tpl');
}
$json = json_encode($ary);
$json_show = json_encode($ary, JSON_PRETTY_PRINT);
$ssurl = $ary['method'] . ":" . $ary['password'] . "@" . $ary['server'] . ":" . $ary['server_port'];
$ssqr = "ss://" . base64_encode($ssurl);

$surge_base = Config::get('baseUrl') . "/downloads/ProxyBase.conf";
$surge_proxy = "#!PROXY-OVERRIDE:ProxyBase.conf\n";
$surge_proxy .= "[Proxy]\n";
$surge_proxy .= "Proxy = custom," . $ary['server'] . "," . $ary['server_port'] . "," . $ary['method'] . "," . $ary['password'] . "," . Config::get('baseUrl') . "/downloads/SSEncrypt.module";
return $this->view()->assign('ary', $ary)->assign('json', $json)->assign('global_url',Config::get('baseUrl')."/downloads")->assign('json_show', $json_show)->assign('ssqr', $ssqr)->assign('surge_base', $surge_base)->assign('surge_proxy', $surge_proxy)->assign('info_server', $ary['server'])->assign('info_port', $this->user->port)->assign('info_method', $ary['method'])->assign('info_pass', $this->user->passwd)->display('user/nodeinfo.tpl');

break;

case 1:
if($user->class>=$node->node_class)
{

$email=$this->user->email;
$email=Radius::GetUserName($email);
$json_show="VPN 信息<br>地址:".$node->server."<br>"."用户名:".$email."<br>密码:".$this->user->passwd."<br>支持方式:".$node->method."<br>备注:".$node->info;

$email=$this->user->email;
$email=Radius::GetUserName($email);
$json_show="VPN 信息<br>地址:".$node->server."<br>"."用户名:".$email."<br>密码:".$this->user->passwd."<br>支持方式:".$node->method."<br>备注:".$node->info;

return $this->view()->assign('json_show', $json_show)->display('user/nodeinfovpn.tpl');

return $this->view()->assign('json_show', $json_show)->display('user/nodeinfovpn.tpl');
}
break;

case 2:
if($user->class>=$node->node_class)
{
$email=$this->user->email;
$email=Radius::GetUserName($email);
$json_show="SSH 信息<br>地址:".$node->server."<br>"."用户名:".$email."<br>密码:".$this->user->passwd."<br>支持方式:".$node->method."<br>备注:".$node->info;

$email=$this->user->email;
$email=Radius::GetUserName($email);
$json_show="SSH 信息<br>地址:".$node->server."<br>"."用户名:".$email."<br>密码:".$this->user->passwd."<br>支持方式:".$node->method."<br>备注:".$node->info;

return $this->view()->assign('json_show', $json_show)->display('user/nodeinfossh.tpl');

return $this->view()->assign('json_show', $json_show)->display('user/nodeinfossh.tpl');

}

break;


case 3:
if($user->class>=$node->node_class)
{

$email=$this->user->email;
$email=Radius::GetUserName($email);
$json_show="PAC 信息<br>地址:".$node->server."<br>"."用户名:".$email."<br>密码:".$this->user->passwd."<br>支持方式:".$node->method."<br>备注:".$node->info;

return $this->view()->assign('json_show', $json_show)->display('user/nodeinfopac.tpl');
$email=$this->user->email;
$email=Radius::GetUserName($email);
$json_show="PAC 信息<br>地址:".$node->server."<br>"."用户名:".$email."<br>密码:".$this->user->passwd."<br>支持方式:".$node->method."<br>备注:".$node->info;

return $this->view()->assign('json_show', $json_show)->display('user/nodeinfopac.tpl');

}

break;

case 4:
if($user->class>=$node->node_class)
{
$email=$this->user->email;
$email=Radius::GetUserName($email);
$json_show="APN 信息<br>下载地址:".$node->server."<br>"."用户名:".$email."<br>密码:".$this->user->passwd."<br>支持方式:".$node->method."<br>备注:".$node->info;

$email=$this->user->email;
$email=Radius::GetUserName($email);
$json_show="APN 信息<br>下载地址:".$node->server."<br>"."用户名:".$email."<br>密码:".$this->user->passwd."<br>支持方式:".$node->method."<br>备注:".$node->info;

return $this->view()->assign('json_show', $json_show)->display('user/nodeinfoapn.tpl');

return $this->view()->assign('json_show', $json_show)->display('user/nodeinfoapn.tpl');

}

break;

case 5:
if($user->class>=$node->node_class)
{
$email=$this->user->email;
$email=Radius::GetUserName($email);
$json_show="Anyconnect 信息<br>地址:".$node->server."<br>"."用户名:".$email."<br>密码:".$this->user->passwd."<br>支持方式:".$node->method."<br>备注:".$node->info;

$email=$this->user->email;
$email=Radius::GetUserName($email);
$json_show="Anyconnect 信息<br>地址:".$node->server."<br>"."用户名:".$email."<br>密码:".$this->user->passwd."<br>支持方式:".$node->method."<br>备注:".$node->info;

return $this->view()->assign('json_show', $json_show)->display('user/nodeinfoanyconnect.tpl');

return $this->view()->assign('json_show', $json_show)->display('user/nodeinfoanyconnect.tpl');
}


break;

case 6:
if($user->class>=$node->node_class)
{
$email=$this->user->email;
$email=Radius::GetUserName($email);
$json_show="APN 文件<br>移动地址:".Config::get('baseUrl')."/downloads/node_apn.php?server=".$node->server."&isp=cmcc<br>联通地址:".Config::get('baseUrl')."/downloads/node_apn.php?server=".$node->server."&isp=cnunc<br>电信地址:".Config::get('baseUrl')."/downloads/node_apn.php?server=".$node->server."&isp=ctnet<br>"."用户名:".$email."<br>密码:".$this->user->passwd."<br>支持方式:".$node->method."<br>备注:".$node->info;

$email=$this->user->email;
$email=Radius::GetUserName($email);
$json_show="APN 文件<br>移动地址:".Config::get('baseUrl')."/downloads/node_apn.php?server=".$node->server."&isp=cmcc<br>联通地址:".Config::get('baseUrl')."/downloads/node_apn.php?server=".$node->server."&isp=cnunc<br>电信地址:".Config::get('baseUrl')."/downloads/node_apn.php?server=".$node->server."&isp=ctnet<br>"."用户名:".$email."<br>密码:".$this->user->passwd."<br>支持方式:".$node->method."<br>备注:".$node->info;

return $this->view()->assign('json_show', $json_show)->display('user/nodeinfoapndownload.tpl');

return $this->view()->assign('json_show', $json_show)->display('user/nodeinfoapndownload.tpl');
}


break;

case 7:
if($user->class>=$node->node_class)
{
$email=$this->user->email;
$email=Radius::GetUserName($email);
$json_show="PAC Plus 信息<br>PAC 地址:".Config::get('baseUrl')."downloads/node_pac.php?address=".$node->server."&port=".($this->user->port-20000)."<br>支持方式:".$node->method."<br>备注:".$node->info;

$email=$this->user->email;
$email=Radius::GetUserName($email);
$json_show="PAC Plus 信息<br>PAC 地址:".Config::get('baseUrl')."downloads/node_pac.php?address=".$node->server."&port=".($this->user->port-20000)."<br>支持方式:".$node->method."<br>备注:".$node->info;


return $this->view()->assign('json_show', $json_show)->display('user/nodeinfopacplus.tpl');

return $this->view()->assign('json_show', $json_show)->display('user/nodeinfopacplus.tpl');
}


break;

case 8:
if($user->class>=$node->node_class)
{
$email=$this->user->email;
$email=Radius::GetUserName($email);
$json_show="PAC Plus Plus信息<br>PAC 一般地址:".Config::get('baseUrl')."/downloads/node_pacpp.php?address=".$node->server."&port=".($this->user->port-20000)."<br>PAC iOS 地址:".Config::get('baseUrl')."/downloads/node_pacpp.php?address=".$node->server."&port=".($this->user->port-20000)."&ios=1<br>"."备注:".$node->info;

$email=$this->user->email;
$email=Radius::GetUserName($email);
$json_show="PAC Plus Plus信息<br>PAC 一般地址:".Config::get('baseUrl')."/downloads/node_pacpp.php?address=".$node->server."&port=".($this->user->port-20000)."<br>PAC iOS 地址:".Config::get('baseUrl')."/downloads/node_pacpp.php?address=".$node->server."&port=".($this->user->port-20000)."&ios=1<br>"."备注:".$node->info;

return $this->view()->assign('json_show', $json_show)->display('user/nodeinfopacpp.tpl');

return $this->view()->assign('json_show', $json_show)->display('user/nodeinfopacpp.tpl');
}


break;
Expand Down
Empty file modified app/Middleware/Mu.php
100644 → 100755
Empty file.
Empty file modified app/Models/Ann.php
100644 → 100755
Empty file.
Empty file modified app/Models/CheckInLog.php
100644 → 100755
Empty file.
Empty file modified app/Models/Code.php
100644 → 100755
Empty file.
Empty file modified app/Models/NodeOnlineLog.php
100644 → 100755
Empty file.
Empty file modified app/Models/PasswordReset.php
100644 → 100755
Empty file.
Empty file modified app/Models/RadiusBan.php
100644 → 100755
Empty file.
Empty file modified app/Models/Token.php
100644 → 100755
Empty file.
Empty file modified app/Models/TrafficLog.php
100644 → 100755
Empty file.
Empty file modified app/Services/Analytics.php
100644 → 100755
Empty file.
Empty file modified app/Services/Auth/Base.php
100644 → 100755
Empty file.
Empty file modified app/Services/Auth/JwtToken.php
100644 → 100755
Empty file.
Empty file modified app/Services/Auth/Token.php
100644 → 100755
Empty file.
Empty file modified app/Services/Aws/Client.php
100644 → 100755
Empty file.
Empty file modified app/Services/Aws/Factory.php
100644 → 100755
Empty file.
Empty file modified app/Services/Boot.php
100644 → 100755
Empty file.
Empty file modified app/Services/Cache.php
100644 → 100755
Empty file.
Empty file modified app/Services/Factory.php
100644 → 100755
Empty file.
Empty file modified app/Services/Jwt.php
100644 → 100755
Empty file.
Empty file modified app/Services/Password.php
100644 → 100755
Empty file.
Empty file modified app/Services/Slim.php
100644 → 100755
Empty file.
Empty file modified app/Services/Token/Base.php
100644 → 100755
Empty file.
Empty file modified app/Services/Token/DB.php
100644 → 100755
Empty file.
Empty file modified app/Services/Token/Dynamodb.php
100644 → 100755
Empty file.
Empty file modified app/Services/Token/Token.php
100644 → 100755
Empty file.
Empty file modified app/Utils/Check.php
100644 → 100755
Empty file.
Empty file modified app/Utils/Da.php
100644 → 100755
Empty file.
Empty file modified app/Utils/HTTPSocket.php
100644 → 100755
Empty file.
Loading

0 comments on commit 0ef9057

Please sign in to comment.