added option of custom css/js
This commit is contained in:
parent
eb05fec6fb
commit
79e49201ab
@ -3,7 +3,7 @@
|
||||
* @Author: printempw
|
||||
* @Date: 2016-03-19 14:34:21
|
||||
* @Last Modified by: printempw
|
||||
* @Last Modified time: 2016-04-03 07:55:53
|
||||
* @Last Modified time: 2016-04-03 11:00:02
|
||||
*/
|
||||
require "../libraries/session.inc.php";
|
||||
if (!$user->is_admin) Utils::redirect('../index.php?msg=看起来你并不是管理员');
|
||||
@ -128,6 +128,47 @@ $db = new Database\Database('users');
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="box box-default">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">自定义 CSS/JavaScript
|
||||
<i class="fa fa-question-circle" data-toggle="tooltip" data-placement="bottom" title="字符串将会被转义"></i>
|
||||
</h3>
|
||||
</div><!-- /.box-header -->
|
||||
<form method="post" action="customize.php">
|
||||
<input type="hidden" name="option" value="adapter">
|
||||
<div class="box-body">
|
||||
<?php
|
||||
if (isset($_POST['custom_css']) && isset($_POST['custom_js'])) {
|
||||
Option::set('custom_css', Utils::convertString($_POST['custom_css']));
|
||||
Option::set('custom_js', Utils::convertString($_POST['custom_js']));
|
||||
echo '<div class="callout callout-success">设置已保存。</div>';
|
||||
} else {
|
||||
echo '<div class="callout callout-info">内容将会被追加至每个页面的 <style> 和 <script> 标签中</div>';
|
||||
} ?>
|
||||
<table class="table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="key">CSS</td>
|
||||
<td class="value">
|
||||
<textarea name="custom_css" class="form-control" rows="3"><?php echo Option::get('custom_css'); ?></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="key">JavaScript</td>
|
||||
<td class="value">
|
||||
<textarea name="custom_js" class="form-control" rows="3"><?php echo Option::get('custom_js'); ?></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div><!-- /.box-body -->
|
||||
<div class="box-footer">
|
||||
<button type="submit" name="submit" class="btn btn-primary">提交</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
@ -3,7 +3,7 @@
|
||||
* @Author: printempw
|
||||
* @Date: 2016-01-17 13:55:20
|
||||
* @Last Modified by: printempw
|
||||
* @Last Modified time: 2016-03-27 10:56:06
|
||||
* @Last Modified time: 2016-04-03 10:53:41
|
||||
*/
|
||||
session_start();
|
||||
$dir = dirname(__FILE__);
|
||||
@ -39,6 +39,7 @@ if (isset($_COOKIE['uname']) && isset($_COOKIE['token'])) {
|
||||
background-image: url("<?php echo Option::get('home_pic_url'); ?>");
|
||||
}
|
||||
</style>
|
||||
<style><?php echo Option::get('custom_css'); ?></style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@ -127,6 +128,7 @@ if (isset($_COOKIE['uname']) && isset($_COOKIE['token'])) {
|
||||
<script type="text/javascript" src="./assets/libs/ply/ply.min.js"></script>
|
||||
<script type="text/javascript" src="./assets/js/utils.js"></script>
|
||||
<script type="text/javascript" src="./assets/js/index.utils.js"></script>
|
||||
<script><?php echo Option::get('custom_js'); ?></script>
|
||||
<?php if ($msg = Utils::getValue('msg', $_GET)): ?>
|
||||
<script type="text/javascript"> showAlert("<?php echo $msg; ?>"); </script>
|
||||
<?php endif; ?>
|
||||
|
@ -3,7 +3,7 @@
|
||||
* @Author: printempw
|
||||
* @Date: 2016-01-16 23:01:33
|
||||
* @Last Modified by: printempw
|
||||
* @Last Modified time: 2016-04-03 08:07:39
|
||||
* @Last Modified time: 2016-04-03 10:58:15
|
||||
*/
|
||||
|
||||
class Utils
|
||||
@ -102,7 +102,7 @@ class Utils
|
||||
* @return string
|
||||
*/
|
||||
public static function convertString($string) {
|
||||
return stripslashes(trim($string));
|
||||
return addslashes(trim($string));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -13,6 +13,7 @@
|
||||
<link rel="stylesheet" href="../assets/libs/ply/ply.css">
|
||||
<link rel="stylesheet" href="../assets/css/admin.style.css">
|
||||
<?php if (isset($data['style'])) echo $data['style']; ?>
|
||||
<style><?php echo Option::get('custom_css'); ?></style>
|
||||
</head>
|
||||
|
||||
<body class="hold-transition <?php echo Option::get('color_scheme'); ?> sidebar-mini">
|
||||
|
@ -17,5 +17,6 @@
|
||||
<script type="text/javascript" src="../assets/libs/cookie.js"></script>
|
||||
<script type="text/javascript" src="../assets/js/utils.js"></script>
|
||||
<?php if (isset($data['script'])) echo $data['script']; ?>
|
||||
<script><?php echo Option::get('custom_js'); ?></script>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -12,6 +12,7 @@
|
||||
<link rel="stylesheet" href="../assets/libs/AdminLTE/dist/css/skins/<?php echo Option::get('color_scheme'); ?>.min.css">
|
||||
<link rel="stylesheet" href="../assets/libs/ply/ply.css">
|
||||
<?php if (isset($data['style'])) echo $data['style']; ?>
|
||||
<style><?php echo Option::get('custom_css'); ?></style>
|
||||
</head>
|
||||
|
||||
<body class="hold-transition <?php echo Option::get('color_scheme'); ?> sidebar-mini">
|
||||
|
Loading…
Reference in New Issue
Block a user