?? tag.php
字號:
<?php
/*
*####################################################
* PHPCMS v3.0.0 - Advanced Content Manage System.
* Copyright (c) 2005-2006 phpcms.cn
*
* For further information go to http://www.phpcms.cn/
* This copyright notice MUST stay intact for use.
*####################################################
*/
defined('IN_PHPCMS') or exit(FORBIDDEN);
$submenu = array(
array('文章列表調(diào)用','?mod='.$mod.'&file='.$file.'&action=manage&func=articlelist&channelid='.$channelid),
array('圖片文章調(diào)用','?mod='.$mod.'&file='.$file.'&action=manage&func=picarticle&channelid='.$channelid),
array('文章幻燈片調(diào)用','?mod='.$mod.'&file='.$file.'&action=manage&func=slidepicarticle&channelid='.$channelid),
array('欄目標(biāo)簽','?mod=phpcms&file=tag&action=manage&func=catlist&channelid='.$channelid),
array('專題標(biāo)簽','?mod=phpcms&file=tag&action=manage&func=speciallist&channelid='.$channelid),
array('專題幻燈片標(biāo)簽','?mod=phpcms&file=tag&action=manage&func=slidespecial&channelid='.$channelid),
array('公告標(biāo)簽','?mod=phpcms&file=tag&action=manage&func=announcelist&channelid='.$channelid),
array('友情鏈接標(biāo)簽','?mod=phpcms&file=tag&action=manage&func=linklist&channelid='.$channelid),
array('評論標(biāo)簽','?mod=phpcms&file=tag&action=manage&func=commentlist&channelid='.$channelid.'&item=channelid&itemid='.$channelid),
array('自定義標(biāo)簽','?mod=phpcms&file=mytag&action=manage&channelid='.$channelid)
);
$menu=adminmenu('標(biāo)簽調(diào)用管理',$submenu);
$funcs = array('articlelist'=>'文章列表調(diào)用標(biāo)簽','picarticle'=>'圖片文章調(diào)用標(biāo)簽','slidepicarticle'=>'幻燈片效果調(diào)用標(biāo)簽');
$tree = new tree;
$cat_option = cat_option($catid);
$func = $func ? $func : "articlelist";
$action = $action ? $action : "manage";
switch($action)
{
case 'set':
if($tagid)
{
$r = $db->get_one("SELECT * FROM ".TABLE_TAG." WHERE tagid=$tagid");
@extract($r);
if(!@include_once PHPCMS_CACHEDIR."tag/".$tagid.".php")
{
cache_tag($tagid);
include_once PHPCMS_CACHEDIR."tag/".$tagid.".php";
}
$data = $_TAG[$tagid];
}
else
{
$data = array (
'channelid' => '$channelid',
'catid' => '0',
'child' => '1',
'specialid' => '0',
'page' => '0',
'articlenum' => '10',
'titlelen' => '30',
'descriptionlen' => '0',
'iselite' => '0',
'datenum' => '0',
'ordertype' => '1',
'datetype' => '2',
'showcatname' => '0',
'showauthor' => '0',
'showhits' => '0',
'showstars' => '0',
'target' => '1',
'showtype' => '1',
'showalt' => '0',
'imgwidth' => '150',
'imgheight' => '150',
'timeout' => '5000',
'cols' => '1',
'templateid' => '0',
);
}
$special_select = special_select($channelid,'selectspecialid','請選擇專題',$data[specialid],'onchange="javascript:ChangeInput(this,document.myform.specialid)"');
$showtpl = showtpl($mod,'tag_'.$func,'newdata[templateid]',$data[templateid],"id='templateid'");
if(!$tagid) $my = "my_";
include admintpl('tag_'.$func);
break;
case 'tag_exists':
if(!preg_match("/^[0-9a-z_]+$/i",$tag)) showmessage("<font color='red'>配置名稱只能由字母、數(shù)字和下劃線組成!</font>");
$r = $db->get_one("SELECT * FROM ".TABLE_TAG." WHERE tag='$tag'");
if($r[tagid])
{
showmessage("<font color='red'>該配置名稱已經(jīng)存在!</font>");
}
else
{
showmessage("該配置名稱不存在!");
}
break;
case 'preview':
if($func && is_array($newdata))
{
@extract($newdata);
}
else
{
if(!@include_once PHPCMS_CACHEDIR."tag/".$tagid.".php")
{
cache_tag($tagid);
include_once PHPCMS_CACHEDIR."tag/".$tagid.".php";
}
@extract($_TAG[$tagid]);
}
if($channelid=="\$channelid") $channelid = $_GET['channelid'] ? $_GET['channelid'] : $channelid;
if($catid=="\$catid") $catid = $_GET['catid'] ? $_GET['catid'] : 0;
if($specialid=="\$specialid") $specialid = $_GET['specialid'] ? $_GET['specialid'] : 0;
if($page=="\$page") $page = $_GET['page'] ? $_GET['page'] : 1;
echo "<html>
<head>
<title>標(biāo)簽預(yù)覽</title>
<link href='".$skindir."/style.css' rel='stylesheet' type='text/css'>
<script language='JavaScript' src='".PHPCMS_PATH."include/js/common.js'></script>
</head>
<body>";
switch($func)
{
case 'articlelist':
echo articlelist($templateid,$channelid,$catid,$child,$specialid,$page,$articlenum,$titlelen,$descriptionlen,$iselite,$datenum,$ordertype,$datetype,$showcatname,$showauthor,$showhits,$target,$cols);
break;
case 'picarticle':
echo picarticle($templateid,$channelid,$catid,$child,$specialid,$page,$articlenum,$titlelen,$descriptionlen,$iselite,$datenum,$ordertype,$showtype,$showalt,$imgwidth,$imgheight,$cols);
break;
case 'slidepicarticle':
echo slidepicarticle($templateid,$channelid,$catid,$child,$specialid,$articlenum,$titlelen,$iselite,$datenum,$ordertype,$imgwidth,$imgheight,$timeout,$effectid);
break;
}
echo "</body></html>";
break;
case 'save':
$tagid = intval($tagid);
if(!$tagid)
{
if(!preg_match("/^my_[0-9a-z_]+$/i",$tag)) showmessage('自定義配置名稱必須以 my_ 為前綴<br/>且只能由字母、數(shù)字和下劃線組成!請返回!');
$r = $db->get_one("SELECT * FROM ".TABLE_TAG." WHERE tag='$tag'");
if($r[tagid]) showmessage("已經(jīng)存在同名標(biāo)簽!請更換標(biāo)簽名!",$PHP_REFERER);
}
if(empty($tagname)) showmessage('配置說明不能為空!請返回!');
if(!preg_match('/^[a-z0-9_]+$/i',$func)) showmessage('配置類型不對!請返回!');
if(!is_array($newdata)) showmessage('參數(shù)錯誤!請返回!');
$thechannelid = intval($channelid);
@extract($newdata);
switch($func)
{
case 'articlelist':
$tagcode = $func."(".$templateid.",".$channelid.",".setpar($catid).",".$child.",".setpar($specialid).",".$page.",".$articlenum.",".$titlelen.",".$descriptionlen.",".$iselite.",".$datenum.",".$ordertype.",".$datetype.",".$showcatname.",".$showauthor.",".$showhits.",".$target.",".$cols.")";
break;
case 'picarticle':
$tagcode = $func."(".$templateid.",".$channelid.",".setpar($catid).",".$child.",".setpar($specialid).",".$page.",".$articlenum.",".$titlelen.",".$descriptionlen.",".$iselite.",".$datenum.",".$ordertype.",".$showtype.",".$showalt.",".$imgwidth.",".$imgheight.",".$cols.")";
break;
case 'slidepicarticle':
$tagcode = $func."(".$templateid.",".$channelid.",".setpar($catid).",".$child.",".setpar($specialid).",".$articlenum.",".$titlelen.",".$iselite.",".$datenum.",".$ordertype.",".$imgwidth.",".$imgheight.",".$timeout.",".$effectid.")";
break;
}
$parameters = addslashes(var_export($newdata, TRUE));
$tagcode = addslashes($tagcode);
if($tagid)
{
$db->query("UPDATE ".TABLE_TAG." SET tagname='$tagname',parameters='$parameters',tagcode='$tagcode',username='$_username',edittime='$timestamp' WHERE tagid='$tagid'");
}
else
{
$db->query("INSERT INTO ".TABLE_TAG."(tag,module,channelid,func,tagname,parameters,tagcode,username,edittime) VALUES('$tag','$mod','$thechannelid','$func','$tagname','$parameters','$tagcode','$_username','$timestamp')");
$tagid = $db->insert_id();
}
cache_tag($tagid);
require_once PHPCMS_ROOT."/include/template.php";
require_once PHPCMS_CACHEDIR."tag.php";
template_cache();
showmessage("標(biāo)簽配置保存成功!",$referer);
break;
case 'manage':
$tags = array();
$module = $mod;
$query = $db->query("SELECT * FROM ".TABLE_TAG." WHERE module='$module' AND channelid=$channelid AND func='$func' ORDER BY type DESC");
while($r=$db->fetch_array($query))
{
$alt = $r[type] ? "標(biāo)簽類型:系統(tǒng)標(biāo)簽" : "標(biāo)簽類型:自定義標(biāo)簽";
$alt .= "
最后修改人:".$r[username];
$alt .= "
最后修改時間:".date("Y-m-d H:i:s",$r[edittime]);
$r[alt] = $alt;
$jsquery = strpos($r[tagcode],"\$channelid") ? "&channelid={\$channelid}" : "";
$jsquery .= strpos($r[tagcode],"\$catid") ? "&catid={\$catid}" : "";
$jsquery .= strpos($r[tagcode],"\$specialid") ? "&specialid={\$specialid}" : "";
$jsquery .= strpos($r[tagcode],"\$page") ? "&page={\$page}" : "";
$r[jsquery] = $jsquery;
$tags[] = $r;
}
switch($func)
{
case 'articlelist':
$tag_function='articlelist(templateid,channelid,catid,child,specialid,page,articlenum,titlelen,descriptionlen,iselite,datenum,ordertype,datetype,showcatname,showauthor,showhits,target,cols)';
break;
case 'picarticle':
$tag_function='picarticle(templateid,channelid,catid,child,specialid,page,articlenum,titlelen,descriptionlen,iselite,datenum,ordertype,showtype,showalt,imgwidth,imgheight,cols)';
break;
case 'slidepicarticle':
$tag_function='slidepicarticle(templateid,channelid,catid,child,specialid,articlenum,titlelen,iselite,datenum,ordertype,imgwidth,imgheight,timeout,effectid)';
break;
}
include admintpl('tag_manage');
break;
case 'delete':
$db->query("DELETE FROM ".TABLE_TAG." WHERE module='$mod' AND channelid=$channelid AND tagid='$tagid' ");
@$f->unlink(PHPCMS_CACHEDIR."tag/".$tagid.".php");
showmessage('操作成功!',$referer);
break;
}
?>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -