原帖由 haohao036 于 2006-8-3 23:44 发表
https://discuz.dismall.com/viewthread.php?tid=214335&highlight=%B8%BD%BC%FE
地址送上..
我没法测试
你先备分
再测试
有问题的话
把语法错误贴出来
用下面替换你贴出来的的代码
- if(preg_match("/\[hide=?\d*\].+?\[\/hide\]/is", $message)) {
-
- // 隐藏时效 by lu5266 (www.5466.ik8.com)
- $efftime = $start = $end = 0;
- $start = strpos($message ,'[time]') + 6;
- $end = strpos($message ,'[/time]');
- if($end > $start && $start > 6) {
- $hidetime = substr($message,$start,$end-$start);
- $message = str_replace('[time]'.$hidetime.'[/time]', '', $message);
- $efftime = $hidetime * 3600 + strtotime($GLOBALS[post]['dateline']) - $GLOBALS[timestamp];
- if($efftime > 0) {
- $date = floor($efftime/86400);
- $hour = floor($efftime%86400/3600);
- $minute = floor($efftime%86400%3600/60);
- $enddate = gmdate("$GLOBALS[dateformat] $GLOBALS[timeformat]", $hidetime * 3600 + strtotime($GLOBALS[post]['dateline']) + $GLOBALS[timeoffset] * 3600);
- $effdate = "时效: <b><font color=blue>$hidetime</font></b>小时, 开始: <b><font color=blue>".$GLOBALS[post]['dateline']."</font></b>, 结束: <b><font color=blue>$enddate</font></b>, 剩下: <b><font color=blue>$date</font></b> 天 <b><font color=blue>$hour</font></b> 小时 <b><font color=blue>$minute</font></b> 分";
- $effdate = "<fieldset style="padding: 1em; width=90%" align="center"><legend>[限时隐藏] ->本内容需[跟帖回复]或者[隐藏时效已过]方可浏览</legend><br>$effdate<br></fieldset>";
- }
- }
- if(stristr($message, '[hide]')) {
- global $language,$isposted;
- include_once language('misc');
- if(!isset($isposted)) {
- $query = $db->query("SELECT pid FROM {$tablepre}posts WHERE tid='$tid' AND authorid='$discuz_uid' LIMIT 1");
- $isposted = $db->result($query, 0);
- }
- if($GLOBALS['forum']['ismoderator'] || $isposted || ($end > $start && $efftime <= 0 && $start > 6)) {
- $message = preg_replace("/\[hide\]\s*(.+?)\s*\[\/hide\]/is","<span style="altbg2"><fieldset style="margin: 2em; margin-top: 3px; padding: 10px; border: ".INNERBORDERWIDTH."px solid ".BORDERCOLOR."; word-break: break-all" align="center"><legend><span class="smalltxt"><strong>[限时隐藏失效] ->本内容[你已跟帖回复]或者[隐藏时效已过]</strong></span></legend></span>\\1<br></fieldset>",$message);
- $ishide = FALSE;
- }else if($end > $start && $efftime > 0 && $start > 6) {
- $message = preg_replace("/\[hide\](.+?)\[\/hide\]/is", $effdate, $message);
- } else {
- $GLOBALS['show_attach']=0;
- $message = preg_replace("/\[hide\](.+?)\[\/hide\]/is", "<span style="altbg2"><fieldset style="margin: 2em; margin-top: 3px; padding: 10px; border: ".INNERBORDERWIDTH."px solid ".BORDERCOLOR."; word-break: break-all" align="center"><legend><span class="smalltxt"><strong>[永久隐藏]</strong></span></legend></span>本内容需[跟帖回复]方可浏览<br></fieldset>",$message);
- $ishide = TRUE;
- }
- }
- $message = preg_replace("/\[hide=(\d+)\]\s*(.+?)\s*\[\/hide\]/ies", "creditshide(\\1,'\\2')", $message);
- }
- }
复制代码 |