. #------------------------------ # $Revision: 2643 $ # $Author: al $ # $Date: 2009-06-18 19:06:27 -0400 (Thu, 18 Jun 2009) $ #------------------------------ $t_core_dir = dirname( __FILE__ ).DIRECTORY_SEPARATOR; require_once( $t_core_dir . 'ajax_api.php' ); require_once( $t_core_dir . 'current_user_api.php' ); require_once( $t_core_dir . 'string_api.php' ); require_once( $t_core_dir . 'prepare_api.php' ); require_once( $t_core_dir . 'profile_api.php' ); require_once( $t_core_dir . 'last_visited_api.php' ); ### Print API ### # this file handles printing functions # -------------------- # Print the headers to cause the page to redirect to $p_url # If $p_die is true (default), terminate the execution of the script # immediately # If we have handled any errors on this page and the 'stop_on_errors' config # option is turned on, return false and don't redirect. # $p_sanitize - true/false - true in the case where the URL is extracted from GET/POST or untrusted source. # This would be false if the URL is trusted (e.g. read from config_inc.php). function print_header_redirect( $p_url, $p_die = true, $p_sanitize = false ) { $t_use_iis = config_get( 'use_iis'); if ( ON == config_get( 'stop_on_errors' ) && error_handled() ) { return false; } # validate the url as part of this site before continuing $t_url = $p_sanitize ? string_sanitize_url( $p_url ) : $p_url; # don't send more headers if they have already been sent (guideweb) if ( ! headers_sent() ) { header( 'Content-Type: text/html; charset=' . lang_get( 'charset' ) ); if ( ON == $t_use_iis ) { header( "Refresh: 0;url=$t_url" ); } else { header( "Location: $t_url" ); } } else { trigger_error( ERROR_PAGE_REDIRECTION, ERROR ); return false; } if ( $p_die ) { die; # additional output can cause problems so let's just stop output here } return true; } # -------------------- # Print a redirect header to view a bug function print_header_redirect_view( $p_bug_id ) { print_header_redirect( string_get_bug_view_url( $p_bug_id ) ); } # -------------------- # Get a view URL for the bug id based on the user's preference and # call print_successful_redirect() with that URL function print_successful_redirect_to_bug( $p_bug_id ) { $t_url = string_get_bug_view_url( $p_bug_id, auth_get_current_user_id() ); print_successful_redirect( $t_url ); } # -------------------- # If the show query count is ON, print success and redirect after the # configured system wait time. # If the show query count is OFF, redirect right away. function print_successful_redirect( $p_redirect_to ) { if ( helper_show_queries() ) { html_meta_redirect( $p_redirect_to ); html_page_top1(); html_page_top2(); PRINT '
' . lang_get( 'operation_successful' ) . '
'; print_bracket_link( $p_redirect_to, lang_get( 'proceed' ) ); PRINT ''; $output .= $t_date_posted . ' - '; echo $output; # @@@ eventually we should replace print's with methods to construct the # strings. print_user( $p_poster_id ); $output = ''; if ( 1 == $p_announcement ) { $output .= ' - [' . lang_get( 'announcement' ) . ']'; } if ( VS_PRIVATE == $p_view_state ) { $output .= ' - [' . lang_get( 'private' ) . ']'; } $output .= '
'; $output .= '' . $t_body . '
'; $output .= '