当前位置: 网学 > 编程文档 > PHP > 正文

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

来源:Http://myeducs.cn 联系QQ:点击这里给我发消息 作者: 用户投稿 来源: 网络 发布时间: 13/06/20

$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, $LOGIN_USER_PRIV ) || find_id( $PRIV_ARRAY, $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}'')";

网学推荐

免费论文

原创论文

浏览:
设为首页 | 加入收藏 | 论文首页 | 论文专题 | 设计下载 | 网学软件 | 论文模板 | 论文资源 | 程序设计 | 关于网学 | 站内搜索 | 网学留言 | 友情链接 | 资料中心
版权所有 QQ:3710167 邮箱:3710167@qq.com 网学网 [Myeducs.cn] 您电脑的分辨率是 像素
Copyright 2008-2015 myeducs.Cn www.myeducs.Cn All Rights Reserved
湘ICP备09003080号