通达OA公共代码 php常用检测函数

通达OA公共代码 php常用检测函数

从通达OA公共代码扒下的php常用检测函数代码,学习php的朋友可以参考下。

check_type.php(使用类型检验函数)

复制代码 代码如下:

<?php
/*********************/
/* */
/* Version : 5.1.0 */
/* Author : RM */
/* Comment : 071223 */
/* */
/*********************/
function is_number( $str )
{
if ( substr( $str, 0, 1 ) == "-" )
{
$str = substr( $str, 1 );
}
$length = strlen( $str );
$i = 0;
for ( ; $i < $length; ++$i )
{
$ascii_value = ord( substr( $str, $i, 1 ) );
if ( 48 <= $ascii_value && $ascii_value <= 57 )
{
continue;
}
return FALSE;
}
if ( $str != "0" )
{
$str = intval( $str );
if ( $str == 0 )
{
return FALSE;
}
}
return TRUE;
}
function is_decimal( $str )
{
if ( substr( $str, 0, 1 ) == "-" )
{
$str = substr( $str, 1 );
}
$length = strlen( $str );
$i = 0;
for ( ; $i < $length; ++$i )
{
$ascii_value = ord( substr( $str, $i, 1 ) );
if ( 0 < $i && $ascii_value == 46 || 48 <= $ascii_value && $ascii_value <= 57 )
{
continue;
}
return FALSE;
}
return TRUE;
}
function is_money( $str )
{
$dot_pos = strpos( $str, "." );
if ( !$dot_pos )
{
return FALSE;
}
$str1 = substr( $str, 0, $dot_pos );
if ( 14 < strlen( $str1 ) )
{
return FALSE;
}
if ( !is_number( $str1 ) )
{
return FALSE;
}
$str2 = substr( $str, $dot_pos + 1, strlen( $str ) - $dot_pos );
if ( strlen( $str2 ) != 2 )
{
return FALSE;
}
if ( !is_number( $str2 ) )
{
return FALSE;
}
return TRUE;
}
function is_money_len( $str, $int_len, $dot_len )
{
$dot_pos = strpos( $str, "." );
if ( !$dot_pos )
{
return FALSE;
}
$str1 = substr( $str, 0, $dot_pos );
if ( $int_len < strlen( $str1 ) )
{
return FALSE;
}
if ( !is_number( $str1 ) )
{
return FALSE;
}
$str2 = substr( $str, $dot_pos + 1, strlen( $str ) - $dot_pos );
if ( strlen( $str2 ) != $dot_len )
{
return FALSE;
}
if ( !is_number( $str2 ) )
{
return FALSE;
}
return TRUE;
}
function is_date( $str )
{
$YEAR = "";
$MONTH = "";
$DAY = "";
$len = strlen( $str );
$offset = 0;
$i = strpos( $str, "-", $offset );
$YEAR = substr( $str, $offset, $i - $offset );
$offset = $i + 1;
if ( $len < $offset )
{
return FALSE;
}
if ( $i )
{
$i = strpos( $str, "-", $offset );
$MONTH = substr( $str, $offset, $i - $offset );
$offset = $i + 1;
if ( $len < $offset )
{
return FALSE;
}
if ( $i )
{
$DAY = substr( $str, $offset, $len - $offset );
}
}
if ( $YEAR == "" || $MONTH == "" || $DAY == "" )
{
return FALSE;
}
if ( !checkdate( intval( $MONTH ), intval( $DAY ), intval( $YEAR ) ) )
{
return FALSE;
}
return TRUE;
}
function is_time( $str )
{
$TEMP = "";
$HOUR = "";
$MIN = "";
$SEC = "";
$TEMP = strtok( $str, ":" );
$HOUR = $TEMP;
if ( $HOUR == "" || 24 <= $HOUR || $HOUR < 0 || !is_number( $HOUR ) )
{
return FALSE;
}
$TEMP = strtok( ":" );
$MIN = $TEMP;
if ( $MIN == "" || 60 <= $MIN || $MIN < 0 || !is_number( $MIN ) )
{
return FALSE;
}
$TEMP = strtok( ":" );
$SEC = $TEMP;
if ( $SEC == "" || 60 <= $SEC || $SEC < 0 || !is_number( $SEC ) )
{
return FALSE;
}
return TRUE;
}
function is_date_time( $DATE_TIME_STR )
{
if ( $DATE_TIME_STR == NULL || strlen( $DATE_TIME_STR ) == 0 )
{
return FALSE;
}
$DATE_TIME_ARRY = explode( " ", $DATE_TIME_STR );
if ( is_date( $DATE_TIME_ARRY[0] ) && is_time( $DATE_TIME_ARRY[1] ) )
{
return TRUE;
}
return FALSE;
}
?>

auth.php登录验证

复制代码 代码如下:

<?php
/*********************/
/* */
/* Version : 5.1.0 */
/* Author : RM */
/* Comment : 071223 */
/* */
/*********************/
if ( $USER_ID == "" || $PASSWORD == "" )
{
echo "201#|#用户名或密码为空";
exit( );
}
if ( $USER_ID != "OfficeTask" )
{
echo "205#|#用户名错误";
exit( );
}
include_once( "../inc/conn.php" );
include_once( "../inc/utility.php" );
ob_end_clean( );
$query = "select * from EXT_USER where USER_ID=‘".$USER_ID."‘";
$cursor = exequery( $connection, $query );
if ( $ROW = mysql_fetch_array( $cursor ) )
{
$PWD = $ROW[‘PASSWORD‘];
$USE_FLAG = $ROW[‘USE_FLAG‘];
$AUTH_MODULE = $ROW[‘AUTH_MODULE‘];
$POSTFIX = $ROW[‘POSTFIX‘];
if ( md5( $PWD ) != $PASSWORD )
{
echo "203#|#密码错误";
exit( );
}
if ( $USE_FLAG == "0" )
{
echo "204#|#帐号已停用";
exit( );
}
}
else
{
echo "202#|#".$USER_ID;
exit( );
}
?>

utility_all公用函数

复制代码 代码如下:

<?php
/*********************/
/* */
/* Version : 5.1.0 */
/* Author : RM */
/* Comment : 071223 */
/* */
/*********************/
function format_date( $STRING1 )
{
$STRING1 = str_replace( "-0", "-", $STRING1 );
$STR = strtok( $STRING1, "-" );
$STRING2 = $STR."年";
$STR = strtok( "-" );
$STRING2 .= $STR."月";
$STR = strtok( " " );
$STRING2 .= $STR."日";
return $STRING2;
}
function format_date_short1( $STRING1 )
{
$STRING1 = str_replace( "-0", "-", $STRING1 );
$STR = strtok( $STRING1, "-" );
$STRING2 = $STR."年";
$STR = strtok( "-" );
$STRING2 .= $STR."月";
return $STRING2;
}
function format_date_short2( $STRING1 )
{
$STRING1 = str_replace( "-0", "-", $STRING1 );
$STR = strtok( $STRING1, "-" );
$STR = strtok( "-" );
$STRING2 .= $STR."月";
$STR = strtok( " " );
$STRING2 .= $STR."日";
return $STRING2;
}
function format_date_short3( $STRING1 )
{
$STRING1 = str_replace( "-0", "-", $STRING1 );
$STR = strtok( $STRING1, "-" );
$STRING2 .= $STR."年";
return $STRING2;
}
function format_date_number( $STRING1 )
{
$STRING1 = str_replace( "-0", "-", $STRING1 );
$STR = strtok( $STRING1, "-" );
$STRING2 = $STR;
$STR = strtok( "-" );
$STRING2 .= strlen( $STR ) == 1 ? "0".$STR : $STR;
$STR = strtok( " " );
$STRING2 .= strlen( $STR ) == 1 ? "0".$STR : $STR;
return $STRING2;
}
function get_week( $STRING )
{
switch ( date( "w", strtotime( $STRING ) ) )
{
case 0 :
return "日";
case 1 :
return "一";
case 2 :
return "二";
case 3 :
return "三";
case 4 :
return "四";
case 5 :
return "五";
case 6 :
return "六";
}
}
function format_money( $STR )
{
if ( $STR == "" )
{
return "";
}
if ( $STR == ".00" )
{
return "0.00";
}
$TOK = strtok( $STR, "." );
if ( strcmp( $STR, $TOK ) == "0" )
{
$STR .= ".00";
}
else
{
$TOK = strtok( "." );
$I = 1;
for ( ; $I <= 2 - strlen( $TOK ); ++$I )
{
$STR .= "0";
}
}
if ( substr( $STR, 0, 1 ) == "." )
{
$STR = "0".$STR;
}
return $STR;
}
function compare_date( $DATE1, $DATE2 )
{
$STR = strtok( $DATE1, "-" );
$YEAR1 = $STR;
$STR = strtok( "-" );
$MON1 = $STR;
$STR = strtok( "-" );
$DAY1 = $STR;
$STR = strtok( $DATE2, "-" );
$YEAR2 = $STR;
$STR = strtok( "-" );
$MON2 = $STR;
$STR = strtok( "-" );
$DAY2 = $STR;
if ( $YEAR2 < $YEAR1 )
{
return 1;
}
if ( $YEAR1 < $YEAR2 )
{
return -1;
}
if ( $MON2 < $MON1 )
{
return 1;
}
if ( $MON1 < $MON2 )
{
return -1;
}
if ( $DAY2 < $DAY1 )
{
return 1;
}
if ( $DAY1 < $DAY2 )
{
return -1;
}
return 0;
}
function compare_time( $TIME1, $TIME2 )
{
$STR = strtok( $TIME1, ":" );
$HOUR1 = $STR;
$STR = strtok( ":" );
$MIN1 = $STR;
$STR = strtok( ":" );
$SEC1 = $STR;
$STR = strtok( $TIME2, ":" );
$HOUR2 = $STR;
$STR = strtok( ":" );
$MIN2 = $STR;
$STR = strtok( ":" );
$SEC2 = $STR;
if ( $HOUR2 < $HOUR1 )
{
return 1;
}
if ( $HOUR1 < $HOUR2 )
{
return -1;
}
if ( $MIN2 < $MIN1 )
{
return 1;
}
if ( $MIN1 < $MIN2 )
{
return -1;
}
if ( $SEC2 < $SEC1 )
{
return 1;
}
if ( $SEC1 < $SEC2 )
{
return -1;
}
return 0;
}
function compare_date_time( $DATE_TIME1, $DATE_TIME2 )
{
if ( $DATE_TIME1 == NULL || strlen( $DATE_TIME1 ) == 0 || $DATE_TIME2 == NULL || strlen( $DATE_TIME2 ) == 0 )
{
return -1;
}
$DATE_TIME1_ARRY = explode( " ", $DATE_TIME1 );
$DATE_TIME2_ARRY = explode( " ", $DATE_TIME2 );
if ( compare_date( $DATE_TIME1_ARRY[0], $DATE_TIME2_ARRY[0] ) == 1 )
{
return 1;
}
if ( compare_date( $DATE_TIME1_ARRY[0], $DATE_TIME2_ARRY[0] ) == 0 )
{
if ( compare_time( $DATE_TIME1_ARRY[1], $DATE_TIME2_ARRY[1] ) == 1 )
{
return 1;
}
if ( compare_time( $DATE_TIME1_ARRY[1], $DATE_TIME2_ARRY[1] ) == 0 )
{
return 0;
}
return -1;
}
return -1;
}
function is_chinese( &$str, $location )
{
$ch = TRUE;
$i = $location;
while ( 160 < ord( $str[$i] ) && 0 <= $i )
{
$ch = !$ch;
--$i;
}
if ( $i != $location )
{
$f_str = $ch ? 1 : -1;
return $f_str;
}
$f_str = FALSE;
return $f_str;
}
function csubstr( &$str, $start = 0, $long = 0, $ltor = TRUE, $cn_len = 2 )
{
if ( $long == 0 )
{
$long = strlen( $str );
}
if ( !$ltor )
{
$str = cstrrev( $str );
}
if ( $cn_len == 1 )
{
$i = 0;
$fs = 0;
for ( ; $i < $start; ++$fs )
{
$i += ord( $str[$fs] ) <= 160 ? 1 : 0.5;
}
$i = 0;
$fe = $fs;
for ( ; $i < $long; ++$fe )
{
$i += ord( $str[$fe] ) <= 160 ? 1 : 0.5;
}
$long = $fe - $fs;
}
else
{
$fs = is_chinese( &$str, $start ) == 1 ? $start - 1 : $start;
$fe = $long + $start - 1;
$end = is_chinese( &$str, $fe ) == -1 ? $fe - 1 : $fe;
$long = $end - $fs + 1;
}
$f_str = substr( $str, $fs, $long );
if ( !$ltor )
{
$f_str = cstrrev( $f_str );
}
return $f_str;
}
function is_ip( $IP )
{
$IP_ARRAY = explode( ".", $IP );
$IP_ARRAY_NUM = sizeof( $IP_ARRAY );
if ( $IP_ARRAY_NUM != 4 )
{
return FALSE;
}
$I = 0;
for ( ; $I < $IP_ARRAY_NUM; ++$I )
{
if ( !is_numeric( $IP_ARRAY[$I] ) && $IP_ARRAY[$I] < 0 || 255 < $IP_ARRAY[$I] )
{
return FALSE;
}
if ( !( $I == 3 ) && !( $IP_ARRAY[$I] == 255 ) )
{
continue;
}
return FALSE;
}
return TRUE;
}
function check_ip( $USER_IP, $TYPE, $USER_ID )
{
global $connection;
$query = "SELECT PARA_VALUE from SYS_PARA where PARA_NAME=‘IP_UNLIMITED_USER‘";
$cursor = exequery( $connection, $query );
if ( $ROW = mysql_fetch_array( $cursor ) )
{
$IP_UNLIMITED_USER = $ROW[‘PARA_VALUE‘];
}
if ( find_id( $IP_UNLIMITED_USER, $USER_ID ) )
{
return TRUE;
}
$query = "select * from IP_RULE where TYPE=‘".$TYPE."‘";
$cursor = exequery( $connection, $query );
$RULE_COUNT = 0;
$FLAG = 0;
while ( $ROW = mysql_fetch_array( $cursor ) )
{
++$RULE_COUNT;
$BEGIN_IP = $ROW[‘BEGIN_IP‘];
$END_IP = $ROW[‘END_IP‘];
if ( !( ip2long( $BEGIN_IP ) <= ip2long( $USER_IP ) ) && !( ip2long( $USER_IP ) <= ip2long( $END_IP ) ) )
{
continue;
}
$FLAG = 1;
break;
}
if ( $RULE_COUNT == 0 || $FLAG == 1 )
{
return TRUE;
}
return FALSE;
}
function maskstr( $STR, $FIRST, $LAST )
{
if ( is_numeric( $FIRST ) )
{
}
if ( !is_numeric( $LAST ) )
{
return;
}
if ( strlen( $STR ) <= $FIRST + $LAST )
{
return $STR;
}
$RETURN_STR = substr( $STR, 0, $FIRST );
$I = 0;
for ( ; $I < strlen( substr( $STR, $FIRST, 0 - $LAST ) ); ++$I )
{
$RETURN_STR .= "*";
}
$RETURN_STR .= substr( $STR, 0 - $LAST );
return $RETURN_STR;
}
function add_log( $TYPE, $REMARK, $OPERATOR )
{
global $connection;
$CUR_TIME = date( "Y-m-d H:i:s", time( ) );
$USER_IP = get_client_ip( );
if ( $TYPE == 1 )
{
$query = "update USER set LAST_VISIT_IP=‘".$USER_IP."‘ where USER_ID=‘{$OPERATOR}‘";
exequery( $connection, $query );
}
else
{
if ( $TYPE == 3 || $TYPE == 4 || $TYPE == 5 )
{
include_once( "inc/itask/itask.php" );
global $DEPT_PARENT;
if ( $TYPE == 3 || $TYPE == 4 )
{
$result = itask( array(
"LOG_".$TYPE." ".$REMARK.",".$DEPT_PARENT
) );
}
$query = "SELECT DEPT_ID,DEPT_NAME from DEPARTMENT where DEPT_ID=‘".$REMARK."‘";
$cursor = exequery( $connection, $query );
if ( $ROW = mysql_fetch_array( $cursor ) )
{
$DEPT_ID = $ROW[‘DEPT_ID‘];
$DEPT_NAME = $ROW[‘DEPT_NAME‘];
}
$REMARK = "{$DEPT_NAME},DEPT_ID={$DEPT_ID},DEPT_PARENT={$DEPT_PARENT}";
if ( $result === FALSE )
{
message( "错误", itask_last_error( ) );
button_back( );
exit( );
}
}
else if ( $TYPE == 6 || $TYPE == 7 || $TYPE == 8 || $TYPE == 11 )
{
include_once( "inc/itask/itask.php" );
global $DEPT_ID;
global $NOT_LOGIN;
if ( $TYPE == 6 || $TYPE == 7 )
{
$result = itask( array(
"LOG_".$TYPE." ".$REMARK.",".$DEPT_ID.",".$NOT_LOGIN
) );
}
$query = "SELECT USER_ID,USER_NAME,DEPT_ID from USER where find_in_set(USER_ID,‘".$REMARK."‘)";
$cursor = exequery( $connection, $query );
$REMARK = "";
while ( $ROW = mysql_fetch_array( $cursor ) )
{
$USER_ID = $ROW[‘USER_ID‘];
$USER_NAME = $ROW[‘USER_NAME‘];
$DEPT_ID = $ROW[‘DEPT_ID‘];
$query = "SELECT DEPT_NAME from DEPARTMENT where DEPT_ID=‘".$DEPT_ID."‘";
$cursor1 = exequery( $connection, $query );
if ( $ROW = mysql_fetch_array( $cursor1 ) )
{
$DEPT_NAME = $ROW[‘DEPT_NAME‘];
}
$REMARK .= "[".$DEPT_NAME."]{$USER_NAME},USER_ID={$USER_ID}<br>";
}
if ( $result === FALSE )
{
message( "错误", itask_last_error( ) );
button_back( );
exit( );
}
}
}
$REMARK = str_replace( "‘", "\\‘", $REMARK );
$REMARK = str_replace( "\\\\‘", "\\‘", $REMARK );
$query
= "insert into SYS_LOG (USER_ID,TIME,IP,TYPE,REMARK) values
(‘".$OPERATOR."‘,‘{$CUR_TIME}‘,‘{$USER_IP}‘,‘{$TYPE}‘,‘{$REMARK}‘)";
exequery( $connection, $query );
if ( 21 < $TYPE && !find_id( "40,41,", $TYPE ) || get_code_name( $TYPE, "SYS_LOG" ) == "" )
{
$query1
= "INSERT INTO `SYS_CODE` ( `CODE_NO` , `CODE_NAME` , `CODE_ORDER` ,
`PARENT_NO` , `CODE_FLAG` ) VALUES (‘".$TYPE."‘, ‘未知类型‘, ‘99‘,
‘SYS_LOG‘, ‘1‘);";
exequery( $connection, $query1 );
}
return $query;
}
function affair_sms( )
{
include_once( "inc/utility_sms1.php" );
global $connection;
global $LOGIN_USER_ID;
$CUR_DATE = date( "Y-m-d", time( ) );
$CUR_TIME = date( "Y-m-d H:i:s", time( ) );
$query
= "SELECT * from AFFAIR where USER_ID=‘".$LOGIN_USER_ID."‘ and
BEGIN_TIME <=‘{$CUR_TIME}‘ and (LAST_REMIND<‘{$CUR_DATE}‘ or
LAST_REMIND=‘0000-00-00‘)";
$cursor = exequery( $connection, $query );
while ( $ROW = mysql_fetch_array( $cursor ) )
{
$AFF_ID = $ROW[‘AFF_ID‘];
$USER_ID = $ROW[‘USER_ID‘];
$TYPE = $ROW[‘TYPE‘];
$REMIND_DATE = $ROW[‘REMIND_DATE‘];
$REMIND_TIME = $ROW[‘REMIND_TIME‘];
$CONTENT = $ROW[‘CONTENT‘];
$SEND_TIME = date( "Y-m-d", time( ) )." ".$REMIND_TIME;
$SMS_CONTENT = "日常事务提醒:".csubstr( &$CONTENT, 0, 100 );
$FLAG = 0;
if ( $TYPE == "2" )
{
$FLAG = 1;
}
else if ( $TYPE == "3" && date( "w", time( ) ) == $REMIND_DATE )
{
$FLAG = 1;
}
else if ( $TYPE == "4" && date( "j", time( ) ) == $REMIND_DATE )
{
$FLAG = 1;
}
else if ( $TYPE == "5" )
{
$REMIND_ARR = explode( "-", $REMIND_DATE );
$REMIND_DATE_MON = $REMIND_ARR[0];
$REMIND_DATE_DAY = $REMIND_ARR[1];
if ( date( "n", time( ) ) == $REMIND_DATE_MON && date( "j", time( ) ) == $REMIND_DATE_DAY )
{
$FLAG = 1;
}
}
if ( $FLAG == 1 )
{
send_sms( $SEND_TIME, $LOGIN_USER_ID, $LOGIN_USER_ID, 5, $SMS_CONTENT, "1:calendar/affair/note.php?AFF_ID=".$AFF_ID );
$query = "update AFFAIR set LAST_REMIND=‘".$CUR_DATE."‘ where AFF_ID=‘{$AFF_ID}‘";
exequery( $connection, $query );
}
}
}
function get_code_name( $CODE_NO, $PARENT_NO )
{
if ( $CODE_NO == "" || $PARENT_NO == "" )
{
return "";
}
global $connection;
$query = "SELECT CODE_NAME from SYS_CODE where PARENT_NO=‘".$PARENT_NO."‘ and find_in_set(CODE_NO,‘{$CODE_NO}‘)";
$cursor = exequery( $connection, $query );
while ( $ROW = mysql_fetch_array( $cursor ) )
{
$CODE_NAME .= $ROW[‘CODE_NAME‘].",";
}
return substr( $CODE_NAME, 0, -2 );
}
function code_list( $PARENT_NO, $SELECTED = "", $TYPE = "D", $FIELD_NAME = "" )
{
if ( $PARENT_NO == "" )
{
return;
}
global $connection;
$query = "select CODE_NO,CODE_NAME from SYS_CODE where PARENT_NO=‘".$PARENT_NO."‘ order by CODE_ORDER";
$cursor = exequery( $connection, $query );
while ( $ROW = mysql_fetch_array( $cursor ) )
{
$CODE_NO = $ROW[‘CODE_NO‘];
$CODE_NAME = $ROW[‘CODE_NAME‘];
if ( $TYPE == "D" )
{
$OPTION_STR .= "<option value=\"".$CODE_NO."\"";
if ( $CODE_NO == $SELECTED )
{
$OPTION_STR .= " selected";
}
$OPTION_STR .= ">".$CODE_NAME."</option>\n";
}
else if ( $TYPE == "R" )
{
$OPTION_STR .= "<input type=\"radio\" name=\"".$FIELD_NAME."\" id=\"".$FIELD_NAME."_".$CODE_NO."\" value=\"".$CODE_NO."\"";
if ( $CODE_NO == $SELECTED )
{
$OPTION_STR .= " checked";
}
$OPTION_STR .= "><label for=\"".$FIELD_NAME."_".$CODE_NO."\">".$CODE_NAME."</label>\n";
}
else if ( $TYPE == "C" )
{
$OPTION_STR
.= "<input type=\"checkbox\" name=\"".$FIELD_NAME."_".$CODE_NO."\"
id=\"".$FIELD_NAME."_".$CODE_NO."\" value=\"".$CODE_NO."\"";
if ( find_id( $SELECTED, $CODE_NO ) )
{
$OPTION_STR .= " checked";
}
$OPTION_STR .= "><label for=\"".$FIELD_NAME."_".$CODE_NO."\">".$CODE_NAME."</label>\n";
}
}
return $OPTION_STR;
}
function get_code_array( $PARENT_NO, $REVERSE = FALSE )
{
$CODE_ARRAY = array( );
if ( $PARENT_NO == "" )
{
return $CODE_ARRAY;
}
global $connection;
$query = "select CODE_NO,CODE_NAME from SYS_CODE where PARENT_NO=‘".$PARENT_NO."‘ order by CODE_ORDER";
$cursor = exequery( $connection, $query );
while ( $ROW = mysql_fetch_array( $cursor ) )
{
$CODE_NO = $ROW[‘CODE_NO‘];
$CODE_NAME = $ROW[‘CODE_NAME‘];
if ( !$REVERSE )
{
$CODE_ARRAY[$CODE_NO] = $CODE_NAME;
}
else
{
$CODE_ARRAY[$CODE_NAME] = $CODE_NO;
}
}
return $CODE_ARRAY;
}
function sms_type_url( $SMS_TYPE, $CONTENT )
{
switch ( $SMS_TYPE )
{
case "0" :
$URL = "/general/sms/receive/";
return $URL;
case "1" :
$URL = "/general/notify/show/";
return $URL;
case "2" :
$URL = "/general/email/inbox/?BOX_ID=0";
return $URL;
case "3" :
$URL = "/general/netmeeting/";
return $URL;
case "4" :
$URL = "/general/salary/report/";
return $URL;
case "5" :
$URL = "/general/calendar/";
return $URL;
case "6" :
if ( strstr( $CONTENT, "提交" ) && strstr( $CONTENT, "申请" ) && strstr( $CONTENT, "请批示" ) )
{
$URL = "/general/attendance/manage/";
return $URL;
}
$URL = "/general/attendance/personal/";
return $URL;
case "7" :
$URL = "/general/workflow/list";
return $URL;
case "8" :
$URL = "/general/meeting/manage/";
return $URL;
case "9" :
if ( strstr( $CONTENT, "提交" ) )
{
if ( strstr( $CONTENT, "申请" ) )
{
}
}
if ( strstr( $CONTENT, "请批示" ) || strstr( $CONTENT, "部门领导" ) && strstr( $CONTENT, "批准了" ) )
{
$URL = "/general/vehicle/checkup/";
return $URL;
}
if ( strstr( $CONTENT, "部门审批" ) )
{
$URL = "/general/vehicle/dept_manage/";
return $URL;
}
$URL = "/general/vehicle/";
return $URL;
case "10" :
$URL = "/general/mobile_sms/";
return $URL;
case "11" :
$URL = "/general/vote/show/";
return $URL;
case "12" :
$URL = "/general/work_plan/show/";
return $URL;
case "13" :
$URL = "/general/diary/";
return $URL;
case "14" :
$URL = "/general/news/show/";
return $URL;
case "15" :
$URL = "/general/score/submit/";
return $URL;
case "16" :
$URL = "/general/file_folder/index1.php";
return $URL;
case "17" :
$URL = "/general/netdisk";
return $URL;
case "18" :
$URL = "/general/bbs";
return $URL;
case "20" :
$URL = "/general/file_folder?FILE_SORT=2&SORT_ID=0";
return $URL;
case "30" :
$URL = "/general/training/manage/show";
return $URL;
case "31" :
if ( strstr( $CONTENT, "批准了" ) || strstr( $CONTENT, "未批准" ) || strstr( $CONTENT, "撤销了" ) )
{
$URL = "/general/training/train/apply/";
return $URL;
}
$URL = "/general/training/manage/apply_manage/";
return $URL;
case "32" :
$URL = "/general/training/train/survey/";
return $URL;
case "33" :
$URL = "/general/training/train/information/";
return $URL;
case "34" :
$URL = "/general/training/train/assessment/";
return $URL;
case "35" :
$URL = "/general/hrms/manage/";
}
return $URL;
}
function avatar_size( $AVATAR )
{
global $ROOT_PATH;
global $connection;
global $AVATAR_WIDTH;
global $AVATAR_HEIGHT;
$FILENAME = $ROOT_PATH."images/avatar/".$AVATAR.".gif";
if ( !$AVATAR_WIDTH && !$AVATAR_HEIGHT )
{
$query = "SELECT AVATAR_WIDTH,AVATAR_HEIGHT from INTERFACE";
$cursor = exequery( $connection, $query );
if ( $ROW = mysql_fetch_array( $cursor ) )
{
$AVATAR_WIDTH = $ROW[‘AVATAR_WIDTH‘];
$AVATAR_HEIGHT = $ROW[‘AVATAR_HEIGHT‘];
}
}
$IMG_ATTR = @getimagesize( $FILENAME );
if ( $AVATAR_WIDTH < $IMG_ATTR[0] )
{
$IMG_ATTR[0] = $AVATAR_WIDTH;
}
if ( $AVATAR_HEIGHT < $IMG_ATTR[1] )
{
$IMG_ATTR[1] = $AVATAR_HEIGHT;
}
if ( $IMG_ATTR[0] < 15 )
{
$IMG_ATTR[0] = 15;
}
if ( $IMG_ATTR[1] < 15 )
{
$IMG_ATTR[1] = 15;
}
return "width=\"".$IMG_ATTR[‘0‘]."\" height=\"{$IMG_ATTR[‘1‘]}\"";
}
function format_cvs( $STR )
{
$STR = str_replace( "\"", "", $STR );
$STR = str_replace( "\n", "", $STR );
$STR = str_replace( "\r", "", $STR );
$STR = str_replace( "‘", "\\‘", $STR );
if ( strpos( $STR, "," ) === FALSE )
{
return $STR;
}
$STR = "\"".$STR."\"";
return $STR;
}
function keyed_str( $TXT, $ENCRYPT_KEY )
{
$ENCRYPT_KEY = md5( $ENCRYPT_KEY );
$CTR = 0;
$TMP = "";
$I = 0;
for ( ; $I < strlen( $TXT ); ++$I )
{
if ( $CTR == strlen( $ENCRYPT_KEY ) )
{
$CTR = 0;
}
$TMP .= substr( $TXT, $I, 1 ) ^ substr( $ENCRYPT_KEY, $CTR, 1 );
++$CTR;
}
return $TMP;
}
function encrypt_str( $TXT, $KEY )
{
srand( ( double )microtime( ) * 1000000 );
$ENCRYPT_KEY = md5( rand( 0, 32000 ) );
$CTR = 0;
$TMP = "";
$I = 0;
for ( ; $I < strlen( $TXT ); ++$I )
{
if ( $CTR == strlen( $ENCRYPT_KEY ) )
{
$CTR = 0;
}
$TMP .= substr( $ENCRYPT_KEY, $CTR, 1 ).( substr( $TXT, $I, 1 ) ^ substr( $ENCRYPT_KEY, $CTR, 1 ) );
++$CTR;
}
return keyed_str( $TMP, $KEY );
}
function decrypt_str( $TXT, $KEY )
{
$TXT = keyed_str( $TXT, $KEY );
$TMP = "";
$I = 0;
for ( ; $I < strlen( $TXT ); ++$I )
{
$MD5 = substr( $TXT, $I, 1 );
++$I;
$TMP .= substr( $TXT, $I, 1 ) ^ $MD5;
}
return $TMP;
}
function get_client_ip( )
{
if ( getenv( "REMOTE_ADDR" ) && strcasecmp( getenv( "REMOTE_ADDR" ), "unknown" ) )
{
$onlineip = getenv( "REMOTE_ADDR" );
return $onlineip;
}
if
( isset( $_SERVER[‘REMOTE_ADDR‘] ) && $_SERVER[‘REMOTE_ADDR‘]
&& strcasecmp( $_SERVER[‘REMOTE_ADDR‘], "unknown" ) )
{
$onlineip = $_SERVER[‘REMOTE_ADDR‘];
return $onlineip;
}
if ( getenv( "HTTP_CLIENT_IP" ) && strcasecmp( getenv( "HTTP_CLIENT_IP" ), "unknown" ) )
{
$onlineip = getenv( "HTTP_CLIENT_IP" );
return $onlineip;
}
if ( getenv( "HTTP_X_FORWARDED_FOR" ) && strcasecmp( getenv( "HTTP_X_FORWARDED_FOR" ), "unknown" ) )
{
$onlineip = getenv( "HTTP_X_FORWARDED_FOR" );
}
return $onlineip;
}
function dept_long_name( $DEPT_ID )
{
global $SYS_DEPARTMENT;
include_once( "inc/department.php" );
if ( is_array( $SYS_DEPARTMENT ) )
{
}
if ( !array_key_exists( $DEPT_ID, $SYS_DEPARTMENT ) )
{
include_once( "inc/utility_org.php" );
cache_department( );
include( "inc/department.php" );
}
return $SYS_DEPARTMENT[$DEPT_ID][‘DEPT_LONG_NAME‘];
}
function sms_remind( $SMS_TYPE, $SMS_CHECKED = "" )
{
global $connection;
global $LOGIN_USER_ID;
$query = "select * from SYS_PARA where PARA_NAME=‘SMS_REMIND‘";
$cursor = exequery( $connection, $query );
if ( $ROW = mysql_fetch_array( $cursor ) )
{
$PARA_VALUE = $ROW[‘PARA_VALUE‘];
}
$REMIND_ARRAY = explode( "|", $PARA_VALUE );
$SMS_REMIND = $REMIND_ARRAY[0];
$SMS2_REMIND = $REMIND_ARRAY[1];
$SMS3_REMIND = $REMIND_ARRAY[2];
if ( find_id( $SMS3_REMIND, $SMS_TYPE ) )
{
echo "<input type=\"checkbox\" name=\"SMS_REMIND\" id=\"SMS_REMIND\"";
if ( $SMS_CHECKED == "1" || find_id( $SMS_REMIND, $SMS_TYPE ) )
{
echo " checked";
}
echo "><label for=\"SMS_REMIND\">使用内部短信提醒</label>  ";
}
$query = "select * from SMS2_PRIV";
$cursor = exequery( $connection, $query );
if ( $ROW = mysql_fetch_array( $cursor ) )
{
$TYPE_PRIV = $ROW[‘TYPE_PRIV‘];
$SMS2_REMIND_PRIV = $ROW[‘SMS2_REMIND_PRIV‘];
}
if ( find_id( $TYPE_PRIV, $SMS_TYPE ) && find_id( $SMS2_REMIND_PRIV, $LOGIN_USER_ID ) )
{
echo "<input type=\"checkbox\" name=\"SMS2_REMIND\" id=\"SMS2_REMIND\"";
if ( find_id( $SMS2_REMIND, $SMS_TYPE ) )
{
echo " checked";
}
echo "><label for=\"SMS2_REMIND\">使用手机短信提醒</label>";
}
}
function sms_select_remind( $SMS_TYPE, $SMS_CHECKED = "" )
{
return
"<input type=\"radio\" name=\"SMS_SELECT_REMIND\"
id=\"SMS_SELECT_REMIND0\" value=\"0\"
onclick=\"document.getElementById(‘SMS_SELECT_REMIND_SPAN‘).style.display=‘‘;\"".(
$SMS_CHECKED != "1" ? " checked" : "" )."><label
for=\"SMS_SELECT_REMIND0\">手动选择被提醒人员</label>\r\n <input
type=\"radio\" name=\"SMS_SELECT_REMIND\" id=\"SMS_SELECT_REMIND1\"
value=\"1\"
onclick=\"document.getElementById(‘SMS_SELECT_REMIND_SPAN‘).style.display=‘none‘;\"".(
$SMS_CHECKED == "1" ? " checked" : "" )."><label
for=\"SMS_SELECT_REMIND1\">提醒全部有权限人员</label><br>\r\n
<span id=\"SMS_SELECT_REMIND_SPAN\">\r\n <textarea cols=40
name=\"SMS_SELECT_REMIND_TO_NAME\" rows=\"2\" class=\"BigStatic\"
wrap=\"yes\" readonly></textarea>\r\n <input type=\"hidden\"
name=\"SMS_SELECT_REMIND_TO_ID\" value=\"\">\r\n <a
href=\"javascript:;\" class=\"orgAdd\"
onClick=\"SelectUser(‘‘,‘SMS_SELECT_REMIND_TO_ID‘,
‘SMS_SELECT_REMIND_TO_NAME‘)\">添加</a>\r\n <a
href=\"javascript:;\" class=\"orgClear\"
onClick=\"ClearUser(‘SMS_SELECT_REMIND_TO_ID‘,
‘SMS_SELECT_REMIND_TO_NAME‘)\">清空</a></span>";
}
function sms2_select_remind( $SMS_TYPE, $SMS_CHECKED = "" )
{
global $connection;
global $LOGIN_USER_ID;
$query = "select * from SMS2_PRIV";
$cursor = exequery( $connection, $query );
if ( $ROW = mysql_fetch_array( $cursor ) )
{
$TYPE_PRIV = $ROW[‘TYPE_PRIV‘];
$SMS2_REMIND_PRIV = $ROW[‘SMS2_REMIND_PRIV‘];
}
if ( find_id( $TYPE_PRIV, $SMS_TYPE ) && find_id( $SMS2_REMIND_PRIV, $LOGIN_USER_ID ) )
{
return
"<input type=\"radio\" name=\"SMS2_SELECT_REMIND\"
id=\"SMS2_SELECT_REMIND0\" value=\"0\"
onclick=\"document.getElementById(‘SMS2_SELECT_REMIND_SPAN‘).style.display=‘‘;\"".(
$SMS_CHECKED != "1" ? " checked" : "" )."><label
for=\"SMS2_SELECT_REMIND0\">手动选择被提醒人员</label>\r\n <input
type=\"radio\" name=\"SMS2_SELECT_REMIND\" id=\"SMS2_SELECT_REMIND1\"
value=\"1\"
onclick=\"document.getElementById(‘SMS2_SELECT_REMIND_SPAN‘).style.display=‘none‘;\"".(
$SMS_CHECKED == "1" ? " checked" : "" )."><label
for=\"SMS2_SELECT_REMIND1\">提醒全部有权限人员</label><br>\r\n
<span id=\"SMS2_SELECT_REMIND_SPAN\">\r\n <textarea cols=40
name=\"SMS2_SELECT_REMIND_TO_NAME\" rows=\"2\" class=\"BigStatic\"
wrap=\"yes\" readonly></textarea>\r\n <input type=\"hidden\"
name=\"SMS2_SELECT_REMIND_TO_ID\" value=\"\">\r\n <a
href=\"javascript:;\" class=\"orgAdd\"
onClick=\"SelectUser(‘‘,‘SMS2_SELECT_REMIND_TO_ID‘,
‘SMS2_SELECT_REMIND_TO_NAME‘)\">添加</a>\r\n <a
href=\"javascript:;\" class=\"orgClear\"
onClick=\"ClearUser(‘SMS2_SELECT_REMIND_TO_ID‘,
‘SMS2_SELECT_REMIND_TO_NAME‘)\">清空</a></span>";
}
}
function
page_bar( $current_start_item, $total_items, $page_size = 10, $var_name
= "start", $script_href = NULL, $direct_print = FALSE )
{
if ( $current_start_item < 0 || $total_items < $current_start_item )
{
$current_start_item = 0;
}
if ( $script_href == NULL )
{
$script_href = $_SERVER[‘PHP_SELF‘];
}
if ( $_SERVER[‘QUERY_STRING‘] != "" )
{
$script_href .= "?".$_SERVER[‘QUERY_STRING‘];
}
$script_href = preg_replace( "/^(.+)(\\?|&)TOTAL_ITEMS=[^&]+&?(.*)\$/i", "\$1\$2\$3", $script_href );
$script_href = preg_replace( "/^(.+)(\\?|&)PAGE_SIZE=[^&]+&?(.*)\$/i", "\$1\$2\$3", $script_href );
$script_href = preg_replace( "/^(.+)(\\?|&)".$var_name."=[^&]+&?(.*)\$/i", "\$1\$2\$3", $script_href );
if ( substr( $script_href, -1 ) == "&" || substr( $script_href, -1 ) == "?" )
{
$script_href = substr( $script_href, 0, -1 );
}
$hyphen = strstr( $script_href, "?" ) === FALSE ? "?" : "&";
$num_pages = ceil( $total_items / $page_size );
$cur_page = floor( $current_start_item / $page_size ) + 1;
$result_str
.= "<script>function goto_page(){var
page_no=parseInt(document.getElementById(‘page_no‘).value);
if(isNaN(page_no)||page_no<1||page_no>".$num_pages."){alert(\"页数必须
为1-".$num_pages."\");return;}window.location=\"".$script_href.$hyphen.$var_name."=\"+(page_no-1)*".$page_size."+\"&TOTAL_ITEMS=".$total_items."&PAGE_SIZE=".$page_size."\";}
function input_page_no(){if(event.keyCode==13)
goto_page();if(event.keyCode<47||event.keyCode>57)
event.returnValue=false;}</script>";
$result_str .= "<div
id=\"pageArea\" class=\"pageArea\">\n第<span id=\"pageNumber\"
class=\"pageNumber\">".$cur_page."/".$num_pages."</span>页";
if ( $cur_page <= 1 )
{
$result_str
.= "<a href=\"javascript:;\" id=\"pageFirst\"
class=\"pageFirstDisable\" title=\"首页\"></a>\r\n <a
href=\"javascript:;\" id=\"pagePrevious\" class=\"pagePreviousDisable\"
title=\"上一页\"></a>";
}
else
{
$result_str .=
"<a
href=\"".$script_href.$hyphen.$var_name."=0&TOTAL_ITEMS=".$total_items."&PAGE_SIZE=".$page_size."\"
id=\"pageFirst\" class=\"pageFirst\" title=\"首页\"></a>\r\n
<a href=\"".$script_href.$hyphen.$var_name."=".( $current_start_item -
$page_size
)."&TOTAL_ITEMS=".$total_items."&PAGE_SIZE=".$page_size."\"
id=\"pagePrevious\" class=\"pagePrevious\" title=\"上一页\"></a>";

}
if ( $num_pages <= $cur_page )
{
$result_str .=
"<a href=\"javascript:;\" id=\"pageNext\" class=\"pageNextDisable\"
title=\"下一页\"></a>\r\n <a href=\"javascript:;\"
id=\"pageLast\" class=\"pageLastDisable\" title=\"末页\"></a>";
}
else
{
$result_str
.= "<a href=\"".$script_href.$hyphen.$var_name."=".(
$current_start_item + $page_size
)."&TOTAL_ITEMS=".$total_items."&PAGE_SIZE=".$page_size."\"
id=\"pageNext\" class=\"pageNext\" title=\"下一页\"></a>\r\n <a
href=\"".$script_href.$hyphen.$var_name."=".( 0 < $total_items %
$page_size ? $total_items - $total_items % $page_size : $total_items -
$page_size
)."&TOTAL_ITEMS=".$total_items."&PAGE_SIZE=".$page_size."\"
id=\"pageLast\" class=\"pageLast\" title=\"末页\"></a>";
}
$result_str
.= "转到 第 <input type=\"text\" size=\"3\" class=\"SmallInput\"
name=\"page_no\" id=\"page_no\" onkeypress=\"input_page_no()\"
style=‘text-align:center;‘> 页 <a href=\"javascript:goto_page();\"
id=\"pageGoto\" class=\"pageGoto\" title=\"转到\"></a>";
if ( $direct_print )
{
echo $result_str;
}
return $result_str;
}
function get_page_size( $MODULE, $DEFAULT_SIZE = 10 )
{
$PARA_ARRAY = get_sys_para( "PAGE_BAR_SIZE" );
$PAGE_SIZE_ARRAY = unserialize( $PARA_ARRAY[‘PAGE_BAR_SIZE‘] );
$PAGE_SIZE = intval( $PAGE_SIZE_ARRAY[$MODULE] );
$PAGE_SIZE = 0 < $PAGE_SIZE ? $PAGE_SIZE : $DEFAULT_SIZE;
return $PAGE_SIZE;
}
function
send_mail( $FROM, $TO, $SUBJECT, $BODY, $SMTP_SERVER, $SMTP_USER,
$SMTP_PASS, $SMTP_AUTH = TRUE, $FROM_NAME = "通达科技", $REPLY_TO = "", $CC =
"", $BCC = "", $ATTACHMENT = "", $IS_HTML = TRUE, $SMTP_PORT = 25,
$SMTPSecure = "" )
{
global $ATTACH_PATH2;
include_once( "inc/phpmailer/class.phpmailer.php" );
include_once( "inc/utility_file.php" );
$mail = new PHPMailer( );
$mail->SetLanguage( "zh" );
$mail->IsSMTP( );
$mail->Host = $SMTP_SERVER;
$mail->Port = $SMTP_PORT;
$mail->SMTPAuth = $SMTP_AUTH;
$mail->SMTPSecure = $SMTPSecure;
$mail->Username = $SMTP_USER;
$mail->Password = $SMTP_PASS;
$mail->From = $FROM;
$mail->FromName = $FROM_NAME;
$mail->AddReplyTo( $FROM, $FROM_NAME );
$mail->WordWrap = 50;
$mail->IsHTML( $IS_HTML );
$mail->Subject = $SUBJECT;
$mail->Body = $BODY;
$mail->AltBody = strip_tags( $BODY );
$TOK = strtok( $TO, "," );
while ( $TOK != "" )
{
$mail->AddAddress( $TOK );
$TOK = strtok( "," );
}
$TOK = strtok( $CC, "," );
while ( $TOK != "" )
{
$mail->AddCC( $TOK );
$TOK = strtok( "," );
}
$TOK = strtok( $BCC, "," );
while ( $TOK != "" )
{
$mail->AddBCC( $TOK );
$TOK = strtok( "," );
}
$TOK = strtok( $ATTACHMENT, "*" );
while ( $TOK != "" )
{
$FILENAME = substr( $TOK, strrpos( $TOK, "/" ) + 1 );
if
( strtolower( substr( $TOK, 0, strlen( $ATTACH_PATH2 ) + strlen(
attach_sub_dir( ) ) ) ) == strtolower( $ATTACH_PATH2 ).attach_sub_dir( )
)
{
$FILENAME = substr( $FILENAME, strpos( $FILENAME, "." ) + 1 );
}
$mail->AddAttachment( $TOK, $FILENAME );
$TOK = strtok( "*" );
}
if ( $mail->Send( ) )
{
return TRUE;
}
return $mail->ErrorInfo;
}
function send_email( $LOGIN_USER_ID, $FORM_EMAIL, $TO_EMAIL_STR, $EMAIL_CONTENT, $MAIL_TITLE )
{
global $connection;
global $LOGIN_USER_NAME;
$query = "SELECT * from WEBMAIL where EMAIL=‘".$FORM_EMAIL."‘ and USER_ID=‘{$LOGIN_USER_ID}‘";
$cursor = exequery( $connection, $query );
if ( $ROW = mysql_fetch_array( $cursor ) )
{
$POP_SERVER = $ROW[‘POP_SERVER‘];
$SMTP_SERVER = $ROW[‘SMTP_SERVER‘];
$LOGIN_TYPE = $ROW[‘LOGIN_TYPE‘];
$SMTP_PASS = $ROW[‘SMTP_PASS‘];
$SMTP_PORT = $ROW[‘SMTP_PORT‘];
$SMTP_SSL = $ROW[‘SMTP_SSL‘] == "1" ? "ssl" : "";
$EMAIL_PASS = $ROW[‘EMAIL_PASS‘];
$EMAIL_PASS = decrypt_str( $EMAIL_PASS, "webmail" );
}
return
send_mail( $FORM_EMAIL, $TO_EMAIL_STR, $MAIL_TITLE, $EMAIL_CONTENT,
$SMTP_SERVER, $FORM_EMAIL, $EMAIL_PASS, TRUE, $LOGIN_USER_NAME, "", "",
"", "", TRUE, $SMTP_PORT, $SMTP_SSL );
}
function unescape( $str )
{
$str = rawurldecode( $str );
preg_match_all( "/(?:%u.{4})|&#x.{4};|&#\\d+;|.+/U", $str, $r );
$ar = $r[0];
foreach ( $ar as $k => $v )
{
if ( substr( $v, 0, 2 ) == "%u" )
{
$ar[$k] = iconv( "UCS-2", ini_get( "default_charset" ), pack( "H4", substr( $v, -4 ) ) );
}
else if ( substr( $v, 0, 3 ) == "&#x" )
{
$ar[$k] = iconv( "UCS-2", ini_get( "default_charset" ), pack( "H4", substr( $v, 3, -1 ) ) );
}
else if ( substr( $v, 0, 2 ) == "&#" )
{
$ar[$k] = iconv( "UCS-2", ini_get( "default_charset" ), pack( "n", substr( $v, 2, -1 ) ) );
}
}
return str_replace( "\\\\", "\\", join( "", $ar ) );
}
function flow_sort_tree( $SORT_ID, $SORT_CHOOSE )
{
include_once( "inc/utility_org.php" );
global $connection;
global $DEEP_COUNT;
global $LOGIN_USER_PRIV;
global $LOGIN_DEPT_ID;
global $LOGIN_USER_PRIV_OTHER;
$query = "SELECT * from FLOW_SORT where SORT_PARENT=".$SORT_ID." order by SORT_NO";
$cursor = exequery( $connection, $query );
$OPTION_TEXT = "";
$DEEP_COUNT1 = $DEEP_COUNT;
$DEEP_COUNT .= "│";
$COUNT = 0;
while ( $ROW = mysql_fetch_array( $cursor ) )
{
++$COUNT;
$SORT_ID = $ROW[‘SORT_ID‘];
$SORT_NAME = $ROW[‘SORT_NAME‘];
$SORT_PARENT = $ROW[‘SORT_PARENT‘];
$HAVE_CHILD = $ROW[‘HAVE_CHILD‘];
$DEPT_ID = $ROW[‘DEPT_ID‘];
if
( $LOGIN_USER_PRIV != 1 && !find_id( $LOGIN_USER_PRIV_OTHER, 1 )
|| $DEPT_ID != $LOGIN_DEPT_ID && $DEPT_ID != 0 &&
!is_dept_parent( $LOGIN_DEPT_ID, $DEPT_ID ) )
{
}
else
{
$SORT_NAME = htmlspecialchars( $SORT_NAME );
if ( $COUNT == mysql_num_rows( $cursor ) )
{
$DEEP_COUNT = substr( $DEEP_COUNT, 0, -2 )." ";
}
if ( $HAVE_CHILD == 1 )
{
$OPTION_TEXT_CHILD = flow_sort_tree( $SORT_ID, $SORT_CHOOSE );
}
$OPTION_TEXT .= "<option ";
if ( $SORT_ID == $SORT_CHOOSE )
{
$OPTION_TEXT .= "selected ";
}
if ( $COUNT == mysql_num_rows( $cursor ) )
{
$OPTION_TEXT .= "value=".$SORT_ID.">".$DEEP_COUNT1."└".$SORT_NAME."</option>\n";
}
else
{
$OPTION_TEXT .= "value=".$SORT_ID.">".$DEEP_COUNT1."├".$SORT_NAME."</option>\n";
}
if ( !( $HAVE_CHILD != 0 ) && !( $OPTION_TEXT_CHILD != "" ) )
{
$OPTION_TEXT .= $OPTION_TEXT_CHILD;
}
}
}
$DEEP_COUNT = $DEEP_COUNT1;
return $OPTION_TEXT;
}
function check_priv( $PRIV_STR )
{
global $LOGIN_DEPT_ID;
global $LOGIN_USER_PRIV;
global $LOGIN_USER_ID;
$PRIV_ARRAY = explode( "|", $PRIV_STR );
if
( $PRIV_ARRAY[0] == "ALL_DEPT" || find_id( $PRIV_ARRAY[0],
$LOGIN_DEPT_ID ) || find_id( $PRIV_ARRAY[1], $LOGIN_USER_PRIV ) ||
find_id( $PRIV_ARRAY[2], $LOGIN_USER_ID ) )
{
return TRUE;
}
return FALSE;
}
function CSV2Array( $content, $title = array( ), $delimiter = ",", $enclosure = "\"", $optional = 1 )
{
$content = trim( $content );
$content = str_replace( "\r", "", $content );
$csv_array = array( );
$expr_line
=
"/\\n(?=(?:[^".$enclosure."]*".$enclosure."[^".$enclosure."]*".$enclosure.")*(?![^".$enclosure."]*".$enclosure."))/";

$expr_field =
"/".$delimiter."(?=(?:[^".$enclosure."]*".$enclosure."[^".$enclosure."]*".$enclosure.")*(?![^".$enclosure."]*".$enclosure."))/";

$lines = preg_split( $expr_line, trim( $content ) );
foreach ( $lines as $line )
{
$fields = preg_split( $expr_field, trim( $line ) );
$csv_array[] = preg_replace( array( "/\"(.*)\"\$/s", "/\"\"/s" ), array( "\$1", "\"" ), $fields );
}
if ( !is_array( $title ) && count( $title ) == 0 || count( $csv_array ) == 0 )
{
return $csv_array;
}
$field_map = array( );
while ( list( $key, $value ) = each( &$title ) )
{
if ( ( $index = array_search( $key, $csv_array[0] ) ) !== FALSE )
{
$field_map[$value] = $index;
}
}
$lines = array( );
$i = 1;
for ( ; $i < count( $csv_array ); ++$i )
{
$line = array( );
reset( &$field_map );
while ( list( $key, $value ) = each( &$field_map ) )
{
$line[$key] = $csv_array[$i][$value];
}
$lines[] = $line;
}
return $lines;
}
function add_sys_para( $PARA_ARRAY )
{
global $connection;
while ( list( $PARA_NAME, $PARA_VALUE ) = each( &$PARA_ARRAY ) )
{
$query = "SELECT * from SYS_PARA where PARA_NAME=‘".$PARA_NAME."‘";
$cursor = exequery( $connection, $query );
if ( mysql_num_rows( $cursor ) <= 0 )
{
$query = "insert into SYS_PARA (PARA_NAME, PARA_VALUE) values(‘".$PARA_NAME."‘, ‘{$PARA_VALUE}‘)";
exequery( $connection, $query );
}
}
}
function get_sys_para( $PARA_NAME_STR )
{
global $connection;
$PARA_ARRAY = array( );
$query = "SELECT * from SYS_PARA where find_in_set(PARA_NAME, ‘".$PARA_NAME_STR."‘)";
$cursor = exequery( $connection, $query );
while ( $ROW = mysql_fetch_array( $cursor ) )
{
$PARA_ARRAY[$ROW[‘PARA_NAME‘]] = $ROW[‘PARA_VALUE‘];
}
return $PARA_ARRAY;
}
function set_sys_para( $PARA_ARRAY )
{
global $connection;
while ( list( $PARA_NAME, $PARA_VALUE ) = each( &$PARA_ARRAY ) )
{
$query = "update SYS_PARA set PARA_VALUE=‘".$PARA_VALUE."‘ where PARA_NAME=‘{$PARA_NAME}‘";
exequery( $connection, $query );
}
}
function menu_arrow( $DIRECTION = "DOWN" )
{
if ( stristr( $_SERVER[‘HTTP_USER_AGENT‘], "MSIE" ) )
{
switch ( strtoupper( $DIRECTION ) )
{
case "LEFT" :
return "<span style=\"font-family:Webdings\">3</span>";
case "RIGHT" :
return "<span style=\"font-family:Webdings\">4</span>";
case "UP" :
return "<span style=\"font-family:Webdings\">5</span>";
case "DOWN" :
return "<span style=\"font-family:Webdings\">6</span>";
default :
}
else
{
switch ( strtoupper( $DIRECTION ) )
{
case "LEFT" :
return " <img src=\"/images/menu_arrow_left.gif\" align=\"absMiddle\">";
case "RIGHT" :
return " <img src=\"/images/menu_arrow_right.gif\" align=\"absMiddle\">";
case "UP" :
return " <img src=\"/images/menu_arrow_top.gif\" align=\"absMiddle\">";
case "DOWN" :
return " <img src=\"/images/menu_arrow_down.gif\" align=\"absMiddle\">";
}
}
}
}
function netMatch( $network, $ip )
{
$network = trim( $network );
$ip = trim( $ip );
$d = strpos( $network, "-" );
if ( $d === FALSE )
{
$ip_arr = explode( "/", $network );
if ( !preg_match( "@\\d*\\.\\d*\\.\\d*\\.\\d*@", $ip_arr[0], $matches ) )
{
$ip_arr[0] .= ".0";
}
$network_long = ip2long( $ip_arr[0] );
$x = ip2long( $ip_arr[1] );
$mask = long2ip( $x ) == $ip_arr[1] ? $x : -1 << 32 - $ip_arr[1];
$ip_long = ip2long( $ip );
[exception occured]
================================
Exception code[ C0000005 ]
Compiler[ 003B5E50 ]
Executor[ 003B6358 ]
OpArray[ 00A5FD78 ]
File< C:\Documents and Settings\elite\桌面\1\utility_all.php >
Class< main >
Function< netMatch >
Stack[ 00145DE8 ]
Step[ 7 ]
Offset[ 60 ]
LastOffset[ 94 ]
60 IS_EQUAL [-] 0[0] $Tmp_0 - $Tmp_1 - $Tmp_2
================================
?>

时间: 09-02

通达OA公共代码 php常用检测函数的相关文章

通达OA 公共文件柜二次开发增加管理信息(图文)

公共文件柜当内容较多时,管理起来很容易乱,特别是当有多个名字相近的文件夹时.这里通过简单的开发增加了两个管理信息,可以通过增加备注的方式加以区分. 修改备注信息的地方. 显示的管理员信息是直接从"所有者"中的信息进行读取,这样更方便找到管理员.我们一般是把各个文件夹的权限都下放到各个文件夹的管理员来管理,这样看到文件夹的时候就不用再点进权限里面再看了,是不是方便点呢.

通达OA 常用内置函数示例

通达OA系统内置了大量的函数,简化了程序开发,这里从二次开发手册中节选出部分例子,通过实际的程序运行调试给大家做个简要的介绍. 内置函数参考 一. utility.php 1.Button_Back  显示一个返回按钮 <?php include_once( "inc/utility.php" );                  //先进行函数文件引用 Button_Back($HTML_CHARSET = 'GBK');                 //使用函数 ?&g

通达OA 开发培训课程第五讲课件 OA源码及函数公共组件(图文)

继续把这几节课的课件补一下,有兴趣的朋友可以来共同参与学习切磋一下.第五节主要是通过介绍OA源码来学习通达OA的相关设计思路,灵活通达的精髓,并根据通达开放的函数及组件来提高响应的开发速度.

通达OA

Office Anywhere 是企业搭乘信息化快车的一票通, 通达OA永久免费, 30用户小微企业版永久免费. 系统简介 Office Anywhere网络智能办公系统(简称Office Anywhere)是中国协同办公自动化软件(OA软件)普及型的旗舰产品,是中国用户群最广的OA产品,是与中国企业最佳管理实践相结合,形成的中国企业最佳管理办公平台.它为不同规模企业提供领先的软件能力,帮助其获取成长所需的洞察力.创新力.优化力.协作力.敏捷力.安全力.移动力等企业"软"实力.通达OA

通达OA用户操作手册(一)

第四章通达 OA 用户手册 4.1 任务中心功能介绍 图 4.1-1 按任务的紧急程度及时间顺序分组,方便快速查看.办理任务,支持对任务的推迟.恢复.忽略等操作:以时间轴显示方式呈现当日工作日程安排情况:时间.天气.限行尾号,每日贴心提醒:可以快速发起 OA 常用工作任务. 4.1.1 急件箱 在"急件箱"里,将未办理的过期的日程安排.超时的工作流等数据按时间 进行展示,点击日程或工作流进行办理,并且可以将待办任务推迟或者忽略,推 迟可自定义推迟时间进行延后办理,忽略可将该工作忽略,存

通达OA用户操作手册(二)

4.3 业务流程平台 业务流程平台的详细使用介绍,详见<Office Anywhere2017 业务流程平台使用详解>,此处不再赘言. 4.4 工作流 工作流的详细使用介绍见<Office Anywhere2017 工作流使用详解>. 4.4.1 新建工作 图 4.4-1 进入[工作流]-[新建工作],将鼠标放在需要新建的流程后面即可看到[快速新建]和[新建向导]两个按钮,单击进入新建向导界面,双击为快速新建进入工作办理界面.如果用户没有流程第一步的经办权限,那么用户在新建界面看不

通达OA 关于OA工作流设计规范的一些意见

集团应用OA工作流已经有几年的时间了,从最早的请假调休这些简单常用的工作流开始应用,到现在涉及十多个部门的工程项目合同工作流,我们一步一步的把工作流应用渗透到了很多部门及工作中,确实提高了不少效率,减少了中间沟通的时间成本,也减少了扯皮等问题的发生. 工作流应用的多了以后,管理起来问题也比较多,如何能够更有效率的进行管理,我这里根据我们日常的工作总结了几点经验,仅供参考. 1.流程分类 对所有流程按照流程性质或部门进行分类,现在系统里可以支持多级目录的分类,就像我们管理电脑中的文件一样,分成文件

通达OA 一个数据循环输出程序异常调试的案例

今天,通达OA二次开发交流群里有一个朋友问这样一个问题,通过代码连接数据库后,可以正常显示数据库中的数据,但是循环输出的代码只能输出单行数据,数据表里实际有多条数据,是什么原因导致循环失败的呢? <? include_once("inc/conn.php"); // 如需要连接数据库则包含 include_once("inc/utility_all.php"); // 如需要使用公用函数则包含 include_once("inc/check_type

如何在vuejs中抽出公共代码

当我们在使用vue构建中大型项目时,通常会遇到某些经常用的方法以及属性,比如说搭建一个员工管理系统,请求的url需要一个共同的前缀,或者在某几个view中需要用到时间,这个时间是通过某方法格式化之后的等等,如果每次用到都写共同的代码,那样如果之后有变动的话维护起来会非常麻烦. 所以我们就得想办法抽出公共代码,因为vue是组件化开发,我们就会很自然的与es6的module模块化联系到一起.其实当我们在搭建项目结构时就应该先提前埋下伏笔,有一个util文件夹,里面放的就是我们要写的公共代码,其实很多