?? picture.php
字號:
$pages=phppages($number,$page,$pagesize,$url);
$query="SELECT * FROM ".TABLE_PICTURE." WHERE status='$status' AND recycle=0 AND channelid='$channelid' $addquery ORDER BY $dordertype LIMIT $offset,$pagesize";
$result=$db->query($query);
if($db->num_rows($result)>0)
{
while($r=$db->fetch_array($result))
{
$p->set_catid($r[catid]);
$r[url] = $p->get_itemurl($r[pictureid],$r[addtime]);
$r[caturl] = $p->get_listurl(0);
$r[thumb] = $r[thumb] ? (preg_match("/^http:\/\//i",$r[thumb]) ? $r[thumb] : PHPCMS_PATH.$r[thumb]) : PHPCMS_PATH."images/nopic.gif";
$r[title] = titleformat($r[title],$r[titlefontcolor],$r[titlefonttype],'');
$r[adddate]=date("Y-m-d",$r[addtime]);
$r[addtime]=date("Y/md",$r[addtime]);
$pictures[]=$r;
}
} include admintpl('picture_manage');
break;
//我添加的圖片
case 'myitem':
@extract($db->get_one("SELECT COUNT(*) AS num_3 FROM ".TABLE_PICTURE." WHERE status=3 AND username='$_username' AND recycle=0 AND channelid='$channelid'"));
@extract($db->get_one("SELECT COUNT(*) AS num_1 FROM ".TABLE_PICTURE." WHERE status=1 AND username='$_username' AND recycle=0 AND channelid='$channelid'"));
@extract($db->get_one("SELECT COUNT(*) AS num_0 FROM ".TABLE_PICTURE." WHERE status=0 AND username='$_username' AND recycle=0 AND channelid='$channelid'"));
@extract($db->get_one("SELECT COUNT(*) AS num_2 FROM ".TABLE_PICTURE." WHERE status=2 AND username='$_username' AND recycle=0 AND channelid='$channelid'"));
$status = isset($status) ? $status : 3;
$referer=urlencode("?mod=picture&file=picture&action=mypicture&channelid=".$channelid."&catid=".$catid."&status=".$status."&keyword=".$keyword."&ontop=".$ontop."&elite=".$elite."&ordertype=".$ordertype."&srchtype=".$srchtype."&page=".$page."&username=".$_username);
$catid=$catid ? $catid : 0;
$thecatid=$catid;
if(!$page)
{
$page=1;
$offset=0;
}
else
{
$offset=($page-1)*$pagesize;
}
$query="SELECT COUNT(*) as num FROM ".TABLE_PICTURE." WHERE username='$_username' and status='$status' AND recycle=0 AND channelid='$channelid' $addquery";
$result=$db->query($query);
$r=$db->fetch_array($result);
$number=$r["num"];
$url="?mod=picture&file=picture&action=mypicture&channelid=".$channelid."&catid=".$catid."&status=".$status."&keyword=".$keyword."&ontop=".$ontop."&elite=".$elite."&ordertype=".$ordertype."&srchtype=".$srchtype."&page=".$page."&username=".$_username;
$pages=phppages($number,$page,$pagesize,$url);
$query="SELECT * FROM ".TABLE_PICTURE." WHERE username='$_username' and status='$status' AND recycle=0 AND channelid='$channelid' $addquery ORDER BY $dordertype LIMIT $offset,$pagesize";
$result=$db->query($query);
if($db->num_rows($result)>0)
{
while($r=$db->fetch_array($result))
{
$p->set_catid($r[catid]);
$r[url] = $p->get_itemurl($r[pictureid],$r[addtime]);
$r[caturl] = $p->get_listurl(0);
$r[thumb] = $r[thumb] ? (preg_match("/^http:\/\//i",$r[thumb]) ? $r[thumb] : PHPCMS_PATH.$r[thumb]) : PHPCMS_PATH."images/nopic.gif";
$r[title] = titleformat($r[title],$r[titlefontcolor],$r[titlefonttype],'');
$r[adddate]=date("Y-m-d",$r[addtime]);
$r[addtime]=date("Y/md",$r[addtime]);
$pictures[]=$r;
}
}
include admintpl('picture_myitem');
break;
//圖片審核管理
case 'check':
$referer=urlencode("?mod=".$mod."&file=".$file."&action=check&channelid=".$channelid."&catid=".$catid."&srchtype=".$srchtype."&keywords=".$keywords."&ordertype=".$ordertype."&page=".$page);
if(!$page)
{
$page=1;
$offset=0;
}
else
{
$offset=($page-1)*$pagesize;
}
$query="SELECT COUNT(*) AS num FROM ".TABLE_PICTURE." WHERE status=1 AND recycle=0 AND channelid='$channelid' $addquery";
$result=$db->query($query);
$r=$db->fetch_array($result);
$number=$r["num"];
$url="?mod=".$mod."&file=".$file."&action=check&channelid=".$channelid."&catid=".$catid."&srchtype=".$srchtype."&keyword=".$keyword."&ordertype=".$ordertype."&page=".$page;
$pages=phppages($number,$page,$pagesize,$url);
$query="SELECT * FROM ".TABLE_PICTURE." WHERE status=1 AND recycle=0 AND channelid='$channelid' $addquery ORDER BY $dordertype LIMIT $offset,$pagesize";
$result=$db->query($query);
if($db->num_rows($result)>0)
{
while($r=$db->fetch_array($result))
{
$p->set_catid($r[catid]);
$r[url] = $p->get_itemurl($r[pictureid],$r[addtime]);
$r[caturl] = $p->get_listurl(0);
$r[thumb] = $r[thumb] ? (preg_match("/^http:\/\//i",$r[thumb]) ? $r[thumb] : PHPCMS_PATH.$r[thumb]) : PHPCMS_PATH."images/nopic.gif";
$r[title] = titleformat($r[title],$r[titlefontcolor],$r[titlefonttype],'');
$r[adddate]=date("Y-m-d",$r[addtime]);
$r[addtime]=date("Y/md",$r[addtime]);
$pictures[]=$r;
}
} include admintpl('picture_check');
break;
case 'special':
$referer=urlencode('?mod='.$mod.'&file='.$file.'&action=special&channelid='.$channelid.'&specialid='.$specialid.'&srchtype='.$srchtype.'&keyword='.$keyword.'&ontop='.$ontop.'&elite='.$elite.'&ordertype='.$ordertype.'&page='.$page);
if(!$page)
{
$page=1;
$offset=0;
}
else
{
$offset=($page-1)*$pagesize;
}
if(!empty($keywords))
{
$keyword=str_replace(' ','%',$keywords);
$keyword=str_replace('*','%',$keyword);
switch($srchtype)
{
case '0':
$addquery=" AND title LIKE '%$keyword%' ";
break;
case '1':
$addquery=" AND content LIKE '%$keyword%' ";
break;
case '2':
$addquery=" AND author LIKE '%$keyword%' ";
break;
case '3':
$addquery=" AND username LIKE '%$keyword%' ";
break;
default :
$addquery=" AND (title LIKE '%$keyword%' or titleintact LIKE '%$keyword%' or subheading LIKE '%$keyword%') ";
}
}
$addquery .= $specialid ? " AND specialid=$specialid " : "";
$addquery .= $elite ? " AND elite=1 " : "";
$addquery .= $ontop ? " AND ontop=1 " : "";
$addquery .= $time ? sql_time($time) : "";
switch($ordertype)
{
case 1:
$dordertype=" pictureid DESC ";
break;
case 2:
$dordertype=" pictureid ";
break;
case 3:
$dordertype=" hits DESC ";
break;
case 4:
$dordertype=" hits ";
break;
default :
$dordertype=" pictureid DESC ";
}
$r = $db->get_one("SELECT COUNT(*) AS num FROM ".TABLE_PICTURE." a WHERE status=3 AND recycle=0 AND specialid>0 AND channelid='$channelid' $addquery");
$number=$r["num"];
$url="?mod=".$mod."&file=".$file."&action=special&channelid=".$channelid."&catid=".$catid."&specialid=".$specialid."&srchtype=".$srchtype."&keyword=".$keyword."&ontop=".$ontop."&elite=".$elite."&ordertype=".$ordertype."&page=".$page;
$pages=phppages($number,$page,$pagesize,$url);
$result=$db->query("SELECT * FROM ".TABLE_PICTURE." WHERE status=3 AND recycle=0 AND specialid>0 AND channelid='$channelid' $addquery ORDER BY $dordertype LIMIT $offset,$pagesize");
while($r=$db->fetch_array($result))
{
$s = $db->get_one("SELECT specialid,specialname,addtime FROM ".TABLE_SPECIAL." a WHERE specialid=$r[specialid]");
$p->set_catid($r[catid]);
$r[url] = $p->get_itemurl($r[pictureid],$r[addtime]);
$r[specialname] = wordscut($s[specialname],24,1);
$r[specialurl] = $p->get_specialitemurl($s[specialid],$s[addtime]);
$r[title] = titleformat($r[title],$r[titlefontcolor],$r[titlefonttype],$r[includepic]);
$r[adddate]=date("Y-m-d",$r[addtime]);
$pictures[]=$r;
}
$special_list = special_select($channelid,'specialid','請選擇專題',$specialid);
$special_select = special_select($channelid,'jump','請選擇專題進行管理',$specialid,'onchange="if(this.options[this.selectedIndex].value!=\'\'){location=\'?mod='.$mod.'&file='.$file.'&action=special&channelid='.$channelid.'&specialid=\'+this.options[this.selectedIndex].value;}"');
include admintpl('picture_special');
break;
case 'sendback':
if($submit)
{
if(empty($pictureid))
{
showmessage('非法參數!請返回!');
}
if($ifpm)
{
if(empty($title))
{
showmessage('對不起,標題不能為空!請返回!');
}
if(empty($content))
{
showmessage('對不起,內容不能為空!請返回!');
}
sendpm($username,$title,$content);
}
if($ifemail)
{
sendusermail($username,$title,$content);
}
$db->query("UPDATE ".TABLE_PICTURE." SET status=2,elite=0,ontop=0 WHERE pictureid='$pictureid' AND channelid='$channelid'");
showmessage('操作成功!',$referer);
}
else
{
if(empty($pictureid))
{
showmessage('非法參數!請返回!');
}
$result=$db->query("SELECT title,catid,username,status FROM ".TABLE_PICTURE." WHERE pictureid='$pictureid' AND channelid='$channelid'");
if($db->num_rows($result)>0)
{
$picture=$db->fetch_array($result);
if($picture[status]!=1)
{
showmessage('無法進行此操作!請返回!');
}
}
else
{
showmessage('圖片不存在!請返回!');
}
include admintpl('picture_sendback');
}
break;
case 'send':
if(empty($pictureid))
{
showmessage('非法參數!請返回!');
}
$result=$db->query("SELECT status FROM ".TABLE_PICTURE." WHERE pictureid='$pictureid' AND channelid='$channelid'");
if($db->num_rows($result)>0)
{
$picture=$db->fetch_array($result);
if(($picture[status]!=2) && ($picture[status]!=0))
{
showmessage('無法進行此操作!請返回!');
}
else
{
$db->query("UPDATE ".TABLE_PICTURE." SET status=1 WHERE pictureid='$pictureid' AND channelid='$channelid'");
showmessage('操作成功!',$referer);
}
}
else
{
showmessage('圖片不存在!請返回!',$referer);
}
break;
//移動圖片
case 'move':
if($submit)
{
$specialid = intval($specialid);
$targetcatid = intval($targetcatid);
if(!$specialid && !$targetcatid) showmessage('非法參數!請返回!');
if($targetcatid && $_CAT[$catid][child] && !$_CAT[$targetcatid]['enableadd']) showmessage('指定欄目不允許添加文章!請返回!');
if($movetype==1)
{
if(empty($pictureid)) showmessage('非法參數!請返回!');
$pictureids=is_array($pictureid) ? implode(',',$pictureid) : $pictureid;
if($specialid) $db->query("UPDATE ".TABLE_PICTURE." SET specialid='$specialid' WHERE pictureid IN ($pictureids) AND status=3 AND channelid='$channelid' ");
if($targetcatid) $db->query("UPDATE ".TABLE_PICTURE." SET catid='$targetcatid' WHERE pictureid IN ($pictureids) AND status=3 AND channelid='$channelid' ");
}
else
{
if(empty($batchcatid)) showmessage('非法參數!請返回!');
$batchcatids=implode(",",$batchcatid);
if($specialid) $db->query("UPDATE ".TABLE_PICTURE." SET specialid='$specialid' WHERE catid IN ($batchcatids) AND status=3 AND channelid='$channelid' ");
if($targetcatid) $db->query("UPDATE ".TABLE_PICTURE." SET catid='$targetcatid' WHERE catid IN ($batchcatids) AND status=3 AND channelid='$channelid' ");
}
showmessage('操作成功!',$referer);
}
else
{
$referer=urlencode('?mod='.$mod.'&file='.$file.'&action=move&channelid='.$channelid);
$pictureid=is_array($pictureid) ? implode(',',$pictureid) : $pictureid;
$special_select = special_select($channelid,'specialid','請選擇專題',$specialid);
include admintpl('picture_move');
}
break;
//回收站管理
case 'recycle':
@extract($db->get_one("SELECT COUNT(*) AS num_3 FROM ".TABLE_PICTURE." WHERE status=3 AND username='$_username' AND recycle=1 AND channelid='$channelid'"));
@extract($db->get_one("SELECT COUNT(*) AS num_1 FROM ".TABLE_PICTURE." WHERE status=1 AND username='$_username' AND recycle=1 AND channelid='$channelid'"));
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -