Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4079a64a88 | ||
|
|
9364388035 | ||
|
|
7a3c86a110 | ||
|
|
15967ea059 | ||
|
|
570f982709 | ||
|
|
6dbcdf7eae | ||
|
|
5e7e10969e | ||
|
|
3d261e08b9 | ||
|
|
546470b2de | ||
|
|
23cdc89441 | ||
|
|
d9d0be334d |
0
.gitmodules
vendored
0
.gitmodules
vendored
File diff suppressed because one or more lines are too long
@@ -583,44 +583,46 @@
|
||||
|
||||
parseBlockTable(block, key, line, state, lines) {
|
||||
var align, aligns, head, j, len, matches, row, rows;
|
||||
if (!!(matches = line.match(/^((?:(?:(?:\||\+)(?:[ :]*\-+[ :]*)(?:\||\+))|(?:(?:[ :]*\-+[ :]*)(?:\||\+)(?:[ :]*\-+[ :]*))|(?:(?:[ :]*\-+[ :]*)(?:\||\+))|(?:(?:\||\+)(?:[ :]*\-+[ :]*)))+)$/))) {
|
||||
if (this.isBlock('table')) {
|
||||
block[3][0].push(block[3][2]);
|
||||
block[3][2] += 1;
|
||||
this.setBlock(key, block[3]);
|
||||
} else {
|
||||
head = 0;
|
||||
if ((block == null) || block[0] !== 'normal' || lines[block[2]].match(/^\s*$/)) {
|
||||
this.startBlock('table', key);
|
||||
if (!!(matches = line.match(/^\s*(\|?[ :]*-{2,}[ :]*(?:[\|\+][ :]*-{2,}[ :]*)*\|?)\s*$/))) {
|
||||
if (matches[1].indexOf('|') >= 0 || matches[1].indexOf('+') >= 0) {
|
||||
if (this.isBlock('table')) {
|
||||
block[3][0].push(block[3][2]);
|
||||
block[3][2] += 1;
|
||||
this.setBlock(key, block[3]);
|
||||
} else {
|
||||
head = 1;
|
||||
this.backBlock(1, 'table');
|
||||
}
|
||||
if (matches[1][0] === '|') {
|
||||
matches[1] = matches[1].substring(1);
|
||||
if (matches[1][matches[1].length - 1] === '|') {
|
||||
matches[1] = matches[1].substring(0, matches[1].length - 1);
|
||||
head = 0;
|
||||
if ((block == null) || block[0] !== 'normal' || lines[block[2]].match(/^\s*$/)) {
|
||||
this.startBlock('table', key);
|
||||
} else {
|
||||
head = 1;
|
||||
this.backBlock(1, 'table');
|
||||
}
|
||||
}
|
||||
rows = matches[1].split(/\+|\|/);
|
||||
aligns = [];
|
||||
for (j = 0, len = rows.length; j < len; j++) {
|
||||
row = rows[j];
|
||||
align = 'none';
|
||||
if (!!(matches = row.match(/^\s*(:?)\-+(:?)\s*$/))) {
|
||||
if (!!matches[1] && !!matches[2]) {
|
||||
align = 'center';
|
||||
} else if (!!matches[1]) {
|
||||
align = 'left';
|
||||
} else if (!!matches[2]) {
|
||||
align = 'right';
|
||||
if (matches[1][0] === '|') {
|
||||
matches[1] = matches[1].substring(1);
|
||||
if (matches[1][matches[1].length - 1] === '|') {
|
||||
matches[1] = matches[1].substring(0, matches[1].length - 1);
|
||||
}
|
||||
}
|
||||
aligns.push(align);
|
||||
rows = matches[1].split(/\+|\|/);
|
||||
aligns = [];
|
||||
for (j = 0, len = rows.length; j < len; j++) {
|
||||
row = rows[j];
|
||||
align = 'none';
|
||||
if (!!(matches = row.match(/^\s*(:?)\-+(:?)\s*$/))) {
|
||||
if (!!matches[1] && !!matches[2]) {
|
||||
align = 'center';
|
||||
} else if (!!matches[1]) {
|
||||
align = 'left';
|
||||
} else if (!!matches[2]) {
|
||||
align = 'right';
|
||||
}
|
||||
}
|
||||
aligns.push(align);
|
||||
}
|
||||
this.setBlock(key, [[head], aligns, head + 1]);
|
||||
}
|
||||
this.setBlock(key, [[head], aligns, head + 1]);
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -649,7 +651,7 @@
|
||||
}
|
||||
|
||||
parseBlockShr(block, key, line) {
|
||||
if (!!(line.match(/^(\* *){3,}\s*$/))) {
|
||||
if (!!(line.match(/^\*{3,}\s*$/))) {
|
||||
this.startBlock('hr', key).endBlock();
|
||||
return false;
|
||||
}
|
||||
@@ -657,7 +659,7 @@
|
||||
}
|
||||
|
||||
parseBlockDhr(block, key, line) {
|
||||
if (!!(line.match(/^(- *){3,}\s*$/))) {
|
||||
if (!!(line.match(/^-{3,}\s*$/))) {
|
||||
this.startBlock('hr', key).endBlock();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
Version 0.8.1/12.4.1
|
||||
|
||||
修复同级子目录下安装多个站点引起的登录失效
|
||||
增加评论黑名单插件
|
||||
修复评论接口重用导致启用评论验证插件后,后台无法评论的bug
|
||||
修正年份路由的bug
|
||||
修正由于flash的cookie丢失bug导致的文件无法上传bug
|
||||
增加对ini_get的判断
|
||||
提交对Sina App Engine的兼容性判断
|
||||
增加对Sina App Engine环境的支持
|
||||
增加对ini_get的判断
|
||||
修正新注册用户登录后跳转错误bug
|
||||
修正对ssl的支持
|
||||
fix issue 510
|
||||
修复使用多层代理时, 获取ip地址错误
|
||||
修正修改文章时上传控件无法载入的问题
|
||||
修改后台错别字
|
||||
修正错别字
|
||||
兼容server不支持http 1.1的情况,典型问题如 sae环境404页面乱码
|
||||
修正由于SAE更改常用导致的数据库信息无法自动读入的问题
|
||||
增加上传插件接口
|
||||
提交Sina App Engine专用的文件上传插件,
|
||||
使用SAE的Storage做持久化存储。
|
||||
修正SaeUpload插件的说明地址
|
||||
new version library
|
||||
只是一些小修正
|
||||
fix bug report on segmentfault
|
||||
fix issue 536
|
||||
fix Issue 541
|
||||
fix Issue 544
|
||||
fix Issue 544
|
||||
fix Issue 540
|
||||
fix Issue 537
|
||||
fix Issue 529
|
||||
fix Issue 532
|
||||
fix issue 526
|
||||
文章增加待审核功能,下一步给文章增加private属性
|
||||
更新后台表单样式, 新增文章预览功能
|
||||
css细节微调
|
||||
文章增加private属性显示
|
||||
修正插件显示空白问题, 预览框box修正
|
||||
修改预览内容样式,修改预览选项位置,高级选项->权限控制增加“允许游客访问”选项,用于私密浏览
|
||||
fix Issue 545
|
||||
实现文章公开度:公开、密码保护、私有、未审核
|
||||
little change
|
||||
实现功能:1,当用户之前有审核通过的评论,再次发评论会直接为通过审核(可关闭);2,未通过审核的评论,评论作者可以在前台看到(他人不可见);3,隐藏功能;
|
||||
修正后台修改或添加页面状态错误的问题;修正保存私密、审核日志时会新增一篇同样日志的问题
|
||||
简单增强搜索功能 Issue 480
|
||||
添加有密码和未发布图标
|
||||
fix Issue 551
|
||||
将文章管理页的公开度草稿等信息改为文字
|
||||
接受插件返回的header
|
||||
@@ -1064,7 +1064,11 @@ function install_step_2_perform()
|
||||
|
||||
// intval port number
|
||||
if (isset($dbConfig['port'])) {
|
||||
$dbConfig['port'] = intval($dbConfig['port']);
|
||||
if (strpos($dbConfig['host'], '/') !== false && $type == 'Mysql') {
|
||||
$dbConfig['port'] = null;
|
||||
} else {
|
||||
$dbConfig['port'] = intval($dbConfig['port']);
|
||||
}
|
||||
}
|
||||
|
||||
// bool ssl verify
|
||||
|
||||
@@ -14,7 +14,7 @@ $this->need('header.php');
|
||||
|
||||
<main class="container">
|
||||
<div class="container-thin">
|
||||
<?php if (!($this->is('index')) and !($this->is('post'))): ?>
|
||||
<?php if (!($this->is('index')) && !($this->is('post'))): ?>
|
||||
<h6 class="text-center text-muted">
|
||||
<?php $this->archiveTitle([
|
||||
'category' => _t('分类 %s 下的文章'),
|
||||
|
||||
@@ -54,7 +54,7 @@ function postMeta(
|
||||
<?php if ($metaType == 'archive'): ?>
|
||||
<li itemprop="interactionCount">
|
||||
<a itemprop="discussionUrl"
|
||||
href="<?php $archive->permalink() ?>#comments"><?php $archive->commentsNum('评论', '1 条评论', '%d 条评论'); ?></a>
|
||||
href="<?php $archive->permalink() ?>#comments"><?php $archive->commentsNum(_t('暂无评论'), _t('1 条评论'), _t('%d 条评论')); ?></a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
|
||||
@@ -13,7 +13,7 @@ $this->need('header.php');
|
||||
?>
|
||||
|
||||
<div class="col-mb-12 col-8" id="main" role="main">
|
||||
<?php if (!($this->is('index')) and !($this->is('post'))): ?>
|
||||
<?php if (!($this->is('index')) && !($this->is('post'))): ?>
|
||||
<h3 class="archive-title"><?php $this->archiveTitle([
|
||||
'category' => _t('分类 %s 下的文章'),
|
||||
'search' => _t('包含关键字 %s 的文章'),
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace Typecho\Db\Adapter;
|
||||
use Typecho\Config;
|
||||
use Typecho\Db;
|
||||
use Typecho\Db\Adapter;
|
||||
use mysqli_sql_exception;
|
||||
|
||||
if (!defined('__TYPECHO_ROOT_DIR__')) {
|
||||
exit;
|
||||
@@ -49,26 +50,40 @@ class Mysqli implements Adapter
|
||||
{
|
||||
$mysqli = mysqli_init();
|
||||
if ($mysqli) {
|
||||
if (!empty($config->sslCa)) {
|
||||
$mysqli->ssl_set(null, null, $config->sslCa, null, null);
|
||||
try {
|
||||
if (!empty($config->sslCa)) {
|
||||
$mysqli->ssl_set(null, null, $config->sslCa, null, null);
|
||||
|
||||
if (isset($config->sslVerify)) {
|
||||
$mysqli->options(MYSQLI_OPT_SSL_VERIFY_SERVER_CERT, $config->sslVerify);
|
||||
if (isset($config->sslVerify)) {
|
||||
$mysqli->options(MYSQLI_OPT_SSL_VERIFY_SERVER_CERT, $config->sslVerify);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$mysqli->real_connect(
|
||||
$config->host,
|
||||
$config->user,
|
||||
$config->password,
|
||||
$config->database,
|
||||
(empty($config->port) ? null : $config->port)
|
||||
);
|
||||
$host = $config->host;
|
||||
$port = empty($config->port) ? null : $config->port;
|
||||
$socket = null;
|
||||
if (strpos($host, '/') !== false) {
|
||||
$socket = $host;
|
||||
$host = 'localhost';
|
||||
$port = null;
|
||||
}
|
||||
|
||||
$this->dbLink = $mysqli;
|
||||
$mysqli->real_connect(
|
||||
$host,
|
||||
$config->user,
|
||||
$config->password,
|
||||
$config->database,
|
||||
$port,
|
||||
$socket
|
||||
);
|
||||
|
||||
if ($config->charset) {
|
||||
$this->dbLink->query("SET NAMES '{$config->charset}'");
|
||||
$this->dbLink = $mysqli;
|
||||
|
||||
if ($config->charset) {
|
||||
$this->dbLink->query("SET NAMES '{$config->charset}'");
|
||||
}
|
||||
} catch (mysqli_sql_exception $e) {
|
||||
throw new ConnectionException($e->getMessage(), $e->getCode());
|
||||
}
|
||||
|
||||
return $this->dbLink;
|
||||
@@ -106,8 +121,13 @@ class Mysqli implements Adapter
|
||||
?string $action = null,
|
||||
?string $table = null
|
||||
) {
|
||||
if ($resource = @$this->dbLink->query($query)) {
|
||||
return $resource;
|
||||
try {
|
||||
if ($resource = $this->dbLink->query($query)) {
|
||||
return $resource;
|
||||
}
|
||||
} catch (mysqli_sql_exception $e) {
|
||||
/** 数据库异常 */
|
||||
throw new SQLException($e->getMessage(), $e->getCode());
|
||||
}
|
||||
|
||||
/** 数据库异常 */
|
||||
|
||||
@@ -61,14 +61,26 @@ class Mysql extends Pdo
|
||||
}
|
||||
}
|
||||
|
||||
$dsn = !empty($config->dsn)
|
||||
? $config->dsn
|
||||
: (strpos($config->host, '/') !== false
|
||||
? "mysql:dbname={$config->database};unix_socket={$config->host}"
|
||||
: "mysql:dbname={$config->database};host={$config->host};port={$config->port}");
|
||||
|
||||
$pdo = new \PDO(
|
||||
!empty($config->dsn)
|
||||
? $config->dsn : "mysql:dbname={$config->database};host={$config->host};port={$config->port}",
|
||||
$dsn,
|
||||
$config->user,
|
||||
$config->password,
|
||||
$options
|
||||
);
|
||||
$pdo->setAttribute(\PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
|
||||
|
||||
if (class_exists('\Pdo\Mysql')) {
|
||||
// 新版本写法
|
||||
$pdo->setAttribute(\Pdo\Mysql::ATTR_USE_BUFFERED_QUERY, true);
|
||||
} else {
|
||||
// 兼容旧版本
|
||||
$pdo->setAttribute(\PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
|
||||
}
|
||||
|
||||
if ($config->charset) {
|
||||
$pdo->exec("SET NAMES '{$config->charset}'");
|
||||
|
||||
@@ -119,7 +119,7 @@ class Pgsql implements Adapter
|
||||
|
||||
/**
|
||||
* @param resource $resource
|
||||
* @return array|null
|
||||
* @return array
|
||||
*/
|
||||
public function fetchAll($resource): array
|
||||
{
|
||||
@@ -146,6 +146,6 @@ class Pgsql implements Adapter
|
||||
*/
|
||||
public function quoteValue($string): string
|
||||
{
|
||||
return '\'' . pg_escape_string($string) . '\'';
|
||||
return '\'' . str_replace('\'', '\'\'', $string) . '\'';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ use Typecho\Db;
|
||||
class Query
|
||||
{
|
||||
/** 数据库关键字 */
|
||||
private const KEYWORDS = '*PRIMARY|AND|OR|LIKE|ILIKE|BINARY|BY|DISTINCT|AS|IN|IS|NULL';
|
||||
private const KEYWORDS = '*PRIMARY|AND|OR|LIKE|ILIKE|BINARY|BY|DISTINCT|AS|IN|NOT|IS|NULL';
|
||||
|
||||
/**
|
||||
* 默认字段
|
||||
|
||||
@@ -337,13 +337,21 @@ class Client
|
||||
$response = curl_exec($ch);
|
||||
if (false === $response) {
|
||||
$error = curl_error($ch);
|
||||
curl_close($ch);
|
||||
if (PHP_VERSION_ID >= 80000) {
|
||||
unset($ch);
|
||||
} else {
|
||||
curl_close($ch);
|
||||
}
|
||||
throw new Exception($error, 500);
|
||||
}
|
||||
|
||||
$this->responseStatus = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
$this->responseBody = $response;
|
||||
curl_close($ch);
|
||||
if (PHP_VERSION_ID >= 80000) {
|
||||
unset($ch);
|
||||
} else {
|
||||
curl_close($ch);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -272,7 +272,7 @@ class Validate
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function run(array $data, array $rules = null): array
|
||||
public function run(array $data, ?array $rules = null): array
|
||||
{
|
||||
$result = [];
|
||||
$this->data = $data;
|
||||
@@ -336,6 +336,6 @@ class Validate
|
||||
{
|
||||
return array_key_exists($this->key, $this->data) &&
|
||||
(is_array($this->data[$this->key]) ? 0 < count($this->data[$this->key])
|
||||
: 0 < strlen($this->data[$this->key]));
|
||||
: 0 < strlen($this->data[$this->key] ?? ''));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ class HyperDown
|
||||
$this->_id = 0;
|
||||
|
||||
usort($this->blockParsers, function ($a, $b) {
|
||||
return $a[1] < $b[1] ? - 1 : 1;
|
||||
return $a[1] < $b[1] ? -1 : 1;
|
||||
});
|
||||
|
||||
foreach ($this->blockParsers as $parser) {
|
||||
@@ -197,7 +197,7 @@ class HyperDown
|
||||
public function makeHolder(string $str): string
|
||||
{
|
||||
$key = "\r" . $this->_uniqid . $this->_id . "\r";
|
||||
$this->_id ++;
|
||||
$this->_id++;
|
||||
$this->_holders[$key] = $str;
|
||||
|
||||
return $key;
|
||||
@@ -234,7 +234,7 @@ class HyperDown
|
||||
}
|
||||
|
||||
$html .= "<li id=\"fn-{$index}\">{$val}</li>";
|
||||
$index ++;
|
||||
$index++;
|
||||
}
|
||||
|
||||
$html .= '</ol></div>';
|
||||
@@ -288,7 +288,7 @@ class HyperDown
|
||||
$deep = 0;
|
||||
while (strpos($text, "\r") !== false && $deep < 10) {
|
||||
$text = str_replace(array_keys($this->_holders), array_values($this->_holders), $text);
|
||||
$deep ++;
|
||||
$deep++;
|
||||
}
|
||||
|
||||
if ($clearHolders) {
|
||||
@@ -304,7 +304,7 @@ class HyperDown
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function markLine(int $start, int $end = - 1): string
|
||||
private function markLine(int $start, int $end = -1): string
|
||||
{
|
||||
if ($this->_line) {
|
||||
$end = $end < 0 ? $start : $end;
|
||||
@@ -323,10 +323,10 @@ class HyperDown
|
||||
*/
|
||||
private function markLines(array $lines, int $start): array
|
||||
{
|
||||
$i = - 1;
|
||||
$i = -1;
|
||||
|
||||
return $this->_line ? array_map(function ($line) use ($start, &$i) {
|
||||
$i ++;
|
||||
$i++;
|
||||
return $this->markLine($start + $i) . $line;
|
||||
}, $lines) : $lines;
|
||||
}
|
||||
@@ -389,9 +389,10 @@ class HyperDown
|
||||
private function parseInline(
|
||||
string $text,
|
||||
string $whiteList = '',
|
||||
bool $clearHolders = true,
|
||||
bool $enableAutoLink = true
|
||||
): string {
|
||||
bool $clearHolders = true,
|
||||
bool $enableAutoLink = true
|
||||
): string
|
||||
{
|
||||
$text = $this->call('beforeParseInline', $text);
|
||||
|
||||
// code
|
||||
@@ -515,7 +516,7 @@ class HyperDown
|
||||
|
||||
// link
|
||||
$text = preg_replace_callback(
|
||||
"/\[((?:[^\]]|\\\\\]|\\\\\[)+?)\]\(((?:[^\)]|\\\\\)|\\\\\()+?)\)/",
|
||||
"/\[([^\]]*(?:\\\\.[^\]]*)*)\]\(([^)]*(?:\\\\.[^)]*)*)\)/",
|
||||
function ($matches) {
|
||||
$escaped = $this->parseInline(
|
||||
$this->escapeBracket($matches[1]), '', false, false
|
||||
@@ -666,7 +667,7 @@ class HyperDown
|
||||
$lines = explode("\n", $text);
|
||||
$this->_blocks = [];
|
||||
$this->_current = 'normal';
|
||||
$this->_pos = - 1;
|
||||
$this->_pos = -1;
|
||||
|
||||
$state = [
|
||||
'special' => implode("|", array_keys($this->_specialWhiteList)),
|
||||
@@ -723,7 +724,7 @@ class HyperDown
|
||||
$this->setBlock($key);
|
||||
return false;
|
||||
} elseif (preg_match("/^(\s*)$/", $line) && $state['empty'] == 0) {
|
||||
$state['empty'] ++;
|
||||
$state['empty']++;
|
||||
$this->setBlock($key);
|
||||
return false;
|
||||
}
|
||||
@@ -1036,53 +1037,54 @@ class HyperDown
|
||||
*/
|
||||
private function parseBlockTable(?array $block, int $key, string $line, ?array &$state, array $lines): bool
|
||||
{
|
||||
if (preg_match("/^((?:(?:(?:\||\+)(?:[ :]*\-+[ :]*)(?:\||\+))|(?:(?:[ :]*\-+[ :]*)(?:\||\+)(?:[ :]*\-+[ :]*))|(?:(?:[ :]*\-+[ :]*)(?:\||\+))|(?:(?:\||\+)(?:[ :]*\-+[ :]*)))+)$/", $line, $matches)) {
|
||||
if ($this->isBlock('table')) {
|
||||
$block[3][0][] = $block[3][2];
|
||||
$block[3][2] ++;
|
||||
$this->setBlock($key, $block[3]);
|
||||
} else {
|
||||
$head = 0;
|
||||
|
||||
if (empty($block) ||
|
||||
$block[0] != 'normal' ||
|
||||
preg_match("/^\s*$/", $lines[$block[2]])) {
|
||||
$this->startBlock('table', $key);
|
||||
if (preg_match("/^\s*(\|?[ :]*-{2,}[ :]*(?:[\|\+][ :]*-{2,}[ :]*)*\|?)\s*$/", $line, $matches)) {
|
||||
if (strpos($matches[1], '|') !== false || strpos($matches[1], '+') !== false) {
|
||||
if ($this->isBlock('table')) {
|
||||
$block[3][0][] = $block[3][2];
|
||||
$block[3][2]++;
|
||||
$this->setBlock($key, $block[3]);
|
||||
} else {
|
||||
$head = 1;
|
||||
$this->backBlock(1, 'table');
|
||||
}
|
||||
$head = 0;
|
||||
|
||||
if ($matches[1][0] == '|') {
|
||||
$matches[1] = substr($matches[1], 1);
|
||||
|
||||
if ($matches[1][strlen($matches[1]) - 1] == '|') {
|
||||
$matches[1] = substr($matches[1], 0, - 1);
|
||||
if (empty($block) ||
|
||||
$block[0] != 'normal' ||
|
||||
preg_match("/^\s*$/", $lines[$block[2]])) {
|
||||
$this->startBlock('table', $key);
|
||||
} else {
|
||||
$head = 1;
|
||||
$this->backBlock(1, 'table');
|
||||
}
|
||||
}
|
||||
|
||||
$rows = preg_split("/(\+|\|)/", $matches[1]);
|
||||
$aligns = [];
|
||||
foreach ($rows as $row) {
|
||||
$align = 'none';
|
||||
if ($matches[1][0] == '|') {
|
||||
$matches[1] = substr($matches[1], 1);
|
||||
|
||||
if (preg_match("/^\s*(:?)\-+(:?)\s*$/", $row, $matches)) {
|
||||
if (!empty($matches[1]) && !empty($matches[2])) {
|
||||
$align = 'center';
|
||||
} elseif (!empty($matches[1])) {
|
||||
$align = 'left';
|
||||
} elseif (!empty($matches[2])) {
|
||||
$align = 'right';
|
||||
if ($matches[1][strlen($matches[1]) - 1] == '|') {
|
||||
$matches[1] = substr($matches[1], 0, -1);
|
||||
}
|
||||
}
|
||||
|
||||
$aligns[] = $align;
|
||||
$rows = preg_split("/(\+|\|)/", $matches[1]);
|
||||
$aligns = [];
|
||||
foreach ($rows as $row) {
|
||||
$align = 'none';
|
||||
|
||||
if (preg_match("/^\s*(:?)\-+(:?)\s*$/", $row, $matches)) {
|
||||
if (!empty($matches[1]) && !empty($matches[2])) {
|
||||
$align = 'center';
|
||||
} elseif (!empty($matches[1])) {
|
||||
$align = 'left';
|
||||
} elseif (!empty($matches[2])) {
|
||||
$align = 'right';
|
||||
}
|
||||
}
|
||||
|
||||
$aligns[] = $align;
|
||||
}
|
||||
|
||||
$this->setBlock($key, [[$head], $aligns, $head + 1]);
|
||||
}
|
||||
|
||||
$this->setBlock($key, [[$head], $aligns, $head + 1]);
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -1144,7 +1146,7 @@ class HyperDown
|
||||
*/
|
||||
private function parseBlockShr(?array $block, int $key, string $line): bool
|
||||
{
|
||||
if (preg_match("/^(\* *){3,}\s*$/", $line)) {
|
||||
if (preg_match("/^\*{3,}\s*$/", $line)) {
|
||||
$this->startBlock('hr', $key)
|
||||
->endBlock();
|
||||
|
||||
@@ -1163,7 +1165,7 @@ class HyperDown
|
||||
*/
|
||||
private function parseBlockDhr(?array $block, int $key, string $line): bool
|
||||
{
|
||||
if (preg_match("/^(- *){3,}\s*$/", $line)) {
|
||||
if (preg_match("/^-{3,}\s*$/", $line)) {
|
||||
$this->startBlock('hr', $key)
|
||||
->endBlock();
|
||||
|
||||
@@ -1192,7 +1194,7 @@ class HyperDown
|
||||
}
|
||||
} elseif ($this->isBlock('table')) {
|
||||
if (false !== strpos($line, '|')) {
|
||||
$block[3][2] ++;
|
||||
$block[3][2]++;
|
||||
$this->setBlock($key, $block[3]);
|
||||
} else {
|
||||
$this->startBlock('normal', $key);
|
||||
@@ -1270,7 +1272,7 @@ class HyperDown
|
||||
}
|
||||
|
||||
if (!$moved) {
|
||||
$key ++;
|
||||
$key++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1312,7 +1314,7 @@ class HyperDown
|
||||
}
|
||||
|
||||
return htmlspecialchars($line);
|
||||
}, array_slice($lines, 1, - 1));
|
||||
}, array_slice($lines, 1, -1));
|
||||
$str = implode("\n", $this->markLines($lines, $start + 1));
|
||||
|
||||
return $isEmpty ? '' :
|
||||
@@ -1365,7 +1367,7 @@ class HyperDown
|
||||
*/
|
||||
private function parseShtml(array $lines, $value, int $start): string
|
||||
{
|
||||
return trim(implode("\n", $this->markLines(array_slice($lines, 1, - 1), $start + 1)));
|
||||
return trim(implode("\n", $this->markLines(array_slice($lines, 1, -1), $start + 1)));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1508,7 +1510,7 @@ class HyperDown
|
||||
$line = substr($line, 1);
|
||||
|
||||
if ($line[strlen($line) - 1] == '|') {
|
||||
$line = substr($line, 0, - 1);
|
||||
$line = substr($line, 0, -1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1521,16 +1523,16 @@ class HyperDown
|
||||
}
|
||||
}, explode('|', $line));
|
||||
$columns = [];
|
||||
$last = - 1;
|
||||
$last = -1;
|
||||
|
||||
foreach ($rows as $row) {
|
||||
if (strlen($row) > 0) {
|
||||
$last ++;
|
||||
$last++;
|
||||
$columns[$last] = [
|
||||
isset($columns[$last]) ? $columns[$last][0] + 1 : 1, $row
|
||||
];
|
||||
} elseif (isset($columns[$last])) {
|
||||
$columns[$last][0] ++;
|
||||
$columns[$last][0]++;
|
||||
} else {
|
||||
$columns[0] = [1, $row];
|
||||
}
|
||||
@@ -1730,7 +1732,7 @@ class HyperDown
|
||||
*/
|
||||
private function startBlock($type, $start, $value = null): HyperDown
|
||||
{
|
||||
$this->_pos ++;
|
||||
$this->_pos++;
|
||||
$this->_current = $type;
|
||||
|
||||
$this->_blocks[$this->_pos] = [$type, $start, $start, $value];
|
||||
@@ -1813,7 +1815,7 @@ class HyperDown
|
||||
$this->_blocks[$this->_pos][2] = $last - $step;
|
||||
|
||||
if ($this->_blocks[$this->_pos][1] <= $this->_blocks[$this->_pos][2]) {
|
||||
$this->_pos ++;
|
||||
$this->_pos++;
|
||||
}
|
||||
|
||||
$this->_current = $type;
|
||||
@@ -1840,7 +1842,7 @@ class HyperDown
|
||||
$this->_blocks[$this->_pos - 1] = $prev;
|
||||
$this->_current = $prev[0];
|
||||
unset($this->_blocks[$this->_pos]);
|
||||
$this->_pos --;
|
||||
$this->_pos--;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -1015,7 +1015,7 @@ class Archive extends Contents
|
||||
$allows = self::pluginHandle()->filter('headerOptions', $allows, $this);
|
||||
$title = (empty($this->archiveTitle) ? '' : $this->archiveTitle . ' » ') . $this->options->title;
|
||||
|
||||
$header = $this->is('single') ? '<link rel="canonical" href="' . $this->archiveUrl . '" />' . "\n" : '';
|
||||
$header = ($this->is('single') && !$this->is('index')) ? '<link rel="canonical" href="' . $this->archiveUrl . '" />' . "\n" : '';
|
||||
|
||||
if (!empty($allows['pingback']) && 2 == $this->options->allowXmlRpc) {
|
||||
$header .= '<link rel="pingback" href="' . $allows['pingback'] . '" />' . "\n";
|
||||
|
||||
@@ -452,7 +452,7 @@ class Contents extends Base implements QueryInterface, RowFilterInterface, Prima
|
||||
}
|
||||
}
|
||||
|
||||
$allow &= ($this->row['allow' . ucfirst($permission)] == 1) and !$this->hidden;
|
||||
$allow &= ($this->row['allow' . ucfirst($permission)] == 1) && !$this->hidden;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ class Service extends BaseOptions implements ActionInterface
|
||||
$url = Common::buildUrl($urlPart);
|
||||
}
|
||||
|
||||
if ($permalinkPart['host'] == $urlPart['host'] && $permalinkPart['path'] == $urlPart['path']) {
|
||||
if ($permalinkPart['host'] == $urlPart['host']) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -153,9 +153,16 @@ class User extends Users
|
||||
/** 开始验证用户 **/
|
||||
$user = $this->db->fetchRow($this->db->select()
|
||||
->from('table.users')
|
||||
->where((strpos($name, '@') ? 'mail' : 'name') . ' = ?', $name)
|
||||
->where('name = ?', $name)
|
||||
->limit(1));
|
||||
|
||||
if (empty($user) && strpos($name, '@') !== false) {
|
||||
$user = $this->db->fetchRow($this->db->select()
|
||||
->from('table.users')
|
||||
->where('mail = ?', $name)
|
||||
->limit(1));
|
||||
}
|
||||
|
||||
if (empty($user)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user