<?php require_once "../../phplib/util.php"; util_assertModerator(PRIV_EDIT); util_assertNotMirror(); $reports = array(array('text' => 'Definiții nemoderate', 'url' => 'admin/viewPendingDefinitions', 'count' => Model::factory('Definition')->where('status', ST_PENDING)->count(), 'privilege' => PRIV_EDIT), array('text' => 'Definiții cu greșeli de tipar', 'url' => 'admin/viewTypos', 'count' => Model::factory('Typo')->select('definitionId')->distinct()->count(), 'privilege' => PRIV_EDIT), array('text' => 'Definiții cu abrevieri ambigue', 'url' => 'admin/randomAbbrevReview', 'count' => Definition::countAmbiguousAbbrevs(), 'privilege' => PRIV_EDIT), array('text' => 'Definiții OCR neverificate', 'url' => 'admin/definitionEdit', 'count' => sprintf("%d (disponibile: %d)", Model::factory('OCR')->where('status', 'raw')->count(), OCR::countAvailable(session_getUserId())), 'privilege' => PRIV_EDIT), array('text' => 'Definiții neasociate cu niciun lexem', 'url' => 'admin/viewUnassociatedDefinitions', 'count' => Definition::countUnassociated(), 'privilege' => PRIV_EDIT), array('text' => 'Lexeme neasociate cu nicio definiție', 'url' => 'admin/viewUnassociatedLexems', 'count' => Lexem::countUnassociated(), 'privilege' => PRIV_EDIT), array('text' => 'Lexeme cu comentarii', 'url' => 'admin/viewLexemsWithComments', 'count' => Model::factory('Lexem')->where_not_null('comment')->count(), 'privilege' => PRIV_EDIT), array('text' => 'Lexeme fără accent', 'url' => 'admin/viewLexemsWithoutAccents', 'count' => Model::factory('Lexem')->where('consistentAccent', 0)->count(), 'privilege' => PRIV_EDIT), array('text' => 'Lexeme ambigue', 'url' => 'admin/viewAmbiguousLexems', 'count' => 'numărătoare dezactivată', 'privilege' => PRIV_EDIT), array('text' => 'Lexeme fără paradigme', 'url' => 'admin/viewTemporaryLexems', 'count' => Model::factory('LexemModel')->where('modelType', 'T')->count(), 'privilege' => PRIV_EDIT)); SmartyWrap::assign('recentLinks', RecentLink::loadForUser()); SmartyWrap::assign("allStatuses", util_getAllStatuses()); SmartyWrap::assign('structStatusNames', Lexem::$STRUCT_STATUS_NAMES); SmartyWrap::assign('reports', $reports); SmartyWrap::assign('sectionTitle', 'Pagina moderatorului'); SmartyWrap::addCss('jqueryui', 'select2'); SmartyWrap::addJs('jquery', 'jqueryui', 'select2', 'select2Dev', 'modelDropdown'); SmartyWrap::displayAdminPage('admin/index.ihtml');
$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(); }
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');
<?php require_once "../../phplib/util.php"; util_assertModerator(PRIV_VISUAL); util_assertNotMirror(); RecentLink::createOrUpdate('Adăugare imagini definiții'); SmartyWrap::assign('sectionTitle', 'Imagini pentru definiții'); SmartyWrap::addCss('elfinder', 'jqueryui'); SmartyWrap::addJs('jquery', 'jqueryui', 'elfinder', 'visual'); SmartyWrap::displayAdminPage('admin/visual.ihtml');
<?php require_once "../phplib/util.php"; setlocale(LC_ALL, "ro_RO.utf8"); SmartyWrap::addCss('mill'); SmartyWrap::addJs('mill'); SmartyWrap::display("mill.tpl");
$definition->abbrevReview = count($ambiguousMatches) ? ABBREV_AMBIGUOUS : ABBREV_REVIEW_COMPLETE; $definition->save(); log_userLog("Added definition {$definition->id} ({$definition->lexicon})"); foreach ($lexemIds as $lexemId) { $lexemId = addslashes(AdminStringUtil::formatLexem($lexemId)); if (StringUtil::startsWith($lexemId, '@')) { // create a new lexem $lexem = Lexem::deepCreate(substr($lexemId, 1), 'T', '1'); $lexem->deepSave(); LexemDefinitionMap::associate($lexem->id, $definition->id); log_userLog("Created lexem {$lexem->id} ({$lexem->form})"); } else { $lexem = Lexem::get_by_id($lexemId); LexemDefinitionMap::associate($lexem->id, $definition->id); log_userLog("Associating with lexem {$lexem->id} ({$lexem->form})"); } } FlashMessage::add('Definiția a fost trimisă. Un moderator o va examina în scurt timp. Vă mulțumim!', 'info'); util_redirect('contribuie'); } } else { SmartyWrap::assign('sourceId', session_getDefaultContribSourceId()); } SmartyWrap::assign('lexemIds', $lexemIds); SmartyWrap::assign('contribSources', Model::factory('Source')->where('canContribute', true)->order_by_asc('displayOrder')->find_many()); SmartyWrap::assign('page_title', 'Contribuie cu definiții'); SmartyWrap::assign('suggestNoBanner', true); SmartyWrap::addCss('jqueryui', 'select2'); SmartyWrap::addJs('jqueryui', 'select2', 'select2Dev'); SmartyWrap::display('contribuie.ihtml'); /**************************************************************************/
} SmartyWrap::assign('isOCR', $isOCR); if ($definitionId) { SmartyWrap::assign('definitionId', $definitionId); } SmartyWrap::assign('def', $definition); SmartyWrap::assign('source', $source); SmartyWrap::assign('sim', SimilarRecord::create($definition, $lexemIds)); SmartyWrap::assign('user', User::get_by_id($definition->userId)); SmartyWrap::assign('comment', $comment); SmartyWrap::assign('commentUser', $commentUser); SmartyWrap::assign('lexemIds', $lexemIds); SmartyWrap::assign('typos', Typo::get_all_by_definitionId($definition->id)); SmartyWrap::assign('homonyms', loadSetHomonyms($lexems)); SmartyWrap::assign("allModeratorSources", Model::factory('Source')->where('canModerate', true)->order_by_asc('displayOrder')->find_many()); SmartyWrap::assign('recentLinks', RecentLink::loadForUser()); SmartyWrap::addCss('jqueryui', 'select2'); SmartyWrap::addJs('jquery', 'jqueryui', 'select2', 'select2Dev', 'definitionEdit'); SmartyWrap::displayAdminPage('admin/definitionEdit.tpl'); /** * Load all lexems having the same form as one of the given lexems, but exclude the given lexems. **/ function loadSetHomonyms($lexems) { if (count($lexems) == 0) { return array(); } $names = util_objectProperty($lexems, 'formNoAccent'); $ids = util_objectProperty($lexems, 'id'); return Model::factory('Lexem')->where_in('formNoAccent', $names)->where_not_in('id', $ids)->find_many(); }
<?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');
$maxFreq = hard_medium; $maxLength = hardLength; break; case 2: $minFreq = hard_medium; $maxFreq = medium_easy; $maxLength = mediumLength; break; default: $minFreq = medium_easy; $maxFreq = maxFreq; $maxLength = easyLength; } $count = Model::factory('Lexem')->where_gte('frequency', $minFreq)->where_lte('frequency', $maxFreq)->where_raw('char_length(formUtf8General) >= 5')->where_raw('char_length(formUtf8General) <= ' . $maxLength)->count(); do { $lexem = Model::factory('Lexem')->where_gte('frequency', $minFreq)->where_lte('frequency', $maxFreq)->where_raw('char_length(formUtf8General) >= 5')->where_raw('char_length(formUtf8General) <= ' . $maxLength)->limit(1)->offset(rand(0, $count - 1))->find_one(); // select all the definitions for the given lexem $defs = Model::factory('Definition')->select('Definition.*')->join('LexemDefinitionMap', 'Definition.id = ldm.definitionId', 'ldm')->join('Source', 's.id = sourceId', 's')->where('ldm.lexemId', $lexem->id)->where('status', 0)->where('s.isOfficial', 2)->order_by_asc('displayOrder')->find_many(); // loop untill you find a lexem with a definition } while (!$defs); $searchResults = SearchResult::mapDefinitionArray($defs); $word = mb_strtoupper($lexem->formNoAccent); SmartyWrap::assign('wordLength', mb_strlen($word)); SmartyWrap::assign('letters', preg_split('//u', 'aăâbcdefghiîjklmnopqrsștțuvwxyz', null, PREG_SPLIT_NO_EMPTY)); SmartyWrap::assign('word', $word); SmartyWrap::assign('searchResults', $searchResults); SmartyWrap::assign('difficulty', $difficulty); SmartyWrap::assign('suggestHiddenSearchForm', true); SmartyWrap::addCss('hangman'); SmartyWrap::addJs('hangman', 'jqnotice'); SmartyWrap::display("hangman.tpl");
<?php require_once "../phplib/util.php"; SmartyWrap::assign('manualData', TopEntry::getTopData(CRIT_CHARS, SORT_DESC, true)); SmartyWrap::assign('bulkData', TopEntry::getTopData(CRIT_CHARS, SORT_DESC, false)); SmartyWrap::addCss('tablesorter'); SmartyWrap::addJs('pager', 'tablesorter'); SmartyWrap::display('top.tpl');
$stemLexemModel = LexemModel::create('T', 1); SmartyWrap::assign('lexem', $lexem); SmartyWrap::assign('lexemModels', $lexem->getLexemModels()); SmartyWrap::assign('stemLexemModel', $stemLexemModel); SmartyWrap::assign('searchResults', $searchResults); SmartyWrap::assign('definitionLexem', $definitionLexem); SmartyWrap::assign('homonyms', Model::factory('Lexem')->where('formNoAccent', $lexem->formNoAccent)->where_not_equal('id', $lexem->id)->find_many()); SmartyWrap::assign('meaningTags', $meaningTags); SmartyWrap::assign('modelTypes', Model::factory('ModelType')->order_by_asc('code')->find_many()); SmartyWrap::assign('models', $models); SmartyWrap::assign('jsonSources', Source::getJson()); SmartyWrap::assign('modelsT', FlexModel::loadByType('T')); SmartyWrap::assign('canEdit', $canEdit); SmartyWrap::assign('structStatusNames', Lexem::$STRUCT_STATUS_NAMES); SmartyWrap::addCss('jqueryui-smoothness', 'paradigm', 'select2', 'lexemEdit', 'windowEngine', 'textComplete'); SmartyWrap::addJs('jqueryui', 'select2', 'select2Dev', 'lexemEdit', 'windowEngine', 'cookie', 'modelDropdown', 'textComplete'); SmartyWrap::displayAdminPage('admin/lexemEdit.tpl'); /**************************************************************************/ // Populate lexem fields from request parameters. function populate(&$lexem, &$original, $lexemForm, $lexemNumber, $lexemDescription, $lexemComment, $needsAccent, $hyphenations, $pronunciations, $variantOfId, $structStatus, $modelType, $modelNumber, $restriction, $lmTags, $isLoc, $sourceIds) { $lexem->form = AdminStringUtil::formatLexem($lexemForm); $lexem->formNoAccent = str_replace("'", '', $lexem->form); $lexem->number = $lexemNumber; $lexem->description = AdminStringUtil::internalize($lexemDescription, false); $lexem->comment = trim(AdminStringUtil::internalize($lexemComment, false)); // Sign appended comments if (StringUtil::startsWith($lexem->comment, $original->comment) && $lexem->comment != $original->comment && !StringUtil::endsWith($lexem->comment, ']]')) { $lexem->comment .= " [[" . session_getUser() . ", " . strftime("%d %b %Y %H:%M") . "]]"; } $lexem->noAccent = !$needsAccent;
<?php require_once "../phplib/util.php"; $title = util_getRequestParameter('title'); $wikiTitle = WikiArticle::urlTitleToWikiTitle($title); $wa = WikiArticle::get_by_title(addslashes($wikiTitle)); if ($wa) { SmartyWrap::assign('wa', $wa); SmartyWrap::assign('page_title', $wikiTitle); } else { SmartyWrap::assign('page_title', 'Articol inexistent'); } SmartyWrap::assign('wikiTitles', WikiArticle::loadAllTitles()); SmartyWrap::addCss('tablesorter'); SmartyWrap::addJs('tablesorter'); SmartyWrap::display('wikiArticle.ihtml');
<?php require_once "../../phplib/util.php"; util_assertModerator(PRIV_WOTD); util_assertNotMirror(); RecentLink::createOrUpdate('Cuvântul zilei'); SmartyWrap::assign('downloadYear', date("Y", strtotime("+1 month"))); SmartyWrap::assign('downloadMonth', date("m", strtotime("+1 month"))); SmartyWrap::addCss('jqgrid', 'jqueryui', 'select2'); SmartyWrap::addJs('jquery', 'jqgrid', 'jqueryui', 'wotd', 'select2'); SmartyWrap::displayAdminPage('admin/wotd.tpl');
SmartyWrap::assign('modelNumber', $modelNumber); SmartyWrap::assign('newModelNumber', $newModelNumber); SmartyWrap::assign('exponent', $exponent); SmartyWrap::assign('newExponent', $newExponent); SmartyWrap::assign('description', $model->description); SmartyWrap::assign('newDescription', $newDescription); SmartyWrap::assign('participleNumber', $participleNumber); SmartyWrap::assign('newParticipleNumber', $newParticipleNumber); SmartyWrap::assign('newForms', $newForms); SmartyWrap::assign('inputValues', $inputValues); SmartyWrap::assign('recentLinks', RecentLink::loadForUser()); SmartyWrap::assign('wasPreviewed', $previewButton); SmartyWrap::assign('errorMessage', $errorMessage); SmartyWrap::assign('sectionTitle', "Editare model {$modelType}{$modelNumber}"); SmartyWrap::addCss('paradigm', 'jqueryui'); SmartyWrap::addJs('jquery', 'jqueryui'); SmartyWrap::displayAdminPage('admin/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; } }
<?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');
$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']; }
$error = 'A intervenit o eroare la încărcare.'; } } } } if ($error) { FlashMessage::add($error); util_redirect(util_getWwwRoot() . 'preferinte'); } $user = session_getUser(); if (!$user) { FlashMessage::add('Nu puteți alege o imagine de profil dacă nu sunteți autentificat.'); util_redirect(util_getWwwRoot()); } // Remove any old files (with different extensions) $oldFiles = glob(util_getRootPath() . "wwwbase/img/user/{$user->id}_raw.*"); foreach ($oldFiles as $oldFile) { unlink($oldFile); } $ext = pathinfo($file['name'], PATHINFO_EXTENSION); $destFileName = util_getRootPath() . "wwwbase/img/user/{$user->id}_raw.{$ext}"; if (!move_uploaded_file($file['tmp_name'], $destFileName)) { FlashMessage::add('A intervenit o eroare la copierea fișierului.'); util_redirect(util_getWwwRoot() . 'preferinte'); } chmod($destFileName, 0666); SmartyWrap::addCss('jcrop'); SmartyWrap::addJs('jcrop'); SmartyWrap::assign('page_title', "Editarea pozei de profil"); SmartyWrap::assign('rawFileName', "{$user->id}_raw.{$ext}"); SmartyWrap::display('editare-avatar.ihtml');
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');
<?php require_once "../../phplib/util.php"; util_assertModerator(PRIV_EDIT); util_assertNotMirror(); RecentLink::createOrUpdate('Forme interzise'); SmartyWrap::assign('recentLinks', RecentLink::loadForUser()); SmartyWrap::addCss('select2', 'forbiddenForms'); SmartyWrap::addJs('select2', 'forbiddenForms'); SmartyWrap::displayAdminPage('admin/forbiddenForms.tpl');