Example #1
0
 public function follow()
 {
     if (IS_GET) {
         $uid = is_login();
         if (!$uid) {
             $this->error('亲,您还没有登录噢!快点<a href="' . U('User/login') . '">登录</a>吧,等你噢〜' . showface('radio'));
         }
         $this->pid = $_GET['id'];
         $this->stock = M('Stock')->find($this->pid);
         // 封闭期关闭投资
         if ($this->stock['closed'] == 1) {
             $this->error('感谢您的关注,该项目目前处于封闭期。');
         }
         $where = array('uid' => $uid, 'status' => 9, 'auth_id' => 1);
         $auth = M('UserAuth')->where($where)->count();
         if (!$auth) {
             $this->error('亲,为了方便您的投资,请先<a href="' . U('User/savecenter') . '">完善您的个人资料</a>噢!' . showface('waiting'));
         }
         //获取投资记录信息
         $data = M('StockAccount')->where(array('pid' => $this->pid, 'uid' => $uid, 'status' => 0))->find();
         //计算可投资金额
         $data['can_fund'] = $this->stock['max_fund'] - $data['fund'];
         $this->data = $data;
         $this->success($this->fetch('follow'));
     } else {
         $amount = $_POST['amount'];
         if (!preg_match("/^\\d*\$/", $amount)) {
             $this->error('投资金额请输入数字。');
         }
         $amount = intval($amount);
         $pid = $_POST['pid'];
         $stock = M('Stock')->find($pid);
         // 封闭期关闭投资
         if ($stock['closed'] == 1) {
             $this->error('感谢您的关注,该项目目前处于封闭期。');
         }
         //更新成1000的整数倍
         $min_fund = $stock['min_fund'];
         //$min_fund = 1000;
         if ($amount <= 0) {
             $this->error('投资金额必须大于0');
         } else {
             if ($amount % 1000 > 0) {
                 $this->error('投资金额必须是1000的整数倍。');
             }
         }
         $uid = is_login();
         //获取投资人记录
         $invest = M('StockAccount')->where(array('pid' => $pid, 'uid' => $uid, 'status' => 0))->find();
         //判断投资额范围
         if ($min_fund > $invest['fund'] + $amount || $stock['max_fund'] != 0 && $invest['fund'] + $amount > $stock['max_fund']) {
             $this->error('投资金额小于' . $min_fund . ',或投资总金额大于' . $stock['max_fund'] . '。');
         }
         // 添加流水记录
         $data = array('uid' => $uid, 'pid' => $pid, 'type' => '1', 'amount' => $amount, 'status' => 0, 'create_time' => NOW_TIME, 'update_time' => NOW_TIME);
         $fid = M('StockAccountFlow')->add($data);
         // 添加支付流水
         $payData['orderid'] = $fid;
         $payData['uid'] = $uid;
         $payData['pay_amount'] = $amount;
         $payData['type'] = 2;
         $payData['merorderid'] = buildMerorderid();
         $payData['amountsum'] = $amount;
         $payData['paytype'] = 0;
         $payData['state'] = 0;
         $payData['create_time'] = $payData['update_time'] = time();
         $resultPaySave = M('ProductPay')->add($payData);
         $this->success('', U('Pay/index', array('merorderid' => $payData['merorderid'])));
     }
 }
Example #2
0
 function htmread($read, $start_limit)
 {
     global $imgpath, $db_ipfrom, $db_windpost, $db_windpic, $db_signwindcode, $db_shield;
     $lpic = L::config('lpic', 'cache_read');
     $ltitle = L::config('ltitle', 'cache_read');
     $_MEDALDB = L::config('_MEDALDB', 'cache_read');
     $read['lou'] = $start_limit;
     $start_limit == $count - 1 && ($read['jupend'] = '<a name=lastatc></a>');
     $read['ifsign'] < 2 && ($read['content'] = str_replace("\n", "<br>", $read['content']));
     $read['groupid'] == '-1' && ($read['groupid'] = $read['memberid']);
     $anonymous = $read['anonymous'] ? 1 : 0;
     if ($read['groupid'] != '' && $anonymous == 0) {
         !$lpic[$read['groupid']] && ($read['groupid'] = 8);
         $read['lpic'] = $lpic[$read['groupid']];
         $read['level'] = $ltitle[$read['groupid']];
         $read['regdate'] = get_date($read['regdate'], "Y-m-d");
         $read['lastlogin'] = get_date($read['lastvisit'], "Y-m-d");
         $read['aurvrc'] = floor($read['rvrc'] / 10);
         $read['author'] = $read['username'];
         $read['ontime'] = (int) ($read['onlinetime'] / 3600);
         $tpc_author = $read['author'];
         list($read['face'], , $httpWidth, $httpHeight, , , , $read['facesize']) = showfacedesign($read['micon'], true, 'm');
         if ($httpWidth > 120 || $httpHeight > 120 || $read['facesize'] == '') {
             $read['facesize'] = ' width="120" height="120"';
         }
         list($read['posttime']) = getLastDate($read['postdate']);
         if ($db_ipfrom == 1) {
             $read['ipfrom'] = ' From:' . $read['ipfrom'];
         }
         if (L::config('md_ifopen', 'cache_read') && $read['medals']) {
             $medals = '';
             $md_a = explode(',', $read['medals']);
             foreach ($md_a as $key => $value) {
                 if ($value) {
                     $medals .= "<img src=\"{$_MEDALDB[$value][smallimage]}\" title=\"{$_MEDALDB[$value][name]}\" /> ";
                 }
             }
             $read['medals'] = $medals . '<br />';
         } else {
             $read['medals'] = '';
         }
         if ($read['ifsign'] == 1 || $read['ifsign'] == 3) {
             global $sign;
             if (!$sign[$read['author']]) {
                 global $db_signmoney, $db_signgroup, $tdtime;
                 if (strpos($db_signgroup, ",{$read['groupid']},") !== false && $db_signmoney) {
                     $read['signature'] = '';
                 } else {
                     if ($db_signwindcode && getstatus($read['userstatus'], PW_USERSTATUS_SIGNCHANGE)) {
                         $read['signature'] = convert($read['signature'], $db_windpic, 2);
                     }
                     $read['signature'] = str_replace("\n", "<br>", $read['signature']);
                 }
                 $sign[$read['author']] = $read['signature'];
             } else {
                 $read['signature'] = $sign[$read['author']];
             }
         } else {
             $read['signature'] = '';
         }
     } else {
         $read['face'] = "{$imgpath}/face/none.gif";
         $read['lpic'] = '8';
         $read['level'] = $read['digests'] = $read['postnum'] = $read['money'] = $read['regdate'] = $read['lastlogin'] = $read['aurvrc'] = $read['credit'] = '*';
         if ($anonymous) {
             $read['signature'] = $read['honor'] = $read['medals'] = $read['ipfrom'] = '';
             $read['author'] = $GLOBALS['db_anonymousname'];
             $read['authorid'] = 0;
             foreach (L::config('customfield', 'cache_read') as $key => $val) {
                 $field = "field_" . (int) $val['id'];
                 $read[$field] = '*';
             }
         }
     }
     $read['postdate'] = get_date($read['postdate']);
     $read['mark'] = '';
     if ($read['ifmark']) {
         $markdb = explode("\t", $read['ifmark']);
         foreach ($markdb as $key => $value) {
             $read['mark'] .= "<li>{$value}</li>";
         }
     }
     if ($read['icon']) {
         $read['icon'] = "<img src=\"{$imgpath}/post/emotion/{$read['icon']}.gif\" align=left border=0>";
     } else {
         $read['icon'] = '';
     }
     /**
      * 动态判断发帖是否需要转换
      */
     $tpc_shield = 0;
     if ($read['ifshield'] || $read['groupid'] == 6 && $db_shield) {
         $read['subject'] = $read['icon'] = '';
         $read['content'] = shield($read['ifshield'] ? $read['ifshield'] == 1 ? 'shield_article' : 'shield_del_article' : 'ban_article');
         $tpc_shield = 1;
     }
     if (!$tpc_shield) {
         $wordsfb = L::loadClass('FilterUtil', 'filter');
         if (!$wordsfb->equal($read['ifwordsfb'])) {
             $read['content'] = $wordsfb->convert($read['content']);
         }
         if ($read['ifconvert'] == 2) {
             $read['content'] = preg_replace("/\\[sell=(.+?)\\]/is", "", $read['content']);
             $read['content'] = preg_replace("/\\[hide=(.+?)\\]/is", "", $read['content']);
             $read['content'] = str_replace(array('[/hide]', '[/sell]', '[post]', '[/post]'), '', $read['content']);
             $read['content'] = convert($read['content'], $db_windpost);
         } else {
             strpos($read['content'], '[s:') !== false && ($read['content'] = showface($read['content']));
         }
         if ($read['aid'] && $this->attachShow->isShow($read['ifhide'], $tid)) {
             $read += $this->attachShow->parseAttachs($read['pid'], $read['content'], false);
         }
     }
     if ($read['remindinfo']) {
         $remind = explode("\t", $read['remindinfo']);
         $remind[0] = str_replace("\n", "<br />", $remind[0]);
         $remind[2] && ($remind[2] = get_date($remind[2]));
         $read['remindinfo'] = $remind;
     }
     $this->forum->foruminfo['copyctrl'] && ($read['content'] = preg_replace("/<br>/eis", "copyctrl('{$read['colour']}')", $read['content']));
     $read['alterinfo'] && ($read['content'] .= "<br><br><br><font color=gray>[ {$read['alterinfo']} ]</font>");
     return $read;
 }
Example #3
0
         require_once PrintEot('ajax');
         ajax_footer();
     } else {
         Showmsg('msg_error');
     }
 } elseif ($type == 'public') {
     $msg_gid = $winddb['groupid'];
     $msginfo = $db->get_one("SELECT m.mid,m.fromuid AS withuid,m.touid,m.username,m.ifnew,m.mdate,mc.title,mc.content FROM pw_msg m LEFT JOIN pw_msgc mc USING(mid) WHERE m.mid=" . pwEscape($mid) . " AND m.type='public' AND m.togroups LIKE " . pwEscape("%,{$msg_gid},%"));
     if ($msginfo) {
         require_once R_P . 'require/bbscode.php';
         $pubmsg = getUserPublicMsgRecord($winduid);
         @extract($pubmsg);
         $msginfo['content'] = str_replace("\n", "<br>", $msginfo['content']);
         $msginfo['content'] = convert($msginfo['content'], $db_windpost);
         if (strpos($msginfo['content'], '[s:') !== false) {
             $msginfo['content'] = showface($msginfo['content']);
         }
         $msginfo['title'] = str_replace('&ensp;$', '$', $msginfo['title']);
         $msginfo['content'] = str_replace('&ensp;$', '$', $msginfo['content']);
         $msginfo['mdate'] = get_date($msginfo['mdate']);
         $msginfo['content'] = str_replace("\$email", $winddb['email'], $msginfo['content']);
         $msginfo['content'] = str_replace("\$windid", $windid, $msginfo['content']);
         if ($pubmsg) {
             if (strpos(",{$readmsg},", ",{$msginfo['mid']},") === false) {
                 $readmsg .= $readmsg ? ',' . $msginfo['mid'] : $msginfo['mid'];
                 if (empty($readmsg)) {
                     $readmsg = '';
                 } else {
                     $temp_msgdb = explode(',', $readmsg);
                     arsort($temp_msgdb);
                     $readmsg = implode(',', $temp_msgdb);
Example #4
0
     $postdata = new replyPostData($pwpost);
 }
 $postdata->initData($postmodify);
 $postdata->setTitle($atc_title);
 $postdata->setContent($atc_content);
 $postdata->setConvert(1);
 $postmodify->execute($postdata);
 extract(L::style());
 $aids = array();
 if ($atcdb['attachs']) {
     $aids = attachment($atc_content);
 }
 $leaveword = $atcdb['leaveword'] ? leaveword($atcdb['leaveword']) : '';
 $content = convert($postdata->data['content'] . $leaveword, $db_windpost);
 if (strpos($content, '[p:') !== false || strpos($content, '[s:') !== false) {
     $content = showface($content);
 }
 if ($atcdb['ifsign'] < 2) {
     $content = str_replace("\n", '<br />', $content);
 }
 if ($postdata->data['ifwordsfb'] == 0) {
     $content = addslashes(wordsConvert(stripslashes($content)));
 }
 $creditnames = pwCreditNames();
 if ($aids) {
     if ($winduid == $atcdb['authorid'] || $pwpost->isGM || pwRights($pwpost->isBM, 'delattach')) {
         $dfadmin = 1;
     } else {
         $dfadmin = 0;
     }
     foreach ($atcdb['attachs'] as $at) {
Example #5
0
function viewread($read, $start_limit)
{
    global $db, $_G, $isGM, $pwSystem, $groupid, $attach_url, $winduid, $tablecolor, $tpc_author, $tpc_buy, $tpc_pid, $tpc_tag, $count, $orderby, $pageinverse, $timestamp, $db_onlinetime, $attachdir, $attachpath, $readcolorone, $readcolortwo, $lpic, $ltitle, $imgpath, $db_ipfrom, $db_showonline, $stylepath, $db_windpost, $db_windpic, $db_signwindcode, $fid, $tid, $pid, $md_ifopen, $_MEDALDB, $rewardtype, $db_shield, $db_iftag, $db_readtag;
    global $ping_logs;
    if ($read['istop'] == 'topped') {
        $read['lou'] = $read['floor'];
    } else {
        $read['lou'] = $orderby != 'desc' || $start_limit == 0 ? $start_limit : $count - $start_limit;
    }
    $read['jupend'] = $start_limit == $count - 1 ? "<a name=a></a><a name={$read['pid']}></a>" : "<a name={$read['pid']}></a>";
    $tpc_buy = $read['buy'];
    $tpc_pid = $read['pid'];
    $tpc_tag = NULL;
    $tpc_shield = 0;
    $read['ifsign'] < 2 && ($read['content'] = str_replace("\n", "<br />", $read['content']));
    if ($read['anonymous']) {
        $anonymous = !$isGM && $winduid != $read['authorid'] && !$pwSystem['anonyhide'];
        $read['anonymousname'] = $GLOBALS['db_anonymousname'];
    } else {
        $anonymous = false;
        $read['anonymousname'] = $read['username'];
    }
    $read['ipfrom'] = $db_ipfrom == 1 && $_G['viewipfrom'] ? $read['ipfrom'] : '';
    $read['ip'] = $isGM || $pwSystem['viewip'] ? 'IP:' . $read['userip'] : '';
    if ($read['groupid'] && !$anonymous) {
        $read['groupid'] == '-1' && ($read['groupid'] = $read['memberid']);
        !array_key_exists($read['groupid'], (array) $lpic) && ($read['groupid'] = 8);
        $read['lpic'] = $lpic[$read['groupid']];
        $read['level'] = $ltitle[$read['groupid']];
        $read['regdate'] = get_date($read['regdate'], "Y-m-d");
        $read['lastlogin'] = get_date($read['lastvisit'], "Y-m-d");
        $read['rvrc'] = floor($read['rvrc'] / 10);
        $read['author'] = $read['username'];
        $tpc_author = $read['author'];
        if (!empty($GLOBALS['showfield'])) {
            $customdata = $read['customdata'] ? (array) unserialize($read['customdata']) : array();
            $read['customdata'] = array();
            foreach ($customdata as $key => $val) {
                if ($val && in_array($key, $GLOBALS['showfield'])) {
                    $read['customdata'][$key] = $val;
                }
            }
        }
        $read['ontime'] = (int) ($read['onlinetime'] / 3600);
        $read['groupid'] == 6 && ($read['honor'] = '');
        if ($read['groupid'] != 6 && ($read['ifsign'] == 1 || $read['ifsign'] == 3)) {
            global $sign;
            if (!$sign[$read['author']]) {
                global $db_signmoney, $db_signgroup, $tdtime, $db_signcurtype;
                if ($db_signmoney && strpos($db_signgroup, ",{$read['groupid']},") !== false && (!getstatus($read['userstatus'], 10) || !$read['starttime'] || $read[$db_signcurtype] < ($tdtime - $read['starttime']) / 86400 * $db_signmoney)) {
                    $read['signature'] = '';
                } else {
                    if ($db_signwindcode && getstatus($read['userstatus'], 9)) {
                        if ($_G['right'][$read['groupid']]['imgwidth'] && $_G['right'][$read['groupid']]['imgheight']) {
                            $db_windpic['picwidth'] = $_G['right'][$read['groupid']]['imgwidth'];
                            $db_windpic['picheight'] = $_G['right'][$read['groupid']]['imgheight'];
                        }
                        if ($_G['right'][$read['groupid']]['fontsize']) {
                            $db_windpic['size'] = $_G['right'][$read['groupid']]['fontsize'];
                        }
                        $read['signature'] = convert($read['signature'], $db_windpic, 2);
                    }
                    $read['signature'] = str_replace("\n", "<br />", $read['signature']);
                }
                $sign[$read['author']] = $read['signature'];
            } else {
                $read['signature'] = $sign[$read['author']];
            }
        } else {
            $read['signature'] = '';
        }
    } else {
        $read['lpic'] = '8';
        $read['level'] = $read['digests'] = $read['postnum'] = $read['money'] = $read['currency'] = '*';
        $read['rvrc'] = $read['lastlogin'] = $read['credit'] = $read['regdate'] = '*';
        $read['honor'] = $read['signature'] = $read['micon'] = $read['aliww'] = '';
        if ($anonymous) {
            $read['oicq'] = $read['ip'] = $read['medals'] = $read['ipfrom'] = '';
            $read['author'] = $GLOBALS['db_anonymousname'];
            $read['authorid'] = 0;
            foreach ($GLOBALS['customfield'] as $key => $val) {
                $field = "field_" . (int) $val['id'];
                $read[$field] = '*';
            }
        }
    }
    $read['face'] = showfacedesign($read['micon']);
    list($read['posttime'], $read['postdate']) = getLastDate($read['postdate']);
    $read['mark'] = $read['reward'] = $read['tag'] = NULL;
    if ($read['ifmark']) {
        $ping_logs[$read['pid']] = $read['ifmark'];
    }
    if ($rewardtype != null) {
        if ($read['lou'] == 0 || $read['ifreward'] > 0 || $rewardtype == '0' && $winduid == $GLOBALS['authorid'] && $winduid != $read['authorid']) {
            $read['reward'] = Getrewhtml($read['lou'], $read['ifreward'], $read['pid']);
        }
    }
    if ($read['icon']) {
        $read['icon'] = "<img src=\"{$imgpath}/post/emotion/{$read['icon']}.gif\" align=\"left\" border=\"0\" />";
    } else {
        $read['icon'] = '';
    }
    if ($md_ifopen && $read['medals']) {
        $medals = $ifMedalNotExist = '';
        $md_a = explode(',', $read['medals']);
        foreach ($md_a as $key => $value) {
            if ($value && $_MEDALDB[$value]) {
                $medals .= "<img src=\"hack/medal/image/{$_MEDALDB[$value][picurl]}\" title=\"{$_MEDALDB[$value][name]}\" /> ";
            } else {
                unset($md_a[$key]);
                $ifMedalNotExist = 1;
            }
        }
        if ($ifMedalNotExist == 1) {
            $newMedalInfo = implode(',', $md_a);
            $db->update("UPDATE pw_members SET medals=" . pwEscape($newMedalInfo) . " WHERE uid=" . pwEscape($read['authorid']));
        }
        $read['medals'] = $medals . '<br />';
    } else {
        $read['medals'] = '';
    }
    $read['leaveword'] && ($read['content'] .= leaveword($read['leaveword'], $read['pid']));
    if ($db_iftag && $read['tags']) {
        list($tagdb, $tpc_tag) = explode("\t", $read['tags']);
        $tagdb = explode(' ', $tagdb);
        foreach ($tagdb as $key => $tag) {
            $tag && ($read['tag'] .= "<a href=\"job.php?action=tag&tagname=" . rawurlencode($tag) . "\"><span class=\"s3\">{$tag}</span></a> ");
        }
    }
    if ($read['ifshield'] || $read['groupid'] == 6 && $db_shield) {
        if ($read['ifshield'] == 2) {
            $read['content'] = shield('shield_del_article');
            $read['subject'] = '';
            $tpc_shield = 1;
        } else {
            if ($groupid == '3') {
                $read['subject'] = shield('shield_title');
            } else {
                $read['content'] = shield($read['ifshield'] ? 'shield_article' : 'ban_article');
                $read['subject'] = '';
                $tpc_shield = 1;
            }
        }
        $read['icon'] = '';
    }
    if (!$tpc_shield) {
        $aids = array();
        if ($read['aid']) {
            $attachs = $GLOBALS['attachdb'][$read['pid']];
            $read['ifhide'] > 0 && ifpost($tid) >= 1 && ($read['ifhide'] = 0);
            if (is_array($attachs) && !$read['ifhide']) {
                $aids = attachment($read['content']);
            }
        }
        if ($read['ifwordsfb'] != $GLOBALS['db_wordsfb']) {
            $read['content'] = wordsConvert($read['content'], array('id' => $tpc_pid == 'tpc' ? $tid : $tpc_pid, 'type' => $tpc_pid == 'tpc' ? 'topic' : 'posts', 'code' => $read['ifwordsfb']));
        }
        if ($read['ifconvert'] == 2) {
            $read['content'] = convert($read['content'], $db_windpost);
        } else {
            $tpc_tag && $db_readtag && ($read['content'] = relatetag($read['content'], $tpc_tag));
            strpos($read['content'], '[s:') !== false && ($read['content'] = showface($read['content']));
        }
        if ($attachs && is_array($attachs) && !$read['ifhide']) {
            if ($winduid == $read['authorid'] || $isGM || $pwSystem['delattach']) {
                $dfadmin = 1;
            } else {
                $dfadmin = 0;
            }
            foreach ($attachs as $at) {
                $atype = '';
                $rat = array();
                if ($at['type'] == 'img' && $at['needrvrc'] == 0 && (!$GLOBALS['downloadimg'] || !$GLOBALS['downloadmoney'] || $_G['allowdownload'] == 2)) {
                    $a_url = geturl($at['attachurl'], 'show');
                    if (is_array($a_url)) {
                        $atype = 'pic';
                        $dfurl = '<br>' . cvpic($a_url[0], 1, $db_windpost['picwidth'], $db_windpost['picheight'], $at['ifthumb']);
                        $rat = array('aid' => $at['aid'], 'name' => $at['name'], 'img' => $dfurl, 'dfadmin' => $dfadmin, 'desc' => $at['descrip']);
                    } elseif ($a_url == 'imgurl') {
                        $atype = 'picurl';
                        $rat = array('aid' => $at['aid'], 'name' => $at['name'], 'dfadmin' => $dfadmin, 'verify' => md5("showimg{$tid}{$read[pid]}{$fid}{$at[aid]}{$GLOBALS[db_hash]}"));
                    }
                } else {
                    $atype = 'downattach';
                    if ($at['needrvrc'] > 0) {
                        !$at['ctype'] && ($at['ctype'] = $at['special'] == 2 ? 'money' : 'rvrc');
                        $at['special'] == 2 && $GLOBALS['db_sellset']['price'] > 0 && ($at['needrvrc'] = min($at['needrvrc'], $GLOBALS['db_sellset']['price']));
                    }
                    $rat = array('aid' => $at['aid'], 'name' => $at['name'], 'size' => $at['size'], 'hits' => $at['hits'], 'needrvrc' => $at['needrvrc'], 'special' => $at['special'], 'cname' => $GLOBALS['creditnames'][$at['ctype']], 'type' => $at['type'], 'dfadmin' => $dfadmin, 'desc' => $at['descrip'], 'ext' => strtolower(substr(strrchr($at['name'], '.'), 1)));
                }
                if (!$atype) {
                    continue;
                }
                if (in_array($at['aid'], $aids)) {
                    $read['content'] = attcontent($read['content'], $atype, $rat);
                } else {
                    $read[$atype][$at['aid']] = $rat;
                }
            }
        }
    }
    /**
     * convert the post content
     */
    $read['alterinfo'] && ($read['content'] .= "<div id=\"alert_{$read['pid']}\" style=\"color:gray;margin-top:30px\">[ {$read['alterinfo']} ]</div>");
    if ($read['remindinfo']) {
        $remind = explode("\t", $read['remindinfo']);
        $remind[0] = str_replace("\n", "<br />", $remind[0]);
        $remind[2] && ($remind[2] = get_date($remind[2]));
        $read['remindinfo'] = $remind;
    }
    if ($_GET['keyword']) {
        $keywords = explode("|", $_GET['keyword']);
        foreach ($keywords as $key => $value) {
            if ($value) {
                $read['content'] = preg_replace("/(?<=[\\s\"\\]>()]|[-�]|^)(" . preg_quote($value, '/') . ")([.,:;-?!()\\s\"<\\[]|[-�]|\$)/siU", "<u><font color=\"red\">\\1</font></u>\\2", $read['content']);
            }
        }
    }
    $GLOBALS['foruminfo']['copyctrl'] && ($read['content'] = preg_replace("/<br \\/>/eis", "copyctrl()", $read['content']));
    return $read;
}
Example #6
0
        					'content'	=> $data['title'],
        					'sender'    => $windid,
        					'receiver'  => $tousername,
        				)),
        			),
        			'sms_message',
        			'sms_guestbook'
        		);
        		*/
        M::sendNotice(array($tousername), array('create_uid' => $winduid, 'create_username' => $windid, 'title' => getLangInfo('writemsg', 'o_board_success_title', array('formname' => $windid, 'sender' => $windid, 'receiver' => $tousername)), 'content' => getLangInfo('writemsg', 'o_board_success_cotent', array('formuid' => $winduid, 'formname' => $windid, 'touid' => $uid, 'content' => $data['title'], 'sender' => $windid, 'receiver' => $tousername))), 'notice_guestbook', 'notice_guestbook');
        countPosts('+1');
        require_once R_P . 'require/showimg.php';
        list($myface) = showfacedesign($winddb['icon'], 1, 'm');
        //require_once(R_P.'require/bbscode.php');
        if (strpos($title, '[s:') !== false) {
            $title = showface($title);
        }
        //require_once(R_P.'require/bbscode.php');
        $title = convert(stripslashes($title), $db_windpost);
        $postdate = get_date($timestamp);
        require_once printEOT('m_ajax');
        ajax_footer();
    } else {
        Showmsg('undefined_action');
    }
} elseif ($a == 'delboard') {
    S::gp(array('id'), 'P', 2);
    if (!$id) {
        Showmsg('undefined_action');
    }
    $board = $db->get_one("SELECT * FROM pw_oboard WHERE id=" . S::sqlEscape($id));
Example #7
0
//留言板
if ($privacy['msgboard']) {
    $boards = array();
    require_once R_P . 'require/bbscode.php';
    $wordsfb = L::loadClass('FilterUtil');
    $query = $db->query("SELECT o.*,m.icon as face,m.groupid FROM pw_oboard o LEFT JOIN pw_members m ON o.uid=m.uid WHERE o.touid=" . pwEscape($u) . " ORDER BY o.id DESC " . pwLimit(0, 15));
    while ($rt = $db->fetch_array($query)) {
        $rt['postdate'] = get_date($rt['postdate']);
        list($rt['face']) = showfacedesign($rt['face'], 1, 'm');
        if ($rt['groupid'] == 6 && $db_shield && $groupid != 3) {
            $rt['title'] = appShield('ban_feed');
        } elseif (!$wordsfb->equal($rt['ifwordsfb'])) {
            $rt['title'] = $wordsfb->convert($rt['title'], array('id' => $rt['id'], 'type' => 'oboard', 'code' => $rt['ifwordsfb']));
        }
        if (strpos($rt['title'], '[s:') !== false) {
            $rt['title'] = showface($rt['title']);
        }
        if (strpos($rt['title'], '[url') !== false) {
            $rt['title'] = convert($rt['title'], $db_windpost);
        }
        $boardids[] = $rt['id'];
        $boards[] = $rt;
    }
    if (!empty($boardids)) {
        $commentdb = getCommentDb('board', $boardids);
    }
}
$whovisit = unserialize($userdb['whovisit']);
$tovisit = unserialize($userdb['tovisit']);
is_array($whovisit) || ($whovisit = array());
is_array($tovisit) || ($tovisit = array());
Example #8
0
     $pwAnonyHide = $pwpost->isGM || pwRights($pwpost->isBM, 'anonyhide');
     $query = $db->query("SELECT p.pid,p.author,p.authorid,p.subject,p.postdate,p.content,p.anonymous,p.ifconvert,p.ifwordsfb,p.ifshield,m.uid,m.groupid,m.userstatus FROM {$pw_posts} p LEFT JOIN pw_members m ON p.authorid=m.uid WHERE tid=" . S::sqlEscape($tid) . "AND ifcheck='1' ORDER BY postdate DESC LIMIT 0,{$db_showreplynum}");
     while ($rt = $db->fetch_array($query)) {
         $tpc_author = $rt['anonymous'] && !$pwAnonyHide && $windid != $rt['author'] ? $db_anonymousname : $rt['author'];
         $tpc_pid = $rt['pid'];
         if ($rt['ifshield']) {
             $groupid != '3' && ($rt['content'] = shield($rt['ifshield'] == '1' ? 'shield_article' : 'shield_del_article'));
         } elseif ($groupid != 3 && $db_shield && $pwforum->forumBan($rt)) {
             $rt['content'] = shield('ban_article');
         } else {
             if (!$wordsfb->equal($rt['ifwordsfb'])) {
                 $rt['content'] = $wordsfb->convert($rt['content']);
             }
             $rt['ifconvert'] == 2 && ($rt['content'] = convert($rt['content'], $db_windpost));
             if (strpos($rt['content'], '[p:') !== false || strpos($rt['content'], '[s:') !== false) {
                 $rt['content'] = showface($rt['content']);
             }
         }
         $review_content = substrs(stripWindCode($rt['content']), 255);
         $post_reply .= "<table width=\"100%\"><tr><td><div class=\"h b\">{$tpc_author}:{$rt['subject']}</div><div class=\"p10\">{$rt['content']}</div></td></tr></table>";
         $review_reply .= "<table width=\"100%\"><tr><td><div class=\"h b\">{$tpc_author}:{$rt['subject']}</div><div class=\"p10\">{$review_content}</div></td></tr></table>";
     }
 }
 if ($winduid && $tpcarray['special'] == 5) {
     $debatestand = $db->get_value("SELECT standpoint FROM pw_debatedata WHERE pid='0' AND tid=" . S::sqlEscape($tid) . "AND authorid=" . S::sqlEscape($winduid));
     $debatestand = (int) $debatestand;
     ${'debate_' . $debatestand} = 'SELECTED';
 }
 $postMinLength = empty($pwpost->forum->foruminfo['forumset']['contentminlen']) ? $db_postmin : $pwpost->forum->foruminfo['forumset']['contentminlen'];
 /**
  * 索引设计时为了减少空间,回复的主题可能为空,所以默认为回复主题!
Example #9
0
function convert($message, $allow, $type = "post")
{
    global $isGM, $pwPostHide, $pwSellHide, $pwEncodeHide, $code_num, $code_htm, $phpcode_htm, $foruminfo, $db_picpath, $imgpath, $stylepath, $db_attachname, $attachpath, $tpc_author, $tpc_buy, $db_cvtimes, $forumset, $tpc_tag, $db_windcode;
    $code_num = 0;
    $code_htm = array();
    if (strpos($message, "[code]") !== false && strpos($message, "[/code]") !== false) {
        $message = preg_replace("/\\[code\\](.+?)\\[\\/code\\]/eis", "phpcode('\\1')", $message, $db_cvtimes);
    }
    if (strpos($message, "[payto]") !== false && strpos($message, "[/payto]") !== false) {
        require_once R_P . 'require/paytofunc.php';
        $message = preg_replace("/\\[payto\\](.+?)\\[\\/payto\\]/eis", "payto('\\1')", $message);
    }
    $message = preg_replace('/\\[list=([aA1]?)\\](.+?)\\[\\/list\\]/is', "<ol type=\"\\1\" style=\"margin:0 0 0 25px\">\\2</ol>", $message);
    $searcharray = array('[u]', '[/u]', '[b]', '[/b]', '[i]', '[/i]', '[list]', '[li]', '[/li]', '[/list]', '[sub]', '[/sub]', '[sup]', '[/sup]', '[strike]', '[/strike]', '[blockquote]', '[/blockquote]', '[hr]', '[/backcolor]', '[/color]', '[/font]', '[/size]', '[/align]');
    $replacearray = array('<u>', '</u>', '<b>', '</b>', '<i>', '</i>', '<ul style="margin:0 0 0 15px">', '<li>', '</li>', '</ul>', '<sub>', '</sub>', '<sup>', '</sup>', '<strike>', '</strike>', '<blockquote>', '</blockquote>', '<hr />', '</span>', '</span>', '</font>', '</font>', '</div>');
    $message = str_replace($searcharray, $replacearray, $message);
    $message = str_replace("p_w_upload", $db_attachname, $message);
    //此处位置不可调换
    $message = str_replace("p_w_picpath", $db_picpath, $message);
    //此处位置不可调换
    $searcharray = array("/\\[font=([^\\[\\(&\\;]+?)\\]/is", "/\\[color=([#0-9a-z]{1,15})\\]/is", "/\\[backcolor=([#0-9a-z]{1,10})\\]/is", "/\\[email=([^\\[]*)\\]([^\\[]*)\\[\\/email\\]/is", "/\\[email\\]([^\\[]*)\\[\\/email\\]/is", "/\\[size=(\\d+)\\]/eis", "/\\[align=(left|center|right|justify)\\]/is", "/\\[glow=(\\d+)\\,([0-9a-zA-Z]+?)\\,(\\d+)\\](.+?)\\[\\/glow\\]/is");
    $replacearray = array("<font face=\"\\1 \">", "<span style=\"color:\\1 \">", "<span style=\"background-color:\\1 \">", "<a href=\"mailto:\\1 \">\\2</a>", "<a href=\"mailto:\\1 \">\\1</a>", "size('\\1','{$allow['size']}')", "<div align=\"\\1\">", "<div style=\"width:\\1px;filter:glow(color=\\2,strength=\\3);\">\\4</div>");
    $message = preg_replace($searcharray, $replacearray, $message);
    if ($db_windcode) {
        $message = preg_replace($db_windcode['searcharray'], $db_windcode['replacearray'], $message);
    }
    if ($allow['pic']) {
        $message = preg_replace("/\\[img\\]([^\\<\r\n\"']+?)\\[\\/img\\]/eis", "cvpic('\\1','','{$allow['picwidth']}','{$allow['picheight']}')", $message, $db_cvtimes);
    } else {
        $message = preg_replace("/\\[img\\]([^\\<\r\n\"']+?)\\[\\/img\\]/eis", "nopic('\\1')", $message, $db_cvtimes);
    }
    if (strpos($message, '[/URL]') !== false || strpos($message, '[/url]') !== false) {
        $searcharray = array("/\\[url=(https?|ftp|gopher|news|telnet|mms|rtsp|thunder)([^\\[\\s]+?)(\\,(1))?\\](.+?)\\[\\/url\\]/eis", "/\\[url\\]www\\.([^\\[]+?)\\[\\/url\\]/eis", "/\\[url\\](https?|ftp|gopher|news|telnet|mms|rtsp|thunder)([^\\[]+?)\\[\\/url\\]/eis");
        $replacearray = array("cvurl('\\1','\\2','\\5','\\4','{$allow['checkurl']}')", "cvurl('\\1','','','','{$allow['checkurl']}')", "cvurl('\\1','\\2','','','{$allow['checkurl']}')");
        $message = preg_replace($searcharray, $replacearray, $message);
    }
    $searcharray = array("/\\[fly\\]([^\\[]*)\\[\\/fly\\]/is", "/\\[move\\]([^\\[]*)\\[\\/move\\]/is");
    $replacearray = array("<marquee width=90% behavior=alternate scrollamount=3>\\1</marquee>", "<marquee scrollamount=3>\\1</marquee>");
    $message = preg_replace($searcharray, $replacearray, $message);
    if ($type == 'post') {
        if ($foruminfo['allowhide'] && strpos($message, "[post]") !== false && strpos($message, "[/post]") !== false) {
            $message = preg_replace("/\\[post\\](.+?)\\[\\/post\\]/eis", "post('\\1')", $message);
        }
        if ($forumset['allowencode'] && strpos($message, "[hide=") !== false && strpos($message, "[/hide]") !== false) {
            $message = preg_replace("/\\[hide=(.+?)\\](.+?)\\[\\/hide\\]/eis", "hidden('\\1','\\2')", $message);
        }
        if ($foruminfo['allowsell'] && strpos($message, "[sell") !== false && strpos($message, "[/sell]") !== false) {
            $message = preg_replace("/\\[sell=(.+?)\\](.+?)\\[\\/sell\\]/eis", "sell('\\1','\\2')", $message);
        }
    }
    if (strpos($message, "[quote]") !== false && strpos($message, "[/quote]") !== false) {
        $message = preg_replace("/\\[quote\\](.+?)\\[\\/quote\\]/eis", "qoute('\\1')", $message);
    }
    if (is_array($code_htm)) {
        krsort($code_htm);
        foreach ($code_htm as $codehtm) {
            foreach ($codehtm as $key => $value) {
                $message = str_replace("<\twind_code_{$key}\t>", $value, $message);
            }
        }
    }
    if ($allow['flash']) {
        $message = preg_replace("/\\[flash=(\\d+?)\\,(\\d+?)(\\,(0|1))?\\]([^\\[\\<\r\n\"']+?)\\[\\/flash\\]/eis", "wplayer('\\5','\\1','\\2','\\4','flash')", $message, $db_cvtimes);
    } else {
        $message = preg_replace("/\\[flash=(\\d+?)\\,(\\d+?)(\\,(0|1))?\\]([^\\[\\<\r\n\"']+?)\\[\\/flash\\]/is", "<img src='{$imgpath}/{$stylepath}/file/music.gif' align='absbottom'> <a target='_blank' href='\\5 '>flash: \\5</a>", $message, $db_cvtimes);
    }
    if ($type == 'post') {
        $t = 0;
        while (strpos($message, '[table') !== false && strpos($message, '[/table]') !== false) {
            $message = preg_replace('/\\[table(=(\\d{1,3}(%|px)?))?\\](.*?)\\[\\/table\\]/eis', "tablefun('\\2','\\3','\\4')", $message);
            if (++$t > 4) {
                break;
            }
        }
        if ($allow['mpeg']) {
            $message = preg_replace(array("/\\[wmv=(0|1)\\]([^\\<\r\n\"']+?)\\[\\/wmv\\]/eis", "/\\[wmv(=([0-9]{1,3})\\,([0-9]{1,3})\\,(0|1))?\\]([^\\<\r\n\"']+?)\\[\\/wmv\\]/eis", "/\\[rm(=([0-9]{1,3})\\,([0-9]{1,3})\\,(0|1))?\\]([^\\<\r\n\"']+?)\\[\\/rm\\]/eis"), array("wplayer('\\2','314','53','\\1','wmv')", "wplayer('\\5','\\2','\\3','\\4','wmv')", "wplayer('\\5','\\2','\\3','\\4','rm')"), $message, $db_cvtimes);
        } else {
            $message = preg_replace(array("/\\[wmv=[01]{1}\\]([^\\<\r\n\"']+?)\\[\\/wmv\\]/is", "/\\[wmv(?:=[0-9]{1,3}\\,[0-9]{1,3}\\,[01]{1})?\\]([^\\<\r\n\"']+?)\\[\\/wmv\\]/is", "/\\[rm(?:=[0-9]{1,3}\\,[0-9]{1,3}\\,[01]{1})\\]([^\\<\r\n\"']+?)\\[\\/rm\\]/is"), "<img src=\"{$imgpath}/{$stylepath}/file/music.gif\" align=\"absbottom\"> <a target=\"_blank\" href=\"\\1 \">\\1</a>", $message, $db_cvtimes);
        }
        if ($allow['iframe']) {
            $message = preg_replace("/\\[iframe\\]([^\\[\\<\r\n\"']+?)\\[\\/iframe\\]/is", "<IFRAME SRC=\\1 FRAMEBORDER=0 ALLOWTRANSPARENCY=true SCROLLING=YES WIDTH=97% HEIGHT=340></IFRAME>", $message, $db_cvtimes);
        } else {
            $message = preg_replace("/\\[iframe\\]([^\\[\\<\r\n\"']+?)\\[\\/iframe\\]/is", "Iframe Close: <a target=_blank href='\\1 '>\\1</a>", $message, $db_cvtimes);
        }
        $tpc_tag && ($message = relatetag($message, $tpc_tag));
        strpos($message, '[s:') !== false && ($message = showface($message));
    }
    if (is_array($phpcode_htm)) {
        foreach ($phpcode_htm as $key => $value) {
            $message = str_replace("<\twind_phpcode_{$key}\t>", $value, $message);
        }
    }
    return $message;
}
Example #10
0
function htmread($read, $start_limit)
{
    global $tpc_author, $count, $timestamp, $db_onlinetime, $db_bbsurl, $attachdir, $attachpath, $_G, $tablecolor, $readcolorone, $readcolortwo, $lpic, $ltitle, $imgpath, $db_ipfrom, $db_showonline, $stylepath, $db_windpost, $db_windpic, $fid, $tid, $attachments, $aids, $db_signwindcode, $db_md_ifopen, $_MEDALDB, $db_shield;
    //* include_once pwCache::getPath(D_P.'data/bbscache/level.php');
    extract(pwCache::getData(D_P . 'data/bbscache/level.php', false));
    $read['lou'] = $start_limit;
    $start_limit == $count - 1 && ($read['jupend'] = '<a name=lastatc></a>');
    $read['ifsign'] < 2 && ($read['content'] = str_replace("\n", "<br>", $read['content']));
    $read['groupid'] == '-1' && ($read['groupid'] = $read['memberid']);
    $anonymous = $read['anonymous'] ? 1 : 0;
    if ($read['groupid'] != '' && $anonymous == 0) {
        !$lpic[$read['groupid']] && ($read['groupid'] = 8);
        $read['lpic'] = $lpic[$read['groupid']];
        $read['level'] = $ltitle[$read['groupid']];
        $read['regdate'] = get_date($read['regdate'], "Y-m-d");
        $read['lastlogin'] = get_date($read['lastvisit'], "Y-m-d");
        $read['aurvrc'] = floor($read['rvrc'] / 10);
        $read['author'] = $read['username'];
        $read['ontime'] = (int) ($read['onlinetime'] / 3600);
        $tpc_author = $read['author'];
        $read['face'] = showfacedesign($read['micon']);
        if ($db_ipfrom == 1) {
            $read['ipfrom'] = ' From:' . $read['ipfrom'];
        }
        if ($db_md_ifopen && $read['medals']) {
            $medals = '';
            $md_a = explode(',', $read['medals']);
            foreach ($md_a as $key => $value) {
                if ($value) {
                    $medals .= "<img src=\"{$_MEDALDB[$value][smallimage]}\" title=\"{$_MEDALDB[$value][name]}\" /> ";
                }
            }
            $read['medals'] = $medals . '<br />';
        } else {
            $read['medals'] = '';
        }
        if ($read['ifsign'] == 1 || $read['ifsign'] == 3) {
            global $sign;
            if (!$sign[$read['author']]) {
                global $db_signmoney, $db_signgroup, $tdtime;
                if (strpos($db_signgroup, ",{$read['groupid']},") !== false && $db_signmoney && (!getstatus($read['userstatus'], PW_USERSTATUS_SHOWSIGN) || (!$read['starttime'] || $read['currency'] < ($tdtime - $read['starttime']) / 86400 * $db_signmoney))) {
                    $read['signature'] = '';
                } else {
                    if ($db_signwindcode && getstatus($read['userstatus'], PW_USERSTATUS_SIGNCHANGE)) {
                        $read['signature'] = convert($read['signature'], $db_windpic, 2);
                    }
                    $read['signature'] = str_replace("\n", "<br>", $read['signature']);
                }
                $sign[$read['author']] = $read['signature'];
            } else {
                $read['signature'] = $sign[$read['author']];
            }
        } else {
            $read['signature'] = '';
        }
    } else {
        $read['face'] = "<br>";
        $read['lpic'] = '8';
        $read['level'] = $read['digests'] = $read['postnum'] = $read['money'] = $read['regdate'] = $read['lastlogin'] = $read['aurvrc'] = $read['credit'] = '*';
        if ($anonymous) {
            $read['signature'] = $read['honor'] = $read['medals'] = $read['ipfrom'] = '';
            $read['author'] = $GLOBALS['db_anonymousname'];
            $read['authorid'] = 0;
            foreach ($GLOBALS['customfield'] as $key => $val) {
                $field = "field_" . (int) $val['id'];
                $read[$field] = '*';
            }
        }
    }
    $read['postdate'] = get_date($read['postdate']);
    $read['mark'] = '';
    if ($read['ifmark']) {
        $markdb = explode("\t", $read['ifmark']);
        foreach ($markdb as $key => $value) {
            $read['mark'] .= "<li>{$value}</li>";
        }
    }
    if ($read['icon']) {
        $read['icon'] = "<img src=\"{$imgpath}/post/emotion/{$read['icon']}.gif\" align=left border=0>";
    } else {
        $read['icon'] = '';
    }
    /**
     * 动态判断发帖是否需要转换
     */
    $tpc_shield = 0;
    if ($read['ifshield'] || $read['groupid'] == 6 && $db_shield) {
        $read['subject'] = $read['icon'] = '';
        $read['content'] = shield($read['ifshield'] ? $read['ifshield'] == 1 ? 'shield_article' : 'shield_del_article' : 'ban_article');
        $tpc_shield = 1;
    }
    $creditnames = pwCreditNames();
    if (!$tpc_shield) {
        $attachs = $aids = array();
        if ($read['aid'] && !$read['ifhide']) {
            $attachs = unserialize($read['aid']);
            if (is_array($attachs)) {
                $aids = attachment($read['content']);
            }
        }
        $wordsfb = L::loadClass('FilterUtil', 'filter');
        if (!$wordsfb->equal($read['ifwordsfb'])) {
            $read['content'] = $wordsfb->convert($read['content']);
        }
        if ($read['ifconvert'] == 2) {
            $read['content'] = preg_replace("/\\[sell=(.+?)\\]/is", "", $read['content']);
            $read['content'] = preg_replace("/\\[hide=(.+?)\\]/is", "", $read['content']);
            $read['content'] = str_replace(array('[/hide]', '[/sell]', '[post]', '[/post]'), '', $read['content']);
            $read['content'] = convert($read['content'], $db_windpost);
        } else {
            strpos($read['content'], '[s:') !== false && ($read['content'] = showface($read['content']));
        }
        if ($attachs && is_array($attachs) && !$read['ifhide']) {
            foreach ($attachs as $at) {
                $atype = '';
                $rat = array();
                if ($at['type'] == 'img' && $at['needrvrc'] == 0) {
                    $a_url = geturl($at['attachurl'], 'show');
                    if (is_array($a_url)) {
                        $atype = 'pic';
                        $dfurl = '<br>' . cvpic($a_url[0], 1, $db_windpost['picwidth'], $db_windpost['picheight'], $at['ifthumb']);
                        $rat = array('aid' => $at['aid'], 'img' => $dfurl, 'dfadmin' => 0, 'desc' => $at['desc']);
                    } elseif ($a_url == 'imgurl') {
                        $atype = 'picurl';
                        $rat = array('aid' => $at['aid'], 'name' => $at['name'], 'dfadmin' => 0, 'verify' => md5("showimg{$tid}{$read[pid]}{$fid}{$at[aid]}{$GLOBALS[db_hash]}"));
                    }
                } else {
                    $atype = 'downattach';
                    if ($at['needrvrc'] > 0) {
                        !$at['ctype'] && ($at['ctype'] = $at['special'] == 2 ? 'money' : 'rvrc');
                        $at['special'] == 2 && $GLOBALS['db_sellset']['price'] > 0 && ($at['needrvrc'] = min($at['needrvrc'], $GLOBALS['db_sellset']['price']));
                    }
                    $rat = array('aid' => $at['aid'], 'name' => $at['name'], 'size' => $at['size'], 'hits' => $at['hits'], 'needrvrc' => $at['needrvrc'], 'special' => $at['special'], 'cname' => $creditnames[$at['ctype']], 'type' => $at['type'], 'dfadmin' => 0, 'desc' => $at['desc'], 'ext' => strtolower(substr(strrchr($at['name'], '.'), 1)));
                }
                if (!$atype) {
                    continue;
                }
                if (in_array($at['aid'], $aids)) {
                    $read['content'] = attcontent($read['content'], $atype, $rat);
                } else {
                    $read[$atype][$at['aid']] = $rat;
                }
            }
        }
    }
    $GLOBALS['foruminfo']['copyctrl'] && ($read['content'] = preg_replace("/<br>/eis", "copyctrl('{$read['colour']}')", $read['content']));
    $read['alterinfo'] && ($read['content'] .= "<br><br><br><font color=gray>[ {$read['alterinfo']} ]</font>");
    return $read;
}
Example #11
0
 $wordsfb = L::loadClass('FilterUtil');
 list($pages, $limit) = pwLimitPages($sum, $page, $basename . "q=diary&a={$a}&");
 $query = $db->query("SELECT d.did,d.dtid,d.uid,d.aid,d.username,d.privacy,d.subject,d.ifconvert,d.ifwordsfb,d.content,d.r_num,d.c_num,d.postdate,m.groupid,m.icon FROM pw_diary d LEFT JOIN pw_members m ON d.uid=m.uid {$sqladd} ORDER BY d.postdate DESC {$limit}");
 while ($rt = $db->fetch_array($query)) {
     if ($rt['groupid'] == 6 && $db_shield && $groupid != 3) {
         $rt['subject'] = '';
         $rt['content'] = appShield('ban_diary');
     } elseif (!$wordsfb->equal($rt['ifwordsfb'])) {
         $rt['content'] = $wordsfb->convert($rt['content'], array('id' => $rt['did'], 'type' => 'diary', 'code' => $rt['ifwordsfb']));
     }
     $rt['postdate'] = get_date($rt['postdate'], 'Y-m-d H:i');
     $rt['content'] = preg_replace("/\\[s:(.+?)\\]/eis", '', $rt['content']);
     if ($rt['ifconvert'] == 2) {
         $rt['content'] = convert($rt['content'], $db_windpost);
     } else {
         strpos($rt['content'], '[s:') !== false && ($rt['content'] = showface($rt['content']));
     }
     if ($o_shownum) {
         $rt['content'] = substrs($rt['content'], $o_shownum);
     }
     $rt['content'] = str_replace("\n", "<br />", $rt['content']);
     $attachs = $aids = array();
     if ($rt['aid']) {
         $attachs = unserialize($rt['aid']);
         if (is_array($attachs)) {
             $aids = attachment($rt['content']);
         }
     }
     if ($attachs && is_array($attachs)) {
         if ($winduid == $rt['authorid'] || $groupid == 3) {
             $dfadmin = 1;
Example #12
0
 function get_messageboard($uid, $num = 20)
 {
     global $db_windpost, $tpc_author;
     require_once R_P . 'require/bbscode.php';
     require_once R_P . 'require/showimg.php';
     $array = $boardids = array();
     $query = $this->_db->query("SELECT o.*,m.icon as face,m.groupid FROM pw_oboard o LEFT JOIN pw_members m ON o.uid=m.uid WHERE o.touid=" . S::sqlEscape($uid) . " ORDER BY o.id DESC " . S::sqlLimit($num));
     while ($rt = $this->_db->fetch_array($query)) {
         $rt['postdate'] = get_date($rt['postdate']);
         list($rt['face']) = showfacedesign($rt['face'], 1, 'm');
         if (strpos($rt['title'], '[s:') !== false) {
             $tpc_author = $rt['username'];
             $rt['title'] = showface($rt['title']);
         }
         if (strpos($rt['title'], '[url') !== false) {
             $rt['title'] = convert($rt['title'], $db_windpost);
         }
         $array[$rt['id']] = $rt;
     }
     return $array;
 }
 public function leader()
 {
     $this->pageTitle = '申请领投人';
     $uid = is_login();
     if (!$uid) {
         $this->redirect('User/login');
     }
     $where = array('uid' => $uid, 'status' => 9, 'auth_id' => 1);
     $auth = M('UserAuth')->where($where)->count();
     $phone = M('UcenterMember')->find($uid);
     if (!$auth || empty($phone['mobile'])) {
         $this->error('您还没有完成实名认证或绑定手机,完善后方可投资。' . showface('waiting'), U('User/savecenter'));
     }
     /** 领投人资格验证(暂时不做领投人认证) **/
     //		$where['auth_id'] = 3;
     //		unset($where['status']);
     //		$auth = M('UserAuth')->where($where)->count();
     //		$phone = M('UcenterMember')->find($uid);
     //		if (!$auth || empty($phone['mobile'])) {
     //			$this->error('您还没有获取领投人资格,立即前往申请领投人。'.showface('waiting'),
     //			 U('User/applylead'));
     //		}
     $pid = I('id');
     $project = D('ProjectFundView')->where(array('p.id' => $pid))->find();
     if (!$project) {
         $this->error('项目不存在!');
     } else {
         if ($project['stage'] != 1) {
             //非询价认投期
             $this->error('该项目不处于预热期,不能申请领投人。');
         } else {
             if ($project['uid'] == $uid) {
                 $this->error('不允许项目发起人,领投自己项目。');
             } else {
                 if (!empty($project['leader_id'])) {
                     $this->error('该项目已经指定了领投人,领投人申请已经关闭.');
                 }
             }
         }
     }
     $count = M('ProjLeader')->where(array('pid' => $pid, 'uid' => $uid, 'status' => array('egt', 0), 'del_flag' => 0))->count();
     if ($count > 0) {
         $this->error('您已经是该项目的候选领投人。请不要重复申请。');
     }
     if (IS_GET) {
         //        $this->assign('pid',$pid);
         $this->project = $project;
         $this->display('leader');
     } else {
         $data = array('pid' => $pid, 'uid' => $uid, 'fund' => $_POST['fund'], 'message' => $_POST['message']);
         if ($project['need_fund'] < $data['fund']) {
             $this->error('投资金额必须小于融资金额' . round($project['need_fund'], 2) . '元。');
         } else {
             if ($project['follow_fund'] > $data['fund']) {
                 $this->error('跟投额必须大于或者等于起投额' . round($project['follow_fund'], 2) . '元。');
             }
         }
         if ($project['type'] == 0 && $data['fund'] % 1000 > 0) {
             $this->error('投资金额必须是1000的倍数。');
         }
         if (empty($data['message'])) {
             $this->error('请填写您的投资理由。');
         }
         $data['status'] = 0;
         $data['create_time'] = NOW_TIME;
         //			M('ProjLeader')->add($data);//todo 添加领头人列表,付款成功后再添写入数据库中
         $investor['step'] = $project['stage'];
         $investor['project_valuation'] = $project['project_valuation'];
         $investor['project_id'] = $pid;
         $investor['investor_id'] = $uid;
         $investor['lead_type'] = 2;
         // 候选领投人
         $investor['fund'] = $_POST['fund'];
         $investor['others'] = $_POST['message'];
         $investor['create_time'] = NOW_TIME;
         $investor['create_id'] = $uid;
         $investor['update_time'] = NOW_TIME;
         $investor['update_id'] = $uid;
         $investor['status'] = 4;
         M('ProjectInvestor')->add($investor);
         //todo 添加投资金额列表
         M('ProjectFund')->where('project_id=' . $pid)->setInc('has_fund', $investor['fund']);
         M('ProjectFund')->where('project_id=' . $pid)->setInc('agree_fund', $investor['fund']);
         // 发送系统消息(通知项目方有人跟投)
         $ulink = '<a href="' . U('MCenter/profile?id=' . $uid) . '">' . get_membername($uid) . '</a>';
         $plink = '<a href="' . U('Manage/foundfollow') . '">《' . $project['project_name'] . '》</a>';
         $content = $ulink . '申请领投了您的' . $plink . '项目';
         D('Message')->send(0, $project['uid'], '', $content, 3);
         $this->success('恭喜您,跟投成功!现在,去签署一下协议吧!' . showface('hand'), U('Agreement/touzi?id=' . $pid));
         //			$this->success('领投申请已经成功,请等待项目方同意。'.showface('hand'), U('MCenter/pj_support'));
     }
 }
Example #14
0
function getCommentDbByTypeid($type, $typeid, $page, $url)
{
    global $db, $groupid, $db_shield, $db_perpage, $db_windpost;
    if (!checkCommType($type)) {
        Showmsg('undefined_action');
    }
    $wordsfb = L::loadClass('FilterUtil');
    $commentdb = $subcommentdb = array();
    $count = $db->get_value("SELECT COUNT(*) FROM pw_comment WHERE type=" . pwEscape($type) . " AND typeid=" . pwEscape($typeid) . " AND upid='0'");
    $numofpage = ceil($count / $db_perpage);
    $start = ($page - 1) * $db_perpage;
    $limit = pwLimit($start, $db_perpage);
    $query = $db->query("SELECT c.id,c.uid,c.username,c.title,c.postdate,c.typeid,c.upid,c.ifwordsfb,m.icon as face,m.groupid FROM pw_comment c LEFT JOIN pw_members m ON c.uid=m.uid WHERE c.type=" . pwEscape($type) . " AND c.typeid=" . pwEscape($typeid) . " AND upid='0' ORDER BY postdate DESC {$limit}");
    while ($rt = $db->fetch_array($query)) {
        $rt['postdate'] = get_date($rt['postdate']);
        list($rt['face']) = showfacedesign($rt['face'], 1, 'm');
        if ($rt['groupid'] == 6 && $db_shield && $groupid != 3) {
            $rt['title'] = getLangInfo('other', 'ban_comment');
        } elseif (!$wordsfb->equal($rt['ifwordsfb'])) {
            $rt['title'] = $wordsfb->convert($rt['title'], array('id' => $rt['id'], 'type' => 'comments', 'code' => $rt['ifwordsfb']));
        }
        if (strpos($rt['title'], '[s:') !== false) {
            $rt['title'] = showface($rt['title']);
        }
        if (strpos($rt['title'], '[url') !== false) {
            $rt['title'] = convert($rt['title'], $db_windpost);
        }
        $commentids[] = $rt['id'];
        $commentdb[$rt['id']] = $rt;
    }
    if ($commentids) {
        $query = $db->query("SELECT c.id,c.uid,c.username,c.title,c.postdate,c.typeid,c.upid,c.ifwordsfb,m.icon as face,m.groupid FROM pw_comment c LEFT JOIN pw_members m ON c.uid=m.uid WHERE c.type=" . pwEscape($type) . " AND c.typeid=" . pwEscape($typeid) . " AND upid IN (" . pwImplode($commentids) . ") ORDER BY postdate ASC");
        while ($rt = $db->fetch_array($query)) {
            $rt['postdate'] = get_date($rt['postdate']);
            list($rt['face']) = showfacedesign($rt['face'], 1, 'm');
            if ($rt['groupid'] == 6 && $db_shield && $groupid != 3) {
                $rt['title'] = getLangInfo('other', 'ban_comment');
            } elseif (!$wordsfb->equal($rt['ifwordsfb'])) {
                $rt['title'] = $wordsfb->convert($rt['title'], array('id' => $rt['id'], 'type' => 'comments', 'code' => $rt['ifwordsfb']));
            }
            $subcommentdb[$rt['upid']][$rt['id']] = $rt;
        }
    }
    $pages = numofpage($count, $page, $numofpage, $url);
    return array($commentdb, $subcommentdb, $pages);
}
 public function addressList($pid)
 {
     $uid = is_login();
     if (!$uid) {
         $this->error('亲,您还没有登录噢!快点登录吧,等你噢〜' . showface('radio'), U('User/login'));
     }
     if (IS_POST) {
     } else {
         //获取所有地址信息
         $resultAddress = M('CustomAddress')->where(array('uid' => $uid, 'status' => array('gt', -1)))->order('status desc,update_time desc')->select();
         $this->assign('pageTitle', '修改地址');
         $this->assign('pid', $pid);
         $this->addresslist = $resultAddress;
         $this->display('addresslist');
     }
 }
Example #16
0
function viewread($read, $start_limit)
{
    global $db, $_G, $isGM, $pwSystem, $groupid, $attach_url, $winduid, $tablecolor, $tpc_author, $tpc_buy, $tpc_pid, $tpc_tag, $count, $orderby, $pageinverse, $timestamp, $db_onlinetime, $attachdir, $attachpath, $readcolorone, $readcolortwo, $lpic, $ltitle, $imgpath, $db_ipfrom, $db_showonline, $stylepath, $db_windpost, $db_windpic, $db_signwindcode, $fid, $tid, $pid, $db_md_ifopen, $_MEDALDB, $rewardtype, $db_shield, $db_iftag, $db_readtag, $viewpic;
    global $ping_logs;
    if ($read['istop'] == 'topped') {
        $read['lou'] = $read['floor'];
    } else {
        $read['lou'] = $count - $start_limit;
    }
    $read['jupend'] = $start_limit == $count - 1 ? "<a name=a></a><a name={$read['pid']}></a>" : "<a name={$read['pid']}></a>";
    $tpc_buy = $read['buy'];
    $tpc_pid = $read['pid'];
    $tpc_tag = NULL;
    $tpc_shield = 0;
    $read['ifsign'] < 2 && ($read['content'] = str_replace("\n", "<br />", $read['content']));
    if ($read['anonymous']) {
        $anonymous = !$isGM && $winduid != $read['authorid'] && !$pwSystem['anonyhide'];
        $read['anonymousname'] = $GLOBALS['db_anonymousname'];
    } else {
        $anonymous = false;
        $read['anonymousname'] = $read['username'];
    }
    $read['ipfrom'] = $db_ipfrom == 1 && $_G['viewipfrom'] ? $read['ipfrom'] : '';
    $read['ip'] = $isGM || $pwSystem['viewip'] ? 'IP:' . $read['userip'] : '';
    if ($read['groupid'] && !$anonymous) {
        $read['groupid'] == '-1' && ($read['groupid'] = $read['memberid']);
        !array_key_exists($read['groupid'], (array) $lpic) && ($read['groupid'] = 8);
        $read['lpic'] = $lpic[$read['groupid']];
        $read['level'] = $ltitle[$read['groupid']];
        $read['regdate'] = get_date($read['regdate'], "Y-m-d");
        $read['lastlogin'] = get_date($read['lastvisit'], "Y-m-d");
        $read['rvrc'] = floor($read['rvrc'] / 10);
        $read['author'] = $read['username'];
        $tpc_author = $read['author'];
        if (!empty($GLOBALS['showfield'])) {
            $customdata = $read['customdata'] ? (array) unserialize($read['customdata']) : array();
            $read['customdata'] = array();
            foreach ($customdata as $key => $val) {
                if ($val && in_array($key, $GLOBALS['showfield'])) {
                    $read['customdata'][$key] = $val;
                }
            }
        }
        $read['ontime'] = (int) ($read['onlinetime'] / 3600);
        $read['groupid'] == 6 && ($read['honor'] = '');
        if ($read['groupid'] != 6 && ($read['ifsign'] == 1 || $read['ifsign'] == 3)) {
            global $sign;
            if (!$sign[$read['author']]) {
                global $db_signmoney, $db_signgroup, $tdtime, $db_signcurtype;
                if ($db_signmoney && strpos($db_signgroup, ",{$read['groupid']},") !== false && (!getstatus($read['userstatus'], PW_USERSTATUS_SHOWSIGN) || !$read['starttime'] || $read[$db_signcurtype] < ($tdtime - $read['starttime']) / 86400 * $db_signmoney)) {
                    $read['signature'] = '';
                } else {
                    if ($db_signwindcode && getstatus($read['userstatus'], PW_USERSTATUS_SIGNCHANGE)) {
                        if ($GLOBALS['gp_right'][$read['groupid']]['imgwidth'] && $GLOBALS['gp_right'][$read['groupid']]['imgheight']) {
                            $db_windpic['picwidth'] = $GLOBALS['gp_right'][$read['groupid']]['imgwidth'];
                            $db_windpic['picheight'] = $GLOBALS['gp_right'][$read['groupid']]['imgheight'];
                        }
                        if ($GLOBALS['gp_right'][$read['groupid']]['fontsize']) {
                            $db_windpic['size'] = $GLOBALS['gp_right'][$read['groupid']]['fontsize'];
                        }
                        $read['signature'] = convert($read['signature'], $db_windpic, 2);
                    }
                    $read['signature'] = str_replace("\n", "<br />", $read['signature']);
                }
                $sign[$read['author']] = $read['signature'];
            } else {
                $read['signature'] = $sign[$read['author']];
            }
        } else {
            $read['signature'] = '';
        }
    } else {
        $read['lpic'] = $lpic['2'];
        $read['level'] = $read['digests'] = $read['postnum'] = $read['money'] = $read['currency'] = '*';
        $read['rvrc'] = $read['lastlogin'] = $read['credit'] = $read['regdate'] = '*';
        $read['honor'] = $read['signature'] = $read['micon'] = $read['aliww'] = '';
        if ($anonymous) {
            $read['oicq'] = $read['ip'] = $read['medals'] = $read['ipfrom'] = '';
            $read['author'] = $GLOBALS['db_anonymousname'];
            $read['authorid'] = 0;
            foreach ($GLOBALS['customfield'] as $key => $val) {
                $field = "field_" . (int) $val['id'];
                $read[$field] = '*';
            }
        }
    }
    list($read['face'], , $httpWidth, $httpHeight, , , , $read['facesize']) = showfacedesign($read['micon'], true, 'm');
    if ($httpWidth > 120 || $httpHeight > 120 || $read['facesize'] == '') {
        $read['facesize'] = ' width="120" height="120"';
    }
    list($read['posttime'], $read['postdate']) = getLastDate($read['postdate']);
    $read['mark'] = $read['reward'] = $read['tag'] = NULL;
    if ($read['ifmark']) {
        $ping_logs[$read['pid']] = $read['ifmark'];
    }
    if ($rewardtype != null) {
        if ($read['lou'] == 0 || $read['ifreward'] > 0 || $rewardtype == '0' && $winduid == $GLOBALS['authorid'] && $winduid != $read['authorid']) {
            $read['reward'] = Getrewhtml($read['lou'], $read['ifreward'], $read['pid']);
        }
    }
    if ($read['icon']) {
        $read['icon'] = "<img src=\"{$imgpath}/post/emotion/{$read['icon']}.gif\" align=\"left\" border=\"0\" />";
    } else {
        $read['icon'] = '';
    }
    if ($db_md_ifopen && $read['medals']) {
        $medals = $ifMedalNotExist = '';
        $md_a = explode(',', $read['medals']);
        foreach ($md_a as $key => $value) {
            if ($value && $_MEDALDB[$value]) {
                $medals .= "<a href=\"apps.php?q=medal\" target=\"_blank\"><img src=\"{$_MEDALDB[$value][smallimage]}\" width=\"30\" height=\"30\"  title=\"{$_MEDALDB[$value][name]}\" /></a>";
            } else {
                unset($md_a[$key]);
                $ifMedalNotExist = 1;
            }
        }
        if ($ifMedalNotExist == 1) {
            $newMedalInfo = implode(',', $md_a);
            $userService = L::loadClass('UserService', 'user');
            /* @var $userService PW_UserService */
            $userService->update($read['authorid'], array('medals' => $newMedalInfo));
        }
        $read['medals'] = $medals . '<br />';
    } else {
        $read['medals'] = '';
    }
    $read['leaveword'] && ($read['content'] .= leaveword($read['leaveword'], $read['pid']));
    if ($read['ifshield'] || $read['groupid'] == 6 && $db_shield) {
        if ($read['ifshield'] == 2) {
            $read['content'] = shield('shield_del_article');
            $read['subject'] = '';
            $tpc_shield = 1;
        } else {
            if ($groupid == '3') {
                $read['subject'] = shield('shield_title');
            } else {
                $read['content'] = shield($read['ifshield'] ? 'shield_article' : 'ban_article');
                $read['subject'] = '';
                $tpc_shield = 1;
            }
        }
        $read['icon'] = '';
    }
    if (!$tpc_shield) {
        if ($read['ifwordsfb'] != $GLOBALS['db_wordsfb']) {
            $read['content'] = wordsConvert($read['content'], array('id' => $tpc_pid == 'tpc' ? $tid : $tpc_pid, 'type' => $tpc_pid == 'tpc' ? 'topic' : 'posts', 'code' => $read['ifwordsfb']));
        }
        if ($read['ifconvert'] == 2) {
            $read['content'] = convert($read['content'], $db_windpost);
        } else {
            $tpc_tag && ($read['content'] = relatetag($read['content'], $tpc_tag));
            strpos($read['content'], '[s:') !== false && ($read['content'] = showface($read['content']));
        }
        if ($read['aid'] && $GLOBALS['attachShow']->isShow($read['ifhide'], $tid)) {
            $read += $GLOBALS['attachShow']->parseAttachs($read['pid'], $read['content'], $winduid == $read['authorid']);
        }
    }
    /**
     * convert the post content
     */
    $read['alterinfo'] && ($read['content'] .= "<div id=\"alert_{$read['pid']}\" style=\"color:gray;margin-top:30px\">[ {$read['alterinfo']} ]</div>");
    if ($read['remindinfo']) {
        $remind = explode("\t", $read['remindinfo']);
        $remind[0] = str_replace("\n", "<br />", $remind[0]);
        $remind[2] && ($remind[2] = get_date($remind[2]));
        $read['remindinfo'] = $remind;
    }
    if ($_GET['keyword']) {
        $keywords = explode("|", $_GET['keyword']);
        foreach ($keywords as $key => $value) {
            if ($value) {
                $read['content'] = preg_replace("/(?<=[\\s\"\\]>()]|[-�]|^)(" . preg_quote($value, '/') . ")([.,:;-?!()\\s\"<\\[]|[-�]|\$)/siU", "<u><font color=\"red\">\\1</font></u>\\2", $read['content']);
            }
        }
    }
    //$GLOBALS['foruminfo']['copyctrl'] && $read['content'] = preg_replace("/<br \/>/eis","copyctrl()",$read['content']);
    return $read;
}
Example #17
0
function convert($message, $allow, $type = "post")
{
    global $isGM, $pwPostHide, $pwSellHide, $pwEncodeHide, $code_num, $code_htm, $phpcode_htm, $foruminfo, $db_picpath, $imgpath, $stylepath, $db_attachname, $attachpath, $db_cvtimes, $forumset, $tpc_tag, $db_windcode, $sell_num;
    $code_num = $sell_num = 0;
    $code_htm = array();
    if (strpos($message, "[code]") !== false && strpos($message, "[/code]") !== false) {
        $message = preg_replace("/\\[code\\](.+)?\\[\\/code\\]/eisU", "phpcode('\\1')", $message, $db_cvtimes);
    }
    if (strpos($message, "[payto]") !== false && strpos($message, "[/payto]") !== false) {
        require_once R_P . 'require/paytofunc.php';
        $message = preg_replace("/\\[payto\\](.+?)\\[\\/payto\\]/eis", "payto('\\1')", $message);
    }
    if (($pos = strpos($message, "[paragraph]")) !== false && $pos == min($pos, 10)) {
        $message = str_replace('[paragraph]', '', $message);
        $tmplist = explode('<br />', $message);
        $message = '<p style="text-indent: 2em;">' . implode('</p><p style="text-indent: 2em;">', $tmplist) . '</p>';
    }
    $message = preg_replace('/\\[list=([aA1]?)\\](.+?)\\[\\/list\\]/is', "<ol type=\"\\1\" style=\"margin:0 0 0 25px\">\\2</ol>", $message);
    $searcharray = array('[u]', '[/u]', '[b]', '[/b]', '[i]', '[/i]', '[list]', '[li]', '[/li]', '[/list]', '[sub]', '[/sub]', '[sup]', '[/sup]', '[strike]', '[/strike]', '[blockquote]', '[/blockquote]', '[hr]', '[/backcolor]', '[/color]', '[/font]', '[/size]', '[/align]');
    $replacearray = array('<u>', '</u>', '<b>', '</b>', '<i>', '</i>', '<ul style="margin:0 0 0 25px">', '<li>', '</li>', '</ul>', '<sub>', '</sub>', '<sup>', '</sup>', '<strike>', '</strike>', '<blockquote>', '</blockquote>', '<hr />', '</span>', '</span>', '</font>', '</font>', '</div>');
    $message = str_replace($searcharray, $replacearray, $message);
    $message = str_replace("p_w_upload", $db_attachname, $message);
    //此处位置不可调换
    $message = str_replace("p_w_picpath", $db_picpath, $message);
    //此处位置不可调换
    $searcharray = array("/\\[font=([^\\[\\(&\\;]+?)\\]/is", "/\\[color=([#0-9a-z]{1,15})\\]/is", "/\\[backcolor=([#0-9a-z]{1,10})\\]/is", "/\\[email=([^\\[]*)\\]([^\\[]*)\\[\\/email\\]/is", "/\\[email\\]([^\\[]*)\\[\\/email\\]/is", "/\\[size=(\\d+)\\]/eis", "/\\[align=(left|center|right|justify)\\]/is", "/\\[glow=(\\d+)\\,([0-9a-zA-Z]+?)\\,(\\d+)\\](.+?)\\[\\/glow\\]/is");
    $replacearray = array("<font face=\"\\1 \">", "<span style=\"color:\\1 \">", "<span style=\"background-color:\\1 \">", "<a href=\"mailto:\\1 \">\\2</a>", "<a href=\"mailto:\\1 \">\\1</a>", "size('\\1','{$allow['size']}')", "<div align=\"\\1\">", "<div style=\"width:\\1px;filter:glow(color=\\2,strength=\\3);\">\\4</div>");
    $message = preg_replace($searcharray, $replacearray, $message);
    if ($db_windcode) {
        $message = preg_replace($db_windcode['searcharray'], $db_windcode['replacearray'], $message);
    }
    if ($allow['pic']) {
        $message = preg_replace("/\\[img\\]([^\\<\r\n\"']+?)\\[\\/img\\]/eis", "cvpic('\\1','','{$allow['picwidth']}','{$allow['picheight']}')", $message, $db_cvtimes);
    } else {
        $message = preg_replace("/\\[img\\]([^\\<\r\n\"']+?)\\[\\/img\\]/eis", "nopic('\\1')", $message, $db_cvtimes);
    }
    if (strpos($message, '[/MUSIC]') !== false || strpos($message, '[/music]') !== false) {
        $message = preg_replace("/\\[music=(\\d+)\\](.+?)\\[\\/music\\]/eis", "SetMusic('\\1')", $message, $db_cvtimes);
    }
    if (strpos($message, '[/URL]') !== false || strpos($message, '[/url]') !== false) {
        $searcharray = array("/\\[url=(https?|ftp|gopher|news|telnet|mms|rtsp|thunder|ed2k|fs2you|flashget|qqdl)([^\\[\\s]+?)(\\,(1)\\/?)?\\](.+?)\\[\\/url\\]/eis", "/\\[url\\]www\\.([^\\[]+?)\\[\\/url\\]/eis", "/\\[url\\](https?|ftp|gopher|news|telnet|mms|rtsp|thunder|ed2k|fs2you|flashget|qqdl)([^\\[]+?)\\[\\/url\\]/eis", "/\\[url=([^\\[\\s]+?)(\\,(1)\\/?)?\\](.+?)\\[\\/url\\]/eis");
        $replacearray = array("cvurl('\\1','\\2','\\5','\\4','{$allow['checkurl']}')", "cvurl('\\1','','','','{$allow['checkurl']}')", "cvurl('\\1','\\2','','','{$allow['checkurl']}')", "cvurl('','\\1','\\4','\\3','{$allow['checkurl']}')");
        $message = preg_replace($searcharray, $replacearray, $message);
    }
    $searcharray = array("/\\[fly\\]([^\\[]*)\\[\\/fly\\]/is", "/\\[move\\]([^\\[]*)\\[\\/move\\]/is");
    $replacearray = array("<marquee width=90% behavior=alternate scrollamount=3>\\1</marquee>", "<marquee scrollamount=3>\\1</marquee>");
    $message = preg_replace($searcharray, $replacearray, $message);
    if ($type == 'post') {
        $tpc_tag && ($message = relatetag($message, $tpc_tag));
        if ($foruminfo['allowhide'] && strpos($message, "[post]") !== false && strpos($message, "[/post]") !== false) {
            $message = preg_replace("/\\[post\\](.+?)\\[\\/post\\]/eis", "post('\\1')", $message);
        }
        if ($forumset['allowencode'] && strpos($message, "[hide=") !== false && strpos($message, "[/hide]") !== false) {
            $message = preg_replace("/\\[hide=(.+?)\\](.+?)\\[\\/hide\\]/eis", "hidden('\\1','\\2')", $message);
        }
        if ($foruminfo['allowsell'] && strpos($message, "[sell") !== false && strpos($message, "[/sell]") !== false) {
            $message = preg_replace("/\\[sell=(.+?)\\](.+?)\\[\\/sell\\]/eis", "sell('\\1','\\2')", $message);
        }
    }
    if (strpos($message, "[quote]") !== false && strpos($message, "[/quote]") !== false) {
        $message = preg_replace("/\\[quote\\](.*?)\\[\\/quote\\]/eis", "qoute('\\1')", $message);
    }
    if (is_array($code_htm)) {
        krsort($code_htm);
        foreach ($code_htm as $codehtm) {
            foreach ($codehtm as $key => $value) {
                $message = str_replace("<\twind_code_{$key}\t>", $value, $message);
            }
        }
    }
    /* 去除quote中链接 */
    $quoteCode = "<blockquote class=\"blockquote3\"><div class=\"text\" style=\"padding:15px;\">";
    $quotePos = strpos($message, $quoteCode);
    /*fix 20110916*/
    if ($quotePos !== false) {
        $endQuotePos = strpos($message, "</div></blockquote>", $quotePos);
        $startQuotePos = $quotePos + strlen($quoteCode) - 1;
        $quoteContent = substr($message, $startQuotePos, $endQuotePos - $startQuotePos);
        $quoteContent = preg_replace('/(<br\\s*\\/?>\\s*){2,}/', '<br>', $quoteContent);
        $quoteContent = preg_replace_callback('/<a\\s+href=(\'|")([^\'"]+)(\'|")[^>]*>([^<]+)<\\/a>/is', 'stripQuoteLinks', $quoteContent);
        $message = substr_replace($message, $quoteContent, $startQuotePos, $endQuotePos - $startQuotePos);
    }
    if ($allow['flash'] && strpos($message, '[flash=') !== false || $allow['mpeg'] && (strpos($message, '[mp3=') !== false || strpos($message, '[rm=') !== false || strpos($message, '[wmv=') !== false)) {
        $message = "<script id=\"js_player\" src=\"js/player.js?1109\"></script>" . $message;
    }
    if ($allow['flash']) {
        $message = setVideo($message);
    } else {
        $message = preg_replace("/\\[flash=(\\d+?)\\,(\\d+?)(\\,(0|1))?\\]([^\\[\\<\r\n\"']+?)\\[\\/flash\\]/is", "<img src='{$imgpath}/wind/file/music.gif' align='absbottom'> <a target='_blank' href='\\5 '>flash: \\5</a>", $message, $db_cvtimes);
    }
    if ($type == 'post') {
        $t = 0;
        while (strpos($message, '[table') !== false && strpos($message, '[/table]') !== false) {
            $message = preg_replace('/\\[table(?:=(\\d{1,3}(?:%|px)?)(?:,(#\\w{6})?)?(?:,(#\\w{6})?)?(?:,(\\d+))?)?\\](.*?)\\[\\/table\\]/eis', "tablefun('\\5','\\1','\\2','\\3','\\4')", $message);
            if (++$t > 4) {
                break;
            }
        }
        if ($allow['mpeg']) {
            $message = setAudio($message);
        } else {
            $message = preg_replace(array("/\\[mp3=[01]{1}\\]([^\\<\r\n\"']+?)\\[\\/mp3\\]/is", "/\\[wmv=[01]{1}\\]([^\\<\r\n\"']+?)\\[\\/wmv\\]/is", "/\\[wmv(?:=[0-9]{1,3}\\,[0-9]{1,3}\\,[01]{1})?\\]([^\\<\r\n\"']+?)\\[\\/wmv\\]/is", "/\\[rm(?:=[0-9]{1,3}\\,[0-9]{1,3}\\,[01]{1})\\]([^\\<\r\n\"']+?)\\[\\/rm\\]/is"), "<img src=\"{$imgpath}/wind/file/music.gif\" align=\"absbottom\"> <a target=\"_blank\" href=\"\\1 \">\\1</a>", $message, $db_cvtimes);
        }
        //修复iframe安全问题 by taishici
        if ($allow['iframe']) {
            //iframe开启的情况
            //$message = preg_replace("/\[iframe\]([^\[\<\r\n\"']+?)\[\/iframe\]/is","<IFRAME SRC=\\1 FRAMEBORDER=0 ALLOWTRANSPARENCY=true SCROLLING=YES WIDTH=97% HEIGHT=340></IFRAME>",$message,$db_cvtimes);
            $message = preg_replace("/\\[iframe(=(\\d+?)\\,(\\d+?))?\\]([^\\[\\<\r\n\"']+?)\\[\\/iframe\\]/eis", "setIframe('\\4', '\\2', '\\3')", $message, $db_cvtimes);
        } else {
            //iframe没开启的情况
            //$message = preg_replace("/\[iframe\]([^\[\<\r\n\"']+?)\[\/iframe\]/is","Iframe Close: <a target=_blank href='\\1 '>\\1</a>",$message,$db_cvtimes);
            $message = preg_replace("/\\[iframe\\]([^\\[\\<\r\n\"']+?)\\[\\/iframe\\]/eis", "setIframeNo('\\1')", $message, $db_cvtimes);
        }
        strpos($message, '[s:') !== false && ($message = showface($message));
    }
    if (is_array($phpcode_htm)) {
        foreach ($phpcode_htm as $key => $value) {
            $message = str_replace("<\twind_phpcode_{$key}\t>", $value, $message);
        }
    }
    return $message;
}