diff --git a/Plugin.php b/Plugin.php index a20f87c..d16e716 100644 --- a/Plugin.php +++ b/Plugin.php @@ -94,7 +94,7 @@ public static function config(Typecho_Widget_Helper_Form $form) { /** 密码区域 HTML */ $default = << -
+
@@ -159,11 +159,11 @@ public static function footer(Widget_Archive $archive) { private static function getRequestPassword($cid, $pid, $currentCid = -1) { if ($currentCid == -1) $currentCid = $cid; $request = new Typecho_Request(); - $request_pid = isset($request->pid) ? intval($request->pid) : 0; - if ($request->isPost() && isset($request->partiallyPassword) && $request_pid === $pid) { + $request_pid = $request->get('pid') != null ? intval($request->get('pid')) : 0; + if ($request->get('pid') != null && $request_pid === $pid) { if (@Helper::options()->plugin('PartiallyPassword')->checkReferer) if (stripos($request->getReferer(), Helper::options()->rootUrl) !== 0) return; - return (new PasswordHash(8, true))->HashPassword($request->partiallyPassword); + return (new PasswordHash(8, true))->HashPassword($request->get('partiallyPassword')); } return Typecho_Cookie::get("partiallyPassword_{$cid}_{$pid}", ''); } @@ -306,14 +306,14 @@ public static function pluginFields($layout) { */ public static function handleSubmit(Widget_Archive $archive, Typecho_Db_Query $select) { if (!$archive->is('page') && !$archive->is('post')) return; - if ($archive->fields->pp_isEnabled && $archive->request->isPost() && isset($archive->request->partiallyPassword)) { - $pid = isset($archive->request->pid) ? intval($archive->request->pid) : 0; + if ($archive->fields->pp_isEnabled && $archive->request->get('partiallyPassword') != null) { + $pid = $archive->request->get('pid') != null ? intval($archive->request->get('pid')) : 0; if ($pid < 0) return; if (@Helper::options()->plugin('PartiallyPassword')->checkReferer) if (stripos($archive->request->getReferer(), Helper::options()->rootUrl) !== 0) return; Typecho_Cookie::set( "partiallyPassword_{$archive->cid}_{$pid}", - (new PasswordHash(8, true))->HashPassword($archive->request->partiallyPassword) + (new PasswordHash(8, true))->HashPassword($archive->request->get('partiallyPassword')) ); } }