该系统为使用PHP开发的基于web的Subversion(SVN)服务器端管理工具。支持功能:SVN仓库管理、SVN用户管理、SVN分组管理、目录授权、目录浏览、Hooks管理、在线dump备份、在线备份恢复、SVN用户禁用、服务器状态管理、日志管理、消息通知、更新检测...
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
1.9 KiB

4 years ago
<?php
/*
* 控制器基类,所有的控制器都要继承此类
*/
//require model
require_once BASE_PATH . '/app/model/connModel.class.php';
//require controller
require_once BASE_PATH . '/app/controller/client.class.php';
require_once BASE_PATH . '/app/controller/config.class.php';
require_once BASE_PATH . '/app/controller/crontab.class.php';
require_once BASE_PATH . '/app/controller/firewall.class.php';
require_once BASE_PATH . '/app/controller/mail.class.php';
require_once BASE_PATH . '/app/controller/svnserve.class.php';
require_once BASE_PATH . '/app/controller/system.class.php';
require_once BASE_PATH . '/app/controller/user.class.php';
//require function
require_once BASE_PATH . '/app/function/detect.function.php';
require_once BASE_PATH . '/app/function/token.function.php';
4 years ago
class Controller
{
4 years ago
public $database_medoo;
public $this_userid;
public $this_username;
function __construct()
{
4 years ago
$this->database_medoo = (new connModel())->GetConn();
$this->this_userid = $this->GetUserInfoByToken(MY_TOKEN)["userid"];
$this->this_username = $this->GetUserInfoByToken(MY_TOKEN)["username"];
}
//根据token获取userid
final function GetUserInfoByToken($token)
{
4 years ago
$explode = explode('.', $token);
$result = $this->database_medoo->select("user", ["username"], ["id" => $explode[0]]);
$data = array(
"userid" => $explode[0],
"username" => $result[0]["username"]
);
return $data;
}
//与守护进程通信
final function RequestReplyExec($shell)
{
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP) or die("error:" . socket_strerror(socket_last_error()));
$server = socket_connect($socket, IPC_ADDRESS, IPC_PORT);
socket_write($socket, $shell);
$reply = socket_read($socket, SOCKET_READ_LENGTH);
socket_close($socket);
4 years ago
return $reply;
}
}