function print_successful_redirect($p_redirect_to) { if (helper_log_to_page()) { html_page_top(null, $p_redirect_to); echo '<br /><div class="center">'; echo lang_get('operation_successful') . '<br />'; print_bracket_link($p_redirect_to, lang_get('proceed')); echo '</div>'; html_page_bottom(); } else { print_header_redirect($p_redirect_to); } }
/** * MantisBT Core API's */ require_once 'core.php'; require_once 'custom_field_api.php'; form_security_validate('manage_proj_custom_field_update'); auth_reauthenticate(); $f_field_id = gpc_get_int('field_id'); $f_project_id = gpc_get_int('project_id'); $f_sequence = gpc_get_int('sequence'); # We should check both since we are in the project section and an # admin might raise the first threshold and not realize they need # to raise the second access_ensure_project_level(config_get('manage_project_threshold'), $f_project_id); access_ensure_project_level(config_get('custom_field_link_threshold'), $f_project_id); custom_field_set_sequence($f_field_id, $f_project_id, $f_sequence); form_security_purge('manage_proj_custom_field_update'); $t_redirect_url = 'manage_proj_edit_page.php?project_id=' . $f_project_id; html_page_top(null, $t_redirect_url); ?> <br /> <div align="center"> <?php echo lang_get('operation_successful') . '<br />'; print_bracket_link($t_redirect_url, lang_get('proceed')); ?> </div> <?php html_page_bottom();
<?php auth_reauthenticate(); access_ensure_global_level(config_get('manage_plugin_threshold')); html_page_top(plugin_lang_get('plugin_title')); print_manage_menu(); plugin_require_api('core/config_api.php'); $t_this_page = 'view_readme'; ERP_print_menu($t_this_page); ?> <pre> <?php plugin_require_api('doc/README.bug_report_mail.txt'); ?> </pre> <?php html_page_bottom(__FILE__);
/** * Print the bottom part for the bug action group page. * @return void */ function bug_group_action_print_bottom() { html_page_bottom(); }
/** * Generate the intermediate authentication page. * @param integer User ID * @param string Username * @return bool * @access public */ function auth_reauthenticate_page($p_user_id, $p_username) { $t_error = false; if (true == gpc_get_bool('_authenticate')) { $f_password = gpc_get_string('password', ''); if (auth_attempt_login($p_username, $f_password)) { auth_set_tokens($p_user_id); return true; } else { $t_error = true; } } html_page_top(); ?> <div align="center"> <p> <?php echo lang_get('reauthenticate_message'); if ($t_error != false) { echo '<br/><font color="red">', lang_get('login_error'), '</font>'; } ?> </p> <form name="reauth_form" method="post" action="<?php echo form_action_self(); ?> "> <?php # CSRF protection not required here - user needs to enter password # (confirmation step) before the form is accepted. print_hidden_inputs(gpc_strip_slashes($_POST)); print_hidden_inputs(gpc_strip_slashes($_GET)); ?> <input type="hidden" name="_authenticate" value="1" /> <table class="width50 center"> <tr> <td class="form-title" colspan="2"><?php echo lang_get('reauthenticate_title'); ?> </td> </tr> <tr class="row-1"> <th class="category"><?php echo lang_get('username'); ?> </th> <td><input type="text" disabled="disabled" size="32" maxlength="<?php echo USERLEN; ?> " value="<?php echo string_attribute($p_username); ?> " /></td> </tr> <tr class="row-2"> <th class="category"><?php echo lang_get('password'); ?> </th> <td><input type="password" name="password" size="16" maxlength="<?php echo PASSLEN; ?> " class="autofocus" /></td> </tr> <tr> <td class="center" colspan="2"><input type="submit" class="button" value="<?php echo lang_get('login_button'); ?> " /></td> </tr> </table> </form> </div> <?php html_page_bottom(); exit; }
/** * Check whether the user has confirmed this action. * * If the user has not confirmed the action, generate a page which asks * the user to confirm and then submits a form back to the current page * with all the GET and POST data and an additional field called _confirmed * to indicate that confirmation has been done. * @param string $p_message * @param string $p_button_label * @return bool * @todo improve this formatting - to only be about 50% of the screen width so that it doesn't become hard to read. */ function helper_ensure_confirmed($p_message, $p_button_label) { if (true == gpc_get_bool('_confirmed')) { return true; } html_page_top(); echo "<br />\n<div class=\"center\">\n<hr />"; echo "\n{$p_message}\n"; echo '<form method="post" action="">' . "\n"; # CSRF protection not required here - user needs to confirm action # before the form is accepted. print_hidden_inputs(gpc_strip_slashes($_POST)); print_hidden_inputs(gpc_strip_slashes($_GET)); echo "<input type=\"hidden\" name=\"_confirmed\" value=\"1\" />\n"; echo '<br /><br /><input type="submit" class="button" value="' . $p_button_label . '" />'; echo "\n</form>\n"; echo "<hr /></div>\n"; html_page_bottom(); exit; }
/** * Default error handler * * This handler will not receive E_ERROR, E_PARSE, E_CORE_*, or E_COMPILE_* * errors. * * E_USER_* are triggered by us and will contain an error constant in $p_error * The others, being system errors, will come with a string in $p_error * * @access private * @param integer $p_type Contains the level of the error raised, as an integer. * @param string $p_error Contains the error message, as a string. * @param string $p_file Contains the filename that the error was raised in, as a string. * @param integer $p_line Contains the line number the error was raised at, as an integer. * @param array $p_context To the active symbol table at the point the error occurred (optional). * @return void * @uses lang_api.php * @uses config_api.php * @uses compress_api.php * @uses database_api.php (optional) * @uses html_api.php (optional) */ function error_handler($p_type, $p_error, $p_file, $p_line, array $p_context) { global $g_error_parameters, $g_error_handled, $g_error_proceed_url; global $g_error_send_page_header; # check if errors were disabled with @ somewhere in this call chain if (0 == error_reporting()) { return; } $t_lang_pushed = false; $t_db_connected = false; if (function_exists('db_is_connected')) { if (db_is_connected()) { $t_db_connected = true; } } $t_html_api = false; if (function_exists('html_end')) { $t_html_api = true; } # flush any language overrides to return to user's natural default if ($t_db_connected) { lang_push(lang_get_default()); $t_lang_pushed = true; } $t_method_array = config_get_global('display_errors'); if (isset($t_method_array[$p_type])) { $t_method = $t_method_array[$p_type]; } else { if (isset($t_method_array[E_ALL])) { $t_method = $t_method_array[E_ALL]; } else { $t_method = 'none'; } } # build an appropriate error string $t_error_location = 'in \'' . $p_file . '\' line ' . $p_line; $t_error_description = '\'' . $p_error . '\' ' . $t_error_location; switch ($p_type) { case E_WARNING: $t_error_type = 'SYSTEM WARNING'; break; case E_NOTICE: $t_error_type = 'SYSTEM NOTICE'; break; case E_STRICT: $t_error_type = 'STRICT NOTICE'; break; case E_RECOVERABLE_ERROR: # This should generally be considered fatal (like E_ERROR) $t_error_type = 'SYSTEM ERROR'; break; case E_DEPRECATED: $t_error_type = 'DEPRECATED'; break; case E_USER_ERROR: $t_error_type = 'APPLICATION ERROR #' . $p_error; $t_error_description = error_string($p_error); if ($t_method == DISPLAY_ERROR_INLINE) { $t_error_description .= ' (' . $t_error_location . ")\n" . error_string(ERROR_DISPLAY_USER_ERROR_INLINE); } break; case E_USER_WARNING: $t_error_type = 'APPLICATION WARNING #' . $p_error; $t_error_description = error_string($p_error) . ' (' . $t_error_location . ')'; break; case E_USER_NOTICE: # used for debugging $t_error_type = 'DEBUG'; break; case E_USER_DEPRECATED: # Get the parent of the call that triggered the error to facilitate # debugging with a more useful filename and line number $t_stack = debug_backtrace(); $t_caller = $t_stack[2]; $t_error_type = 'WARNING'; $t_error_description = error_string($p_error) . ' (in ' . $t_caller['file'] . ' line ' . $t_caller['line'] . ')'; if ($t_method == DISPLAY_ERROR_INLINE && php_sapi_name() != 'cli') { # Enqueue messages for later display with error_print_delayed() global $g_errors_delayed; $g_errors_delayed[] = $t_error_description; $g_error_handled = true; return; } break; default: # shouldn't happen, just display the error just in case $t_error_type = 'UNHANDLED ERROR TYPE (' . '<a href="http://php.net/errorfunc.constants">' . $p_type . '</a>)'; $t_error_description = $p_error . ' (' . $t_error_location . ')'; } $t_error_description = nl2br($t_error_description); if (php_sapi_name() == 'cli') { if (DISPLAY_ERROR_NONE != $t_method) { echo $t_error_type . ': ' . $t_error_description . "\n"; if (ON == config_get_global('show_detailed_errors')) { echo "\n"; debug_print_backtrace(); } } if (DISPLAY_ERROR_HALT == $t_method) { exit(1); } } else { switch ($t_method) { case DISPLAY_ERROR_HALT: # disable any further event callbacks if (function_exists('event_clear_callbacks')) { event_clear_callbacks(); } $t_oblen = ob_get_length(); if ($t_oblen > 0) { $t_old_contents = ob_get_contents(); if (!error_handled()) { # Retrieve the previously output header if (false !== preg_match_all('|^(.*)(</head>.*$)|is', $t_old_contents, $t_result) && isset($t_result[1]) && isset($t_result[1][0])) { $t_old_headers = $t_result[1][0]; unset($t_old_contents); } } } # We need to ensure compression is off - otherwise the compression headers are output. compress_disable(); # then clean the buffer, leaving output buffering on. if ($t_oblen > 0) { ob_clean(); } # If HTML error output was disabled, set an error header and stop if (defined('DISABLE_INLINE_ERROR_REPORTING')) { # @TODO Have a mapping for mantis error codes to appropiate HTTP error codes header(' ', true, 400); exit(1); } # don't send the page header information if it has already been sent if ($g_error_send_page_header) { if ($t_html_api) { html_page_top1(); if ($p_error != ERROR_DB_QUERY_FAILED && $t_db_connected == true) { html_page_top2(); } else { html_page_top2a(); } } else { echo '<html><head><title>', $t_error_type, '</title></head><body>'; } } else { # Output the previously sent headers, if defined if (isset($t_old_headers)) { echo $t_old_headers, "\n"; html_page_top2(); } } echo '<div id="error-msg">'; echo '<div class="error-type">' . $t_error_type . '</div>'; echo '<div class="error-description">', $t_error_description, '</div>'; echo '<div class="error-info">'; if (null === $g_error_proceed_url) { echo lang_get('error_no_proceed'); } else { echo '<a href="', $g_error_proceed_url, '">', lang_get('proceed'), '</a>'; } echo '</div>'; if (ON == config_get_global('show_detailed_errors')) { echo '<div class="error-details">'; error_print_details($p_file, $p_line, $p_context); echo '</div>'; echo '<div class="error-trace">'; error_print_stack_trace(); echo '</div>'; } echo '</div>'; if (isset($t_old_contents)) { echo '<div class="warning">Previous non-fatal errors occurred. Page contents follow.</div>'; echo '<div id="old-contents">'; echo $t_old_contents; echo '</div>'; } if ($t_html_api) { if ($p_error != ERROR_DB_QUERY_FAILED && $t_db_connected == true) { html_page_bottom(); } else { html_body_end(); html_end(); } } else { echo '</body></html>', "\n"; } exit(1); case DISPLAY_ERROR_INLINE: if (!defined('DISABLE_INLINE_ERROR_REPORTING')) { echo '<div class="error-inline">', $t_error_type, ': ', $t_error_description, '</div>'; } $g_error_handled = true; break; default: # do nothing - note we treat this as we've not handled an error, so any redirects go through. } } if ($t_lang_pushed) { lang_pop(); } $g_error_parameters = array(); $g_error_proceed_url = null; }
/** * Generate the intermediate authentication page. * @param integer $p_user_id User ID. * @param string $p_username Username. * @return boolean * @access public */ function auth_reauthenticate_page($p_user_id, $p_username) { $t_error = false; if (true == gpc_get_bool('_authenticate')) { $f_password = gpc_get_string('password', ''); if (auth_attempt_login($p_username, $f_password)) { auth_set_tokens($p_user_id); return true; } else { $t_error = true; } } html_page_top(); ?> <div class="important-msg"> <?php echo lang_get('reauthenticate_message'); if ($t_error != false) { echo '<br /><span class="error-msg">', lang_get('login_error'), '</span>'; } ?> </div> <div id="reauth-div" class="form-container"> <form id="reauth-form" method="post" action=""> <fieldset> <legend><span><?php echo lang_get('reauthenticate_title'); ?> </span></legend> <?php # CSRF protection not required here - user needs to enter password # (confirmation step) before the form is accepted. print_hidden_inputs($_POST); print_hidden_inputs($_GET); ?> <input type="hidden" name="_authenticate" value="1" /> <div class="field-container"> <label for="username"><span><?php echo lang_get('username'); ?> </span></label> <span class="input"><input id="username" type="text" disabled="disabled" size="32" maxlength="<?php echo DB_FIELD_SIZE_USERNAME; ?> " value="<?php echo string_attribute($p_username); ?> " /></span> <span class="label-style"></span> </div> <div class="field-container"> <label for="password"><span><?php echo lang_get('password'); ?> </span></label> <span class="input"><input id="password" type="password" name="password" size="32" maxlength="<?php echo auth_get_password_max_size(); ?> " class="autofocus" /></span> <span class="label-style"></span> </div> <span class="submit-button"><input type="submit" class="button" value="<?php echo lang_get('login_button'); ?> " /></span> </fieldset> </form> </div> <?php html_page_bottom(); exit; }
/** * Default error handler * * This handler will not receive E_ERROR, E_PARSE, E_CORE_*, or E_COMPILE_* * errors. * * E_USER_* are triggered by us and will contain an error constant in $p_error * The others, being system errors, will come with a string in $p_error * * @access private * @param int p_type contains the level of the error raised, as an integer. * @param string p_error contains the error message, as a string. * @param string p_file contains the filename that the error was raised in, as a string. * @param int p_line contains the line number the error was raised at, as an integer. * @param array p_context to the active symbol table at the point the error occurred (optional) * @uses lang_api.php * @uses config_api.php * @uses compress_api.php * @uses database_api.php (optional) * @uses html_api.php (optional) */ function error_handler($p_type, $p_error, $p_file, $p_line, $p_context) { global $g_error_parameters, $g_error_handled, $g_error_proceed_url; global $g_lang_overrides; global $g_error_send_page_header; # check if errors were disabled with @ somewhere in this call chain if (0 == error_reporting()) { return; } $t_lang_pushed = false; $t_db_connected = false; if (function_exists('db_is_connected')) { if (db_is_connected()) { $t_db_connected = true; } } $t_html_api = false; if (function_exists('html_end')) { $t_html_api = true; } # flush any language overrides to return to user's natural default if ($t_db_connected) { lang_push(lang_get_default()); $t_lang_pushed = true; } $t_short_file = basename($p_file); $t_method_array = config_get_global('display_errors'); if (isset($t_method_array[$p_type])) { $t_method = $t_method_array[$p_type]; } else { if (isset($t_method_array[E_ALL])) { $t_method = $t_method_array[E_ALL]; } else { $t_method = 'none'; } } # build an appropriate error string switch ($p_type) { case E_WARNING: $t_error_type = 'SYSTEM WARNING'; $t_error_description = "'{$p_error}' in '{$p_file}' line {$p_line}"; break; case E_NOTICE: $t_error_type = 'SYSTEM NOTICE'; $t_error_description = "'{$p_error}' in '{$p_file}' line {$p_line}"; break; case E_USER_ERROR: $t_error_type = "APPLICATION ERROR #{$p_error}"; $t_error_description = error_string($p_error); break; case E_USER_WARNING: $t_error_type = "APPLICATION WARNING #{$p_error}"; $t_error_description = error_string($p_error); break; case E_USER_NOTICE: # used for debugging $t_error_type = 'DEBUG'; $t_error_description = $p_error; break; default: # shouldn't happen, just display the error just in case $t_error_type = ''; $t_error_description = $p_error; } $t_error_description = nl2br($t_error_description); switch ($t_method) { case 'halt': # disable any further event callbacks if (function_exists('event_clear_callbacks')) { event_clear_callbacks(); } $t_oblen = ob_get_length(); if (error_handled() && $t_oblen > 0) { $t_old_contents = ob_get_contents(); } # We need to ensure compression is off - otherwise the compression headers are output. compress_disable(); # then clean the buffer, leaving output buffering on. if ($t_oblen > 0) { ob_clean(); } # don't send the page header information if it has already been sent if ($g_error_send_page_header) { if ($t_html_api) { html_page_top1(); if ($p_error != ERROR_DB_QUERY_FAILED && $t_db_connected == true) { html_page_top2(); } else { html_page_top2a(); } } else { echo '<html><head><title>', $t_error_type, '</title></head><body>'; } } echo '<br /><div align="center"><table class="width50" cellspacing="1">'; echo '<tr><td class="form-title">', $t_error_type, '</td></tr>'; echo '<tr><td><p class="center" style="color:red">', $t_error_description, '</p></td></tr>'; echo '<tr><td><p class="center">'; if (null === $g_error_proceed_url) { echo lang_get('error_no_proceed'); } else { echo '<a href="', $g_error_proceed_url, '">', lang_get('proceed'), '</a>'; } echo '</p></td></tr>'; if (ON == config_get_global('show_detailed_errors')) { echo '<tr><td>'; error_print_details($p_file, $p_line, $p_context); echo '</td></tr>'; echo '<tr><td>'; error_print_stack_trace(); echo '</td></tr>'; } echo '</table></div>'; if (isset($t_old_contents)) { echo '<p>Previous non-fatal errors occurred. Page contents follow.</p>'; echo '<div style="border: solid 1px black;padding: 4px">'; echo $t_old_contents; echo '</div>'; } if ($t_html_api) { if ($p_error != ERROR_DB_QUERY_FAILED && $t_db_connected == true) { html_page_bottom(); } else { html_body_end(); html_end(); } } else { echo '</body></html>', "\n"; } exit; case 'inline': echo '<p style="color:red">', $t_error_type, ': ', $t_error_description, '</p>'; $g_error_handled = true; break; default: # do nothing - note we treat this as we've not handled an error, so any redirects go through. } if ($t_lang_pushed) { lang_pop(); } $g_error_parameters = array(); $g_error_proceed_url = null; }
/** * Retaken function form print_api.php but it prints redirection message everytime * @param type $p_redirect_to */ function release_mgt_successful_redirect($p_redirect_to) { html_page_top(null, $p_redirect_to); echo '<br /><div class="center">'; echo lang_get('operation_successful') . '<br />'; print_bracket_link($p_redirect_to, lang_get('proceed')); echo '</div>'; html_page_bottom(); }
function write_bug_rows($p_rows) { $user_array = get_user_array(); $alive_user_ids = array(); $issues_array_html = ''; $allowed_statuses_html = ''; print '<div id="taskodrome_data" hidden="true"> '; $users = ''; $user_number = count($user_array); for ($i = 0; $i != $user_number; $i++) { $users .= '<p hidden="true" class="user_data" '; $users .= 'name="' . $user_array[$i]->name . '" '; $users .= 'id="' . $user_array[$i]->id . '"'; $users .= '></p>'; $alive_user_ids[$user_array[$i]->id] = 1; } print $users; $t_rows = count($p_rows); for ($i = 0; $i < $t_rows; $i++) { $t_row = $p_rows[$i]; $handler_id = $t_row->handler_id; if (!array_key_exists($t_row->handler_id, $alive_user_ids)) { $handler_id = 0; } $issues_array_html .= '<p hidden="true" class="issue_data" '; $issues_array_html .= 'id="' . $t_row->id . '" '; $issues_array_html .= 'summary="' . htmlentities($t_row->summary) . '" '; $issues_array_html .= 'status="' . $t_row->status . '" '; $issues_array_html .= 'handler_id="' . $handler_id . '" '; $issues_array_html .= 'topColor="#0000FF" '; $issues_array_html .= 'bottomColor="#FF0000" '; $issues_array_html .= 'updateTime="' . $t_row->last_updated . '"'; $issues_array_html .= '></p>'; $t_all_statuses = get_status_option_list(access_get_project_level($t_row->project_id), $t_row->status, true, false, $t_row->project_id); $allowed_statuses_html .= '<p hidden="true" class="status_pair" '; $allowed_statuses_html .= 'id="' . $t_row->id . '" '; $src_status_str = ''; $dst_status_str = ''; foreach ($t_all_statuses as $src_status => $src_st) { $src_status_str .= $src_status . ';'; $t_enum_list = get_status_option_list(access_get_project_level($t_row->project_id), $src_status, true, bug_is_user_reporter($t_row->id, auth_get_current_user_id()) && access_has_bug_level(config_get('report_bug_threshold'), $t_row->id) && ON == config_get('allow_reporter_close'), $t_row->project_id); foreach ($t_enum_list as $dst_status => $dst_st) { $dst_status_str .= $dst_status . ','; } $dst_status_str .= ';'; } $allowed_statuses_html .= 'src_status="' . $src_status_str . '" '; $allowed_statuses_html .= 'dst_status="' . $dst_status_str . '"'; $allowed_statuses_html .= '></p>'; } print $issues_array_html; print $allowed_statuses_html; $status_order = null; foreach (plugin_config_get("status_board_order") as $t_value) { $status_order .= $t_value . ';'; } print '<p hidden="true" class="status_board_order" value="' . $status_order . '"></p>'; print '<p hidden="true" id="cooldown_period_days" value="' . plugin_config_get("cooldown_period_days") . '"></p>'; print '<p hidden="true" id="cooldown_period_hours" value="' . plugin_config_get("cooldown_period_hours") . '"></p>'; print '</div>'; print '<section class="tabs"> <br> <input type="radio" id="radio_dg" name="group" > <input type="radio" id="radio_sg" name="group" > [ <label id="label_dg" class="radio_label" for="radio_dg" >' . plugin_lang_get("assignment_board") . '</label> ] [ <label id="label_sg" class="radio_label" for="radio_sg" >' . plugin_lang_get("status_board") . '</label> ] <div class="tabs_cont"> <div id="tab_c1"> '; print '<div id="dev-grid" class="grid"> <canvas id="panel"> </canvas> </div> '; print '</div>'; print '<div id="tab_c2"> <div id="st-grid" class="grid"> <canvas id="panel_st"> </canvas> </div> '; html_page_bottom(); print '</div>'; print '</div> </section> '; }
print_summary_submenu(); $t_width = plugin_config_get( 'window_width' ); $t_graph_width = (int) ( ( $t_width - 50 ) * 0.6 ); # gather the data for the graphs $t_metrics = create_bug_enum_summary( lang_get( 'status_enum_string' ), 'status' ); $t_token = token_set( TOKEN_GRAPH, serialize( $t_metrics ) ); ?> <br /> <table class="width100" cellspacing="1"> <tr> <td class="form-title"> <?php echo plugin_lang_get( 'graph_imp_status_title' ) ?> </td> </tr> <tr> <td class="center"> <img src="<?php echo plugin_page( 'summary_graph_bystatus.php')?>&width=<?php echo $t_graph_width?>" alt="" /> </td> </tr> <tr> <td class="center"> <img src="<?php echo plugin_page( 'summary_graph_bystatus_pct.php')?>&width=<?php echo $t_graph_width?>" alt="" /> </td> </tr> </table> <?php html_page_bottom();
/** * Default error handler * * This handler will not receive E_ERROR, E_PARSE, E_CORE_*, or E_COMPILE_* * errors. * * E_USER_* are triggered by us and will contain an error constant in $p_error * The others, being system errors, will come with a string in $p_error * * @access private * @param int p_type contains the level of the error raised, as an integer. * @param string p_error contains the error message, as a string. * @param string p_file contains the filename that the error was raised in, as a string. * @param int p_line contains the line number the error was raised at, as an integer. * @param array p_context to the active symbol table at the point the error occurred (optional) * @uses lang_api.php * @uses config_api.php * @uses compress_api.php * @uses database_api.php (optional) * @uses html_api.php (optional) */ function error_handler($p_type, $p_error, $p_file, $p_line, $p_context) { global $g_error_parameters, $g_error_handled, $g_error_proceed_url; global $g_lang_overrides; global $g_error_send_page_header; # check if errors were disabled with @ somewhere in this call chain if (0 == error_reporting()) { return; } $t_lang_pushed = false; $t_db_connected = false; if (function_exists('db_is_connected')) { if (db_is_connected()) { $t_db_connected = true; } } $t_html_api = false; if (function_exists('html_end')) { $t_html_api = true; } # flush any language overrides to return to user's natural default if ($t_db_connected) { lang_push(lang_get_default()); $t_lang_pushed = true; } $t_short_file = basename($p_file); $t_method_array = config_get_global('display_errors'); if (isset($t_method_array[$p_type])) { $t_method = $t_method_array[$p_type]; } else { if (isset($t_method_array[E_ALL])) { $t_method = $t_method_array[E_ALL]; } else { $t_method = 'none'; } } # build an appropriate error string switch ($p_type) { case E_WARNING: $t_error_type = 'SYSTEM WARNING'; $t_error_description = "'{$p_error}' in '{$p_file}' line {$p_line}"; break; case E_NOTICE: $t_error_type = 'SYSTEM NOTICE'; $t_error_description = "'{$p_error}' in '{$p_file}' line {$p_line}"; break; case E_USER_ERROR: $t_error_type = "APPLICATION ERROR #{$p_error}"; $t_error_description = error_string($p_error); if ($t_method == DISPLAY_ERROR_INLINE) { $t_error_description .= "\n" . error_string(ERROR_DISPLAY_USER_ERROR_INLINE); } break; case E_USER_WARNING: $t_error_type = "APPLICATION WARNING #{$p_error}"; $t_error_description = error_string($p_error); break; case E_USER_NOTICE: # used for debugging $t_error_type = 'DEBUG'; $t_error_description = $p_error; break; default: # shouldn't happen, just display the error just in case $t_error_type = ''; $t_error_description = $p_error; } $t_error_description = nl2br($t_error_description); switch ($t_method) { case DISPLAY_ERROR_HALT: # disable any further event callbacks if (function_exists('event_clear_callbacks')) { event_clear_callbacks(); } $t_oblen = ob_get_length(); if ($t_oblen > 0) { $t_old_contents = ob_get_contents(); if (!error_handled()) { # Retrieve the previously output header if (false !== preg_match_all('|^(.*)(</head>.*$)|is', $t_old_contents, $result)) { $t_old_headers = $result[1][0]; unset($t_old_contents); } } } # We need to ensure compression is off - otherwise the compression headers are output. compress_disable(); # then clean the buffer, leaving output buffering on. if ($t_oblen > 0) { ob_clean(); } # don't send the page header information if it has already been sent if ($g_error_send_page_header) { if ($t_html_api) { html_page_top1(); if ($p_error != ERROR_DB_QUERY_FAILED && $t_db_connected == true) { html_page_top2(); } else { html_page_top2a(); } } else { echo '<html><head><title>', $t_error_type, '</title></head><body>'; } } else { # Output the previously sent headers, if defined if (isset($t_old_headers)) { echo $t_old_headers, "\n"; html_page_top2(); } } echo '<div id="error-msg">'; echo '<div class="error-type">' . $t_error_type . '</div>'; echo '<div class="error-description">', $t_error_description, '</div>'; echo '<div class="error-info">'; if (null === $g_error_proceed_url) { echo lang_get('error_no_proceed'); } else { echo '<a href="', $g_error_proceed_url, '">', lang_get('proceed'), '</a>'; } echo '</div>'; if (ON == config_get_global('show_detailed_errors')) { echo '<div class="error-details">'; error_print_details($p_file, $p_line, $p_context); echo '</div>'; echo '<div class="error-trace">'; error_print_stack_trace(); echo '</div>'; } echo '</div>'; if (isset($t_old_contents)) { echo '<div class="warning">Previous non-fatal errors occurred. Page contents follow.</div>'; echo '<div id="old-contents">'; echo $t_old_contents; echo '</div>'; } if ($t_html_api) { if ($p_error != ERROR_DB_QUERY_FAILED && $t_db_connected == true) { html_page_bottom(); } else { html_body_end(); html_end(); } } else { echo '</body></html>', "\n"; } exit; case DISPLAY_ERROR_INLINE: echo '<div class="error-inline">', $t_error_type, ': ', $t_error_description, '</div>'; $g_error_handled = true; break; default: # do nothing - note we treat this as we've not handled an error, so any redirects go through. } if ($t_lang_pushed) { lang_pop(); } $g_error_parameters = array(); $g_error_proceed_url = null; }