Example #1
0
File: my.php Project: vcgato29/poff
/**
 * script version (added automatically on svn commit)
 *
 */
define('version', '$Id: my.php 39 2008-11-22 17:48:03Z lauri $');
/**
 * If true then outputs notices/warnings/errors and
 * print $_REQUEST and $_SESSION global variables
 *
 */
define('debug', isset($_COOKIE['ma']['debug']) && $_COOKIE['ma']['debug'] == 1 ? 1 : 0);
// Set the error handler to the error_handler() function
set_error_handler('error_handler');
// image outputing
if (isset($_GET['img'])) {
    output_image($_GET['img']);
}
session_cache_limiter('private');
session_start();
header('Pragma: no-cache');
header('Cache-Control: no-cache');
/*

if(isset($_COOKIE['ma']['err_rep']))
{
	error_reporting($_COOKIE['ma']['err_rep']);
}

if(isset($_COOKIE['ma']['time_limit']) && is_numeric($_COOKIE['ma']['time_limit']))
{
	if(function_exists('set_time_limit'))
    // Output transparent gif
    header('Cache-Control: no-cache');
    header('Content-type: image/gif');
    header('Content-length: 43');
    echo base64_decode('R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==');
    // Flush here to prevent browser from showing the page as loading while
    // running cron.
    flush();
}
// Thanks to various fatal errors and lack of try/finally, it is quite easy to leave
// the cron lock locked, especially when working on cron-related code.
//
// Attempt to alleviate the problem by doing setup outside of the lock as much as possible.
$cron_type = request_var('cron_type', '');
// Comment this line out for debugging so the page does not return an image.
output_image();
$cron_lock = $phpbb_container->get('cron.lock_db');
if ($cron_lock->acquire()) {
    $cron = $phpbb_container->get('cron.manager');
    $task = $cron->find_task($cron_type);
    if ($task) {
        if ($task->is_parametrized()) {
            $task->parse_parameters($request);
        }
        if ($task->is_ready()) {
            $task->run();
        }
    }
    $cron_lock->release();
}
garbage_collection();
Example #3
0
function output_icon($icon)
{
    $time = filemtime(get_image_filename($icon));
    if (isset($_SERVER['HTTP_IF_NONE_MATCH']) && $time == $_SERVER['HTTP_IF_NONE_MATCH'] || $time <= if_modified_since()) {
        header('HTTP/1.1 304 Not Modified');
        header('Etag: ' . $time);
        header('Cache-Control: public, max-age=' . FAVICON_CACHE_TTL);
        header('Expires: ' . gmdate("D, d M Y H:i:s", UNIX_TIME + FAVICON_CACHE_TTL) . ' GMT');
        exit;
    }
    output_image($icon, $time);
}