From 207f6eea93167d6d0653e9ac5f2f545fbf495a21 Mon Sep 17 00:00:00 2001 From: ONEXIN Date: Sun, 18 Jul 2021 11:55:33 +0000 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E4=B8=BA=E5=89=8D?= =?UTF-8?q?=E7=AB=AF=E5=BC=80=E5=8F=91=E7=82=B9=E5=87=BB=E5=8F=96=E6=B6=88?= =?UTF-8?q?=E6=94=B6=E8=97=8F=E6=8F=90=E4=BE=9B=E5=AE=9E=E7=94=A8=E7=9A=84?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../include/spacecp/spacecp_favorite.php | 37 +++++++++++++++++-- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/upload/source/include/spacecp/spacecp_favorite.php b/upload/source/include/spacecp/spacecp_favorite.php index d39b93fc0..fa21b2efa 100644 --- a/upload/source/include/spacecp/spacecp_favorite.php +++ b/upload/source/include/spacecp/spacecp_favorite.php @@ -27,9 +27,39 @@ if($_GET['op'] == 'delete') { C::t('home_favorite')->delete($_GET['favorite'], false, $_G['uid']); } showmessage('favorite_delete_succeed', 'home.php?mod=space&uid='.$_G['uid'].'&do=favorite&view=me&type='.$_GET['type'].'&quickforward=1'); - } else { - $favid = intval($_GET['favid']); - $thevalue = C::t('home_favorite')->fetch($favid); + } else { + $type = empty($_GET['type']) ? '' : $_GET['type']; + $id = empty($_GET['id']) ? 0 : intval($_GET['id']); + if($type && $id){ + switch($type) { + case 'thread': + $idtype = 'tid'; + break; + case 'forum': + $idtype = 'fid'; + break; + case 'blog': + $idtype = 'blogid'; + break; + case 'group': + $idtype = 'gid'; + break; + case 'album': + $idtype = 'albumid'; + break; + case 'space': + $idtype = 'uid'; + break; + case 'article': + $idtype = 'aid'; + break; + } + $thevalue = C::t('home_favorite')->fetch_by_id_idtype($id, $idtype, $_G['uid']); + $favid = $thevalue['favid']; + }else{ + $favid = intval($_GET['favid']); + $thevalue = C::t('home_favorite')->fetch($favid); + } if(empty($thevalue) || $thevalue['uid'] != $_G['uid']) { showmessage('favorite_does_not_exist'); } @@ -164,7 +194,6 @@ function deletefavorite($thevalue = array()){ case 'fid': C::t('forum_forum')->update_forum_counter($thevalue['id'], 0, 0, 0, 0, -1); break; - default: case 'blogid': C::t('home_blog')->increase($thevalue['id'], 0, array('favtimes' => -1)); break; -- Gitee