1
0
mirror of https://github.com/ZeroDream-CN/PHPMC7 synced 2024-11-27 23:02:52 +08:00

增加多语言支持,修复 utf8mb4 乱码问题

更新版本到 7.3.3325
This commit is contained in:
Akkariin Meiko 2018-10-19 18:39:25 +08:00
parent 0794b18efc
commit d5d5962746
21 changed files with 392 additions and 171 deletions

File diff suppressed because one or more lines are too long

View File

@ -124,10 +124,12 @@ function selectServer(id, element) {
function serverStatus() {
var htmlobjs = $.ajax({url:"?action=status&id=" + server, async:true, timeout:10000, success: function(){
if(server != undefined) {
var rpt = htmlobjs.responseText;
var fallback = rpt.split("\/");
$("#online").html(fallback[0]);
$("#max").html(fallback[1]);
}
setTimeout(serverStatus, 10000);
}});
};

View File

@ -33,44 +33,44 @@
<div class="col-lg-12">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>服务器控制台</h5>
<h5>{{ $Lang->str('服务器控制台'); }}</h5>
</div>
<div class="ibox-content" style="">
<div id="debug" class="console" style="overflow: unset;overflow-y: scroll;"></div>
<input id="command" style="background: none;top: 0px;outline: none;" placeholder="在此处输入命令Enter 提交">
<input id="command" style="background: none;top: 0px;outline: none;" placeholder="{{ $Lang->str('在此处输入命令Enter 提交'); }}">
</div>
</div>
</div>
<div class="col-lg-8">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>服务器控制台</h5></div>
<h5>{{ $Lang->str('服务器控制台'); }}</h5></div>
<div class="ibox-content">
<h1 class="no-margins">
<span class="text-info" id="online"></span> /
<span class="text-danger" id="max"></span></h1>
<small>在线玩家 / 最大在线</small>
<small>{{ $Lang->str('在线玩家'); }} / {{ $Lang->str('最大在线'); }}</small>
<br>
<span>当前延迟:<span id="ping">Pinging ...</span></span>
<span>{{ $Lang->str('当前延迟:'); }}<span id="ping">Pinging ...</span></span>
<br><br>
<button class="btn btn-primary" id="btn1" onclick="startServer()"><i class="fa fa-play"></i> 开启</button>
<button class="btn btn-primary" id="btn1" onclick="startServer()"><i class="fa fa-play"></i> {{ $Lang->str('开启'); }}</button>
<div class="s8px"></div>
<button class="btn btn-danger" id="btn2" onclick="stopServer()"><i class="fa fa-stop"></i> 关闭</button>
<button class="btn btn-danger" id="btn2" onclick="stopServer()"><i class="fa fa-stop"></i> {{ $Lang->str('关闭'); }}</button>
<div class="s8px"></div>
<button class="btn btn-warning" id="btn3" onclick="restartServer()"><i class="fa fa-refresh"></i> 重启</button>
<button class="btn btn-warning" id="btn3" onclick="restartServer()"><i class="fa fa-refresh"></i> {{ $Lang->str('重启'); }}</button>
<p style="margin-top: 8px;">
<input type="checkbox" checked="true" id="autoflush"> <span style="position: relative;top: -2px;">保持输出滚动</span></input>
<input type="checkbox" checked="true" id="autoflush"> <span style="position: relative;top: -2px;">{{ $Lang->str('保持输出滚动'); }}</span></input>
</p>
<p>游戏地址:<code id="gamehost"></code></p>
<p>FTP 账号:<code id="ftpuser"></code></p>
<p>FTP 密码:<code id="ftppass"></code></p>
<p>{{ $Lang->str('游戏地址:'); }}<code id="gamehost"></code></p>
<p>{{ $Lang->str('FTP 账号:'); }}<code id="ftpuser"></code></p>
<p>{{ $Lang->str('FTP 密码:'); }}<code id="ftppass"></code></p>
</div>
</div>
</div>
<div class="col-lg-4">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>选择服务器</h5>
<h5>{{ $Lang->str('选择服务器'); }}</h5>
</div>
<div class="ibox-content">
{{ PHPMC::Server()->getServerList() }}

View File

@ -33,7 +33,7 @@
<div class="col-lg-12">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>Daemon 列表</h5>
<h5>{{ $Lang->str('Daemon 列表'); }}</h5>
</div>
<div class="ibox-content" style="">
{{ PHPMC::Daemon()->getDaemonListAdmin() }}
@ -43,27 +43,27 @@
<div class="col-lg-6">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>修改 Daemon</h5></div>
<h5>{{ $Lang->str('修改 Daemon'); }}</h5></div>
<div class="ibox-content addfrp">
<p>从上面选择一个 Daemon 来修改设置</p>
<p>{{ $Lang->str('从上面选择一个 Daemon 来修改设置'); }}</p>
<div id="changedaemon" style="display: none;">
<p>请注意,当 Daemon 中还有服务器时无法删除。</p>
<p>Daemon 名称</p>
<p>{{ $Lang->str('请注意,当 Daemon 中还有服务器时无法删除。'); }}</p>
<p>{{ $Lang->str('Daemon 名称'); }}</p>
<input type="text" id="modify_name" class="form-control" />
<p>AJAX 请求地址</p>
<p>{{ $Lang->str('AJAX 请求地址'); }}</p>
<input type="text" id="modify_host" class="form-control" />
<p>连接密码</p>
<p>{{ $Lang->str('连接密码'); }}</p>
<input type="text" id="modify_pass" class="form-control" />
<p>域名或 IP 地址</p>
<p>{{ $Lang->str('域名或 IP 地址'); }}</p>
<input type="text" id="modify_fqdn" class="form-control" />
<p>服务器系统类型</p>
<p>{{ $Lang->str('服务器系统类型'); }}</p>
<select id="modify_type" class="form-control">
<option value="linux" id="Type_linux">Linux x86/x64</option>
<option value="windows" id="Type_windows">Windows x86/x64</option>
</select>
<div class="text-right" style="margin-top: 16px;">
<button class="btn btn-danger" onclick="deleteDaemon()">删除 Daemon</button>
<button class="btn btn-primary" onclick="updateDaemon()">保存修改</button>
<button class="btn btn-danger" onclick="deleteDaemon()">{{ $Lang->str('删除 Daemon'); }}</button>
<button class="btn btn-primary" onclick="updateDaemon()">{{ $Lang->str('保存修改'); }}</button>
</div>
</div>
</div>
@ -72,24 +72,24 @@
<div class="col-lg-6">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>添加服务器</h5>
<h5>{{ $Lang->str('添加 Daemon'); }}</h5>
</div>
<div class="ibox-content addfrp">
<p>Daemon 名称</p>
<p>{{ $Lang->str('Daemon 名称'); }}</p>
<input type="text" id="name" class="form-control" />
<p>AJAX 请求地址</p>
<p>{{ $Lang->str('AJAX 请求地址'); }}</p>
<input type="text" id="host" class="form-control" />
<p>连接密码</p>
<p>{{ $Lang->str('连接密码'); }}</p>
<input type="text" id="pass" class="form-control" />
<p>域名或 IP 地址</p>
<p>{{ $Lang->str('域名或 IP 地址'); }}</p>
<input type="text" id="fqdn" class="form-control" />
<p>服务器系统类型</p>
<p>{{ $Lang->str('服务器系统类型'); }}</p>
<select id="type" class="form-control">
<option value="linux">Linux x86/x64</option>
<option value="windows">Windows x86/x64</option>
</select>
<div class="text-right" style="margin-top: 16px;">
<button class="btn btn-primary" onclick="createDaemon()">添加 Daemon</button>
<button class="btn btn-primary" onclick="createDaemon()">{{ $Lang->str('添加 Daemon'); }}</button>
</div>
</div>
</div>
@ -99,7 +99,7 @@
<script type="text/javascript">
var selected;
function selectDaemon(id, element) {
window.parent.frames.progressshow("请稍后,正在加载...");
window.parent.frames.progressshow("{{ $Lang->str('请稍后,正在加载...'); }}");
$(".server-hover").attr("style", "");
element.style.border = "1px solid rgba(255,255,255,0.3)";
var htmlobj = $.ajax({
@ -173,7 +173,7 @@
});
}
function deleteDaemon() {
if(confirm("您确定要删除此 Daemon 吗?此操作不可恢复!")) {
if(confirm("{{ $Lang->str('您确定要删除此 Daemon 吗?此操作不可恢复!'); }}")) {
var htmlobj = $.ajax({
url: "?action=deletedaemon",
async:true,

View File

@ -30,35 +30,35 @@
<div class="col-sm-12">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>系统数据统计</h5>
<h5>{{ $Lang->str('系统数据统计'); }}</h5>
</div>
<div class="ibox-content">
<div class="row">
<div class="col-sm-3 box-hover">
<center>
<h1><i class="fa fa-cubes"></i></h1>
<h4>Daemon 数量</h4>
<h4>{{ $Lang->str('Daemon 数量'); }}</h4>
<p>{Daemon:getCounts}</p>
</center>
</div>
<div class="col-sm-3 box-hover">
<center>
<h1><i class="fa fa-cubes"></i></h1>
<h4>Minecraft 服务器数量</h4>
<h4>{{ $Lang->str('Minecraft 服务器数量'); }}</h4>
<p>{Server:getCounts}</p>
</center>
</div>
<div class="col-sm-3 box-hover">
<center>
<h1><i class="fa fa-key"></i></h1>
<h4>登录失败次数</h4>
<h4>{{ $Lang->str('登录失败次数'); }}</h4>
<p>{Option:loginFailed}</p>
</center>
</div>
<div class="col-sm-3 box-hover">
<center>
<h1><i class="fa fa-users"></i></h1>
<h4>用户数量</h4>
<h4>{{ $Lang->str('用户数量'); }}</h4>
<p>{User:getCounts}</p>
</center>
</div>
@ -69,25 +69,25 @@
<div class="col-lg-8">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>主页</h5></div>
<h5>{{ $Lang->str('主页'); }}</h5></div>
<div class="ibox-content" id="debug">
<p>欢迎使用 PHPMC <span class="text-success">7</span> 管理面板系统</p>
<p>您正在使用的 PHPMC 版本为:{System:get_phpmc_version}</p>
<p>如果您在使用中遇到任何问题请与我取得联系QQ204034。</p>
<p>PHPMC 官方网站:<a href="https://www.phpmc.cn/" target="_blank">https://www.phpmc.cn/</a></p>
<p>{{ $Lang->str('欢迎使用 PHPMC'); }} <span class="text-success">7</span> {{ $Lang->str('管理面板系统'); }}</p>
<p>{{ $Lang->str('您正在使用的 PHPMC 版本为:'); }}{System:get_phpmc_version}</p>
<p>{{ $Lang->str('如果您在使用中遇到任何问题请与我取得联系QQ204034。'); }}</p>
<p>{{ $Lang->str('PHPMC 官方网站:'); }}<a href="https://www.phpmc.cn/" target="_blank">https://www.phpmc.cn/</a></p>
</div>
</div>
</div>
<div class="col-lg-4">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>系统信息</h5>
<h5>{{ $Lang->str('系统信息'); }}</h5>
</div>
<div class="ibox-content" id="debug">
<p>PHP 版本:{System:get_PHP_Version}</p>
<p>PHP 运行方式:{System:get_php_sapi_name}</p>
<p>服务器操作系统:{System:get_php_os}</p>
<p>HTTP 服务器:{System:get_server_software}</p>
<p>{{ $Lang->str('PHP 版本:'); }}{System:get_PHP_Version}</p>
<p>{{ $Lang->str('PHP 运行方式:'); }}{System:get_php_sapi_name}</p>
<p>{{ $Lang->str('服务器操作系统:'); }}{System:get_php_os}</p>
<p>{{ $Lang->str('HTTP 服务器:'); }}{System:get_server_software}</p>
</div>
</div>
</div>

View File

@ -2,7 +2,7 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>{Option:SiteName} 登陆</title>
<title>{Option:SiteName} {{ $Lang->str('登陆'); }}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="robots" content="noindex" />
<link href="content/{Option:Theme}/css/sakura.css" type="text/css" rel="stylesheet" />
@ -15,7 +15,7 @@
<table>
<tr>
<td>
<h2>提示信息</h2>
<h2>{{ $Lang->str('提示信息'); }}</h2>
</td>
</tr>
<tr>
@ -87,18 +87,18 @@
<table>
<tr>
<td class="label">
<span>账号</span>
<span>{{ $Lang->str('账号'); }}</span>
</td>
<td>
<input id="login_username" placeholder="用户名" type="text" name="username" />
<input id="login_username" placeholder="{{ $Lang->str('用户名'); }}" type="text" name="username" />
</td>
</tr>
<tr>
<td>
<span>密码</span>
<span>{{ $Lang->str('密码'); }}</span>
</td>
<td>
<input id="login_passwd" placeholder="密码" type="password" name="password" />
<input id="login_passwd" placeholder="{{ $Lang->str('密码'); }}" type="password" name="password" />
</td>
</tr>
<tr>
@ -108,12 +108,12 @@
<tr>
<td>
<span class="pre-text">
<a href="?page=findpass">忘记密码</a>
<a href="?page=findpass">{{ $Lang->str('忘记密码'); }}</a>
</span>
</td>
<td>
<div class="btn-content">
<button class="btn-login" onclick="login()">Log In</button>
<button class="btn-login" onclick="login()">{{ $Lang->str('Log In'); }}</button>
</div>
</td>
</tr>
@ -122,9 +122,9 @@
</div>
<div class="right-tips">
<div class="tips-content">
<p>欢迎登录 <b>{Option:SiteName}</b> {Option:Description}</p>
<p>本平台由 Akkariin 开发。</p>
<p>作者QQ204034&nbsp;&nbsp;邮箱akkariin@akkariin.com</p>
<p>{{ $Lang->str('欢迎登录'); }} <b>{Option:SiteName}</b> {Option:Description}</p>
<p>{{ $Lang->str('本平台由 Akkariin 开发。'); }}</p>
<p>{{ $Lang->str('作者QQ204034&nbsp;&nbsp;邮箱akkariin@akkariin.com'); }}</p>
</div>
</div>
</div>

View File

@ -28,7 +28,7 @@
<table>
<tr>
<td>
<h2>提示信息</h2>
<h2>{{ $Lang->str('提示信息'); }}</h2>
</td>
</tr>
<tr>
@ -95,7 +95,7 @@
<li>
<a class="J_menuItem" href="?page=home" data-index="0">
<i class="fa fa-home"></i>
<span class="nav-label">主页</span>
<span class="nav-label">{{ $Lang->str('主页'); }}</span>
</a>
</li>
<!--<li class="">
@ -111,31 +111,31 @@
<li>
<a class="J_menuItem" href="?page=console" data-index="1">
<i class="fa fa-terminal"></i>
<span>服务器控制台</span>
<span>{{ $Lang->str('服务器控制台'); }}</span>
</a>
</li>
<li>
<a class="J_menuItem" href="?page=server-list" data-index="2">
<i class="fa fa-server"></i>
<span>服务器管理</span>
<span>{{ $Lang->str('服务器管理'); }}</span>
</a>
</li>
<li>
<a class="J_menuItem" href="?page=daemon-list" data-index="3">
<i class="fa fa-cube"></i>
<span>Daemon 管理</span>
<span>{{ $Lang->str('Daemon 管理'); }}</span>
</a>
</li>
<li>
<a class="J_menuItem" href="?page=user-list" data-index="4">
<i class="fa fa-user"></i>
<span class="nav-label">用户管理</span>
<span class="nav-label">{{ $Lang->str('用户管理'); }}</span>
</a>
</li>
<li>
<a class="J_menuItem" href="?page=setting" data-index="5">
<i class="fa fa-cog"></i>
<span class="nav-label">PHPMC 7 设置</span>
<span class="nav-label">{{ $Lang->str('PHPMC 7 设置'); }}</span>
</a>
</li>
</ul>
@ -151,35 +151,35 @@
</button>
<nav class="page-tabs J_menuTabs">
<div class="page-tabs-content">
<a href="javascript:;" class="active J_menuTab" data-id="?page=home">首页</a></div>
<a href="javascript:;" class="active J_menuTab" data-id="?page=home">{{ $Lang->str('首页'); }}</a></div>
</nav>
<button class="roll-nav roll-right J_tabRight">
<i class="fa fa-forward"></i>
</button>
<div class="btn-group roll-nav roll-right">
<button class="dropdown J_tabClose" data-toggle="dropdown">关闭操作</button>
<button class="dropdown J_tabClose" data-toggle="dropdown">{{ $Lang->str('关闭操作'); }}</button>
<ul role="menu" class="dropdown-menu dropdown-menu-right">
<li class="J_tabShowActive">
<a>定位当前选项卡</a>
<a>{{ $Lang->str('定位当前选项卡'); }}</a>
</li>
<li class="divider"></li>
<li class="J_tabCloseAll">
<a>关闭全部选项卡</a>
<a>{{ $Lang->str('关闭全部选项卡'); }}</a>
</li>
<li class="J_tabCloseOther">
<a>关闭其他选项卡</a>
<a>{{ $Lang->str('关闭其他选项卡'); }}</a>
</li>
</ul>
</div>
<a href="?action=logout" class="roll-nav roll-right J_tabExit">
<i class="fa fa fa-sign-out"></i>退出</a>
<i class="fa fa fa-sign-out"></i>{{ $Lang->str('退出'); }}</a>
</div>
<div class="row J_mainContent" id="content-main">
<iframe class="J_iframe" name="iframe0" width="100%" height="100%" src="?page=home" frameborder="0" data-id="?page=home" seamless=""></iframe>
</div>
<div class="footer">
<div class="pull-right">© 2018
<a href="https://www.phpmc.cn/" target="_blank">PHPMC 提供技术支持</a></div>
<a href="https://www.phpmc.cn/" target="_blank">{{ $Lang->str('PHPMC 提供技术支持'); }}</a></div>
</div>
</div>
</div>

View File

@ -33,7 +33,7 @@
<div class="col-lg-12">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>服务器列表</h5>
<h5>{{ $Lang->str('服务器列表'); }}</h5>
</div>
<div class="ibox-content" style="">
{{ PHPMC::Server()->getServerListAdmin() }}
@ -43,32 +43,32 @@
<div class="col-lg-6">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>修改服务器</h5></div>
<h5>{{ $Lang->str('修改服务器'); }}</h5></div>
<div class="ibox-content addfrp">
<p>从上面选择一个服务器来修改设置</p>
<p>{{ $Lang->str('从上面选择一个服务器来修改设置'); }}</p>
<div id="changeserver" style="display: none;">
<p>请注意,服务器创建后无法修改 Daemon。</p>
<p>服务器名称</p>
<p>{{ $Lang->str('请注意,服务器创建后无法修改 Daemon。'); }}</p>
<p>{{ $Lang->str('服务器名称'); }}</p>
<input type="text" id="modify_name" class="form-control" />
<p>最大内存 (MB)</p>
<p>{{ $Lang->str('最大内存 (MB)'); }}</p>
<input type="text" id="modify_maxram" class="form-control" />
<p>核心文件名字</p>
<p>{{ $Lang->str('核心文件名字'); }}</p>
<input type="text" id="modify_jar" class="form-control" />
<p>核心启动命令</p>
<p>{{ $Lang->str('核心启动命令'); }}</p>
<input type="text" id="modify_startcommand" class="form-control" />
<p>停止命令</p>
<p>{{ $Lang->str('停止命令'); }}</p>
<input type="text" id="modify_stopcommand" class="form-control" />
<p>服务器端口</p>
<p>{{ $Lang->str('服务器端口'); }}</p>
<input type="text" id="modify_port" class="form-control" />
<p>服务器 FTP 密码</p>
<p>{{ $Lang->str('服务器 FTP 密码'); }}</p>
<input type="text" id="modify_ftppass" class="form-control" />
<p>服务器所有者</p>
<p>{{ $Lang->str('服务器所有者'); }}</p>
<select id="modify_owner" class="form-control">
{{ PHPMC::User()->getOptionList(true) }}
</select>
<div class="text-right" style="margin-top: 16px;">
<button class="btn btn-danger" onclick="deleteServer()">删除服务器</button>
<button class="btn btn-primary" onclick="updateServer()">保存修改</button>
<button class="btn btn-danger" onclick="deleteServer()">{{ $Lang->str('删除服务器'); }}</button>
<button class="btn btn-primary" onclick="updateServer()">{{ $Lang->str('保存修改'); }}</button>
</div>
</div>
</div>
@ -77,33 +77,33 @@
<div class="col-lg-6">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>添加服务器</h5>
<h5>{{ $Lang->str('添加服务器'); }}</h5>
</div>
<div class="ibox-content addfrp">
<p>选择 Daemon</p>
<p>{{ $Lang->str('选择 Daemon'); }}</p>
<select id="daemon" class="form-control">
{{ PHPMC::Daemon()->getOptionList() }}
</select>
<p>服务器名称</p>
<p>{{ $Lang->str('服务器名称'); }}</p>
<input type="text" id="name" placeholder="MyServer" class="form-control" />
<p>最大内存 (MB)</p>
<p>{{ $Lang->str('最大内存 (MB)'); }}</p>
<input type="text" id="maxram" placeholder="1024" class="form-control" />
<p>核心文件名字</p>
<p>{{ $Lang->str('核心文件名字'); }}</p>
<input type="text" id="jar" placeholder="PaperSpigot.jar" class="form-control" />
<p>核心启动命令</p>
<p>{{ $Lang->str('核心启动命令'); }}</p>
<input type="text" id="startcommand" placeholder="java -Xmx{maxram}M -Xms128M -jar {jar}" value="java -Xmx{maxram}M -Xms128M -jar {jar}" class="form-control" />
<p>停止命令</p>
<p>{{ $Lang->str('停止命令'); }}</p>
<input type="text" id="stopcommand" placeholder="stop" class="form-control" />
<p>服务器端口</p>
<p>{{ $Lang->str('服务器端口'); }}</p>
<input type="text" id="port" placeholder="25565" class="form-control" />
<p>服务器 FTP 密码</p>
<p>{{ $Lang->str('服务器 FTP 密码'); }}</p>
<input type="text" id="ftppass" placeholder="123456789" class="form-control" />
<p>服务器所有者</p>
<p>{{ $Lang->str('服务器所有者'); }}</p>
<select id="owner" class="form-control">
{{ PHPMC::User()->getOptionList() }}
</select>
<div class="text-right" style="margin-top: 16px;">
<button class="btn btn-success" onclick="createServer()">添加服务器</button>
<button class="btn btn-success" onclick="createServer()">{{ $Lang->str('添加服务器'); }}</button>
</div>
</div>
</div>
@ -113,7 +113,7 @@
<script type="text/javascript">
var selected;
function selectServer(id, element) {
window.parent.frames.progressshow("请稍后,正在加载...");
window.parent.frames.progressshow("{{ $Lang->str('请稍后,正在加载...'); }}");
$(".server-hover").attr("style", "");
element.style.border = "1px solid rgba(255,255,255,0.3)";
var htmlobj = $.ajax({
@ -199,7 +199,7 @@
});
}
function deleteServer() {
if(confirm("您确定要删除此服务器吗?此操作不可恢复!")) {
if(confirm("{{ $Lang->str('您确定要删除此服务器吗?此操作不可恢复!'); }}")) {
var htmlobj = $.ajax({
url: "?",
async:true,

View File

@ -33,30 +33,32 @@
<div class="col-lg-12">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>PHPMC 7 设置</h5>
<h5>{{ $Lang->str('PHPMC 7 设置'); }}</h5>
</div>
<div class="ibox-content addfrp">
<h4>感谢您使用 PHPMC <span class="text-success">7</span></h4>
<p>如果您在使用中遇到任何问题,请与我取得联系。</p>
<p>QQ204034 | Emailakkariin@akkariin.com</p>
<h4>{{ $Lang->str('感谢您使用 PHPMC'); }} <span class="text-success">7</span></h4>
<p>{{ $Lang->str('如果您在使用中遇到任何问题,请与我取得联系。'); }}</p>
<p>{{ $Lang->str('QQ204034 | Emailakkariin@akkariin.com'); }}</p>
<hr>
<p>站点名称</p>
<p>{{ $Lang->str('站点名称'); }}</p>
<input type="text" class="form-control" id="SiteName" value="{Option:SiteName}" />
<p>站点简介</p>
<p>{{ $Lang->str('站点简介'); }}</p>
<input type="text" class="form-control" id="Description" value="{Option:Description}" />
<p>系统主题</p>
<p>{{ $Lang->str('系统主题'); }}</p>
<input type="text" class="form-control" id="Theme" value="{Option:Theme}" />
<p>{{ $Lang->str('系统语言'); }}</p>
<input type="text" class="form-control" id="Lang" value="{Option:Lang}" />
<div class="text-right" style="margin-top: 16px;">
<button class="btn btn-primary" onclick="saveConfig()">保存设置</button>
<button class="btn btn-primary" onclick="saveConfig()">{{ $Lang->str('保存设置'); }}</button>
</div>
</div>
</div>
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>检查更新</h5>
<h5>{{ $Lang->str('检查更新'); }}</h5>
</div>
<div class="ibox-content addfrp" id="update">
<p>请稍后,正在检查软件更新...</p>
<p>{{ $Lang->str('请稍后,正在检查软件更新...'); }}</p>
</div>
</div>
</div>
@ -65,29 +67,51 @@
<script type="text/javascript">
var version = "{{ PHPMC_VERSION; }}";
var newversion;
function saveConfig() {
var htmlobj = $.ajax({
url: "/?action=saveconfig",
async:true,
timeout:5000,
data: {
SiteName: $("#SiteName").val(),
Description: $("#Description").val(),
Theme: $("#Theme").val(),
Lang: $("#Lang").val()
},
error: function() {
window.parent.frames.showmsg(htmlobj.responseText);
},
success: function() {
console.log(htmlobj.responseText);
window.parent.frames.showmsg(htmlobj.responseText);
location = '?page=setting';
return;
}
});
}
function checkUpdate() {
var htmlobj = $.ajax({
url: "https://www.phpmc.cn/update.php?version={{ PHPMC_VERSION; }}",
async: true,
timeout:5000,
error: function(e) {
window.parent.frames.showmsg("检查更新错误:" + htmlobj.responseText);
window.parent.frames.showmsg("{{ $Lang->str('检查更新错误:'); }}" + htmlobj.responseText);
},
success: function() {
console.log(htmlobj.responseText);
var data = JSON.parse(htmlobj.responseText);
newversion = data.version;
if(version == newversion) {
$("#update").html("<p>本地版本:" + version + "</p><p>最新版本:" + newversion + "</p><p>您的 PHPMC 已经是最新版本,无需更新。</p>");
$("#update").html("<p>{{ $Lang->str('本地版本:'); }}" + version + "</p><p>{{ $Lang->str('最新版本:'); }}" + newversion + "</p><p>{{ $Lang->str('您的 PHPMC 已经是最新版本,无需更新。'); }}</p>");
return;
}
$("#update").html("<p>本地版本:" + version + "</p><p>最新版本:" + newversion + "</p><p>更新内容:<br>" + data.feature + "</p><p><button class='btn btn-primary' onclick='update()'>立即更新</button></p>");
$("#update").html("<p>{{ $Lang->str('本地版本:'); }}" + version + "</p><p>{{ $Lang->str('最新版本:'); }}" + newversion + "</p><p>{{ $Lang->str('更新内容:'); }}<br>" + data.feature + "</p><p><button class='btn btn-primary' onclick='update()'>{{ $Lang->str('立即更新'); }}</button></p>");
return;
}
});
}
function update() {
window.parent.frames.showmsg("请稍后,正在执行系统更新...");
window.parent.frames.showmsg("{{ $Lang->str('请稍后,正在执行系统更新...'); }}");
var htmlobj = $.ajax({
url: "?action=update",
async:true,
@ -102,27 +126,6 @@
}
});
}
function saveConfig() {
var htmlobj = $.ajax({
url: "/?action=saveconfig",
async:true,
timeout:5000,
data: {
SiteName: $("#SiteName").val(),
Description: $("#Description").val(),
Theme: $("#Theme").val()
},
error: function() {
window.parent.frames.showmsg(htmlobj.responseText);
},
success: function() {
console.log(htmlobj.responseText);
window.parent.frames.showmsg(htmlobj.responseText);
location = '?page=setting'
return;
}
});
}
window.onload = function() {
checkUpdate();
}

View File

@ -33,7 +33,7 @@
<div class="col-lg-12">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>用户列表</h5>
<h5>{{ $Lang->str('用户列表'); }}</h5>
</div>
<div class="ibox-content" style="">
{{ PHPMC::User()->getUserListAdmin() }}
@ -43,22 +43,22 @@
<div class="col-lg-6">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>修改用户</h5></div>
<h5>{{ $Lang->str('修改用户'); }}</h5></div>
<div class="ibox-content addfrp">
<p>从上面选择一个用户来修改设置</p>
<p>{{ $Lang->str('从上面选择一个用户来修改设置'); }}</p>
<div id="changeuser" style="display: none;">
<p>请注意,当用户还拥有服务器时无法删除。</p>
<p>用户名</p>
<p>{{ $Lang->str('请注意,当用户还拥有服务器时无法删除。'); }}</p>
<p>{{ $Lang->str('用户名'); }}</p>
<input type="text" id="modify_username" class="form-control" />
<p>用户密码 (留空不修改)</p>
<p>{{ $Lang->str('用户密码 (留空不修改)'); }}</p>
<input type="password" id="modify_password" class="form-control" />
<p>用户邮箱</p>
<p>{{ $Lang->str('用户邮箱'); }}</p>
<input type="text" id="modify_email" class="form-control" />
<p>用户权限</p>
<p>{{ $Lang->str('用户权限'); }}</p>
<input type="text" id="modify_permission" class="form-control" />
<div class="text-right" style="margin-top: 16px;">
<button class="btn btn-danger" onclick="deleteUser()">删除用户</button>
<button class="btn btn-primary" onclick="updateUser()">保存修改</button>
<button class="btn btn-danger" onclick="deleteUser()">{{ $Lang->str('删除用户'); }}</button>
<button class="btn btn-primary" onclick="updateUser()">{{ $Lang->str('保存修改'); }}</button>
</div>
</div>
</div>
@ -67,19 +67,19 @@
<div class="col-lg-6">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>添加用户</h5>
<h5>{{ $Lang->str('添加用户'); }}</h5>
</div>
<div class="ibox-content addfrp">
<p>用户名</p>
<p>{{ $Lang->str('用户名'); }}</p>
<input type="text" id="username" class="form-control" />
<p>用户密码</p>
<p>{{ $Lang->str('用户密码'); }}</p>
<input type="password" id="password" class="form-control" />
<p>用户邮箱</p>
<p>{{ $Lang->str('用户邮箱'); }}</p>
<input type="text" id="email" class="form-control" />
<p>用户权限</p>
<p>{{ $Lang->str('用户权限'); }}</p>
<input type="text" id="permission" class="form-control" />
<div class="text-right" style="margin-top: 16px;">
<button class="btn btn-primary" onclick="createUser()">添加用户</button>
<button class="btn btn-primary" onclick="createUser()">{{ $Lang->str('添加用户'); }}</button>
</div>
</div>
</div>
@ -159,7 +159,7 @@
});
}
function deleteUser() {
if(confirm("您确定要删除此用户吗?此操作不可恢复!")) {
if(confirm("{{ $Lang->str('您确定要删除此用户吗?此操作不可恢复!'); }}")) {
var htmlobj = $.ajax({
url: "?",
async:true,

View File

@ -20,6 +20,7 @@ class Daemon {
$this->daemon = $daemon;
$db = Config::MySQL();
$conn = mysqli_connect($db['host'], $db['user'], $db['pass'], $db['name'], $db['port']);
mysqli_query($conn, "set names 'utf8mb4'");
$rs = mysqli_fetch_array(mysqli_query($conn, "SELECT * FROM `{$db['name']}`.`daemon` WHERE `id`='{$daemon}'"));
if($rs) {
$this->id = $rs['id'];
@ -59,6 +60,7 @@ class Daemon {
public function getCounts() {
$db = Config::MySQL();
$conn = mysqli_connect($db['host'], $db['user'], $db['pass'], $db['name'], $db['port']);
mysqli_query($conn, "set names 'utf8mb4'");
$rs = mysqli_query($conn, "SELECT * FROM `{$db['name']}`.`daemon`");
$i = 0;
while($rw = mysqli_fetch_row($rs)) {
@ -75,6 +77,7 @@ class Daemon {
public function getOptionList() {
$db = Config::MySQL();
$conn = mysqli_connect($db['host'], $db['user'], $db['pass'], $db['name'], $db['port']);
mysqli_query($conn, "set names 'utf8mb4'");
$rs = mysqli_query($conn, "SELECT * FROM `{$db['name']}`.`daemon`");
$data = "";
while($rw = mysqli_fetch_row($rs)) {
@ -97,6 +100,7 @@ class Daemon {
$uuid = md5(md5(time() . rand(0, 999999)));
$db = Config::MySQL();
$conn = mysqli_connect($db['host'], $db['user'], $db['pass'], $db['name'], $db['port']);
mysqli_query($conn, "set names 'utf8mb4'");
mysqli_query($conn, "INSERT INTO `{$db['name']}`.`daemon` (`id`, `name`, `host`, `pass`, `fqdn`, `type`) "
. "VALUES (NULL, '{$name}', '{$host}', '{$pass}', '{$fqdn}', '{$type}')");
return true;
@ -116,6 +120,7 @@ class Daemon {
public function updateDaemon($id, $name, $host, $pass, $fqdn, $type) {
$db = Config::MySQL();
$conn = mysqli_connect($db['host'], $db['user'], $db['pass'], $db['name'], $db['port']);
mysqli_query($conn, "set names 'utf8mb4'");
mysqli_query($conn, "UPDATE `{$db['name']}`.`daemon` SET `name`='{$name}', `host`='{$host}', "
. "`pass`='{$pass}', `fqdn`='{$fqdn}', `type`='{$type}' WHERE `id`='{$id}'");
return true;
@ -130,6 +135,7 @@ class Daemon {
public function deleteDaemon($id) {
$db = Config::MySQL();
$conn = mysqli_connect($db['host'], $db['user'], $db['pass'], $db['name'], $db['port']);
mysqli_query($conn, "set names 'utf8mb4'");
mysqli_query($conn, "DELETE FROM `{$db['name']}`.`daemon` WHERE `id`='{$id}'");
return true;
}
@ -142,6 +148,7 @@ class Daemon {
public function getDaemonListAdmin() {
$db = Config::MySQL();
$conn = mysqli_connect($db['host'], $db['user'], $db['pass'], $db['name'], $db['port']);
mysqli_query($conn, "set names 'utf8mb4'");
$rs = mysqli_query($conn, "SELECT * FROM `{$db['name']}`.`daemon`");
$data = "";
while($rw = mysqli_fetch_row($rs)) {

View File

@ -273,7 +273,7 @@ class Event {
echo $sinfo['online'] . "/" . $sinfo['max'] . "/" . $Daemon->fqdn . ":" . $Server->port;
exit;
} else {
echo "/";
echo "0/0/0";
exit;
}
}
@ -540,7 +540,10 @@ class Event {
if(!preg_match("/^[a-zA-Z0-9\-\_]+$/", $data['Theme'])) {
PHPMC::Error()->Println("请填写字段:系统主题");
}
PHPMC::Option()->saveConfig($data['SiteName'], $data['Description'], $data['Theme']);
if(!preg_match("/^[a-zA-Z0-9\-\_]+$/", $data['Lang'])) {
PHPMC::Error()->Println("请填写字段:系统语言");
}
PHPMC::Option()->saveConfig($data['SiteName'], $data['Description'], $data['Theme'], $data['Lang']);
echo "系统设置更改成功,您需要刷新网页后设置才会生效。";
exit;
}

View File

@ -0,0 +1,22 @@
<?php
class Lang {
public $lang;
public $data;
public function setLang($lang) {
$this->lang = $lang;
if(file_exists(ROOT . "/include/langs/{$lang}.php")) {
include(ROOT . "/include/langs/{$lang}.php");
$this->data = $langdata;
} else {
$this->data = Array();
}
}
public function str($text) {
$data = $this->data;
//file_put_contents(ROOT . "/lang.txt", "'{$text}' => '{$text}'", FILE_APPEND);
return isset($data[$text]) ? $data[$text] : $text;
}
}

View File

@ -1,7 +1,7 @@
<?php
// PHPMC 7 Version define
// Don't change this, because it will interfere your update.
define("PHPMC_VERSION", "7.3.3233");
define("PHPMC_VERSION", "7.3.3325");
include(ROOT . "/include/core/PHPMC/Event.php");
include(ROOT . "/include/core/PHPMC/User.php");
@ -17,6 +17,7 @@ include(ROOT . "/include/core/PHPMC/Permission.php");
include(ROOT . "/include/core/PHPMC/Update.php");
include(ROOT . "/include/core/PHPMC/Csrf.php");
include(ROOT . "/include/core/PHPMC/Plugin.php");
include(ROOT . "/include/core/PHPMC/Lang.php");
class PHPMC {
@ -64,6 +65,10 @@ class PHPMC {
return new Plugin();
}
public static function Lang() {
return new Lang();
}
public static function Error() {
return new WebError();
}

View File

@ -6,6 +6,7 @@ class Option {
public function __construct() {
$db = Config::MySQL();
$conn = mysqli_connect($db['host'], $db['user'], $db['pass'], $db['name'], $db['port']);
mysqli_query($conn, "set names 'utf8mb4'");
$rs = mysqli_query($conn, "SELECT * FROM `{$db['name']}`.`option`");
while($rw = mysqli_fetch_row($rs)) {
$this->options[$rw[1]] = $rw[2];
@ -22,18 +23,21 @@ class Option {
}
}
public function saveConfig($SiteName, $Description, $Theme) {
public function saveConfig($SiteName, $Description, $Theme, $Lang) {
$db = Config::MySQL();
$conn = mysqli_connect($db['host'], $db['user'], $db['pass'], $db['name'], $db['port']);
mysqli_query($conn, "set names 'utf8mb4'");
mysqli_query($conn, "UPDATE `{$db['name']}`.`option` SET `value`='{$SiteName}' WHERE `key`='SiteName'");
mysqli_query($conn, "UPDATE `{$db['name']}`.`option` SET `value`='{$Description}' WHERE `key`='Description'");
mysqli_query($conn, "UPDATE `{$db['name']}`.`option` SET `value`='{$Theme}' WHERE `key`='Theme'");
mysqli_query($conn, "UPDATE `{$db['name']}`.`option` SET `value`='{$Lang}' WHERE `key`='Lang'");
return true;
}
public function updateOption($key, $value) {
$db = Config::MySQL();
$conn = mysqli_connect($db['host'], $db['user'], $db['pass'], $db['name'], $db['port']);
mysqli_query($conn, "set names 'utf8mb4'");
mysqli_query($conn, "UPDATE `{$db['name']}`.`option` SET `value`='{$value}' WHERE `key`='{$key}'");
return true;
}

View File

@ -40,8 +40,9 @@ class Permission {
public function checkSession($permission) {
if(!$this->check($permission)) {
$Option = new Option();
$Loader = new Loader();
echo $Loader->loadPage("403.html", ROOT . "/content/" . Config::Theme() . "/error/");
echo $this->check($permission);//$Loader->loadPage("403.html", ROOT . "/content/" . $Option->getOption("Theme") . "/error/");
exit;
}
}
@ -57,12 +58,26 @@ class Permission {
*/
public function serverControlPerm($permission, $server) {
$gettag = explode(";", $permission);
$s = 0;
$User = new User();
$Profile = $User->getLoginUser();
$Server = new Server();
$Server->setServer($server);
if($Server->uuid == null) {
return false;
}
if($Server->owner == $Profile->id) {
return true;
} else {
for($i = 0;$i < count($gettag);$i++) {
$getkey = explode(":", $gettag[$i]);
if($getkey[0] == "server" && $getkey[1] == $server) {
if($getkey[0] == "server") {
if($getkey[1] == $server) {
return true;
}
}
}
}
return false;
}
}

View File

@ -10,6 +10,7 @@ class Profile {
if(!empty($username) && preg_match("/^[A-Za-z0-9\-\_]+$/", $username)) {
$db = Config::MySQL();
$conn = mysqli_connect($db['host'], $db['user'], $db['pass'], $db['name'], $db['port']);
mysqli_query($conn, "set names 'utf8mb4'");
// Method 1 通过用户名查找用户
$rs = mysqli_fetch_array(mysqli_query($conn, "SELECT * FROM `{$db['name']}`.`users` WHERE `username`='{$username}'"));
if($rs) {

View File

@ -25,6 +25,7 @@ class Server {
$this->server = $server;
$db = Config::MySQL();
$conn = mysqli_connect($db['host'], $db['user'], $db['pass'], $db['name'], $db['port']);
mysqli_query($conn, "set names 'utf8mb4'");
// Method 1 通过服务器 ID 查找服务器
$rs = mysqli_fetch_array(mysqli_query($conn, "SELECT * FROM `{$db['name']}`.`servers` WHERE `id`='" . $this->server . "'"));
if($rs) {
@ -161,6 +162,7 @@ class Server {
$uuid = md5(uniqid(rand(0, 10000000), TRUE));
$db = Config::MySQL();
$conn = mysqli_connect($db['host'], $db['user'], $db['pass'], $db['name'], $db['port']);
mysqli_query($conn, "set names 'utf8mb4'");
mysqli_query($conn, "INSERT INTO `{$db['name']}`.`servers` (`id`, `name`, `daemon`, `maxram`, `jar`, `startcommand`, `stopcommand`, `owner`, `status`, `port`, `uuid`, `ftppass`) "
. "VALUES (NULL, '{$name}', '{$daemon}', '{$maxram}', '{$jar}', '{$startcommand}', '{$stopcommand}', '{$owner}', '{$status}', '{$port}', '{$uuid}', '{$ftppass}')");
$this->setServer($uuid);
@ -186,6 +188,7 @@ class Server {
public function updateServer($id, $name, $maxram, $jar, $startcommand, $stopcommand, $owner, $status, $port, $ftppass) {
$db = Config::MySQL();
$conn = mysqli_connect($db['host'], $db['user'], $db['pass'], $db['name'], $db['port']);
mysqli_query($conn, "set names 'utf8mb4'");
mysqli_query($conn, "UPDATE `{$db['name']}`.`servers` SET `name`='{$name}', `maxram`='{$maxram}', `jar`='{$jar}', `startcommand`='{$startcommand}', "
."`stopcommand`='{$stopcommand}', `owner`='{$owner}', `status`='{$status}', `port`='{$port}', `ftppass`='{$ftppass}' WHERE `id`='{$id}'");
return true;
@ -201,6 +204,7 @@ class Server {
$this->setServer($id);
$db = Config::MySQL();
$conn = mysqli_connect($db['host'], $db['user'], $db['pass'], $db['name'], $db['port']);
mysqli_query($conn, "set names 'utf8mb4'");
$Daemon = new Daemon();
if($Daemon->setDaemon($this->daemon) == null) {
return false;
@ -329,6 +333,7 @@ class Server {
public function getCounts() {
$db = Config::MySQL();
$conn = mysqli_connect($db['host'], $db['user'], $db['pass'], $db['name'], $db['port']);
mysqli_query($conn, "set names 'utf8mb4'");
$rs = mysqli_query($conn, "SELECT * FROM `{$db['name']}`.`servers`");
$i = 0;
while($rw = mysqli_fetch_row($rs)) {
@ -346,6 +351,7 @@ class Server {
public function getCountsByDaemon($id) {
$db = Config::MySQL();
$conn = mysqli_connect($db['host'], $db['user'], $db['pass'], $db['name'], $db['port']);
mysqli_query($conn, "set names 'utf8mb4'");
$rs = mysqli_query($conn, "SELECT * FROM `{$db['name']}`.`servers` WHERE `daemon`='{$id}'");
$i = 0;
while($rw = mysqli_fetch_row($rs)) {
@ -363,6 +369,7 @@ class Server {
public function getCountsByOwner($id) {
$db = Config::MySQL();
$conn = mysqli_connect($db['host'], $db['user'], $db['pass'], $db['name'], $db['port']);
mysqli_query($conn, "set names 'utf8mb4'");
$rs = mysqli_query($conn, "SELECT * FROM `{$db['name']}`.`servers` WHERE `owner`='{$id}'");
$i = 0;
while($rw = mysqli_fetch_row($rs)) {
@ -380,13 +387,14 @@ class Server {
public function getServerList() {
$db = Config::MySQL();
$conn = mysqli_connect($db['host'], $db['user'], $db['pass'], $db['name'], $db['port']);
mysqli_query($conn, "set names 'utf8mb4'");
$User = new User();
$Profile = $User->getLoginUser();
$ownerid = $Profile->id;
$rs = mysqli_query($conn, "SELECT * FROM `{$db['name']}`.`servers`");
$data = "";
while($rw = mysqli_fetch_row($rs)) {
if(PHPMC::Permission()->check("server:" . $rw[0])) {
if(PHPMC::Permission()->check("server:" . $rw[0]) || $rw[7] == $ownerid) {
$Daemon = new Daemon();
if($Daemon->setDaemon($rw[2]) == null) {
PHPMC::Error()->Println("500 Server Internal Error");
@ -409,6 +417,7 @@ class Server {
public function getServerListAdmin() {
$db = Config::MySQL();
$conn = mysqli_connect($db['host'], $db['user'], $db['pass'], $db['name'], $db['port']);
mysqli_query($conn, "set names 'utf8mb4'");
$User = new User();
$Profile = $User->getLoginUser();
$ownerid = $Profile->id;
@ -421,7 +430,7 @@ class Server {
}
$Profile = new Profile($rw[7]);
$data .= "<div class='server-hover' onclick='selectServer({$rw[0]}, this)'>
<h5>{$rw[1]}</h5>
<h5>ID{$rw[0]} 名称:{$rw[1]}</h5>
<p>" . $Daemon->fqdn . ":{$rw[9]} | 所有者:" . $Profile->username . "</p>
</div>";
}

View File

@ -24,6 +24,7 @@ class User {
public function Login($username, $password) {
$db = Config::MySQL();
$conn = mysqli_connect($db['host'], $db['user'], $db['pass'], $db['name'], $db['port']);
mysqli_query($conn, "set names 'utf8mb4'");
$rs = mysqli_fetch_array(mysqli_query($conn, "SELECT * FROM `{$db['name']}`.`users` WHERE `username`='{$username}'"));
if($rs) {
return password_verify(md5($password), $rs['password']);
@ -35,6 +36,7 @@ class User {
public function getCounts() {
$db = Config::MySQL();
$conn = mysqli_connect($db['host'], $db['user'], $db['pass'], $db['name'], $db['port']);
mysqli_query($conn, "set names 'utf8mb4'");
$rs = mysqli_query($conn, "SELECT * FROM `{$db['name']}`.`users`");
$i = 0;
while($rw = mysqli_fetch_row($rs)) {
@ -51,6 +53,7 @@ class User {
public function getOptionList($isModifyList = false) {
$db = Config::MySQL();
$conn = mysqli_connect($db['host'], $db['user'], $db['pass'], $db['name'], $db['port']);
mysqli_query($conn, "set names 'utf8mb4'");
$rs = mysqli_query($conn, "SELECT * FROM `{$db['name']}`.`users`");
$data = "";
while($rw = mysqli_fetch_row($rs)) {
@ -71,6 +74,7 @@ class User {
public function getUserListAdmin() {
$db = Config::MySQL();
$conn = mysqli_connect($db['host'], $db['user'], $db['pass'], $db['name'], $db['port']);
mysqli_query($conn, "set names 'utf8mb4'");
$rs = mysqli_query($conn, "SELECT * FROM `{$db['name']}`.`users`");
$data = "";
while($rw = mysqli_fetch_row($rs)) {
@ -96,6 +100,7 @@ class User {
$uuid = md5(md5(time() . rand(0, 999999)));
$db = Config::MySQL();
$conn = mysqli_connect($db['host'], $db['user'], $db['pass'], $db['name'], $db['port']);
mysqli_query($conn, "set names 'utf8mb4'");
mysqli_query($conn, "INSERT INTO `{$db['name']}`.`users` (`id`, `username`, `password`, `email`, `permission`) "
. "VALUES (NULL, '{$username}', '{$password}', '{$email}', '{$permission}')");
return true;
@ -114,6 +119,7 @@ class User {
public function updateUser($id, $username, $password = false, $email, $permission) {
$db = Config::MySQL();
$conn = mysqli_connect($db['host'], $db['user'], $db['pass'], $db['name'], $db['port']);
mysqli_query($conn, "set names 'utf8mb4'");
if($password) {
mysqli_query($conn, "UPDATE `{$db['name']}`.`users` SET `username`='{$username}', `password`='{$password}', "
. "`email`='{$email}', `permission`='{$permission}' WHERE `id`='{$id}'");
@ -133,6 +139,7 @@ class User {
public function deleteUser($id) {
$db = Config::MySQL();
$conn = mysqli_connect($db['host'], $db['user'], $db['pass'], $db['name'], $db['port']);
mysqli_query($conn, "set names 'utf8mb4'");
mysqli_query($conn, "DELETE FROM `{$db['name']}`.`users` WHERE `id`='{$id}'");
return true;
}

131
include/langs/en_US.php Normal file
View File

@ -0,0 +1,131 @@
<?php
$langdata = Array(
'提示信息' => 'Info',
'主页' => 'Home',
'服务器控制台' => 'Console',
'服务器管理' => 'Servers',
'Daemon 管理' => 'Daemons',
'用户管理' => 'Users',
'PHPMC 7 设置' => 'Setting',
'首页' => 'Home',
'关闭操作' => 'Close',
'定位当前选项卡' => 'Close this',
'关闭全部选项卡' => 'Close all',
'关闭其他选项卡' => 'Close other',
'退出' => 'Logout',
'PHPMC 提供技术支持' => 'PHPMC Software',
'系统数据统计' => 'System statistics',
'Daemon 数量' => 'Daemons',
'Minecraft 服务器数量' => 'Minecraft Servers',
'登录失败次数' => 'Login failed',
'用户数量' => 'Users',
'主页' => 'Home',
'欢迎使用 PHPMC' => 'Welcome to PHPMC',
'管理面板系统' => 'Minecraft Server Manager',
'您正在使用的 PHPMC 版本为:' => 'You are using PHPMC ',
'如果您在使用中遇到任何问题请与我取得联系QQ204034。' => 'If you has any problems during use, please contact me. Emailakkariin@akkariin.com',
'PHPMC 官方网站:' => 'PHPMC Official website: ',
'系统信息' => 'System information',
'PHP 版本:' => 'PHP version: ',
'PHP 运行方式:' => 'PHP cgi mode: ',
'服务器操作系统:' => 'Server operating system: ',
'HTTP 服务器:' => 'HTTP Server: ',
'服务器控制台' => 'Server console',
'在此处输入命令Enter 提交' => 'Input your command here, use Enter to submit',
'服务器控制台' => 'Server console',
'在线玩家' => 'Online players',
'最大在线' => 'Max online',
'当前延迟:' => 'Network delay: ',
'开启' => 'Start',
'关闭' => 'Stop',
'重启' => 'Reboot',
'保持输出滚动' => 'Keep output refresh',
'游戏地址:' => 'Game IP: ',
'FTP 账号:' => 'FTP username: ',
'FTP 密码:' => 'FTP password: ',
'选择服务器' => 'Select server',
'服务器列表' => 'Server list',
'修改服务器' => 'Modify server',
'从上面选择一个服务器来修改设置' => 'Select a server to modify.',
'请注意,服务器创建后无法修改 Daemon。' => 'You can\'t modify daemon after server created.',
'服务器名称' => 'Server name',
'最大内存 (MB)' => 'Max memory (MB)',
'核心文件名字' => 'Core jar name',
'核心启动命令' => 'Core start command',
'停止命令' => 'Stop command',
'服务器端口' => 'Server port',
'服务器 FTP 密码' => 'Server FTP password',
'服务器所有者' => 'Server owner',
'删除服务器' => 'Delete Server',
'保存修改' => 'Save',
'添加服务器' => 'Add Server',
'选择 Daemon' => 'Select Daemon',
'服务器名称' => 'Server name',
'最大内存 (MB)' => 'Max memory (MB)',
'核心文件名字' => 'Core jar name',
'核心启动命令' => 'Core start command',
'停止命令' => 'Stop command',
'服务器端口' => 'Server port',
'服务器 FTP 密码' => 'Server FTP password',
'服务器所有者' => 'Server owner',
'添加服务器' => 'Add Server',
'请稍后,正在加载...' => 'Loading...',
'您确定要删除此服务器吗?此操作不可恢复!' => 'Are you sure to delete this server?',
'Daemon 列表' => 'Daemon list',
'修改 Daemon' => 'Modify Daemon',
'从上面选择一个 Daemon 来修改设置' => 'Select a daemon to modify',
'请注意,当 Daemon 中还有服务器时无法删除。' => 'The daemon can\'t be delete when there\'s some server in the daemon',
'Daemon 名称' => 'Daemon name',
'AJAX 请求地址' => 'AJAX request address',
'连接密码' => 'Connect password',
'域名或 IP 地址' => 'Domain or IP address',
'服务器系统类型' => 'Server operating system',
'删除 Daemon' => 'Delete Daemon',
'保存修改' => 'Save',
'添加 Daemon' => 'Add Daemon',
'Daemon 名称' => 'Daemon name',
'AJAX 请求地址' => 'AJAX request address',
'连接密码' => 'Connect password',
'域名或 IP 地址' => 'Domain or IP address',
'服务器系统类型' => 'Server operating system',
'添加 Daemon' => 'Add Daemon',
'请稍后,正在加载...' => 'Loading...',
'您确定要删除此 Daemon 吗?此操作不可恢复!' => 'Are you sure to delete this daemon?',
'用户列表' => 'User list',
'修改用户' => 'Modify user',
'从上面选择一个用户来修改设置' => 'Select a user to modify',
'请注意,当用户还拥有服务器时无法删除。' => 'The user can\'t be delete when the user have some server',
'用户名' => 'Username',
'用户密码 (留空不修改)' => 'Username (Leave blank to not modify)',
'用户邮箱' => 'Email',
'用户权限' => 'Permission',
'删除用户' => 'Delete user',
'保存修改' => 'Save',
'添加用户' => 'Add user',
'用户名' => 'Username',
'用户密码' => 'Password',
'用户邮箱' => 'Email',
'用户权限' => 'Permission',
'添加用户' => 'Add user',
'您确定要删除此用户吗?此操作不可恢复!' => 'Are you sure to delete this user?',
'PHPMC 7 设置' => 'PHPMC 7 Setting',
'感谢您使用 PHPMC' => 'Thank you for using PHPMC',
'如果您在使用中遇到任何问题,请与我取得联系。' => 'If you has any problems during use, please contact me.',
'QQ204034 | Emailakkariin@akkariin.com' => 'QQ204034 | Emailakkariin@akkariin.com',
'站点名称' => 'Site name',
'站点简介' => 'Site description',
'系统主题' => 'Site theme',
'系统语言' => 'Language',
'保存设置' => 'Save config',
'检查更新' => 'Check update',
'请稍后,正在检查软件更新...' => 'Checking update, please wait...',
'检查更新错误:' => 'Failed to check update: ',
'本地版本:' => 'Local version: ',
'最新版本:' => 'Remote version: ',
'您的 PHPMC 已经是最新版本,无需更新。' => 'Your PHPMC is newest version.',
'本地版本:' => 'Local version: ',
'最新版本:' => 'Remote version: ',
'更新内容:' => 'What\'s new',
'立即更新' => 'Update now',
'请稍后,正在执行系统更新...' => 'Updating system, please wait...'
);

View File

@ -1,11 +1,20 @@
<?php
include(ROOT . "/include/core/PHPMC/Main.php");
include(ROOT . "/include/data/config.php");
// 想来想去还是在这里加载语言设置比较合适
$Lang = new Lang();
$Option = new Option();
$result = $Option->getOption("Lang");
$result = $result == "" ? "zh-CN" : $result;
$Lang->setLang($result);
class Loader {
public $Event;
public function __construct() {
global $Lang;
$this->Event = new Event();
}
@ -15,6 +24,7 @@ class Loader {
*
**/
public function frame() {
global $Lang;
echo $this->loadPage("panel.html", ROOT . "/content/" . Config::Theme() . "/");
}
@ -28,6 +38,7 @@ class Loader {
*
**/
public function loadPage($pageName, $pagePath) {
global $Lang;
SESSION_START();
$Option = new Option();
$Profile = new Profile($_SESSION["user"]);
@ -83,6 +94,7 @@ class Loader {
*
**/
public function router() {
global $Lang;
if(PHPMC::Csrf()->isemptyCsrfToken()) {
PHPMC::Csrf()->createCsrfToken();
}