コード例 #1
0
ファイル: adsModule.php プロジェクト: florinp/dexonline
 public static function runAllModules($lexems, $definitions)
 {
     $adsModules = Config::get('global.adsModulesH');
     if ($adsModules) {
         foreach ($adsModules as $adsModule) {
             require_once util_getRootPath() . "phplib/ads/{$adsModule}/{$adsModule}AdsModule.php";
             $className = ucfirst($adsModule) . 'AdsModule';
             $module = new $className();
             $result = $module->run(empty($lexems) ? null : $lexems, empty($definitions) ? null : $definitions);
             if ($result) {
                 SmartyWrap::assign('adsProvider', $adsModule);
                 SmartyWrap::assign('adsProviderParams', $result);
                 break;
             }
         }
     }
 }
コード例 #2
0
ファイル: custom-ad.php プロジェクト: Jobava/mirror-dexonline
$provider = util_getRequestParameter('provider');
// Display a banner for this provider
$go = util_getRequestParameter('go');
// Track a click and redirect to this provider
$clickurl = util_getRequestParameter('clickurl');
// Sent to us by OpenX; when displaying a banner, we have to link to this URL
if ($go) {
    $provider = $go;
    $go = true;
}
require_once "../phplib/ads/{$provider}/{$provider}AdsModule.php";
if ($provider == 'diverta') {
    $bookId = util_getRequestParameter('bookId');
    $book = DivertaBook::get_by_id($bookId);
    if (!$book) {
        exit;
    }
    if ($go) {
        $book->clicks++;
        $book->save();
        util_redirect($book->url);
    }
    $book->impressions++;
    $book->save();
    SmartyWrap::assign('book', $book);
    SmartyWrap::assign('hasImage', file_exists(util_getRootPath() . "wwwbase/img/diverta/thumb/{$book->sku}.jpg"));
}
SmartyWrap::assign('clickurl', str_replace('__', '&', $clickurl));
$output = SmartyWrap::fetch("ads/{$provider}.ihtml");
$output = addslashes(str_replace("\n", ' ', $output));
print "document.write(\"{$output}\");";
コード例 #3
0
<?php

require_once "../phplib/util.php";
$user = session_getUser();
if (!$user) {
    util_redirect('auth/login');
}
SmartyWrap::assign('bookmarks', UserWordBookmarkDisplayObject::getByUser($user->id));
SmartyWrap::display('cuvinte-favorite.tpl');
コード例 #4
0
ファイル: paradigm.php プロジェクト: Jobava/mirror-dexonline
    // 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');
}
コード例 #5
0
ファイル: bulkLabel.php プロジェクト: florinp/dexonline
$lexems = Model::factory('Lexem')->table_alias('l')->select('l.*')->join('LexemModel', 'lm.lexemId = l.id', 'lm')->where('lm.modelType', 'T')->where_like('l.reverse', "{$reverseSuffix}%")->order_by_asc('l.formNoAccent')->limit(20)->find_many();
// $lmMatrix[$i][$j] = lexem model (with inflected forms) for lexem $i and model $j
$lmMatrix = array();
foreach ($lexems as $l) {
    $lm = $l->getFirstLexemModel();
    $lmArray = array();
    foreach ($models as $m) {
        // Force a reload
        $lm = LexemModel::get_by_id($lm->id);
        $lm->modelType = $m->modelType;
        $lm->modelNumber = $m->number;
        $lm->generateInflectedFormMap();
        $lmArray[] = $lm;
    }
    $lmMatrix[] = $lmArray;
}
// Load the definitions for each lexem
$searchResults = array();
foreach ($lexems as $l) {
    $definitions = Definition::loadByLexemId($l->id);
    $searchResults[] = SearchResult::mapDefinitionArray($definitions);
}
SmartyWrap::assign('suffix', $suffix);
SmartyWrap::assign('lexems', $lexems);
SmartyWrap::assign('models', $models);
SmartyWrap::assign('modelTypes', $modelTypes);
SmartyWrap::assign('searchResults', $searchResults);
SmartyWrap::assign('lmMatrix', $lmMatrix);
SmartyWrap::assign('recentLinks', RecentLink::loadForUser());
SmartyWrap::addCss('paradigm');
SmartyWrap::displayAdminPage('admin/bulkLabel.tpl');
コード例 #6
0
$data['identity'] = $provider;
if (isset($data['name'])) {
    $data['fullname'] = $data['name'];
}
$user = User::get_by_identity_openidConnectSub($provider, $data['sub']);
if (!$user && $oidc->getPlainOpenid()) {
    // This may be the first time the user logs in after the migration from
    // OpenID 2.0 to OpenID Connect.
    $user = User::get_by_identity($oidc->getPlainOpenid());
    if ($user) {
        $user->identity = null;
        // session_login will overwrite it
    }
}
if ($user) {
    session_login($user, $data);
} else {
    // First time logging in, must claim an existing account or create a new one
    // TODO this duplicates code in revenireOpenid.php
    $user = isset($data['email']) ? User::get_by_email($data['email']) : null;
    $loginType = $user ? 0 : (isset($data['fullname']) ? 1 : (isset($data['nickname']) ? 2 : 3));
    // Store the identity in a temporary file. Don't print it in the form, because then it can be faked on the next page.
    $randString = util_randomCapitalLetterString(20);
    FileCache::put($randString, $data);
    SmartyWrap::assign('page_title', 'Autentificare cu OpenID');
    SmartyWrap::assign('suggestHiddenSearchForm', true);
    SmartyWrap::assign('data', $data);
    SmartyWrap::assign('randString', $randString);
    SmartyWrap::assign('loginType', $loginType);
    SmartyWrap::display('auth/chooseIdentity.ihtml');
}
コード例 #7
0
foreach ($recordSet as $row) {
    $changeSet = $row;
    $changeSet['changesCount'] = 0;
    if ($row['OldUserId'] !== $row['NewUserId']) {
        $changeSet['changesCount']++;
    }
    if ($row['OldSourceId'] !== $row['NewSourceId']) {
        $changeSet['changesCount']++;
    }
    if ($row['OldStatus'] !== $row['NewStatus']) {
        $changeSet['OldStatusName'] = $statuses[$row['OldStatus']];
        $changeSet['NewStatusName'] = $statuses[$row['NewStatus']];
        $changeSet['changesCount']++;
    }
    if ($row['OldLexicon'] !== $row['NewLexicon']) {
        $changeSet['changesCount']++;
    }
    if ($row['OldModUserId'] !== $row['NewModUserId']) {
        $changeSet['changesCount']++;
    }
    if ($row['OldInternalRep'] !== $row['NewInternalRep']) {
        $changeSet['diff'] = LDiff::htmlDiff($row['OldInternalRep'], $row['NewInternalRep']);
        $changeSet['changesCount']++;
    }
    if ($changeSet['changesCount'] > 0) {
        $changeSets[] = $changeSet;
    }
}
SmartyWrap::assign('def', $def);
SmartyWrap::assign('changeSets', $changeSets);
SmartyWrap::display('istoria-definitiei.tpl');
コード例 #8
0
        $s = substr($s, 0, $m['position']) . " {$MARKER} " . substr($s, $m['position'], $m['length']) . " {$MARKER} " . substr($s, $m['position'] + $m['length']);
    }
    $s = AdminStringUtil::htmlize($s, $def->sourceId);
    // Split the definition into n ambiguities and n+1 bits of text between the ambiguities
    $text = array();
    $ambiguities = array();
    while (($p = strpos($s, $MARKER)) !== false) {
        $chunk = trim(substr($s, 0, $p));
        $s = trim(substr($s, $p + strlen($MARKER)));
        if (count($text) == count($ambiguities)) {
            $text[] = $chunk;
        } else {
            $ambiguities[] = $chunk;
        }
    }
    $text[] = trim($s);
    SmartyWrap::assign('text', $text);
    SmartyWrap::assign('ambiguities', $ambiguities);
}
SmartyWrap::assign('def', $def);
SmartyWrap::assign('recentLinks', RecentLink::loadForUser());
SmartyWrap::assign('sectionTitle', 'Examinare abrevieri');
SmartyWrap::addJs('jquery');
SmartyWrap::displayAdminPage('admin/randomAbbrevReview.ihtml');
/**
 * Sort matches from last to first
 */
function positionCmp($a, $b)
{
    return $b['position'] - $a['position'];
}
コード例 #9
0
ファイル: visualTag.php プロジェクト: Jobava/mirror-dexonline
    $v = Visual::get_by_path($fileName);
    if (!$v) {
        $v = Visual::createFromFile($fileName);
    }
    util_redirect("?id={$v->id}");
}
$v = Visual::get_by_id($id);
if ($saveButton) {
    $v->lexemeId = $lexemId;
    $v->revised = $revised;
    $v->save();
    util_redirect("?id={$v->id}");
}
if ($addTagButton) {
    $vt = Model::factory('VisualTag')->create();
    $vt->imageId = $v->id;
    $vt->lexemeId = $tagLexemId;
    $vt->label = $tagLabel;
    $vt->textXCoord = $textXCoord;
    $vt->textYCoord = $textYCoord;
    $vt->imgXCoord = $imgXCoord;
    $vt->imgYCoord = $imgYCoord;
    $vt->save();
    util_redirect("?id={$v->id}");
}
SmartyWrap::assign('visual', $v);
SmartyWrap::assign('lexem', Lexem::get_by_id($v->lexemeId));
SmartyWrap::assign('sectionTitle', 'Etichetare imagini pentru definiții');
SmartyWrap::addCss('jqueryui-smoothness', 'jcrop', 'select2', 'jqgrid', 'jqueryui', 'gallery');
SmartyWrap::addJs('jquery', 'jqueryui', 'jcrop', 'visualTag', 'select2', 'select2Dev', 'jqgrid', 'gallery');
SmartyWrap::displayAdminPage('admin/visualTag.ihtml');
コード例 #10
0
ファイル: doneaza.php プロジェクト: florinp/dexonline
<?php

require_once "../phplib/util.php";
$user = session_getUser();
$haveEuPlatescCredentials = Config::get('euplatesc.euPlatescMid') && Config::get('euplatesc.euPlatescKey');
SmartyWrap::assign('suggestHiddenSearchForm', true);
SmartyWrap::assign('suggestNoBanner', true);
SmartyWrap::assign('haveEuPlatescCredentials', $haveEuPlatescCredentials);
SmartyWrap::assign('defaultEmail', $user ? $user->email : '');
SmartyWrap::addCss('jqueryui');
SmartyWrap::addJs('jqueryui');
SmartyWrap::display('doneaza.tpl');
コード例 #11
0
ファイル: surse.php プロジェクト: florinp/dexonline
<?php

require_once "../phplib/util.php";
$submitButton = util_getRequestParameter('submitButton');
if ($submitButton) {
    util_assertModerator(PRIV_ADMIN);
    $order = 1;
    $ids = util_getRequestParameter("ids");
    foreach ($ids as $id) {
        $src = Source::get_by_id($id);
        $src->displayOrder = $order++;
        $src->save();
    }
    FlashMessage::add('Ordinea a fost salvată.', 'info');
    util_redirect('surse');
}
if (util_isModerator(PRIV_VIEW_HIDDEN)) {
    $sources = Model::factory('Source')->order_by_asc('displayOrder')->find_many();
} else {
    $sources = Model::factory('Source')->where_not_equal('isOfficial', SOURCE_TYPE_HIDDEN)->order_by_asc('displayOrder')->find_many();
}
SmartyWrap::assign('sources', $sources);
SmartyWrap::addCss('jqueryui');
SmartyWrap::addJs('jqueryui', 'jqTableDnd', 'tablesorter');
SmartyWrap::display('surse.tpl');
コード例 #12
0
ファイル: search.php プロジェクト: florinp/dexonline
    if (count($sourceList)) {
        $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();
コード例 #13
0
ファイル: flexiuni.php プロジェクト: florinp/dexonline
if ($submitButton) {
    // Re-rank the inflections according to the order in $inflectionIds
    $modelTypeMap = array();
    foreach ($inflectionIds as $inflId) {
        $infl = Inflection::get_by_id($inflId);
        $rank = array_key_exists($infl->modelType, $modelTypeMap) ? $modelTypeMap[$infl->modelType] + 1 : 1;
        $modelTypeMap[$infl->modelType] = $rank;
        $infl->rank = $rank;
        $infl->save();
    }
    // Add a new inflection if one is given
    if ($newDescription) {
        $infl = Model::factory('Inflection')->create();
        $infl->description = $newDescription;
        $infl->modelType = $newModelType;
        $infl->rank = $modelTypeMap[$newModelType] + 1;
        $infl->save();
    }
    util_redirect('flexiuni');
}
// Tag inflections which can be safely deleted (only those that aren't being used by any model)
$inflections = Model::factory('Inflection')->order_by_asc('modelType')->order_by_asc('rank')->find_many();
$usedInflectionIds = db_getArray('select distinct inflectionId from ModelDescription');
foreach ($inflections as $infl) {
    $infl->canDelete = !in_array($infl->id, $usedInflectionIds);
}
SmartyWrap::assign('suggestHiddenSearchForm', true);
SmartyWrap::assign('inflections', $inflections);
SmartyWrap::assign('modelTypes', ModelType::loadCanonical());
SmartyWrap::addJs('jqTableDnd');
SmartyWrap::display('flexiuni.tpl');
コード例 #14
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');
}
コード例 #15
0
ファイル: surse.php プロジェクト: Jobava/mirror-dexonline
<?php

require_once "../phplib/util.php";
$submitButton = util_getRequestParameter('submitButton');
if ($submitButton) {
    util_assertModerator(PRIV_ADMIN);
    $order = 1;
    $ids = util_getRequestParameter("ids");
    foreach ($ids as $id) {
        $src = Source::get_by_id($id);
        $src->displayOrder = $order++;
        $src->save();
    }
    FlashMessage::add('Ordinea a fost salvată.', 'info');
    util_redirect('surse');
}
if (util_isModerator(PRIV_VIEW_HIDDEN)) {
    $sources = Model::factory('Source')->order_by_asc('displayOrder')->find_many();
} else {
    $sources = Model::factory('Source')->where_not_equal('isOfficial', SOURCE_TYPE_HIDDEN)->order_by_asc('displayOrder')->find_many();
}
SmartyWrap::assign('sources', $sources);
SmartyWrap::assign('page_title', 'Surse');
SmartyWrap::addCss('jqueryui');
SmartyWrap::addJs('jqueryui', 'jqTableDnd', 'tablesorter');
SmartyWrap::display('surse.ihtml');
コード例 #16
0
ファイル: update4.php プロジェクト: Jobava/mirror-dexonline
$STATIC_FILES = file(Config::get('static.url') . 'fileList.txt');
$URL = Config::get('static.url') . 'download/xmldump';
if (count($_GET) == 0) {
    util_redirect("http://wiki.dexonline.ro/wiki/Protocol_de_exportare_a_datelor");
}
$lastDump = getLastDumpDate($TODAY, $REMOTE_FOLDER);
SmartyWrap::assign('lastDump', $lastDump);
SmartyWrap::assign('url', $URL);
$lastClientUpdate = util_getRequestParameterWithDefault('last', '0');
if ($lastClientUpdate == '0') {
    // Dump the freshest full dump we have
    // TODO: return an error if there is no full dump
    SmartyWrap::assign('serveFullDump', true);
    $lastClientUpdate = $lastDump;
}
SmartyWrap::assign('diffs', getDiffsBetween($lastClientUpdate, $TODAY, $REMOTE_FOLDER));
header('Content-type: text/xml');
print SmartyWrap::fetch('update4.ihtml');
/**************************************************************************/
// Do not return a dump for today, in case it is still being built
function getLastDumpDate($today, $folder)
{
    global $STATIC_FILES;
    // Group existing files by date, excluding the diff files
    $map = array();
    foreach ($STATIC_FILES as $file) {
        $matches = array();
        if (preg_match(":^{$folder}/(\\d\\d\\d\\d-\\d\\d-\\d\\d)-[a-z]+.xml.gz:", $file, $matches)) {
            $date = $matches[1];
            if ($date < $today) {
                if (array_key_exists($date, $map)) {
コード例 #17
0
ファイル: wotm.php プロジェクト: florinp/dexonline
$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());
SmartyWrap::assign('timestamp', $timestamp);
SmartyWrap::assign('searchResult', array_pop($searchResults));
SmartyWrap::display('wotm.tpl');
コード例 #18
0
ファイル: wotdExport.php プロジェクト: florinp/dexonline
<?php

require_once "../../phplib/util.php";
util_assertModerator(PRIV_WOTD);
$month = util_getRequestParameter('month');
$year = util_getRequestParameter('year');
$month = sprintf("%02d", $month);
$wotds = Model::factory('WordOfTheDay')->where_like('displayDate', "{$year}-{$month}-%")->order_by_asc('displayDate')->find_many();
$wotdSet = array();
foreach ($wotds as $wotd) {
    $wotdr = WordOfTheDayRel::get_by_wotdId($wotd->id);
    $def = Definition::get_by_id($wotdr->refId);
    $wotdSet[] = array('wotd' => $wotd, 'def' => $def);
}
SmartyWrap::assign('month', $month);
SmartyWrap::assign('year', $year);
SmartyWrap::assign('recentLinks', RecentLink::loadForUser());
SmartyWrap::assign('wotdSet', $wotdSet);
SmartyWrap::displayAdminPage('admin/wotdExport.tpl');
コード例 #19
0
ファイル: properNouns.php プロジェクト: florinp/dexonline
        }
    }
    // Delete lexems
    foreach ($deleteMap as $lId => $value) {
        if ($value == 2) {
            // Checked and confirmed
            $l = Lexem::get_by_id($lId);
            $l->delete();
        }
    }
    // Now save the ones that can be saved and present errors for the others
    foreach ($lexemMap as $id => $l) {
        if (!array_key_exists($id, $errorMap) && !array_key_exists($id, $deleteMap)) {
            $l->save();
            $lm = $l->getFirstLexemModel();
            $lm->save();
            $lm->regenerateParadigm();
        }
    }
}
$deSource = Source::get_by_shortName('DE');
$lexems = Model::factory('Lexem')->table_alias('l')->select('l.*')->distinct()->join('LexemModel', 'l.id = lm.lexemId', 'lm')->join('LexemDefinitionMap', 'l.id = ldm.lexemId', 'ldm')->join('Definition', 'ldm.definitionId = d.id', 'd')->where('d.status', Definition::ST_ACTIVE)->where('d.sourceId', $deSource->id)->where('lm.isLoc', 0)->where_like('l.formNoAccent', "{$prefix}%")->where('l.verifSp', 0)->where_not_equal('lm.modelType', 'SP')->order_by_asc('l.formNoAccent')->limit(100)->find_many();
foreach ($lexems as $l) {
    $l->restrP = strpos($l->restriction, 'P') !== false;
    $l->restrS = strpos($l->restriction, 'S') !== false;
}
RecentLink::createOrUpdate('Marcare substantive proprii');
SmartyWrap::assign('recentLinks', RecentLink::loadForUser());
SmartyWrap::assign('lexems', $lexems);
SmartyWrap::assign('prefix', $prefix);
SmartyWrap::displayAdminPage('admin/properNouns.tpl');
コード例 #20
0
ファイル: index.php プロジェクト: Jobava/mirror-dexonline
<?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');
コード例 #21
0
ファイル: index.php プロジェクト: Jobava/mirror-dexonline
});
$wordCount = Definition::getWordCount();
$wordCountRough = $wordCount - $wordCount % 10000;
SmartyWrap::assign('page_title', 'Dicționar explicativ al limbii române');
SmartyWrap::assign('onHomePage', '1');
SmartyWrap::assign('letters', preg_split('//u', 'aăâbcdefghiîjklmnopqrsștțuvwxyz'));
SmartyWrap::assign('words_total', util_formatNumber($wordCount, 0));
SmartyWrap::assign('words_rough', util_formatNumber($wordCountRough, 0));
SmartyWrap::assign('words_last_month', util_formatNumber(Definition::getWordCountLastMonth(), 0));
SmartyWrap::assign('widgets', $widgets);
SmartyWrap::assign('numEnabledWidgets', $numEnabledWidgets);
/* WotD part */
$wotd = WordOfTheDay::getTodaysWord();
if (!$wotd) {
    WordOfTheDay::updateTodaysWord();
    $wotd = WordOfTheDay::getTodaysWord();
}
$defId = WordOfTheDayRel::getRefId($wotd->id);
$def = Model::factory('Definition')->where('id', $defId)->where('status', ST_ACTIVE)->find_one();
SmartyWrap::assign('thumbUrl', $wotd->getThumbUrl());
SmartyWrap::assign('title', $def->lexicon);
SmartyWrap::assign('today', date('Y/m/d'));
/* WotM part */
$wotm = WordOfTheMonth::getCurrentWotM();
$def = Model::factory('Definition')->where('id', $wotm->definitionId)->where('status', ST_ACTIVE)->find_one();
SmartyWrap::assign('thumbUrlM', $wotm->getThumbUrl());
SmartyWrap::assign('articol', $wotm->article);
SmartyWrap::assign('titleM', $def->lexicon);
SmartyWrap::assign('todayM', date('Y/m'));
$page = Config::get('global.aprilFoolsDay') ? 'index-afd.ihtml' : 'index.ihtml';
SmartyWrap::displayPageWithSkin($page);
コード例 #22
0
$deleteId = util_getRequestParameter('deleteId');
$submitButton = util_getRequestParameter('submitButton');
if ($deleteId) {
    $mt = MeaningTag::get_by_id($deleteId);
    $mtms = MeaningTagMap::get_all_by_meaningTagId($mt->id);
    if (count($mtms)) {
        FlashMessage::add("Nu pot șterge eticheta «{$mt->value}», deoarece unele sensuri o folosesc.", 'error');
    } else {
        $mt->delete();
        FlashMessage::add("Am șters eticheta «{$mt->value}».", 'info');
    }
    util_redirect('etichete-sensuri');
}
if ($submitButton) {
    util_assertModerator(PRIV_ADMIN);
    $values = explode(',', $value);
    foreach ($values as $value) {
        $value = trim($value);
        if ($value && !MeaningTag::get_by_value($value)) {
            $mt = Model::factory('MeaningTag')->create();
            $mt->value = $value;
            $mt->save();
        }
    }
    FlashMessage::add('Etichetele au fost salvate.', 'info');
    util_redirect('etichete-sensuri');
}
$meaningTags = Model::factory('MeaningTag')->order_by_asc('value')->find_many();
SmartyWrap::assign('meaningTags', $meaningTags);
SmartyWrap::assign('page_title', 'Etichete pentru sensuri');
SmartyWrap::display('etichete-sensuri.ihtml');
コード例 #23
0
ファイル: diacritice.php プロジェクト: florinp/dexonline
        if (isset($_POST['hiddenText'])) {
            if ($_POST['hiddenText'] == '') {
                return '';
            } else {
                $search = array();
                $replace = array();
                $buffer = $_POST['hiddenText'];
                foreach ($_POST as $key => $value) {
                    if (is_numeric($key)) {
                        $search[] = '/@@' . $key . '@@/i';
                        $replace[] = $value;
                    }
                }
                return preg_replace($search, $replace, $buffer);
            }
        } else {
            return '';
        }
    }
}
if (strstr($_SERVER['SCRIPT_NAME'], 'diacritice.php')) {
    $obj = new DiacriticsFixer();
    if (isset($_POST['text']) && $_POST['text'] != '') {
        SmartyWrap::assign('textarea', '<div id="textInput">' . $obj->fix($_POST['text']) . '</div>');
        SmartyWrap::assign('hiddenText', '<input type="hidden" name="hiddenText" value="' . $obj->getHiddenText() . '">');
    } else {
        SmartyWrap::assign('textarea', '<textarea name="text" id="textInput" placeholder="introduceți textul aici">' . $obj->replaceDiacritics() . '</textarea>');
        SmartyWrap::assign('hiddenText', '<input type="hidden" name="hiddenText" value="">');
    }
    SmartyWrap::display('diacritics_fix/diacritics_fix.tpl');
}
コード例 #24
0
util_assertNotLoggedIn();
$token = util_getRequestParameter('token');
$identity = util_getRequestParameter('identity');
$pt = PasswordToken::get_by_token($token);
$data = FileCache::get($identity);
if (!$pt) {
    FlashMessage::add('Ați introdus un cod de recuperare incorect.');
} else {
    if ($pt->createDate < time() - 24 * 3600) {
        FlashMessage::add('Codul de recuperare introdus a expirat.');
    } else {
        if (!$data) {
            FlashMessage::add('Ați introdus o identitate incorectă.');
        } else {
            $user = User::get_by_id($pt->userId);
            if (!$user) {
                FlashMessage::add('Ați introdus un cod de recuperare incorect.');
            } else {
                if ($user->identity) {
                    FlashMessage::add('Acest cont a fost deja revendicat de o identitate OpenID.');
                } else {
                    FlashMessage::add('Contul dumneavoastră a fost recuperat și unificat cu identitatea OpenID.', 'info');
                    session_login($user, $data);
                }
            }
        }
    }
}
SmartyWrap::assign('page_title', 'Recuperarea parolei');
SmartyWrap::assign('suggestHiddenSearchForm', true);
SmartyWrap::display('auth/passwordRecoveryWrongData.ihtml');
コード例 #25
0
ファイル: user.php プロジェクト: florinp/dexonline
$userData = array();
$user->email = StringUtil::scrambleEmail($user->email);
// Find the rank of this user by number of words and number of characters
$topWords = TopEntry::getTopData(CRIT_WORDS, SORT_DESC, true);
$numUsers = count($topWords);
$rankWords = 0;
while ($rankWords < $numUsers && $topWords[$rankWords]->userNick != $nick) {
    $rankWords++;
}
$userData['rank_words'] = $rankWords + 1;
if ($rankWords < $numUsers) {
    $topEntry = $topWords[$rankWords];
    $userData['last_submission'] = $topEntry->timestamp;
    $userData['num_words'] = $topEntry->numDefinitions;
    $userData['num_chars'] = $topEntry->numChars;
}
$topChars = TopEntry::getTopData(CRIT_CHARS, SORT_DESC, true);
$numUsers = count($topChars);
$rankChars = 0;
while ($rankChars < $numUsers && $topChars[$rankChars]->userNick != $nick) {
    $rankChars++;
}
$userData['rank_chars'] = $rankChars + 1;
SmartyWrap::assign('medals', Medal::loadForUser($user));
if (util_isModerator(PRIV_ADMIN)) {
    // Admins can grant/revoke medals
    SmartyWrap::assign('allMedals', Medal::$DATA);
}
SmartyWrap::assign('user', $user);
SmartyWrap::assign('userData', $userData);
SmartyWrap::display('user.tpl');
コード例 #26
0
ファイル: update3.php プロジェクト: florinp/dexonline
                    prepareDefForVersion($def);
                    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)
{
コード例 #27
0
ファイル: scrabble.php プロジェクト: Jobava/mirror-dexonline
<?php

require_once "../phplib/util.php";
$form = util_getRequestParameter('form');
$locVersion = util_getRequestParameter('locVersion');
$locVersions = Config::getLocVersions();
if (!util_isModerator(PRIV_LOC)) {
    $locVersions = array_slice($locVersions, 1);
    // remove the version in progress
}
if ($locVersion && $form) {
    LocVersion::changeDatabase($locVersion);
    $form = StringUtil::cleanupQuery($form);
    $field = StringUtil::hasDiacritics($form) ? 'formNoAccent' : 'formUtf8General';
    $data = Model::factory('InflectedForm')->table_alias('I')->select('I.form', 'inflectedForm')->select('L.formNoAccent', 'lexemFormNoAccent')->select('L.form', 'lexemForm')->select('LM.modelType', 'modelType')->select('LM.modelNumber', 'modelNumber')->select('LM.restriction', 'restriction')->select('Infl.description', 'inflection')->join('LexemModel', 'I.lexemModelId = LM.id', 'LM')->join('Lexem', 'LM.lexemId = L.id', 'L')->join('ModelType', 'LM.modelType = MT.code', 'MT')->join('Model', 'MT.canonical = M.modelType and LM.modelNumber = M.number', 'M')->join('ModelDescription', 'M.id = MD.modelId and I.variant = MD.variant and I.inflectionId = MD.inflectionId', 'MD')->join('Inflection', 'I.inflectionId = Infl.id', 'Infl')->where('MD.applOrder', 0)->where("I.{$field}", $form)->where('LM.isLoc', 1)->where('MD.isLoc', 1)->order_by_asc('LM.lexemId')->find_array();
    SmartyWrap::assign('page_title', 'Verificare LOC: ' . $form);
    SmartyWrap::assign('form', $form);
    SmartyWrap::assign('selectedLocVersion', $locVersion);
    SmartyWrap::assign('data', $data);
} else {
    SmartyWrap::assign('selectedLocVersion', $locVersions[0]->name);
    SmartyWrap::assign('page_title', 'Căutare formă flexionară în LOC ' . $form);
}
SmartyWrap::addJs('modelDropdown');
SmartyWrap::assign('suggestHiddenSearchForm', true);
SmartyWrap::assign('page_title', 'Scrabble');
SmartyWrap::assign('locVersions', $locVersions);
SmartyWrap::display('scrabble.ihtml');
コード例 #28
0
<?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');
コード例 #29
0
ファイル: visualTag.php プロジェクト: florinp/dexonline
if ($fileName) {
    $v = Visual::get_by_path($fileName);
    if (!$v) {
        $v = Visual::createFromFile($fileName);
    }
    util_redirect("?id={$v->id}");
}
$v = Visual::get_by_id($id);
if ($saveButton) {
    $v->lexemeId = $lexemId;
    $v->revised = $revised;
    $v->save();
    util_redirect("?id={$v->id}");
}
if ($addTagButton) {
    $vt = Model::factory('VisualTag')->create();
    $vt->imageId = $v->id;
    $vt->lexemeId = $tagLexemId;
    $vt->label = $tagLabel;
    $vt->textXCoord = $textXCoord;
    $vt->textYCoord = $textYCoord;
    $vt->imgXCoord = $imgXCoord;
    $vt->imgYCoord = $imgYCoord;
    $vt->save();
    util_redirect("?id={$v->id}");
}
SmartyWrap::assign('visual', $v);
SmartyWrap::assign('lexem', Lexem::get_by_id($v->lexemeId));
SmartyWrap::addCss('jqueryui-smoothness', 'jcrop', 'select2', 'jqgrid', 'jqueryui', 'gallery');
SmartyWrap::addJs('jquery', 'jqueryui', 'jcrop', 'visualTag', 'select2', 'select2Dev', 'jqgrid', 'gallery');
SmartyWrap::displayAdminPage('admin/visualTag.tpl');
コード例 #30
0
ファイル: articole.php プロジェクト: Jobava/mirror-dexonline
<?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');