\n
\n";
print_hr();
PRINT "\n$p_message\n";
PRINT '\n";
print_hr();
PRINT "
\n";
html_page_bottom1();
exit;
}
# --------------------
# Call custom function.
#
# $p_function - Name of function to call (eg: do_stuff). The function will call custom_function_override_do_stuff()
# if found, otherwise, will call custom_function_default_do_stuff().
# $p_args_array - Parameters to function as an array
function helper_call_custom_function( $p_function, $p_args_array ) {
$t_function = 'custom_function_override_' . $p_function;
if ( !function_exists( $t_function ) ) {
$t_function = 'custom_function_default_' . $p_function;
}
return call_user_func_array( $t_function, $p_args_array );
}
# --------------------
function helper_project_specific_where( $p_project_id, $p_user_id = null ) {
if ( null === $p_user_id ) {
$p_user_id = auth_get_current_user_id();
}
if ( ALL_PROJECTS == $p_project_id ) {
$t_topprojects = $t_project_ids = user_get_accessible_projects( $p_user_id );
foreach ( $t_topprojects as $t_project ) {
$t_project_ids = array_merge( $t_project_ids, user_get_all_accessible_subprojects( $p_user_id, $t_project ) );
}
$t_project_ids = array_unique( $t_project_ids );
} else {
access_ensure_project_level( VIEWER, $p_project_id );
$t_project_ids = user_get_all_accessible_subprojects( $p_user_id, $p_project_id );
array_unshift( $t_project_ids, $p_project_id );
}
$t_project_ids = array_map( 'db_prepare_int', $t_project_ids );
if ( 0 == count( $t_project_ids ) ) {
$t_project_filter = ' 1<>1';
} elseif ( 1 == count( $t_project_ids ) ) {
$t_project_filter = ' project_id=' . $t_project_ids[0];
} else {
$t_project_filter = ' project_id IN (' . join( ',', $t_project_ids ) . ')';
}
return $t_project_filter;
}
?>