$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}'')";