📄 col.inc.php
字号:
<?php
function addmenulocation( $pid, $pub )
{
global $fsql;
global $tbl_menu;
global $PHP_SELF;
global $strColMainMenu;
global $strColBtMenu;
global $strColSubMenu;
global $strColToMain;
$pid = $_REQUEST['pid'];
$pub = $_REQUEST['pub'];
if ( !isset( $pid ) || $pid == "" )
{
$pid = 0;
}
if ( !isset( $pub ) || $pub == "" )
{
$pub = "menu";
}
echo "<select name='MenuLocation' onChange='window.location=this.form.MenuLocation.options[this.form.MenuLocation.selectedIndex].value'>";
echo "<option value='".$PHP_SELF."?pid=0&pub=menu' ".seld( $pub, "menu" ).">".$strColMainMenu."</option>";
echo "<option value='".$PHP_SELF."?pid=0&pub=btmenu' ".seld( $pub, "btmenu" ).">".$strColBtMenu."</option>";
$fsql->query( "select * from {$tbl_menu} where pub='menu' and pid='0' and menuid!='{$menuid}' and coltype!='url' order by xuhao" );
while ( $fsql->next_record( ) )
{
$topmenu = $fsql->f( "menu" );
$topmenuid = $fsql->f( "menuid" );
if ( $topmenuid == $pid )
{
echo "<option value='".$PHP_SELF."?pid=".$topmenuid."&pub=smenu' selected>".$strColSubMenu." |".$strColToMain."|- {$topmenu} </option>";
}
else
{
echo "<option value='".$PHP_SELF."?pid=".$topmenuid."&pub=smenu' >".$strColSubMenu." |".$strColToMain."|- {$topmenu} </option>";
}
}
echo "</select>";
}
function menulocation( $menuid, $pid, $pub )
{
global $fsql;
global $tbl_menu;
global $PHP_SELF;
global $strColMainMenu;
global $strColBtMenu;
global $strColSubMenu;
global $strColToMain;
if ( !isset( $pid ) || $pid == "" )
{
$pid = 0;
}
if ( !isset( $pub ) || $pub == "" )
{
$pub = "menu";
}
echo "<select style='width=200' name='MenuLocation' onChange='window.location=this.form.MenuLocation.options[this.form.MenuLocation.selectedIndex].value'>";
echo "<option value='".$PHP_SELF."?step=changelocate&menuid=".$menuid."&pid=0&pub=menu' ".seld( $pub, "menu" ).">".$strColMainMenu."</option>";
echo "<option value='".$PHP_SELF."?step=changelocate&menuid=".$menuid."&pid=0&pub=btmenu' ".seld( $pub, "btmenu" ).">".$strColBtMenu."</option>";
$fsql->query( "select * from {$tbl_menu} where pub='menu' and pid='0' and menuid!='{$menuid}' and coltype!='url' order by xuhao" );
while ( $fsql->next_record( ) )
{
$topmenu = $fsql->f( "menu" );
$topmenuid = $fsql->f( "menuid" );
if ( $topmenuid == $pid )
{
echo "<option value='".$PHP_SELF."?step=changelocate&menuid=".$menuid."&pid=".$topmenuid."&pub=smenu' selected>".$strColSubMenu." |".$strColToMain."|- {$topmenu} </option>";
}
else
{
echo "<option value='".$PHP_SELF."?step=changelocate&menuid=".$menuid."&pid=".$topmenuid."&pub=smenu' >".$strColSubMenu." |".$strColToMain."|- {$topmenu} </option>";
}
}
echo "</select>";
}
function coladd( )
{
global $msql;
global $tbl_menu;
global $strColNotice1;
global $strColNotice7;
global $strColNotice8;
global $strColNotice15;
global $strColNotice10;
global $strColNotice11;
global $strColNotice12;
global $strColNotice13;
global $strColPname1;
global $strColPname2;
global $strColPname3;
global $strColPname4;
global $strColPname5;
global $strColPname6;
global $strColPname7;
global $tbl_pageset;
global $tbl_form;
global $charset;
global $dbcharset;
$menu = $_POST['menu'];
$coltype = $_POST['coltype'];
$url = $_POST['url'];
$ifshow = $_POST['ifshow'];
$target = $_POST['target'];
$pub = $_POST['pub'];
$pid = $_POST['pid'];
$fold = $_POST['fold'];
$openindex = $_POST['openindex'];
$skin = $_POST['skin'];
if ( $menu == "" )
{
err( $strColNotice1, "", "" );
}
if ( $coltype != "url" )
{
$nums = strlen( $fold );
if ( $nums < 3 || 12 < $nums )
{
err( $strColNotice10, "", "" );
}
$i = 0;
for ( ; $i < $nums; $i++ )
{
$w = substr( $fold, $i, 1 );
$w = ord( $w );
if ( $w < 48 || 57 < $w && $w < 65 || 90 < $w && $w < 97 || 122 < $w )
{
err( $strColNotice7, "", "" );
}
}
if ( $fold == "images" || $fold == "templates" || $fold == "adm" || $fold == "admin" || $fold == "advs" )
{
err( $strColNotice15, "", "" );
}
if ( $fold == "count" || $fold == "css" || $fold == "includes" || $fold == "install" || $fold == "js" )
{
err( $strColNotice15, "", "" );
}
if ( $fold == "language" || $fold == "module" || $fold == "pic" || $fold == "small" )
{
err( $strColNotice15, "", "" );
}
if ( $coltype == "page" )
{
$msql->query( "select * from {$tbl_menu} where fold='{$fold}' and coltype='page'" );
if ( $msql->next_record( ) )
{
err( $strColNotice11, "", "" );
}
if ( is_dir( "../page/".$fold ) )
{
err( $strColNotice11, "", "" );
}
}
else if ( $coltype == "form" )
{
$msql->query( "select * from {$tbl_menu} where fold='{$fold}' and coltype='form'" );
if ( $msql->next_record( ) )
{
err( $strColNotice11, "", "" );
}
if ( is_dir( "../form/".$fold ) )
{
err( $strColNotice11, "", "" );
}
}
else
{
$msql->query( "select * from {$tbl_menu} where fold='{$fold}'" );
if ( $msql->next_record( ) )
{
err( $strColNotice11, "", "" );
}
if ( is_dir( "../".$fold ) )
{
err( $strColNotice11, "", "" );
}
}
}
if ( !is_writable( "../" ) || !is_writable( "../page/" ) )
{
err( $strColNotice0, "", "" );
}
if ( $coltype == "url" && ( $url == "" || $url == "http://" ) )
{
err( $strColNotice8, "", "" );
}
$menu = htmlspecialchars( $menu );
$url = htmlspecialchars( $url );
$fold = htmlspecialchars( $fold );
$msql->query( "select max(xuhao) from {$tbl_menu} where pub='{$pub}'" );
if ( $msql->next_record( ) )
{
$maxxuhao = $msql->f( "max(xuhao)" );
}
$nowxuhao = $maxxuhao + 1;
$msql->query( "insert into {$tbl_menu} values(\r\n\t\t0,\r\n\t\t'{$pid}',\r\n\t\t'{$menu}',\r\n\t\t'{$coltype}',\r\n\t\t'{$url}',\r\n\t\t'{$fold}',\r\n\t\t'{$pub}',\r\n\t\t'{$ifshow}',\r\n\t\t'1',\r\n\t\t'{$nowxuhao}',\r\n\t\t'{$target}',\r\n\t\t'{$openindex}',\r\n\t\t'0',\r\n\t\t'{$skin}'\r\n\r\n\t\t)" );
$menuid = $msql->instid( );
switch ( $coltype )
{
case "page" :
$rootdir = "../page";
initcol( $rootdir, $menuid, $coltype, $strColPname1, "page", "page_page.htm", "1", $fold, "page_html.php", "index.html" );
break;
case "news" :
$rootdir = "../".$fold;
mkdir( $rootdir, 511 );
initcol( $rootdir, $menuid, $coltype, $strColPname4, "main", "page_news_index.htm", "1", "main", "news_main.php", "index.html" );
initcol( $rootdir, $menuid, $coltype, $strColPname2, "query", "page_news_query.htm", "2", "class", "news_class.php", "0.html" );
initcol( $rootdir, $menuid, $coltype, $strColPname3, "detail", "page_news_detail.htm", "3", "html", "news_html.php", "0.html" );
break;
case "cp" :
$rootdir = "../".$fold;
mkdir( $rootdir, 511 );
initcol( $rootdir, $menuid, $coltype, $strColPname4, "main", "page_cp_index.htm", "1", "main", "cp_main.php", "index.html" );
initcol( $rootdir, $menuid, $coltype, $strColPname2, "query", "page_cp_query.htm", "2", "class", "cp_class.php", "0.html" );
initcol( $rootdir, $menuid, $coltype, $strColPname3, "detail", "page_cp_detail.htm", "3", "html", "cp_html.php", "0.html" );
break;
case "down" :
$rootdir = "../".$fold;
mkdir( $rootdir, 511 );
initcol( $rootdir, $menuid, $coltype, $strColPname4, "main", "page_down_index.htm", "1", "main", "down_main.php", "index.html" );
initcol( $rootdir, $menuid, $coltype, $strColPname2, "query", "page_down_query.htm", "2", "class", "down_class.php", "0.html" );
initcol( $rootdir, $menuid, $coltype, $strColPname3, "detail", "page_down_detail.htm", "3", "html", "down_html.php", "0.html" );
mkdir( $rootdir."/html/download", 511 );
break;
case "form" :
$vsion = $msql->version( );
$mysqlversion = substr( $vsion, 0, 4 );
if ( !$dbcharset && in_array( strtolower( $charset ), array( "gbk", "big5", "utf-8" ) ) )
{
$dbcharset = str_replace( "-", "", $charset );
}
if ( 4.1 <= $mysqlversion )
{
$addsql = "ENGINE=MyISAM DEFAULT CHARSET=".$dbcharset;
}
$table_name = $tbl_form."_".$menuid;
$msql->query( "CREATE TABLE {$table_name} (\r\n\t\t\t\tid int(3) auto_increment,\r\n\t\t\t\tfield_caption varchar(200),\r\n\t\t\t\tfield_type int(1),\r\n\t\t\t\tfield_size int(3),\r\n\t\t\t\tfield_name varchar(200),\r\n\t\t\t\tfield_value varchar(255),\r\n\t\t\t\tfield_null int(1),\r\n\t\t\t\tvalue_repeat int(1),\r\n\t\t\t\tfield_intro varchar(255),\r\n\t\t\t\tuse_field int(1),\r\n\t\t\t\tmoveable int(1),\r\n\t\t\t\txuhao int(3),\r\n\t\t\t\tPRIMARY KEY (id) \r\n\t\t\t\t) ".$addsql." \r\n\t\t\t\t" );
$msql->query( "INSERT INTO {$table_name} SELECT * FROM {$tbl_form}" );
$rootdir = "../form";
initcol( $rootdir, $menuid, $coltype, $strColPname5, "form", "page_form.htm", "1", $fold, "form.php", "form.html" );
break;
}
sayok( $strColNotice12, "", "" );
}
function initcol( $rootdir, $menuid, $coltype, $pagecname, $pagename, $tempfile, $xuhao, $dir, $infile, $htmlfile )
{
global $msql;
global $tbl_pageset;
$fdir = $rootdir."/".$dir;
mkdir( $fdir, 511 );
$imgdir = $fdir."/images";
mkdir( $imgdir, 511 );
$fd = fopen( $fdir."/menuid", "w" );
fwrite( $fd, $menuid, 30 );
fclose( $fd );
chmod( $fdir."/menuid", 438 );
$str = "<";
$str .= "?php";
$str .= "\n";
$str .= "include('../../includes/".$infile."');\n";
$str .= "?";
$str .= ">";
$fd = fopen( $fdir."/index.php", "w" );
fwrite( $fd, $str, 100 );
fclose( $fd );
chmod( $fdir."/index.php", 493 );
$str = "<script>window.location='index.php?0.html'</script>";
$fd = fopen( $fdir."/".$htmlfile, "w" );
fwrite( $fd, $str, 200 );
fclose( $fd );
chmod( $fdir."/".$htmlfile, 493 );
$msql->query( "insert into {$tbl_pageset} set menuid='{$menuid}',coltype='{$coltype}',name='{$pagecname}',pagename='{$pagename}',tempfile='{$tempfile}',xuhao='{$xuhao}'" );
}
function coltype2colname( $coltype )
{
global $fsql;
global $tbl_coltype;
$fsql->query( "select colname from {$tbl_coltype} where coltype='{$coltype}'" );
if ( $fsql->next_record( ) )
{
$colname = $fsql->f( "colname" );
}
return $colname;
}
function cat2catpath( $tbl, $catid )
{
global $msql;
$msql->query( "select catpath from {$tbl} where catid='{$catid}'" );
if ( $msql->next_record( ) )
{
$catpath = $msql->f( "catpath" );
}
return $catpath;
}
function changelocate( $menuid, $pid, $pub )
{
global $msql;
global $tbl_menu;
global $PHP_SELF;
global $strColNotice22;
if ( $pub != "menu" )
{
$msql->query( "select * from {$tbl_menu} where pid='{$menuid}'" );
if ( $msql->next_record( ) )
{
err( $strColNotice22, "", "" );
}
}
$msql->query( "update {$tbl_menu} set pid='{$pid}',pub='{$pub}' where menuid='{$menuid}'" );
echo "<script>window.location='col.php?pid={$pid}&pub={$pub}'</script>";
}
function menumodify( )
{
global $msql;
global $tbl_menu;
global $strColNotice1;
$menuid = $_REQUEST['menuid'];
$menu = $_REQUEST['menu'];
$xuhao = $_REQUEST['xuhao'];
$skin = $_REQUEST['skin'];
$target = $_REQUEST['target'];
$ifshow = $_REQUEST['ifshow'];
$openindex = $_REQUEST['openindex'];
$secure = $_REQUEST['secure'];
if ( $menu == "" || $menu == " " )
{
err( $strColNotice1, "", "" );
}
$menu = htmlspecialchars( $menu );
$msql->query( "update {$tbl_menu} set \r\n\tmenu='{$menu}',\r\n\ttarget='{$target}',\r\n\txuhao='{$xuhao}',\r\n\tskin='{$skin}',\r\n\tifshow='{$ifshow}',\r\n\topenindex='{$openindex}',\r\n\tsecure='{$secure}'\r\n\t\t\r\n\twhere menuid='{$menuid}'" );
}
function coldel( $menuid )
{
global $msql;
global $fsql;
global $tbl_menu;
global $strColNotice23;
global $strColNotice24;
global $strColNotice25;
global $strColNotice26;
global $strColNotice27;
global $strColNotice28;
global $tbl_down_con;
global $tbl_down_cat;
global $tbl_form;
global $tbl_form_feedback;
global $tbl_comment;
global $tbl_logo;
global $tbl_pop;
global $tbl_advs_float;
global $tbl_advs_dl;
global $tbl_advs_left;
global $tbl_advs_right;
global $tbl_pageset;
global $tbl_plus;
global $tbl_prop;
global $tbl_cp_con;
global $tbl_cp_cat;
global $tbl_news_cat;
global $tbl_news_con;
$pid = $_GET['pid'];
$pub = $_GET['pub'];
if ( $menuid == "" )
{
err( $strColNotice23, "", "" );
}
$msql->query( "select * from {$tbl_menu} where menuid='{$menuid}'" );
if ( $msql->next_record( ) )
{
$moveable = $msql->f( "moveable" );
$coltype = $msql->f( "coltype" );
$fold = $msql->f( "fold" );
}
else
{
err( $strColNotice28, "", "" );
}
if ( $moveable != 1 )
{
err( $strColNotice24, "", "" );
}
if ( $coltype != "url" && ( $fold == "" || strlen( $fold ) < 3 || strstr( $fold, "/" ) || strstr( $fold, "." ) ) )
{
err( $strColNotice27, "", "" );
}
$msql->query( "select * from {$tbl_menu} where pid='{$menuid}'" );
if ( $msql->next_record( ) )
{
err( $strColNotice25, "", "" );
}
$msql->query( "delete from {$tbl_logo} where menuid='{$menuid}'" );
$msql->query( "delete from {$tbl_pop} where menuid='{$menuid}'" );
$msql->query( "delete from {$tbl_advs_float} where menuid='{$menuid}'" );
$msql->query( "delete from {$tbl_advs_dl} where menuid='{$menuid}'" );
$msql->query( "delete from {$tbl_advs_left} where menuid='{$menuid}'" );
$msql->query( "delete from {$tbl_advs_right} where menuid='{$menuid}'" );
$msql->query( "delete from {$tbl_pageset} where menuid='{$menuid}'" );
$msql->query( "delete from {$tbl_plus} where menuid='{$menuid}'" );
$msql->query( "delete from {$tbl_prop} where menuid='{$menuid}'" );
switch ( $coltype )
{
case "page" :
delfold( "../page/".$fold );
break;
case "news" :
delfold( "../".$fold );
$msql->query( "delete from {$tbl_news_con} where menuid='{$menuid}'" );
$msql->query( "delete from {$tbl_news_cat} where menuid='{$menuid}'" );
break;
case "cp" :
delfold( "../".$fold );
$msql->query( "delete from {$tbl_cp_con} where menuid='{$menuid}'" );
$msql->query( "delete from {$tbl_cp_cat} where menuid='{$menuid}'" );
break;
case "down" :
delfold( "../".$fold );
$msql->query( "delete from {$tbl_down_con} where menuid='{$menuid}'" );
$msql->query( "delete from {$tbl_down_cat} where menuid='{$menuid}'" );
break;
case "form" :
delfold( "../form/".$fold );
$nowformtbl = $tbl_form."_".$menuid;
$msql->query( "drop table if exists {$nowformtbl}" );
$msql->query( "delete from {$tbl_form_feedback} where menuid='{$menuid}'" );
break;
}
$msql->query( "delete from {$tbl_comment} where menuid='{$menuid}'" );
$msql->query( "delete from {$tbl_menu} where menuid='{$menuid}'" );
sayok( $strColNotice26, "col.php?pid={$pid}&pub={$pub}", "" );
}
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -