if ($requested_identifier) {
         $t->requested_identifier = $requested_identifier;
     }
     $t->template_id = $template->id();
     $t->set_theme($theme);
     $t->initialize($site_id, $page_id);
     if ($requested_api && method_exists($t, 'run_api')) {
         $t->run_api();
     } else {
         $t->run();
     }
     $page = ob_get_contents();
     ob_end_clean();
     // if we are a developer lets turn back on the error_handler on screen output
     if (is_developer() && ($use_cache && !$cache_hit)) {
         error_handler_config("display_errors", true);
     }
 }
 ///////////////////////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////////////////////////////////////////////////////////////
 //    display the page
 ///////////////////////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////////////////////////////////////////////////////////////
 echo $page;
 // if we're using a cache, make sure to store the new result
 // also, record stats about misses here
 $page_gen_time = round(1000 * (get_microtime() - $s));
 if ($use_cache and !$cache_hit) {
     $cache->set_page_generation_time($page_gen_time);
     $cache->store(get_current_url(), $page);
 }
Esempio n. 2
0
<?php

/**
 * Common support code for the background upload scripts.
 *
 * @package reason
 * @subpackage scripts
 * @since Reason 4.0 beta 8
 * @author Eric Naeseth <*****@*****.**>
 */
require_once 'reason_header.php';
// Prevent the error handler from dumping HTML error messages.
error_handler_config('script_mode', true);
reason_require_once('function_libraries/util.php');
reason_require_once('classes/entity_selector.php');
connectDB(REASON_DB);
reason_require_once('function_libraries/user_functions.php');
reason_require_once('function_libraries/upload.php');
reason_require_once('function_libraries/reason_session.php');
function response_code($code)
{
    http_response_code($code);
}
function final_response($code, $message)
{
    if (is_array($message) || is_object($message)) {
        header('Content-Type: application/json');
        $message = json_encode($message);
    } else {
        header('Content-Type: text/plain');
    }
Esempio n. 3
0
 function _verify_values()
 {
     // check to make sure required fields are filled out
     foreach ($this->_req_channel_attributes as $req) {
         if (!$this->get_channel_attr($req)) {
             $old_mode = error_handler_config('script_mode', true);
             trigger_error('"' . $req . '" is a required RSS channel field.  Use set_channel_attribute( "' . $req . '", "blah" ) to set it.');
             error_handler_config('script_mode', $old_mode);
             $this->send_internal_error();
             die;
         }
     }
 }
/**
 * The callback function that handles PHP errors. For more information on what
 * this error handler does and when it gets called, see
 * {@link error_handler.php the documentation for the error handler file}.
 */
function carl_util_handle_error($level, $message, $file, $line, $context)
{
    // Obey the current PHP error_reporting value. One notable effect of this
    // check is that it causes us to obey the @ error-suppression operator.
    if (($level & error_reporting()) == 0) {
        return true;
    }
    $store_error = $log_error = error_handler_config('log_errors');
    $display_error = is_developer() && error_handler_config('display_errors') && !error_handler_config('script_mode') && !isset($_REQUEST['nodebug']);
    $send_email = error_handler_config('send_emails');
    $send_page = error_handler_config('send_pages');
    if ($store_error) {
        _carl_util_store_error($level, $message, $file, $line, $context);
    }
    if ($display_error) {
        _carl_util_display_error($level, $message, $file, $line, $context);
    }
    if ($log_error) {
        _carl_util_log_error($level, $message, $file, $line, $context);
    }
    if ($send_email) {
        _carl_util_send_email($level, $message, $file, $line, $context);
    }
    if ($send_page) {
        _carl_util_send_page($level, $message, $file, $line, $context);
    }
    if (level_is_terminal($level)) {
        if (!is_developer() && !error_handler_config('script_mode')) {
            header('Location: ' . OHSHI_SCRIPT);
        } else {
            _carl_util_send_error_status();
        }
        exit;
    }
    return true;
}