This commit is contained in:
joyqi 2018-09-26 11:07:07 +08:00
parent df7aeda761
commit b497004516
2 changed files with 10 additions and 6 deletions

View File

@ -738,6 +738,7 @@ class Widget_Abstract_Contents extends Widget_Abstract
. '" method="post">' .
'<p class="word">' . _t('请输入密码访问') . '</p>' .
'<p><input type="password" class="text" name="protectPassword" />
<input type="hidden" name="protectCID" value="' . $value['cid'] . '" />
<input type="submit" class="submit" value="' . _t('提交') . '" /></p>' .
'</form>';

View File

@ -809,6 +809,15 @@ class Widget_Archive extends Widget_Abstract_Contents
$select->where('table.contents.created >= ? AND table.contents.created < ?', $from, $to);
}
/** 保存密码至cookie */
if ($this->request->isPost()
&& isset($this->request->protectPassword)
&& isset($this->request->protectCID)
&& !$this->parameter->preview) {
$this->security->protect();
Typecho_Cookie::set('protectPassword_' . $this->request->filter('int')->protectCID, $this->request->protectPassword, 0);
}
/** 匹配类型 */
$select->limit(1);
$this->query($select);
@ -825,12 +834,6 @@ class Widget_Archive extends Widget_Abstract_Contents
}
}
/** 保存密码至cookie */
if ($this->request->isPost() && isset($this->request->protectPassword) && !$this->parameter->preview) {
$this->security->protect();
Typecho_Cookie::set('protectPassword_' . $this->cid, $this->request->protectPassword, 0);
}
/** 设置模板 */
if ($this->template) {
/** 应用自定义模板 */