Skip to content

Commit 43a421e

Browse files
committed
20220531
1 parent 1ce04d3 commit 43a421e

File tree

11 files changed

+67
-26
lines changed

11 files changed

+67
-26
lines changed

main/lang/de/main.php

+1
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
'menu_preferences' => 'Einstellungen',
6565
'menu_log' => 'Systemprotokoll',
6666
'menu_about' => 'Etwa',
67+
'menu_gologout' => 'Ausloggen',
6768
/* Page index */
6869
'txt-SysMsg' => 'System informationen',
6970
'txt-StorageMsg' => 'Speichergerät informationen',

main/lang/en/main.php

+1
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
'menu_preferences' => 'Preferences',
6565
'menu_log' => 'System log',
6666
'menu_about' => 'About',
67+
'menu_gologout' => 'Logout',
6768
/* Page index */
6869
'txt-SysMsg' => 'System information',
6970
'txt-StorageMsg' => 'Storage information',

main/lang/jp/main.php

+1
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
'menu_preferences' => '環境設定',
6565
'menu_log' => 'システムログ',
6666
'menu_about' => 'だいたい',
67+
'menu_gologout' => 'ログアウト',
6768
/* Page index */
6869
'txt-SysMsg' => '記憶情報',
6970
'txt-StorageMsg' => 'ストレージ情報',

main/lang/zh-CN/main.php

+1
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
'menu_preferences' => '系统首选项',
6565
'menu_log' => '系统日志',
6666
'menu_about' => '关于',
67+
'menu_gologout' => '登出系统',
6768
/* Page index */
6869
'txt-SysMsg' => '系统信息',
6970
'txt-StorageMsg' => '存储信息',

main/lang/zh-TW/main.php

+1
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
'menu_preferences' => '系統首選項',
6565
'menu_log' => '系統日誌',
6666
'menu_about' => '關於',
67+
'menu_gologout' => '登出系統',
6768
/* Page index */
6869
'txt-SysMsg' => '系統信息',
6970
'txt-StorageMsg' => '存儲信息',
+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
@include('part-top')
2+
3+
<!-- GoLogout 功能设置区域 -->
4+
<script type="text/javascript">
5+
setInterval(window.location.href="/logout", 100);
6+
</script>
7+
8+
@include('part-bottom')

main/resources/views/index.blade.php

+9-9
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,9 @@
221221

222222
<!-- 读取数据JS -->
223223
<script type=text/javascript>
224-
function RefreshStatusSys(){ //获取网络信息
224+
function RefreshStatusSys(){ //获取开机时间和进程数信息
225225
document.getElementById("Sys_spinner").style.visibility="visible";
226-
$.ajax( { type: "POST", url: '/getapi' , async : true , data: {"API":"[Sys][Time]",'_token':'{{csrf_token()}}' },//传入后台
226+
var VAjax1 = $.ajax( { type: "POST", url: '/getapi' , async : true , data: {"API":"[Sys][Time]",'_token':'{{csrf_token()}}' },//传入后台
227227
success: function(result) { //alert(result); //调试输出服务器返回信息
228228
if (result["[OK!]"]==0) { //console.log(result["API"]);
229229
document.getElementById("Time_sys-uptimelang").innerHTML=result["Time"]["sys-uptimelang"];//运行时间
@@ -239,7 +239,7 @@ function RefreshStatusSys(){ //获取网络信息
239239
240240
function RefreshStatusStorage(){ //获取存储信息
241241
document.getElementById("Storage_spinner").style.visibility="visible";
242-
$.ajax( { type: "POST", url: '/getapi' , async : true , data: {"API":"[Storage]",'_token':'{{csrf_token()}}' },//传入后台
242+
var VAjax2 = $.ajax( { type: "POST", url: '/getapi' , async : true , data: {"API":"[Storage]",'_token':'{{csrf_token()}}' },//传入后台
243243
success: function(result) { //alert(result); //调试输出服务器返回信息
244244
if (result["[OK!]"]==0) { //console.log(result["API"]);
245245
//这里插入存储信息相关代码
@@ -255,7 +255,7 @@ function RefreshStatusStorage(){ //获取存储信息
255255
function RefreshStatusCM(){ //获取CPU和内存信息
256256
var xCPUa=0; var xMEMa=0; var xCPUs=0; var xCPUs1=[]; var xCPUs2=[];
257257
document.getElementById("CAndM_spinner").style.visibility="visible";
258-
$.ajax( { type: "POST", url: '/getapi' , async : true , data: {"API":"[CpuState][Mem]",'_token':'{{csrf_token()}}' },//传入后台
258+
var VAjax3 = $.ajax( { type: "POST", url: '/getapi' , async : true , data: {"API":"[CpuState][Mem]",'_token':'{{csrf_token()}}' },//传入后台
259259
success: function(result) { //alert(result); //调试输出服务器返回信息
260260
if (result["[OK!]"]==0) { //console.log(result);
261261
document.getElementById("Mt").innerHTML=result["Mem"]["memtotal"];//物理内存
@@ -282,7 +282,7 @@ function RefreshStatusCM(){ //获取CPU和内存信息
282282
function RefreshStatusNet(){ //获取网络信息
283283
var xNICs=0;
284284
document.getElementById("Net_spinner").style.visibility="visible";
285-
$.ajax( { type: "POST", url: '/getapi' , async : true , data: {"API":"[Net]",'_token':'{{csrf_token()}}' },//传入后台
285+
var VAjax4 = $.ajax( { type: "POST", url: '/getapi' , async : true , data: {"API":"[Net]",'_token':'{{csrf_token()}}' },//传入后台
286286
success: function(result) { //alert(result); //调试输出服务器返回信息
287287
//document.getElementById("NetTest").innerHTML= JSON.stringify(result); //测试网络信息
288288
if (result["[OK!]"]==0) { //console.log(result["Net"]);
@@ -329,10 +329,10 @@ function RefreshStatusNet(){ //获取网络信息
329329
}
330330
331331
window.onload=function(){ RefreshStatusCM(); RefreshStatusNet(); }; //页面显示时马上刷新
332-
setInterval( RefreshStatusSys , 6000 ); //系统信息计时器定期刷新
333-
setInterval( RefreshStatusStorage , 10000 ); //存储信息计时器定期刷新
334-
setInterval( RefreshStatusCM , 2000 ); //CPU和内存信息计时器定期刷新
335-
setInterval( RefreshStatusNet , 3000 ); //网络信息计时器定期刷新
332+
var VSI1 = setInterval( RefreshStatusSys , 6000 ); //系统信息计时器定期刷新
333+
var VSI2 = setInterval( RefreshStatusStorage , 10000 ); //存储信息计时器定期刷新
334+
var VSI3 = setInterval( RefreshStatusCM , 2000 ); //CPU和内存信息计时器定期刷新
335+
var VSI4 = setInterval( RefreshStatusNet , 3000 ); //网络信息计时器定期刷新
336336
</script>
337337

338338
@include('part-bottom')

main/resources/views/part-header.blade.php

+14-2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,18 @@
3232
$('#staticBackdropshutdown_Btn').click(function () {
3333
window.location.href="/shutdown";
3434
});
35+
function Gologout() {
36+
if(typeof(VSI1) != "undefined") { clearInterval(VSI1); }
37+
if(typeof(VSI2) != "undefined") { clearInterval(VSI2); }
38+
if(typeof(VSI3) != "undefined") { clearInterval(VSI3); }
39+
if(typeof(VSI4) != "undefined") { clearInterval(VSI4); }
40+
if(typeof(VAjax1) != "undefined") { VAjax1.abort(); }
41+
if(typeof(VAjax2) != "undefined") { VAjax2.abort(); }
42+
if(typeof(VAjax3) != "undefined") { VAjax3.abort(); }
43+
if(typeof(VAjax4) != "undefined") { VAjax4.abort(); }
44+
window.location.href="/gologout";
45+
return;
46+
}
3547
</script>
3648

3749
<!-- 页首功能HTML -->
@@ -84,8 +96,8 @@
8496
</li>
8597

8698
<!-- 登出菜单 -->
87-
<li class="nav-item"><a href="/logout"><i class="bi bi-box-arrow-right" style="font-size:20px;line-height:46px;float:right;padding-right:8px;padding-left:2px;" title="{{ __('main.Logout') }}" data-bs-toggle="tooltip" data-bs-placement="left"></i></a></li>
88-
99+
<li class="nav-item"><a href="javascript:void(0);" onclick="Gologout();"><i class="bi bi-box-arrow-right" id="staticLogout_Btn" style="font-size:20px;line-height:46px;float:right;padding-right:8px;padding-left:2px;" title="{{ __('main.Logout') }}" data-bs-toggle="tooltip" data-bs-placement="left"></i></a></li>
100+
89101
</ul>
90102
<!-- 页首功能区域结束 -->
91103
</div>

main/resources/views/part-menu.blade.php

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
<a href="/log" class="<?php if ($xUri=='log') {echo 'AdminMenuItemNow';} else { echo 'AdminMenuItem';} ?>" >{{ __('main.menu_log') }}</a>
2020

21+
<a href="/gologout" class="<?php if ($xUri=='gologout') {echo 'AdminMenuItemNow';} else { echo 'AdminMenuItem';} ?>" >{{ __('main.menu_gologout') }}</a>
2122
</div>
2223
</div>
2324
</div>

main/routes/web.php

+28-15
Original file line numberDiff line numberDiff line change
@@ -320,8 +320,11 @@ function Get_info_Storage() { //获取存储相关信息
320320

321321
/* ====== 系统路由区域 ====== */
322322
Route::match(['get','post'],'/', function () { //系统登录页面,处理登录相关功能
323-
$zU=Session::get('User',''); $zP=Session::get('Pass','');
324-
if (trim($zU)=='' or trim($zP)=='') { return redirect('/login'); /* 无验证信息 , 重定向至登录页面; */ } else { return redirect('/index'); /* 有验证信息 , 重定向至主控制面板; */ }
323+
if (trim(Session::get('User',''))=='' or trim(Session::get('Pass',''))=='') {
324+
return redirect('/login'); //无验证信息 , 重定向至登录页面
325+
} else {
326+
return redirect('/index'); //有验证信息 , 重定向至主控制面板
327+
}
325328
});
326329

327330
Route::get('/lang', function (Request $request) { //设置语言页面,处理设置语言的功能
@@ -341,7 +344,6 @@ function Get_info_Storage() { //获取存储相关信息
341344
$LangValue = strtolower(trim($LangValue)); global $qLangs; if (isset($qLangs[$LangValue])) { App::setLocale($qLangs[$LangValue]); } else { App::setLocale('en'); } //设置语言
342345
$Data['xLang']=App::getLocale(); $Data['xUri']=trim(Route::getFacadeRoot()->current()->uri()); $Data['xUrl']=trim($request->fullUrl()); $Data['xReferer']=trim(request()->headers->get('referer')); $Data['xClientIP']=trim($request->ip());
343346
$Data['xLastRequest']=date("Y-m-d H:i:s",time()); Session::put('LastRequest',$Data['xLastRequest']);/*[End]*/
344-
Session::put('LastRequest',$Data['xLastRequest']); /*[End]*/
345347
/* ====== 处理路由 Begin ====== */
346348
$Message = $request->input('mid'); //get和post一起取,同名post覆盖get;
347349
if (!isset($Message)) {$Message = $request->input('m', '000000');}
@@ -360,19 +362,13 @@ function Get_info_Storage() { //获取存储相关信息
360362
if (!isset($LangValue)) {$LangValue = Session::get('Lang','en'); } //如果Cookie未设置就读取Session中的Lang;
361363
$LangValue = strtolower(trim($LangValue)); global $qLangs; if (isset($qLangs[$LangValue])) { App::setLocale($qLangs[$LangValue]); } else { App::setLocale('en'); } //设置语言
362364
$Data['xLang']=App::getLocale(); $Data['xUri']=trim(Route::getFacadeRoot()->current()->uri()); $Data['xUrl']=trim($request->fullUrl()); $Data['xReferer']=trim(request()->headers->get('referer')); $Data['xClientIP']=trim($request->ip());
363-
$Data['xLastRequest']=date("Y-m-d H:i:s",time()); Session::put('LastRequest',$Data['xLastRequest']);/*[End]*/
364-
/* --- 判断是否登录成功[Begin] --- */
365-
$xU=trim(Session::get('User','')); $xP=trim(Session::get('Pass',''));
366-
$xV=Chk_Authenticate_Session($xU,$xP); if ($xV[0]==false) { Session::forget(['User','Pass']); return redirect('/login'); /* 用户名密码验证失败 , 重定向至登录页面; */ }
365+
$Data['xLastRequest']=date("Y-m-d H:i:s",time()); /*[End]*/
367366
/* ====== 处理路由 Begin ====== */
368-
Session::forget(['User','Pass']);
369-
Session::flush();
370-
sleep(1);
371367
$Data['xMessage']=trans('main.LogoutMsg');
372368
$Data['xMessage_Center']='T'; //文字中间对齐
373369
$Data['xMessage_UrlTime']=3;
374370
$Data['xMessage_Url']='/';
375-
var_dump([Session::get('User',''),Session::get('Pass','')]);
371+
Session::forget(['User','Pass']);
376372
return view('message',$Data); //输出页面;
377373
});
378374

@@ -470,6 +466,23 @@ function Get_info_Storage() { //获取存储相关信息
470466
}
471467
})->name('login');
472468

469+
Route::get('/gologout', function (Request $request) { //登出页面
470+
/* --- 设置语言[Begin] --- */
471+
$LangValue = $request->cookie('Lang'); //读取Cookie中的Lang;
472+
if (!isset($LangValue)) {$LangValue = Session::get('Lang','en'); } //如果Cookie未设置就读取Session中的Lang;
473+
$LangValue = strtolower(trim($LangValue)); global $qLangs; if (isset($qLangs[$LangValue])) { App::setLocale($qLangs[$LangValue]); } else { App::setLocale('en'); } //设置语言
474+
$Data['xLang']=App::getLocale(); $Data['xUri']=trim(Route::getFacadeRoot()->current()->uri()); $Data['xUrl']=trim($request->fullUrl()); $Data['xReferer']=trim(request()->headers->get('referer')); $Data['xClientIP']=trim($request->ip());
475+
$Data['xLastRequest']=date("Y-m-d H:i:s",time()); Session::put('LastRequest',$Data['xLastRequest']);/*[End]*/
476+
/* --- 判断是否登录成功[Begin] --- */
477+
$xU=trim(Session::get('User','')); $xP=trim(Session::get('Pass',''));
478+
$xV=Chk_Authenticate_Session($xU,$xP); if ($xV[0]==false) { Session::forget(['User','Pass']); return redirect('/login'); /* 用户名密码验证失败 , 重定向至登录页面; */ }
479+
//密码验证正确,开始输出控制面板 ===>>>
480+
$Data['xSysInfo']=Get_info_Net();
481+
Log::info('GoLogout');
482+
$Data['xUser']=trim($xV[1]); return view('gologout',$Data); //输出页面;
483+
/*[End]*/
484+
});
485+
473486
Route::get('/index', function (Request $request) { //系统首页
474487
/* --- 设置语言[Begin] --- */
475488
$LangValue = $request->cookie('Lang'); //读取Cookie中的Lang;
@@ -483,7 +496,7 @@ function Get_info_Storage() { //获取存储相关信息
483496
//密码验证正确,开始输出控制面板 ===>>>
484497
//$HW=Get_phpSysinfo($hosturl=URL::secureAsset(''),$decode=true);
485498
$Data['xSysInfo']=Get_info_All();
486-
Log::info('打开控制面板!');
499+
Log::info('Dashboard');
487500
$Data['xUser']=trim($xV[1]); return view('index',$Data); //输出页面;
488501
/*[End]*/
489502
});
@@ -500,7 +513,7 @@ function Get_info_Storage() { //获取存储相关信息
500513
$xV=Chk_Authenticate_Session($xU,$xP); if ($xV[0]==false) { Session::forget(['User','Pass']); return redirect('/login'); /* 用户名密码验证失败 , 重定向至登录页面; */ }
501514
//密码验证正确,开始输出控制面板 ===>>>
502515
$Data['xSysInfo']=Get_info_Net();
503-
Log::info('打开控制面板!');
516+
Log::info('Log');
504517
$Data['xUser']=trim($xV[1]); return view('log',$Data); //输出页面;
505518
/*[End]*/
506519
});
@@ -516,7 +529,7 @@ function Get_info_Storage() { //获取存储相关信息
516529
$xU=trim(Session::get('User','')); $xP=trim(Session::get('Pass',''));
517530
$xV=Chk_Authenticate_Session($xU,$xP); if ($xV[0]==false) { Session::forget(['User','Pass']); return redirect('/login'); /* 用户名密码验证失败 , 重定向至登录页面; */ }
518531
//密码验证正确,开始输出控制面板 ===>>>
519-
Log::info('打开控制面板!');
532+
Log::info('About');
520533
$Data['xUser']=trim($xV[1]); return view('about',$Data); //输出页面;
521534
/*[End]*/
522535
});
@@ -532,7 +545,7 @@ function Get_info_Storage() { //获取存储相关信息
532545
$xU=trim(Session::get('User','')); $xP=trim(Session::get('Pass',''));
533546
$xV=Chk_Authenticate_Session($xU,$xP); if ($xV[0]==false) { Session::forget(['User','Pass']); return redirect('/login'); /* 用户名密码验证失败 , 重定向至登录页面; */ }
534547
//密码验证正确,开始输出控制面板 ===>>>
535-
Log::info('打开控制面板!');
548+
Log::info('Preferences');
536549
$Data['xUser']=trim($xV[1]); return view('preferences',$Data); //输出页面;
537550
/*[End]*/
538551
});

phplibs/test/.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*
2+
!.gitignore

0 commit comments

Comments
 (0)