Mercurial > SimpleWebPresenter
view flag.php @ 56:0f1e08cdfff2
Move accept-language to Language to reflect new class name.
| author | Tom Fredrik "BFG" Klaussen <bfg@blenning.no> |
|---|---|
| date | Thu, 11 Oct 2012 01:07:17 +0200 |
| parents | 88482c6636c4 |
| children | dd4ddedca4c5 |
line wrap: on
line source
<?php /** * @file * Displays a flag, in an active or disabled state, depending on parameters */ define(DEBUG,0); include_once 'CacheTimeCheck.inc'; $cache = CacheTimeCheck::instance(__FILE__); $cache->includeOnce('Language.inc'); $cache->includeOnce('common-functions.inc'); $active = $_GET['active']; $lang = $_GET['lang']; if(!$lang) { $lang = "no"; $langs = Language::accepted(); foreach ($langs as $l => $val) { if (file_exists($l)) { $lang = $l; break; } } } $name = "../img/flag-${lang}"; if ($active) $name .= "-active"; $name .= ".png"; $cache->cache_time($name); $cache->CheckHttpModified(); $flag = loadFile($name); if (floatval($flag) < 0) { errorPage('Resource not found', 404); } else { header("Content-Type: image/png"); print $flag; }
