📄 js.php
字号:
<?php
/*
*######################################
* PHPCMS v2.00 - Advanced Content Manage System.
* Copyright (c) 2004-2005 phpcms.cn
*
* For further information go to http://www.phpcms.cn/
* This copyright notice MUST stay intact for use.
*######################################
*/
if(!defined('IN_PHPCMS')) {
exit('Access Denied');
}
$action = $action ? $action : 'article' ;
switch($action){
case 'article':
$query = $db->query("SELECT * FROM $table_js where com='article' ORDER BY jsid desc");
while($js=$db->fetch_array($query)) {
$jss[]=$js;
}
include template('js_article',1);
break;
case 'articleadd':
if($submit){
if(!$name){showmessage('对不起,js名称不能为空!请返回!');}
if(empty($jsname)){showmessage('对不起,js文件名不能为空!请返回!');}
if($articlenum<=0){showmessage('对不起,文章数必须大于0!请返回!');}
$result=$db->query("SELECT * FROM $table_js WHERE jsname='$jsname'");
if($db->num_rows($result)>0){
showmessage('对不起,JS文件名重复!请返回!');
}
$parameters='articlenum='.$articlenum.'&catid='.$catid.'&child='.$child.'&specialid='.$specialid.'&picarticle='.$picarticle.'&elite='.$elite.'&hot='.$hot.'&btime='.$btime.'&ordertype='.$ordertype.'&orderway='.$orderway.'&titlenum='.$titlenum.'&contentnum='.$contentnum.'&showcatname='.$showcatname.'&showtag='.$showtag.'&showauthor='.$showauthor.'&showhits='.$showhits.'&showcomment='.$showcomment.'&showaddtime='.$showaddtime.'&picorderway='.$picorderway.'&picwidth='.$picwidth.'&picheight='.$picheight.'&target='.$target;
$db->query("insert into $table_js(name,introduce,com,jsname,parameters,addtime) values('$name','$introduce','article','$jsname','$parameters','$timestamp')");
showmessage('操作成功!','?file=html&action=js_article&jsid='.$db->insert_id());
}else{
$specials='';
$result=$db->query("select * from $table_special where close=0 order by specialid desc");
if($db->num_rows($result)>0){
while($r=$db->fetch_array($result)){
$specials[]=$r;
}
}
$result=$db->query("select catid,parentid,catname,child,enableadd from $table_category where cattype>0");
while($r=$db->fetch_array($result)){
$category[$r[parentid]][]=$r;
}
$categories=category();
include template('js_articleadd',1);
}
break;
case 'articleedit':
if($submit){
if(!$name){showmessage('对不起,js名称不能为空!请返回!');}
if(empty($jsname)){showmessage('对不起,js文件名不能为空!请返回!');}
if($articlenum<=0){showmessage('对不起,文章数必须大于0!请返回!');}
$result=$db->query("SELECT * FROM $table_js WHERE jsname='$jsname'");
if($db->num_rows($result)>1){
showmessage('对不起,JS文件名重复!请返回!');
}
$parameters='articlenum='.$articlenum.'&catid='.$catid.'&child='.$child.'&specialid='.$specialid.'&picarticle='.$picarticle.'&elite='.$elite.'&hot='.$hot.'&btime='.$btime.'&ordertype='.$ordertype.'&orderway='.$orderway.'&titlenum='.$titlenum.'&contentnum='.$contentnum.'&showcatname='.$showcatname.'&showtag='.$showtag.'&showauthor='.$showauthor.'&showhits='.$showhits.'&showcomment='.$showcomment.'&showaddtime='.$showaddtime.'&picorderway='.$picorderway.'&picwidth='.$picwidth.'&picheight='.$picheight.'&target='.$target;
$db->query("update $table_js set name='$name',introduce='$introduce',jsname='$jsname',parameters='$parameters' where jsid=$jsid");
showmessage('操作成功!','?file=html&action=js_article&jsid='.$jsid);
}else{
$result=$db->query("SELECT * FROM $table_js WHERE jsid='$jsid'");
$js=$db->fetch_array($result);
parse_str($js[parameters],$jsp);
$js=array_merge($js,$jsp);
$specials='';
$result=$db->query("select * from $table_special where close=0 order by specialid desc");
if($db->num_rows($result)>0){
while($r=$db->fetch_array($result)){
$specials[]=$r;
}
}
$thecatid=$js[catid];
$result=$db->query("select catid,parentid,catname,child,enableadd from $table_category where cattype>0");
while($r=$db->fetch_array($result)){
$category[$r[parentid]][]=$r;
}
$categories=category();
include template('js_articleedit',1);
}
break;
case 'jsdelete':
if(empty($jsid)){
showmessage('非法参数!请返回!');
}
$result=$db->query("SELECT com,jsname FROM $table_js WHERE jsid='$jsid'");
if($db->num_rows($result)==0){
showmessage('对不起,该记录不存在!请返回!');
}
$r=$db->fetch_array($result);
$db->query("DELETE FROM $table_js WHERE jsid=$jsid");
if($db->affected_rows()>0){
unlink($phpcms_root.'/data/js/'.$r[com].'_'.$r[jsname].'.js');
showmessage('操作成功!',$referer);
}else{
showmessage('操作失败!请返回!');
}
break;
case 'jsshow':
exit("<script language='javascript' src='".$rootpath."/data/js/".$jsfullname."'></script>");
break;
}
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -