<?php

// Force browser to render the output as plain text
HTTP::mime('text/plain');
echo $content;
예제 #2
0
 *
 */
Route::accept(array('feed/json', 'feed/json/(:num)'), function ($offset = 1) use($config) {
    Config::set('offset', (int) $offset);
    HTTP::mime('application/json', $config->charset);
    Shield::attach(SHIELD . DS . 'json.php');
}, 82);
/**
 * Captcha Image
 * -------------
 *
 * [1]. captcha.png
 *
 */
Route::accept('captcha.png', function () {
    HTTP::mime('image/png')->header(array('Cache-Control' => 'no-store, no-cache, must-revalidate, max-age=0', 'Cache-Control' => 'post-check=0, pre-check=0', 'Pragma' => 'no-cache'));
    $str = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
    $bg = Request::get('bg', '333333', false);
    $color = Request::get('color', 'FFFFAA', false);
    $padding = Request::get('padding', 0);
    $width = Request::get('width', 100) + $padding * 2;
    $height = Request::get('height', 30) + $padding * 2;
    $size = Request::get('size', 16);
    $length = Request::get('length', 7);
    $font = Request::get('font', 'special-elite-regular.ttf', false);
    $text = substr(str_shuffle($str), 0, $length);
    Session::set(Guardian::$captcha, $text);
    if ($bg !== 'false' && ($bg = Converter::HEX2RGB($bg))) {
        $bg = array($bg['r'], $bg['g'], $bg['b'], $bg['a']);
    } else {
        $bg = $bg !== 'false' ? array(51, 51, 51, 1) : array(0, 0, 0, 0);