mirror of https://github.com/1099438829/apeblog
修复8.2的兼容性
This commit is contained in:
parent
7cb03187a9
commit
469e711f28
|
|
@ -4,6 +4,7 @@
|
|||
namespace app\common\model;
|
||||
|
||||
|
||||
use think\db\BaseQuery;
|
||||
use think\db\exception\DataNotFoundException;
|
||||
use think\db\exception\DbException;
|
||||
use think\db\exception\ModelNotFoundException;
|
||||
|
|
@ -120,9 +121,9 @@ trait ModelTrait
|
|||
* @param null $eachFn 处理结果函数
|
||||
* @param array $params 分页参数
|
||||
* @param int $limit 分页数
|
||||
* @return ModelTrait
|
||||
* @return array
|
||||
*/
|
||||
public static function page($model = null, $eachFn = null, $params = [], $limit = 20): ModelTrait
|
||||
public static function page($model = null, $eachFn = null, $params = [], $limit = 20): array
|
||||
{
|
||||
if (is_numeric($eachFn) && is_numeric($model)) {
|
||||
return parent::page($model, $eachFn);
|
||||
|
|
|
|||
|
|
@ -20,11 +20,12 @@ class UrlLog extends BaseModel
|
|||
if ($url_data) {
|
||||
$this->where($urlWhere)->inc('pv')->update();
|
||||
} else {
|
||||
$dataUrl['url'] = $url;
|
||||
$dataUrl['pv'] = 1;
|
||||
$dataUrl['title'] = $title;
|
||||
$dataUrl['date'] = $date_data;
|
||||
$this->insertGetId($dataUrl);
|
||||
$model = new self();
|
||||
$model->url = $url;
|
||||
$model->pv = 1;
|
||||
$model->title = $title;
|
||||
$model->date = $date_data;
|
||||
$model->save();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,12 +30,10 @@ class Base extends BaseController
|
|||
protected function initialize()
|
||||
{
|
||||
parent::initialize();
|
||||
$this->userInfo = Session::get(Data::SESSION_KEY_USER_INFO);
|
||||
$this->userId = Session::get(Data::SESSION_KEY_USER_ID);
|
||||
|
||||
if ($this->userId){
|
||||
if (!empty($this->userId)){
|
||||
//模板兼容性标签
|
||||
$this->assign('user_info', $this->userInfo);
|
||||
$this->assign('user_info', Session::get(Data::SESSION_KEY_USER_INFO));
|
||||
$this->assign('user_id', $this->userId);
|
||||
}
|
||||
//判断是否关闭站点。
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@
|
|||
<div class="post-item-meta">
|
||||
<div class="post-item-meta-item">
|
||||
<span class="post-item-meta-author">
|
||||
<!-- <img src="{$field['avatar']}" width="24" height="24" alt="头像" class="avatar avatar-24 wp-user-avatar wp-user-avatar-24 photo avatar-default post-item-avatar">-->
|
||||
<!-- <img src="" width="24" height="24" alt="头像" class="avatar avatar-24 wp-user-avatar wp-user-avatar-24 photo avatar-default post-item-avatar">-->
|
||||
{$field['author']}
|
||||
</span>
|
||||
<span class="post-item-time">{$field['create_time']}</span>
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@
|
|||
<div class="menu-mobile">
|
||||
<ul class="menu-mobile-header-list">
|
||||
{ape:nav type="all"}
|
||||
<li id="menu-item-{$field.id}" class="menu-item {notempty name="field['child']"}menu-item-has-children{/notempty} {:is_active_nav($cid,$field['id'])?'current-menu-item current_page_item':''} menu-item-{$field['id']}">
|
||||
<li id="menu-item-{$field.id}" class="menu-item {notempty name="field['child']"}menu-item-has-children {:is_active_nav($cid,$field['pid'])?'current-menu-item current_page_item':''} {else} {:is_active_nav($cid,$field['id'])?'current-menu-item current_page_item':''} {/notempty} menu-item-{$field['id']}">
|
||||
{notempty name="field['child']"}
|
||||
<a href="#" aria-current="page">{$field['title']}</a>
|
||||
{else /}
|
||||
|
|
|
|||
|
|
@ -1365,17 +1365,17 @@
|
|||
},
|
||||
{
|
||||
"name": "symfony/http-foundation",
|
||||
"version": "v5.4.28",
|
||||
"version_normalized": "5.4.28.0",
|
||||
"version": "v5.4.30",
|
||||
"version_normalized": "5.4.30.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/http-foundation.git",
|
||||
"reference": "365992c83a836dfe635f1e903ccca43ee03d3dd2"
|
||||
"reference": "671769f79de0532da1478c60968b42506e185d2e"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/365992c83a836dfe635f1e903ccca43ee03d3dd2",
|
||||
"reference": "365992c83a836dfe635f1e903ccca43ee03d3dd2",
|
||||
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/671769f79de0532da1478c60968b42506e185d2e",
|
||||
"reference": "671769f79de0532da1478c60968b42506e185d2e",
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
|
|
@ -1402,7 +1402,7 @@
|
|||
"suggest": {
|
||||
"symfony/mime": "To use the file extension guesser"
|
||||
},
|
||||
"time": "2023-08-21T07:23:18+00:00",
|
||||
"time": "2023-10-28T23:35:12+00:00",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
|
|
@ -1430,7 +1430,7 @@
|
|||
"description": "Defines an object-oriented layer for the HTTP specification",
|
||||
"homepage": "https://symfony.com",
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/http-foundation/tree/v5.4.28"
|
||||
"source": "https://github.com/symfony/http-foundation/tree/v5.4.30"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
'name' => 'topthink/think',
|
||||
'pretty_version' => 'dev-master',
|
||||
'version' => 'dev-master',
|
||||
'reference' => 'a284ab8feb3db76d633b4d2320202e59e209a9a0',
|
||||
'reference' => '7cb03187a94546bb6ec2c895b331743c8c72fce9',
|
||||
'type' => 'project',
|
||||
'install_path' => __DIR__ . '/../../',
|
||||
'aliases' => array(),
|
||||
|
|
@ -194,9 +194,9 @@
|
|||
),
|
||||
),
|
||||
'symfony/http-foundation' => array(
|
||||
'pretty_version' => 'v5.4.28',
|
||||
'version' => '5.4.28.0',
|
||||
'reference' => '365992c83a836dfe635f1e903ccca43ee03d3dd2',
|
||||
'pretty_version' => 'v5.4.30',
|
||||
'version' => '5.4.30.0',
|
||||
'reference' => '671769f79de0532da1478c60968b42506e185d2e',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../symfony/http-foundation',
|
||||
'aliases' => array(),
|
||||
|
|
@ -295,7 +295,7 @@
|
|||
'topthink/think' => array(
|
||||
'pretty_version' => 'dev-master',
|
||||
'version' => 'dev-master',
|
||||
'reference' => 'a284ab8feb3db76d633b4d2320202e59e209a9a0',
|
||||
'reference' => '7cb03187a94546bb6ec2c895b331743c8c72fce9',
|
||||
'type' => 'project',
|
||||
'install_path' => __DIR__ . '/../../',
|
||||
'aliases' => array(),
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
// This file is automatically generated at:2023-10-18 19:05:37
|
||||
// This file is automatically generated at:2023-11-03 23:08:15
|
||||
declare (strict_types = 1);
|
||||
return array (
|
||||
0 => 'think\\captcha\\CaptchaService',
|
||||
|
|
|
|||
|
|
@ -33,17 +33,21 @@ class HeaderUtils
|
|||
*
|
||||
* Example:
|
||||
*
|
||||
* HeaderUtils::split("da, en-gb;q=0.8", ",;")
|
||||
* HeaderUtils::split('da, en-gb;q=0.8', ',;')
|
||||
* // => ['da'], ['en-gb', 'q=0.8']]
|
||||
*
|
||||
* @param string $separators List of characters to split on, ordered by
|
||||
* precedence, e.g. ",", ";=", or ",;="
|
||||
* precedence, e.g. ',', ';=', or ',;='
|
||||
*
|
||||
* @return array Nested array with as many levels as there are characters in
|
||||
* $separators
|
||||
*/
|
||||
public static function split(string $header, string $separators): array
|
||||
{
|
||||
if ('' === $separators) {
|
||||
throw new \InvalidArgumentException('At least one separator must be specified.');
|
||||
}
|
||||
|
||||
$quotedSeparators = preg_quote($separators, '/');
|
||||
|
||||
preg_match_all('
|
||||
|
|
@ -77,8 +81,8 @@ class HeaderUtils
|
|||
*
|
||||
* Example:
|
||||
*
|
||||
* HeaderUtils::combine([["foo", "abc"], ["bar"]])
|
||||
* // => ["foo" => "abc", "bar" => true]
|
||||
* HeaderUtils::combine([['foo', 'abc'], ['bar']])
|
||||
* // => ['foo' => 'abc', 'bar' => true]
|
||||
*/
|
||||
public static function combine(array $parts): array
|
||||
{
|
||||
|
|
@ -95,13 +99,13 @@ class HeaderUtils
|
|||
/**
|
||||
* Joins an associative array into a string for use in an HTTP header.
|
||||
*
|
||||
* The key and value of each entry are joined with "=", and all entries
|
||||
* The key and value of each entry are joined with '=', and all entries
|
||||
* are joined with the specified separator and an additional space (for
|
||||
* readability). Values are quoted if necessary.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* HeaderUtils::toString(["foo" => "abc", "bar" => true, "baz" => "a b c"], ",")
|
||||
* HeaderUtils::toString(['foo' => 'abc', 'bar' => true, 'baz' => 'a b c'], ',')
|
||||
* // => 'foo=abc, bar, baz="a b c"'
|
||||
*/
|
||||
public static function toString(array $assoc, string $separator): string
|
||||
|
|
@ -252,42 +256,39 @@ class HeaderUtils
|
|||
private static function groupParts(array $matches, string $separators, bool $first = true): array
|
||||
{
|
||||
$separator = $separators[0];
|
||||
$partSeparators = substr($separators, 1);
|
||||
|
||||
$separators = substr($separators, 1);
|
||||
$i = 0;
|
||||
$partMatches = [];
|
||||
$previousMatchWasSeparator = false;
|
||||
|
||||
if ('' === $separators && !$first) {
|
||||
$parts = [''];
|
||||
|
||||
foreach ($matches as $match) {
|
||||
if (!$first && $previousMatchWasSeparator && isset($match['separator']) && $match['separator'] === $separator) {
|
||||
$previousMatchWasSeparator = true;
|
||||
$partMatches[$i][] = $match;
|
||||
} elseif (isset($match['separator']) && $match['separator'] === $separator) {
|
||||
$previousMatchWasSeparator = true;
|
||||
++$i;
|
||||
if (!$i && isset($match['separator'])) {
|
||||
$i = 1;
|
||||
$parts[1] = '';
|
||||
} else {
|
||||
$previousMatchWasSeparator = false;
|
||||
$partMatches[$i][] = $match;
|
||||
}
|
||||
}
|
||||
|
||||
$parts = [];
|
||||
if ($partSeparators) {
|
||||
foreach ($partMatches as $matches) {
|
||||
$parts[] = self::groupParts($matches, $partSeparators, false);
|
||||
}
|
||||
} else {
|
||||
foreach ($partMatches as $matches) {
|
||||
$parts[] = self::unquote($matches[0][0]);
|
||||
}
|
||||
|
||||
if (!$first && 2 < \count($parts)) {
|
||||
$parts = [
|
||||
$parts[0],
|
||||
implode($separator, \array_slice($parts, 1)),
|
||||
];
|
||||
$parts[$i] .= self::unquote($match[0]);
|
||||
}
|
||||
}
|
||||
|
||||
return $parts;
|
||||
}
|
||||
|
||||
$parts = [];
|
||||
$partMatches = [];
|
||||
|
||||
foreach ($matches as $match) {
|
||||
if (($match['separator'] ?? null) === $separator) {
|
||||
++$i;
|
||||
} else {
|
||||
$partMatches[$i][] = $match;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($partMatches as $matches) {
|
||||
$parts[] = '' === $separators ? self::unquote($matches[0][0]) : self::groupParts($matches, $separators, false);
|
||||
}
|
||||
|
||||
return $parts;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -94,27 +94,30 @@ class CustomComponent implements CustomComponentInterface, \JsonSerializable, \A
|
|||
return $this->appendRule + $this->getRule();
|
||||
}
|
||||
|
||||
public function jsonSerialize()
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function jsonSerialize(): mixed
|
||||
{
|
||||
return $this->build();
|
||||
}
|
||||
|
||||
public function offsetExists($offset)
|
||||
public function offsetExists($offset):bool
|
||||
{
|
||||
return isset($this->props[$offset]);
|
||||
}
|
||||
|
||||
public function offsetGet($offset)
|
||||
public function offsetGet($offset): mixed
|
||||
{
|
||||
return $this->props[$offset];
|
||||
}
|
||||
|
||||
public function offsetSet($offset, $value)
|
||||
public function offsetSet($offset, $value) : void
|
||||
{
|
||||
$this->props[$offset] = $value;
|
||||
}
|
||||
|
||||
public function offsetUnset($offset)
|
||||
public function offsetUnset($offset): void
|
||||
{
|
||||
unset($this->props[$offset]);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue