// 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'); }
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"; $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');
<?php require_once "../../phplib/util.php"; set_time_limit(0); // If no GET arguments are set, print usage and return. if (count($_GET) == 0) { SmartyWrap::addCss('polar'); SmartyWrap::displayWithoutSkin('update3Instructions.tpl'); return; } util_enforceGzipEncoding(); header('Content-type: text/xml'); $export = util_getRequestParameter('export'); $timestamp = util_getRequestIntParameter('timestamp'); $version = util_getRequestParameterWithDefault('version', '3.0'); if ($export && util_isDesktopBrowser() && !session_getUser()) { SmartyWrap::display('bits/updateError.tpl'); exit; } if ($export == 'sources') { SmartyWrap::assign('sources', Model::factory('Source')->find_many()); SmartyWrap::displayWithoutSkin('xml/update3Sources.tpl'); } else { if ($export == 'inflections') { SmartyWrap::assign('inflections', Model::factory('Inflection')->order_by_asc('id')->find_many()); SmartyWrap::displayWithoutSkin('xml/update3Inflections.tpl'); } else { if ($export == 'abbrev') { SmartyWrap::assign('abbrev', AdminStringUtil::loadRawAbbreviations()); SmartyWrap::displayWithoutSkin('xml/update3Abbrev.tpl'); } else {
<?php require_once "../phplib/util.php"; setlocale(LC_ALL, "ro_RO.utf8"); SmartyWrap::addCss('mill'); SmartyWrap::addJs('mill'); SmartyWrap::display("mill.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');
$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');
$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'); /**************************************************************************/
$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") . "]]"; }
SmartyWrap::assign('adjModelType', ModelType::get_by_code('A')); 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"; 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');