本帖最后由 stonecliz 于 2010-12-15 09:34 编辑
早上反编辑了365Q的代码,发现有错误的,不懂PHP 有懂的给修正一下!!!!!!!!!!!
http://u.115.com/file/t5f586c5b5#
365Q.rar
Parse error: syntax error, unexpected T_DO, expecting ';' in D:\365Q\webroot\inc\utility.php on line 250
<?php
/*********************/
/* */
/* Version : 5.1.0 */
/* Author : RM */
/* Comment : 071223 */
/* */
/*********************/
function Message( $TITLE, $CONTENT, $STYLE = "", $BUTTONS = array( ) )
{
$WIDTH = strlen( $CONTENT ) * 15 + 140;
$WIDTH = 500 < $WIDTH ? 500 : $WIDTH;
if ( $STYLE == "blank" )
{
$WIDTH -= 70;
}
if ( $STYLE == "" )
{
if ( $TITLE == "错误" )
{
$STYLE = "error";
}
else if ( $TITLE == "警告" )
{
$STYLE = "warning";
}
else if ( $TITLE == "停止" )
{
$STYLE = "stop";
}
else if ( $TITLE == "禁止" )
{
$STYLE = "forbidden";
}
else if ( $TITLE == "帮助" )
{
$STYLE = "help";
}
else
{
$STYLE = "info";
}
}
echo "<table class=\"MessageBox\" align=\"center\" width=\"";
echo $WIDTH;
echo "\">\r\n";
if ( $TITLE != "" )
{
echo " <tr class=\"head\">\r\n <td class=\"left\"></td>\r\n <td class=\"center\">\r\n <div class=\"title\">";
echo $TITLE;
echo "</div>\r\n </td>\r\n <td class=\"right\"></td>\r\n </tr>\r\n";
}
else
{
echo " <tr class=\"head-no-title\">\r\n <td class=\"left\"></td>\r\n <td class=\"center\">\r\n </td>\r\n <td class=\"right\"></td>\r\n </tr>\r\n";
}
echo " <tr class=\"msg\">\r\n <td class=\"left\"></td>\r\n <td class=\"center ";
echo $STYLE;
echo "\">\r\n <div class=\"msg-content\">";
echo $CONTENT;
echo "</div>\r\n </td>\r\n <td class=\"right\"></td>\r\n </tr>\r\n";
if ( is_array( $BUTTONS ) && 0 < count( $BUTTONS ) )
{
echo " <tr class=\"control\">\r\n <td class=\"left\"></td>\r\n <td class=\"center\">\r\n";
foreach ( $BUTTONS as $BUTTON )
{
echo "<a class=\"BigBtn\" href=\"".( $BUTTON['href'] != "" ? str_replace( "\"", "\\\"", $BUTTON['href'] ) : "javascript:;" )."\"";
if ( $BUTTON['click'] != "" )
{
echo " onclick=\"".str_replace( "\"", "\\\"", $BUTTON['click'] )."\"";
}
echo "><span>".$BUTTON['value']."</span></a> ";
}
echo " </td>\r\n <td class=\"right\"></td>\r\n </tr>\r\n";
}
echo " <tr class=\"foot\">\r\n <td class=\"left\"></td>\r\n <td class=\"center\"></td>\r\n <td class=\"right\"></td>\r\n </tr>\r\n</table>\r\n";
}
function Button_Back( )
{
global $HTML_CHARSET;
$VALUE = "返回";
if ( $HTML_CHARSET != "" )
{
$VALUE = iconv( ini_get( "default_charset" ), $HTML_CHARSET, $VALUE );
}
echo " <br><center><input type=\"button\" class=\"BigButton\" value=\"";
echo $VALUE;
echo "\" onclick=\"history.back();\"></center>\r\n";
}
function Button_Back_Law( )
{
echo "<br><center><input type=\"button\" class=\"BigButton\" value=\"回上一层\" onclick=\"history.back();\"> <input type=\"button\" class=\"BigButton\" value=\"回主目录\" onclick=\"location='/general/info/law';\"></center><br>";
}
function find_id( $STRING, $ID )
{
$STRING = ltrim( $STRING, "," );
if ( $ID == "" || $ID == "," )
{
return FALSE;
}
if ( substr( $STRING, -1 ) != "," )
{
$STRING .= ",";
}
if ( 0 < strpos( $STRING, ",".$ID."," ) )
{
return TRUE;
}
if ( strpos( $STRING, $ID."," ) === 0 )
{
return TRUE;
}
if ( !strstr( $ID, "," ) || $STRING == $ID )
{
return TRUE;
}
return FALSE;
}
function check_id( $STRING, $ID, $FLAG )
{
$MY_ARRAY = explode( ",", $ID );
$ARRAY_COUNT = sizeof( $MY_ARRAY );
if ( $MY_ARRAY[$ARRAY_COUNT - 1] == "" )
{
--$ARRAY_COUNT;
}
$I = 0;
for ( ;
$I < $ARRAY_COUNT;
++$I
)
{
if ( $FLAG )
{
if ( find_id( $STRING, $MY_ARRAY[$I] ) )
{
$ID_STR .= $MY_ARRAY[$I].",";
}
}
else if ( !find_id( $STRING, $MY_ARRAY[$I] ) )
{
$ID_STR .= $MY_ARRAY[$I].",";
}
}
return $ID_STR;
}
function update_my_online_status( $sid_upd )
{
global $connection;
global $LOGIN_UID;
$query = "update USER_ONLINE set TIME='".time( )."' ";
if ( $sid_upd )
{
$query .= ",SID='".session_id( )."' ";
}
$query .= " where UID='".$LOGIN_UID."'";
exequery( $connection, $query );
if ( mysql_affected_rows( ) == 0 )
{
$query = "insert into USER_ONLINE values('".$LOGIN_UID."','".time( )."','".session_id( )."')";
exequery( $connection, $query );
}
}
function clear_online_status( )
{
global $connection;
global $ROOT_PATH;
global $ONLINE_REF_SEC;
global $SYS_DEPARTMENT;
if ( !is_array( $SYS_DEPARTMENT ) )
{
include_once( "inc/department.php" );
}
$query = "delete from USER_ONLINE where TIME<".( time( ) - $ONLINE_REF_SEC - 5 );
$cursor = exequery( $connection, $query );
$DEPT_ID_STR = "";
$query = ( "select USER.UID,USER_ID,USER_NAME,DEPT_ID,DEPT_ID_OTHER,SEX,ON_STATUS,USER.USER_PRIV,PRIV_NO from USER,USER_ONLINE,USER_PRIV where USER_ONLINE.TIME>=".( time( ) - $ONLINE_REF_SEC - 5 ) )." and USER.UID=USER_ONLINE.UID and USER.USER_PRIV=USER_PRIV.USER_PRIV and USER.DEPT_ID!=0 order by PRIV_NO,USER_NO,USER_NAME";
$cursor = exequery( $connection, $query );
while ( $ROW = mysql_fetch_array( $cursor ) )
{
$UID = $ROW['UID'];
$USER_ID = $ROW['USER_ID'];
$USER_NAME = $ROW['USER_NAME'];
$SEX = $ROW['SEX'];
$ON_STATUS = $ROW['ON_STATUS'];
$DEPT_ID = $ROW['DEPT_ID'];
$DEPT_ID_OTHER = $ROW['DEPT_ID_OTHER'];
$USER_PRIV = $ROW['USER_PRIV'];
$PRIV_NO = $ROW['PRIV_NO'];
$SEX = $SEX == "" ? "0" : $SEX;
$ON_STATUS = $ON_STATUS == "" || $ON_STATUS == "0" ? "1" : $ON_STATUS;
$USER_STR .= " \"".$UID."\"=> array(\"USER_ID\" => \"".$USER_ID."\", \"USER_NAME\" => \"".$USER_NAME."\", \"DEPT_ID\" => \"".$DEPT_ID."\", \"SEX\" => \"".$SEX."\", \"ON_STATUS\" => \"".$ON_STATUS."\", \"USER_PRIV\" => \"".$USER_PRIV."\", \"RIV_NO\" => \"".$PRIV_NO."\"),\n";
$DEPT_ID_ALL = $DEPT_ID.",".$DEPT_ID_OTHER;
$DEPT_ID_ARRAY = explode( ",", $DEPT_ID_ALL );
$I = 0;
for ( ;
$I < count( $DEPT_ID_ARRAY );
++$I
)
{
$DEPT_ID = $DEPT_ID_ARRAY[$I];
while ( $DEPT_ID == "" || !( 0 < $DEPT_ID ) && find_id( $DEPT_ID_STR, $DEPT_ID ) )
{
if ( !array_key_exists( $DEPT_ID, $SYS_DEPARTMENT ) )
{
@include_once( "inc/utility_org.php" );
cache_department( );
@include( "inc/department.php" );
}
$DEPT_ID_STR .= $DEPT_ID.",";
$DEPT_ID = $SYS_DEPARTMENT[$DEPT_ID]['DEPT_PARENT'];
}
}
}
while ( list( $DEPT_ID, $DEPT ) = each( &$SYS_DEPARTMENT ) )
{
if ( find_id( $DEPT_ID_STR, $DEPT_ID ) )
{
$DEPT_STR .= " \"".$DEPT_ID."\"=> array(\"DEPT_NAME\" => \"".$DEPT['DEPT_NAME']."\", \"DEPT_PARENT\" => \"".$DEPT['DEPT_PARENT']."\", \"DEPT_LONG_NAME\" => \"".$DEPT['DEPT_LONG_NAME']."\"),\n";
}
}
$DATA = "<?\n\$SYS_ONLINE_USER = array(\n".$USER_STR.");\n";
$DATA .= "\n\$SYS_ONLINE_DEPT = array(\n".$DEPT_STR.");\n?>";
file_put_contents( $ROOT_PATH."inc/user_online.php", $DATA );
}
function get_online_code( $TYPE = "1", $RTX_FLAG = "0" )
{
global $connection;
global $LOGIN_UID;
global $LOGIN_USER_ID;
global $LOGIN_USER_PRIV;
global $LOGIN_DEPT_ID;
global $SYS_DEPARTMENT;
@include_once( "inc/user_online.php" );
@include_once( "inc/utility_org.php" );
$PRIV_NO_FLAG = 0;
$MODULE_ID = "1";
@include_once( "inc/my_priv.php" );
if ( !is_array( $SYS_ONLINE_USER ) )
{
clear_online_status( );
include_once( "inc/user_online.php" );
}
$EXCLUDE_UID_STR = my_exclude_uid( );
if ( $TYPE == "1" )
{
$DEPT_ID_ARRAY = array( );
for ( ; do 这里是250行
while ( list( $UID, $USER ) = each( &$SYS_ONLINE_USER ) )
{
do
{
if ( !( $USER['USER_ID'] != $LOGIN_USER_ID ) )
{
break;
}
else
{
if ( !is_dept_priv( $USER['DEPT_ID'], $DEPT_PRIV, $DEPT_ID_STR, TRUE ) && !( $DEPT_PRIV == "3" ) || $DEPT_PRIV == "4" && !find_id( $USER_ID_STR, $USER['USER_ID'] ) )
{
if ( $ROLE_PRIV == "0" && $USER['PRIV_NO'] <= $MY_PRIV_NO || $ROLE_PRIV == "1" && $USER['PRIV_NO'] < $MY_PRIV_NO )
{
break;
}
if ( !( $ROLE_PRIV == "3" ) )
{
break;
}
find_id( $PRIV_ID_STR, $USER['USER_PRIV'] );
if ( find_id( $PRIV_ID_STR, $USER['USER_PRIV'] ) )
{
break;
if ( find_id( $PRIV_ID_STR, $USER['USER_PRIV'] ) )
{
break;
break;
}
}
}
}
}
)
{
} while ( 0 );
$USER_TEXT .= "tree.nodes['".$USER['DEPT_ID'].",_".$USER['USER_ID']."']='text:".$USER['USER_NAME'].";icon:U".$USER['SEX'].$USER['ON_STATUS'].";";
if ( $RTX_FLAG == "1" )
{
$USER_TEXT .= "onload:RAP(\"".$USER['USER_ID']."\");";
}
$USER_TEXT .= "url:javascript:view_user(\"".$USER['USER_ID']."\");exclude:".( find_id( $EXCLUDE_UID_STR, $UID ) ? "1" : "0" ).";';";
if ( !in_array( $USER['DEPT_ID'], $DEPT_ID_ARRAY ) )
{
$DEPT_ID = $USER['DEPT_ID'];
$DEPT_ID_ARRAY[] = $DEPT_ID;
if ( 0 < $DEPT_ID )
{
$DEPT_PARENT = $SYS_DEPARTMENT[$DEPT_ID]['DEPT_PARENT'];
if ( !( $DEPT_PARENT == 0 ) )
{
if ( $SYS_DEPARTMENT[$DEPT_ID] )
{
break;
if ( $DEPT_PARENT == 0 )
{
break;
if ( $DEPT_PARENT == 0 )
{
break;
}
}
}
}
}
}
}
$DEPT_ID_ARRAY[] = $DEPT_PARENT;
$DEPT_ID = $DEPT_PARENT;
} while ( 1 );
while ( list( $DEPT_ID, $DEPT ) = each( &$SYS_ONLINE_DEPT ) )
{
if ( !in_array( $DEPT_ID, $DEPT_ID_ARRAY ) )
{
}
else
{
if ( $DEPT['DEPT_PARENT'] == 0 )
{
$DEPT_PARENT = "TDOA";
}
else
{
$DEPT_PARENT = $DEPT['DEPT_PARENT'];
}
if ( isorgbydeptid( $DEPT_ID ) == 1 )
{
$DEPT_TEXT .= "tree.nodes['".$DEPT_PARENT.",".$DEPT_ID."']='type:1;iconrg;text:[".$DEPT['DEPT_NAME']."];';";
}
else
{
$DEPT_TEXT .= "tree.nodes['".$DEPT_PARENT.",".$DEPT_ID."']='type:1;text:[".$DEPT['DEPT_NAME']."];';";
}
}
}
return "+OK ".count( $SYS_ONLINE_USER ).":".$USER_TEXT.$DEPT_TEXT;
}
$DEPT_COUNT = 0;
while ( list( $DEPT_ID, $DEPT ) = each( &$SYS_ONLINE_DEPT ) )
{
if ( $DEPT_ID != $LOGIN_DEPT_ID && !is_dept_priv( $DEPT_ID, $DEPT_PRIV, $DEPT_ID_STR, TRUE ) )
{
}
else
{
$DEPT_USER_COUNT = 0;
reset( &$SYS_ONLINE_USER );
for ( ;
while ( list( $UID, $USER ) = each( &$SYS_ONLINE_USER ) )
{
do
{
if ( $USER['DEPT_ID'] != $DEPT_ID )
{
break;
}
if ( $USER['USER_ID'] != $LOGIN_USER_ID && !is_dept_priv( $DEPT_ID, $DEPT_PRIV, $DEPT_ID_STR, TRUE ) )
{
if ( !( $USER['USER_ID'] != $LOGIN_USER_ID ) )
{
break;
}
if ( !( $DEPT_PRIV == "3" ) || $DEPT_PRIV == "4" && !find_id( $USER_ID_STR, $USER['USER_ID'] ) )
{
if ( $ROLE_PRIV == "0" && $USER['PRIV_NO'] <= $MY_PRIV_NO || $ROLE_PRIV == "1" && $USER['PRIV_NO'] < $MY_PRIV_NO )
{
break;
}
if ( !( $ROLE_PRIV == "3" ) )
{
break;
}
find_id( $PRIV_ID_STR, $USER['USER_PRIV'] );
if ( find_id( $PRIV_ID_STR, $USER['USER_PRIV'] ) )
{
break;
if ( find_id( $PRIV_ID_STR, $USER['USER_PRIV'] ) )
{
break;
if ( find_id( $PRIV_ID_STR, $USER['USER_PRIV'] ) )
{
break;
if ( find_id( $PRIV_ID_STR, $USER['USER_PRIV'] ) )
{
break;
break;
}
}
}
}
}
}
)
{
} while ( 0 );
$USER_TEXT .= "D[".$DEPT_COUNT."][3][".$DEPT_USER_COUNT."]=[\"".$USER['USER_ID']."\",\"".htmlspecialchars( $USER['USER_NAME'] )."\",\"U".$USER['SEX'].$USER['ON_STATUS']."\",".( find_id( $EXCLUDE_UID_STR, $UID ) ? "1" : "0" )."];";
++$DEPT_USER_COUNT;
}
if ( !( $DEPT_USER_COUNT == 0 ) )
{
$DEPT_TEXT .= "D[".$DEPT_COUNT."]=[\"".$DEPT_ID."\",\"".htmlspecialchars( $DEPT['DEPT_NAME'] )."\",\"".htmlspecialchars( $DEPT['DEPT_LONG_NAME'] )."\",[]];";
++$DEPT_COUNT;
}
}
}
return "+OK D = new Array();".$DEPT_TEXT.$USER_TEXT;
}
function cache_menu( )
{
global $connection;
global $ROOT_PATH;
$query = "SELECT * from SYS_MENU order by MENU_ID";
$cursor = exequery( $connection, $query );
while ( $ROW = mysql_fetch_array( $cursor ) )
{
$MENU_NAME = str_replace( array( "\"", "\\", "'" ), array( "", "/", "" ), $ROW['MENU_NAME'] );
$IMAGE = str_replace( array( "\"", "\\", "'" ), array( "", "/", "" ), $ROW['IMAGE'] );
$cache2 .= " \"m".$ROW['MENU_ID']."\" => array(\"MENU_ID\" => \"".$ROW['MENU_ID']."\", \"FUNC_NAME\" => \"".$MENU_NAME."\", \"IMAGE\" => \"".$ROW['IMAGE']."\"),\n";
$cache3 .= "func_array[\"m".$ROW['MENU_ID']."\"]=[\"".$MENU_NAME."\",\"".$IMAGE."\"];\n";
$query = "SELECT * from SYS_FUNCTION where MENU_ID like '".$ROW['MENU_ID']."%' order by MENU_ID";
$cursor1 = exequery( $connection, $query );
while ( $ROW = mysql_fetch_array( $cursor1 ) )
{
$FUNC_NAME = str_replace( array( "\"", "\\", "'" ), array( "", "/", "" ), $ROW['FUNC_NAME'] );
$FUNC_CODE = str_replace( array( "\"", "\\", "'" ), array( "", "/", "" ), $ROW['FUNC_CODE'] );
$OPEN_WINDOW = substr( $FUNC_CODE, 0, 2 ) == "1:" ? 1 : 0;
$FUNC_CODE = substr( $FUNC_CODE, 0, 2 ) == "1:" ? substr( $FUNC_CODE, 2 ) : $FUNC_CODE;
if ( 10000 <= $ROW['FUNC_ID'] && $ROW['FUNC_ID'] <= 20000 )
{
$IMAGE = "fis";
}
else if ( stristr( $FUNC_CODE, "http://" ) )
{
$IMAGE = "menu_url";
}
else if ( stristr( $FUNC_CODE, "file://" ) )
{
$IMAGE = "winexe";
}
else if ( stristr( $FUNC_CODE, "/" ) )
{
$IMAGE = substr( $FUNC_CODE, 0, strpos( $FUNC_CODE, "/" ) );
}
else
{
$IMAGE = $FUNC_CODE;
}
$cache .= " \"".$ROW['FUNC_ID']."\" => \"".$FUNC_CODE."\",\n";
$cache2 .= " \"".$ROW['FUNC_ID']."\" => array(\"FUNC_ID\" => \"".$ROW['FUNC_ID']."\", \"MENU_ID\" => \"".$ROW['MENU_ID']."\", \"FUNC_NAME\" => \"".$FUNC_NAME."\", \"FUNC_CODE\" => \"".$FUNC_CODE."\", \"IMAGE\" => \"".$IMAGE."\"";
$cache3 .= "func_array[\"f".$ROW['FUNC_ID']."\"]=[\"".$FUNC_NAME."\",\"".$FUNC_CODE."\",\"".$IMAGE."\"";
if ( $OPEN_WINDOW )
{
$cache2 .= ", \"OPEN_WINDOW\" => ".$OPEN_WINDOW;
$cache3 .= ",\"".$OPEN_WINDOW."\"";
}
$cache2 .= "),\n";
$cache3 .= "];\n";
}
}
$cache = "<?\n\$SYS_FUNCTION = array(\n".substr( $cache, 0, -2 )."\n);\n?>";
$cache2 = "<?\n\$SYS_FUNCTION = array(\n".substr( $cache2, 0, -2 )."\n);\n?>";
$cache3 = "var func_array=[];\n".$cache3;
$cache_file = $ROOT_PATH."inc/sys_function.php";
$cache_file2 = $ROOT_PATH."inc/sys_function_all.php";
$cache_file3 = $ROOT_PATH."inc/sys_function.js";
if ( !file_exists( $cache_file ) && is_writable( $cache_file ) )
{
file_put_contents( $cache_file, $cache );
file_put_contents( $cache_file2, $cache2 );
file_put_contents( $cache_file3, $cache3 );
}
else
{
message( "错误", "不能写入缓存文件,请设置OA安装目录\\webroot\\inc目录的权限" );
}
}
function iask( $FUNC, $IASK_SMALL = 0 )
{
global $IASK_YN;
if ( !$IASK_YN )
{
return;
}
if ( $IASK_SMALL )
{
$IMG_STR = "iask_small.png";
}
else
{
$IMG_STR = "iask.png";
}
return "<span class=\"small\" style=\"cursor:hand;\" title=\"点击打开操作提示与技巧窗口\" onclick=\"javascript:window.open('/module/iask?FUNC=".$FUNC."','iask','top=0,left=0,width=600,height=500,status=1,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes')\"> <img src=\"/images/".$IMG_STR."\" align=\"absmiddle\"></span>";
}
function new_sms_remind( $UID, $REMIND = 1 )
{
global $ROOT_PATH;
if ( !file_exists( $ROOT_PATH."attachment" ) )
{
mkdir( $ROOT_PATH."attachment", 448 );
}
if ( !file_exists( $ROOT_PATH."attachment/new_sms" ) )
{
mkdir( $ROOT_PATH."attachment/new_sms", 448 );
}
file_put_contents( $ROOT_PATH."attachment/new_sms/".$UID.".sms", $REMIND );
}
function td_trim( $STR, $charlist = " ,\t\n\r\x00\x0B" )
{
return trim( $STR, $charlist );
}
$BUTTON_BACK = array(
array( "value" => "返回", "href" => "javascript:history.back();" )
);
$BUTTON_CLOSE = array(
array( "value" => "关闭", "href" => "javascript:window.close();" )
);
$BUTTON_CLOSE_TAB = array(
array( "value" => "关闭", "href" => "javascript:window.top.closeTab();" )
);
?>
|