diff --git a/upload/source/plugin/mobile/api/1/viewthread.php b/upload/source/plugin/mobile/api/1/viewthread.php index 7ced3069788dd61d813f4371a77fdc10600d34c1..e588c2fd1ae32fecdd994b63e50e781126b653b0 100644 --- a/upload/source/plugin/mobile/api/1/viewthread.php +++ b/upload/source/plugin/mobile/api/1/viewthread.php @@ -88,6 +88,31 @@ class mobile_api { preg_match('/\[tthread=(.+?),(.+?)\](.*?)\[\/tthread\]/', $variable['postlist'][$k]['message'], $matches); $variable['postlist'][$k]['message'] = preg_replace('/\[tthread=(.+?)\](.*?)\[\/tthread\]/', lang('plugin/qqconnect', 'connect_tthread_message', array('username' => $matches[1], 'nick' => $matches[2])), $variable['postlist'][$k]['message']); } + $firstpost = current($GLOBALS['postarr']); + if($firstpost['first'] && strpos($firstpost['message'],'[/hide]') !== FALSE ){ + $authorreplyexist = false; + if(!$_G['forum']['ismoderator']) { + if($_G['uid']) { + $_post = C::t('forum_post')->fetch('tid:'.$_G['tid'], $pid); + $authorreplyexist = $_post['tid'] == $_G['tid'] ? C::t('forum_post')->fetch_pid_by_tid_authorid($_G['tid'], $_G['uid']) : false; + } + } else { + $authorreplyexist = true; + } + if(!$authorreplyexist){ + $aids = array(); + preg_match_all("/\[hide(.*?)?\]\s*(.*?)\s*\[\/hide\]/is",$firstpost['message'],$matches); + foreach ($matches[2] as $match){ + preg_match_all("/\[attach\](\d+)\[\/attach\]/i",$match,$matchaids); + $aids = array_merge($aids,$matchaids[1]); + } + foreach($aids as $aid){ + unset($variable['postlist'][$k]['attachments'][$aid]); + } + $variable['postlist'][$k]['attachlist'] = array_diff($variable['postlist'][$k]['attachlist'],$aids); + $variable['postlist'][$k]['imagelist'] = array_diff($variable['postlist'][$k]['imagelist'],$aids); + } + } } foreach($GLOBALS['aimgs'] as $pid => $aids) { diff --git a/upload/source/plugin/mobile/api/4/viewthread.php b/upload/source/plugin/mobile/api/4/viewthread.php index d46c60dfecd8ddd7ef6d6eca99736f713968c96e..dcda4f9631df08290a98b3cc11d76691886a5261 100644 --- a/upload/source/plugin/mobile/api/4/viewthread.php +++ b/upload/source/plugin/mobile/api/4/viewthread.php @@ -131,6 +131,29 @@ class mobile_api { $variable['postlist'][$k]['message'] = preg_replace('/( ){2,}/', '', $variable['postlist'][$k]['message']); $variable['postlist'][$k]['dateline'] = strip_tags($post['dateline']); $variable['postlist'][$k]['groupiconid'] = mobile_core::usergroupIconId($post['groupid']); + if($firstpost['first'] && strpos($firstpost['message'],'[/hide]') !== FALSE ){ + $authorreplyexist = false; + if(!$_G['forum']['ismoderator']) { + if($_G['uid']) { + $_post = C::t('forum_post')->fetch('tid:'.$_G['tid'], $pid); + $authorreplyexist = $_post['tid'] == $_G['tid'] ? C::t('forum_post')->fetch_pid_by_tid_authorid($_G['tid'], $_G['uid']) : false; + } + } else { + $authorreplyexist = true; + } + if(!$authorreplyexist){ + $aids = array(); + preg_match_all("/\[hide(.*?)?\]\s*(.*?)\s*\[\/hide\]/is",$firstpost['message'],$matches); + foreach ($matches[2] as $match){ + preg_match_all("/\[attach\](\d+)\[\/attach\]/i",$match,$matchaids); + $aids = array_merge($aids,$matchaids[1]); + } + foreach($aids as $aid){ + unset($variable['postlist'][$k]['attachments'][$aid]); + } + $variable['postlist'][$k]['attachlist'] = array_diff($variable['postlist'][$k]['attachlist'],$aids); + } + } } if (!empty($GLOBALS['polloptions'])) {