function smarty_function_tikicon($params, &$smarty)
{
    global $style, $style_base, $icon_style;
    //print_r($params);
    //print("<br />");
    //print_r($style);
    //print("<br />");
    //print_r($style_base);
    //print("<br />");
    //print_r($icon_style);
    //print("<br />");
    //if we have icon styles, first look there
    if (isset($icon_style)) {
        if (false !== ($matchFile = get_first_match("img/icons/{$icon_style}/" . $params['igroup'] . "/", $params['iname']))) {
            return output_icon($params, $matchFile);
        }
    }
    //if we have site styles, look there
    if (isset($style) && isset($style_base)) {
        if (false !== ($matchFile = get_first_match("styles/{$style_base}/icons/" . $params['igroup'] . "/", $params['iname']))) {
            return output_icon($params, $matchFile);
        }
    }
    //Well, then lets look in the default location
    if (false !== ($matchFile = get_first_match("img/icons/" . $params['igroup'] . "/", $params['iname']))) {
        return output_icon($params, $matchFile);
    }
    //OK! FINE! For now TEMPORARILY we'll look in the icons folder.
    if (false !== ($matchFile = get_first_match("img/icons/", $params['iname']))) {
        return output_icon($params, $matchFile);
    }
    //Still didn't find it! Well lets output something
    return output_icon($params, "broken." . $params['igroup'] . "/" . $params['iname']);
}
Beispiel #2
0
if (!function_exists('file_put_contents')) {
    function file_put_contents($filename, $data)
    {
        $fp = fopen($filename, is_file($filename) ? 'r+b' : 'wb');
        if ($fp === false) {
            return false;
        }
        flock($fp, LOCK_EX);
        rewind($fp);
        $bytes = fwrite($fp, $data);
        fflush($fp);
        ftruncate($fp, ftell($fp));
        flock($fp, LOCK_UN);
        fclose($fp);
        return $bytes;
    }
}
if (isset($_GET['clear'])) {
    clear_cache($_GET['clear']);
    exit('ok');
}
$favicon = false;
if (isset($_GET['url'])) {
    $favicon = get_favicon(rawurldecode($_GET['url']));
}
if ($favicon === false) {
    output_image('ErrorIcon');
    exit;
}
output_icon($favicon);
exit;