コード例 #1
0
ファイル: memberlist.lib.php プロジェクト: iabing/mzzyc
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;
}
コード例 #2
0
ファイル: likesgpage.lib.php プロジェクト: ahmatjan/cmf2
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;
}
コード例 #3
0
ファイル: feedback.lib.php プロジェクト: klr2003/sourceread
/**
 * 调用最新评论
 *
 * @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;
}
コード例 #4
0
ファイル: mynews.lib.php プロジェクト: klr2003/sourceread
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;
}
コード例 #5
0
ファイル: loop.lib.php プロジェクト: ahmatjan/cmf2
function lib_loop(&$ctag, &$refObj)
{
    global $dsql;
    $attlist = "table|,tablename|,row|8,sort|,if|,ifcase|,orderway|desc";
    //(2011.7.22 增加loop标签orderway属性 by:织梦的鱼)
    FillAttsDefault($ctag->CAttribute->Items, $attlist);
    extract($ctag->CAttribute->Items, EXTR_SKIP);
    $innertext = trim($ctag->GetInnertext());
    $revalue = '';
    if (!empty($table)) {
        $tablename = $table;
    }
    if ($tablename == '' || $innertext == '') {
        return '';
    }
    if ($if != '') {
        $ifcase = $if;
    }
    if ($sort != '') {
        $sort = " ORDER BY {$sort} {$orderway} ";
    }
    if ($ifcase != '') {
        $ifcase = " WHERE {$ifcase} ";
    }
    $dsql->SetQuery("SELECT * FROM {$tablename} {$ifcase} {$sort} LIMIT 0,{$row}");
    $dsql->Execute();
    $ctp = new DedeTagParse();
    $ctp->SetNameSpace("field", "[", "]");
    $ctp->LoadSource($innertext);
    $GLOBALS['autoindex'] = 0;
    while ($row = $dsql->GetArray()) {
        $GLOBALS['autoindex']++;
        foreach ($ctp->CTags as $tagid => $ctag) {
            if ($ctag->GetName() == 'array') {
                $ctp->Assign($tagid, $row);
            } else {
                if (!empty($row[$ctag->GetName()])) {
                    $ctp->Assign($tagid, $row[$ctag->GetName()]);
                }
            }
        }
        $revalue .= $ctp->GetResult();
    }
    return $revalue;
}
コード例 #6
0
ファイル: sql.lib.php プロジェクト: klr2003/sourceread
function lib_sql(&$ctag, &$refObj)
{
    global $dsql, $sqlCt;
    $attlist = "sql|";
    FillAttsDefault($ctag->CAttribute->Items, $attlist);
    extract($ctag->CAttribute->Items, EXTR_SKIP);
    //传递环境参数
    preg_match_all("/~([A-Za-z0-9]+)~/s", $sql, $conditions);
    if (is_array($conditions)) {
        foreach ($conditions[1] as $key => $value) {
            if (isset($refObj->Fields[$value])) {
                $sql = str_replace($conditions[0][$key], "'" . addslashes($refObj->Fields[$value]) . "'", $sql);
            }
        }
    }
    $revalue = '';
    $Innertext = trim($ctag->GetInnerText());
    if ($sql == '' || $Innertext == '') {
        return '';
    }
    if (empty($sqlCt)) {
        $sqlCt = 0;
    }
    $ctp = new DedeTagParse();
    $ctp->SetNameSpace('field', '[', ']');
    $ctp->LoadSource($Innertext);
    $thisrs = 'sq' . $sqlCt;
    $dsql->Execute($thisrs, $sql);
    $GLOBALS['autoindex'] = 0;
    while ($row = $dsql->GetArray($thisrs)) {
        $sqlCt++;
        $GLOBALS['autoindex']++;
        foreach ($ctp->CTags as $tagid => $ctag) {
            if ($ctag->GetName() == 'array') {
                $ctp->Assign($tagid, $row);
            } else {
                if (!empty($row[$ctag->GetName()])) {
                    $ctp->Assign($tagid, $row[$ctag->GetName()]);
                }
            }
        }
        $revalue .= $ctp->GetResult();
    }
    return $revalue;
}
コード例 #7
0
ファイル: infoguide.lib.php プロジェクト: iabing/mzzyc
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;
}
コード例 #8
0
ファイル: json.lib.php プロジェクト: iabing/mzzyc
function lib_json(&$ctag, &$refObj)
{
    global $dsql, $sqlCt, $cfg_soft_lang;
    $attlist = "url|";
    FillAttsDefault($ctag->CAttribute->Items, $attlist);
    extract($ctag->CAttribute->Items, EXTR_SKIP);
    $Innertext = trim($ctag->GetInnerText());
    if ($url == '' || $Innertext == '') {
        return '';
    }
    $ctp = new DedeTagParse();
    $ctp->SetNameSpace('field', '[', ']');
    $ctp->LoadSource($Innertext);
    $mcache = new MiniCache();
    $GLOBALS['autoindex'] = 0;
    $chash = md5($url);
    if (!($row = $mcache->Get($chash))) {
        $content = @file_get_contents($url);
        $json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE);
        $row = $json->decode($content);
        if ($cfg_soft_lang != 'utf-8') {
            $row = AutoCharset($row, 'utf-8', 'gb2312');
        }
        $mcache->Save($chash, $row, $cache);
    }
    $revalue = "";
    foreach ($row as $key => $value) {
        $GLOBALS['autoindex']++;
        foreach ($ctp->CTags as $tagid => $ctag) {
            if ($ctag->GetName() == 'array') {
                $ctp->Assign($tagid, $value);
            } else {
                if (!empty($value[$ctag->GetName()])) {
                    $ctp->Assign($tagid, $value[$ctag->GetName()]);
                } else {
                    $ctp->Assign($tagid, "");
                }
            }
        }
        $revalue .= $ctp->GetResult();
    }
    return $revalue;
}
コード例 #9
0
ファイル: sonchannel.lib.php プロジェクト: iabing/mzzyc
function lib_sonchannel(&$ctag, &$refObj)
{
    global $_sys_globals, $dsql;
    $attlist = "row|100,nosonmsg|,col|1";
    FillAttsDefault($ctag->CAttribute->Items, $attlist);
    extract($ctag->CAttribute->Items, EXTR_SKIP);
    $innertext = $ctag->GetInnerText();
    $typeid = $_sys_globals['typeid'];
    if (empty($typeid)) {
        return $ctag->GetAtt('nosonmsg');
    }
    $sql = "SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath\r\n        FROM `#@__arctype` WHERE reid='{$typeid}' AND ishidden<>1 ORDER BY sortrank ASC LIMIT 0,{$row}";
    //And id<>'$typeid'
    $dtp2 = new DedeTagParse();
    $dtp2->SetNameSpace("field", "[", "]");
    $dtp2->LoadSource($innertext);
    $dsql->SetQuery($sql);
    $dsql->Execute();
    $line = $row;
    $GLOBALS['autoindex'] = 0;
    $likeType = '';
    for ($i = 0; $i < $line; $i++) {
        if ($col > 1) {
            $likeType .= "<dl>\r\n";
        }
        for ($j = 0; $j < $col; $j++) {
            if ($col > 1) {
                $likeType .= "<dd>\r\n";
            }
            if ($row = $dsql->GetArray()) {
                $row['typelink'] = $row['typeurl'] = GetOneTypeUrlA($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 .= "</dd>\r\n";
            }
            $GLOBALS['autoindex']++;
        }
        //Loop Col
        if ($col > 1) {
            $i += $col - 1;
            $likeType .= "    </dl>\r\n";
        }
    }
    //Loop for $i
    $dsql->FreeResult();
    return $likeType;
}
コード例 #10
0
ファイル: flinktype.lib.php プロジェクト: ahmatjan/cmf2
function lib_flinktype(&$ctag, &$refObj)
{
    global $dsql;
    $attlist = "row|24,titlelen|24";
    FillAttsDefault($ctag->CAttribute->Items, $attlist);
    extract($ctag->CAttribute->Items, EXTR_SKIP);
    $totalrow = $row;
    $revalue = '';
    $equery = "SELECT * FROM #@__flinktype order by id asc limit 0,{$totalrow}";
    if (trim($ctag->GetInnerText()) == '') {
        $innertext = "<li>[field:typename /]</li>";
    } else {
        $innertext = $ctag->GetInnerText();
    }
    if (!isset($type)) {
        $type = '';
    }
    $dtp = new DedeTagParse();
    $dtp->SetNameSpace("dede", "{", "}");
    $dtp->LoadString($innertext);
    $dsql->SetQuery($equery);
    $dsql->Execute();
    $rs = '';
    $row = array();
    while ($dbrow = $dsql->GetObject()) {
        $row[] = $dbrow;
    }
    $dedecms = false;
    $dedecms->id = 999;
    $dedecms->typename = '织梦链';
    if ($type == 'dedecms') {
        $row[] = $dedecms;
    }
    foreach ($row as $key => $value) {
        if (is_array($dtp->CTags)) {
            $GLOBALS['envs']['flinkid'] = $value->id;
            foreach ($dtp->CTags as $tagid => $ctag) {
                $tagname = $ctag->GetName();
                if ($tagname == "flink") {
                    $dtp->Assign($tagid, lib_flink($ctag, $refObj));
                }
            }
        }
        $rs = $dtp->GetResult();
        $rs = preg_replace("/\\[field:id([\\/\\s]{0,})\\]/isU", $value->id, $rs);
        $rs = preg_replace("/\\[field:typename([\\/\\s]{0,})\\]/isU", $value->typename, $rs);
        $revalue .= $rs;
    }
    return $revalue;
}
コード例 #11
0
ファイル: asktype.lib.php プロジェクト: hensonvip/ymroad
/**
 * 问答调用标签
 *
 * @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;
}
コード例 #12
0
ファイル: groupthread.lib.php プロジェクト: iabing/mzzyc
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;
}
コード例 #13
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;
}
コード例 #14
0
ファイル: memberinfos.lib.php プロジェクト: iabing/mzzyc
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;
}
コード例 #15
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;
}
コード例 #16
0
ファイル: ask.lib.php プロジェクト: ahmatjan/cmf2
/**
 * 问答调用标签
 *
 * @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_ask(&$ctag, &$refObj)
{
    global $dsql, $envs, $cfg_dbprefix, $cfg_cmsurl, $cfg_ask_directory, $cfg_ask_isdomain, $cfg_ask_domain;
    //属性处理
    $attlist = "row|6,qtype|new,tid|0,titlelen|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");
    }
    $qtypeQuery = '';
    if ($tid > 0) {
        $tid = " (tid={$tid} Or tid2='{$tid}') AND ";
    } else {
        $tid = '';
    }
    //推荐问题
    if ($qtype == 'commend') {
        $qtypeQuery = " {$tid} digest=1 ORDER BY dateline DESC ";
    } else {
        if ($qtype == 'ok') {
            $qtypeQuery = " {$tid} status=1 ORDER BY solvetime DESC ";
        } else {
            if ($qtype == 'high') {
                $qtypeQuery = " {$tid} status=0 ORDER BY reward DESC ";
            } else {
                $qtypeQuery = " {$tid} status=0 ORDER BY disorder DESC, dateline DESC ";
            }
        }
    }
    $ctp = new DedeTagParse();
    $ctp->SetNameSpace('field', '[', ']');
    $solvingask = '';
    $query = "SELECT id, tid, tidname, tid2, tid2name, title,dateline FROM `#@__ask` WHERE {$qtypeQuery}  limit 0, {$row}";
    $dsql->Execute('me', $query);
    while ($rs = $dsql->GetArray('me')) {
        $rs['title'] = cn_substr($rs['title'], $titlelen);
        $ctp->LoadSource($innertext);
        if ($rs['tid2name'] != '') {
            $rs['tid'] = $rs['tid2'];
            $rs['tidname'] = $rs['tid2name'];
        }
        $rs['url'] = $weburl . "?ct=question&askaid=" . $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;
}
コード例 #17
0
ファイル: arcmulti.php プロジェクト: iabing/mzzyc
     if ($row['color'] != '') {
         $row['title'] = "<font color='" . $row['color'] . "'>" . $row['title'] . "</font>";
     }
     if (preg_match('#b#', $row['flag'])) {
         $row['title'] = "<strong>" . $row['title'] . "</strong>";
     }
     //$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($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) {
コード例 #18
0
 $fieldinfos = GetFieldMake($dtype, $fieldname, $dfvalue, $mxlen);
 $ntabsql = $fieldinfos[0];
 $buideType = $fieldinfos[1];
 $rs = $dsql->ExecuteNoneQuery(" ALTER TABLE `{$trueTable}` ADD  {$ntabsql} ");
 if (!$rs) {
     $gerr = $dsql->GetError();
     ShowMsg("增加字段失败,错误提示为:" . $gerr, "javascript:;");
     exit;
 }
 $ok = false;
 //检测旧配置信息,并替换为新配置
 if (is_array($dtp->CTags)) {
     //遍历旧配置
     foreach ($dtp->CTags as $tagid => $ctag) {
         if ($fieldname == strtolower($ctag->GetName())) {
             $dtp->Assign($tagid, stripslashes($fieldstring), false);
             $ok = true;
             break;
         }
     }
     $oksetting = $ok ? $dtp->GetResultNP() : $fieldset . "\n" . stripslashes($fieldstring);
 } else {
     //原来的配置为空
     $oksetting = $fieldset . "\n" . stripslashes($fieldstring);
 }
 $addlist = GetAddFieldList($dtp, $oksetting);
 $oksetting = addslashes($oksetting);
 $rs = $dsql->ExecuteNoneQuery("UPDATE #@__member_model SET `info`='{$oksetting}' WHERE id='{$id}' ");
 if (!$rs) {
     $grr = $dsql->GetError();
     ShowMsg("保存节点配置出错!" . $grr, "javascript:;");
コード例 #19
0
ファイル: arclistsg.lib.php プロジェクト: ahmatjan/cmf2
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;
}
コード例 #20
0
 /**
  *  解析模板,对内容里的变动进行赋值
  *
  * @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
         }
         //结束模板循环
     }
 }
コード例 #21
0
ファイル: arc.rssview.class.php プロジェクト: soonfine/leread
 /**
  *  获得文档列表
  *
  * @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;
 }
コード例 #22
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;
 }
コード例 #23
0
ファイル: typelink.class.php プロジェクト: iabing/mzzyc
 /**
  *  获得与该类相关的类目,本函数应用于模板标记{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;
 }
コード例 #24
0
ファイル: booklist.lib.php プロジェクト: klr2003/sourceread
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;
}
コード例 #25
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;
  }
コード例 #26
0
function lib_duoshuo(&$ctag, &$refObj)
{
    global $dsql, $cfg_basehost, $cfg_cmspath;
    $plugin = Duoshuo_Dedecms::getInstance();
    if ($plugin->getOption('short_name') == '' || $plugin->getOption('secret') == '') {
        return '在管理后台进行一步配置,就可以开始使用多说了';
    }
    $attlist = 'type|0';
    FillAttsDefault($ctag->CAttribute->Items, $attlist);
    extract($ctag->CAttribute->Items, EXTR_SKIP);
    if (empty($refObj->Fields['aid'])) {
        return '';
    }
    $arcid = $refObj->Fields['aid'];
    //设置参数
    $attrs = array();
    $attrs[] = ' data-thread-key="' . $arcid . '"';
    $attrs[] = 'data-author-key="' . $refObj->Fields["mid"] . '"';
    /*
    if(empty($refObj->Fields['arcurl'])){
    	$refObj->Fields['arcurl'] = $refObj->GetTrueUrl(null);
    }
    if(strpos($refObj->Fields['arcurl'],$cfg_basehost) === false){
    	$attrs[] = ' data-url="'.$cfg_basehost.$refObj->Fields['arcurl'].'"';
    }
    
    $attrs[] = ' data-url="'.$refObj->Fields['arcurl'].'"';
    */
    $article_url = $refObj->GetTrueUrl(null);
    if (!strpos($article_url, 'http:')) {
        $article_url = $cfg_basehost . $article_url;
    }
    if (!empty($refObj->Fields['litpic']) && !preg_match('/\\/images\\/defaultpic.gif/', $refObj->Fields['litpic'])) {
        $attrs[] = ' data-image="' . $refObj->Fields['litpic'] . '"';
    }
    if (!empty($refObj->Fields['title'])) {
        $attrs[] = 'data-title="' . htmlspecialchars($refObj->Fields['title'], ENT_QUOTES, 'GB2312') . '"';
    }
    //输出评论框
    ob_start();
    require DEDEROOT . '/plus/duoshuo/templates/comments.htm';
    if ($plugin->getOption('seo_enabled') && !empty($arcid)) {
        // 每篇评论最大字数
        $infolen = 200;
        // 每篇文章seo显示的最大行数
        $totalrow = 100;
        $innertext = file_get_contents(DEDEROOT . '/plus/duoshuo/templates/comments_seo.htm');
        ?>
<div id="ds-ssr" class="mt1">
	<dl class="tbox">
		<dt> <strong>评论列表(网友评论仅供网友表达个人看法,并不表明本站同意其观点或证实其描述)</strong> </dt>
		<dd>
			<div class="dede_comment">
				<div class="decmt-box1">
					<ul>
						<li id="commetcontentNew"></li>

<?php 
        $wsql = " WHERE ischeck=1 AND aid = {$arcid}";
        $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['msg'] = jsTrim(Html2Text($arr['msg']), $infolen);
            $arr['dtime'] = GetDateTimeMK($arr['dtime']);
            $arr['username'] = $str = str_replace('&lt;br/&gt;', ' ', $arr['username']);
            foreach ($ctp->CTags as $tagid => $ctag) {
                if (!empty($arr[$ctag->GetName()])) {
                    $ctp->Assign($tagid, $arr[$ctag->GetName()]);
                }
            }
            echo $ctp->GetResult();
        }
        ?>
 
					</ul>
				</div>
			</div>
		</dd>
	</dl>
</div>

<?php 
    }
    return ob_get_clean();
}
コード例 #27
0
ファイル: tag.lib.php プロジェクト: hensonvip/ymroad
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;
}
コード例 #28
0
ファイル: infolink.lib.php プロジェクト: iabing/mzzyc
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;
}
コード例 #29
0
    $tabsql = '';
    //检测旧数据类型,并替换为新配置
    foreach ($dtp->CTags as $tagid => $ctag) {
        if (trim($fieldname) == trim(strtolower($ctag->GetName()))) {
            if (isset($fields[$fieldname]) && $fields[$fieldname] != $buideType) {
                $tabsql = "ALTER TABLE `{$trueTable}` CHANGE `{$fieldname}` " . $ntabsql;
                $dsql->ExecuteNoneQuery($tabsql);
            } else {
                if (!isset($fields[$fieldname])) {
                    $tabsql = "ALTER TABLE `{$trueTable}` ADD " . $ntabsql;
                    $dsql->ExecuteNoneQuery($tabsql);
                } else {
                    $tabsql = '';
                }
            }
            $dtp->Assign($tagid, stripslashes($fieldstring), false);
            break;
        }
    }
    $oksetting = $dtp->GetResultNP();
    $oksetting = addslashes($oksetting);
    $dsql->ExecuteNoneQuery("UPDATE #@__member_model SET info='{$oksetting}' WHERE id='{$id}' ");
    ShowMsg("成功更改一个字段的配置!", "member_model_edit.php?id={$id}");
    exit;
} else {
    if ($action == "disabled") {
        foreach ($dtp->CTags as $tagid => $ctag) {
            if (strtolower($ctag->GetName()) == strtolower($fname)) {
                $statenum = $ctag->GetAtt('state') == 1 ? 0 : 1;
                $fieldstring = "<field:{$ctag->GetName()} itemname=\"{$ctag->GetAtt('itemname')}\" autofield=\"{$ctag->GetAtt('autofield')}\" type=\"{$ctag->GetAtt('type')}\" isnull=\"{$ctag->GetAtt('isnull')}\" default=\"{$ctag->GetAtt('default')}\"  maxlength=\"{$ctag->GetAtt('maxlength')}\" issearch=\"{$ctag->GetAtt('issearch')}\" isshow=\"{$ctag->GetAtt('isshow')}\" state=\"{$statenum}\">\r\n";
                $fieldstring .= "</field:{$ctag->GetName()}>";
コード例 #30
0
	function GetDataList($innertext)
	{
		$timedd = "未知";
		$starttime = ExecTime(); 
		$DataListValue = "";
		if($this->totalResult==0){
			$query = preg_replace("/^(.*)[\s]from[\s]/is",'Select count(*) as dd From ',$this->sourceSql);
			$rowdm = $this->dsql->GetOne($query);
			$this->totalResult = $rowdm['dd'];
		}
		$this->sourceSql .= " limit ".(($this->nowPage-1)*$this->pageSize).",".$this->pageSize;
		$this->dsql->Query('dms',$this->sourceSql);
		//计算执行时间
		$endtime = $this->ExecTime();
		if($starttime!=""&&$endtime!=""){
			$timedd=$endtime-$starttime;
			if($timedd<0) $timedd=$timedd*(-1.0);
			$timedd=substr($timedd,0,5);
		}
		$this->queryTime = $timedd;
		$GLOBALS["limittime"] = $timedd;
		$GLOBALS["totalrecord"] = $this->totalResult;
		////////////////////////////////////////
		$dtp2 = new DedeTagParse();
		$dtp2->TagStartWord="[";
		$dtp2->TagEndWord="]";
		$dtp2->NameSpace="field";
		$dtp2->CharToLow=FALSE;
		$dtp2->LoadSource($innertext);
		$fnum = 0;
		while($GLOBALS["row"] = $this->dsql->GetArray('dms'))
		{
			$fnum++;
			for($i=0;$i<=$dtp2->Count;$i++)
			{
				if(isset($GLOBALS["row"][$dtp2->CTags[$i]->TagName]))
					$dtp2->Assign($i,$GLOBALS["row"][$dtp2->CTags[$i]->TagName]);
				else
					$dtp2->Assign($i,"");
			}
			$DataListValue .= $dtp2->GetResult();
		}
		$GLOBALS["row"] = "";
		return $DataListValue;
	}