public function Node() { global $user; $nodes = Node::GetNodeArray(0); $nodeVip = Node::GetNodeArray(1); include Template::load("panel/node"); //throw new Error("This page is not available" , 404); }
public function JsonList() { global $user; $id = trim($_REQUEST['id']); $nodeList = Nodem::GetNodeArray(); $info = ""; foreach ($nodeList as $node) { $info .= NodeUtil::NodeJson($node->server, $node->port, $user->sspwd, $node->method) . ","; } include Template::load('/node/JsonAll'); exit; }
/** * 设置权限 */ public function setAuth() { $id = $this->isG('id', '请提交用户组'); $record = []; $recordList = \Model\Content::listContent(['table' => 'node_group', 'condition' => 'user_group_id = :user_group_id', 'param' => ['user_group_id' => $id]]); if (!empty($recordList)) { foreach ($recordList as $value) { $record[] = $value['node_id']; } } $this->assign('record', json_encode($record)); $this->assign('list', \Model\Node::nodeList()); $this->assign('prefix', 'node_'); $this->display('User_group_setting'); }
/** * 设置节点 */ public function setNode() { $id = $this->isG('id', '请选择用户组'); $group = \Model\Content::findContent('user_group', $id, 'user_group_id'); if (empty($group)) { $this->error('用户组不存在'); } $nodeList = $this->db('node_group')->where('user_group_id = :user_group_id')->select(array('user_group_id' => $id)); foreach ($nodeList as $key => $value) { $groupNode[] = $value['node_id']; } $this->assign('groupNode', $groupNode); $this->assign($group); $this->assign('node', \Model\Node::nodeList()); $this->assign('title', "设置'{$group['user_group_name']}'用户组权限节点"); $this->layout(); }
/** * @JSON * @Authorization */ public function nodeStatus() { $API_BASE = "https://nodequery.com/api/"; $API_KEY = Option::get('SERVER_NODE_QUERY_API_KEY'); if (!$API_KEY) { throw new Error('API_KEY is not available', 500); } $status = array(); $nodes = Node::getNodeArray(); foreach ($nodes as $node) { $result = Http::doGet($API_BASE . 'servers/' . $node->api_id . '?api_key=' . $API_KEY); $result = json_decode($result, true); $status[] = array('id' => $node->id, 'current_rx' => $result['data'][0]['current_rx'], 'current_tx' => $result['data'][0]['current_tx'], 'total_rx' => $result['data'][0]['total_rx'], 'total_tx' => $result['data'][0]['total_tx'], 'availability' => $result['data'][0]['availability']); unset($result); } return $status; }
/** * @JSON * @return array */ public function getNodeInfo() { $id = trim($_REQUEST['id']); $result = array('error' => -1, 'message' => 'Request failed'); $user = User::getUserByUserId(User::getCurrent()->uid); $node = MNode::getNodeById($id); $method = $node->method; if ($node->custom_method == 1 && $user->method != '' && $user->method != null) { $method = $user->method; } $info = self::nodeDetail($node->server, $user->port, $user->sspwd, $method, $node->name); if (self::verifyPlan($user->plan, $node->type)) { $result = array('error' => 0, 'message' => '获取成功', 'info' => $info, 'node' => $node); } else { $result = array('error' => -1, 'message' => '你不是 VIP, 无法使用高级节点!'); } return $result; }
/** * @JSON */ public function delete() { $result = array('error' => -1, 'message' => '删除失败'); if ($_POST['node_id'] != null) { if (NodeModel::deleteNode($_POST['node_id']) > 0) { $result = array('error' => 0, 'message' => '删除成功'); } } return $result; }
/** * 修改 自定义加密方式 * @JSON * @throws Error */ public function changeMethod() { $user = User::getCurrent(); if ($_POST['method'] != null) { $method = null; if ($_POST['method'] != '-1') { $method = htmlspecialchars(trim($_POST['method'])); } $user = User::getUserByUserId($user->uid); $user->method = $method; $user->save(); $_SESSION['currentUser'] = $user; return array('error' => 0, 'message' => '修改加密方式成功,全部节点同步大约5分钟内生效。'); } else { $nodeList = Node::getSupportCustomMethodArray(); Template::putContext('user', $user); Template::putContext('nodeList', $nodeList); Template::setView("panel/changeMethod"); } }
public function delete() { $result = array('error' => -1, 'message' => '删除失败'); if (isset($_POST['id']) || $_POST['id'] != null) { if (NodeModel::deleteNode($_POST['id']) > 0) { $result = array('error' => 0, 'message' => '删除成功'); } } echo json_encode($result); exit; }
public function index() { $this->assign('title', $this->model['model_title']); $this->assign('node', \Model\Node::nodeList()); $this->layout(); }
public function index() { $this->assign('node', \Model\Node::nodeList()); $this->layout(); }
public function index() { $this->assign('node', \Model\Node::nodeList()); parent::index(); }