Exemplo n.º 1
0
function RepNewstextImgLink($newstext, $add)
{
    global $public_r;
    $expage = '[!--empirenews.page--]';
    //分页符
    if (!stristr($newstext, $expage) || !stristr($newstext, '<img ')) {
        return '';
    }
    $newstext = stripSlashes($newstext);
    $repurl = '[!--empirecms.rep.nextpageurl--]';
    $newstext = DoRepImgLink($newstext, $repurl);
    $nr = explode($expage, $newstext);
    $count = count($nr);
    //页面地址
    $urlqzr = ReturnInfoPageQz($add);
    $lastpageurl = $public_r['newsurl'] . 'e/public/ClassUrl/?classid=' . $add['classid'];
    //最后一页链接地址
    $new_newstext = '';
    $addexpage = '';
    for ($i = 0; $i < $count; $i++) {
        $thispagetext = $nr[$i];
        if (stristr($thispagetext, '<img ')) {
            if ($i == $count - 1) {
                $newurl = $lastpageurl;
            } else {
                //下一页链接
                if ($urlqzr['nametype'] == 1) {
                    $newurl = eReturnRewritePageLink($urlqzr, $i + 1);
                } else {
                    $newurl = $urlqzr['titleurl'] . '_' . ($i + 2) . $urlqzr['filetype'];
                }
            }
            $thispagetext = str_replace($repurl, $newurl, $thispagetext);
        }
        $new_newstext .= $addexpage . $thispagetext;
        $addexpage = $expage;
    }
    return addslashes($new_newstext);
}
Exemplo n.º 2
0
function DtGetHtml($add, $newstemp_r, $mid, $tbname, $line, $page_line, $start, $page, $search)
{
    global $public_r, $class_r, $class_zr, $class_tr, $fun_r, $empire, $dbtbpre, $emod_r, $level_r;
    //更新点击
    $empire->query("update {$dbtbpre}ecms_" . $tbname . " set onclick=onclick+1 where id='{$add['id']}' limit 1");
    $add['onclick'] = $add['onclick'] + 1;
    //模板参数
    $newstemptext = $newstemp_r[temptext];
    $formatdate = $newstemp_r[showdate];
    //页面
    $pagetitle = ehtmlspecialchars($add[title]);
    $url = ReturnClassLink($add[classid]);
    //导航
    $newstemptext = DtInfo_ReplaceSvars($newstemptext, $url, $add[classid], $pagetitle, $add[keyboard], $pagetitle);
    //相关信息
    if (strstr($newstemptext, '[!--other.link--]')) {
        $keyboardtext = GetKeyboard($add[keyboard], $add[keyid], $add[classid], $add[id], $class_r[$add[classid]][link_num]);
    }
    //分页字段
    $ptitle = $add['title'];
    $truepage = '';
    $titleselect = '';
    $expage = '[!--empirenews.page--]';
    //分页符
    $pf = $emod_r[$mid]['pagef'];
    if ($pf && strstr($add[$pf], $expage)) {
        $n_r = explode($expage, $add[$pf]);
        $thispagenum = count($n_r);
        if ($page < 0 || $page > $thispagenum - 1) {
            $page = 0;
        }
        $add[$pf] = $n_r[$page];
        if ($page) {
            $ti_r = explode('[/!--empirenews.page--]', $n_r[$page]);
            if (count($ti_r) >= 2) {
                $ptitle = $ti_r[0];
                $add[$pf] = $ti_r[1];
            } else {
                $ptitle = $add['title'] . '(' . ($page + 1) . ')';
            }
        }
        //伪静态
        $pagefunr = eReturnRewriteInfoUrl($add['classid'], $add['id'], 0);
        $pagefunr['repagenum'] = 0;
        //取得分页
        $truepage = InfoUsePage($thispagenum, $line, $page_line, $start, $page, $search, $pagefunr);
        //下拉式分页
        if (strstr($newstemptext, '[!--title.select--]')) {
            for ($j = 0; $j < $thispagenum; $j++) {
                $spurl = eReturnRewritePageLink($pagefunr, $j);
                if ($j == 0) {
                    $sptitle = $add[title];
                } else {
                    $ti_r = explode('[/!--empirenews.page--]', $n_r[$j]);
                    $sptitle = count($ti_r) >= 2 ? $ti_r[0] : $add[title] . '(' . ($j + 1) . ')';
                }
                $select = '';
                if ($page == $j) {
                    $ptitle = $sptitle;
                    $select = ' selected';
                }
                $titleselect .= '<option value="' . $spurl . '"' . $select . '>' . $sptitle . '</option>';
            }
            $titleselect = '<select name="titleselect" onchange="self.location.href=this.options[this.selectedIndex].value">' . $titleselect . '</select>';
        }
        //下一页链接
        if ($page == $thispagenum - 1) {
            $thisnextlink = eReturnRewritePageLink($pagefunr, 0);
        } else {
            $thisnextlink = eReturnRewritePageLink($pagefunr, $page + 1);
        }
    }
    //返回替换验证字符
    $docheckrep = ReturnCheckDoRepStr();
    if ($add[newstext]) {
        if (empty($public_r['dorepword']) && $docheckrep[3]) {
            $add[newstext] = ReplaceWord($add[newstext]);
            //过滤字符
        }
        if (empty($public_r['dorepkey']) && $docheckrep[4] && !empty($add[dokey])) {
            $add[newstext] = ReplaceKey($add['newstext'], $add['classid']);
        }
        if ($public_r['opencopytext']) {
            $add[newstext] = AddNotCopyRndStr($add[newstext]);
            //随机复制字符
        }
    }
    //变量
    $tempf = $emod_r[$mid]['tempf'];
    $fr = explode(',', $tempf);
    $fcount = count($fr) - 1;
    //变量替换
    $newstempstr = $newstemptext;
    //模板
    for ($i = 1; $i < $fcount; $i++) {
        $f = $fr[$i];
        $value = $add[$f];
        if ($f == 'downpath') {
            if (strstr($newstemptext, '[!--downpath--]')) {
                $value = ReturnDownSoftHtml($add);
            }
        } elseif ($f == 'onlinepath') {
            if (strstr($newstemptext, '[!--onlinepath--]')) {
                $value = ReturnOnlinepathHtml($add);
            }
        } elseif ($f == 'morepic') {
            if (strstr($newstemptext, '[!--morepic--]')) {
                $value = ReturnMorepicpathHtml($add);
            }
        } elseif ($f == 'newstime') {
            if (strstr($newstemptext, '[!--newstime--]')) {
                $value = date($formatdate, $value);
            }
        } elseif ($f == 'befrom') {
            if ($docheckrep[1] && strstr($newstemptext, '[!--befrom--]')) {
                $value = ReplaceBefrom($value);
            }
        } elseif ($f == 'writer') {
            if ($docheckrep[2] && strstr($newstemptext, '[!--writer--]')) {
                $value = ReplaceWriter($value);
            }
        } elseif ($f == 'titlepic') {
            if (empty($value)) {
                $value = $public_r[newsurl] . 'e/data/images/notimg.gif';
            }
        } elseif ($f == 'title') {
        } else {
            if (!strstr($emod_r[$mid]['editorf'], ',' . $f . ',')) {
                if (strstr($emod_r[$mid]['tobrf'], ',' . $f . ',')) {
                    $value = nl2br($value);
                }
                if (!strstr($emod_r[$mid]['dohtmlf'], ',' . $f . ',')) {
                    $value = RepFieldtextNbsp(ehtmlspecialchars($value));
                }
            }
        }
        $newstempstr = str_replace('[!--' . $f . '--]', $value, $newstempstr);
    }
    //固定变量
    $newstempstr = str_replace('[!--id--]', $add[id], $newstempstr);
    $newstempstr = str_replace('[!--classid--]', $add[classid], $newstempstr);
    $newstempstr = str_replace('[!--class.name--]', $class_r[$add[classid]][classname], $newstempstr);
    $newstempstr = str_replace('[!--ttid--]', $add[ttid], $newstempstr);
    $newstempstr = str_replace('[!--tt.name--]', $class_tr[$add[ttid]][tname], $newstempstr);
    $newstempstr = str_replace('[!--tt.url--]', sys_ReturnBqInfoTypeUrl($add['ttid']), $newstempstr);
    $newstempstr = str_replace('[!--onclick--]', $add[onclick], $newstempstr);
    $newstempstr = str_replace('[!--userfen--]', $add[userfen], $newstempstr);
    $newstempstr = str_replace('[!--username--]', $add[username], $newstempstr);
    //带链接的用户名
    if ($add[ismember] == 1 && $add[userid]) {
        $newstempstr = str_replace('[!--linkusername--]', "<a href='" . $public_r[newsurl] . "e/space/?userid=" . $add[userid] . "' target=_blank>" . $add[username] . "</a>", $newstempstr);
    } else {
        $newstempstr = str_replace('[!--linkusername--]', $add[username], $newstempstr);
    }
    $newstempstr = str_replace('[!--userid--]', $add[userid], $newstempstr);
    $newstempstr = str_replace('[!--other.link--]', $keyboardtext, $newstempstr);
    $newstempstr = str_replace('[!--news.url--]', $public_r[newsurl], $newstempstr);
    $newstempstr = str_replace('[!--plnum--]', $add[plnum], $newstempstr);
    $newstempstr = str_replace('[!--totaldown--]', $add[totaldown], $newstempstr);
    $newstempstr = str_replace('[!--keyboard--]', $add[keyboard], $newstempstr);
    //链接
    $titleurl = sys_ReturnBqTitleLink($add);
    $newstempstr = str_replace('[!--titleurl--]', $titleurl, $newstempstr);
    $newstempstr = str_replace('[!--page.stats--]', '', $newstempstr);
    $classurl = sys_ReturnBqClassname($add, 9);
    $newstempstr = str_replace('[!--class.url--]', $classurl, $newstempstr);
    //下一篇
    if (strstr($newstemptext, '[!--info.next--]')) {
        $next_r = $empire->fetch1("select isurl,titleurl,classid,id,title from {$dbtbpre}ecms_" . $class_r[$add[classid]][tbname] . " where id>{$add['id']} and classid='{$add['classid']}' order by id limit 1");
        if (empty($next_r[id])) {
            $infonext = "<a href='" . $classurl . "'>" . $fun_r['HaveNoNextLink'] . "</a>";
        } else {
            //链接
            $nexttitleurl = sys_ReturnBqTitleLink($next_r);
            $infonext = "<a href='" . $nexttitleurl . "'>" . $next_r[title] . "</a>";
        }
        $newstempstr = str_replace('[!--info.next--]', $infonext, $newstempstr);
    }
    //上一篇
    if (strstr($newstemptext, '[!--info.pre--]')) {
        $next_r = $empire->fetch1("select isurl,titleurl,classid,id,title from {$dbtbpre}ecms_" . $class_r[$add[classid]][tbname] . " where id<{$add['id']} and classid='{$add['classid']}' order by id desc limit 1");
        if (empty($next_r[id])) {
            $infonext = "<a href='" . $classurl . "'>" . $fun_r['HaveNoNextLink'] . "</a>";
        } else {
            //链接
            $nexttitleurl = sys_ReturnBqTitleLink($next_r);
            $infonext = "<a href='" . $nexttitleurl . "'>" . $next_r[title] . "</a>";
        }
        $newstempstr = str_replace('[!--info.pre--]', $infonext, $newstempstr);
    }
    //投票
    if (strstr($newstemptext, '[!--info.vote--]')) {
        $myvotetext = sys_GetInfoVote($add[classid], $add[id]);
        $newstempstr = str_replace('[!--info.vote--]', $myvotetext, $newstempstr);
    }
    //评分
    if (strstr($newstemptext, '[!--pinfopfen--]')) {
        $pinfopfen = $add[infopfennum] ? round($add[infopfen] / $add[infopfennum]) : 0;
        $newstempstr = str_replace('[!--pinfopfen--]', $pinfopfen, $newstempstr);
        $newstempstr = str_replace('[!--infopfennum--]', $add[infopfennum], $newstempstr);
    }
    $string = $newstempstr;
    //替换变量
    $string = str_replace('[!--p.title--]', strip_tags($ptitle), $string);
    $string = str_replace('[!--next.page--]', $thisnextlink, $string);
    $string = str_replace('[!--page.url--]', $truepage, $string);
    $string = str_replace('[!--title.select--]', $titleselect, $string);
    return $string;
}
Exemplo n.º 3
0
function InfoUsePage($num, $line, $page_line, $start, $page, $search, $add)
{
    global $fun_r;
    if ($num <= $line) {
        return '';
    }
    $snum = 2;
    //最小页数
    $totalpage = ceil($num / $line);
    //取得总页数
    $firststr = '<a title="' . $fun_r['trecord'] . '">&nbsp;<b>' . $num . '</b> </a>&nbsp;&nbsp;';
    //上一页
    if ($page != 0) {
        $toppage = '<a href="' . eReturnRewritePageLink($add, 0) . '">' . $fun_r['startpage'] . '</a>&nbsp;';
        $pagepr = $page - 1;
        $prepage = '<a href="' . eReturnRewritePageLink($add, $pagepr) . '">' . $fun_r['pripage'] . '</a>';
    }
    //下一页
    if ($page != $totalpage - 1) {
        $pagenex = $page + 1;
        $nextpage = '&nbsp;<a href="' . eReturnRewritePageLink($add, $pagenex) . '">' . $fun_r['nextpage'] . '</a>';
        $lastpage = '&nbsp;<a href="' . eReturnRewritePageLink($add, $totalpage - 1) . '">' . $fun_r['lastpage'] . '</a>';
    }
    $starti = $page - $snum < 0 ? 0 : $page - $snum;
    $no = 0;
    for ($i = $starti; $i < $totalpage && $no < $page_line; $i++) {
        $no++;
        if ($page == $i) {
            $is_1 = "<b>";
            $is_2 = "</b>";
        } else {
            $is_1 = '<a href="' . eReturnRewritePageLink($add, $i) . '">';
            $is_2 = "</a>";
        }
        $pagenum = $i + 1;
        $returnstr .= "&nbsp;" . $is_1 . $pagenum . $is_2;
    }
    $returnstr = $firststr . $toppage . $prepage . $returnstr . $nextpage . $lastpage;
    return $returnstr;
}