示例#1
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;
}
示例#2
0
function GetOneImgUrl($img, $ftype = 1)
{
    if ($img != '') {
        $dtp = new DedeTagParse();
        //var_dump($img);
        $dtp->LoadSource($img);
        //var_dump($img);
        if (is_array($dtp->CTags)) {
            foreach ($dtp->CTags as $ctag) {
                var_dump($ctag->GetName());
                if ($ctag->GetName() == 'img') {
                    $width = $ctag->GetAtt('width');
                    $height = $ctag->GetAtt('height');
                    $imgurl = trim($ctag->GetInnerText());
                    $img = '';
                    //var_dump($imgurl);
                    if ($imgurl != '') {
                        if (1 == 1) {
                            $img .= $imgurl;
                            //var_dump($img);
                        } else {
                            $img .= '<img src="' . $imgurl . '" width="' . $width . '" height="' . $height . '" />';
                        }
                    }
                }
            }
        }
        $dtp->Clear();
        return $img;
    }
}
示例#3
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;
}
示例#4
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;
}
示例#5
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;
}
示例#6
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;
}
示例#7
0
function getListImgSrc($url)
{
    $dtp = new DedeTagParse();
    $dtp->LoadSource($url);
    if ($url != '') {
        if (preg_match("/<[img|IMG].*?src=[\\'|\"](.*?(?:[\\.gif|\\.jpg|\\.png|\\.jpeg]))[\\'|\"].*?[\\/]?>/", $url, $arr)) {
            return $arr[1];
        }
    }
}
示例#8
0
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;
}
示例#9
0
 function getFieldList()
 {
     $dtp = new DedeTagParse();
     $dtp->SetNameSpace("field", "<", ">");
     $dtp->LoadSource($this->info);
     $fields = array();
     if (is_array($dtp->CTags)) {
         foreach ($dtp->CTags as $tagid => $tag) {
             $fields[$tag->GetName()] = array($tag->GetAtt('itemname'), $tag->GetAtt('type'));
         }
     }
     return $fields;
 }
示例#10
0
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
/**
 * 问答调用标签
 *
 * @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
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;
    }
}
示例#13
0
 function __construct($cid, $aid = 0)
 {
     $this->ChannelInfos = '';
     $this->ChannelFields = '';
     $this->AllFieldNames = '';
     $this->SplitPageField = '';
     $this->ChannelID = $cid;
     $this->ArcID = $aid;
     $this->dsql = $GLOBALS['dsql'];
     $sql = " Select * from `#@__channeltype` where id='{$cid}' ";
     $this->ChannelInfos = $this->dsql->GetOne($sql);
     if (!is_array($this->ChannelInfos)) {
         echo '读取频道信息失败,无法进行后续操作!';
         exit;
     }
     $dtp = new DedeTagParse();
     $dtp->SetNameSpace('field', '<', '>');
     $dtp->LoadSource($this->ChannelInfos['fieldset']);
     if (is_array($dtp->CTags)) {
         $tnames = array();
         foreach ($dtp->CTags as $ctag) {
             $tname = $ctag->GetName();
             if (isset($tnames[$tname])) {
                 break;
             }
             $tnames[$tname] = 1;
             if ($this->AllFieldNames != '') {
                 $this->AllFieldNames .= ',' . $tname;
             } else {
                 $this->AllFieldNames .= $tname;
             }
             if (is_array($ctag->CAttribute->Items)) {
                 $this->ChannelFields[$tname] = $ctag->CAttribute->Items;
             }
             $this->ChannelFields[$tname]['value'] = '';
             $this->ChannelFields[$tname]['innertext'] = $ctag->GetInnerText();
             if (empty($this->ChannelFields[$tname]['itemname'])) {
                 $this->ChannelFields[$tname]['itemname'] = $tname;
             }
             if ($ctag->GetAtt('page') == 'split') {
                 $this->SplitPageField = $tname;
             }
         }
     }
     $dtp->Clear();
 }
示例#14
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;
}
示例#15
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;
}
示例#16
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;
}
示例#17
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;
}
示例#18
0
	function __construct($aid)
 	{
		$this->dsql = new DedeSql(false);
		$this->VoteInfos = $this->dsql->GetOne("Select * From #@__vote where aid='$aid'");
		$this->VoteNotes = Array();
		$this->VoteCount = 0;
		$this->VoteID = $aid;
		if(!is_array($this->VoteInfos)) return;
		$dtp = new DedeTagParse();
		$dtp->SetNameSpace("v","<",">");
		$dtp->LoadSource($this->VoteInfos['votenote']);
		if(is_array($dtp->CTags)){
			foreach($dtp->CTags as $ctag){
				$this->VoteNotes[$ctag->GetAtt('id')]['count'] = $ctag->GetAtt('count');
				$this->VoteNotes[$ctag->GetAtt('id')]['name'] = trim($ctag->GetInnerText());
				$this->VoteCount++;
			}
		}
		$dtp->Clear();
	}
示例#19
0
 function __construct($aid)
 {
     $this->dsql = $GLOBALS['dsql'];
     $this->VoteInfos = $this->dsql->GetOne("SELECT * FROM `#@__vote` WHERE aid='{$aid}'");
     $this->VoteNotes = array();
     $this->VoteCount = 0;
     $this->VoteID = $aid;
     if (!is_array($this->VoteInfos)) {
         return;
     }
     $dtp = new DedeTagParse();
     $dtp->SetNameSpace("v", "<", ">");
     $dtp->LoadSource($this->VoteInfos['votenote']);
     if (is_array($dtp->CTags)) {
         foreach ($dtp->CTags as $ctag) {
             $this->VoteNotes[$ctag->GetAtt('id')]['count'] = $ctag->GetAtt('count');
             $this->VoteNotes[$ctag->GetAtt('id')]['name'] = trim($ctag->GetInnerText());
             $this->VoteCount++;
         }
     }
     $dtp->Clear();
 }
示例#20
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;
    }
}
示例#21
0
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;
}
示例#22
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;
}
示例#23
0
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;
}
示例#24
0
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;
}
示例#25
0
    $topid = $arcRow['topid'];
    $arcurl = @GetFileUrl($aid, $arcRow['typeid'], $arcRow['senddate'], $arctitle, $arcRow['ismake'], $arcRow['arcrank'], $arcRow['namerule'], $arcRow['typedir'], $arcRow['money'], $arcRow['filename'], $arcRow['moresite'], $arcRow['siteurl'], $arcRow['sitepath']);
} else {
    ShowMsg('无法浏览未知文档!', '-1');
    exit;
}
if (empty($mx)) {
    $mx = $cfg_album_width;
}
$pageGuide = "";
//获取上下幅图片链接
$row = $dsql->GetOne("SELECT imgurls FROM `#@__addonimages` WHERE aid='{$aid}'");
$i = 0;
$nextSrc = '';
$preSrc = '';
$dtp = new DedeTagParse();
$dtp->LoadSource($row['imgurls']);
foreach ($dtp->CTags as $ctag) {
    if ($ctag->GetName() == "img") {
        if ($i == $npos - 1) {
            $preSrc = trim($ctag->GetInnerText());
        }
        if ($i == $npos + 1) {
            $nextSrc = trim($ctag->GetInnerText());
        }
        $i++;
    }
}
unset($dtp);
if ($cfg_multi_site == 'Y') {
    if (!preg_match("/^http:/i", $preSrc) && !empty($preSrc)) {
示例#26
0
             } else {
                 if ($fieldtype == 'dtime') {
                     $dfvalue = time();
                 } else {
                     $dfvalue = '';
                 }
             }
         }
         $inadd_v .= ",'{$dfvalue}'";
     } else {
         $inadd_v .= ",'@{$tname}@'";
     }
 }
 $addSqlTemplate = "INSERT INTO `{$addtable}`(`aid`,`typeid`{$inadd_f}) Values('@aid@','@typeid@'{$inadd_v})";
 //导出数据的SQL操作
 $dtp = new DedeTagParse();
 $totalpage = $totalcc / $pagesize;
 $startdd = ($pageno - 1) * $pagesize;
 if (!empty($nid)) {
     $dsql->SetQuery("SELECT * FROM `#@__co_htmls` WHERE nid='{$nid}' AND isdown='1' ORDER BY aid {$orderway} LIMIT {$startdd},{$pagesize}");
 } else {
     $dsql->SetQuery("SELECT * FROM `#@__co_htmls` WHERE isdown='1' ORDER BY aid {$orderway} LIMIT {$startdd},{$pagesize}");
 }
 $dsql->Execute();
 while ($row = $dsql->GetObject()) {
     if (trim($row->result == '')) {
         continue;
     }
     //$addSqlTemplate,$mainSqlTemplate,$indexSqlTemplate
     $ntypeid = $autotype == 1 && $row->typeid != 0 ? $row->typeid : $typeid;
     $indexSql = str_replace('@typeid@', $ntypeid, $indexSqlTemplate);
示例#27
0
function GetFormItemValue($ctag, $fvalue)
{
    $fieldname = $ctag->GetName();
    $formitem = "\r\n\t\t<table width=\"800\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\r\n       <tr>\r\n        <td width=\"80\">~name~</td>\r\n        <td width=\"720\">~form~</td>\r\n       </tr>\r\n    </table>\r\n";
    $innertext = trim($ctag->GetInnerText());
    if ($innertext != "") {
        if ($ctag->GetAtt("type") == 'select') {
            $myformItem = '';
            $items = explode(',', $innertext);
            $myformItem = "<select name='{$fieldname}' style='width:150px'>";
            foreach ($items as $v) {
                $v = trim($v);
                if ($v != '') {
                    if ($fvalue == $v) {
                        $myformItem .= "<option value='{$v}' selected>{$v}</option>\r\n";
                    } else {
                        $myformItem .= "<option value='{$v}'>{$v}</option>\r\n";
                    }
                }
            }
            $myformItem .= "</select>\r\n";
            $formitem = str_replace("~name~", $ctag->GetAtt('itemname'), $formitem);
            $formitem = str_replace("~form~", $myformItem, $formitem);
            return $formitem;
        } else {
            if ($ctag->GetAtt("type") == 'radio') {
                $myformItem = '';
                $items = explode(',', $innertext);
                foreach ($items as $v) {
                    $v = trim($v);
                    if ($v != '') {
                        if ($fvalue == $v) {
                            $myformItem .= "<input type='radio' name='{$fieldname}' class='np' value='{$v}' checked>{$v}\r\n";
                        } else {
                            $myformItem .= "<input type='radio' name='{$fieldname}' class='np' value='{$v}'>{$v}\r\n";
                        }
                    }
                }
                $formitem = str_replace("~name~", $ctag->GetAtt('itemname'), $formitem);
                $formitem = str_replace("~form~", $myformItem, $formitem);
                return $formitem;
            } else {
                $formitem = str_replace('~name~', $ctag->GetAtt('itemname'), $formitem);
                $formitem = str_replace('~form~', $innertext, $formitem);
                $formitem = str_replace('@value', $fvalue, $formitem);
                return $formitem;
            }
        }
    }
    //文本数据的特殊处理
    if ($ctag->GetAtt("type") == "textdata") {
        if (is_file($GLOBALS['cfg_basedir'] . $fvalue)) {
            $fp = fopen($GLOBALS['cfg_basedir'] . $fvalue, 'r');
            $okfvalue = "";
            while (!feof($fp)) {
                $okfvalue .= fgets($fp, 1024);
            }
            fclose($fp);
        } else {
            $okfvalue = "";
        }
        $formitem = "<table width=\"800\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td width=\"80\">" . $ctag->GetAtt('itemname') . "</td>\r\n";
        $formitem .= "<td>\r\n" . GetEditor($fieldname, $okfvalue, 350, 'Basic', 'string') . "</td>\r\n";
        $formitem .= "</tr></table>\r\n";
        $formitem .= "<input type='hidden' name='{$fieldname}_file' value='{$fvalue}'>\r\n";
        return $formitem;
    } else {
        if ($ctag->GetAtt("type") == "htmltext") {
            $formitem = "<table width=\"800\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td width=\"80\">" . $ctag->GetAtt('itemname') . "</td>\r\n";
            $formitem .= "<td>\r\n" . GetEditor($fieldname, $fvalue, 350, 'Basic', 'string') . "</td>\r\n";
            $formitem .= "</tr></table>\r\n";
            return $formitem;
        } else {
            if ($ctag->GetAtt("type") == "multitext") {
                $innertext = "<textarea name='{$fieldname}' id='{$fieldname}' style='width:100%;height:80'>{$fvalue}</textarea>\r\n";
                $formitem = str_replace("~name~", $ctag->GetAtt('itemname'), $formitem);
                $formitem = str_replace("~form~", $innertext, $formitem);
                return $formitem;
            } else {
                if ($ctag->GetAtt("type") == "datetime") {
                    $nowtime = GetDateTimeMk($fvalue);
                    $innertext = "<input name=\"{$fieldname}\" value=\"{$nowtime}\" type=\"text\" id=\"{$fieldname}\" style=\"width:200\">";
                    $innertext .= "<input name=\"selPubtime\" type=\"button\" id=\"selkeyword\" value=\"选择\" onClick=\"showCalendar('{$fieldname}', 'Y-m-d H:i:00', '24');\">";
                    $formitem = str_replace("~name~", $ctag->GetAtt('itemname'), $formitem);
                    $formitem = str_replace("~form~", $innertext, $formitem);
                    return $formitem;
                } else {
                    if ($ctag->GetAtt("type") == "img") {
                        $ndtp = new DedeTagParse();
                        $ndtp->LoadSource($fvalue);
                        if (!is_array($ndtp->CTags)) {
                            $ndtp->Clear();
                            $fvalue = "";
                        }
                        $ntag = $ndtp->GetTag("img");
                        $fvalue = trim($ntag->GetInnerText());
                        $innertext = "<input type='text' name='{$fieldname}' value='{$fvalue}' id='{$fieldname}' style='width:300'><input name='" . $fieldname . "_bt' type='button' value='浏览...' onClick=\"SelectImage('form1.{$fieldname}','big')\">\r\n";
                        $formitem = str_replace("~name~", $ctag->GetAtt('itemname'), $formitem);
                        $formitem = str_replace("~form~", $innertext, $formitem);
                        return $formitem;
                    } else {
                        if ($ctag->GetAtt("type") == "media") {
                            $innertext = "<input type='text' name='{$fieldname}' value='{$fvalue}' id='{$fieldname}' style='width:300'><input name='" . $fieldname . "_bt' type='button' value='浏览...' onClick=\"SelectMedia('form1.{$fieldname}')\">\r\n";
                            $formitem = str_replace("~name~", $ctag->GetAtt('itemname'), $formitem);
                            $formitem = str_replace("~form~", $innertext, $formitem);
                            return $formitem;
                        } else {
                            if ($ctag->GetAtt("type") == "addon") {
                                $innertext = "<input type='text' name='{$fieldname}' id='{$fieldname}' value='{$fvalue}' style='width:300'><input name='" . $fieldname . "_bt' type='button' value='浏览...' onClick=\"SelectSoft('form1.{$fieldname}')\">\r\n";
                                $formitem = str_replace("~name~", $ctag->GetAtt('itemname'), $formitem);
                                $formitem = str_replace("~form~", $innertext, $formitem);
                                return $formitem;
                            } else {
                                $innertext = "<input type='text' name='{$fieldname}' id='{$fieldname}' style='width:200' value='{$fvalue}'>\r\n";
                                $formitem = str_replace("~name~", $ctag->GetAtt('itemname'), $formitem);
                                $formitem = str_replace("~form~", $innertext, $formitem);
                                return $formitem;
                            }
                        }
                    }
                }
            }
        }
    }
}
 */
require_once dirname(__FILE__) . "/config.php";
//增加权限检查
require_once DEDEINC . "/dedetag.class.php";
require_once DEDEADMIN . "/inc/inc_admin_channel.php";
if (empty($action)) {
    $action = '';
}
//获取模型信息
$mysql_version = $dsql->GetVersion();
$mysql_versions = explode(".", trim($mysql_version));
$mysql_version = $mysql_versions[0] . "." . $mysql_versions[1];
$row = $dsql->GetOne("SELECT `table`,`info` FROM #@__member_model WHERE id='{$id}'");
$fieldset = $row['info'];
$trueTable = $row['table'];
$dtp = new DedeTagParse();
$dtp->SetNameSpace("field", "<", ">");
$dtp->LoadSource($fieldset);
foreach ($dtp->CTags as $ctag) {
    if (strtolower($ctag->GetName()) == strtolower($fname)) {
        break;
    }
}
//字段类型信息
$ds = file(DEDEADMIN . "/inc/fieldtype.txt");
foreach ($ds as $d) {
    $dds = explode(',', trim($d));
    $fieldtypes[$dds[0]] = $dds[1];
}
//保存更改
/*--------------------
示例#29
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;
}
示例#30
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;
  }