예제 #1
0
<?php

setlocale(LC_ALL, "ro_RO.utf8");
define('WOTD_BIG_BANG', '2011-05-01');
require_once "../phplib/util.php";
$date = util_getRequestParameter('d');
$type = util_getRequestParameter('t');
// RSS stuff - could be separated from the rest
// TODO optimize & factorize
if ($type == 'rss') {
    $words = WordOfTheDay::getRSSWotD();
    $results = array();
    foreach ($words as $w) {
        $item = array();
        $ts = strtotime($w->displayDate);
        $defId = WordOfTheDayRel::getRefId($w->id);
        $def = Model::factory('Definition')->where('id', $defId)->where('status', ST_ACTIVE)->find_one();
        smarty_assign('def', $def);
        smarty_assign('imageUrl', $w->getImageUrl());
        smarty_assign('fullServerUrl', util_getFullServerUrl());
        $item['title'] = $def->lexicon;
        $item['description'] = smarty_fetch('common/bits/wotdRssItem.ihtml');
        $item['pubDate'] = date('D, d M Y H:i:s', $ts) . ' EEST';
        $item['link'] = util_getFullServerUrl() . 'cuvantul-zilei/' . date('Y/m/d', $ts);
        $results[] = $item;
    }
    header("Content-type: text/xml");
    smarty_assign('rss_title', 'Cuvântul zilei');
    smarty_assign('rss_link', 'http://' . $_SERVER['HTTP_HOST'] . '/cuvantul-zilei/');
    smarty_assign('rss_description', 'Doza zilnică de cuvinte propuse de DEXonline!');
    smarty_assign('rss_pubDate', date('D, d M Y H:i:s') . ' EEST');
예제 #2
0
<?php

define('ONE_DAY_IN_SECS', 86400);
define('WOTD_BIG_BANG', '2011-05-01');
define('WOTD_REASON_BIG_BANG', '2013-09-01');
define('WOTD_REASON_DISPLAY_DELAY', 2);
require_once "../phplib/util.php";
$date = util_getRequestParameter('d');
$type = util_getRequestParameter('t');
$delay = util_getRequestParameter('h', 0);
//delay in minutes
// RSS stuff - could be separated from the rest
// TODO optimize & factorize
if ($type == 'rss' || $type == 'blog') {
    $words = WordOfTheDay::getRSSWotD($delay);
    $results = array();
    foreach ($words as $w) {
        $item = array();
        $ts = strtotime($w->displayDate);
        $defId = WordOfTheDayRel::getRefId($w->id);
        $def = Model::factory('Definition')->where('id', $defId)->where('status', ST_ACTIVE)->find_one();
        $source = Model::factory('Source')->where('id', $def->sourceId)->find_one();
        SmartyWrap::assign('def', $def);
        SmartyWrap::assign('source', $source);
        SmartyWrap::assign('imageUrl', $w->getImageUrl());
        if ($type == 'blog') {
            $curDate = strftime("%e %B", $ts);
            SmartyWrap::assign('curDate', $curDate);
            $item['title'] = "{$curDate} – " . $def->lexicon;
            $item['description'] = SmartyWrap::fetch('bits/wotdRssBlogItem.ihtml');
        } else {