Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
joyqi committed Sep 26, 2018
1 parent df7aeda commit b497004
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
1 change: 1 addition & 0 deletions var/Widget/Abstract/Contents.php
Original file line number Diff line number Diff line change
Expand Up @@ -738,6 +738,7 @@ public function filter(array $value)
. '" 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>';

Expand Down
15 changes: 9 additions & 6 deletions var/Widget/Archive.php
Original file line number Diff line number Diff line change
Expand Up @@ -809,6 +809,15 @@ private function singleHandle(Typecho_Db_Query $select, &$hasPushed)
$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);
Expand All @@ -825,12 +834,6 @@ private function singleHandle(Typecho_Db_Query $select, &$hasPushed)
}
}

/** 保存密码至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) {
/** 应用自定义模板 */
Expand Down

0 comments on commit b497004

Please sign in to comment.