fix #1268
This commit is contained in:
@@ -16,7 +16,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
php: ['7.2', '7.3', '7.4', '8.0']
|
||||
php: ['7.2', '7.3', '7.4', '8.0', '8.1']
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
@@ -182,8 +182,10 @@ namespace Typecho {
|
||||
*/
|
||||
public static function url(?string $path, ?string $prefix): string
|
||||
{
|
||||
$path = $path ?? '';
|
||||
$path = (0 === strpos($path, './')) ? substr($path, 2) : $path;
|
||||
return rtrim($prefix, '/') . '/' . str_replace('//', '/', ltrim($path, '/'));
|
||||
return rtrim($prefix ?? '', '/') . '/'
|
||||
. str_replace('//', '/', ltrim($path, '/'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -20,10 +20,10 @@ trait QueryTrait
|
||||
}
|
||||
}
|
||||
|
||||
$sql['limit'] = (0 == strlen($sql['limit'])) ? null : ' LIMIT ' . $sql['limit'];
|
||||
$sql['offset'] = (0 == strlen($sql['offset'])) ? null : ' OFFSET ' . $sql['offset'];
|
||||
$sql['limit'] = isset($sql['limit']) ? ' LIMIT ' . $sql['limit'] : '';
|
||||
$sql['offset'] = isset($sql['offset']) ? ' OFFSET ' . $sql['offset'] : '';
|
||||
|
||||
return 'SELECT ' . $sql['fields'] . ' FROM ' . $sql['table'] .
|
||||
$sql['where'] . $sql['group'] . $sql['having'] . $sql['order'] . $sql['limit'] . $sql['offset'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -585,7 +585,7 @@ class Contents extends Base implements QueryInterface
|
||||
|
||||
/** 处理密码保护流程 */
|
||||
if (
|
||||
strlen($value['password']) > 0 &&
|
||||
strlen($value['password'] ?? '') > 0 &&
|
||||
$value['password'] !== Cookie::get('protectPassword_' . $value['cid']) &&
|
||||
$value['authorId'] != $this->user->uid &&
|
||||
!$this->user->pass('editor', true)
|
||||
|
||||
Reference in New Issue
Block a user