예제 #1
0
/**
 * 调用最新评论
 *
 * @param int row 12
 * int infolen 10
 * @param int titlelen 100
 * @return unknown
 */
function lib_feedback(&$ctag, &$refObj)
{
    global $dsql;
    $attlist = "row|12,titlelen|24,infolen|100";
    FillAttsDefault($ctag->CAttribute->Items, $attlist);
    extract($ctag->CAttribute->Items, EXTR_SKIP);
    $innertext = trim($ctag->GetInnerText());
    $totalrow = $row;
    $revalue = '';
    if (empty($innertext)) {
        $innertext = GetSysTemplets('tag_feedback.htm');
    }
    $wsql = " where ischeck=1 ";
    $equery = "SELECT * FROM `#@__feedback` {$wsql} ORDER BY id DESC LIMIT 0 , {$totalrow}";
    $ctp = new DedeTagParse();
    $ctp->SetNameSpace('field', '[', ']');
    $ctp->LoadSource($innertext);
    $dsql->Execute('fb', $equery);
    while ($arr = $dsql->GetArray('fb')) {
        $arr['title'] = cn_substr($arr['arctitle'], $titlelen);
        $arr['msg'] = jstrim($arr['msg'], $infolen);
        foreach ($ctp->CTags as $tagid => $ctag) {
            if (!empty($arr[$ctag->GetName()])) {
                $ctp->Assign($tagid, $arr[$ctag->GetName()]);
            }
        }
        $revalue .= $ctp->GetResult();
    }
    return $revalue;
}
예제 #2
0
function lib_mynews(&$ctag, &$refObj)
{
    global $dsql, $envs;
    //属性处理
    $attlist = "row|1,titlelen|24";
    FillAttsDefault($ctag->CAttribute->Items, $attlist);
    extract($ctag->CAttribute->Items, EXTR_SKIP);
    $innertext = trim($ctag->GetInnerText());
    if (empty($row)) {
        $row = 1;
    }
    if (empty($titlelen)) {
        $titlelen = 30;
    }
    if (empty($innertext)) {
        $innertext = GetSysTemplets('mynews.htm');
    }
    $idsql = '';
    if ($envs['typeid'] > 0) {
        $idsql = " where typeid='" . GetTopid($this->TypeID) . "' ";
    }
    $dsql->SetQuery("Select * from #@__mynews {$idsql} order by senddate desc limit 0,{$row}");
    $dsql->Execute();
    $ctp = new DedeTagParse();
    $ctp->SetNameSpace('field', '[', ']');
    $ctp->LoadSource($innertext);
    $revalue = '';
    while ($row = $dsql->GetArray()) {
        foreach ($ctp->CTags as $tagid => $ctag) {
            @$ctp->Assign($tagid, $row[$ctag->GetName()]);
        }
        $revalue .= $ctp->GetResult();
    }
    return $revalue;
}
예제 #3
0
function lib_memberlist(&$ctag, &$refObj)
{
    global $dsql, $sqlCt;
    $attlist = "row|6,iscommend|0,orderby|logintime,signlen|50";
    FillAttsDefault($ctag->CAttribute->Items, $attlist);
    extract($ctag->CAttribute->Items, EXTR_SKIP);
    $revalue = '';
    $innerText = trim($ctag->GetInnerText());
    if (empty($innerText)) {
        $innerText = GetSysTemplets('memberlist.htm');
    }
    $wheresql = ' WHERE mb.spacesta>-1 AND mb.matt<10 ';
    if ($iscommend > 0) {
        $wheresql .= " AND  mb.matt='{$iscommend}' ";
    }
    $sql = "SELECT mb.*,ms.spacename,ms.sign FROM `#@__member` mb\r\n        LEFT JOIN `#@__member_space` ms ON ms.mid = mb.mid\r\n        {$wheresql} order by mb.{$orderby} DESC LIMIT 0,{$row} ";
    $ctp = new DedeTagParse();
    $ctp->SetNameSpace('field', '[', ']');
    $ctp->LoadSource($innerText);
    $dsql->Execute('mb', $sql);
    while ($row = $dsql->GetArray('mb')) {
        $row['spaceurl'] = $GLOBALS['cfg_basehost'] . '/member/index.php?uid=' . $row['userid'];
        if (empty($row['face'])) {
            $row['face'] = $row['sex'] == '女' ? $GLOBALS['cfg_memberurl'] . '/templets/images/dfgirl.png' : $GLOBALS['cfg_memberurl'] . '/templets/images/dfboy.png';
        }
        foreach ($ctp->CTags as $tagid => $ctag) {
            if (isset($row[$ctag->GetName()])) {
                $ctp->Assign($tagid, $row[$ctag->GetName()]);
            }
        }
        $revalue .= $ctp->GetResult();
    }
    return $revalue;
}
예제 #4
0
function lib_likesgpage(&$ctag, &$refObj)
{
    global $dsql;
    //把属性转为变量,如果不想进行此步骤,也可以直接从 $ctag->CAttribute->Items 获得,这样也可以支持中文名
    $attlist = "row|8";
    FillAttsDefault($ctag->CAttribute->Items, $attlist);
    extract($ctag->CAttribute->Items, EXTR_SKIP);
    $innertext = trim($ctag->GetInnerText());
    $aid = isset($refObj->Fields['aid']) ? $refObj->Fields['aid'] : 0;
    $revalue = '';
    if ($innertext == '') {
        $innertext = GetSysTemplets("part_likesgpage.htm");
    }
    $likeid = empty($refObj->Fields['likeid']) ? 'all' : $refObj->Fields['likeid'];
    $dsql->SetQuery("SELECT aid,title,filename FROM `#@__sgpage` WHERE likeid LIKE '{$likeid}' LIMIT 0,{$row}");
    $dsql->Execute();
    $ctp = new DedeTagParse();
    $ctp->SetNameSpace('field', '[', ']');
    $ctp->LoadSource($innertext);
    while ($row = $dsql->GetArray()) {
        if ($aid != $row['aid']) {
            $row['url'] = $GLOBALS['cfg_cmsurl'] . '/' . $row['filename'];
            foreach ($ctp->CTags as $tagid => $ctag) {
                if (!empty($row[$ctag->GetName()])) {
                    $ctp->Assign($tagid, $row[$ctag->GetName()]);
                }
            }
            $revalue .= $ctp->GetResult();
        } else {
            $revalue .= '<dd class="cur"><span>' . $row['title'] . '</span></dd>';
        }
    }
    return $revalue;
}
예제 #5
0
function lib_infoguide(&$ctag, &$refObj)
{
    global $dsql, $nativeplace, $infotype, $hasSetEnumJs, $cfg_cmspath, $cfg_mainsite;
    //属性处理
    //$attlist="row|12,titlelen|24";
    //FillAttsDefault($ctag->CAttribute->Items,$attlist);
    //extract($ctag->CAttribute->Items, EXTR_SKIP);
    $cmspath = empty($cfg_cmspath) || preg_match('#[/$]#', $cfg_cmspath) ? $cfg_cmspath . '/' : $cfg_cmspath;
    if (empty($refObj->Fields['typeid'])) {
        $row = $dsql->GetOne("SELECT id FROM `#@__arctype` WHERE channeltype='-8' And reid = '0' ");
        $typeid = is_array($row) ? $row['id'] : 0;
        if (empty($typeid)) {
            return '请指定一个栏目类型为“分类信息”,否则无法使用这个搜索表单!';
        }
    } else {
        $typeid = $refObj->Fields['typeid'];
    }
    $innerText = trim($ctag->GetInnerText());
    if (empty($innerText)) {
        $innerText = GetSysTemplets("info_guide.htm");
    }
    $ctp = new DedeTagParse();
    $ctp->SetNameSpace('field', '[', ']');
    $ctp->LoadSource($innerText);
    $revalue = $seli = '';
    $fields = array('nativeplace' => '', 'infotype' => '', 'typeid' => $typeid);
    if ($hasSetEnumJs != 'has') {
        $revalue .= '<script language="javascript" type="text/javascript" src="' . $cfg_mainsite . $cmspath . 'images/enums.js"></script>' . "\r\n";
        $GLOBALS['hasSetEnumJs'] = 'hasset';
    }
    $fields['nativeplace'] = $fields['infotype'] = '';
    if (empty($nativeplace)) {
        $nativeplace = 0;
    }
    if (empty($infotype)) {
        $infotype = 0;
    }
    $fields['nativeplace'] .= "<input type='hidden' id='hidden_nativeplace' name='nativeplace' value='{$nativeplace}' />\r\n";
    $fields['nativeplace'] .= "<span class='infosearchtxt'>地区:</span><span id='span_nativeplace'></span>\r\n";
    $fields['nativeplace'] .= "<span id='span_nativeplace_son'></span>\r\n<span id='span_nativeplace_sec'></span><br />\r\n";
    $fields['nativeplace'] .= "<script language='javascript' type='text/javascript' src='{$cfg_mainsite}{$cmspath}data/enums/nativeplace.js'></script>\r\n";
    $fields['nativeplace'] .= '<script language="javascript">MakeTopSelect("nativeplace", ' . $nativeplace . ');</script>' . "\r\n";
    $fields['infotype'] .= "<input type='hidden' id='hidden_infotype' name='infotype' value='{$infotype}' />\r\n";
    $fields['infotype'] .= "<span class='infosearchtxt'>类型:</span><span id='span_infotype'></span>\r\n";
    $fields['infotype'] .= "<span id='span_infotype_son'></span><span id='span_infotype_sec'></span><br />\r\n";
    $fields['infotype'] .= "<script language='javascript' type='text/javascript' src='{$cfg_mainsite}{$cmspath}data/enums/infotype.js'></script>\r\n";
    $fields['infotype'] .= '<script language="javascript">MakeTopSelect("infotype", ' . $infotype . ');</script>' . "\r\n";
    if (is_array($ctp->CTags)) {
        foreach ($ctp->CTags as $tagid => $ctag) {
            if (isset($fields[$ctag->GetName()])) {
                $ctp->Assign($tagid, $fields[$ctag->GetName()]);
            }
        }
        $revalue .= $ctp->GetResult();
    }
    return $revalue;
}
예제 #6
0
/**
 * 问答调用标签
 *
 * @version        $Id: ask.lib.php 1 9:29 2010年7月6日Z tianya $
 * @package        DedeCMS.Taglib
 * @copyright      Copyright (c) 2007 - 2010, DesDev, Inc.
 * @license        http://help.dedecms.com/usersguide/license.html
 * @link           http://www.dedecms.com
 */
function lib_asktype(&$ctag, &$refObj)
{
    global $dsql, $envs, $cfg_dbprefix, $cfg_cmsurl, $cfg_ask_directory, $cfg_ask_isdomain, $cfg_ask_domain;
    //属性处理
    $attlist = "tid|0,reid|0,name|24";
    FillAttsDefault($ctag->CAttribute->Items, $attlist);
    extract($ctag->CAttribute->Items, EXTR_SKIP);
    if (!$dsql->IsTable("{$cfg_dbprefix}ask")) {
        return '没安装问答模块';
    }
    //启用二级域名
    if ($cfg_ask_isdomain == 'Y') {
        $weburl = $cfg_ask_domain . '/';
    } else {
        $weburl = $cfg_ask_directory . '/';
    }
    $innertext = $ctag->GetInnerText();
    if (trim($innertext) == '') {
        $innertext = GetSysTemplets("asks.htm");
    }
    if ($tid > 0) {
        $qtypeQuery = "WHERE reid={$tid} ";
    } else {
        $qtypeQuery = '';
    }
    if ($reid > 0) {
        $qtypeQuery = "WHERE reid > 0 ";
    }
    $ctp = new DedeTagParse();
    $ctp->SetNameSpace('field', '[', ']');
    $solvingask = '';
    $query = "SELECT id,name,reid FROM `#@__asktype` {$qtypeQuery}";
    $dsql->Execute('me', $query);
    while ($rs = $dsql->GetArray('me')) {
        $ctp->LoadSource($innertext);
        if ($rs['reid'] != '') {
            $rs['typeurl'] = $weburl . "?ct=browser&tid2=" . $rs['id'];
        } else {
            $rs['typeurl'] = $weburl . "?ct=browser&tid=" . $rs['id'];
        }
        foreach ($ctp->CTags as $tagid => $ctag) {
            if (!empty($rs[strtolower($ctag->GetName())])) {
                $ctp->Assign($tagid, $rs[$ctag->GetName()]);
            }
        }
        $solvingask .= $ctp->GetResult();
    }
    return $solvingask;
}
예제 #7
0
function lib_autochannel(&$ctag, &$refObj)
{
    global $dsql;
    $attlist = 'partsort|0,typeid=-1';
    FillAttsDefault($ctag->CAttribute->Items, $attlist);
    extract($ctag->CAttribute->Items, EXTR_SKIP);
    $innertext = trim($ctag->GetInnerText());
    $topid = $typeid;
    $sortid = $partsort;
    if ($topid == '-1' || $topid == '') {
        $topid = isset($refObj->TypeLink->TypeInfos['id']) ? $refObj->TypeLink->TypeInfos['id'] : 0;
    }
    if (empty($sortid)) {
        $sortid = 1;
    }
    $getstart = $sortid - 1;
    $row = $dsql->GetOne("SELECT id,typename FROM `#@__arctype` WHERE reid='{$topid}' AND \n                          ispart<2 AND ishidden<>'1' ORDER BY sortrank asc limit {$getstart},1");
    if (!is_array($row)) {
        return '';
    } else {
        $typeid = $row['id'];
    }
    if (trim($innertext) == '') {
        $innertext = GetSysTemplets('part_autochannel.htm');
    }
    $row = $dsql->GetOne("SELECT id,typedir,isdefault,defaultname,ispart,namerule2,typename,moresite,siteurl,sitepath \n                          FROM `#@__arctype` WHERE id='{$typeid}' ");
    if (!is_array($row)) {
        return '';
    }
    $dtp = new DedeTagParse();
    $dtp->SetNameSpace('field', '[', ']');
    $dtp->LoadSource($innertext);
    if (!is_array($dtp->CTags)) {
        unset($dtp);
        return '';
    } else {
        $row['typelink'] = GetTypeUrl($row['id'], MfTypedir($row['typedir']), $row['isdefault'], $row['defaultname'], $row['ispart'], $row['namerule2'], $row['siteurl'], $row['sitepath']);
        foreach ($dtp->CTags as $tagid => $ctag) {
            if (isset($row[$ctag->GetName()])) {
                $dtp->Assign($tagid, $row[$ctag->GetName()]);
            }
        }
        $revalue = $dtp->GetResult();
        unset($dtp);
        return $revalue;
    }
}
예제 #8
0
function lib_groupthread(&$ctag, &$refObj)
{
    global $dsql, $envs, $cfg_dbprefix, $cfg_cmsurl;
    //属性处理
    $attlist = "gid|0,orderby|dateline,orderway|desc,row|12,titlelen|30";
    FillAttsDefault($ctag->CAttribute->Items, $attlist);
    extract($ctag->CAttribute->Items, EXTR_SKIP);
    if (!$dsql->IsTable("{$cfg_dbprefix}groups")) {
        return '没安装圈子模块';
    }
    if (!preg_match("#\\/\$#", $cfg_cmsurl)) {
        $cfg_group_url = $cfg_cmsurl . "/group";
    } else {
        $cfg_group_url = $cfg_cmsurl . "group";
    }
    $innertext = $ctag->GetInnerText();
    if (trim($innertext) == '') {
        $innertext = GetSysTemplets('groupthreads.htm');
    }
    $WhereSql = " WHERE t.closed=0 ";
    $orderby = 't.' . $orderby;
    if ($gid > 0) {
        $WhereSql .= " AND t.gid='{$gid}' ";
    }
    $query = "SELECT t.subject,t.gid,t.tid,t.lastpost,g.groupname FROM `#@__group_threads` t \r\n             LEFT JOIN `#@__groups` g ON g.groupid=t.gid\r\n             {$WhereSql} ORDER BY {$orderby} {$orderway} LIMIT 0,{$row}";
    $dsql->SetQuery($query);
    $dsql->Execute();
    $ctp = new DedeTagParse();
    $ctp->SetNameSpace('field', '[', ']');
    if (!isset($list)) {
        $list = '';
    }
    while ($rs = $dsql->GetArray()) {
        $ctp->LoadSource($innertext);
        $rs['subject'] = cn_substr($rs['subject'], $titlelen);
        $rs['url'] = $cfg_group_url . "/viewthread.php?id={$rs['gid']}&tid={$rs['tid']}";
        $rs['groupurl'] = $cfg_group_url . "/group.php?id={$rs['gid']}";
        foreach ($ctp->CTags as $tagid => $ctag) {
            if (!empty($rs[strtolower($ctag->GetName())])) {
                $ctp->Assign($tagid, $rs[$ctag->GetName()]);
            }
        }
        $list .= $ctp->GetResult();
    }
    return $list;
}
예제 #9
0
/**
 * 专题主题调用标签
 *
 * @version        $Id: arclist.lib.php 2 8:29 2010年7月8日Z tianya $
 * @package        DedeCMS.Taglib
 * @copyright      Copyright (c) 2007 - 2010, DesDev, Inc.
 * @license        http://help.dedecms.com/usersguide/license.html
 * @link           http://www.dedecms.com
 */
function ch_specialtopic($noteinfo, $arcTag, $refObj, $fname = '')
{
    require_once DEDEINC . '/taglib/arclist.lib.php';
    if ($noteinfo == '') {
        return '';
    }
    $noteid = $arcTag->GetAtt('noteid');
    $rvalue = '';
    $tempStr = GetSysTemplets('channel_spec_note.htm');
    $dtp = new DedeTagParse();
    $dtp->LoadSource($noteinfo);
    if (is_array($dtp->CTags)) {
        foreach ($dtp->CTags as $k => $ctag) {
            $notename = $ctag->GetAtt('name');
            //指定名称的专题节点
            if ($noteid != '' && $ctag->GetAtt('noteid') != $noteid) {
                continue;
            }
            $isauto = $ctag->GetAtt('isauto');
            $idlist = trim($ctag->GetAtt('idlist'));
            $rownum = trim($ctag->GetAtt('rownum'));
            $keywords = '';
            $stypeid = 0;
            if (empty($rownum)) {
                $rownum = 40;
            }
            //通过关键字和栏目ID自动获取模式
            if ($isauto == 1) {
                $idlist = '';
                $keywords = trim($ctag->GetAtt('keywords'));
                $stypeid = $ctag->GetAtt('typeid');
            }
            $listTemplet = trim($ctag->GetInnerText()) != '' ? $ctag->GetInnerText() : GetSysTemplets('spec_arclist.htm');
            $idvalue = lib_arclistDone($refObj, $ctag, $stypeid, $rownum, $ctag->GetAtt('col'), $ctag->GetAtt('titlelen'), $ctag->GetAtt('infolen'), $ctag->GetAtt('imgwidth'), $ctag->GetAtt('imgheight'), 'all', 'default', $keywords, $listTemplet, 0, $idlist, $ctag->GetAtt('channel'), '', $ctag->GetAtt('att'));
            $notestr = str_replace('~notename~', $notename, $tempStr);
            $notestr = str_replace('~spec_arclist~', $idvalue, $notestr);
            $rvalue .= $notestr;
            if ($noteid != '' && $ctag->GetAtt('noteid') == $noteid) {
                break;
            }
        }
    }
    $dtp->Clear();
    return $rvalue;
}
예제 #10
0
/**
 * 
 *
 * @version        $Id: productimagelist.lib.php 1 9:29 2010Äê7ÔÂ6ÈÕZ tianya $
 * @package        DedeCMS.Taglib
 * @copyright      Copyright (c) 2007 - 2010, DesDev, Inc.
 * @license        http://help.dedecms.com/usersguide/license.html
 * @link           http://www.dedecms.com
 */
function lib_productimagelist(&$ctag, &$refObj)
{
    global $dsql, $sqlCt;
    $attlist = "desclen|80";
    FillAttsDefault($ctag->CAttribute->Items, $attlist);
    extract($ctag->CAttribute->Items, EXTR_SKIP);
    if (!isset($refObj->addTableRow['imgurls'])) {
        return;
    }
    $revalue = '';
    $innerText = trim($ctag->GetInnerText());
    if (empty($innerText)) {
        $innerText = GetSysTemplets('productimagelist.htm');
    }
    $dtp = new DedeTagParse();
    $dtp->LoadSource($refObj->addTableRow['imgurls']);
    $images = array();
    if (is_array($dtp->CTags)) {
        foreach ($dtp->CTags as $ctag) {
            if ($ctag->GetName() == "img") {
                $row = array();
                $row['imgsrc'] = trim($ctag->GetInnerText());
                $row['text'] = $ctag->GetAtt('text');
                $images[] = $row;
            }
        }
    }
    $dtp->Clear();
    $revalue = '';
    $ctp = new DedeTagParse();
    $ctp->SetNameSpace('field', '[', ']');
    $ctp->LoadSource($innerText);
    foreach ($images as $row) {
        foreach ($ctp->CTags as $tagid => $ctag) {
            if (isset($row[$ctag->GetName()])) {
                $ctp->Assign($tagid, $row[$ctag->GetName()]);
            }
        }
        $revalue .= $ctp->GetResult();
    }
    return $revalue;
}
예제 #11
0
function lib_memberinfos(&$ctag, &$refObj)
{
    global $dsql, $sqlCt;
    $attlist = "mid|0";
    FillAttsDefault($ctag->CAttribute->Items, $attlist);
    extract($ctag->CAttribute->Items, EXTR_SKIP);
    if (empty($mid)) {
        if (!empty($refObj->Fields['mid'])) {
            $mid = $refObj->Fields['mid'];
        } else {
            $mid = 1;
        }
    } else {
        $mid = intval($mid);
    }
    $revalue = '';
    $innerText = trim($ctag->GetInnerText());
    if (empty($innerText)) {
        $innerText = GetSysTemplets('memberinfos.htm');
    }
    $sql = "SELECT mb.*,ms.spacename,ms.sign,ar.membername as rankname FROM `#@__member` mb\r\n        LEFT JOIN `#@__member_space` ms ON ms.mid = mb.mid \r\n        LEFT JOIN `#@__arcrank` ar ON ar.rank = mb.rank\r\n        WHERE mb.mid='{$mid}' LIMIT 0,1 ";
    $ctp = new DedeTagParse();
    $ctp->SetNameSpace('field', '[', ']');
    $ctp->LoadSource($innerText);
    $dsql->Execute('mb', $sql);
    while ($row = $dsql->GetArray('mb')) {
        if ($row['matt'] == 10) {
            return '';
        }
        $row['spaceurl'] = $GLOBALS['cfg_basehost'] . '/member/index.php?uid=' . $row['userid'];
        if (empty($row['face'])) {
            $row['face'] = $row['sex'] == '女' ? $GLOBALS['cfg_memberurl'] . '/templets/images/dfgirl.png' : $GLOBALS['cfg_memberurl'] . '/templets/images/dfboy.png';
        }
        foreach ($ctp->CTags as $tagid => $ctag) {
            if (isset($row[$ctag->GetName()])) {
                $ctp->Assign($tagid, $row[$ctag->GetName()]);
            }
        }
        $revalue .= $ctp->GetResult();
    }
    return $revalue;
}
예제 #12
0
파일: type.lib.php 프로젝트: iabing/mzzyc
function lib_type(&$ctag, &$refObj)
{
    global $dsql, $envs;
    $attlist = 'typeid|0';
    FillAttsDefault($ctag->CAttribute->Items, $attlist);
    extract($ctag->CAttribute->Items, EXTR_SKIP);
    $innertext = trim($ctag->GetInnerText());
    if ($typeid == 0) {
        $typeid = isset($refObj->TypeLink->TypeInfos['id']) ? $refObj->TypeLink->TypeInfos['id'] : $envs['typeid'];
    }
    if (empty($typeid)) {
        return '';
    }
    $row = $dsql->GetOne("SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath \r\n                          FROM `#@__arctype` WHERE id='{$typeid}' ");
    if (!is_array($row)) {
        return '';
    }
    if (trim($innertext) == '') {
        $innertext = GetSysTemplets("part_type_list.htm");
    }
    $dtp = new DedeTagParse();
    $dtp->SetNameSpace('field', '[', ']');
    $dtp->LoadSource($innertext);
    if (!is_array($dtp->CTags)) {
        unset($dtp);
        return '';
    } else {
        $row['typelink'] = $row['typeurl'] = GetOneTypeUrlA($row);
        foreach ($dtp->CTags as $tagid => $ctag) {
            if (isset($row[$ctag->GetName()])) {
                $dtp->Assign($tagid, $row[$ctag->GetName()]);
            }
        }
        $revalue = $dtp->GetResult();
        unset($dtp);
        return $revalue;
    }
}
예제 #13
0
파일: group.lib.php 프로젝트: iabing/mzzyc
function lib_group(&$ctag, &$refObj)
{
    global $dsql, $envs, $cfg_dbprefix, $cfg_cmsurl;
    //属性处理
    $attlist = "row|6,orderby|threads,titlelen|30";
    FillAttsDefault($ctag->CAttribute->Items, $attlist);
    extract($ctag->CAttribute->Items, EXTR_SKIP);
    if (!$dsql->IsTable("{$cfg_dbprefix}groups")) {
        return '没安装圈子模块';
    }
    if (!preg("#\\/\$#", $cfg_cmsurl)) {
        $cfg_group_url = $cfg_cmsurl . '/group';
    } else {
        $cfg_group_url = $cfg_cmsurl . 'group';
    }
    $innertext = $ctag->GetInnerText();
    if (trim($innertext) == '') {
        $innertext = GetSysTemplets("groups.htm");
    }
    $list = '';
    $dsql->SetQuery("SELECT groupimg,groupid,groupname FROM `#@__groups` WHERE ishidden=0 ORDER BY {$orderby} DESC LIMIT 0,{$row}");
    $dsql->Execute();
    $ctp = new DedeTagParse();
    $ctp->SetNameSpace('field', '[', ']');
    while ($rs = $dsql->GetArray()) {
        $ctp->LoadSource($innertext);
        $rs['groupname'] = cn_substr($rs['groupname'], $titlelen);
        $rs['url'] = $cfg_group_url . "/group.php?id={$rs['groupid']}";
        $rs['icon'] = $rs['groupimg'];
        foreach ($ctp->CTags as $tagid => $ctag) {
            if (!empty($rs[strtolower($ctag->GetName())])) {
                $ctp->Assign($tagid, $rs[$ctag->GetName()]);
            }
        }
        $list .= $ctp->GetResult();
    }
    return $list;
}
예제 #14
0
 /**
  *  获取内容列表
  *
  * @access    public
  * @param     int  $limitstart  限制开始  
  * @param     int  $row  行数 
  * @param     int  $col  列数
  * @param     int  $titlelen  标题长度
  * @param     int  $infolen  描述长度
  * @param     int  $imgwidth  图片宽度
  * @param     int  $imgheight  图片高度
  * @param     string  $listtype  列表类型
  * @param     string  $orderby  排列顺序
  * @param     string  $innertext  底层模板
  * @param     string  $tablewidth  表格宽度
  * @return    string
  */
 function GetArcList($limitstart = 0, $row = 10, $col = 1, $titlelen = 30, $infolen = 250, $imgwidth = 120, $imgheight = 90, $listtype = "all", $orderby = "default", $innertext = "", $tablewidth = "100")
 {
     $typeid = $this->TypeID;
     if ($row == "") {
         $row = 10;
     }
     if ($limitstart == "") {
         $limitstart = 0;
     }
     if ($titlelen == "") {
         $titlelen = 30;
     }
     if ($infolen == "") {
         $infolen = 250;
     }
     if ($imgwidth == "") {
         $imgwidth = 120;
     }
     if ($imgheight == "") {
         $imgheight = 120;
     }
     if ($listtype == "") {
         $listtype = "all";
     }
     if ($orderby == "") {
         $orderby = "default";
     } else {
         $orderby = strtolower($orderby);
     }
     $tablewidth = str_replace("%", "", $tablewidth);
     if ($tablewidth == "") {
         $tablewidth = 100;
     }
     if ($col == "") {
         $col = 1;
     }
     $colWidth = ceil(100 / $col);
     $tablewidth = $tablewidth . "%";
     $colWidth = $colWidth . "%";
     $innertext = trim($innertext);
     if ($innertext == "") {
         $innertext = GetSysTemplets("spec_list.htm");
     }
     //按不同情况设定SQL条件
     $orwhere = " arc.arcrank > -1 AND arc.channel = -1 ";
     if ($this->StartTime > 0) {
         $orwhere .= " AND arc.senddate>'" . $this->StartTime . "'";
     }
     //排序方式
     $ordersql = '';
     if ($orderby == 'senddate') {
         $ordersql = " ORDER BY arc.senddate desc";
     } else {
         if ($orderby == 'pubdate') {
             $ordersql = " ORDER BY arc.pubdate desc";
         } else {
             if ($orderby == 'id') {
                 $ordersql = "  ORDER BY arc.id desc";
             } else {
                 $ordersql = " ORDER BY arc.sortrank desc";
             }
         }
     }
     $query = "SELECT arc.*,tp.typedir,tp.typename,tp.isdefault,arc.money,\r\n            tp.defaultname,tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepath\r\n            FROM `#@__archives` arc LEFT JOIN `#@__arctype` tp ON arc.typeid=tp.id\r\n            WHERE {$orwhere} {$ordersql} LIMIT {$limitstart},{$row} ";
     $this->dsql->SetQuery($query);
     $this->dsql->Execute('al');
     $artlist = '';
     if ($col > 1) {
         $artlist = "<table width='{$tablewidth}' border='0' cellspacing='0' cellpadding='0'>\r\n";
     }
     $this->dtp2->LoadSource($innertext);
     for ($i = 0; $i < $row; $i++) {
         if ($col > 1) {
             $artlist .= "<tr>\r\n";
         }
         for ($j = 0; $j < $col; $j++) {
             if ($col > 1) {
                 $artlist .= "<td width='{$colWidth}'>\r\n";
             }
             if ($row = $this->dsql->GetArray("al")) {
                 //处理一些特殊字段
                 $row["description"] = cn_substr($row["description"], $infolen);
                 $row["title"] = cn_substr($row["title"], $titlelen);
                 $row["id"] = $row["id"];
                 if ($row['litpic'] == '-' || $row['litpic'] == '') {
                     $row['litpic'] = $GLOBALS['cfg_cmspath'] . '/images/defaultpic.gif';
                 }
                 if (!preg_match("/^http:\\/\\//", $row['litpic']) && $GLOBALS['cfg_multi_site'] == 'Y') {
                     $row['litpic'] = $GLOBALS['cfg_mainsite'] . $row['litpic'];
                 }
                 $row['picname'] = $row['litpic'];
                 $row["arcurl"] = GetFileUrl($row["id"], $row["typeid"], $row["senddate"], $row["title"], $row["ismake"], $row["arcrank"], $row["namerule"], $row["typedir"], $row["money"], $row['filename'], $row["moresite"], $row["siteurl"], $row["sitepath"]);
                 $row["typeurl"] = GetTypeUrl($row["typeid"], $row["typedir"], $row["isdefault"], $row["defaultname"], $row["ispart"], $row["namerule2"], $row["moresite"], $row["siteurl"], $row["sitepath"]);
                 $row["info"] = $row["description"];
                 $row["filename"] = $row["arcurl"];
                 $row["stime"] = GetDateMK($row["pubdate"]);
                 $row["textlink"] = "<a href='" . $row["filename"] . "'>" . $row["title"] . "</a>";
                 $row["typelink"] = "[<a href='" . $row["typeurl"] . "'>" . $row["typename"] . "</a>]";
                 $row["imglink"] = "<a href='" . $row["filename"] . "'><img src='" . $row["picname"] . "' border='0' width='{$imgwidth}' height='{$imgheight}'></a>";
                 $row["image"] = "<img src='" . $row["picname"] . "' border='0' width='{$imgwidth}' height='{$imgheight}'>";
                 $row['plusurl'] = $row['phpurl'] = $GLOBALS['cfg_phpurl'];
                 $row['memberurl'] = $GLOBALS['cfg_memberurl'];
                 $row['templeturl'] = $GLOBALS['cfg_templeturl'];
                 //编译附加表里的数据
                 foreach ($this->ChannelUnit->ChannelFields as $k => $arr) {
                     if (isset($row[$k])) {
                         $row[$k] = $this->ChannelUnit->MakeField($k, $row[$k]);
                     }
                 }
                 if (is_array($this->dtp2->CTags)) {
                     foreach ($this->dtp2->CTags as $k => $ctag) {
                         if ($ctag->GetName() == 'array') {
                             //传递整个数组,在runphp模式中有特殊作用
                             $this->dtp2->Assign($k, $row);
                         } else {
                             if (isset($row[$ctag->GetName()])) {
                                 $this->dtp2->Assign($k, $row[$ctag->GetName()]);
                             } else {
                                 $this->dtp2->Assign($k, '');
                             }
                         }
                     }
                 }
                 $artlist .= $this->dtp2->GetResult();
             } else {
                 $artlist .= "";
             }
             if ($col > 1) {
                 $artlist .= "</td>\r\n";
             }
         }
         //Loop Col
         if ($col > 1) {
             $artlist .= "</tr>\r\n";
         }
     }
     //Loop Line
     if ($col > 1) {
         $artlist .= "</table>\r\n";
     }
     $this->dsql->FreeResult("al");
     return $artlist;
 }
	function GetAddLinks($fvalue,$aid,$cid)
	{
		global $cfg_softinfos;
		if(!is_array($cfg_softinfos)){
			$cfg_softinfos = $this->dsql->GetOne("Select ismoresite,sites,gotojump,showlocal From #@__softconfig");
	  }
		$phppath = $GLOBALS['cfg_phpurl'];
		$downlinks = "";
		$dtp = new DedeTagParse();
    $dtp->LoadSource($fvalue);
    if(!is_array($dtp->CTags)){
    	$dtp->Clear();
    	return "无链接信息!";
    }
    $tempStr = GetSysTemplets("channel/channel_downlinks.htm");
    foreach($dtp->CTags as $ctag)
    {
    	if($ctag->GetName()=="link")
    	{
    	  $links = trim($ctag->GetInnerText());
    	  $serverName = trim($ctag->GetAtt("text"));
    	  if(!isset($firstLink)){ $firstLink = $links; }
    	  if($cfg_softinfos['showlocal']==0 || $cfg_softinfos['ismoresite']!=1)
    	  {
    	     if($cfg_softinfos['gotojump']==1) $links = $phppath."/download.php?open=1&aid=$aid&cid=$cid&link=".urlencode(base64_encode($links));
    	     $temp = str_replace("~link~",$links,$tempStr);
    	     $temp = str_replace("~server~",$serverName,$temp);
    	     $downlinks .= $temp;
    	  }
      }
    }
    $dtp->Clear();
    //启用镜像功能的情况
    if($cfg_softinfos['ismoresite']==1 && !empty($cfg_softinfos['sites']) && isset($firstLink))
    {
    	if(!empty($GLOBALS['cfg_basehost'])) $firstLink = eregi_replace($GLOBALS['cfg_basehost'],"",$firstLink);
    	
    	$cfg_softinfos['sites'] = ereg_replace("\n{1,}","\n",str_replace("\r","\n",$cfg_softinfos['sites']));
    	$sites = explode("\n",trim($cfg_softinfos['sites']));
    	foreach($sites as $site)
    	{
    		if(trim($site)=='') continue;
    		list($link,$serverName) = explode('|',$site);
    		
    		if(!eregi("^(http|ftp)://",$firstLink)) $flink = trim($link).$firstLink;
    		else $flink = $firstLink;
    		
    		if($cfg_softinfos['gotojump']==1) $flink = $phppath."/download.php?open=1&aid=$aid&cid=$cid&link=".urlencode(base64_encode($flink));
    	  $temp = str_replace("~link~",$flink,$tempStr);
    	  $temp = str_replace("~server~",$serverName,$temp);
    	  $downlinks .= $temp;
    	}
    }
    return $downlinks;global $cfg_softinfos;
		if(!is_array($cfg_softinfos)){
			$cfg_softinfos = $this->dsql->GetOne("Select ismoresite,sites,gotojump,showlocal From #@__softconfig");
	  }
		$phppath = $GLOBALS['cfg_phpurl'];
		$downlinks = "";
		$dtp = new DedeTagParse();
    $dtp->LoadSource($fvalue);
    if(!is_array($dtp->CTags)){
    	$dtp->Clear();
    	return "无链接信息!";
    }
    $tempStr = GetSysTemplets("channel/channel_downlinks.htm");
    foreach($dtp->CTags as $ctag)
    {
    	if($ctag->GetName()=="link")
    	{
    	  $links = trim($ctag->GetInnerText());
    	  $serverName = trim($ctag->GetAtt("text"));
    	  if(!isset($firstLink)){ $firstLink = $links; }
    	  if($cfg_softinfos['showlocal']==0 || $cfg_softinfos['ismoresite']!=1)
    	  {
    	     if($cfg_softinfos['gotojump']==1) $links = $phppath."/download.php?open=1&aid=$aid&cid=$cid&link=".urlencode(base64_encode($links));
    	     $temp = str_replace("~link~",$links,$tempStr);
    	     $temp = str_replace("~server~",$serverName,$temp);
    	     $downlinks .= $temp;
    	  }
      }
    }
    $dtp->Clear();
    //启用镜像功能的情况
    if($cfg_softinfos['ismoresite']==1 && !empty($cfg_softinfos['sites']) && isset($firstLink))
    {
    	if(!empty($GLOBALS['cfg_basehost'])) $firstLink = eregi_replace($GLOBALS['cfg_basehost'],"",$firstLink);
    	
    	$cfg_softinfos['sites'] = ereg_replace("\n{1,}","\n",str_replace("\r","\n",$cfg_softinfos['sites']));
    	$sites = explode("\n",trim($cfg_softinfos['sites']));
    	foreach($sites as $site)
    	{
    		if(trim($site)=='') continue;
    		list($link,$serverName) = explode('|',$site);
    		
    		if(!eregi("^(http|ftp)://",$firstLink)) $flink = trim($link).$firstLink;
    		else $flink = $firstLink;
    		
    		if($cfg_softinfos['gotojump']==1) $flink = $phppath."/download.php?open=1&aid=$aid&cid=$cid&link=".urlencode(base64_encode($flink));
    	  $temp = str_replace("~link~",$flink,$tempStr);
    	  $temp = str_replace("~server~",$serverName,$temp);
    	  $downlinks .= $temp;
    	}
    }
    return $downlinks;
	}
예제 #16
0
 /**
  *  获得一个单列的文档列表
  *
  * @access    public
  * @param     int  $limitstart  限制开始  
  * @param     int  $row  行数 
  * @param     int  $col  列数
  * @param     int  $titlelen  标题长度
  * @param     int  $infolen  描述长度
  * @param     int  $imgwidth  图片宽度
  * @param     int  $imgheight  图片高度
  * @param     string  $listtype  列表类型
  * @param     string  $orderby  排列顺序
  * @param     string  $innertext  底层模板
  * @param     string  $tablewidth  表格宽度
  * @param     string  $ismake  是否编译
  * @param     string  $orderWay  排序方式
  * @return    string
  */
 function GetArcList($limitstart = 0, $row = 10, $col = 1, $titlelen = 30, $infolen = 250, $imgwidth = 120, $imgheight = 90, $listtype = "all", $orderby = "default", $innertext = "", $tablewidth = "100", $ismake = 1, $orderWay = 'desc')
 {
     $getrow = $row == '' ? 10 : $row;
     if ($limitstart == '') {
         $limitstart = 0;
     }
     if ($titlelen == '') {
         $titlelen = 100;
     }
     if ($infolen == '') {
         $infolen = 250;
     }
     if ($imgwidth == '') {
         $imgwidth = 120;
     }
     if ($imgheight == '') {
         $imgheight = 120;
     }
     if ($listtype == '') {
         $listtype = 'all';
     }
     $orderby = $orderby == '' ? 'default' : strtolower($orderby);
     if ($orderWay == '') {
         $orderWay = 'desc';
     }
     $tablewidth = str_replace("%", "", $tablewidth);
     if ($tablewidth == '') {
         $tablewidth = 100;
     }
     if ($col == '') {
         $col = 1;
     }
     $colWidth = ceil(100 / $col);
     $tablewidth = $tablewidth . "%";
     $colWidth = $colWidth . "%";
     $innertext = trim($innertext);
     if ($innertext == '') {
         $innertext = GetSysTemplets("list_fulllist.htm");
     }
     $idlists = $ordersql = '';
     $this->dsql->SetQuery("SELECT aid FROM `#@__taglist` WHERE tid = '{$this->TagInfos['id']}' AND arcrank>-1 LIMIT {$limitstart},{$getrow}");
     $this->dsql->Execute();
     while ($row = $this->dsql->GetArray()) {
         $idlists .= $idlists == '' ? $row['aid'] : ',' . $row['aid'];
     }
     if ($idlists == '') {
         return '';
     }
     //按不同情况设定SQL条件
     $orwhere = " se.id IN({$idlists}) ";
     //排序方式
     if ($orderby == "sortrank") {
         $ordersql = "  ORDER BY se.sortrank {$orderWay}";
     } else {
         $ordersql = " ORDER BY se.id {$orderWay}";
     }
     $query = "SELECT se.*,tp.typedir,tp.typename,tp.isdefault,tp.defaultname,tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepath\n            FROM `#@__archives` se LEFT JOIN `#@__arctype` tp ON se.typeid=tp.id WHERE {$orwhere} {$ordersql} ";
     $this->dsql->SetQuery($query);
     $this->dsql->Execute('al');
     $row = $this->PageSize / $col;
     $artlist = '';
     $this->dtp2->LoadSource($innertext);
     $GLOBALS['autoindex'] = 0;
     for ($i = 0; $i < $row; $i++) {
         if ($col > 1) {
             $artlist .= "<div>\r\n";
         }
         for ($j = 0; $j < $col; $j++) {
             if ($row = $this->dsql->GetArray("al")) {
                 $GLOBALS['autoindex']++;
                 $ids[$row['id']] = $row['id'];
                 //处理一些特殊字段
                 $row['infos'] = cn_substr($row['description'], $infolen);
                 $row['id'] = $row['id'];
                 $row['arcurl'] = GetFileUrl($row['id'], $row['typeid'], $row['senddate'], $row['title'], $row['ismake'], $row['arcrank'], $row['namerule'], $row['typedir'], $row['money'], $row['filename'], $row['moresite'], $row['siteurl'], $row['sitepath']);
                 $row['typeurl'] = GetTypeUrl($row['typeid'], MfTypedir($row['typedir']), $row['isdefault'], $row['defaultname'], $row['ispart'], $row['namerule2'], $row['moresite'], $row['siteurl'], $row['sitepath']);
                 if ($row['litpic'] == '-' || $row['litpic'] == '') {
                     $row['litpic'] = $GLOBALS['cfg_cmspath'] . '/images/defaultpic.gif';
                 }
                 if (!preg_match("/^http:\\/\\//", $row['litpic']) && $GLOBALS['cfg_multi_site'] == 'Y') {
                     $row['litpic'] = $GLOBALS['cfg_mainsite'] . $row['litpic'];
                 }
                 $row['picname'] = $row['litpic'];
                 $row['stime'] = GetDateMK($row['pubdate']);
                 $row['typelink'] = "<a href='" . $row['typeurl'] . "'>" . $row['typename'] . "</a>";
                 $row['image'] = "<img src='" . $row['picname'] . "' border='0' width='{$imgwidth}' height='{$imgheight}' alt='" . preg_replace("/['><]/", "", $row['title']) . "'>";
                 $row['imglink'] = "<a href='" . $row['filename'] . "'>" . $row['image'] . "</a>";
                 $row['fulltitle'] = $row['title'];
                 $row['title'] = cn_substr($row['title'], $titlelen);
                 if ($row['color'] != '') {
                     $row['title'] = "<font color='" . $row['color'] . "'>" . $row['title'] . "</font>";
                 }
                 if (preg_match('/c/', $row['flag'])) {
                     $row['title'] = "<b>" . $row['title'] . "</b>";
                 }
                 $row['textlink'] = "<a href='" . $row['filename'] . "'>" . $row['title'] . "</a>";
                 $row['plusurl'] = $row['phpurl'] = $GLOBALS['cfg_phpurl'];
                 $row['memberurl'] = $GLOBALS['cfg_memberurl'];
                 $row['templeturl'] = $GLOBALS['cfg_templeturl'];
                 if (is_array($this->dtp2->CTags)) {
                     foreach ($this->dtp2->CTags as $k => $ctag) {
                         if ($ctag->GetName() == 'array') {
                             //传递整个数组,在runphp模式中有特殊作用
                             $this->dtp2->Assign($k, $row);
                         } else {
                             if (isset($row[$ctag->GetName()])) {
                                 $this->dtp2->Assign($k, $row[$ctag->GetName()]);
                             } else {
                                 $this->dtp2->Assign($k, '');
                             }
                         }
                     }
                 }
                 $artlist .= $this->dtp2->GetResult();
             }
             //if hasRow
         }
         //Loop Col
         if ($col > 1) {
             $i += $col - 1;
             $artlist .= "    </div>\r\n";
         }
     }
     //Loop Line
     $this->dsql->FreeResult('al');
     return $artlist;
 }
예제 #17
0
function lib_infolink(&$ctag, &$refObj)
{
    global $dsql, $nativeplace, $infotype, $hasSetEnumJs, $cfg_cmspath, $cfg_mainsite;
    global $em_nativeplaces, $em_infotypes;
    //属性处理
    //$attlist="row|12,titlelen|24";
    //FillAttsDefault($ctag->CAttribute->Items,$attlist);
    //extract($ctag->CAttribute->Items, EXTR_SKIP);
    $cmspath = empty($cfg_cmspath) || !preg_match("#\\/\$#", $cfg_cmspath) ? $cfg_cmspath . '/' : $cfg_cmspath;
    $baseurl = preg_replace("#\\/\$#", '', $cfg_mainsite) . $cmspath;
    $smalltypes = '';
    if (!empty($refObj->TypeLink->TypeInfos['smalltypes'])) {
        $smalltypes = explode(',', $refObj->TypeLink->TypeInfos['smalltypes']);
    }
    if (empty($refObj->Fields['typeid'])) {
        $row = $dsql->GetOne("SELECT id FROM `#@__arctype` WHERE channeltype='-8' And reid = '0' ");
        $typeid = is_array($row) ? $row['id'] : 0;
    } else {
        $typeid = $refObj->Fields['typeid'];
    }
    $innerText = trim($ctag->GetInnerText());
    if (empty($innerText)) {
        $innerText = GetSysTemplets("info_link.htm");
    }
    $ctp = new DedeTagParse();
    $ctp->SetNameSpace('field', '[', ']');
    $ctp->LoadSource($innerText);
    $revalue = $seli = '';
    $channelid = empty($refObj->TypeLink->TypeInfos['channeltype']) ? -8 : $refObj->TypeLink->TypeInfos['channeltype'];
    $fields = array('nativeplace' => '', 'infotype' => '', 'typeid' => $typeid, 'channelid' => $channelid, 'linkallplace' => '', 'linkalltype' => '');
    $fields['nativeplace'] = $fields['infotype'] = '';
    $fields['linkallplace'] = "<a href='{$baseurl}plus/list.php?channelid={$channelid}&tid={$typeid}&infotype={$infotype}'>不限</a>";
    $fields['linkalltype'] = "<a href='{$baseurl}plus/list.php?channelid={$channelid}&tid={$typeid}&nativeplace={$nativeplace}'>不限</a>";
    //地区链接
    if (empty($nativeplace)) {
        foreach ($em_nativeplaces as $eid => $em) {
            if ($eid % 500 != 0) {
                continue;
            }
            $fields['nativeplace'] .= " <a href='{$baseurl}plus/list.php?channelid={$channelid}&tid={$typeid}&nativeplace={$eid}&infotype={$infotype}'>{$em}</a>\r\n";
        }
    } else {
        $sontype = $nativeplace % 500 != 0 ? $nativeplace : 0;
        $toptype = $nativeplace % 500 == 0 ? $nativeplace : $nativeplace - $nativeplace % 500;
        //2011-6-21 修改地区列表的一个小空格 论坛http://bbs.dedecms.com/371492.html(by:织梦的鱼)
        $fields['nativeplace'] = "<a href='{$baseurl}plus/list.php?channelid={$channelid}&tid={$typeid}&nativeplace={$toptype}&infotype={$infotype}'> <b>{$em_nativeplaces[$toptype]}</b></a> &gt;&gt; ";
        foreach ($em_nativeplaces as $eid => $em) {
            if ($eid < $toptype + 1 || $eid > $toptype + 499) {
                continue;
            }
            if ($eid == $nativeplace) {
                $fields['nativeplace'] .= " <b>{$em}</b>\r\n";
            } else {
                $fields['nativeplace'] .= " <a href='{$baseurl}plus/list.php?channelid={$channelid}&tid={$typeid}&nativeplace={$eid}&infotype={$infotype}'>{$em}</a>\r\n";
            }
        }
    }
    //小分类链接
    if (empty($infotype) || is_array($smalltypes)) {
        foreach ($em_infotypes as $eid => $em) {
            if (!is_array($smalltypes) && $eid % 500 != 0) {
                continue;
            }
            if (is_array($smalltypes) && !in_array($eid, $smalltypes)) {
                continue;
            }
            if ($eid == $infotype) {
                $fields['infotype'] .= " <b>{$em}</b>\r\n";
            } else {
                $fields['infotype'] .= " <a href='{$baseurl}plus/list.php?channelid={$channelid}&tid={$typeid}&infotype={$eid}&nativeplace={$nativeplace}'>{$em}</a>\r\n";
            }
        }
    } else {
        $sontype = $infotype % 500 != 0 ? $infotype : 0;
        $toptype = $infotype % 500 == 0 ? $infotype : $infotype - $infotype % 500;
        $fields['infotype'] .= "<a href='{$baseurl}plus/list.php?channelid={$channelid}&tid={$typeid}&infotype={$toptype}&nativeplace={$nativeplace}'><b>{$em_infotypes[$toptype]}</b></a> &gt;&gt; ";
        foreach ($em_infotypes as $eid => $em) {
            if ($eid < $toptype + 1 || $eid > $toptype + 499) {
                continue;
            }
            if ($eid == $infotype) {
                $fields['infotype'] .= " <b>{$em}</b>\r\n";
            } else {
                $fields['infotype'] .= " <a href='{$baseurl}plus/list.php?channelid={$channelid}&tid={$typeid}&infotype={$eid}&nativeplace={$nativeplace}'>{$em}</a>\r\n";
            }
        }
    }
    if (is_array($ctp->CTags)) {
        foreach ($ctp->CTags as $tagid => $ctag) {
            if (isset($fields[$ctag->GetName()])) {
                $ctp->Assign($tagid, $fields[$ctag->GetName()]);
            }
        }
        $revalue .= $ctp->GetResult();
    }
    return $revalue;
}
예제 #18
0
function lib_booklist(&$ctag, &$refObj, $getcontent = 0)
{
    global $dsql, $envs, $cfg_dbprefix, $cfg_cmsurl;
    //属性处理
    $attlist = "row|12,booktype|-1,titlelen|30,orderby|lastpost,author|,keyword|";
    FillAttsDefault($ctag->CAttribute->Items, $attlist);
    extract($ctag->CAttribute->Items, EXTR_SKIP);
    if (!$dsql->IsTable("{$cfg_dbprefix}story_books")) {
        return '没安装连载模块';
    }
    $addquery = '';
    if (empty($innertext)) {
        if ($getcontent == 0) {
            $innertext = GetSysTemplets('booklist.htm');
        } else {
            $innertext = GetSysTemplets('bookcontentlist.htm');
        }
    }
    //图书类型
    if ($booktype != -1) {
        $addquery .= " And b.booktype='{$booktype}' ";
    }
    //推荐
    if ($orderby == 'commend') {
        $addquery .= " And b.iscommend=1 ";
        $orderby = 'lastpost';
    }
    //作者条件
    if (!empty($author)) {
        $addquery .= " And b.author like '{$author}' ";
    }
    //关键字条件
    if (!empty($keyword)) {
        $keywords = explode(',', $keyword);
        $keywords = array_unique($keywords);
        if (count($keywords) > 0) {
            $addquery .= " And (";
        }
        foreach ($keywords as $v) {
            $addquery .= " CONCAT(b.author,b.bookname,b.keywords) like '%{$v}%' OR";
        }
        $addquery = ereg_replace(" OR\$", "", $addquery);
        $addquery .= ")";
    }
    $clist = '';
    $query = "Select b.id,b.catid,b.ischeck,b.booktype,b.iscommend,b.click,b.bookname,b.lastpost,\r\n \t\tb.author,b.mid,b.litpic,b.pubdate,b.weekcc,b.monthcc,b.description,c.classname,c.classname as typename,c.booktype as catalogtype\r\n \t\tFrom `#@__story_books` b left join `#@__story_catalog` c on c.id=b.catid\r\n \t\twhere b.postnum>0 And b.ischeck>0 {$addquery} order by b.{$orderby} desc limit 0, {$row}";
    $dsql->SetQuery($query);
    $dsql->Execute();
    $ndtp = new DedeTagParse();
    $ndtp->SetNameSpace('field', '[', ']');
    $GLOBALS['autoindex'] = 0;
    while ($row = $dsql->GetArray()) {
        $GLOBALS['autoindex']++;
        $row['title'] = $row['bookname'];
        $ndtp->LoadString($innertext);
        //获得图书最新的一个更新章节
        $row['contenttitle'] = '';
        $row['contentid'] = '';
        if ($getcontent == 1) {
            $nrow = $dsql->GetOne("Select id,title,chapterid From `#@__story_content` where bookid='{$row['id']}' order by id desc ");
            $row['contenttitle'] = $nrow['title'];
            $row['contentid'] = $nrow['id'];
        }
        if ($row['booktype'] == 1) {
            $row['contenturl'] = $cfg_cmspath . '/book/show-photo.php?id=' . $row['contentid'];
        } else {
            $row['contenturl'] = $cfg_cmspath . '/book/story.php?id=' . $row['contentid'];
        }
        //动态网址
        $row['dmbookurl'] = $cfg_cmspath . '/book/book.php?id=' . $row['id'];
        //静态网址
        $row['bookurl'] = $row['url'] = GetBookUrl($row['id'], $row['bookname']);
        $row['catalogurl'] = $cfg_cmspath . '/book/list.php?id=' . $row['catid'];
        $row['cataloglink'] = "<a href='{$row['catalogurl']}'>{$row['classname']}</a>";
        $row['booklink'] = "<a href='{$row['bookurl']}'>{$row['bookname']}</a>";
        $row['contentlink'] = "<a href='{$row['contenturl']}'>{$row['contenttitle']}</a>";
        $row['imglink'] = "<a href='{$row['bookurl']}'><img src='{$row['litpic']}' width='{$imgwidth}' height='{$imgheight}' border='0' /></a>";
        if ($row['ischeck'] == 2) {
            $row['ischeck'] = '已完成连载';
        } else {
            $row['ischeck'] = '连载中...';
        }
        if ($row['booktype'] == 0) {
            $row['booktypename'] = '小说';
        } else {
            $row['booktypename'] = '漫画';
        }
        if (is_array($ndtp->CTags)) {
            foreach ($ndtp->CTags as $tagid => $ctag) {
                $tagname = $ctag->GetTagName();
                if (isset($row[$tagname])) {
                    $ndtp->Assign($tagid, $row[$tagname]);
                } else {
                    $ndtp->Assign($tagid, '');
                }
            }
        }
        $clist .= $ndtp->GetResult();
    }
    return $clist;
}
예제 #19
0
 /**
  *  获得一个单列的文档列表
  *
  * @access    public
  * @param     int  $limitstart  限制开始  
  * @param     int  $row  行数 
  * @param     int  $col  列数
  * @param     int  $titlelen  标题长度
  * @param     int  $infolen  描述长度
  * @param     int  $imgwidth  图片宽度
  * @param     int  $imgheight  图片高度
  * @param     string  $listtype  列表类型
  * @param     string  $orderby  排列顺序
  * @param     string  $innertext  底层模板
  * @param     string  $tablewidth  表格宽度
  * @param     string  $ismake  是否编译
  * @param     string  $orderWay  排序方式
  * @return    string
  */
 function GetArcList($limitstart = 0, $row = 10, $col = 1, $titlelen = 30, $infolen = 250, $imgwidth = 120, $imgheight = 90, $listtype = "all", $orderby = "default", $innertext = "", $tablewidth = "100", $ismake = 1, $orderWay = 'desc')
 {
     global $cfg_list_son, $cfg_digg_update;
     $typeid = $this->TypeID;
     if ($row == '') {
         $row = 10;
     }
     if ($limitstart == '') {
         $limitstart = 0;
     }
     if ($titlelen == '') {
         $titlelen = 100;
     }
     if ($infolen == '') {
         $infolen = 250;
     }
     if ($imgwidth == '') {
         $imgwidth = 120;
     }
     if ($imgheight == '') {
         $imgheight = 120;
     }
     if ($listtype == '') {
         $listtype = 'all';
     }
     if ($orderWay == '') {
         $orderWay = 'desc';
     }
     if ($orderby == '') {
         $orderby = 'default';
     } else {
         $orderby = strtolower($orderby);
     }
     $tablewidth = str_replace('%', '', $tablewidth);
     if ($tablewidth == '') {
         $tablewidth = 100;
     }
     if ($col == '') {
         $col = 1;
     }
     $colWidth = ceil(100 / $col);
     $tablewidth = $tablewidth . '%';
     $colWidth = $colWidth . '%';
     $innertext = trim($innertext);
     if ($innertext == '') {
         $innertext = GetSysTemplets('list_fulllist.htm');
     }
     //排序方式
     $ordersql = '';
     if ($orderby == "senddate" || $orderby == "id") {
         $ordersql = " ORDER BY arc.id {$orderWay}";
     } else {
         if ($orderby == "hot" || $orderby == "click") {
             $ordersql = " ORDER BY arc.click {$orderWay}";
         } else {
             if ($orderby == "lastpost") {
                 $ordersql = "  ORDER BY arc.lastpost {$orderWay}";
             } else {
                 $ordersql = " ORDER BY arc.sortrank {$orderWay}";
             }
         }
     }
     //获得附加表的相关信息
     $addtable = $this->ChannelUnit->ChannelInfos['addtable'];
     if ($addtable != "") {
         $addJoin = " LEFT JOIN `{$addtable}` ON arc.id = " . $addtable . '.aid ';
         $addField = '';
         $fields = explode(',', $this->ChannelUnit->ChannelInfos['listfields']);
         foreach ($fields as $k => $v) {
             $nfields[$v] = $k;
         }
         if (is_array($this->ChannelUnit->ChannelFields) && !empty($this->ChannelUnit->ChannelFields)) {
             foreach ($this->ChannelUnit->ChannelFields as $k => $arr) {
                 if (isset($nfields[$k])) {
                     if (!empty($arr['rename'])) {
                         $addField .= ',' . $addtable . '.' . $k . ' as ' . $arr['rename'];
                     } else {
                         $addField .= ',' . $addtable . '.' . $k;
                     }
                 }
             }
         }
     } else {
         $addField = '';
         $addJoin = '';
     }
     //如果不用默认的sortrank或id排序,使用联合查询(数据量大时非常缓慢)
     if (preg_match('/hot|click|lastpost/', $orderby)) {
         $query = "SELECT arc.*,tp.typedir,tp.typename,tp.isdefault,tp.defaultname,\n           tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepath\n           {$addField}\n           FROM `#@__archives` arc\n           LEFT JOIN `#@__arctype` tp ON arc.typeid=tp.id\n           {$addJoin}\n           WHERE {$this->addSql} {$ordersql} LIMIT {$limitstart},{$row}";
     } else {
         $t1 = ExecTime();
         $ids = array();
         $query = "SELECT id FROM `#@__arctiny` arc WHERE {$this->addSql} {$ordersql} LIMIT {$limitstart},{$row} ";
         $this->dsql->SetQuery($query);
         $this->dsql->Execute();
         while ($arr = $this->dsql->GetArray()) {
             $ids[] = $arr['id'];
         }
         $idstr = join(',', $ids);
         if ($idstr == '') {
             return '';
         } else {
             $query = "SELECT arc.*,tp.typedir,tp.typename,tp.corank,tp.isdefault,tp.defaultname,\n                       tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepath\n                       {$addField}\n                       FROM `#@__archives` arc LEFT JOIN `#@__arctype` tp ON arc.typeid=tp.id\n                       {$addJoin}\n                       WHERE arc.id in({$idstr}) {$ordersql} ";
         }
         $t2 = ExecTime();
         //echo $t2-$t1;
     }
     $this->dsql->SetQuery($query);
     $this->dsql->Execute('al');
     $t2 = ExecTime();
     //echo $t2-$t1;
     $artlist = '';
     $this->dtp2->LoadSource($innertext);
     $GLOBALS['autoindex'] = 0;
     for ($i = 0; $i < $row; $i++) {
         if ($col > 1) {
             $artlist .= "<div>\r\n";
         }
         for ($j = 0; $j < $col; $j++) {
             if ($row = $this->dsql->GetArray("al")) {
                 $GLOBALS['autoindex']++;
                 $ids[$row['id']] = $row['id'];
                 //处理一些特殊字段
                 $row['infos'] = cn_substr($row['description'], $infolen);
                 $row['id'] = $row['id'];
                 if ($cfg_digg_update > 0) {
                     $prefix = 'diggCache';
                     $key = 'aid-' . $row['id'];
                     $cacherow = GetCache($prefix, $key);
                     $row['goodpost'] = $cacherow['goodpost'];
                     $row['badpost'] = $cacherow['badpost'];
                     $row['scores'] = $cacherow['scores'];
                 }
                 if ($row['corank'] > 0 && $row['arcrank'] == 0) {
                     $row['arcrank'] = $row['corank'];
                 }
                 $row['filename'] = $row['arcurl'] = GetFileUrl($row['id'], $row['typeid'], $row['senddate'], $row['title'], $row['ismake'], $row['arcrank'], $row['namerule'], $row['typedir'], $row['money'], $row['filename'], $row['moresite'], $row['siteurl'], $row['sitepath']);
                 $row['typeurl'] = GetTypeUrl($row['typeid'], MfTypedir($row['typedir']), $row['isdefault'], $row['defaultname'], $row['ispart'], $row['namerule2'], $row['moresite'], $row['siteurl'], $row['sitepath']);
                 if ($row['litpic'] == '-' || $row['litpic'] == '') {
                     $row['litpic'] = $GLOBALS['cfg_cmspath'] . '/images/defaultpic.gif';
                 }
                 if (!preg_match("/^http:\\/\\//i", $row['litpic']) && $GLOBALS['cfg_multi_site'] == 'Y') {
                     $row['litpic'] = $GLOBALS['cfg_mainsite'] . $row['litpic'];
                 }
                 $row['picname'] = $row['litpic'];
                 $row['stime'] = GetDateMK($row['pubdate']);
                 $row['typelink'] = "<a href='" . $row['typeurl'] . "'>" . $row['typename'] . "</a>";
                 $row['image'] = "<img src='" . $row['picname'] . "' border='0' width='{$imgwidth}' height='{$imgheight}' alt='" . preg_replace("/['><]/", "", $row['title']) . "'>";
                 $row['imglink'] = "<a href='" . $row['filename'] . "'>" . $row['image'] . "</a>";
                 $row['fulltitle'] = $row['title'];
                 $row['title'] = cn_substr($row['title'], $titlelen);
                 if ($row['color'] != '') {
                     $row['title'] = "<font color='" . $row['color'] . "'>" . $row['title'] . "</font>";
                 }
                 if (preg_match('/c/', $row['flag'])) {
                     $row['title'] = "<b>" . $row['title'] . "</b>";
                 }
                 $row['textlink'] = "<a href='" . $row['filename'] . "'>" . $row['title'] . "</a>";
                 $row['plusurl'] = $row['phpurl'] = $GLOBALS['cfg_phpurl'];
                 $row['memberurl'] = $GLOBALS['cfg_memberurl'];
                 $row['templeturl'] = $GLOBALS['cfg_templeturl'];
                 //编译附加表里的数据
                 foreach ($row as $k => $v) {
                     $row[strtolower($k)] = $v;
                 }
                 foreach ($this->ChannelUnit->ChannelFields as $k => $arr) {
                     if (isset($row[$k])) {
                         $row[$k] = $this->ChannelUnit->MakeField($k, $row[$k]);
                     }
                 }
                 if (is_array($this->dtp2->CTags)) {
                     foreach ($this->dtp2->CTags as $k => $ctag) {
                         if ($ctag->GetName() == 'array') {
                             //传递整个数组,在runphp模式中有特殊作用
                             $this->dtp2->Assign($k, $row);
                         } else {
                             if (isset($row[$ctag->GetName()])) {
                                 $this->dtp2->Assign($k, $row[$ctag->GetName()]);
                             } else {
                                 $this->dtp2->Assign($k, '');
                             }
                         }
                     }
                 }
                 $artlist .= $this->dtp2->GetResult();
             }
             //if hasRow
         }
         //Loop Col
         if ($col > 1) {
             $i += $col - 1;
             $artlist .= "    </div>\r\n";
         }
     }
     //Loop Line
     $t3 = ExecTime();
     //echo ($t3-$t2);
     $this->dsql->FreeResult('al');
     return $artlist;
 }
예제 #20
0
  function GetArcList($innertext="")
  {
    $typeid=$this->TypeID;
		$innertext = trim($innertext);
		if($innertext=="") $innertext = GetSysTemplets("rss.htm");
		$orwhere = " #@__archives.arcrank > -1 ";
		$orwhere .= " And (".$this->TypeLink->GetSunID($this->TypeID,"#@__archives",$this->TypeFields['channeltype'])." Or #@__archives.typeid2='".$this->TypeID."') ";
		$ordersql=" order by #@__archives.senddate desc";
		//----------------------------
		$query = "Select #@__archives.ID,#@__archives.title,#@__archives.source,#@__archives.writer,#@__archives.typeid,#@__archives.ismake,#@__archives.money,
		#@__archives.description,#@__archives.pubdate,#@__archives.senddate,#@__archives.arcrank,#@__archives.click,
		#@__archives.litpic,#@__arctype.typedir,#@__arctype.typename,#@__arctype.isdefault,
		#@__arctype.defaultname,#@__arctype.namerule,#@__arctype.namerule2,#@__arctype.ispart,
		#@__arctype.siteurl 
		from #@__archives 
		left join #@__arctype on #@__archives.typeid=#@__arctype.ID
		where $orwhere $ordersql limit 0,".$this->MaxRow;
		$this->dsql->SetQuery($query);
		$this->dsql->Execute("al");
    $artlist = "";
    $dtp2 = new DedeTagParse();
 		$dtp2->SetNameSpace("field","[","]");
    $dtp2->LoadSource($innertext);
    while($row = $this->dsql->GetArray("al"))
    {
      //处理一些特殊字段
      if($row["litpic"]=="") $row["litpic"] = $GLOBALS["cfg_plus_dir"]."/img/dfpic.gif";
      $row["picname"] = $row["litpic"];
      $row["arcurl"] = $this->GetArcUrl($row["ID"],$row["typeid"],$row["senddate"],$row["title"],
                        $row["ismake"],$row["arcrank"],$row["namerule"],$row["typedir"],$row["money"]);
      $row["typeurl"] = $this->GetListUrl($row["typeid"],$row["typedir"],$row["isdefault"],$row["defaultname"],$row["ispart"],$row["namerule2"]);
      $row["info"] = $row["description"];
      $row["filename"] = $row["arcurl"];
      $row["stime"] = GetDateMK($row["pubdate"]);
      $row["image"] = "<img src='".$row["picname"]."' border='0'>";
      $row["fullurl"] = $row['siteurl'].$row["arcurl"];
      $row["phpurl"] = $GLOBALS["cfg_plus_dir"];
 		  $row["templeturl"] = $GLOBALS["cfg_templets_dir"];
 		  if($row["source"]=="") $row["source"] = $GLOBALS['cfg_webname'];
 		  if($row["writer"]=="") $row["writer"] = "秩名";
 		  
 		  foreach($row as $k=>$v){
 		  	$row[$k] = htmlspecialchars($v);
 		  }
      //---------------------------
      if(is_array($dtp2->CTags)){
       	foreach($dtp2->CTags as $k=>$ctag){
       		if(isset($row[$ctag->GetName()])) $dtp2->Assign($k,$row[$ctag->GetName()]);
       		else $dtp2->Assign($k,"");
       	}
      }
      $artlist .= $dtp2->GetResult()."\r\n";
     }
     $this->dsql->FreeResult("al");
     return $artlist;
  }
예제 #21
0
 /**
  *  获得与该类相关的类目,本函数应用于模板标记{dede:channel}{/dede:channel}中
  *  $typetype 的值为: sun 下级分类 self 同级分类 top 顶级分类
  *
  * @access    public
  * @param     int   $typeid   栏目ID
  * @param     int   $reid   所属ID
  * @param     int   $row   栏目行数
  * @param     string   $typetype   栏目类型
  * @param     string   $innertext   底层模板
  * @param     int   $col   显示列数
  * @param     int   $tablewidth   表格宽度
  * @param     int   $myinnertext   自定义底层模板
  * @return    string
  */
 function GetChannelList($typeid = 0, $reid = 0, $row = 8, $typetype = 'sun', $innertext = '', $col = 1, $tablewidth = 100, $myinnertext = '')
 {
     if ($typeid == 0) {
         $typeid = $this->TypeID;
     }
     if ($row == "") {
         $row = 8;
     }
     if ($reid == "") {
         $reid = 0;
     }
     if ($col == "") {
         $col = 1;
     }
     $tablewidth = str_replace("%", "", $tablewidth);
     if ($tablewidth == "") {
         $tablewidth = 100;
     }
     if ($col == "") {
         $col = 1;
     }
     $colWidth = ceil(100 / $col);
     $tablewidth = $tablewidth . "%";
     $colWidth = $colWidth . "%";
     if ($typetype == "") {
         $typetype = "sun";
     }
     if ($innertext == "") {
         $innertext = GetSysTemplets("channel_list.htm");
     }
     if ($reid == 0 && $typeid > 0) {
         $dbrow = $this->dsql->GetOne("SELECT reid FROM #@__arctype WHERE id='{$typeid}' ");
         if (is_array($dbrow)) {
             $reid = $dbrow['reid'];
         }
     }
     $likeType = "";
     if ($typetype == "top") {
         $sql = "SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl\r\n          FROM #@__arctype WHERE reid=0 AND ishidden<>1 ORDER BY sortrank ASC limit 0,{$row}";
     } else {
         if ($typetype == "sun" || $typetype == "son") {
             $sql = "SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl\r\n          FROM #@__arctype WHERE reid='{$typeid}' AND ishidden<>1 ORDER BY sortrank ASC limit 0,{$row}";
         } else {
             if ($typetype == "self") {
                 $sql = "SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl\r\n            FROM #@__arctype WHERE reid='{$reid}' AND ishidden<>1 ORDER BY sortrank ASC limit 0,{$row}";
             }
         }
     }
     //AND ID<>'$typeid'
     $dtp2 = new DedeTagParse();
     $dtp2->SetNameSpace("field", "[", "]");
     $dtp2->LoadSource($innertext);
     $this->dsql->SetQuery($sql);
     $this->dsql->Execute();
     $line = $row;
     $GLOBALS['autoindex'] = 0;
     if ($col > 1) {
         $likeType = "<table width='{$tablewidth}' border='0' cellspacing='0' cellpadding='0'>\r\n";
     }
     for ($i = 0; $i < $line; $i++) {
         if ($col > 1) {
             $likeType .= "<tr>\r\n";
         }
         for ($j = 0; $j < $col; $j++) {
             if ($col > 1) {
                 $likeType .= "    <td width='{$colWidth}'>\r\n";
             }
             if ($row = $this->dsql->GetArray()) {
                 //处理当前栏目的样式
                 if ($row['id'] == "{$typeid}" && $myinnertext != '') {
                     $linkOkstr = $myinnertext;
                     $row['typelink'] = $this->GetOneTypeUrl($row);
                     $linkOkstr = str_replace("~typelink~", $row['typelink'], $linkOkstr);
                     $linkOkstr = str_replace("~typename~", $row['typename'], $linkOkstr);
                     $likeType .= $linkOkstr;
                 } else {
                     //非当前栏目
                     $row['typelink'] = $this->GetOneTypeUrl($row);
                     if (is_array($dtp2->CTags)) {
                         foreach ($dtp2->CTags as $tagid => $ctag) {
                             if (isset($row[$ctag->GetName()])) {
                                 $dtp2->Assign($tagid, $row[$ctag->GetName()]);
                             }
                         }
                     }
                     $likeType .= $dtp2->GetResult();
                 }
             }
             if ($col > 1) {
                 $likeType .= "    </td>\r\n";
             }
             $GLOBALS['autoindex']++;
         }
         //Loop Col
         if ($col > 1) {
             $i += $col - 1;
         }
         if ($col > 1) {
             $likeType .= "    </tr>\r\n";
         }
     }
     //Loop for $i
     if ($col > 1) {
         $likeType .= "    </table>\r\n";
     }
     $this->dsql->FreeResult();
     return $likeType;
 }
예제 #22
0
function lib_channelartlist(&$ctag, &$refObj)
{
    global $dsql, $envs, $_sys_globals, $cfg_tui;
    //处理标记属性、innertext
    $attlist = 'typeid|0,row|20,showhide|no,cacheid|';
    FillAttsDefault($ctag->CAttribute->Items, $attlist);
    extract($ctag->CAttribute->Items, EXTR_SKIP);
    $innertext = trim($ctag->GetInnerText());
    $showhideArr = array('yes' => 0, 'no' => 1, 'both' => -1);
    $hideflag = $showhideArr[$showhide];
    $artlist = '';
    //读取固定的缓存块
    $cacheid = trim($cacheid);
    if ($cacheid != '') {
        $artlist = GetCacheBlock($cacheid);
        if ($artlist != '') {
            return $artlist;
        }
    }
    if (empty($typeid)) {
        $typeid = !empty($refObj->TypeLink->TypeInfos['id']) ? $refObj->TypeLink->TypeInfos['id'] : 0;
    }
    if ($innertext == '') {
        $innertext = GetSysTemplets('part_channelartlist.htm');
    }
    $totalnum = $row;
    if (empty($totalnum)) {
        $totalnum = 20;
    }
    //获得类别ID总数的信息
    $typeids = array();
    if ($typeid == 0) {
        $tpsql = " reid<>0 AND ispart<>2 AND ishidden<>{$hideflag} AND channeltype>0 ";
    } else {
        if ($typeid == '-1') {
            $tpsql = " reid=0 and ishidden<>{$hideflag} AND channeltype>0 ";
        } else {
            if ($typeid == '-9999999') {
                $tpsql = " id={$cfg_tui} AND ispart<>2 AND ishidden<>{$hideflag} ";
            } else {
                if (!preg_match('#,#', $typeid) && $typeid > 0) {
                    $tpsql = " reid='{$typeid}' AND ispart<>2 AND ishidden<>{$hideflag} ";
                } else {
                    if ($typeid < 0) {
                        $typeid = 0 - $typeid;
                        $tpsql = " id={$typeid} AND ispart<>2 AND ishidden<>{$hideflag} ";
                    } else {
                        $tpsql = " reid IN({$typeid}) AND ispart<>2 AND ishidden<>{$hideflag} ";
                    }
                }
            }
        }
    }
    if ($orderby == '') {
        $orderbysql = "ORDER BY id";
    } else {
        $orderbysql = "ORDER BY {$orderby}";
    }
    if ($orderway == '') {
        $orderwaysql = "desc";
    } else {
        $orderwaysql = "{$orderway}";
    }
    $dsql->SetQuery("SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath \r\n                                            FROM `#@__arctype` WHERE {$tpsql} {$orderbysql} {$orderwaysql} LIMIT {$totalnum}");
    $dsql->Execute();
    while ($row = $dsql->GetArray()) {
        $typeids[] = $row;
    }
    if (!isset($typeids[0])) {
        return '';
    }
    $GLOBALS['itemindex'] = 0;
    $GLOBALS['itemparity'] = 1;
    for ($i = 0; isset($typeids[$i]); $i++) {
        $GLOBALS['itemindex']++;
        $pv = new PartView($typeids[$i]['id']);
        $pv->Fields['typeurl'] = GetOneTypeUrlA($typeids[$i]);
        $pv->SetTemplet($innertext, 'string');
        $artlist .= $pv->GetResult();
        $GLOBALS['itemparity'] = $GLOBALS['itemparity'] == 1 ? 2 : 1;
    }
    //注销环境变量,以防止后续调用中被使用
    $GLOBALS['envs']['typeid'] = $_sys_globals['typeid'];
    $GLOBALS['envs']['reid'] = '';
    if ($cacheid != '') {
        WriteCacheBlock($cacheid, $artlist);
    }
    return $artlist;
}
예제 #23
0
 function GetArcList($limitstart = 0, $row = 10, $col = 1, $titlelen = 30, $infolen = 250, $imgwidth = 120, $imgheight = 90, $achanneltype = "all", $orderby = "default", $innertext = "", $tablewidth = "100")
 {
     $typeid = $this->TypeID;
     if ($row == '') {
         $row = 10;
     }
     if ($limitstart == '') {
         $limitstart = 0;
     }
     if ($titlelen == '') {
         $titlelen = 30;
     }
     if ($infolen == '') {
         $infolen = 250;
     }
     if ($imgwidth == '') {
         $imgwidth = 120;
     }
     if ($imgheight = '') {
         $imgheight = 120;
     }
     if ($achanneltype == '') {
         $achanneltype = '0';
     }
     $orderby = $orderby == '' ? 'default' : strtolower($orderby);
     $tablewidth = str_replace("%", "", $tablewidth);
     if ($tablewidth == '') {
         $tablewidth = 100;
     }
     if ($col == '') {
         $col = 1;
     }
     $colWidth = ceil(100 / $col);
     $tablewidth = $tablewidth . "%";
     $colWidth = $colWidth . "%";
     $innertext = trim($innertext);
     if ($innertext == '') {
         $innertext = GetSysTemplets("search_list.htm");
     }
     //排序方式
     $ordersql = '';
     if ($orderby == "senddate") {
         $ordersql = " order by arc.senddate desc";
     } else {
         if ($orderby == "pubdate") {
             $ordersql = " order by arc.pubdate desc";
         } else {
             if ($orderby == "id") {
                 $ordersql = "  order by arc.id desc";
             } else {
                 $ordersql = " order by arc.sortrank desc";
             }
         }
     }
     //搜索
     $query = "Select arc.*,act.typedir,act.typename,act.isdefault,act.defaultname,act.namerule,\r\n\t\tact.namerule2,act.ispart,act.moresite,act.siteurl,act.sitepath\r\n\t\tfrom `#@__archives` arc left join `#@__arctype` act on arc.typeid=act.id\r\n\t\twhere {$this->AddSql} {$ordersql} limit {$limitstart},{$row}";
     $this->dsql->SetQuery($query);
     $this->dsql->Execute("al");
     $artlist = "";
     if ($col > 1) {
         $artlist = "<table width='{$tablewidth}' border='0' cellspacing='0' cellpadding='0'>\r\n";
     }
     $this->dtp2->LoadSource($innertext);
     for ($i = 0; $i < $row; $i++) {
         if ($col > 1) {
             $artlist .= "<tr>\r\n";
         }
         for ($j = 0; $j < $col; $j++) {
             if ($col > 1) {
                 $artlist .= "<td width='{$colWidth}'>\r\n";
             }
             if ($row = $this->dsql->GetArray("al")) {
                 //处理一些特殊字段
                 $row["arcurl"] = GetFileUrl($row["id"], $row["typeid"], $row["senddate"], $row["title"], $row["ismake"], $row["arcrank"], $row["namerule"], $row["typedir"], $row["money"], $row['filename'], $row["moresite"], $row["siteurl"], $row["sitepath"]);
                 $row["description"] = $this->GetRedKeyWord(cn_substr($row["description"], $infolen));
                 $row["title"] = $this->GetRedKeyWord(cn_substr($row["title"], $titlelen));
                 $row["id"] = $row["id"];
                 if ($row['litpic'] == '-' || $row['litpic'] == '') {
                     $row['litpic'] = $GLOBALS['cfg_cmspath'] . '/images/defaultpic.gif';
                 }
                 if (!eregi("^http://", $row['litpic']) && $GLOBALS['cfg_multi_site'] == 'Y') {
                     $row['litpic'] = $GLOBALS['cfg_mainsite'] . $row['litpic'];
                 }
                 $row['picname'] = $row['litpic'];
                 $row["typeurl"] = GetTypeUrl($row["typeid"], $row["typedir"], $row["isdefault"], $row["defaultname"], $row["ispart"], $row["namerule2"], $row["moresite"], $row["siteurl"], $row["sitepath"]);
                 $row["info"] = $row["description"];
                 $row["filename"] = $row["arcurl"];
                 $row["stime"] = GetDateMK($row["pubdate"]);
                 $row["textlink"] = "<a href='" . $row["filename"] . "'>" . $row["title"] . "</a>";
                 $row["typelink"] = "[<a href='" . $row["typeurl"] . "'>" . $row["typename"] . "</a>]";
                 $row["imglink"] = "<a href='" . $row["filename"] . "'><img src='" . $row["picname"] . "' border='0' width='{$imgwidth}' height='{$imgheight}'></a>";
                 $row["image"] = "<img src='" . $row["picname"] . "' border='0' width='{$imgwidth}' height='{$imgheight}'>";
                 $row['plusurl'] = $row['phpurl'] = $GLOBALS['cfg_phpurl'];
                 $row['memberurl'] = $GLOBALS['cfg_memberurl'];
                 $row['templeturl'] = $GLOBALS['cfg_templeturl'];
                 if (is_array($this->dtp2->CTags)) {
                     foreach ($this->dtp2->CTags as $k => $ctag) {
                         if ($ctag->GetName() == 'array') {
                             //传递整个数组,在runphp模式中有特殊作用
                             $this->dtp2->Assign($k, $row);
                         } else {
                             if (isset($row[$ctag->GetName()])) {
                                 $this->dtp2->Assign($k, $row[$ctag->GetName()]);
                             } else {
                                 $this->dtp2->Assign($k, '');
                             }
                         }
                     }
                 }
                 $artlist .= $this->dtp2->GetResult();
             } else {
                 $artlist .= "";
             }
             if ($col > 1) {
                 $artlist .= "</td>\r\n";
             }
         }
         //Loop Col
         if ($col > 1) {
             $artlist .= "</tr>\r\n";
         }
     }
     //Loop Line
     if ($col > 1) {
         $artlist .= "</table>\r\n";
     }
     $this->dsql->FreeResult("al");
     return $artlist;
 }
예제 #24
0
function lib_arclistsg(&$ctag, &$refObj)
{
    global $dsql, $PubFields, $cfg_keyword_like, $cfg_index_cache, $_arclistEnv, $envs, $_sys_globals;
    //属性处理
    $attlist = "typeid|0,row|10,col|1,flag|,titlelen|30,sort|default,keyword|,innertext|,arcid|0,idlist|,channelid|0,limit|,orderway|desc,subday|0";
    FillAttsDefault($ctag->CAttribute->Items, $attlist);
    extract($ctag->CAttribute->Items, EXTR_SKIP);
    $line = $row;
    $orderby = strtolower($sort);
    if ($col == '') {
        $col = 1;
    }
    if (empty($imgwidth)) {
        $imgwidth = "";
    }
    if (empty($imgheight)) {
        $imgheight = "";
    }
    $innertext = trim($ctag->GetInnerText());
    if ($innertext == '') {
        $innertext = GetSysTemplets("part_arclistsg.htm");
    }
    if (empty($channelid) && isset($GLOBALS['envs']['channelid'])) {
        $channelid = $GLOBALS['envs']['channelid'];
    }
    if (empty($typeid) && !empty($envs['typeid'])) {
        $typeid = $envs['typeid'];
    }
    if (empty($typeid) && empty($channelid)) {
        return "No channel info!";
    }
    if (!empty($channelid)) {
        $gquery = "SELECT addtable,listfields FROM `#@__channeltype` WHERE id='{$channelid}' ";
    } else {
        $gquery = "SELECT ch.addtable,listfields FROM `#@__arctype` tp LEFT JOIN `#@__channeltype` ch ON ch.id=tp.channeltype WHERE id='{$typeid}'";
    }
    $row = $dsql->GetOne($gquery);
    $orwheres = array();
    $maintable = trim($row['addtable']);
    if ($maintable == '') {
        return "No addtable info!";
    }
    //列表调用字段
    $listarcs = array('aid', 'typeid');
    if (!empty($row['listfields'])) {
        $listfields = explode(',', $row['listfields']);
        foreach ($listfields as $v) {
            if (!in_array($v, $listarcs)) {
                $listarcs[] = $v;
            }
        }
    }
    $arclistquery = join(',', $listarcs);
    $arclistquery .= ",arc.aid AS id,arc.senddate AS pubdate";
    //按不同情况设定SQL条件 排序方式
    if ($idlist == '') {
        if ($orderby == 'near' && $cfg_keyword_like == 'N') {
            $keyword = '';
        }
        //时间限制(用于调用最近热门文章、热门评论之类)
        if ($subday > 0) {
            //这里的时间只能计算到天,否则缓存功能将无效
            $ntime = gmmktime(0, 0, 0, gmdate('m'), gmdate('d'), gmdate('Y'));
            $limitday = $ntime - $subday * 24 * 3600;
            $orwheres[] = " arc.senddate > {$limitday} ";
        }
        if ($flag != '') {
            $flags = explode(',', $flag);
            for ($i = 0; isset($flags[$i]); $i++) {
                $orwheres[] = " FIND_IN_SET('{$flags[$i]}',flag)>0 ";
            }
        }
        if (!empty($typeid)) {
            //指定了多个栏目时,不再获取子类的id
            if (preg_match('#,#', $typeid)) {
                $orwheres[] = " typeid IN ({$typeid}) ";
            } else {
                //处理交叉栏目
                $CrossID = '';
                if ((isset($envs['cross']) || $ctag->GetAtt('cross') == '1') && $ctag->GetAtt('nocross') != '1') {
                    $arr = $dsql->GetOne("SELECT `id`,`topid`,`cross`,`crossid`,`ispart`,`typename` FROM `#@__arctype` WHERE id='{$typeid}' ");
                    if ($arr['cross'] == 0 || $arr['cross'] == 2 && trim($arr['crossid'] == '')) {
                        $orwheres[] = ' typeid IN (' . GetSonIds($typeid) . ')';
                    } else {
                        $selquery = '';
                        if ($arr['cross'] == 1) {
                            $selquery = "SELECT id,topid FROM `#@__arctype` WHERE typename like '{$arr['typename']}' AND id<>'{$typeid}' AND topid<>'{$typeid}'  ";
                        } else {
                            $arr['crossid'] = preg_replace('#[^0-9,]#', '', trim($arr['crossid']));
                            if ($arr['crossid'] != '') {
                                $selquery = "SELECT id,topid FROM `#@__arctype` WHERE id IN('{$arr['crossid']}') AND id<>'{$typeid}' AND topid<>'{$typeid}'  ";
                            }
                        }
                        if ($selquery != '') {
                            $dsql->SetQuery($selquery);
                            $dsql->Execute();
                            while ($arr = $dsql->GetArray()) {
                                $CrossID .= $CrossID == '' ? $arr['id'] : ',' . $arr['id'];
                            }
                        }
                    }
                }
                if ($CrossID == '') {
                    $orwheres[] = ' typeid IN (' . GetSonIds($typeid) . ')';
                } else {
                    $orwheres[] = ' typeid IN (' . GetSonIds($typeid) . ',' . $CrossID . ')';
                }
            }
        }
        //频道ID
        if (!empty($channelid)) {
            $orwheres[] = " AND arc.channel = '{$channelid}' ";
        }
        //由于这个条件会导致缓存功能失去意义,因此取消
        //if($arcid!=0) $orwheres[] = " arc.id<>'$arcid' ";
    }
    //文档排序的方式
    $ordersql = '';
    if ($orderby == 'hot' || $orderby == 'click') {
        $ordersql = " ORDER BY arc.click {$orderway}";
    } else {
        if ($orderby == 'id') {
            $ordersql = "  ORDER BY arc.aid {$orderway}";
        } else {
            if ($orderby == 'near') {
                $ordersql = " ORDER BY ABS(arc.id - " . $arcid . ")";
            } else {
                if ($orderby == 'rand') {
                    $ordersql = "  ORDER BY rand()";
                } else {
                    $ordersql = " ORDER BY arc.aid {$orderway}";
                }
            }
        }
    }
    //limit条件
    $limit = trim(preg_replace('#limit#i', '', $limit));
    if ($limit != '') {
        $limitsql = " LIMIT {$limit} ";
    } else {
        $limitsql = " LIMIT 0,{$line} ";
    }
    $orwhere = '';
    if (isset($orwheres[0])) {
        $orwhere = join(' AND ', $orwheres);
        $orwhere = preg_replace("#^ AND#i", '', $orwhere);
        $orwhere = preg_replace("#AND[ ]{1,}AND#i", 'AND ', $orwhere);
    }
    if ($orwhere != '') {
        $orwhere = " WHERE {$orwhere} ";
    }
    $query = "SELECT {$arclistquery},tp.typedir,tp.typename,tp.isdefault,tp.defaultname,tp.namerule,\n        tp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepath\n        FROM `{$maintable}` arc LEFT JOIN `#@__arctype` tp ON arc.typeid=tp.id\n        {$orwhere} AND arc.arcrank > -1 {$ordersql} {$limitsql}";
    $md5hash = md5($query);
    $needcache = TRUE;
    if ($idlist != '') {
        $needcache = FALSE;
    } else {
        $idlist = GetArclistSgCache($md5hash);
        if ($idlist != '') {
            $needcache = FALSE;
        }
    }
    //指定了id或使用缓存中的id
    if ($idlist != '' && $_arclistEnv != 'index') {
        $query = "SELECT {$arclistquery},tp.typedir,tp.typename,tp.isdefault,tp.defaultname,tp.namerule,tp.namerule2,tp.ispart,\n            tp.moresite,tp.siteurl,tp.sitepath FROM `{$maintable}` arc LEFT JOIN `#@__arctype` tp ON arc.typeid=tp.id\n          WHERE arc.aid IN({$idlist}) {$ordersql} {$limitsql}";
    }
    $dsql->SetQuery($query);
    $dsql->Execute("al");
    $artlist = "";
    $dtp2 = new DedeTagParse();
    $dtp2->SetNameSpace("field", "[", "]");
    $dtp2->LoadString($innertext);
    $GLOBALS['autoindex'] = 0;
    $ids = array();
    for ($i = 0; $i < $line; $i++) {
        for ($j = 0; $j < $col; $j++) {
            if ($col > 1) {
                $artlist .= "    <div>\r\n";
            }
            if ($row = $dsql->GetArray("al")) {
                $ids[] = $row['aid'];
                $row['filename'] = $row['arcurl'] = GetFileUrl($row['id'], $row['typeid'], $row['senddate'], $row['title'], 1, 0, $row['namerule'], $row['typedir'], 0, '', $row['moresite'], $row['siteurl'], $row['sitepath']);
                $row['typeurl'] = GetTypeUrl($row['typeid'], $row['typedir'], $row['isdefault'], $row['defaultname'], $row['ispart'], $row['namerule2'], $row['moresite'], $row['siteurl'], $row['sitepath']);
                if ($row['litpic'] == '-' || $row['litpic'] == '') {
                    $row['litpic'] = $GLOBALS['cfg_cmspath'] . '/images/defaultpic.gif';
                }
                if (!preg_match("#^http:\\/\\/#i", $row['litpic']) && $GLOBALS['cfg_multi_site'] == 'Y') {
                    $row['litpic'] = $GLOBALS['cfg_mainsite'] . $row['litpic'];
                }
                $row['picname'] = $row['litpic'];
                $row['image'] = "<img src='" . $row['picname'] . "' border='0' width='{$imgwidth}' height='{$imgheight}' alt='" . preg_replace("#['><]#", "", $row['title']) . "' />";
                $row['imglink'] = "<a href='" . $row['filename'] . "'>" . $row['image'] . "</a>";
                $row['stime'] = GetDateMK($row['pubdate']);
                $row['typelink'] = "<a href='" . $row['typeurl'] . "'>" . $row['typename'] . "</a>";
                $row['fulltitle'] = $row['title'];
                $row['title'] = cn_substr($row['title'], $titlelen);
                $row['textlink'] = "<a href='" . $row['filename'] . "'>" . $row['title'] . "</a>";
                $row['plusurl'] = $row['phpurl'] = $GLOBALS['cfg_phpurl'];
                $row['memberurl'] = $GLOBALS['cfg_memberurl'];
                $row['templeturl'] = $GLOBALS['cfg_templeturl'];
                if (is_array($dtp2->CTags)) {
                    foreach ($dtp2->CTags as $k => $ctag) {
                        if ($ctag->GetName() == 'array') {
                            //传递整个数组,在runphp模式中有特殊作用
                            $dtp2->Assign($k, $row);
                        } else {
                            if (isset($row[$ctag->GetName()])) {
                                $dtp2->Assign($k, $row[$ctag->GetName()]);
                            } else {
                                $dtp2->Assign($k, '');
                            }
                        }
                    }
                    $GLOBALS['autoindex']++;
                }
                $artlist .= $dtp2->GetResult() . "\r\n";
            } else {
                $artlist .= '';
            }
            if ($col > 1) {
                $artlist .= "    </div>\r\n";
            }
        }
        //Loop Col
        if ($col > 1) {
            $i += $col - 1;
        }
    }
    //loop line
    $dsql->FreeResult("al");
    //保存ID缓存
    $idsstr = join(',', $ids);
    if ($idsstr != '' && $needcache && $cfg_index_cache > 0) {
        $mintime = time() - $cfg_index_cache * 3600;
        $inquery = "INSERT INTO `#@__arccache`(`md5hash`,`uptime`,`cachedata`) VALUES ('" . $md5hash . "', '" . time() . "', '{$idsstr}'); ";
        $dsql->ExecuteNoneQuery("DELETE FROM `#@__arccache` WHERE md5hash='" . $md5hash . "' or uptime < {$mintime} ");
        $dsql->ExecuteNoneQuery($inquery);
    }
    return $artlist;
}
예제 #25
0
 /**
  *  获得文档列表
  *
  * @access    public
  * @param     string  $innertext  底层模板
  * @return    string
  */
 function GetArcList($innertext = "")
 {
     $typeid = $this->TypeID;
     $innertext = trim($innertext);
     if ($innertext == "") {
         $innertext = GetSysTemplets("rss.htm");
     }
     $orwhere = " arc.arcrank > -1 ";
     $orwhere .= " AND (arc.typeid in (" . GetSonIds($this->TypeID, $this->TypeFields['channeltype']) . ") ) ";
     $ordersql = " ORDER BY arc.id desc";
     $query = "SELECT arc.*,tp.typedir,tp.typename,tp.isdefault,\r\n        tp.defaultname,tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepath\r\n        FROM `#@__archives` arc LEFT JOIN `#@__arctype` tp ON arc.typeid=tp.id\r\n        WHERE {$orwhere} {$ordersql} LIMIT 0," . $this->MaxRow;
     $this->dsql->SetQuery($query);
     $this->dsql->Execute('al');
     $artlist = '';
     $dtp2 = new DedeTagParse();
     $dtp2->SetNameSpace('field', '[', ']');
     $dtp2->LoadSource($innertext);
     while ($row = $this->dsql->GetArray('al')) {
         //处理一些特殊字段
         if ($row['litpic'] == '-' || $row['litpic'] == '') {
             $row['litpic'] = $GLOBALS['cfg_cmspath'] . '/images/defaultpic.gif';
         }
         if (!preg_match("/^http:\\/\\//", $row['litpic']) && $GLOBALS['cfg_multi_site'] == 'Y') {
             $row['litpic'] = $GLOBALS['cfg_mainsite'] . $row['litpic'];
         }
         $row['picname'] = $row['litpic'];
         $row["arcurl"] = GetFileUrl($row["id"], $row["typeid"], $row["senddate"], $row["title"], $row["ismake"], $row["arcrank"], $row["namerule"], $row["typedir"], $row["money"], $row['filename'], $row["moresite"], $row["siteurl"], $row["sitepath"]);
         $row["typeurl"] = GetTypeUrl($row["typeid"], $row["typedir"], $row["isdefault"], $row["defaultname"], $row["ispart"], $row["namerule2"], $row["moresite"], $row["siteurl"], $row["sitepath"]);
         $row["info"] = $row["description"];
         $row["filename"] = $row["arcurl"];
         $row["stime"] = GetDateMK($row["pubdate"]);
         $row["image"] = "<img src='" . $row["picname"] . "' border='0'>";
         $row["fullurl"] = $GLOBALS["cfg_basehost"] . $row["arcurl"];
         // 2011-6-20 启用多站点RSS输出存在的路径问题(by:织梦的鱼)
         if ($GLOBALS['cfg_multi_site'] == 'Y') {
             $row["fullurl"] = $row["arcurl"];
         }
         $row["phpurl"] = $GLOBALS["cfg_plus_dir"];
         $row["templeturl"] = $GLOBALS["cfg_templets_dir"];
         if ($row["source"] == '') {
             $row["source"] = $GLOBALS['cfg_webname'];
         }
         if ($row["writer"] == '') {
             $row["writer"] = "秩名";
         }
         foreach ($row as $k => $v) {
             $row[$k] = htmlspecialchars($v);
         }
         if (is_array($dtp2->CTags)) {
             foreach ($dtp2->CTags as $k => $ctag) {
                 if ($ctag->GetName() == 'array') {
                     //传递整个数组,在runphp模式中有特殊作用
                     $dtp2->Assign($k, $row);
                 } else {
                     if (isset($row[$ctag->GetName()])) {
                         $dtp2->Assign($k, $row[$ctag->GetName()]);
                     } else {
                         $dtp2->Assign($k, '');
                     }
                 }
             }
         }
         $artlist .= $dtp2->GetResult() . "\r\n";
     }
     $this->dsql->FreeResult('al');
     return $artlist;
 }
예제 #26
0
function ch_softlinks_all($fvalue, &$ctag, &$refObj, &$row)
{
    global $dsql, $cfg_phpurl;
    $phppath = $cfg_phpurl;
    $dtp = new DedeTagParse();
    $dtp->LoadSource($fvalue);
    if (!is_array($dtp->CTags)) {
        $dtp->Clear();
        return "无链接信息!";
    }
    $tempStr = GetSysTemplets('channel_downlinks.htm');
    $downlinks = '';
    foreach ($dtp->CTags as $ctag) {
        if ($ctag->GetName() == 'link') {
            $link = trim($ctag->GetInnerText());
            $serverName = trim($ctag->GetAtt('text'));
            $islocal = trim($ctag->GetAtt('islocal'));
            //分析本地链接
            if (!isset($firstLink) && $islocal == 1) {
                $firstLink = $link;
            }
            if ($islocal == 1 && $row['islocal'] != 1) {
                continue;
            }
            //支持http,迅雷下载,ftp,flashget
            if (!eregi('^http://|^thunder://|^ftp://|^flashget://', $link)) {
                $link = $GLOBALS['cfg_mainsite'] . $link;
            }
            $downloads = getDownloads($link);
            $uhash = substr(md5($link), 0, 24);
            if ($row['gotojump'] == 1) {
                $link = $phppath . "/download.php?open=2&id={$refObj->ArcID}&uhash={$uhash}";
            }
            $temp = str_replace("~link~", $link, $tempStr);
            $temp = str_replace("~server~", $serverName, $temp);
            $temp = str_replace("~downloads~", $downloads, $temp);
            $downlinks .= $temp;
        }
    }
    $dtp->Clear();
    //获取镜像功能的地址
    //必须设置为:[根据本地地址和服务器列表自动生成] 的情况
    $linkCount = 1;
    if ($row['ismoresite'] == 1 && $row['moresitedo'] == 1 && trim($row['sites']) != '' && isset($firstLink)) {
        $firstLink = eregi_replace("http://([^/]*)/", '/', $firstLink);
        $row['sites'] = ereg_replace("[\r\n]{1,}", "\n", $row['sites']);
        $sites = explode("\n", trim($row['sites']));
        foreach ($sites as $site) {
            if (trim($site) == '') {
                continue;
            }
            list($link, $serverName) = explode('|', $site);
            $link = trim(ereg_replace("/\$", "", $link)) . $firstLink;
            $downloads = getDownloads($link);
            $uhash = substr(md5($link), 0, 24);
            if ($row['gotojump'] == 1) {
                $link = $phppath . "/download.php?open=2&id={$refObj->ArcID}&uhash={$uhash}";
            }
            $temp = str_replace("~link~", $link, $tempStr);
            $temp = str_replace("~server~", $serverName, $temp);
            $temp = str_replace("~downloads~", $downloads, $temp);
            $downlinks .= $temp;
        }
    }
    return $downlinks;
}
예제 #27
0
function lib_tag(&$ctag, &$refObj)
{
    global $dsql, $envs, $cfg_cmsurl;
    //属性处理
    $attlist = "row|30,sort|new,getall|0,typeid|0";
    FillAttsDefault($ctag->CAttribute->Items, $attlist);
    extract($ctag->CAttribute->Items, EXTR_SKIP);
    $InnerText = $ctag->GetInnerText();
    if (trim($InnerText) == '') {
        $InnerText = GetSysTemplets('tag_one.htm');
    }
    $revalue = '';
    $ltype = $sort;
    $num = $row;
    $addsql = '';
    if ($getall == 0 && isset($refObj->Fields['tags']) && !empty($refObj->Fields['aid'])) {
        $dsql->SetQuery("SELECT tid FROM `#@__taglist` WHERE aid = '{$refObj->Fields['aid']}' ");
        $dsql->Execute();
        $ids = '';
        while ($row = $dsql->GetArray()) {
            $ids .= $ids == '' ? $row['tid'] : ',' . $row['tid'];
        }
        if ($ids != '') {
            $addsql = " WHERE id IN({$ids}) ";
        }
        if ($addsql == '') {
            return '';
        }
    } else {
        if (!empty($typeid)) {
            $addsql = " WHERE typeid='{$typeid}' ";
        }
    }
    if ($ltype == 'rand') {
        $orderby = 'rand() ';
    } else {
        if ($ltype == 'week') {
            $orderby = ' weekcc DESC ';
        } else {
            if ($ltype == 'month') {
                $orderby = ' monthcc DESC ';
            } else {
                if ($ltype == 'hot') {
                    $orderby = ' count DESC ';
                } else {
                    if ($ltype == 'total') {
                        $orderby = ' total DESC ';
                    } else {
                        $orderby = 'addtime DESC  ';
                    }
                }
            }
        }
    }
    $dsql->SetQuery("SELECT * FROM `#@__tagindex` {$addsql} ORDER BY {$orderby} LIMIT 0,{$num}");
    $dsql->Execute();
    $ctp = new DedeTagParse();
    $ctp->SetNameSpace('field', '[', ']');
    $ctp->LoadSource($InnerText);
    while ($row = $dsql->GetArray()) {
        $row['keyword'] = $row['tag'];
        $row['tag'] = dede_htmlspecialchars($row['tag']);
        $row['link'] = $cfg_cmsurl . "/tags.php?/" . urlencode($row['keyword']) . "/";
        $row['highlight'] = 0;
        if ($row['monthcc'] > 1000 || $row['weekcc'] > 300) {
            $row['highlight'] = mt_rand(3, 4);
        } else {
            if ($row['count'] > 3000) {
                $row['highlight'] = mt_rand(5, 6);
            } else {
                $row['highlight'] = mt_rand(1, 2);
            }
        }
        foreach ($ctp->CTags as $tagid => $ctag) {
            if (isset($row[$ctag->GetName()])) {
                $ctp->Assign($tagid, $row[$ctag->GetName()]);
            }
        }
        $revalue .= $ctp->GetResult();
    }
    return $revalue;
}
 /**
  *  解析模板,对内容里的变动进行赋值
  *
  * @access    public
  * @param     string  $pageNo  页码数
  * @param     string  $ismake  是否生成
  * @return    string
  */
 function ParseDMFields($pageNo, $ismake = 1)
 {
     $this->NowPage = $pageNo;
     $this->Fields['nowpage'] = $this->NowPage;
     if ($this->SplitPageField != '' && isset($this->Fields[$this->SplitPageField])) {
         $this->Fields[$this->SplitPageField] = $this->SplitFields[$pageNo - 1];
         if ($pageNo > 1) {
             $this->Fields['description'] = trim(preg_replace("/[\r\n\t]/", ' ', cn_substr(html2text($this->Fields[$this->SplitPageField]), 200)));
         }
     }
     //解析模板
     if (is_array($this->dtp->CTags)) {
         foreach ($this->dtp->CTags as $i => $ctag) {
             if ($ctag->GetName() == 'field') {
                 $this->dtp->Assign($i, $this->GetField($ctag->GetAtt('name'), $ctag));
             } else {
                 if ($ctag->GetName() == 'pagebreak') {
                     if ($ismake == 0) {
                         $this->dtp->Assign($i, $this->GetPagebreakDM($this->TotalPage, $this->NowPage, $this->ArcID));
                     } else {
                         $this->dtp->Assign($i, $this->GetPagebreak($this->TotalPage, $this->NowPage, $this->ArcID));
                     }
                 } else {
                     if ($ctag->GetName() == 'pagetitle') {
                         if ($ismake == 0) {
                             $this->dtp->Assign($i, $this->GetPageTitlesDM($ctag->GetAtt("style"), $pageNo));
                         } else {
                             $this->dtp->Assign($i, $this->GetPageTitlesST($ctag->GetAtt("style"), $pageNo));
                         }
                     } else {
                         if ($ctag->GetName() == 'prenext') {
                             $this->dtp->Assign($i, $this->GetPreNext($ctag->GetAtt('get')));
                         } else {
                             if ($ctag->GetName() == 'fieldlist') {
                                 $innertext = trim($ctag->GetInnerText());
                                 if ($innertext == '') {
                                     $innertext = GetSysTemplets('tag_fieldlist.htm');
                                 }
                                 $dtp2 = new DedeTagParse();
                                 $dtp2->SetNameSpace('field', '[', ']');
                                 $dtp2->LoadSource($innertext);
                                 $oldSource = $dtp2->SourceString;
                                 $oldCtags = $dtp2->CTags;
                                 $res = '';
                                 if (is_array($this->ChannelUnit->ChannelFields) && is_array($dtp2->CTags)) {
                                     foreach ($this->ChannelUnit->ChannelFields as $k => $v) {
                                         if (isset($v['autofield']) && empty($v['autofield'])) {
                                             continue;
                                         }
                                         $dtp2->SourceString = $oldSource;
                                         $dtp2->CTags = $oldCtags;
                                         $fname = $v['itemname'];
                                         foreach ($dtp2->CTags as $tid => $ctag2) {
                                             if ($ctag2->GetName() == 'name') {
                                                 $dtp2->Assign($tid, $fname);
                                             } else {
                                                 if ($ctag2->GetName() == 'tagname') {
                                                     $dtp2->Assign($tid, $k);
                                                 } else {
                                                     if ($ctag2->GetName() == 'value') {
                                                         $this->Fields[$k] = $this->ChannelUnit->MakeField($k, $this->Fields[$k], $ctag2);
                                                         @$dtp2->Assign($tid, $this->Fields[$k]);
                                                     }
                                                 }
                                             }
                                         }
                                         $res .= $dtp2->GetResult();
                                     }
                                 }
                                 $this->dtp->Assign($i, $res);
                             }
                         }
                     }
                 }
             }
             //end case
         }
         //结束模板循环
     }
 }
예제 #29
0
 function GetList($limitstart, $ismake = 1)
 {
     global $cfg_list_son, $cfg_needsontype;
     $col = $this->ListObj->GetAtt('col');
     if (empty($col)) {
         $col = 1;
     }
     $titlelen = $this->ListObj->GetAtt('titlelen');
     $infolen = $this->ListObj->GetAtt('infolen');
     $imgwidth = $this->ListObj->GetAtt('imgwidth');
     $imgheight = $this->ListObj->GetAtt('imgheight');
     $titlelen = AttDef($titlelen, 60);
     $infolen = AttDef($infolen, 250);
     $imgwidth = AttDef($imgwidth, 80);
     $imgheight = AttDef($imgheight, 80);
     $innertext = trim($this->ListObj->GetInnerText());
     if (empty($innertext)) {
         $innertext = GetSysTemplets("list_fulllist.htm");
     }
     $tablewidth = 100;
     if ($col == "") {
         $col = 1;
     }
     $colWidth = ceil(100 / $col);
     $tablewidth = $tablewidth . "%";
     $colWidth = $colWidth . "%";
     //按不同情况设定SQL条件
     $orwhere = " arc.arcrank > -1 And channel>-1 ";
     $typeid = $this->ListObj->GetAtt('typeid');
     $subday = $this->ListObj->GetAtt('subday');
     $listtype = $this->ListObj->GetAtt('type');
     $att = $this->ListObj->GetAtt('att');
     $channelid = $this->ListObj->GetAtt('channel');
     if (empty($channelid)) {
         $channelid = 0;
     }
     //是否指定栏目条件
     if (!empty($typeid)) {
         if ($cfg_list_son == 'N') {
             $orwhere .= " And (arc.typeid='{$typeid}') ";
         } else {
             $orwhere .= " And arc.typeid in (" . GetSonIds($typeid, 0, true) . ") ";
         }
     }
     //自定义属性条件
     if ($att != '') {
         $flags = explode(',', $att);
         for ($i = 0; isset($flags[$i]); $i++) {
             $orwhere .= " AND FIND_IN_SET('{$flags[$i]}',flag)>0 ";
         }
     }
     //文档的频道模型
     if ($channelid > 0 && !eregi("spec", $listtype)) {
         $orwhere .= " And arc.channel = '{$channelid}' ";
     }
     //推荐文档 带缩略图  专题文档
     if (eregi("commend", $listtype)) {
         $orwhere .= " And FIND_IN_SET('c',flag) > 0  ";
     }
     if (eregi("image", $listtype)) {
         $orwhere .= " And arc.litpic <> ''  ";
     }
     if (eregi("spec", $listtype) || $channelid == -1) {
         $orwhere .= " And arc.channel = -1  ";
     }
     if (!empty($subday)) {
         $starttime = time() - $subday * 86400;
         $orwhere .= " And arc.senddate > {$starttime}  ";
     }
     $keyword = $this->ListObj->GetAtt('keyword');
     if (!empty($keyword)) {
         $orwhere .= " And CONCAT(arc.title,arc.keywords) REGEXP '{$keyword}' ";
     }
     $orderby = $this->ListObj->GetAtt('orderby');
     $orderWay = $this->ListObj->GetAtt('orderway');
     //排序方式
     $ordersql = "";
     if ($orderby == "senddate") {
         $ordersql = " order by arc.senddate {$orderWay}";
     } else {
         if ($orderby == "pubdate") {
             $ordersql = " order by arc.pubdate {$orderWay}";
         } else {
             if ($orderby == "id") {
                 $ordersql = "  order by arc.id {$orderWay}";
             } else {
                 if ($orderby == "hot" || $orderby == "click") {
                     $ordersql = " order by arc.click {$orderWay}";
                 } else {
                     if ($orderby == "lastpost") {
                         $ordersql = "  order by arc.lastpost {$orderWay}";
                     } else {
                         if ($orderby == "scores") {
                             $ordersql = "  order by arc.scores {$orderWay}";
                         } else {
                             if ($orderby == "rand") {
                                 $ordersql = "  order by rand()";
                             } else {
                                 $ordersql = " order by arc.sortrank {$orderWay}";
                             }
                         }
                     }
                 }
             }
         }
     }
     //获得附加表的相关信息
     $addField = "";
     $addJoin = "";
     if (is_object($this->ChannelUnit)) {
         $addtable = $this->ChannelUnit->ChannelInfos['addtable'];
         if ($addtable != "") {
             $addJoin = " left join {$addtable} on arc.id = " . $addtable . ".aid ";
             $addField = "";
             $fields = explode(",", $this->ChannelUnit->ChannelInfos['listfields']);
             foreach ($fields as $k => $v) {
                 $nfields[$v] = $k;
             }
             foreach ($this->ChannelUnit->ChannelFields as $k => $arr) {
                 if (isset($nfields[$k])) {
                     if (!empty($arr['rename'])) {
                         $addField .= "," . $addtable . "." . $k . " as " . $arr['rename'];
                     } else {
                         $addField .= "," . $addtable . "." . $k;
                     }
                 }
             }
         }
     }
     $query = "Select arc.*,tp.typedir,tp.typename,tp.isdefault,tp.defaultname,\r\n\t\ttp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepath\r\n\t\t{$addField}\r\n\t\tfrom {$this->maintable} arc\r\n\t\tleft join #@__arctype tp on arc.typeid=tp.id\r\n\t\t{$addJoin}\r\n\t\twhere {$orwhere} {$ordersql} limit {$limitstart}," . $this->PageSize;
     $this->dsql->SetQuery($query);
     $this->dsql->Execute("al");
     $artlist = "";
     if ($col > 1) {
         $artlist = "<table width='{$tablewidth}' border='0' cellspacing='0' cellpadding='0'>\r\n";
     }
     $indtp = new DedeTagParse();
     $indtp->SetNameSpace("field", "[", "]");
     $indtp->LoadSource($innertext);
     $GLOBALS['autoindex'] = 0;
     for ($i = 0; $i < $this->PageSize; $i++) {
         if ($col > 1) {
             $artlist .= "<tr>\r\n";
         }
         for ($j = 0; $j < $col; $j++) {
             if ($col > 1) {
                 $artlist .= "<td width='{$colWidth}'>\r\n";
             }
             if ($row = $this->dsql->GetArray("al")) {
                 $GLOBALS['autoindex']++;
                 //处理一些特殊字段
                 $row['id'] = $row['id'];
                 $row['arcurl'] = $this->GetArcUrl($row['id'], $row['typeid'], $row['senddate'], $row['title'], $row['ismake'], $row['arcrank'], $row['namerule'], $row['typedir'], $row['money'], $row['filename'], $row['moresite'], $row['siteurl'], $row['sitepath']);
                 $row['typeurl'] = GetTypeUrl($row['typeid'], $row['typedir'], $row['isdefault'], $row['defaultname'], $row['ispart'], $row['namerule2'], $row['siteurl'], $row['sitepath']);
                 if ($ismake == 0 && $GLOBALS['cfg_multi_site'] == 'Y') {
                     if ($row["siteurl"] == "") {
                         $row["siteurl"] = $GLOBALS['cfg_mainsite'];
                     }
                 }
                 $row['description'] = cn_substr($row['description'], $infolen);
                 if ($row['litpic'] == '-' || $row['litpic'] == '') {
                     $row['litpic'] = $GLOBALS['cfg_cmspath'] . '/images/defaultpic.gif';
                 }
                 if (!eregi("^http://", $row['litpic']) && $GLOBALS['cfg_multi_site'] == 'Y') {
                     $row['litpic'] = $GLOBALS['cfg_mainsite'] . $row['litpic'];
                 }
                 $row['picname'] = $row['litpic'];
                 $row['info'] = $row['description'];
                 $row['filename'] = $row['arcurl'];
                 $row['stime'] = GetDateMK($row['pubdate']);
                 $row['textlink'] = "<a href='" . $row['filename'] . "' title='" . str_replace("'", "", $row['title']) . "'>" . $row['title'] . "</a>";
                 $row['typelink'] = "<a href='" . $row['typeurl'] . "'>[" . $row['typename'] . "]</a>";
                 $row['imglink'] = "<a href='" . $row['filename'] . "'><img src='" . $row['picname'] . "' border='0' width='{$imgwidth}' height='{$imgheight}' alt='" . str_replace("'", "", $row['title']) . "'></a>";
                 $row['image'] = "<img src='" . $row['picname'] . "' border='0' width='{$imgwidth}' height='{$imgheight}' alt='" . str_replace("'", "", $row['title']) . "'>";
                 $row['plusurl'] = $row['phpurl'] = $GLOBALS['cfg_phpurl'];
                 $row['memberurl'] = $GLOBALS['cfg_memberurl'];
                 $row['templeturl'] = $GLOBALS['cfg_templeturl'];
                 $row['title'] = cn_substr($row['title'], $titlelen);
                 if ($row['color'] != "") {
                     $row['title'] = "<font color='" . $row['color'] . "'>" . $row['title'] . "</font>";
                 }
                 if (ereg('c', $row['flag'])) {
                     $row['title'] = "<b>" . $row['title'] . "</b>";
                 }
                 //编译附加表里的数据
                 if (is_object($this->ChannelUnit)) {
                     foreach ($row as $k => $v) {
                         if (ereg("[A-Z]", $k)) {
                             $row[strtolower($k)] = $v;
                         }
                     }
                     foreach ($this->ChannelUnit->ChannelFields as $k => $arr) {
                         if (isset($row[$k])) {
                             $row[$k] = $this->ChannelUnit->MakeField($k, $row[$k]);
                         }
                     }
                 }
                 //解析单条记录
                 if (is_array($indtp->CTags)) {
                     foreach ($indtp->CTags as $k => $ctag) {
                         $_f = $ctag->GetName();
                         if ($_f == 'array') {
                             //传递整个数组,在runphp模式中有特殊作用
                             $indtp->Assign($k, $row);
                         } else {
                             if (isset($row[$_f])) {
                                 $indtp->Assign($k, $row[$_f]);
                             } else {
                                 $indtp->Assign($k, "");
                             }
                         }
                     }
                 }
                 $artlist .= $indtp->GetResult();
             } else {
                 $artlist .= "";
             }
             if ($col > 1) {
                 $artlist .= "\t</td>\r\n";
             }
         }
         //Loop Col
         if ($col > 1) {
             $i += $col - 1;
         }
         if ($col > 1) {
             $artlist .= "\t</tr>\r\n";
         }
     }
     //Loop Line
     if ($col > 1) {
         $artlist .= "</table>\r\n";
     }
     $this->dsql->FreeResult("al");
     return $artlist;
 }
	function GetArcList($limitstart=0,$row=10,$col=1,$titlelen=30,$infolen=250,
	$imgwidth=120,$imgheight=90,$listtype="all",$orderby="default",$innertext="",$tablewidth="100",$ismake=1,$orderWay='desc')
	{
		global $cfg_list_son;
		$t1 = ExecTime();
		$typeid=$this->TypeID;
		
		if($row=="") $row = 10;
			if($limitstart=="") $limitstart = 0;
			if($titlelen=="") $titlelen = 100;
			if($infolen=="") $infolen = 250;
			if($imgwidth=="") $imgwidth = 120;
			if($imgheight=="") $imgheight = 120;
			if($listtype=="") $listtype = "all";
			if($orderby=="") $orderby="default";
			else $orderby=strtolower($orderby);
			if($orderWay=='') $orderWay = 'desc';
			$tablewidth = str_replace("%","",$tablewidth);
			if($tablewidth=="") $tablewidth=100;
			if($col=="") $col=1;
			$colWidth = ceil(100/$col);
			$tablewidth = $tablewidth."%";
			$colWidth = $colWidth."%";
			$innertext = trim($innertext);
			if($innertext=="") $innertext = GetSysTemplets("list_fulllist.htm");
			//按不同情况设定SQL条件

			$orwhere = $this->addSql;

			//排序方式
			if($orderby=="senddate") $ordersql=" order by arc.senddate $orderWay";
			elseif($orderby=="pubdate") $ordersql=" order by arc.pubdate $orderWay";
			elseif($orderby=="id") $ordersql="  order by arc.ID $orderWay";
			elseif($orderby=="hot"||$orderby=="click") $ordersql = " order by arc.click $orderWay";
			elseif($orderby=="lastpost") $ordersql = "  order by arc.lastpost $orderWay";
			elseif($orderby=="postnum") $ordersql = "  order by arc.postnum $orderWay";
			elseif($orderby=="digg") $ordersql = "  order by arc.digg $orderWay";
		  elseif($orderby=="diggtime") $ordersql = "  order by arc.diggtime $orderWay";
			else $ordersql=" order by arc.sortrank $orderWay";

			//获得附加表的相关信息
			//-----------------------------
			$addtable  = $this->ChannelUnit->ChannelInfos['addtable'];
			$addfields = trim($this->ChannelUnit->ChannelInfos['listadd']);
			if($addtable!="" && $addfields!="")
			{
				$addJoin = " left join `$addtable` addt on addt.aid = arc.ID ";
				$addField = "";
				$fields = explode(",",$addfields);
				foreach($fields as $k=>$v){
					$addField .= ",addt.{$v}";
				}
			}else
			{
				$addField = "";
				$addJoin = "";
			}

			$query = "Select arc.*,
			tp.typedir,tp.typename,tp.isdefault,tp.defaultname,tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl
			$addField
			from `{$this->maintable}` arc
			left join #@__arctype tp on arc.typeid=tp.ID
			$addJoin
			where $orwhere $ordersql limit $limitstart,$row";

			$this->dtp2->LoadSource($innertext);
			if(!is_array($this->dtp2->CTags)) return '';
			
			$this->dsql->Execute("al",$query);
			
			$t2 = ExecTime();
			
			$artlist = "";
			if($col>1) $artlist = "<table width='$tablewidth' border='0' cellspacing='0' cellpadding='0'>\r\n";
			
			$GLOBALS['autoindex'] = 0;
			for($i=0;$i<$row;$i++)
			{
				if($col>1) $artlist .= "<tr>\r\n";
				for($j=0;$j<$col;$j++)
				{
					if($col>1) $artlist .= "<td width='$colWidth'>\r\n";
					if($row = $this->dsql->GetArray("al",MYSQL_ASSOC))
					{
						$GLOBALS['autoindex']++;
						//处理一些特殊字段
						//if()
						$row['id'] =  $row['ID'];
						$row['arcurl'] = $this->GetArcUrl($row['id'],$row['typeid'],$row['senddate'],$row['title'],$row['ismake'],$row['arcrank'],$row['namerule'],$row['typedir'],$row['money']);
						$row['typeurl'] = $this->GetListUrl($row['typeid'],$row['typedir'],$row['isdefault'],$row['defaultname'],$row['ispart'],$row['namerule2'],"abc");

						if($ismake==0 && $GLOBALS['cfg_multi_site']=='Y')
						{
							if($row["siteurl"]=="") $row["siteurl"] = $GLOBALS['cfg_mainsite'];
							if(!eregi("^http://",$row['picname'])){
								$row['litpic'] = $row['siteurl'].$row['litpic'];
								$row['picname'] = $row['litpic'];
							}
						}

						$row['description'] = cn_substr($row['description'],$infolen);
						if($row['litpic']=="") $row['litpic'] = $GLOBALS['cfg_plus_dir']."/img/dfpic.gif";
						$row['picname'] = $row['litpic'];
						$row['info'] = $row['description'];
						$row['filename'] = $row['arcurl'];
						$row['stime'] = GetDateMK($row['pubdate']);
						
						if($this->hasDmCache){
						  $row['areaidname'] = $row['areaid2name'] = $row['sectoridname'] = $row['sectorid2name'] =$row['smalltypeidname'] = '';
						  $row['areaidname'] = $this->areas[$row['areaid']];
						  $row['areaid2name'] = $this->areas[$row['areaid2']];
						  $row['sectoridname'] = $this->sectors[$row['sectorid']];
						  $row['sectorid2name'] = $this->sectors[$row['sectorid2']];
						  $row['smalltypeidname'] = $this->smalltypes[$row['smalltypeid']];
						}

						$row['textlink'] = "<a href='".$row['filename']."' title='".str_replace("'","",$row['title'])."'>".$row['title']."</a>";

						if($row['typeid'] != $this->Fields['ID']){
							$row['typelink'] = "<a href='".$row['typeurl']."'>[".$row['typename']."]</a>";
						}else{
							$row['typelink']= '';
						}
						$row['imglink'] = "<a href='".$row['filename']."'><img src='".$row['picname']."' border='0' width='$imgwidth' height='$imgheight' alt='".str_replace("'","",$row['title'])."'></a>";
						$row['image'] = "<img src='".$row['picname']."' border='0' width='$imgwidth' height='$imgheight' alt='".str_replace("'","",$row['title'])."'>";
						$row['phpurl'] = $GLOBALS['cfg_plus_dir'];
						$row['plusurl'] = $GLOBALS['cfg_plus_dir'];
						$row['templeturl'] = $GLOBALS['cfg_templets_dir'];
						$row['memberurl'] = $GLOBALS['cfg_member_dir'];
						$row['title'] = cn_substr($row['title'],$titlelen);
						if($row['color']!="") $row['title'] = "<font color='".$row['color']."'>".$row['title']."</font>";
						if($row['iscommend']==5||$row['iscommend']==16) $row['title'] = "<b>".$row['title']."</b>";
						//编译附加表里的数据
						foreach($row as $k=>$v){ $row[strtolower($k)] = $v; }
						foreach($this->ChannelUnit->ChannelFields as $k=>$arr){
							if(isset($row[$k])) $row[$k] = $this->ChannelUnit->MakeField($k,$row[$k]);
						}
						foreach($this->dtp2->CTags as $k=>$ctag){
								@$this->dtp2->Assign($k,$row[$ctag->GetName()]);
						}
						$artlist .= $this->dtp2->GetResult();
					}//if hasRow
					if($col>1) $artlist .= "	</td>\r\n";
				}//Loop Col
				if($col>1) $i += $col - 1;
				if($col>1) $artlist .= "	</tr>\r\n";
		}//Loop Line
		if($col>1) $artlist .= "</table>\r\n";
		$this->dsql->FreeResult("al");
		//$t3 = ExecTime();
		//echo ($t3-$t2)."<br>";
		return $artlist;
	}