【php开源代码栏目提醒】:本文主要为网学会员提供category.php,希望对需要category.php网友有所帮助,学习一下!
<?php
/*********************/
/* */
/* Version : 5.1.0 */
/* Author : RM */
/* Comment : 071223 */
/* */
/*********************/
if ( !defined( "IN_SUPEV" ) || !defined( "IN_ADMINCP" ) )
{
exit( "Access Denied" );
}
define( "MAX_UP_CATEGORY_FILE", 30000 );
include_once( LANG_PATH."./admincp/global.php" );
include_once( LANG_PATH."./admincp/category.php" );
include_once( SUPEV_ROOT."./api/insenz.php" );
$result = videoclient_util::getvideocategories( );
$result = iconv_local( $result );
if ( empty( $result ) )
{
cpmsg( "鑾峰彇瑙嗛璇剧▼澶辫触" );
}
else
{
$video_categories['categorys'] = $result;
}
$video_categories['categorys'][0] = "";
ksort( $video_categories['categorys'] );
showtabs( array(
"list" => array( "璇剧▼绠$悊", "./admincp.php?script=category&action=list" ),
"add" => array( "娣诲姞璇剧▼", "./admincp.php?script=category&action=add" )
), $action );
if ( $action == "list" )
{
if ( !submitcheck( "submitbtn" ) )
{
$uilist = new ui_list_class( );
$uilist->name = "璇剧▼绠$悊";
$uilist->header = array(
"cid" => model_header( "", "10%", M_CHECKBOX, "KEY" ),
"displayorder" => model_header( "鎺掑簭", "10%", M_TEXT ),
"thumb" => model_header( "璇剧▼鍥剧墖", "20%", M_LABEL ),
"subject" => model_header( "璇剧▼鍚嶇О", "20%", M_TEXT ),
"enable_nav" => model_header( "鏄惁鍦ㄥ鑸樉绀?, "20%", M_TEXT ),
"insenz_category" => model_header( "Insenz璇剧▼", "15%", M_LABEL ),
"oprow" => model_header( "鎿嶄綔", "20%", M_LABEL )
);
$sql = "select * from {$tablepre}categories order by displayorder ";
$res = $db->query( $sql );
$rowarr = array( );
while ( $cate = $db->fetch_array( $res ) )
{
$cate['oprow'] = "<a href=\"?script=category&action=edit&cid=".$cate[cid]."\">缂栬緫</a>";
$cate['insenz_category'] = $video_categories['categorys'][$cate['insenz_category']];
$cate['thumb'] = "<img src=\"".CATETHUMBPATH.$cate['thumb']."\" title=\"".$cate['subject']."\" alt=\"".$cate['subject']."\" onerror=\"this.src='".CATENOTHUMB."';\" />";
$rowarr[] = $cate;
}
$uilist->data =& $rowarr;
$uilist->opt = array(
"name" => model_optgroup( "operation", "" ),
"values" => array(
"update" => model_optitem( "鏇存柊" ),
"del" => model_optitem( "鍒犻櫎", M_CANCELBOX )
)
);
$uilist->show( );
}
else
{
$table = "categories";
if ( $operation == "update" )
{
foreach ( $items as $lineid => $line )
{
$sqltemp = $comma = "";
foreach ( $line as $keys => $lists )
{
$sqltemp .= $comma.$keys."='".$lists."'";
$comma = ",";
}
$sql = "update {$tablepre}{$table} set ".$sqltemp." where cid='{$lineid}'";
$db->query( $sql );
}
}
else if ( $operation == "del" )
{
if ( !$confirmed )
{
}
if ( !empty( $delitems ) )
{
$comma = "";
foreach ( $delitems as $delid )
{
$delids .= $comma.$delid;
$comma = ",";
}
$sql = "delete from {$tablepre}{$table} where cid in ({$delids})";
$db->query( $
sql );
}
}
updatesyscache( "common" );
cpmsg( "鎿嶄綔鎴愬姛銆?, "?script=category&action=list" );
}
}
else if ( $action == "edit" )
{
if ( !submitcheck( "submitbtn" ) )
{
$cid = intval( $cid );
$sql = "select * from {$tablepre}categories where cid=".$cid;
$res = $db->query( $sql );
$category = $db->fetch_array( $res );
showpanel_start( $lang['editCate'] );
showsetting( "cate_subject", "categorynew[subject]", $category['subject'], "text" );
showsetting( "cate_description", "categorynew[description]", $category['description'], "textarea" );
$ispublish = array( "鍙栧叏灞璁剧疆", "蹇呴』瀹℃牳", "涓嶉渶瀹℃牳" );
$ispublishvideo = array(
"checked" => $category['ispublishvideo'],
"list" => $ispublish
);
showsetting( "ispublishvideo", "categorynew[ispublishvideo]", $ispublishvideo, "radio" );
$ispublishspecial = array(
"checked" => $category['ispublishspecial'],
"list" => $ispublish
);
showsetting( "ispublishspecial", "categorynew[ispublishspecial]", $ispublishspecial, "radio" );
showsetting( "insenz_category", "categorynew[insenz_category]", model_select( $category['insenz_category'], $video_categories['categorys'] ), "select" );
showsetting( "cate_thumb", "categorynew_thumb", $thumb, "file" );
showpanel_end( );
}
else
{
$cid = intval( $cid );
$save_name = "";
if ( empty( $categorynew['insenz_category'] ) )
{
cpmsg( "Insenz璇剧▼涓嶈兘绌? );
}
$tmp_name = $_FILES['categorynew_thumb'][