<?php require_once "../../phplib/util.php"; util_assertModerator(PRIV_EDIT); util_assertNotMirror(); RecentLink::createOrUpdate('Lexeme cu comentarii'); smarty_assign('sectionTitle', 'Lexeme cu comentarii'); smarty_assign('recentLinks', RecentLink::loadForUser()); smarty_assign('lexems', Model::factory('Lexem')->where_not_equal('comment', '')->order_by_asc('formNoAccent')->find_many()); smarty_displayWithoutSkin('flex/viewLexemsWithComments.ihtml');
WordOfTheDay::updateTodaysWord(); $wotd = WordOfTheDay::get_by_displayDate($mysqlDate); } $archive = WordOfTheDay::getArchiveWotD(date('Y', $timestamp), date('m', $timestamp)); $defId = WordOfTheDayRel::getRefId($wotd->id); $def = Definition::get_by_id($defId); $searchResults = SearchResult::mapDefinitionArray(array($def)); setlocale(LC_ALL, 'ro_RO'); $roDate = strftime("%e %B %Y", $timestamp); $pageTitle = sprintf("Cuvântul zilei: %s (%s)", $def->lexicon, $roDate); if ($mysqlDate > WOTD_BIG_BANG) { smarty_assign('prevday', date('Y/m/d', $timestamp - 86400)); } if ($mysqlDate < $today) { smarty_assign('nextday', date('Y/m/d', $timestamp + 86400)); } smarty_assign('imageUrl', $wotd->getImageUrl()); smarty_assign('timestamp', $timestamp); smarty_assign('archive', $archive); smarty_assign('mysqlDate', $mysqlDate); smarty_assign('page_title', $pageTitle); smarty_assign('page_keywords', "Cuvântul zilei, {$def->lexicon}, dexonline, DEX online, {$pageTitle}"); smarty_assign('page_description', "{$pageTitle} de la dexonline"); smarty_assign('searchResult', array_pop($searchResults)); if ($type == 'url') { smarty_assign('today', $today); smarty_assign('title', $def->lexicon); smarty_displayWithoutSkin('common/bits/wotdurl.ihtml'); } else { smarty_displayCommonPageWithSkin('wotd.ihtml'); }
<?php require_once "../../phplib/util.php"; util_assertModerator(PRIV_WOTD); util_assertNotMirror(); RecentLink::createOrUpdate('Word of the Day - Imagini'); smarty_assign('sectionTitle', 'Imagini pentru cuvântul zilei'); smarty_displayWithoutSkin('admin/wotdImages.ihtml');
} $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:'', join(",",$ids)); $forms = db_getArrayOfRows($query); */ $query = sprintf(RANDOM_WORDS_QUERY, $showSource?SOURCE_PART_RANDOM_WORDS:'', $listLength); $forms = db_getArrayOfRows($query); $cnt = count($forms); if ($noSkin) { smarty_assign('forms', $forms); smarty_displayWithoutSkin('common/randomWordListSimple.ihtml'); } else { smarty_assign('forms', $forms); smarty_assign('page_title', "O listă de {$cnt} de cuvinte alese la întâmplare."); smarty_displayCommonPageWithSkin('randomWordList.ihtml'); } ?>
<?php require_once "../../phplib/util.php"; ini_set('max_execution_time', '3600'); util_assertModerator(PRIV_LOC); util_assertNotMirror(); DebugInfo::disable(); $modelType = util_getRequestParameter('modelType'); $modelNumber = util_getRequestParameter('modelNumber'); $deleteButton = util_getRequestParameter('deleteButton'); $model = Model::factory('FlexModel')->where('modelType', $modelType)->where('number', $modelNumber)->find_one(); $lexems = Lexem::loadByCanonicalModel($modelType, $modelNumber); if ($deleteButton) { foreach ($lexems as $lexem) { $lexem->modelType = 'T'; $lexem->modelNumber = '1'; $lexem->restriction = ''; $lexem->save(); $lexem->regenerateParadigm(); } $model->delete(); util_redirect('../admin/index.php'); exit; } RecentLink::createOrUpdate("Ștergere model: {$model}"); smarty_assign('modelType', $modelType); smarty_assign('modelNumber', $modelNumber); smarty_assign('lexems', $lexems); smarty_assign('recentLinks', RecentLink::loadForUser()); smarty_displayWithoutSkin('flex/deleteModel.ihtml');
} } // 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(); $l->regenerateParadigm(); } } } $deSource = Source::get_by_shortName('DE'); $lexems = Model::factory('Lexem')->distinct()->select('Lexem.*')->join('LexemDefinitionMap', 'Lexem.id = lexemId')->join('Definition', 'definitionId = Definition.id')->where('status', 0)->where('sourceId', $deSource->id)->where('isLoc', 0)->where_like('formNoAccent', "{$prefix}%")->where('verifSp', 0)->where_not_equal('modelType', 'SP')->order_by_asc('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'); smarty_assign('sectionTitle', 'Marcare substantive proprii'); smarty_assign('recentLinks', RecentLink::loadForUser()); smarty_assign('lexems', $lexems); smarty_assign('prefix', $prefix); smarty_displayWithoutSkin('admin/properNouns.ihtml');
<?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: text/xml"); smarty_assign('rss_title', 'Articole lingvistice - DEX online'); smarty_assign('rss_link', 'http://' . $_SERVER['HTTP_HOST'] . '/rss/articole/'); smarty_assign('rss_description', 'Articole pe teme lingvistice de la DEX online'); smarty_assign('rss_pubDate', date('D, d M Y H:i:s') . ' EEST'); smarty_assign('results', $results); smarty_displayWithoutSkin('common/rss.ixml'); exit; } smarty_assign('page_title', 'Articole lingvistice'); smarty_assign('wikiTitles', WikiArticle::loadAllTitles()); smarty_displayCommonPageWithSkin('articole.ihtml');
smarty_assign('inflectionMap', Inflection::mapById($inflections)); smarty_assign('modelType', $modelType); smarty_assign('modelNumber', $modelNumber); smarty_assign('newModelNumber', $newModelNumber); smarty_assign('exponent', $exponent); smarty_assign('newExponent', $newExponent); smarty_assign('description', $model->description); smarty_assign('newDescription', $newDescription); smarty_assign('participleNumber', $participleNumber); smarty_assign('newParticipleNumber', $newParticipleNumber); smarty_assign('newForms', $newForms); smarty_assign('inputValues', $inputValues); smarty_assign('recentLinks', RecentLink::loadForUser()); smarty_assign('wasPreviewed', $previewButton); smarty_assign('errorMessage', $errorMessage); smarty_displayWithoutSkin('flex/editModel.ihtml'); /****************************************************************************/ /** * $a, $b: arrays of ($form, $isLoc, $recommended) tuples. Only compares the forms. */ function equalArrays($a, $b) { if (count($a) != count($b)) { return false; } foreach ($a as $key => $tuple) { if ($a[$key]['form'] != $b[$key]['form']) { return false; } } return true;
$lexem->regenerateParadigm(); } } } } util_redirect("placeAccents.php"); } $chars = array(); $searchResults = array(); $lexems = Model::factory('Lexem')->raw_query("select * from Lexem where form not rlike '\\'' and not noAccent order by rand() limit 10", null)->find_many(); foreach ($lexems as $l) { $charArray = array(); $form = mb_strtoupper($l->form); $len = mb_strlen($form); for ($i = 0; $i < $len; $i++) { $c = StringUtil::getCharAt($form, $i); $charArray[] = ctype_space($c) ? ' ' : $c; } $chars[$l->id] = $charArray; $definitions = Definition::loadByLexemId($l->id); $searchResults[$l->id] = SearchResult::mapDefinitionArray($definitions); } RecentLink::createOrUpdate('Plasare accente'); smarty_assign('sectionTitle', 'Plasare accente'); smarty_assign('lexems', $lexems); smarty_assign('chars', $chars); smarty_assign('searchResults', $searchResults); smarty_assign("allStatuses", util_getAllStatuses()); smarty_assign('recentLinks', RecentLink::loadForUser()); smarty_displayWithoutSkin('flex/placeAccents.ihtml');
$ifMapArray = array(); foreach ($models as $m) { $l->modelType = $m->modelType; $l->modelNumber = $m->number; $if = $l->generateParadigm(); if (is_array($if)) { $ifMapArray[] = InflectedForm::mapByInflectionRank($if); } else { $ifMapArray[] = null; } } $l->modelType = $origModelType; $l->modelNumber = $origModelNumber; $ifMapMatrix[] = $ifMapArray; } // Load the definitions for each lexem $searchResults = array(); foreach ($lexems as $l) { $definitions = Definition::loadByLexemId($l->id); $searchResults[] = SearchResult::mapDefinitionArray($definitions); } smarty_assign('suffix', $suffix); smarty_assign('lexems', $lexems); smarty_assign('models', $models); smarty_assign('searchResults', $searchResults); smarty_assign('ifMapMatrix', $ifMapMatrix); smarty_assign('allStatuses', util_getAllStatuses()); smarty_assign('sectionTitle', "Sufix: {$suffix}"); smarty_assign('recentLinks', RecentLink::loadForUser()); smarty_displayWithoutSkin('flex/bulkLabel.ihtml');
<?php require_once "../../phplib/util.php"; util_assertModerator(PRIV_EDIT); util_assertNotMirror(); $models = FlexModel::loadByType('A'); smarty_assign('recentLinks', RecentLink::loadForUser()); smarty_assign('canEditWotd', util_isModerator(PRIV_WOTD)); smarty_assign("allStatuses", util_getAllStatuses()); smarty_assign("allModeratorSources", Model::factory('Source')->where('canModerate', true)->order_by_asc('displayOrder')->find_many()); smarty_assign('modelTypes', ModelType::loadCanonical()); smarty_assign('models', $models); smarty_displayWithoutSkin('admin/index.ihtml');
<?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(); } smarty_displayWithoutSkin('common/bits/typoConfirmation.ihtml'); } else { smarty_assign('definitionId', $definitionId); smarty_displayWithoutSkin('common/bits/typoForm.ihtml'); }
<?php require_once "../../phplib/util.php"; // Select suffixes and counts for temporary lexems. $dbResult = db_execute("select reverse(substring(reverse, 1, 4)) as s, count(*) as c from Lexem where modelType = 'T' " . "group by s having c >= 5 order by c desc, s", PDO::FETCH_ASSOC); $stats = array(); foreach ($dbResult as $row) { $stats[] = array($row['s'], $row['c']); } smarty_assign('stats', $stats); smarty_assign('sectionTitle', 'Alegere sufix'); smarty_assign('recentLinks', RecentLink::loadForUser()); smarty_displayWithoutSkin('flex/bulkLabelSelectSuffix.ihtml');
smarty_assign('lexemIds', $lexemIds); smarty_assign('user', userCache_get($def->userId)); smarty_displayWithoutSkin('common/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); smarty_assign('ifs', InflectedForm::loadByLexemId($lexem->id)); smarty_assign('lexem', $lexem); smarty_displayWithoutSkin('common/update3Lexems.ihtml'); } print "</Lexems>\n"; } } } } } /****************************************************************************/ function userCache_init() { $GLOBALS['USER'] = array(); } function userCache_get($key) { if (array_key_exists($key, $GLOBALS['USER'])) {
$pm = ParticipleModel::loadByVerbModel($modelNumber); $clonePm = Model::factory('ParticipleModel')->create(); $clonePm->verbModel = $newModelNumber; $clonePm->adjectiveModel = $pm->adjectiveModel; $clonePm->save(); } // Migrate the selected lexems. if ($chooseLexems && $lexemIds) { foreach ($lexemIds as $lexemId) { $l = Lexem::get_by_id($lexemId); $l->modelNumber = $newModelNumber; $l->save(); // It is not necessary to regenerate the paradigm for now, since // the inflected forms are identical. } } util_redirect('../admin/index.php'); exit; } } else { $newModelNumber = $modelNumber . ".1"; } $lexems = Lexem::loadByCanonicalModel($modelType, $modelNumber); smarty_assign('modelType', $modelType); smarty_assign('modelNumber', $modelNumber); smarty_assign('newModelNumber', $newModelNumber); smarty_assign('lexems', $lexems); smarty_assign('errorMessage', $errorMessages); smarty_assign('recentLinks', RecentLink::loadForUser()); smarty_displayWithoutSkin('flex/cloneModel.ihtml');
smarty_assign('page_title', "{$declensionText}: {$cuv}"); smarty_assign('declensionText', "{$declensionText}: {$cuv}"); } $sourceNamesArr = array(); foreach ($lexems as $l) { $sourceNamesArr[] = LexemSources::getNamesOfSources($l->source); } // This paragraph replicates code from paradigm.php $hasUnrecommendedForms = false; foreach ($ifMaps as $ifMap) { foreach ($ifMap as $rank => $ifs) { foreach ($ifs as $if) { $hasUnrecommendedForms |= !$if->recommended; } } } smarty_assign('hasUnrecommendedForms', $hasUnrecommendedForms); smarty_assign('sourceNamesArr', $sourceNamesArr); smarty_assign('lexems', $filtered_lexems); smarty_assign('ifMaps', $ifMaps); smarty_assign('showParadigm', true); smarty_assign('onlyParadigm', !$ajax); } else { FlashMessage::add("Niciun rezultat pentru {$cuv}."); smarty_assign('page_title', "Eroare"); } if ($ajax) { smarty_displayWithoutSkin('common/bits/multiParadigm.ihtml'); } else { smarty_displayCommonPageWithSkin('search.ihtml'); }
$new_words[] = WotDArchive::setOnlyDate($day); } } return $new_words; } $monthsName = array(1 => 'Ianuarie', 2 => 'Februarie', 3 => 'Martie', 4 => 'Aprilie', 5 => 'Mai', 6 => 'Iunie', 7 => 'Iulie', 8 => 'August', 9 => 'Septembrie', 10 => 'Octombrie', 11 => 'Noiembrie', 12 => 'Decembrie'); smarty_assign('month', $monthsName[$month]); smarty_assign('year', $year); $showPrev = $year > 2011 || $year == 2011 && $month > 5 ? 1 : 0; $showNext = time() < mktime(0, 0, 0, $month + 1, 1, $year) ? 0 : 1; smarty_assign('showPrev', $showPrev); smarty_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}"; } smarty_assign('prevMonth', $prevMonth); smarty_assign('nextMonth', $nextMonth); $words = createCalendar($year, $month); smarty_assign('words', $words); smarty_displayWithoutSkin('common/wotdArchive.ihtml');
if (!is_null($conjugations) || !is_null($declensions)) { $page_keywords .= ", paradigmă {$cuv}"; $page_description .= ', paradigme'; } $page_keywords .= ", dexonline, DEX online"; $page_description .= " pentru {$cuv}"; $page_title = ''; if (count($sourceList)) { $page_description .= " din dicționarele: " . implode(", ", $sourceList); if (count($sourceList) == 1) { $page_title = ' ' . $sourceList[0]; } } $page_title .= $showParadigm ? ' si paradigme' : ''; smarty_assign('page_title', "{$cuv} - definitie{$page_title}"); smarty_assign('page_keywords', $page_keywords); smarty_assign('page_description', $page_description); } // Ads AdsModule::runAllModules(empty($lexems) ? null : $lexems, empty($definitions) ? null : $definitions); smarty_assign('text', $text); smarty_assign('searchType', $searchType); smarty_assign('showParadigm', $showParadigm); smarty_assign('paradigmLink', $paradigmLink); smarty_assign('advancedSearch', $text || $sourceId); if (!$xml) { smarty_displayCommonPageWithSkin('search.ihtml'); } else { header('Content-type: text/xml'); smarty_displayWithoutSkin('common/searchXML.ihtml'); }
} } // Forms that will disappear after the merge -- these should be rare. foreach ($srcIfs as $srcIf) { if (!in_array($srcIf, $destIfs)) { $lostForms[] = $srcIf; } } $lexem->addedForms = $addedForms; $lexem->lostForms = $lostForms; } $lexems[] = $lexem; } } RecentLink::createOrUpdate('Unificare lexeme'); smarty_assign('sectionTitle', 'Unificare lexeme'); smarty_assign('recentLinks', RecentLink::loadForUser()); smarty_assign('modelType', $modelType); smarty_assign('lexems', $lexems); smarty_displayWithoutSkin('flex/mergeLexems.ihtml'); /***************************************************/ /** Returns an array containing only the accented forms, not the entire InflectedForm objects **/ function loadIfArrayByLexemId($lexemId) { $ifs = InflectedForm::loadByLexemId($lexemId); $result = array(); foreach ($ifs as $if) { $result[] = $if->form; } return $result; }
<?php require_once "../../phplib/util.php"; util_assertModerator(PRIV_EDIT); util_assertNotMirror(); RecentLink::createOrUpdate('Lexeme neasociate'); $lexems = Lexem::loadUnassociated(); smarty_assign('lexems', $lexems); smarty_assign('sectionTitle', 'Lexeme neasociate'); smarty_assign('recentLinks', RecentLink::loadForUser()); smarty_displayWithoutSkin('admin/lexemList.ihtml');
function util_assertNotMirror() { if (pref_isMirror()) { smarty_displayWithoutSkin('common/mirror_message.ihtml'); exit; } }
<?php require_once "../../phplib/util.php"; util_assertModerator(PRIV_EDIT); util_assertNotMirror(); RecentLink::createOrUpdate('Greșeli de tipar'); $sourceClause = ''; $sourceId = 0; $sourceUrlName = util_getRequestParameter('source'); if ($sourceUrlName) { $source = $sourceUrlName ? Source::get_by_urlName($sourceUrlName) : null; $sourceId = $source ? $source->id : 0; $sourceClause = $source ? "sourceId = {$sourceId} and " : ''; smarty_assign('src_selected', $sourceId); } $defs = Model::factory('Definition')->raw_query("select * from Definition where {$sourceClause} id in (select definitionId from Typo) order by lexicon", null)->find_many(); smarty_assign('searchResults', SearchResult::mapDefinitionArray($defs)); smarty_assign('sectionTitle', 'Definiții cu greșeli de tipar'); smarty_assign('allStatuses', util_getAllStatuses()); smarty_assign('recentLinks', RecentLink::loadForUser()); smarty_displayWithoutSkin('admin/definitionList.ihtml');
$s = $def->internalRep; foreach ($matches as $m) { $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); smarty_assign('text', $text); smarty_assign('ambiguities', $ambiguities); } smarty_assign('def', $def); smarty_assign('recentLinks', RecentLink::loadForUser()); smarty_displayWithoutSkin('admin/randomAbbrevReview.ihtml'); /** * Sort matches from last to first */ function positionCmp($a, $b) { return $b['position'] - $a['position']; }
} $defs = Model::factory('Definition')->where_raw("status = 0 {$sourceClause} and binary internalRep like '%{$search}%'")->order_by_asc('id')->limit($MAX_AFFECTED)->find_many(); $searchResults = SearchResult::mapDefinitionArray($defs); foreach ($defs as $def) { $def->internalRep = str_replace($search, $replace, $def->internalRep); $ambiguousMatches = array(); $def->internalRep = AdminStringUtil::internalizeDefinition($def->internalRep, $def->sourceId, $ambiguousMatches); $def->htmlRep = AdminStringUtil::htmlize($def->internalRep, $def->sourceId); // Complete or un-complete the abbreviation review if (!count($ambiguousMatches) && $def->abbrevReview == ABBREV_AMBIGUOUS) { $def->abbrevReview = ABBREV_REVIEW_COMPLETE; } else { if (count($ambiguousMatches) && $def->abbrevReview == ABBREV_REVIEW_COMPLETE) { $def->abbrevReview = ABBREV_AMBIGUOUS; } } if ($realRun) { $def->save(); } } if ($realRun) { util_redirect("index.php"); } smarty_assign('search', $search); smarty_assign('replace', $replace); smarty_assign('sourceId', $sourceId); smarty_assign('searchResults', $searchResults); smarty_assign('allStatuses', util_getAllStatuses()); smarty_assign('recentLinks', RecentLink::loadForUser()); smarty_displayWithoutSkin('admin/bulkReplace.ihtml');
<?php require_once "../../phplib/util.php"; util_assertNotMirror(); util_assertNotLoggedIn(); $openid = util_getRequestParameter('openid'); switch ($openid) { case 'google': $openid = "https://www.google.com/accounts/o8/id"; break; case 'yahoo': $openid = "http://yahoo.com/"; break; } if ($openid) { OpenID::beginAuth($openid, null); smarty_displayWithoutSkin('common/auth/beginAuth.ihtml'); exit; } smarty_assign('openid', $openid); smarty_assign('page_title', 'Autentificare cu OpenID'); smarty_assign('suggestHiddenSearchForm', true); smarty_displayCommonPageWithSkin('auth/login.ihtml');