refactor(web/super_manage): super_manage v2 (#7)
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Baoshuo Ren 2022-10-20 21:34:00 +08:00 committed by GitHub
commit a256309d5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 1183 additions and 838 deletions

View File

@ -11,5 +11,5 @@
become404Page();
}
redirectTo(HTML::blog_url($blog['poster'], '/post/'.$_GET['id']));
redirectTo(HTML::blog_url($blog['poster'], '/post/'.$_GET['id'] . ($_GET['sub'] ?: '')));
?>

File diff suppressed because it is too large Load Diff

View File

@ -341,7 +341,7 @@ EOD);
</div>
<?php if (isSuperUser($myUser) && $user['username'] != $myUser['username']): ?>
<div class="alert alert-warning mb-0" role="alert">
如需重置其他用户的密码,请前往 <a href="/super-manage/users" class="alert-link">系统管理</a> 页面操作。
如需重置其他用户的密码,请前往 <a href="/super_manage/users" class="alert-link">系统管理</a> 页面操作。
</div>
<?php endif ?>
@ -410,6 +410,20 @@ EOD);
<?php else: ?>
<fieldset disabled>
<?php endif ?>
<div class="mb-3">
<span>
<?= UOJLocale::get('user::user group') ?>
</span>
<span class="d-inline-block ms-3">
<?php if ($user['usergroup'] == 'S'): ?>
<?= UOJLocale::get('user::super user') ?>
<?php elseif ($user['usergroup'] == 'B'): ?>
<?= UOJLocale::get('user::banned user') ?>
<?php else: ?>
<?= UOJLocale::get('user::normal user') ?>
<?php endif ?>
</span>
</div>
<div class="input-group mb-3">
<label for="input-user_type" class="form-label">
<?= UOJLocale::get('user::user type') ?>

View File

@ -111,7 +111,7 @@ EOD;
<label for="input-$name" class="col-sm-2 control-label">$label_text</label>
<div class="col-sm-3">
<input type="$type" class="form-control" name="$name" id="input-$name" value="$default_value" />
<span class="help-block" id="help-$name"></span>
<span class="help-block invalid-feedback" id="help-$name"></span>
</div>
</div>
EOD;
@ -197,7 +197,7 @@ EOD;
<label for="input-$name" class="col-sm-2 control-label">$label_text</label>
<div class="col-sm-10">
<textarea class="form-control" name="$name" id="input-$name">$default_value</textarea>
<span class="help-block" id="help-$name"></span>
<span class="help-block invalid-feedback" id="help-$name"></span>
</div>
</div>
EOD;
@ -210,7 +210,7 @@ EOD;
<div id="div-$name" class="form-group">
<label for="input-$name" class="control-label">$label_text</label>
<textarea class="form-control" name="$name" id="input-$name">$default_value</textarea>
<span class="help-block" id="help-$name"></span>
<span class="help-block invalid-feedback" id="help-$name"></span>
</div>
EOD;
$this->add($name, $html, $validator_php, $validator_js, $no_val);
@ -270,7 +270,7 @@ EOD;
<div id="div-$name">
<label for="input-$name" class="control-label">$label_text</label>
<textarea class="ckeditor" name="$name" id="input-$name">$default_value</textarea>
<span class="help-block" id="help-$name"></span>
<span class="help-block invalid-feedback" id="help-$name"></span>
</div>
EOD;
$this->add($name, $html, $validator_php, $validator_js);
@ -333,7 +333,7 @@ EOD
<div id="div-$name">
<label for="input-$name" class="control-label">$label_text</label>
<textarea name="$name" id="input-$name">$default_value</textarea>
<span class="help-block" id="help-$name"></span>
<span class="help-block invalid-feedback" id="help-$name"></span>
</div>
<script type="text/javascript">
$('#input-$name').slide_editor();
@ -794,7 +794,7 @@ EOD;
<button type="button" class="btn btn-primary" style="width:100px; !important" onclick="$('#input-{$name}').click();"><span class="glyphicon glyphicon-folder-open"></span> $browse_text</button>
</span>
</div>
<span class="help-block" id="help-{$name}"></span>
<span class="help-block invalid-feedback" id="help-{$name}"></span>
</div>
EOD;

View File

@ -88,7 +88,7 @@ function getUserLink($username) {
if ($realname == "") {
return '<span class="uoj-username">'.$username.'</span>';
} else {
return '<span class="uoj-username" data-realname="'.$realname.'">'.$username.'</span>';
return '<span class="uoj-username" data-realname="'.HTML::escape($realname).'">'.$username.'</span>';
}
} else {
$esc_username = HTML::escape($username);

View File

@ -1,5 +1,9 @@
<?php
return [
'user group' => 'User Group',
'super user' => 'Super User',
'normal user' => 'Normal User',
'banned user' => 'Banned User',
'real name' => 'Real name',
'belongs to these groups' => 'Belongs to these groups:',
'avatar source' => 'Avatar source',

View File

@ -1,5 +1,9 @@
<?php
return [
'user group' => '用户类别',
'super user' => '超级用户',
'normal user' => '普通用户',
'banned user' => '封禁用户',
'real name' => '真实姓名',
'belongs to these groups' => '属于这些小组:',
'avatar source' => '头像来源',

View File

@ -58,6 +58,7 @@ Route::group([
}
Route::any('/blogs/{id}', '/blog_show.php');
Route::any('/post/{id}', '/blog_show.php');
Route::any('/post/{id}/write', '/blog_show.php?sub=%2Fwrite');
Route::any('/announcements', '/announcements.php');
@ -76,7 +77,7 @@ Route::group([
Route::any('/user_msg', '/user_msg.php');
Route::any('/user/{username}/system_msg', '/user_system_msg.php');
Route::any('/super-manage(?:/{tab})?', '/super_manage.php');
Route::any('/super_manage(?:/{tab})?', '/super_manage.php');
Route::any('/download.php', '/download.php');

View File

@ -145,7 +145,7 @@ mb-4" role="navigation">
</li>
<?php if (isSuperUser(Auth::user())): ?>
<li>
<a class="dropdown-item" href="<?= HTML::url('/super-manage') ?>">
<a class="dropdown-item" href="<?= HTML::url('/super_manage') ?>">
<?= UOJLocale::get('system manage') ?>
</a>
</li>

View File

@ -212,7 +212,7 @@ mb-4" role="navigation">
</li>
<?php if (isSuperUser(Auth::user())): ?>
<li>
<a class="dropdown-item" href="<?= HTML::url('/super-manage') ?>">
<a class="dropdown-item" href="<?= HTML::url('/super_manage') ?>">
<?= UOJLocale::get('system manage') ?>
</a>
</li>

View File

@ -265,7 +265,7 @@
<li role="presentation"><a class="dropdown-item" href="<?= HTML::url('/user_msg') ?>"><?= UOJLocale::get('private message') ?>&nbsp;&nbsp;<?= $new_user_msg_num_html ?></a></li>
<li role="presentation"><a class="dropdown-item" href="<?= HTML::url('/user/'.Auth::id().'/system_msg') ?>"><?= UOJLocale::get('system message') ?>&nbsp;&nbsp;<?= $new_system_msg_num_html ?></a></li>
<?php if (isSuperUser(Auth::user())): ?>
<li role="presentation"><a class="dropdown-item" href="<?= HTML::url('/super-manage') ?>"><?= UOJLocale::get('system manage') ?></a></li>
<li role="presentation"><a class="dropdown-item" href="<?= HTML::url('/super_manage') ?>"><?= UOJLocale::get('system manage') ?></a></li>
<?php endif ?>
</ul>
</li>

View File

@ -576,19 +576,39 @@ $.fn.long_table = function(data, cur_page, header_row, get_row_str, config) {
if (n_pages > 1) {
var pagination = $('<ul class="pagination top-buffer-no bot-buffer-sm justify-content-center"></ul>');
if (cur_page > 1) {
if (isBootstrap5Page) {
pagination.append(get_page_li(1, '<i class="bi bi-chevron-double-left"></i>'));
pagination.append(get_page_li(cur_page - 1, '<i class="bi bi-chevron-left"></i>'));
} else {
pagination.append(get_page_li(cur_page - 1, '<span class="glyphicon glyphicon glyphicon-backward"></span>'));
}
} else {
if (isBootstrap5Page) {
pagination.append(get_page_li(-1, '<i class="bi bi-chevron-double-left"></i>'));
pagination.append(get_page_li(-1, '<i class="bi bi-chevron-left"></i>'));
} else {
pagination.append(get_page_li(-1, '<span class="glyphicon glyphicon glyphicon-backward"></span>'));
}
}
var max_extend = config.max_extend != undefined ? config.max_extend : 5;
for (var i = Math.max(cur_page - max_extend, 1); i <= Math.min(cur_page + max_extend, n_pages); i++) {
pagination.append(get_page_li(i, i.toString()));
}
if (cur_page < n_pages) {
if (isBootstrap5Page) {
pagination.append(get_page_li(cur_page + 1, '<i class="bi bi-chevron-right"></i>'));
pagination.append(get_page_li(n_pages, '<i class="bi bi-chevron-double-right"></i>'));
} else {
pagination.append(get_page_li(cur_page + 1, '<span class="glyphicon glyphicon glyphicon-forward"></span>'));
}
} else {
if (isBootstrap5Page) {
pagination.append(get_page_li(-1, '<i class="bi bi-chevron-right"></i>'));
pagination.append(get_page_li(-1, '<i class="bi bi-chevron-double-right"></i>'));
} else {
pagination.append(get_page_li(-1, '<span class="glyphicon glyphicon glyphicon-forward"></span>'));
}
}
$(table_div).append($('<div class="text-center"></div>').append(pagination));
}
});