function qa_install_db_fail_handler($type, $errno = null, $error = null, $query = null) { global $pass_failure_from_install; $pass_failure_type = $type; $pass_failure_errno = $errno; $pass_failure_error = $error; $pass_failure_query = $query; $pass_failure_from_install = true; require QA_INCLUDE_DIR . 'qa-install.php'; qa_exit('error'); }
function qa_page_db_fail_handler($type, $errno = null, $error = null, $query = null) { if (qa_to_override(__FUNCTION__)) { $args = func_get_args(); return qa_call_override(__FUNCTION__, $args); } $pass_failure_type = $type; $pass_failure_errno = $errno; $pass_failure_error = $error; $pass_failure_query = $query; require_once QA_INCLUDE_DIR . 'qa-install.php'; qa_exit('error'); }
function qa_feed_not_found() { header('HTTP/1.0 404 Not Found'); echo qa_lang_html('misc/feed_not_found'); qa_exit(); }
function qa_image_db_fail_handler() { header('HTTP/1.1 500 Internal Server Error'); qa_exit('error'); }
function qa_redirect_raw($url) { if (qa_to_override(__FUNCTION__)) { $args = func_get_args(); return qa_call_override(__FUNCTION__, $args); } header('Location: ' . $url); qa_exit('redirect'); }
$qa_content['script_onloads'][] = array("qa_mailing_start('mailing_ok', 'domailingpause');"); } else { // rudimentary non-Javascript version of mass mailing loop echo '<tt>'; while (true) { qa_mailing_perform_step(); $message = qa_mailing_progress_message(); if (!isset($message)) { break; } echo qa_html($message) . str_repeat(' ', 1024) . "<br>\n"; flush(); sleep(1); } echo qa_lang_html('admin/mailing_complete') . '</tt><p><a href="' . qa_path_html('admin/mailing') . '">' . qa_lang_html('admin/admin_title') . ' - ' . qa_lang_html('admin/mailing_title') . '</a>'; qa_exit(); } } function qa_optionfield_make_select(&$optionfield, $options, $value, $default) { $optionfield['type'] = 'select'; $optionfield['options'] = $options; $optionfield['value'] = isset($options[qa_html($value)]) ? $options[qa_html($value)] : @$options[$default]; } $indented = false; foreach ($showoptions as $optionname) { if (empty($optionname)) { $indented = false; $qa_content['form']['fields'][] = array('type' => 'blank'); } elseif (strpos($optionname, '/') !== false) { $qa_content['form']['fields'][] = array('type' => 'static', 'label' => qa_lang_html($optionname));
function qa_ajax_db_fail_handler() { echo "QA_AJAX_RESPONSE\n0\nA database error occurred."; qa_exit('error'); }
/** * If a DB error occurs, call the installed fail handler (if any) otherwise report error and exit immediately. */ function qa_db_fail_error($type, $errno = null, $error = null, $query = null) { if (qa_to_override(__FUNCTION__)) { $args = func_get_args(); return qa_call_override(__FUNCTION__, $args); } global $qa_db_fail_handler; @error_log('PHP Question2Answer MySQL ' . $type . ' error ' . $errno . ': ' . $error . (isset($query) ? ' - Query: ' . $query : '')); if (function_exists($qa_db_fail_handler)) { $qa_db_fail_handler($type, $errno, $error, $query); } else { echo '<hr><font color="red">Database ' . htmlspecialchars($type . ' error ' . $errno) . '<p>' . nl2br(htmlspecialchars($error . "\n\n" . $query)); qa_exit('error'); } }