Example #1
0
load_skin('tools');
// content of the target web object
$input = '';
// maybe we have a cookie string to process
$cookie = '';
if (isset($_REQUEST['cookie']) && strlen($_REQUEST['cookie'])) {
    $cookie = $_REQUEST['cookie'];
}
// we have an URL to scan
$reference = '';
if (isset($_REQUEST['reference']) && strlen($_REQUEST['reference'])) {
    $reference = $_REQUEST['reference'];
    // fetch the object through the web
    if (!($input = http::proceed($reference, '', '', $cookie))) {
        // the standard way to localize string throughout YACS is to invoke i18n::s() -- see i18n/i18n.php
        Logger::error(sprintf(i18n::s('error while fetching %s'), $reference) . ' (' . http::get_error() . ')');
    }
    // the user has submitted some content to crunch
} elseif (isset($_REQUEST['input']) && strlen($_REQUEST['input'])) {
    $input = $_REQUEST['input'];
}
// the path to this page
$context['path_bar'] = array('tools/' => i18n::s('Tools'));
// the title of the page
// in YACS templates, it is placed into $context['title']
$context['page_title'] = i18n::s('Fat Index');
// the splash message
$context['text'] .= '<p>' . i18n::s('This script strips tags and white space to evaluate the amount of useful bytes. Then it computes the fat index as follows:') . '</p>' . "\n" . '<dl><dd>' . i18n::s('FAT Index = 10 log( Raw Bytes / Useful Bytes )') . '</dd></dl>' . "\n";
// we at least ask for registration
// look at shared/surfer.php for more information on the YACS security model
if (!Surfer::is_logged()) {