Exemple #1
0
function get_mttinfo($v)
{
    global $_mttinfo;
    if (isset($_mttinfo[$v])) {
        return $_mttinfo[$v];
    }
    switch ($v) {
        case 'template_url':
            $_mttinfo['template_url'] = get_mttinfo('mtt_url') . 'themes/' . Config::get('template') . '/';
            return $_mttinfo['template_url'];
        case 'url':
            $_mttinfo['url'] = Config::get('url');
            if ($_mttinfo['url'] == '') {
                $_mttinfo['url'] = 'http://' . $_SERVER['HTTP_HOST'] . ($_SERVER['SERVER_PORT'] != 80 ? ':' . $_SERVER['SERVER_PORT'] : '') . url_dir(isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : $_SERVER['SCRIPT_NAME']);
            }
            return $_mttinfo['url'];
        case 'mtt_url':
            $_mttinfo['mtt_url'] = Config::get('mtt_url');
            if ($_mttinfo['mtt_url'] == '') {
                $_mttinfo['mtt_url'] = url_dir(isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : $_SERVER['SCRIPT_NAME']);
            }
            return $_mttinfo['mtt_url'];
        case 'title':
            $_mttinfo['title'] = Config::get('title') != '' ? htmlarray(Config::get('title')) : __('My Tiny Todolist');
            return $_mttinfo['title'];
    }
}
Exemple #2
0
function printRss($listData, $data)
{
    $link = get_mttinfo('url') . "?list=" . $listData['id'];
    $buildDate = gmdate('r');
    $s = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<rss version=\"2.0\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\">\n<channel>\n" . "<title>{$listData['_feed_title']}</title>\n<link>{$link}</link>\n<description>{$listData['_feed_descr']}</description>\n" . "<lastBuildDate>{$buildDate}</lastBuildDate>\n\n";
    foreach ($data as $v) {
        $d = gmdate('r', $v[$listData['_uid_field']]);
        $guid = $listData['id'] . '-' . $v['id'] . '-' . $v[$listData['_uid_field']];
        $s .= "<item>\n<title><![CDATA[" . str_replace("]]>", "]]]]><![CDATA[>", $v['title']) . "]]></title>\n" . "<link>{$link}</link>\n" . "<pubDate>{$d}</pubDate>\n" . "<description><![CDATA[" . $v['_descr'] . "]]></description>\n" . "<guid isPermaLink=\"false\">{$guid}</guid>\n" . "</item>\n";
    }
    $s .= "</channel>\n</rss>";
    header("Content-type: text/xml; charset=utf-8");
    print $s;
}