Example #1
0
                    SmartyWrap::assign('def', $def);
                    SmartyWrap::assign('lexemIds', $lexemIds);
                    SmartyWrap::assign('user', userCache_get($def->userId));
                    SmartyWrap::displayWithoutSkin('xml/update3Definitions.tpl');
                }
                print "</Definitions>\n";
            } else {
                if ($export == 'lexems') {
                    $lexemDbResult = db_execute("select * from Lexem where modDate >= '{$timestamp}' order by modDate, id");
                    print "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
                    print "<Lexems>\n";
                    print "<NumResults>" . $lexemDbResult->rowCount() . "</NumResults>\n";
                    foreach ($lexemDbResult as $dbRow) {
                        $lexem = Model::factory('Lexem')->create($dbRow);
                        SmartyWrap::assign('lexem', $lexem);
                        SmartyWrap::displayWithoutSkin('xml/update3Lexems.tpl');
                    }
                    print "</Lexems>\n";
                }
            }
        }
    }
}
/****************************************************************************/
function userCache_init()
{
    $GLOBALS['USER'] = array();
}
function userCache_get($key)
{
    if (array_key_exists($key, $GLOBALS['USER'])) {
Example #2
0
<?php

require_once '../../phplib/util.php';
//util_assertModerator(PRIV_ADMIN);
$rows = CrawledPage::getListOfDomains();
$options = array('all', 'most recent domain');
$last = end($rows);
$values = array('all', $last->domain);
foreach ($rows as $obj) {
    array_push($options, $obj->domain);
    array_push($values, $obj->domain);
}
//var_dump($options);
SmartyWrap::assign('page_title', 'Romanian Crawler Log');
SmartyWrap::assign('values', $values);
SmartyWrap::assign('options', $options);
//SmartyWrap::smartyDisplay('crawler/crawler.ihtml');
SmartyWrap::assign('jqueryLibPath', '../js/jquery-1.8.3.min.js');
SmartyWrap::displayWithoutSkin('crawler/crawler.ihtml');
Example #3
0
<?php

require_once "../phplib/util.php";
$type = util_getRequestParameter('t');
if ($type == 'rss') {
    $articles = WikiArticle::getRss();
    $results = array();
    foreach ($articles as $a) {
        $results[] = array('title' => $a->title, 'description' => $a->htmlContents, 'pubDate' => date('D, d M Y H:i:s', $a->modDate) . ' EEST', 'link' => sprintf("http://%s/articol/%s", $_SERVER['HTTP_HOST'], $a->getUrlTitle()));
    }
    header("Content-type: application/rss+xml");
    SmartyWrap::assign('rss_title', 'Articole lingvistice - dexonline');
    SmartyWrap::assign('rss_link', 'http://' . $_SERVER['HTTP_HOST'] . '/rss/articole/');
    SmartyWrap::assign('rss_description', 'Articole pe teme lingvistice de la dexonline');
    SmartyWrap::assign('rss_pubDate', date('D, d M Y H:i:s') . ' EEST');
    SmartyWrap::assign('results', $results);
    SmartyWrap::displayWithoutSkin('xml/rss.tpl');
    exit;
}
SmartyWrap::assign('wikiTitles', WikiArticle::loadAllTitles());
SmartyWrap::display('articole.tpl');
Example #4
0
                    SmartyWrap::assign('def', $def);
                    SmartyWrap::assign('lexemIds', $lexemIds);
                    SmartyWrap::assign('user', userCache_get($def->userId));
                    SmartyWrap::displayWithoutSkin('update3Definitions.ihtml');
                }
                print "</Definitions>\n";
            } else {
                if ($export == 'lexems') {
                    $lexemDbResult = db_execute("select * from Lexem where modDate >= '{$timestamp}' order by modDate, id");
                    print "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
                    print "<Lexems>\n";
                    print "<NumResults>" . $lexemDbResult->rowCount() . "</NumResults>\n";
                    foreach ($lexemDbResult as $dbRow) {
                        $lexem = Model::factory('Lexem')->create($dbRow);
                        SmartyWrap::assign('lexem', $lexem);
                        SmartyWrap::displayWithoutSkin('update3Lexems.ihtml');
                    }
                    print "</Lexems>\n";
                }
            }
        }
    }
}
/****************************************************************************/
function userCache_init()
{
    $GLOBALS['USER'] = array();
}
function userCache_get($key)
{
    if (array_key_exists($key, $GLOBALS['USER'])) {
Example #5
0
        $pageDescription .= " din dicționarele: " . implode(", ", $sourceList);
    }
    SmartyWrap::assign('pageDescription', $pageDescription);
}
// Ads
AdsModule::runAllModules(empty($lexems) ? null : $lexems, empty($definitions) ? null : $definitions);
SmartyWrap::assign('text', $text);
SmartyWrap::assign('searchType', $searchType);
SmartyWrap::assign('showParadigm', $showParadigm);
SmartyWrap::assign('locParadigm', session_user_prefers(Preferences::LOC_PARADIGM));
SmartyWrap::assign('paradigmLink', $paradigmLink);
SmartyWrap::assign('advancedSearch', $text || $sourceId);
/* Gallery */
$images = empty($lexems) ? array() : Visual::loadAllForLexems($lexems);
SmartyWrap::assign('images', $images);
if (count($images)) {
    SmartyWrap::addCss('gallery');
    SmartyWrap::addJs('gallery');
}
if (!$xml) {
    SmartyWrap::addCss('paradigm');
    SmartyWrap::display('search.tpl');
} else {
    header('Content-type: text/xml');
    SmartyWrap::displayWithoutSkin('xml/search.tpl');
}
if (Config::get('global.logSearch')) {
    $logDefinitions = isset($definitions) ? $definitions : array();
    $log = new Log($cuv, $redirectFrom, $searchType, $redirect, $logDefinitions);
    $log->logData();
}
Example #6
0
require_once "../phplib/util.php";
$date = util_getRequestParameter('d');
$type = util_getRequestParameter('t');
$today = date('Y-m-01', time());
// Always use the first of the month
$timestamp = $date ? strtotime($date) : time();
$mysqlDate = date("Y-m-01", $timestamp);
if ($mysqlDate < WOTM_BIG_BANG || $mysqlDate > $today && !util_isModerator(PRIV_ADMIN)) {
    util_redirect(util_getWwwRoot() . 'cuvantul-lunii');
}
$wotm = WordOfTheMonth::getWotM($mysqlDate);
$def = Definition::get_by_id($wotm->definitionId);
if ($type == 'url') {
    SmartyWrap::assign('today', $today);
    SmartyWrap::assign('title', $def->lexicon);
    SmartyWrap::displayWithoutSkin('bits/wotmurl.tpl');
    exit;
}
$searchResults = SearchResult::mapDefinitionArray(array($def));
$cYear = date('Y', $timestamp);
$cMonth = date('n', $timestamp);
$nextTS = mktime(0, 0, 0, $cMonth + 1, 1, $cYear);
$prevTS = mktime(0, 0, 0, $cMonth - 1, 1, $cYear);
if ($mysqlDate > WOTM_BIG_BANG) {
    SmartyWrap::assign('prevmon', date('Y/m', $prevTS));
}
if ($mysqlDate < $today || util_isModerator(PRIV_ADMIN)) {
    SmartyWrap::assign('nextmon', date('Y/m', $nextTS));
}
SmartyWrap::assign('imageUrl', $wotm->getImageUrl());
SmartyWrap::assign('artist', $wotm->getArtist());
Example #7
0
$showSource = (int) util_getRequestParameter('s');
if (!is_int($showSource) || $showSource != 1) {
    $showSource = DEFAULT_SHOW_LIST;
}
$noSkin = (int) util_getRequestParameter('k');
if (!is_int($noSkin) || $noSkin != 1) {
    $noSkin = DEFAULT_SHOW_LIST;
}
/*
  $query = sprintf('select id from Lexem order by rand() limit %d', $listLength);
  $ids = db_getArray($query);

  $query = sprintf(RANDOM_WORDS_QUERY, $showSource?SOURCE_PART_RANDOM_WORDS:'', implode(",",$ids));
  $forms = db_getArrayOfRows($query);
*/
$wotd = '';
if (is_null($wListLength)) {
    $query = sprintf(RANDOM_WORDS_QUERY, $showSource ? SOURCE_PART_RANDOM_WORDS : '', $listLength);
} else {
    $query = sprintf(RANDOM_WOTD_QUERY, $wListLength);
    $wotd = ' ale zilei';
}
$forms = db_getArrayOfRows($query);
$cnt = count($forms);
SmartyWrap::assign('forms', $forms);
SmartyWrap::assign('wotd', $wotd);
if ($noSkin) {
    SmartyWrap::displayWithoutSkin('bits/randomWordListSimple.tpl');
} else {
    SmartyWrap::display('randomWordList.tpl');
}
Example #8
0
<?php

require_once "../phplib/util.php";
define('NO_OF_WOTD_IN_LIST', 4);
$year = util_getRequestIntParameterWithDefault('y', date('Y'));
$month = util_getRequestIntParameterWithDefault('m', date('m'));
$day = util_getRequestIntParameterWithDefault('d', date('d'));
$timestamp = mktime(0, 0, 0, $month, $day, $year);
$prevWotds = WordOfTheDay::getPreviousYearsWotds($month, $day);
$wotds = [];
foreach ($prevWotds as $w) {
    $currentYear = substr($w->displayDate, 0, 4);
    if (count($wotds) >= NO_OF_WOTD_IN_LIST) {
        break;
    }
    if ($currentYear != $year) {
        $defId = WordOfTheDayRel::getRefId($w->id);
        $def = Model::factory('Definition')->where('id', $defId)->where('status', Definition::ST_ACTIVE)->find_one();
        $entry = [];
        $entry['year'] = $currentYear;
        $entry['href'] = "/cuvantul-zilei/{$currentYear}/{$month}/{$day}";
        $entry['img'] = $w->getThumbUrl();
        $entry['word'] = $def->lexicon;
        $entry['tip'] = $w->description;
        $wotds[] = $entry;
    }
}
SmartyWrap::assign('timestamp', $timestamp);
SmartyWrap::assign('wotds', $wotds);
SmartyWrap::displayWithoutSkin('bits/wotdPreviousYears.tpl');
Example #9
0
// Force loading a lexem on the next comparison.
print "<!DOCTYPE dict [\n";
print "  <!ENTITY diams \"&#x2666;\">\n";
print "  <!ENTITY loz \"&#x25ca;\">\n";
print "  <!ENTITY rsquo \"&#x2019;\">\n";
print "]>\n";
print "<Dictionary>\n";
print "  <Timestamp>" . time() . "</Timestamp>\n";
if ($version == '1.0') {
    print "    <NumResults>" . $defDbResult->rowCount() . "</NumResults>\n";
}
foreach ($defDbResult as $row) {
    fetchNextRow($row);
    SmartyWrap::assign('version', $version);
    SmartyWrap::assign('includeNameWithDiacritics', hasFlag('a'));
    SmartyWrap::displayWithoutSkin('update.ihtml');
}
print "</Dictionary>\n";
return;
function createSourceMap()
{
    $sourceMap = array();
    $sources = Model::factory('Source')->find_many();
    foreach ($sources as $source) {
        $sourceMap[$source->id] = $source;
    }
    return $sourceMap;
}
function userCache_init()
{
    $GLOBALS['USER'] = array();
Example #10
0
    $weeks = array();
    while (count($calendar)) {
        $weeks[] = array_splice($calendar, 0, 7);
    }
    return $weeks;
}
SmartyWrap::assign('month', strftime("%B", strtotime("{$year}-{$month}-01")));
SmartyWrap::assign('year', $year);
$showPrev = $year > 2011 || $year == 2011 && $month > 5 ? 1 : 0;
$showNext = util_isModerator(PRIV_ADMIN) || time() >= mktime(0, 0, 0, $month + 1, 1, $year);
SmartyWrap::assign('showPrev', $showPrev);
SmartyWrap::assign('showNext', $showNext);
$prefix = 'arhiva/cuvantul-zilei';
if ($month == '01') {
    $prevMonth = $prefix . '/' . ($year - 1) . '/12';
} else {
    $m = sprintf("%02d", (int) $month - 1);
    $prevMonth = "{$prefix}/{$year}/{$m}";
}
if ($month == '12') {
    $nextMonth = $prefix . '/' . ($year + 1) . '/01';
} else {
    $m = sprintf("%02d", (int) $month + 1);
    $nextMonth = "{$prefix}/{$year}/{$m}";
}
SmartyWrap::assign('prevMonth', $prevMonth);
SmartyWrap::assign('nextMonth', $nextMonth);
$words = createCalendar($year, $month);
SmartyWrap::assign('words', $words);
SmartyWrap::displayWithoutSkin('wotdArchive.ihtml');
Example #11
0
<?php

require_once "../../phplib/util.php";
util_assertNotMirror();
// Parse or initialize the GET/POST arguments
$text = util_getRequestParameter('text');
$definitionId = util_getRequestIntParameter('definitionId');
$submit = util_getRequestIntParameter('submit');
if ($submit) {
    if ($text && $definitionId) {
        $typo = Model::factory('Typo')->create();
        $typo->definitionId = $definitionId;
        $typo->problem = $text;
        $typo->save();
    }
    SmartyWrap::displayWithoutSkin('bits/typoConfirmation.tpl');
} else {
    SmartyWrap::assign('definitionId', $definitionId);
    SmartyWrap::displayWithoutSkin('bits/typoForm.tpl');
}
Example #12
0
    $weeks = array();
    while (count($calendar)) {
        $weeks[] = array_splice($calendar, 0, 7);
    }
    return $weeks;
}
SmartyWrap::assign('month', strftime("%B", strtotime("{$year}-{$month}-01")));
SmartyWrap::assign('year', $year);
$showPrev = $year > 2011 || $year == 2011 && $month > 5 ? 1 : 0;
$showNext = util_isModerator(PRIV_ADMIN) || time() >= mktime(0, 0, 0, $month + 1, 1, $year);
SmartyWrap::assign('showPrev', $showPrev);
SmartyWrap::assign('showNext', $showNext);
$prefix = 'arhiva/cuvantul-zilei';
if ($month == '01') {
    $prevMonth = $prefix . '/' . ($year - 1) . '/12';
} else {
    $m = sprintf("%02d", (int) $month - 1);
    $prevMonth = "{$prefix}/{$year}/{$m}";
}
if ($month == '12') {
    $nextMonth = $prefix . '/' . ($year + 1) . '/01';
} else {
    $m = sprintf("%02d", (int) $month + 1);
    $nextMonth = "{$prefix}/{$year}/{$m}";
}
SmartyWrap::assign('prevMonth', $prevMonth);
SmartyWrap::assign('nextMonth', $nextMonth);
$words = createCalendar($year, $month);
SmartyWrap::assign('words', $words);
SmartyWrap::displayWithoutSkin('bits/wotdArchive.tpl');
Example #13
0
            }
        } else {
            // asume plain OpenID
            $isOpenidConnect = false;
        }
    }
    if (!FlashMessage::getMessage()) {
        if ($isOpenidConnect) {
            try {
                $oidc->authenticate($oidcId, $oidcSecret);
            } catch (OpenIDException $e) {
                FlashMessage::add($e->getMessage());
            }
        } else {
            $authResult = OpenID::beginAuth($openid, null);
            if ($authResult != null) {
                SmartyWrap::displayWithoutSkin('auth/beginAuth.ihtml');
                exit;
            }
        }
    }
}
if ($devel) {
    SmartyWrap::assign('allowFakeUsers', true);
    SmartyWrap::assign('privilegeNames', $PRIV_NAMES);
    SmartyWrap::assign('fakeUserNick', 'test' . rand(10000, 99999));
}
SmartyWrap::assign('openid', $openid);
SmartyWrap::assign('page_title', 'Autentificare cu OpenID');
SmartyWrap::assign('suggestHiddenSearchForm', true);
SmartyWrap::display('auth/login.ihtml');
Example #14
0
    WordOfTheDay::updateTodaysWord();
    $wotd = WordOfTheDay::get_by_displayDate($mysqlDate);
}
$reason = '';
if ($wotd) {
    $reason = $wotd->description;
    if (util_isModerator(PRIV_ADMIN) || $mysqlDate >= WOTD_REASON_BIG_BANG && $date && strtotime($date) < time() - WOTD_REASON_DISPLAY_DELAY * ONE_DAY_IN_SECS) {
        SmartyWrap::assign('reason', $reason);
    }
}
$defId = WordOfTheDayRel::getRefId($wotd->id);
$def = Definition::get_by_id($defId);
if ($type == 'url') {
    SmartyWrap::assign('today', $today);
    SmartyWrap::assign('title', $def->lexicon);
    SmartyWrap::displayWithoutSkin('bits/wotdurl.ihtml');
    exit;
}
$searchResults = SearchResult::mapDefinitionArray(array($def));
$roDate = strftime("%e %B %Y", $timestamp);
$pageTitle = sprintf("Cuvântul zilei (%s): %s", $roDate, $def->lexicon);
$pageDesc = sprintf("Cuvântul zilei de la dexonline. Azi, %s: %s", $roDate, $def->lexicon);
if ($mysqlDate > WOTD_BIG_BANG) {
    SmartyWrap::assign('prevday', date('Y/m/d', $timestamp - ONE_DAY_IN_SECS));
}
if ($mysqlDate < $today || util_isModerator(PRIV_ADMIN)) {
    SmartyWrap::assign('nextday', date('Y/m/d', $timestamp + ONE_DAY_IN_SECS));
}
SmartyWrap::assign('imageUrl', $wotd->getImageUrl());
SmartyWrap::assign('imageCredits', $wotd->getImageCredits());
SmartyWrap::assign('timestamp', $timestamp);
<?php

require_once "../../phplib/util.php";
$lexemId = util_getRequestParameter('lexemId');
$defs = Definition::loadByLexemId($lexemId);
$results = array();
foreach ($defs as $def) {
    $htmlRep = str_replace("\n", ' ', $def->htmlRep);
    $source = Source::get_by_id($def->sourceId);
    $results[] = array('id' => $def->id, 'shortName' => $source->shortName, 'status' => $def->getStatusName(), 'htmlRep' => $htmlRep);
}
SmartyWrap::assign('results', $results);
SmartyWrap::displayWithoutSkin('ajax/getDefinitionsForLexem.tpl');
Example #16
0
    SmartyWrap::assign('page_title', "{$cuv} - definitie{$page_title}");
    SmartyWrap::assign('page_keywords', $page_keywords);
    SmartyWrap::assign('page_description', $page_description);
}
// Ads
AdsModule::runAllModules(empty($lexems) ? null : $lexems, empty($definitions) ? null : $definitions);
SmartyWrap::assign('text', $text);
SmartyWrap::assign('searchType', $searchType);
SmartyWrap::assign('showParadigm', $showParadigm);
SmartyWrap::assign('locParadigm', session_user_prefers(Preferences::LOC_PARADIGM));
SmartyWrap::assign('paradigmLink', $paradigmLink);
SmartyWrap::assign('advancedSearch', $text || $sourceId);
/* Gallery */
$images = empty($lexems) ? array() : Visual::loadAllForLexems($lexems);
SmartyWrap::assign('images', $images);
if (count($images)) {
    SmartyWrap::addCss('gallery');
    SmartyWrap::addJs('gallery');
}
if (!$xml) {
    SmartyWrap::addCss('paradigm');
    SmartyWrap::display('search.ihtml');
} else {
    header('Content-type: text/xml');
    SmartyWrap::displayWithoutSkin('searchXML.ihtml');
}
if (Config::get('global.logSearch')) {
    $logDefinitions = isset($definitions) ? $definitions : array();
    $log = new Log($cuv, $redirectFrom, $searchType, $redirect, $logDefinitions);
    $log->logData();
}
Example #17
0
<?php

require_once "../phplib/util.php";
$type = util_getRequestParameter('t');
if ($type == 'rss') {
    $articles = WikiArticle::getRss();
    $results = array();
    foreach ($articles as $a) {
        $results[] = array('title' => $a->title, 'description' => $a->htmlContents, 'pubDate' => date('D, d M Y H:i:s', $a->modDate) . ' EEST', 'link' => sprintf("http://%s/articol/%s", $_SERVER['HTTP_HOST'], $a->getUrlTitle()));
    }
    header("Content-type: application/rss+xml");
    SmartyWrap::assign('rss_title', 'Articole lingvistice - DEX online');
    SmartyWrap::assign('rss_link', 'http://' . $_SERVER['HTTP_HOST'] . '/rss/articole/');
    SmartyWrap::assign('rss_description', 'Articole pe teme lingvistice de la DEX online');
    SmartyWrap::assign('rss_pubDate', date('D, d M Y H:i:s') . ' EEST');
    SmartyWrap::assign('results', $results);
    SmartyWrap::displayWithoutSkin('rss.ixml');
    exit;
}
SmartyWrap::assign('page_title', 'Articole lingvistice');
SmartyWrap::assign('wikiTitles', WikiArticle::loadAllTitles());
SmartyWrap::display('articole.ihtml');
Example #18
0
if (!is_int($showSource) || $showSource != 1) {
    $showSource = DEFAULT_SHOW_LIST;
}
$noSkin = (int) util_getRequestParameter('k');
if (!is_int($noSkin) || $noSkin != 1) {
    $noSkin = DEFAULT_SHOW_LIST;
}
/*
$query = sprintf('select id from Lexem order by rand() limit %d', $listLength);
$ids = db_getArray($query);

$query = sprintf(RANDOM_WORDS_QUERY, $showSource?SOURCE_PART_RANDOM_WORDS:'', implode(",",$ids));
$forms = db_getArrayOfRows($query);
*/
$wotd = '';
if (is_null($wListLength)) {
    $query = sprintf(RANDOM_WORDS_QUERY, $showSource ? SOURCE_PART_RANDOM_WORDS : '', $listLength);
} else {
    $query = sprintf(RANDOM_WOTD_QUERY, $wListLength);
    $wotd = ' ale zilei';
}
$forms = db_getArrayOfRows($query);
$cnt = count($forms);
if ($noSkin) {
    SmartyWrap::assign('forms', $forms);
    SmartyWrap::displayWithoutSkin('randomWordListSimple.ihtml');
} else {
    SmartyWrap::assign('forms', $forms);
    SmartyWrap::assign('page_title', "O listă de {$cnt} de cuvinte{$wotd} alese la întâmplare.");
    SmartyWrap::display('randomWordList.ihtml');
}
Example #19
0
    // Exercise the fields we'll need later in the view.
    // TODO: this code replicates code from search.php
    $hasUnrecommendedForms = false;
    foreach ($filtered_lexems as $l) {
        foreach ($l->getLexemModels() as $lm) {
            $lm->getModelType();
            $lm->getSourceNames();
            $map = $lm->loadInflectedFormMap();
            $lm->addLocInfo();
            foreach ($map as $ifs) {
                foreach ($ifs as $if) {
                    $hasUnrecommendedForms |= !$if->recommended;
                }
            }
        }
    }
    SmartyWrap::assign('hasUnrecommendedForms', $hasUnrecommendedForms);
    SmartyWrap::assign('lexems', $filtered_lexems);
    SmartyWrap::assign('showParadigm', true);
    SmartyWrap::assign('locParadigm', session_user_prefers(Preferences::LOC_PARADIGM));
    SmartyWrap::assign('onlyParadigm', !$ajax);
} else {
    FlashMessage::add("Niciun rezultat pentru {$cuv}.");
    SmartyWrap::assign('page_title', "Eroare");
}
if ($ajax) {
    SmartyWrap::displayWithoutSkin('bits/multiParadigm.ihtml');
} else {
    SmartyWrap::addCss('paradigm');
    SmartyWrap::display('search.ihtml');
}
Example #20
0
function util_assertNotMirror()
{
    if (Config::get('global.mirror')) {
        SmartyWrap::displayWithoutSkin('mirror_message.ihtml');
        exit;
    }
}