This commit is contained in:
杜恒 2021-05-17 10:27:29 +08:00
parent 02150d5ef8
commit 404afe2b07
15 changed files with 182 additions and 20 deletions

1
assets/css/joe.census.min.css vendored Normal file
View File

@ -0,0 +1 @@
.joe_census__basic{display:grid;grid-template-columns:repeat(4, 1fr);gap:15px}.joe_census__basic-item{display:flex;align-items:center;justify-content:space-between;background:var(--background);box-shadow:var(--box-shadow);border-radius:var(--radius-inner) var(--radius-wrap) var(--radius-wrap) var(--radius-inner);padding:12px 15px}.joe_census__basic-item .count h6{font-size:12px;margin-bottom:10px;color:var(--seat)}.joe_census__basic-item .count p{font-size:22px;font-weight:700}.joe_census__basic-item .icon{fill:var(--classA)}.joe_census__basic-item:nth-child(1){border-left:5px solid #1cc88a;color:#1cc88a}.joe_census__basic-item:nth-child(2){border-left:5px solid #36b9cc;color:#36b9cc}.joe_census__basic-item:nth-child(3){border-left:5px solid #2196f3;color:#2196f3}.joe_census__basic-item:nth-child(4){border-left:5px solid #9c27b0;color:#9c27b0}

View File

@ -0,0 +1,46 @@
.joe_census {
&__basic {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 15px;
&-item {
display: flex;
align-items: center;
justify-content: space-between;
background: var(--background);
box-shadow: var(--box-shadow);
border-radius: var(--radius-inner) var(--radius-wrap) var(--radius-wrap) var(--radius-inner);
padding: 12px 15px;
.count {
h6 {
font-size: 12px;
margin-bottom: 10px;
color: var(--seat);
}
p {
font-size: 22px;
font-weight: 700;
}
}
.icon {
fill: var(--classA);
}
&:nth-child(1) {
border-left: 5px solid #1cc88a;
color: #1cc88a;
}
&:nth-child(2) {
border-left: 5px solid #36b9cc;
color: #36b9cc;
}
&:nth-child(3) {
border-left: 5px solid #2196f3;
color: #2196f3;
}
&:nth-child(4) {
border-left: 5px solid #9c27b0;
color: #9c27b0;
}
}
}
}

File diff suppressed because one or more lines are too long

View File

@ -3231,6 +3231,11 @@
right: 0; right: 0;
} }
} }
&.captcha {
display: flex;
align-items: center;
justify-content: space-between;
}
} }
} }
.body { .body {

3
assets/js/joe.census.js Normal file
View File

@ -0,0 +1,3 @@
document.addEventListener('DOMContentLoaded', () => {
console.log(1);
})

1
assets/js/joe.census.min.js vendored Normal file
View File

@ -0,0 +1 @@
document.addEventListener("DOMContentLoaded",()=>{console.log(1)});

View File

@ -332,8 +332,8 @@ document.addEventListener('DOMContentLoaded', () => {
if (author.trim() === '') return Qmsg.info('请输入昵称!'); if (author.trim() === '') return Qmsg.info('请输入昵称!');
if (!/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/.test(mail)) return Qmsg.info('请输入正确的邮箱!'); if (!/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/.test(mail)) return Qmsg.info('请输入正确的邮箱!');
/* -- 验证码前端校验 -- */ /* -- 验证码前端校验 -- */
const sum = $(".joe_comment__respond-form .head input[name='sum']").val(); const captcha = $(".joe_comment__respond-form .head input[name='captcha']").val();
if (sum.trim() === '') return Qmsg.info('请输入计算结果'); if (captcha.trim() === '') return Qmsg.info('请输入验证码');
/* -- 验证码前端校验 -- */ /* -- 验证码前端校验 -- */
if (type === 'text' && text.trim() === '') return Qmsg.info('请输入评论内容!'); if (type === 'text' && text.trim() === '') return Qmsg.info('请输入评论内容!');
if (type === 'draw') { if (type === 'draw') {
@ -346,7 +346,7 @@ document.addEventListener('DOMContentLoaded', () => {
$.ajax({ $.ajax({
url, url,
type: 'POST', type: 'POST',
data: { author, mail, text, parent, sum }, data: { author, mail, text, parent, captcha },
dataType: 'text', dataType: 'text',
success(res) { success(res) {
let arr = [], let arr = [],

File diff suppressed because one or more lines are too long

74
census.php Normal file
View File

@ -0,0 +1,74 @@
<?php
/**
* 统计
*
* @package custom
*
**/
?>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<?php $this->need('public/include.php'); ?>
<link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/joe.census.min.css'); ?>">
<script src="https://cdn.jsdelivr.net/npm/echarts@5.1.1/dist/echarts.min.js"></script>
<script src="<?php $this->options->themeUrl('assets/js/joe.census.min.js'); ?>"></script>
</head>
<body>
<div id="Joe">
<?php $this->need('public/header.php'); ?>
<div class="joe_container">
<div class="joe_main">
<?php Typecho_Widget::widget('Widget_Stat')->to($item); ?>
<div class="joe_census__basic">
<div class="joe_census__basic-item">
<div class="count">
<h6>文章数</h6>
<p><?php echo number_format($item->publishedPostsNum); ?></p>
</div>
<svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="30" height="30">
<path d="M947.2 298.667c0-34.134-12.8-68.267-38.4-89.6L814.933 115.2c-51.2-51.2-132.266-51.2-179.2 0l-512 516.267c-25.6 21.333-38.4 55.466-38.4 89.6v132.266c0 46.934 38.4 85.334 81.067 85.334h682.667c25.6 0 42.666-17.067 42.666-42.667s-17.066-42.667-42.666-42.667h-409.6L908.8 388.267c25.6-25.6 38.4-55.467 38.4-89.6zM170.667 853.333V721.067c0-12.8 4.266-21.334 12.8-29.867l413.866-418.133 153.6 153.6-413.866 413.866c-8.534 8.534-21.334 12.8-34.134 12.8H170.667zm678.4-524.8l-38.4 38.4-153.6-153.6 38.4-38.4c8.533-8.533 21.333-12.8 29.866-12.8 12.8 0 21.334 4.267 29.867 12.8l93.867 93.867c8.533 8.533 12.8 17.067 12.8 29.867s-4.267 21.333-12.8 29.866z" />
</svg>
</div>
<div class="joe_census__basic-item">
<div class="count">
<h6>评论数</h6>
<p><?php echo number_format($item->publishedCommentsNum); ?></p>
</div>
<svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="32" height="32">
<path d="M511.914 928.016c-8.257 0-16.341-3.096-22.706-9.46l-95.984-95.985c-12.557-12.557-12.557-32.682 0-45.24s32.683-12.556 45.24 0l73.45 73.45 73.45-73.45c6.02-6.02 14.105-9.46 22.706-9.46h223.962c17.718 0 31.995-14.277 31.995-31.995V223.962c0-17.545-14.277-31.994-31.995-31.994H192.14c-17.546 0-31.995 14.449-31.995 31.994v511.914c0 17.718 14.45 31.995 31.995 31.995h95.984c17.717 0 31.994 14.277 31.994 31.995s-14.277 31.994-31.994 31.994H192.14c-52.98 0-95.984-43.003-95.984-95.984V223.962c0-52.98 43.003-95.984 95.984-95.984h639.892c52.98 0 95.984 43.004 95.984 95.984v511.914c0 52.98-43.003 95.984-95.984 95.984H621.143l-86.523 86.695c-6.193 6.193-14.45 9.461-22.706 9.461z" />
<path d="M335.944 511.914c-26.49 0-47.992-21.502-47.992-47.992s21.501-47.992 47.992-47.992 47.991 21.502 47.991 47.992-21.501 47.992-47.991 47.992zm191.967 0c-26.49 0-47.992-21.502-47.992-47.992s21.502-47.992 47.992-47.992 47.992 21.502 47.992 47.992-21.502 47.992-47.992 47.992zm192.14 0c-26.49 0-47.992-21.502-47.992-47.992s21.502-47.992 47.992-47.992 47.992 21.502 47.992 47.992-21.674 47.992-47.992 47.992z" />
</svg>
</div>
<div class="joe_census__basic-item">
<div class="count">
<h6>分类数</h6>
<p><?php echo number_format($item->categoriesNum); ?></p>
</div>
<svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="28" height="28">
<path d="M166.79 123.639v778.578l311.724-133.273a86.303 86.303 0 0 1 64.857-1.208L857.21 888.279v-764.64H166.79zM145.215 58.91h733.57a43.151 43.151 0 0 1 43.152 43.152v817.608a43.151 43.151 0 0 1-58.62 40.282l-343.14-131.806a21.576 21.576 0 0 0-16.225.303L162.194 974.582a43.151 43.151 0 0 1-60.132-39.678V102.062a43.151 43.151 0 0 1 43.153-43.15z" />
<path d="M329.816 411.307a32.363 32.363 0 1 1 0-64.727h364.368a32.363 32.363 0 1 1 0 64.727H329.816zm0 170.814a32.363 32.363 0 1 1 0-64.728h364.368a32.363 32.363 0 1 1 0 64.728H329.816z" />
</svg>
</div>
<div class="joe_census__basic-item">
<div class="count">
<h6>页面数</h6>
<p><?php echo number_format($item->publishedPagesNum + $item->publishedPostsNum); ?></p>
</div>
<svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="26" height="26">
<path d="M653.824 32.256l264.96 264.704c20.48 20.48 32.256 48.384 32.256 77.568v539.648c0 60.672-49.152 109.824-109.824 109.824H182.784c-60.672 0-109.824-49.152-109.824-109.824V109.824C73.216 49.152 122.368 0 182.784 0h393.472c29.184 0 57.088 11.52 77.568 32.256zm-32 71.168v225.792H847.36L621.824 103.424zm-60.672-30.208H182.784c-20.224 0-36.608 16.384-36.608 36.608v804.608c0 20.224 16.384 36.608 36.608 36.608H840.96c20.224 0 36.608-16.384 36.608-36.608v-524.8 12.544h-256c-40.448 0-73.216-32.768-73.216-73.216v-256h12.8zm0 0" />
</svg>
</div>
</div>
</div>
</div>
<?php $this->need('public/footer.php'); ?>
</div>
</body>
</html>

37
core/captcha.php Normal file
View File

@ -0,0 +1,37 @@
<?php
/* 生成图片验证码 */
session_start();
header("Content-type: image/png");
$image = imagecreatetruecolor(85, 40);
$bgcolor = imagecolorallocate($image, 255, 255, 255);
imagecolortransparent($image, $bgcolor);
imagefill($image, 0, 0, $bgcolor);
$content = "0123456789";
$captcha = "";
/* 绘制干扰点 */
for ($i = 0; $i < 80; $i++) {
$pointColor = imagecolorallocate($image, rand(100, 255), rand(100, 255), rand(100, 255));
imagesetpixel($image, rand(0, 85), rand(0, 40), $pointColor);
}
/* 绘制验证码 */
for ($i = 0; $i < 4; $i++) {
$fontSize = 10;
$fontColor = imagecolorallocate($image, 155, 155, 155);
$fontContent = rand(0, 9);
$captcha .= $fontContent;
$x = ($i * 85 / 4) + 7;
$y = rand(10, 15);
imagestring($image, $fontSize, $x, $y, $fontContent, $fontColor);
}
$_SESSION["captcha"] = $captcha;
imagepng($image);
imagedestroy($image);

View File

@ -10,10 +10,10 @@ class Intercept
public static function message($comment) public static function message($comment)
{ {
/* 校验验证码是否正确 */ /* 校验验证码是否正确 */
$sum = (int)Typecho_Request::getInstance()->sum;
if (!$sum) throw new Typecho_Widget_Exception('请输入计算结果!', 403);
session_start(); session_start();
if ($sum != $_SESSION['commentCode']) throw new Typecho_Widget_Exception('计算结果有误,请检查!', 403); $captcha = (int)Typecho_Request::getInstance()->captcha;
if (!$captcha) throw new Typecho_Widget_Exception('请输入验证码!', 403);
if ($captcha != $_SESSION['captcha']) throw new Typecho_Widget_Exception('验证码错误,请检查!', 403);
/* 用户输入内容画图模式 */ /* 用户输入内容画图模式 */
if (preg_match('/\{!\{(.*)\}!\}/', $comment['text'], $matches)) { if (preg_match('/\{!\{(.*)\}!\}/', $comment['text'], $matches)) {

View File

@ -2,7 +2,7 @@
/* 获取主题当前版本号 */ /* 获取主题当前版本号 */
function _getVersion() function _getVersion()
{ {
return "6.9.5"; return "6.9.6";
}; };
/* 判断是否是手机 */ /* 判断是否是手机 */

View File

@ -1,6 +1,6 @@
{ {
"name": "typecho-joe-next", "name": "typecho-joe-next",
"version": "6.9.5", "version": "6.9.6",
"description": "A Theme Of Typecho", "description": "A Theme Of Typecho",
"main": "index.php", "main": "index.php",
"keywords": [ "keywords": [

View File

@ -25,14 +25,9 @@
<div class="list"> <div class="list">
<input type="text" value="<?php $this->user->hasLogin() ? $this->user->mail() : $this->remember('mail') ?>" autocomplete="off" name="mail" placeholder="请输入邮箱..." /> <input type="text" value="<?php $this->user->hasLogin() ? $this->user->mail() : $this->remember('mail') ?>" autocomplete="off" name="mail" placeholder="请输入邮箱..." />
</div> </div>
<div class="list"> <div class="list captcha">
<?php <input maxlength="4" type="text" autocomplete="off" name="captcha" placeholder="请输入验证码..." />
session_start(); <img style="cursor: pointer;" src="<?php $this->options->themeUrl('core/captcha.php'); ?>" onclick="this.src = this.src">
$num1 = rand(1, 10);
$num2 = rand(1, 10);
$_SESSION['commentCode'] = $num1 + $num2;
?>
<input type="text" autocomplete="off" name="sum" placeholder="计算:<?php echo $num1 ?> + <?php echo $num2 ?> = ?" />
</div> </div>
</div> </div>
<div class="body"> <div class="body">

View File

@ -18,7 +18,7 @@
<?php endif; ?> <?php endif; ?>
<link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/joe.mode.min.css'); ?>"> <link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/joe.mode.min.css'); ?>">
<link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/joe.normalize.min.css'); ?>"> <link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/joe.normalize.min.css'); ?>">
<link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/joe.global.min.css'); ?>"> <link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/joe.global.min.css?v=20210517'); ?>">
<link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/joe.responsive.min.css'); ?>"> <link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/joe.responsive.min.css'); ?>">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/typecho-joe-next@6.0.0/plugin/qmsg/qmsg.css"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/typecho-joe-next@6.0.0/plugin/qmsg/qmsg.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.css" /> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.css" />
@ -40,6 +40,6 @@
<?php if ($this->options->JCursorEffects && $this->options->JCursorEffects !== 'off') : ?> <?php if ($this->options->JCursorEffects && $this->options->JCursorEffects !== 'off') : ?>
<script src="<?php $this->options->themeUrl('assets/cursor/' . $this->options->JCursorEffects); ?>" async></script> <script src="<?php $this->options->themeUrl('assets/cursor/' . $this->options->JCursorEffects); ?>" async></script>
<?php endif; ?> <?php endif; ?>
<script src="<?php $this->options->themeUrl('assets/js/joe.global.min.js?v=20210516'); ?>"></script> <script src="<?php $this->options->themeUrl('assets/js/joe.global.min.js?v=20210517'); ?>"></script>
<script src="<?php $this->options->themeUrl('assets/js/joe.short.min.js'); ?>"></script> <script src="<?php $this->options->themeUrl('assets/js/joe.short.min.js'); ?>"></script>
<?php $this->options->JCustomHeadEnd() ?> <?php $this->options->JCustomHeadEnd() ?>