📄 menu_name.php
字号:
<?php
function recursionmenustr( $menuid, $theme, &$outstr, $func_id_str, &$ct )
{
global $connection;
global $user_id;
global $func_id_str_a;
$webroot = get_cfg_var( "doc_root" );
$themedir = $webroot."/images/menu";
$lengthcur = strlen( $menuid );
$lengthnxt = strlen( $menuid ) + 2;
$sql = "\r\n\t\t SELECT * FROM user_menu \r\n\t\t\t WHERE LEFT(MENU_ID,".$lengthcur.")='".$menuid."' \r\n\t\t\t AND LENGTH(MENU_ID)=".$lengthnxt." \r\n\t\t\t AND USER_ID='".$user_id."' \r\n\t\t\t AND FUNC_ISSHOW=1 \r\n\t\t\t ORDER BY ORDER_ID ASC\r\n ";
$rs = exequery( $connection, $sql );
while ( $row = mysql_fetch_array( $rs ) )
{
$func_id = $row['FUNC_ID'];
$menu_id = $row['MENU_ID'];
$menu_name = $row['FUNC_NAME'];
$func_code = $row['FUNC_CODE'];
$func_issys = $row['FUNC_ISSYS'];
$realvalue = true;
if ( $func_issys == 1 && strpos( $func_id_str_a, ",".$func_id."," ) === false )
{
$realvalue = false;
}
if ( $realvalue )
{
$imgsrc = "/images/menu/".$theme."/icon/".$func_id.".gif";
$filepath = $themedir."/".$theme."/icon/".$func_id.".gif";
if ( !file_exists( $filepath ) )
{
$imgsrc = "/images/menu/1/icon/none.gif";
if ( 999 < $func_id )
{
$src = "/images/menu/".$theme."/icon/sysdefinenone.gif";
}
if ( 1999 < $func_id )
{
$src = "/images/menu/".$theme."/icon/mydefinenone.gif";
}
}
if ( strstr( $func_code, "http://" ) )
{
$href = $func_code;
}
else if ( strstr( $func_code, "file://" ) )
{
$winpath = str_replace( "\\", "/", str_replace( "file://", "", $func_code ) );
$winpath = base64_encode( $winpath );
$href = "/general/winexe/run_cache.php?path=".$winpath."&name=".$menu_name;
}
else
{
$href = "/general/".$func_code;
}
if ( $ct != 0 )
{
$sfix = ",";
}
++$ct;
$sqlc = "\r\n\t\t\t\t SELECT COUNT(FUNC_ID) AS cnt FROM user_menu \r\n\t\t\t\t\t WHERE LEFT(MENU_ID,".strlen( $menu_id ).")='".$menu_id."' \r\n\t\t\t\t\t AND LENGTH(MENU_ID)>".strlen( $menu_id )." \r\n\t\t\t\t\t AND FUNC_ISSHOW=1 \r\n\t\t\t\t\t AND USER_ID='".$user_id."' \r\n\t\t\t\t\t AND (FUNC_ID IN (".$func_id_str.") OR FUNC_ISSYS<>1)\r\n\t\t\t\t ";
$rsc = exequery( $connection, $sqlc );
$rowc = mysql_fetch_array( $rsc );
$type = 1;
$nbsp = "";
if ( 0 < $rowc['cnt'] )
{
$href = "javascript:void(0)";
$type = 0;
}
if ( 4 < strlen( $menu_id ) )
{
$nbsp = " ";
}
$text = $nbsp."<img src='".$imgsrc."'>".$menu_name;
htmltr( $text, $func_id, $menu_name, $type );
$outstr .= $sfix."['<img src=\"".$imgsrc."\">','".$menu_name."','".$href."','main','".$menu_name."'";
if ( 0 < $rowc['cnt'] )
{
recursionmenustr( $menu_id, $theme, $outstr, $func_id_str, $ct );
}
$ffix = "]";
$outstr .= $ffix;
}
}
return $outstr;
}
function htmltr( $text, $id, $name, $type )
{
if ( $type == 1 )
{
$color = "#000000";
$strtd = "\t class=\"menulines\" onClick=\"javascript:add_user('{$id}','{$name}')\" style=\"cursor:hand\"";
}
else
{
$color = "#999999";
$span = "<span style=\"color:<?={$color}?>\">";
$espan = "</span>";
}
echo "\r\n<tr class=\"TableLine1\">\r\n <td ";
echo $strtd;
echo "> \r\n\t\t ";
echo $span.$text.$espan;
echo " </td>\r\n</tr>\r\n\r\n\r\n";
}
include_once( "inc/conn.php" );
include_once( "inc/auth.php" );
$user_id = $_SESSION['LOGIN_USER_ID'];
$theme = $_SESSION['LOGIN_THEME'];
$sql = "\r\n SELECT up.FUNC_ID_STR FROM user u,user_priv up\r\n\t WHERE u.USER_ID='".$user_id."'\r\n\t\t AND u.user_priv=up.user_priv \r\n ";
$rs = exequery( $connection, $sql );
$ar = mysql_fetch_array( $rs );
if ( $ar['FUNC_ID_STR'] == "" )
{
message( "警告", "你没有任何权限!" );
exit( );
}
$webroot = get_cfg_var( "doc_root" );
$themedir = $webroot."/images/menu";
$func_id_str = substr( $ar['FUNC_ID_STR'], 0, -1 );
$func_id_str_a = ",".$func_id_str.",";
$funcid = $_REQUEST['id'];
if ( $funcid == "" )
{
$sql = "\r\n\t\t SELECT FUNC_ID,MENU_ID,FUNC_NAME,FUNC_CODE,FUNC_ISSYS FROM user_menu \r\n\t\t\t WHERE LENGTH(MENU_ID)=2 \r\n\t\t\t\t AND USER_ID='".$user_id."' \r\n\t\t\t\t AND FUNC_ISSHOW=1 \r\n\t\t\t AND FUNC_ISSYS=1 \r\n\t\t\t AND FUNC_ID IN (".$func_id_str.")\r\n\t\t\t\t ORDER BY ORDER_ID ASC;\r\n\t\t\t";
$rs = exequery( $connection, $sql );
$count_menu = 0;
while ( $ar = mysql_fetch_array( $rs ) )
{
$func_id = $ar['FUNC_ID'];
$realvalue = true;
if ( $func_issys == 1 && strpos( $func_id_str_a, ",".$func_id."," ) === false )
{
$realvalue = false;
}
if ( $realvalue )
{
$funcid = $func_id;
break;
}
}
}
$sql = "SELECT MENU_ID FROM user_menu WHERE FUNC_ID=".$funcid." AND USER_ID='".$user_id."'";
$rs = exequery( $connection, $sql );
$row = mysql_fetch_array( $rs );
$menuid = $row['MENU_ID'];
$sql = "\r\n\t SELECT COUNT(FUNC_ID) AS cnt FROM user_menu \r\n\t\t WHERE LEFT(MENU_ID,2)='".$menuid."' \r\n\t\t AND LENGTH(MENU_ID)=4 \r\n\t\t AND USER_ID='".$user_id."'\r\n\t\t AND (FUNC_ID IN (".$func_id_str.") OR FUNC_ISSYS<>1) \r\n\t ";
$rs = exequery( $connection, $sql );
$row = mysql_fetch_array( $rs );
if ( $row['cnt'] == 0 )
{
message( "警告", "权限有误!" );
exit( );
}
echo "\r\n<html>\r\n<head>\r\n<title></title>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\">\r\n";
include_once( "inc/menu_button.js" );
echo "\r\n";
echo "<s";
echo "cript Language=\"JavaScript\">\r\nvar parent_window = parent.dialogArguments;\r\n\r\nfunction add_user(user_id,user_name)\r\n{\r\n var autoName = document.getElementById('flagEmpty');\r\n if (parent_window.form1.FUNC_NAME.value == ''){\r\n\t autoName.value=1;\r\n }\r\n if (autoName.value==1){\r\n\t parent_window.form1.FUNC_NAME.value=user_name;\r\n }\r\n \r\n TO_VAL=parent_window.form1.H_FUNC_ID.value;\r\n if(TO_VAL.in";
echo "dexOf(\",\"+user_id+\",\")<0 && TO_VAL.indexOf(user_id+\",\")!=0)\r\n {\r\n parent_window.form1.H_FUNC_ID.value=user_id;\r\n parent_window.form1.H_FUNC_NAME.value=user_name;\r\n }\r\n}\r\n</script>\r\n<head>\r\n\r\n<body class=\"bodycolor\" topmargin=\"1\" leftmargin=\"0\">\r\n<table border=\"0\" cellspacing=\"1\" width=\"100%\" class=\"small\" cellpadding=\"5\" bordercolorlight=\"#000000\" bordercolordark=\"#FFFFFF\" onMouseover=\"borde";
echo "rize_on(event)\" onMouseout=\"borderize_off(event)\" onclick=\"borderize_on1(event)\">\r\n<thead class=\"TableLine2\">\r\n <th><b>选择菜单</b></th><input id=\"flagEmpty\" name=\"flagEmpty\" value=\"\" type=\"hidden\">\r\n</thead>\r\n";
echo "\r\n";
$outstr = recursionmenustr( $menuid, $theme, &$outstr, $func_id_str, &$ct );
echo "\t\t\r\n\r\n\r\n</table>\r\n</body>\r\n</html>\r\n";
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -