mirror of
https://github.com/typecho/typecho.git
synced 2025-03-18 08:59:40 +01:00
fix bug
This commit is contained in:
parent
403f96fdc0
commit
4791cd978e
@ -147,12 +147,12 @@ class Contents extends Base implements QueryInterface
|
||||
/**
|
||||
* 为内容应用缩略名
|
||||
*
|
||||
* @param string $slug 缩略名
|
||||
* @param string|null $slug 缩略名
|
||||
* @param mixed $cid 内容id
|
||||
* @return string
|
||||
* @throws Exception
|
||||
*/
|
||||
public function applySlug(string $slug, $cid): string
|
||||
public function applySlug(?string $slug, $cid): string
|
||||
{
|
||||
if ($cid instanceof Query) {
|
||||
$cid = $this->db->fetchObject($cid->select('cid')
|
||||
|
@ -548,12 +548,12 @@ class Edit extends Contents implements ActionInterface
|
||||
* 设置内容标签
|
||||
*
|
||||
* @param integer $cid
|
||||
* @param string $tags
|
||||
* @param string|null $tags
|
||||
* @param boolean $beforeCount 是否参与计数
|
||||
* @param boolean $afterCount 是否参与计数
|
||||
* @throws DbException
|
||||
*/
|
||||
public function setTags(int $cid, string $tags, bool $beforeCount = true, bool $afterCount = true)
|
||||
public function setTags(int $cid, ?string $tags, bool $beforeCount = true, bool $afterCount = true)
|
||||
{
|
||||
$tags = str_replace(',', ',', $tags);
|
||||
$tags = array_unique(array_map('trim', explode(',', $tags)));
|
||||
@ -1023,7 +1023,7 @@ class Edit extends Contents implements ActionInterface
|
||||
protected function ___draft(): ?array
|
||||
{
|
||||
if ($this->have()) {
|
||||
if ('post_draft' == $this->type) {
|
||||
if ('post_draft' == $this->type || 'page_draft' == $this->type) {
|
||||
return $this->row;
|
||||
} else {
|
||||
return $this->db->fetchRow(Contents::alloc()->select()
|
||||
|
@ -33,6 +33,7 @@ if (!defined('__TYPECHO_ROOT_DIR__')) {
|
||||
* @property string $pluginUrl
|
||||
* @property string $adminUrl
|
||||
* @property string $loginUrl
|
||||
* @property string $originalSiteUrl
|
||||
* @property string $loginAction
|
||||
* @property string $registerUrl
|
||||
* @property string $registerAction
|
||||
@ -48,6 +49,7 @@ if (!defined('__TYPECHO_ROOT_DIR__')) {
|
||||
* @property int $timezone
|
||||
* @property string $charset
|
||||
* @property string $contentType
|
||||
* @property string $generator
|
||||
* @property string $software
|
||||
* @property string $version
|
||||
* @property bool $markdown
|
||||
@ -61,6 +63,33 @@ if (!defined('__TYPECHO_ROOT_DIR__')) {
|
||||
* @property string $actionTable
|
||||
* @property string $panelTable
|
||||
* @property bool $commentsThreaded
|
||||
* @property bool $defaultAllowComment
|
||||
* @property bool $defaultAllowPing
|
||||
* @property bool $defaultAllowFeed
|
||||
* @property string $commentDateFormat
|
||||
* @property string $commentsAvatarRating
|
||||
* @property string $commentsPageDisplay
|
||||
* @property int $commentsPageSize
|
||||
* @property string $commentsOrder
|
||||
* @property bool $commentsMarkdown
|
||||
* @property bool $commentsShowUrl
|
||||
* @property bool $commentsUrlNofollow
|
||||
* @property bool $commentsAvatar
|
||||
* @property bool $commentsPageBreak
|
||||
* @property bool $commentsRequireModeration
|
||||
* @property bool $commentsWhitelist
|
||||
* @property bool $commentsRequireMail
|
||||
* @property bool $commentsRequireURL
|
||||
* @property bool $commentsCheckReferer
|
||||
* @property bool $commentsAntiSpam
|
||||
* @property bool $commentsAutoClose
|
||||
* @property bool $commentsPostIntervalEnable
|
||||
* @property string $commentsHTMLTagAllowed
|
||||
* @property bool $allowRegister
|
||||
* @property bool $allowXmlRpc
|
||||
* @property int $postsListSize
|
||||
* @property bool $feedFullText
|
||||
* @property int $defaultCategory
|
||||
*/
|
||||
class Options extends Base
|
||||
{
|
||||
|
@ -256,15 +256,23 @@ class Discussion extends Options implements ActionInterface
|
||||
$commentsPostOptionsValue[] = 'commentsPostIntervalEnable';
|
||||
}
|
||||
|
||||
$commentsPost = new Form\Element\Checkbox('commentsPost', $commentsPostOptions,
|
||||
$commentsPostOptionsValue, _t('评论提交'));
|
||||
$commentsPost = new Form\Element\Checkbox(
|
||||
'commentsPost',
|
||||
$commentsPostOptions,
|
||||
$commentsPostOptionsValue,
|
||||
_t('评论提交')
|
||||
);
|
||||
$form->addInput($commentsPost->multiMode());
|
||||
|
||||
/** 允许使用的HTML标签和属性 */
|
||||
$commentsHTMLTagAllowed = new Form\Element\Textarea('commentsHTMLTagAllowed', null,
|
||||
$commentsHTMLTagAllowed = new Form\Element\Textarea(
|
||||
'commentsHTMLTagAllowed',
|
||||
null,
|
||||
$this->options->commentsHTMLTagAllowed,
|
||||
_t('允许使用的HTML标签和属性'), _t('默认的用户评论不允许填写任何的HTML标签, 你可以在这里填写允许使用的HTML标签.') . '<br />'
|
||||
. _t('比如: %s', '<code><a href=""> <img src=""> <blockquote></code>'));
|
||||
_t('允许使用的HTML标签和属性'),
|
||||
_t('默认的用户评论不允许填写任何的HTML标签, 你可以在这里填写允许使用的HTML标签.') . '<br />'
|
||||
. _t('比如: %s', '<code><a href=""> <img src=""> <blockquote></code>')
|
||||
);
|
||||
$commentsHTMLTagAllowed->input->setAttribute('class', 'mono');
|
||||
$form->addInput($commentsHTMLTagAllowed);
|
||||
|
||||
|
@ -245,7 +245,8 @@ RewriteRule . {$basePath}index.php [L]
|
||||
} elseif (!isset($patterns[$postPatternValue])) {
|
||||
$customPatternValue = $this->decodeRule($postPatternValue);
|
||||
}
|
||||
$patterns['custom'] = _t('个性化定义') . ' <input type="text" class="w-50 text-s mono" name="customPattern" value="' . $customPatternValue . '" />';
|
||||
$patterns['custom'] = _t('个性化定义') .
|
||||
' <input type="text" class="w-50 text-s mono" name="customPattern" value="' . $customPatternValue . '" />';
|
||||
|
||||
$postPattern = new Form\Element\Radio(
|
||||
'postPattern',
|
||||
|
@ -429,7 +429,7 @@ class Upload extends Contents implements ActionInterface
|
||||
* @param string $ext 扩展名
|
||||
* @return boolean
|
||||
*/
|
||||
public static function checkFileType($ext)
|
||||
public static function checkFileType(string $ext): bool
|
||||
{
|
||||
$options = Options::alloc();
|
||||
return in_array($ext, $options->allowedAttachmentTypes);
|
||||
|
Loading…
x
Reference in New Issue
Block a user