function GetOneImgUrl($img, $ftype = 1) { if ($img != '') { $dtp = new DedeTagParse(); $dtp->LoadSource($img); if (is_array($dtp->CTags)) { foreach ($dtp->CTags as $ctag) { if ($ctag->GetName() == 'img') { $width = $ctag->GetAtt('width'); $height = $ctag->GetAtt('height'); $imgurl = trim($ctag->GetInnerText()); $img = ''; if ($imgurl != '') { if ($ftype == 1) { $img .= $imgurl; } else { $img .= '<img src="' . $imgurl . '" width="' . $width . '" height="' . $height . '" />'; } } } } } $dtp->Clear(); return $img; } }
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(); }
/** * 专题主题调用标签 * * @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; }
/** * * * @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; }
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(); }
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(); }
function LoadConfig($configString) { $dtp = new DedeTagParse(); $dtp->SetNameSpace("dede","{","}"); $dtp2 = new DedeTagParse(); $dtp2->SetNameSpace("dede","{","}"); $dtp3 = new DedeTagParse(); $dtp3->SetNameSpace("dede","{","}"); $dtp->LoadString($configString); for($i=0;$i<=$dtp->Count;$i++) { $ctag = $dtp->CTags[$i]; //item 配置 //节点基本信息 if($ctag->GetName()=="item") { $this->Item["name"] = $ctag->GetAtt("name"); $this->Item["typeid"] = $ctag->GetAtt("typeid"); $this->Item["imgurl"] = $ctag->GetAtt("imgurl"); $this->Item["imgdir"] = $ctag->GetAtt("imgdir"); $this->Item["language"] = $ctag->GetAtt("language"); $this->Item["matchtype"] = $ctag->GetAtt("matchtype"); $this->Item["isref"] = $ctag->GetAtt("isref"); $this->Item["refurl"] = $ctag->GetAtt("refurl"); $this->Item["exptime"] = $ctag->GetAtt("exptime"); if($this->Item["matchtype"]=="") $this->Item["matchtype"]="string"; //创建图片保存目录 $updir = dirname(__FILE__)."/".$this->Item["imgdir"]."/"; $updir = str_replace("\\","/",$updir); $updir = preg_replace("/\/{1,}/","/",$updir); if(!is_dir($updir)) MkdirAll($updir,$GLOBALS['cfg_dir_purview']); } //list 配置 //要采集的列表页的信息 else if($ctag->GetName()=="list") { $this->List["varstart"]= $ctag->GetAtt("varstart"); $this->List["varend"] = $ctag->GetAtt("varend"); $this->List["source"] = $ctag->GetAtt("source"); $this->List["sourcetype"] = $ctag->GetAtt("sourcetype"); $dtp2->LoadString($ctag->GetInnerText()); for($j=0;$j<=$dtp2->Count;$j++) { $ctag2 = $dtp2->CTags[$j]; $tname = $ctag2->GetName(); if($tname=="need"){ $this->List["need"] = trim($ctag2->GetInnerText()); }else if($tname=="cannot"){ $this->List["cannot"] = trim($ctag2->GetInnerText()); } else if($tname=="linkarea"){ $this->List["linkarea"] = trim($ctag2->GetInnerText()); }else if($tname=="url") { $gurl = trim($ctag2->GetAtt("value")); //手工指定列表网址 if($this->List["source"]=="app") { $turl = trim($ctag2->GetInnerText()); $turls = explode("\n",$turl); $l_tj = 0; foreach($turls as $turl){ $turl = trim($turl); if($turl=="") continue; if(!eregi("^http://",$turl)) $turl = "http://".$turl; $this->List["url"][$l_tj] = $turl; $l_tj++; } } //用分页变量产生的网址 else { if(eregi("var:分页",trim($ctag2->GetAtt("value")))){ if($this->List["varstart"]=="") $this->List["varstart"]=1; if($this->List["varend"]=="") $this->List["varend"]=10; $l_tj = 0; for($l_em = $this->List["varstart"];$l_em<=$this->List["varend"];$l_em++){ $this->List["url"][$l_tj] = str_replace("[var:分页]",$l_em,$gurl); $l_tj++; } }//if set var else{ $this->List["url"][0] = $gurl; } } } }//End inner Loop1 } //art 配置 //要采集的文章页的信息 else if($ctag->GetName()=="art") { $dtp2->LoadString($ctag->GetInnerText()); for($j=0;$j<=$dtp2->Count;$j++) { $ctag2 = $dtp2->CTags[$j]; //文章要采集的字段的信息及处理方式 if($ctag2->GetName()=="note"){ $field = $ctag2->GetAtt('field'); if($field == "") continue; $this->ArtNote[$field]["value"] = $ctag2->GetAtt('value'); $this->ArtNote[$field]["isunit"] = $ctag2->GetAtt('isunit'); $this->ArtNote[$field]["isdown"] = $ctag2->GetAtt('isdown'); $dtp3->LoadString($ctag2->GetInnerText()); for($k=0;$k<=$dtp3->Count;$k++) { $ctag3 = $dtp3->CTags[$k]; if($ctag3->GetName()=="trim"){ $this->ArtNote[$field]["trim"][] = $ctag3->GetInnerText(); } else if($ctag3->GetName()=="match"){ $this->ArtNote[$field]["match"] = $ctag3->GetInnerText(); } else if($ctag3->GetName()=="function"){ $this->ArtNote[$field]["function"] = $ctag3->GetInnerText(); } } } else if($ctag2->GetName()=="sppage"){ $this->ArtNote["sppage"] = $ctag2->GetInnerText(); $this->ArtNote["sptype"] = $ctag2->GetAtt('sptype'); } }//End inner Loop2 } }//End Loop $dtp->Clear(); $dtp2->Clear(); }
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; } } } } } } } }
$addQuery = "SELECT * FROM `{$addtable}` WHERE aid='{$aid}'"; $addRow = $dsql->GetOne($addQuery); $newRowStart = 1; $nForm = ''; if (isset($addRow['softlinks']) && $addRow['softlinks'] != '') { $dtp = new DedeTagParse(); $dtp->LoadSource($addRow['softlinks']); if (is_array($dtp->CTags)) { foreach ($dtp->CTags as $ctag) { if ($ctag->GetName() == 'link') { $nForm .= "软件地址" . $newRowStart . ":<input class='text' type='text' name='softurl" . $newRowStart . "' value='" . trim($ctag->GetInnerText()) . "' />\r\n 服务器名称:<input class='text' type='text' name='servermsg" . $newRowStart . "' value='" . $ctag->GetAtt("text") . "' />\r\n <br />"; $newRowStart++; } } } $dtp->Clear(); } $channelid = $row['channel']; $tags = GetTags($aid); include DEDEMEMBER . "/templets/soft_edit.htm"; exit; } else { if ($dopost == 'save') { $description = ''; include DEDEMEMBER . '/inc/archives_check_edit.php'; //分析处理附加表数据 $inadd_f = ''; if (!empty($dede_addonfields)) { $addonfields = explode(';', $dede_addonfields); if (is_array($addonfields)) { foreach ($addonfields as $v) {
function GetImgLinks($fvalue) { $revalue = ""; $dtp = new DedeTagParse(); $dtp->LoadSource($fvalue); if(!is_array($dtp->CTags)){ $dtp->Clear(); return "无图片信息!"; } $ptag = $dtp->GetTag("pagestyle"); if(is_object($ptag)){ $pagestyle = $ptag->GetAtt('value'); $maxwidth = $ptag->GetAtt('maxwidth'); $ddmaxwidth = $ptag->GetAtt('ddmaxwidth'); $irow = $ptag->GetAtt('row'); $icol = $ptag->GetAtt('col'); if(empty($maxwidth)) $maxwidth = $GLOBALS['cfg_album_width']; }else{ $pagestyle = 2; $maxwidth = $GLOBALS['cfg_album_width']; $ddmaxwidth = 200; } if($pagestyle == 3){ if(empty($irow)) $irow = 4; if(empty($icol)) $icol = 4; } //遍历图片信息 $mrow = 0; $mcol = 0; $photoid = 0; $images = array(); $sysimgpath = $GLOBALS['cfg_templeturl']."/sysimg"; foreach($dtp->CTags as $ctag){ if($ctag->GetName()=="img"){ $iw = $ctag->GetAtt('width'); $ih = $ctag->GetAtt('heigth'); $alt = str_replace("'","",$ctag->GetAtt('text')); $src = trim($ctag->GetInnerText()); $ddimg = $ctag->GetAtt('ddimg'); if($iw > $maxwidth) $iw = $maxwidth; $iw = (empty($iw) ? "" : "width='$iw'"); //全部列出式或分页式图集 if($pagestyle<3){ if($revalue==""){ if($pagestyle==2){ $playsys = " <div class='butbox'> <a href='$src' target='_blank' class='c1'>原始图片</a>\r\n <a href='javascript:dPlayPre();' class='c1'>上一张</a>\r\n <a href='javascript:dPlayNext();' class='c1'>下一张</a>\r\n <a href='javascript:dStopPlay();' class='c1'>自动 / 暂停播放</a>\r\n </div>\r\n"; $revalue = " {$playsys} <div class='imgview'>\r\n <center> <a href='javascript:dPlayNext();'><img src='$src' alt='$alt'/></a>\r\n </center> </div>\r\n <script language='javascript'>dStartPlay();</script>\r\n"; } else $revalue = " <div class='imgview'>\r\n <center> <a href='$src' target='_blank'><img src='$src' alt='$alt' /></a>\r\n </center> </div>\r\n"; }else{ if($pagestyle==2){ $playsys = " <div class='butbox'> <a href='$src' target='_blank' class='c1'>原始图片</a>\r\n <a href='javascript:dPlayPre();' class='c1'>上一张</a>\r\n <a href='javascript:dPlayNext();' class='c1'>下一张</a>\r\n <a href='javascript:dStopPlay();' class='c1'>自动 / 暂停播放</a>\r\n </div>\r\n"; $revalue .= "#p#分页标题#e# {$playsys} <div class='imgview'>\r\n <center> <a href='javascript:dPlayNext();'><img src='$src' alt='$alt'/></a>\r\n </center> </div>\r\n <script language='javascript'>dStartPlay();</script>\r\n"; } else $revalue .= " <div class='imgview'>\r\n <center> <a href='$src' target='_blank'><img src='$src' alt='$alt' /></a>\r\n </center> </div>\r\n"; } //多列式图集 }else if($pagestyle==3){ $images[$photoid][0] = $src; $images[$photoid][1] = $alt; $images[$photoid][2] = $ddimg; $photoid++; } } } //重新运算多列式图集 if($pagestyle==3){ if(empty($ddmaxwidth)) $ddmaxwidth = 200; $picnum = count($images); $sPos = 0; if($icol==0) $icol = 1; $tdwidth = ceil(100 / $icol); while($sPos < $picnum){ for($i=0;$i < $irow;$i++){ //$revalue .= "<ul class='imgline'>\r\n"; for($j=0;$j < $icol;$j++){ if(!isset($images[$sPos])){ $revalue .= ""; } else{ $src = $images[$sPos][0]; $alt = $images[$sPos][1]; $litsrc = $images[$sPos][2]; $tpwidth = $ddmaxwidth; if($litsrc==''){ $litsrc = $src; $tpwidth = ''; }else{ $tpwidth = " width='$tpwidth'"; } //多行多列imgurls标签生成代码 $revalue .= "<dl>\r\n <dt><a href='{$GLOBALS['cfg_phpurl']}/showphoto.php?aid={$this->ArcID}&src=".urlencode($src)."&npos=$sPos' target='_blank'><img src='$litsrc' alt='$alt'{$tpwidth} border='0'/></a></dt>\r\n <dd class='title'><img src='/templets/images/ico_15.gif' /><a href='{$GLOBALS['cfg_phpurl']}/showphoto.php?aid={$this->ArcID}&src=".urlencode($src)."&npos=$sPos' target='_blank'>$alt</a></dd>\r\n </dl>\r\n"; $sPos++; } } //$revalue .= "</ul>\r\n"; if(!isset($images[$sPos])) break; } if(!isset($images[$sPos])){ break; }else{ $revalue .= "#p#分页标题#e#"; } } } unset($dtp); unset($images); return $revalue; }
function ch_softlinks_all($fvalue, &$ctag, &$refObj, &$row) { global $dsql, $cfg_phpurl; $phppath = $cfg_phpurl; $dtp = new DedeTagParse(); $dtp->LoadSource($fvalue); if (!is_array($dtp->CTags)) { $dtp->Clear(); return "无链接信息!"; } $tempStr = GetSysTemplets('channel_downlinks.htm'); $downlinks = ''; foreach ($dtp->CTags as $ctag) { if ($ctag->GetName() == 'link') { $link = trim($ctag->GetInnerText()); $serverName = trim($ctag->GetAtt('text')); $islocal = trim($ctag->GetAtt('islocal')); //分析本地链接 if (!isset($firstLink) && $islocal == 1) { $firstLink = $link; } if ($islocal == 1 && $row['islocal'] != 1) { continue; } //支持http,迅雷下载,ftp,flashget if (!eregi('^http://|^thunder://|^ftp://|^flashget://', $link)) { $link = $GLOBALS['cfg_mainsite'] . $link; } $downloads = getDownloads($link); $uhash = substr(md5($link), 0, 24); if ($row['gotojump'] == 1) { $link = $phppath . "/download.php?open=2&id={$refObj->ArcID}&uhash={$uhash}"; } $temp = str_replace("~link~", $link, $tempStr); $temp = str_replace("~server~", $serverName, $temp); $temp = str_replace("~downloads~", $downloads, $temp); $downlinks .= $temp; } } $dtp->Clear(); //获取镜像功能的地址 //必须设置为:[根据本地地址和服务器列表自动生成] 的情况 $linkCount = 1; if ($row['ismoresite'] == 1 && $row['moresitedo'] == 1 && trim($row['sites']) != '' && isset($firstLink)) { $firstLink = eregi_replace("http://([^/]*)/", '/', $firstLink); $row['sites'] = ereg_replace("[\r\n]{1,}", "\n", $row['sites']); $sites = explode("\n", trim($row['sites'])); foreach ($sites as $site) { if (trim($site) == '') { continue; } list($link, $serverName) = explode('|', $site); $link = trim(ereg_replace("/\$", "", $link)) . $firstLink; $downloads = getDownloads($link); $uhash = substr(md5($link), 0, 24); if ($row['gotojump'] == 1) { $link = $phppath . "/download.php?open=2&id={$refObj->ArcID}&uhash={$uhash}"; } $temp = str_replace("~link~", $link, $tempStr); $temp = str_replace("~server~", $serverName, $temp); $temp = str_replace("~downloads~", $downloads, $temp); $downlinks .= $temp; } } return $downlinks; }
/** * 分析采集文章页的字段的设置 * * @access public * @param string $configString 配置字符串 * @return void */ function LoadItemConfig($configString) { $dtp = new DedeTagParse(); $dtp2 = new DedeTagParse(); $dtp->LoadString($configString); for ($i = 0; $i <= $dtp->Count; $i++) { $ctag = $dtp->CTags[$i]; if ($ctag->GetName() == 'sppage') { $this->artNotes['sppage'] = $ctag->GetInnerText(); $this->artNotes['sptype'] = $ctag->GetAtt('sptype'); $this->spNotes['srul'] = $ctag->GetAtt('srul'); $this->spNotes['erul'] = $ctag->GetAtt('erul'); } else { if ($ctag->GetName() == 'previewurl') { $this->artNotes['previewurl'] = $ctag->GetInnerText(); } else { if ($ctag->GetName() == 'keywordtrim') { $this->artNotes['keywordtrim'] = $ctag->GetInnerText(); } else { if ($ctag->GetName() == 'descriptiontrim') { $this->artNotes['descriptiontrim'] = $ctag->GetInnerText(); } else { if ($ctag->GetName() == 'item') { $field = $ctag->GetAtt('field'); if ($field == '') { continue; } $this->artNotes[$field]['value'] = $ctag->GetAtt('value'); $this->artNotes[$field]['isunit'] = $ctag->GetAtt('isunit'); $this->artNotes[$field]['isdown'] = $ctag->GetAtt('isdown'); $this->artNotes[$field]['trim'] = array(); $this->artNotes[$field]['match'] = ''; $this->artNotes[$field]['function'] = ''; $t = 0; $dtp2->LoadString($ctag->GetInnerText()); for ($k = 0; $k <= $dtp2->Count; $k++) { $ctag2 = $dtp2->CTags[$k]; if ($ctag2->GetName() == 'trim') { $this->artNotes[$field]['trim'][$t][0] = str_replace('#n#', ' ', $ctag2->GetInnerText()); $this->artNotes[$field]['trim'][$t][1] = $ctag2->GetAtt('replace'); $t++; } else { if ($ctag2->GetName() == 'match') { $this->artNotes[$field]['match'] = str_replace('#n#', ' ', $ctag2->GetInnerText()); } else { if ($ctag2->GetName() == 'function') { $this->artNotes[$field]['function'] = $ctag2->GetInnerText(); } } } } } } } } } } //End Loop $dtp->Clear(); $dtp2->Clear(); }
/** * 获取缩略图链接 * * @access public * @param string $fvalue 表单值 * @return string */ function GetlitImgLinks($fvalue) { if ($GLOBALS["htmltype"] == "dm") { if (empty($GLOBALS["pageno"])) { $NowPage = 1; } else { $NowPage = intval($GLOBALS["pageno"]); } } else { if (empty($GLOBALS["stNowPage"])) { $NowPage = 1; } else { $NowPage = intval($GLOBALS["stNowPage"]); } } $revalue = ""; $dtp = new DedeTagParse(); $dtp->LoadSource($fvalue); if (!is_array($dtp->CTags)) { $dtp->Clear(); return "无图片信息!"; } $ptag = $dtp->GetTag("pagestyle"); if (is_object($ptag)) { $pagestyle = $ptag->GetAtt('value'); $maxwidth = $ptag->GetAtt('maxwidth'); $ddmaxwidth = $ptag->GetAtt('ddmaxwidth'); $irow = $ptag->GetAtt('row'); $icol = $ptag->GetAtt('col'); if (empty($maxwidth)) { $maxwidth = $GLOBALS['cfg_album_width']; } } else { $pagestyle = 2; $maxwidth = $GLOBALS['cfg_album_width']; $ddmaxwidth = 200; } if ($pagestyle == 3) { if (empty($irow)) { $irow = 4; } if (empty($icol)) { $icol = 4; } } $mrow = 0; $mcol = 0; $photoid = 1; $images = array(); $TotalPhoto = sizeof($dtp->CTags); foreach ($dtp->CTags as $ctag) { if ($ctag->GetName() == "img") { $iw = $ctag->GetAtt('width'); $ih = $ctag->GetAtt('heigth'); $alt = str_replace("'", "", $ctag->GetAtt('text')); $src = trim($ctag->GetInnerText()); $ddimg = $ctag->GetAtt('ddimg'); if ($iw > $maxwidth) { $iw = $maxwidth; } $iw = empty($iw) ? "" : "width='{$iw}'"; if ($GLOBALS["htmltype"] == "dm") { $imgurl = "view.php?aid={$this->ArcID}&pageno={$photoid}"; } else { if ($photoid == 1) { $imgurl = $GLOBALS["fileFirst"] . ".html"; } else { $imgurl = $GLOBALS["fileFirst"] . "_" . $photoid . ".html"; } } $imgcls = "image" . ($photoid - 1); $revalue .= "<dl><dt>{$alt}<dd>{$ddimg}<dd>{$ddimg}<dd>{$ddimg}<dd><dd><div></div><div></div><dd><dd>{$photoid}</dd></dl>\r\n"; $photoid++; } } unset($dtp); unset($images); return $revalue; }
/** * 图像标签 * * @version $Id:img.lib.php 1 9:33 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_img($fvalue, &$arcTag, &$refObj, $fname = '') { global $cfg_album_width, $cfg_album_row, $cfg_album_col, $cfg_album_pagesize, $cfg_album_style, $cfg_album_ddwidth, $cfg_basehost, $cfg_multi_site; $dtp = new DedeTagParse(); $dtp->LoadSource($fvalue); if (!is_array($dtp->CTags)) { $dtp->Clear(); return "无图片信息!"; } $pagestyle = $cfg_album_style; $maxwidth = $cfg_album_width; $ddmaxwidth = $cfg_album_ddwidth; $pagepicnum = $cfg_album_pagesize; $row = $cfg_album_row; $icol = $cfg_album_col; $ptag = $dtp->GetTag('pagestyle'); if (is_object($ptag)) { $pagestyle = $ptag->GetAtt('value'); $maxwidth = $ptag->GetAtt('maxwidth'); $ddmaxwidth = $ptag->GetAtt('ddmaxwidth'); $pagepicnum = $ptag->GetAtt('pagepicnum'); $irow = $ptag->GetAtt('row'); $icol = $ptag->GetAtt('col'); if (empty($maxwidth)) { $maxwidth = $cfg_album_width; } } //遍历图片信息 $mrow = 0; $mcol = 0; $images = array(); $innerTmp = $arcTag->GetInnerText(); if (trim($innerTmp) == '') { $innerTmp = GetSysTemplets("channel_article_image.htm"); } if ($pagestyle == 1) { $pagesize = $pagepicnum; } else { if ($pagestyle == 2) { $pagesize = 1; } else { $pagesize = $irow * $icol; } } if (is_object($arcTag) && $arcTag->GetAtt('pagesize') > 0) { $pagesize = $arcTag->GetAtt('pagesize'); } if (empty($pagesize)) { $pagesize = 12; } $aid = $refObj->ArcID; $row = $refObj->dsql->GetOne("SELECT title FROM `#@__archives` WHERE `id` = '{$aid}';"); $title = $row['title']; $revalue = ''; $GLOBAL['photoid'] = 0; foreach ($dtp->CTags as $ctag) { if ($ctag->GetName() == "img") { $fields = $ctag->CAttribute->Items; $fields['text'] = str_replace("'", "", $ctag->GetAtt('text')); $fields['title'] = $title; $fields['imgsrc'] = trim($ctag->GetInnerText()); $fields['imgsrctrue'] = $fields['imgsrc']; if (empty($fields['ddimg'])) { $fields['ddimg'] = $fields['imgsrc']; } if ($cfg_multi_site == 'Y') { //$cfg_basehost) if (!preg_match('#^http:#i', $fields['imgsrc'])) { $fields['imgsrc'] = $cfg_basehost . $fields['imgsrc']; } if (!preg_match('#^http:#i', $fields['ddimg'])) { $fields['ddimg'] = $cfg_basehost . $fields['ddimg']; } } if (empty($fields['width'])) { $fields['width'] = $maxwidth; } //if($fields['text']=='') //{ //$fields['text'] = '图片'.($GLOBAL['photoid']+1); //} $fields['alttext'] = str_replace("'", '', $fields['text']); $fields['pagestyle'] = $pagestyle; $dtp2 = new DedeTagParse(); $dtp2->SetNameSpace("field", "[", "]"); $dtp2->LoadSource($innerTmp); if ($GLOBAL['photoid'] > 0 && $GLOBAL['photoid'] % $pagesize == 0) { $revalue .= "#p#分页标题#e#"; } if ($pagestyle == 1) { $fields['imgwidth'] = ''; $fields['linkurl'] = $fields['imgsrc']; $fields['textlink'] = "<br /><a href='{$fields['linkurl']}' target='_blank'>{$fields['text']}</a>"; } else { if ($pagestyle == 2) { if ($fields['width'] > $maxwidth) { $fields['imgwidth'] = " width='{$maxwidth}' "; } else { $fields['imgwidth'] = " width='{$fields['width']}' "; } $fields['linkurl'] = $fields['imgsrc']; if ($fields['text'] != '') { $fields['textlink'] = "<br /><a href='{$fields['linkurl']}' target='_blank'>{$fields['text']}</a>\r\n"; } else { $fields['textlink'] = ''; } } else { if ($pagestyle == 3) { $fields['text'] = $fields['textlink'] = ''; $fields['imgsrc'] = $fields['ddimg']; $fields['imgwidth'] = " width='{$ddmaxwidth}' "; $fields['linkurl'] = "{$GLOBALS['cfg_phpurl']}/showphoto.php?aid={$refObj->ArcID}&src=" . urlencode($fields['imgsrctrue']) . "&npos={$GLOBAL['photoid']}"; } } } if (is_array($dtp2->CTags)) { foreach ($dtp2->CTags as $tagid => $ctag) { if (isset($fields[$ctag->GetName()])) { $dtp2->Assign($tagid, $fields[$ctag->GetName()]); } } $revalue .= $dtp2->GetResult(); } $GLOBAL['photoid']++; } } return $revalue; }
function Display($modfile = "") { global $cfg_templets_dir, $wecome_info, $cfg_basedir; if (empty($wecome_info)) { $wecome_info = "DedeCms OX 通用对话框:"; } $ctp = new DedeTagParse(); if ($modfile == '') { $ctp->LoadTemplate($cfg_basedir . $cfg_templets_dir . '/plus/win_templet.htm'); } else { $ctp->LoadTemplate($modfile); } $emnum = $ctp->Count; for ($i = 0; $i <= $emnum; $i++) { if (isset($GLOBALS[$ctp->CTags[$i]->GetTagName()])) { $ctp->Assign($i, $GLOBALS[$ctp->CTags[$i]->GetTagName()]); } } $ctp->Display(); $ctp->Clear(); }
/** * 获得带值的表单(编辑时用) * * @access public * @param object $ctag 标签 * @param mixed $fvalue 变量值 * @param string $admintype 会员类型 * @param string $fieldname 变量名称 * @return string */ function GetFormItemValue($ctag, $fvalue, $admintype = 'admin', $fieldname = '') { global $cfg_basedir, $dsql; $fieldname = $ctag->GetName(); $formitem = $formitem = GetSysTemplets("custom_fields_{$admintype}.htm"); $innertext = trim($ctag->GetInnerText()); if ($innertext != '') { $formitem = $innertext; } $ftype = $ctag->GetAtt('type'); $myformItem = ''; if (preg_match("/select|radio|checkbox/i", $ftype)) { $items = explode(',', $ctag->GetAtt('default')); } if ($ftype == 'select') { $myformItem = "<select name='{$fieldname}' style='width:150px'>"; if (is_array($items)) { foreach ($items as $v) { $v = trim($v); if ($v == '') { continue; } $myformItem .= $fvalue == $v ? "<option value='{$v}' selected>{$v}</option>\r\n" : "<option value='{$v}'>{$v}</option>\r\n"; } } $myformItem .= "</select>\r\n"; $innertext = $myformItem; } else { if ($ctag->GetAtt("type") == 'stepselect') { global $hasSetEnumJs, $cfg_cmspath; $cmspath = empty($cfg_cmspath) || preg_match('/[/$]/', $cfg_cmspath) ? $cfg_cmspath . '/' : $cfg_cmspath; $myformItem = ''; $myformItem .= "<input type='hidden' id='hidden_{$fieldname}' name='{$fieldname}' value='{$fvalue}' />\r\n"; $myformItem .= "<span id='span_{$fieldname}'></span>\r\n"; $myformItem .= "<span id='span_{$fieldname}_son'></span>\r\n"; $myformItem .= "<span id='span_{$fieldname}_sec'></span>\r\n"; if ($hasSetEnumJs != 'hasset') { $myformItem .= '<script language="javascript" type="text/javascript" src="' . $cmspath . 'images/enums.js"></script>' . "\r\n"; $GLOBALS['hasSetEnumJs'] = 'hasset'; } $myformItem .= "<script language='javascript' type='text/javascript' src='{$cmspath}data/enums/{$fieldname}.js'></script>\r\n"; $myformItem .= "<script language='javascript' type='text/javascript'>MakeTopSelect('{$fieldname}', {$fvalue});</script>\r\n"; $formitem = str_replace('~name~', $ctag->GetAtt('itemname'), $formitem); $formitem = str_replace('~form~', $myformItem, $formitem); return $formitem; } else { if ($ftype == 'radio') { if (is_array($items)) { foreach ($items as $v) { $v = trim($v); if ($v == '') { continue; } $myformItem .= $fvalue == $v ? "<input type='radio' name='{$fieldname}' class='np' value='{$v}' checked='checked' />{$v}\r\n" : "<input type='radio' name='{$fieldname}' class='np' value='{$v}' />{$v}\r\n"; } } $innertext = $myformItem; } else { if ($ftype == 'checkbox') { $myformItem = ''; $fvalues = explode(',', $fvalue); if (is_array($items)) { foreach ($items as $v) { $v = trim($v); if ($v == '') { continue; } if (in_array($v, $fvalues)) { $myformItem .= "<input type='checkbox' name='{$fieldname}[]' class='np' value='{$v}' checked='checked' />{$v}\r\n"; } else { $myformItem .= "<input type='checkbox' name='{$fieldname}[]' class='np' value='{$v}' />{$v}\r\n"; } } } $innertext = $myformItem; } else { if ($ftype == "textdata") { if (is_file($cfg_basedir . $fvalue)) { $fp = fopen($cfg_basedir . $fvalue, 'r'); $okfvalue = ''; while (!feof($fp)) { $okfvalue .= fgets($fp, 1024); } fclose($fp); } else { $okfvalue = ''; } if ($admintype == 'admin') { $myformItem = GetEditor($fieldname, $okfvalue, 350, 'Basic', 'string') . "\r\n <input type='hidden' name='{$fieldname}_file' value='{$fvalue}' />\r\n "; } else { $myformItem = GetEditor($fieldname, $okfvalue, 350, 'Member', 'string') . "\r\n <input type='hidden' name='{$fieldname}_file' value='{$fvalue}' />\r\n "; } $innertext = $myformItem; } else { if ($ftype == "htmltext") { if ($admintype == 'admin') { $myformItem = GetEditor($fieldname, $fvalue, 350, 'Basic', 'string') . "\r\n "; } else { $myformItem = GetEditor($fieldname, $fvalue, 350, 'Member', 'string') . "\r\n "; } $innertext = $myformItem; } else { if ($ftype == "multitext") { $innertext = "<textarea name='{$fieldname}' id='{$fieldname}' style='width:90%;height:80px'>{$fvalue}</textarea>\r\n"; } else { if ($ftype == "datetime") { $nowtime = GetDateTimeMk($fvalue); $innertext = "<input name=\"{$fieldname}\" value=\"{$nowtime}\" type=\"text\" id=\"{$fieldname}\" style=\"width:250px\" class=\"intxt\" />"; $innertext .= " <script language=\"javascript\" type=\"text/javascript\">\r\n Calendar.setup({\r\n inputField : \"{$fieldname}\",\r\n ifFormat : \"%Y-%m-%d %H:%M\",\r\n showsTime : true,\r\n timeFormat : \"24\"\r\n });\r\n </script>"; } else { if ($ftype == "img") { $ndtp = new DedeTagParse(); $ndtp->LoadSource($fvalue); if (!is_array($ndtp->CTags)) { $ndtp->Clear(); $fvalue = ""; } else { $ntag = $ndtp->GetTag("img"); $fvalue = trim($ntag->GetInnerText()); } $innertext = "<input type='text' name='{$fieldname}' value='{$fvalue}' id='{$fieldname}' style='width:300px' class='text' /> <input name='" . $fieldname . "_bt' class='inputbut' type='button' value='浏览...' onClick=\"SelectImage('form1.{$fieldname}','big')\" />\r\n"; } else { if ($ftype == "imgfile") { $innertext = "<input type='text' name='{$fieldname}' value='{$fvalue}' id='{$fieldname}' style='width:300px' class='text' /> <input name='" . $fieldname . "_bt' class='inputbut' type='button' value='浏览...' onClick=\"SelectImage('form1.{$fieldname}','big')\" />\r\n"; } else { if ($ftype == "media") { $innertext = "<input type='text' name='{$fieldname}' value='{$fvalue}' id='{$fieldname}' style='width:300px' class='text' /> <input name='" . $fieldname . "_bt' class='inputbut' type='button' value='浏览...' onClick=\"SelectMedia('form1.{$fieldname}')\" />\r\n"; } else { if ($ftype == "addon") { $innertext = "<input type='text' name='{$fieldname}' id='{$fieldname}' value='{$fvalue}' style='width:300px' class='text' /> <input name='" . $fieldname . "_bt' class='inputbut' type='button' value='浏览...' onClick=\"SelectSoft('form1.{$fieldname}')\" />\r\n"; } else { if ($ftype == "int" || $ftype == "float") { $innertext = "<input type='text' name='{$fieldname}' id='{$fieldname}' style='width:100px' class='intxt' value='{$fvalue}' /> (填写数值)\r\n"; } else { $innertext = "<input type='text' name='{$fieldname}' id='{$fieldname}' style='width:250px' class='intxt' value='{$fvalue}' />\r\n"; } } } } } } } } } } } } } $formitem = str_replace('~name~', $ctag->GetAtt('itemname'), $formitem); $formitem = str_replace('~form~', $innertext, $formitem); return $formitem; }
function GetFormItemValue($ctag,$fvalue,$admintype='admin') { global $cfg_basedir; $fieldname = $ctag->GetName(); $formitem = $formitem = GetSysTemplets("custom_fields_{$admintype}.htm"); $innertext = trim($ctag->GetInnerText()); $ftype = $ctag->GetAtt("type"); $myformItem = ''; if(eregi("select|radio|checkbox",$ftype)) $items = explode(',',$innertext); if($ftype=='select') { $myformItem = "<select name='$fieldname' style='width:150px'>"; if(is_array($items)) { foreach($items as $v){ $v = trim($v); if($v=='') continue; $myformItem.= ($fvalue==$v ? "<option value='$v' selected>$v</option>\r\n" : "<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') { if(is_array($items)) { foreach($items as $v) { $v = trim($v); if($v=='') continue; $myformItem.= ($fvalue==$v ? "<input type='radio' name='$fieldname' class='np' value='$v' checked>$v\r\n" : "<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; } //checkbox else if($ctag->GetAtt("type")=='checkbox') { $myformItem = ''; $items = explode(',',$innertext); $fvalues = explode(',',$fvalue); foreach($items as $v){ $v = trim($v); if($v=='') continue; if(in_array($v,$fvalues)){ $myformItem .= "<input type='checkbox' name='{$fieldname}[]' class='np' value='$v' checked='checked' />$v\r\n"; } else{ $myformItem .= "<input type='checkbox' 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; } //除了以上类型,如果其它的类型自定义了发布表单,则直接输出发布表单优先 if(!empty($innertext)) { $formitem = str_replace('~name~',$ctag->GetAtt('itemname'),$formitem); $formitem = str_replace('~form~',$innertext,$formitem); $formitem = str_replace('@value',$fvalue,$formitem); return $formitem; } //文本数据的特殊处理 if($ftype=="textdata") { if(is_file($cfg_basedir.$fvalue)){ $fp = fopen($cfg_basedir.$fvalue,'r'); $okfvalue = ""; while(!feof($fp)){ $okfvalue .= fgets($fp,1024); } fclose($fp); }else{ $okfvalue = ''; } if($admintype=='admin') $myformItem = GetEditor($fieldname,$okfvalue,350,'Basic','string')."\r\n <input type='hidden' name='{$fieldname}_file' value='{$fvalue}'>\r\n "; else $myformItem = GetEditor($fieldname,$okfvalue,350,'Member','string')."\r\n <input type='hidden' name='{$fieldname}_file' value='{$fvalue}'>\r\n "; $formitem = str_replace("~name~",$ctag->GetAtt('itemname'),$formitem); $formitem = str_replace("~form~",$myformItem,$formitem); return $formitem; } else if($ftype=="htmltext") { if($admintype=='admin') $myformItem = GetEditor($fieldname,$fvalue,350,'Basic','string')."\r\n "; else $myformItem = GetEditor($fieldname,$fvalue,350,'Member','string')."\r\n "; $formitem = str_replace("~name~",$ctag->GetAtt('itemname'),$formitem); $formitem = str_replace("~form~",$myformItem,$formitem); return $formitem; } else if($ftype=="multitext") { $innertext = "<textarea name='$fieldname' id='$fieldname' style='width:100%;height:80px'>$fvalue</textarea>\r\n"; $formitem = str_replace("~name~",$ctag->GetAtt('itemname'),$formitem); $formitem = str_replace("~form~",$innertext,$formitem); return $formitem; } else if($ftype=="datetime") { $nowtime = GetDateTimeMk($fvalue); $innertext = "<input name=\"$fieldname\" value=\"$nowtime\" type=\"text\" id=\"$fieldname\" style=\"width:250px\">"; $formitem = str_replace("~name~",$ctag->GetAtt('itemname'),$formitem); $formitem = str_replace("~form~",$innertext,$formitem); return $formitem; } else if($ftype=="img") { $ndtp = new DedeTagParse(); $ndtp->LoadSource($fvalue); if(!is_array($ndtp->CTags)){ $ndtp->Clear(); $fvalue = ""; }else { $ntag = $ndtp->GetTag("img"); //$fvalue = trim($ntag->GetInnerText()); $fvalue = trim($ndtp->InnerText); } $innertext = "<input type='text' name='$fieldname' value='$fvalue' id='$fieldname' style='width:300px'> <input name='".$fieldname."_bt' class='inputbut' 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($ftype=="imgfile") { $innertext = "<input type='text' name='$fieldname' value='$fvalue' id='$fieldname' style='width:300px'> <input name='".$fieldname."_bt' class='inputbut' 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($ftype=="media") { $innertext = "<input type='text' name='$fieldname' value='$fvalue' id='$fieldname' style='width:300px'> <input name='".$fieldname."_bt' class='inputbut' 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($ftype=="addon") { $innertext = "<input type='text' name='$fieldname' id='$fieldname' value='$fvalue' style='width:300px'> <input name='".$fieldname."_bt' class='inputbut' 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 if($ftype=="int"||$ftype=="float") { $innertext = "<input type='text' name='$fieldname' id='$fieldname' style='width:100px' value='$fvalue'> (填写数值)\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:250px' value='$fvalue'>\r\n"; $formitem = str_replace("~name~",$ctag->GetAtt('itemname'),$formitem); $formitem = str_replace("~form~",$innertext,$formitem); return $formitem; } }
function Display($modfile="") { global $cfg_templets_dir,$cfg_basedir,$maintitle,$winform; if(empty($this->mainTitle)) $maintitle = '通用对话框'; else $maintitle = $this->mainTitle; if(empty($winform)) $winform = $this->myWin; if(empty($cfg_templets_dir)) $cfg_templets_dir = dirname(__FILE__)."/../templets"; else $cfg_templets_dir = $cfg_basedir.$cfg_templets_dir; $ctp = new DedeTagParse(); if($modfile=="") $ctp->LoadTemplate($cfg_templets_dir."/win_templet.htm"); else $ctp->LoadTemplate($modfile); $emnum = $ctp->Count; for($i=0;$i<=$emnum;$i++) { if(isset($GLOBALS[$ctp->CTags[$i]->GetTagName()])) { $ctp->Assign($i,$GLOBALS[$ctp->CTags[$i]->GetTagName()]); } } $ctp->Display(); $ctp->Clear(); }