<?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');
<?php require_once "../../phplib/util.php"; util_assertModerator(PRIV_EDIT); util_assertNotMirror(); RecentLink::createOrUpdate('Lexeme ambigue'); $lexems = Lexem::loadAmbiguous(); SmartyWrap::assign('recentLinks', RecentLink::loadForUser()); SmartyWrap::assign('lexems', $lexems); SmartyWrap::displayAdminPage('admin/viewAmbiguousLexems.tpl');
// $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');
<?php require_once "../../phplib/util.php"; util_assertModerator(PRIV_EDIT); util_assertNotMirror(); RecentLink::createOrUpdate('Lexeme neasociate'); $lexems = Lexem::loadUnassociated(); SmartyWrap::assign('lexems', $lexems); SmartyWrap::assign('sectionTitle', 'Lexeme neasociate'); SmartyWrap::assign('sectionCount', count($lexems)); SmartyWrap::assign('recentLinks', RecentLink::loadForUser()); SmartyWrap::displayAdminPage('admin/lexemList.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(); $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');
$pm = ParticipleModel::loadByVerbModel($modelNumber); $clonePm = Model::factory('ParticipleModel')->create(); $clonePm->verbModel = $newModelNumber; $clonePm->adjectiveModel = $pm->adjectiveModel; $clonePm->save(); } // Migrate the selected lexems. if ($chooseLexems && $lexemModelIds) { foreach ($lexemModelIds as $lexemModelId) { $lm = LexemModel::get_by_id($lexemModelId); $lm->modelNumber = $newModelNumber; $lm->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"; } $lexemModels = LexemModel::loadByCanonicalModel($modelType, $modelNumber); SmartyWrap::assign('modelType', $modelType); SmartyWrap::assign('modelNumber', $modelNumber); SmartyWrap::assign('newModelNumber', $newModelNumber); SmartyWrap::assign('lexemModels', $lexemModels); SmartyWrap::assign('errorMessage', $errorMessages); SmartyWrap::assign('recentLinks', RecentLink::loadForUser()); SmartyWrap::displayAdminPage('admin/cloneModel.tpl');
$where[] = "structStatus = {$structStatus}"; } // Process the $nick argument if ($nick) { $user = User::get_by_nick($nick); if ($user) { $joins['definition'] = true; $where[] = "userId = {$user->id}"; } } // Assemble the query $query = Model::factory('Lexem')->table_alias('l')->select('l.*')->distinct()->order_by_asc('formNoAccent')->limit(10000); // ... and joins foreach ($joins as $join => $ignored) { switch ($join) { case 'definition': $query = $query->join('LexemDefinitionMap', 'l.id = ldm.lexemId', 'ldm')->join('Definition', 'ldm.definitionId = d.id', 'd'); break; case 'lexemModel': $query = $query->join('LexemModel', 'l.id = lm.lexemId', 'lm'); } } // ... and where clauses foreach ($where as $clause) { $query = $query->where_raw("({$clause})"); } $lexems = $query->find_many(); SmartyWrap::assign('lexems', $lexems); SmartyWrap::assign('recentLinks', RecentLink::loadForUser()); SmartyWrap::displayAdminPage('admin/lexemSearch.tpl');
<?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 join LexemModel on lexemId = Lexem.id " . "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']); } SmartyWrap::assign('stats', $stats); SmartyWrap::assign('sectionTitle', 'Alegere sufix pentru etichetare asistată'); SmartyWrap::assign('recentLinks', RecentLink::loadForUser()); SmartyWrap::displayAdminPage('admin/bulkLabelSelectSuffix.ihtml');
<?php require_once "../../phplib/util.php"; util_assertModerator(PRIV_STRUCT); util_assertNotMirror(); // Select lexems that // * are associated with definitions from DEX '98 or DEX '09 // * have the shortest total definition length (from all sources) $lexems = Model::factory('Lexem')->table_alias('l')->select('l.*')->join('LexemDefinitionMap', 'l.id = ldm.lexemId', 'ldm')->join('Definition', 'ldm.definitionId = d.id', 'd')->where('l.structStatus', Lexem::STRUCT_STATUS_NEW)->where_not_equal('d.status', Definition::ST_DELETED)->group_by('l.id')->having_raw('sum(sourceId in (1, 27)) > 0')->having_raw('sum(length(internalRep)) < 300')->limit(100)->find_many(); // Load the definitions for each lexem $searchResults = array(); foreach ($lexems as $l) { $defs = Definition::loadByLexemId($l->id); $searchResults[] = SearchResult::mapDefinitionArray($defs); } SmartyWrap::assign('lexems', $lexems); SmartyWrap::assign('searchResults', $searchResults); SmartyWrap::assign('recentLinks', RecentLink::loadForUser()); SmartyWrap::displayAdminPage('admin/structChooseLexem.tpl');
<?php require_once "../../phplib/util.php"; util_assertModerator(PRIV_WOTD); util_assertNotMirror(); RecentLink::createOrUpdate('Word of the Day - Imagini'); SmartyWrap::assign('sectionTitle', 'Imagini pentru cuvântul zilei'); SmartyWrap::addCss('elfinder', 'jqueryui'); SmartyWrap::addJs('jquery', 'jqueryui', 'elfinder'); SmartyWrap::displayAdminPage('admin/wotdImages.ihtml');
<?php require_once "../../phplib/util.php"; util_assertModerator(PRIV_EDIT); util_assertNotMirror(); RecentLink::createOrUpdate('Lexeme cu comentarii'); $lexems = Model::factory('Lexem')->where_not_null('comment')->order_by_asc('formNoAccent')->find_many(); SmartyWrap::assign('recentLinks', RecentLink::loadForUser()); SmartyWrap::assign('lexems', $lexems); SmartyWrap::displayAdminPage('admin/viewLexemsWithComments.tpl');
if ($nextPageButton) { $page++; } $name = StringUtil::cleanupQuery($name); $arr = StringUtil::analyzeQuery($name); $hasDiacritics = $arr[0]; $hasRegexp = $arr[1]; $isAllDigits = $arr[2]; $field = $hasDiacritics ? 'formNoAccent' : 'formUtf8General'; $userId = ''; if ($nick) { $user = User::get_by_nick($nick); if ($user) { $userId = $user->id; } } $beginTime = mktime(0, 0, 0, $mo1, $da1, $yr1); $endTime = mktime(23, 59, 59, $mo2, $da2, $yr2); // Query the database and output the results $defs = Definition::searchModerator($name, $hasDiacritics, $sourceId, $status, $userId, $beginTime, $endTime, $page, RESULTS_PER_PAGE); $searchResults = SearchResult::mapDefinitionArray($defs); $args = array('name' => $name, 'status' => $status, 'nick' => $nick, 'sourceId' => $sourceId, 'yr1' => $yr1, 'mo1' => $mo1, 'da1' => $da1, 'yr2' => $yr2, 'mo2' => $mo2, 'da2' => $da2, 'page' => $page); FileCache::putModeratorQueryResults($ip, array($searchResults, $args)); } else { list($searchResults, $args) = FileCache::getModeratorQueryResults($ip); } SmartyWrap::assign('searchResults', $searchResults); SmartyWrap::assign('args', $args); SmartyWrap::assign('recentLinks', RecentLink::loadForUser()); SmartyWrap::displayAdminPage('admin/definitionLookup.tpl');
<?php require_once "../../phplib/util.php"; ini_set('memory_limit', '256M'); $modelType = util_getRequestParameter('modelType'); $modelNumber = util_getRequestParameter('modelNumber'); $lexems = Lexem::loadByCanonicalModel($modelType, $modelNumber); RecentLink::createOrUpdate("Model: {$modelType}{$modelNumber}"); SmartyWrap::assign('lexems', $lexems); SmartyWrap::assign('modelType', $modelType); SmartyWrap::assign('modelNumber', $modelNumber); SmartyWrap::assign('recentLinks', RecentLink::loadForUser()); SmartyWrap::displayAdminPage('admin/viewLexemsByModel.tpl');
function handleLexemActions() { $lexemId = util_getRequestParameter('lexemId'); $lexem = Lexem::get_by_id($lexemId); $associateDefinitionId = util_getRequestParameter('associateDefinitionId'); if ($associateDefinitionId) { LexemDefinitionMap::associate($lexem->id, $associateDefinitionId); util_redirect("lexemEdit.php?lexemId={$lexem->id}"); } $dissociateDefinitionId = util_getRequestParameter('dissociateDefinitionId'); if ($dissociateDefinitionId) { LexemDefinitionMap::dissociate($lexem->id, $dissociateDefinitionId); util_redirect("lexemEdit.php?lexemId={$lexem->id}"); } $createDefinition = util_getRequestParameter('createDefinition'); $miniDefTarget = util_getRequestParameter('miniDefTarget'); if ($createDefinition) { $def = Model::factory('Definition')->create(); $def->userId = session_getUserId(); $def->sourceId = Source::get_by_shortName('Neoficial')->id; $def->lexicon = $lexem->formNoAccent; $def->internalRep = '@' . mb_strtoupper(AdminStringUtil::internalize($lexem->form, false)) . '@ v. @' . $miniDefTarget . '.@'; $def->htmlRep = AdminStringUtil::htmlize($def->internalRep, $def->sourceId); $def->status = Definition::ST_ACTIVE; $def->save(); LexemDefinitionMap::associate($lexem->id, $def->id); util_redirect("lexemEdit.php?lexemId={$lexem->id}"); } $deleteLexem = util_getRequestParameter('deleteLexem'); if ($deleteLexem) { $homonyms = Model::factory('Lexem')->where('formNoAccent', $lexem->formNoAccent)->where_not_equal('id', $lexem->id)->find_many(); $lexem->delete(); SmartyWrap::assign('lexem', $lexem); SmartyWrap::assign('homonyms', $homonyms); SmartyWrap::displayAdminPage('admin/lexemDeleted.tpl'); exit; } $cloneLexem = util_getRequestParameter('cloneLexem'); if ($cloneLexem) { $newLexem = $lexem->cloneLexem(); log_userLog("Cloned lexem {$lexem->id} ({$lexem->form}), new id is {$newLexem->id}"); util_redirect("lexemEdit.php?lexemId={$newLexem->id}"); } $mergeLexem = util_getRequestParameter('mergeLexem'); $mergeLexemId = util_getRequestParameter('mergeLexemId'); if ($mergeLexem) { $other = Lexem::get_by_id($mergeLexemId); if ($lexem->form != $other->form) { FlashMessage::add('Nu pot unifica lexemele deoarece accentele diferă. Rezolvați diferența și încercați din nou.'); util_redirect("lexemEdit.php?lexemId={$lexem->id}"); } $defs = Definition::loadByLexemId($lexem->id); foreach ($defs as $def) { LexemDefinitionMap::associate($other->id, $def->id); } // Add lexem models from $lexem to $other if the form is the same. Exclude T-type models. $displayOrder = count($other->getLexemModels()); foreach ($lexem->getLexemModels() as $lm) { if ($lm->modelType != 'T' && !$other->hasModel($lm->modelType, $lm->modelNumber)) { $lm->lexemId = $other->id; $lm->displayOrder = ++$displayOrder; $lm->save(); } } // Add meanings from $lexem to $other and renumber their displayOrder and breadcrumb // displayOrders are generated sequentially regardless of level. // Breadcrumbs follow levels so only their first part changes. $counter = Model::factory('Meaning')->where('lexemId', $other->id)->count(); $numRoots = Model::factory('Meaning')->where('lexemId', $other->id)->where('parentId', 0)->count(); $meanings = Model::factory('Meaning')->where('lexemId', $lexem->id)->order_by_asc('displayOrder')->find_many(); foreach ($meanings as $m) { $m->lexemId = $other->id; $m->displayOrder = ++$counter; $parts = explode('.', $m->breadcrumb, 2); $parts[0] += $numRoots; $m->breadcrumb = implode('.', $parts); $m->save(); } // Add images and image tags from $lexem to $other $visuals = Visual::get_all_by_lexemeId($lexem->id); foreach ($visuals as $v) { $v->lexemeId = $other->id; $v->save(); } $visualTags = VisualTag::get_all_by_lexemeId($lexem->id); foreach ($visualTags as $vt) { $vt->lexemeId = $other->id; $vt->save(); } $lexem->delete(); util_redirect("lexemEdit.php?lexemId={$other->id}"); } }
// Compress the directory OS::executeAndAssert("zip -r0 compressed.zip *"); // Move the resulting file to another temp location so it lives a little longer $outputFile = tempnam(Config::get('global.tempDir'), 'compress_'); @unlink($outputFile); rename("{$workDir}/compressed.zip", $outputFile); OS::executeAndAssert("rm -rf {$workDir}"); header('Content-disposition: attachment; filename=comprimate.zip'); header('Content-Type: application/zip'); readfile($outputFile); exit; } } } } SmartyWrap::displayAdminPage('admin/wotdCompressImages.tpl'); /**************************************************************************/ function recursiveScan($path, $logFile) { global $IGNORED_DIRS, $EXTENSIONS, $beforeBytes, $afterBytes; $files = scandir($path); foreach ($files as $file) { if (in_array($file, $IGNORED_DIRS)) { continue; } $full = "{$path}/{$file}"; if (is_dir($full)) { recursiveScan($full, $logFile); } else { $extension = pathinfo(strtolower($full), PATHINFO_EXTENSION); $fullNoExt = substr($full, 0, strlen($full) - strlen($extension) - 1);
} // 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'); SmartyWrap::assign('sectionTitle', 'Unificare lexeme'); SmartyWrap::assign('recentLinks', RecentLink::loadForUser()); SmartyWrap::assign('modelType', $modelType); SmartyWrap::assign('lexems', $lexems); SmartyWrap::displayAdminPage('admin/mergeLexems.ihtml'); /***************************************************/ /** Returns an array containing only the accented forms, not the entire InflectedForm objects **/ function loadIfArray($lexem) { $lm = $lexem->getFirstLexemModel(); $ifs = $lm->loadInflectedForms(); $result = array(); foreach ($ifs as $if) { $result[] = $if->form; } return $result; }
<?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');
<?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');
} } } } } 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")->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'); SmartyWrap::assign('sectionTitle', 'Plasare accente'); SmartyWrap::assign('lexems', $lexems); SmartyWrap::assign('chars', $chars); SmartyWrap::assign('searchResults', $searchResults); SmartyWrap::assign("allStatuses", util_getAllStatuses()); SmartyWrap::assign('recentLinks', RecentLink::loadForUser()); SmartyWrap::displayAdminPage('admin/placeAccents.ihtml');
<?php require_once "../../phplib/util.php"; util_assertModerator(PRIV_EDIT); util_assertNotMirror(); RecentLink::createOrUpdate('Lexeme neasociate'); $lexems = Lexem::loadUnassociated(); SmartyWrap::assign('lexems', $lexems); SmartyWrap::assign('recentLinks', RecentLink::loadForUser()); SmartyWrap::displayAdminPage('admin/viewUnassociatedLexems.tpl');
<?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(); $lexemModels = LexemModel::loadByCanonicalModel($modelType, $modelNumber); if ($deleteButton) { foreach ($lexemModels as $lm) { $lm->modelType = 'T'; $lm->modelNumber = '1'; $lm->restriction = ''; $lm->save(); $lm->regenerateParadigm(); } $model->delete(); util_redirect('../admin/index.php'); } RecentLink::createOrUpdate("Ștergere model: {$model}"); SmartyWrap::assign('modelType', $modelType); SmartyWrap::assign('modelNumber', $modelNumber); SmartyWrap::assign('lexemModels', $lexemModels); SmartyWrap::assign('recentLinks', RecentLink::loadForUser()); SmartyWrap::displayAdminPage('admin/deleteModel.tpl');
<?php require_once "../../phplib/util.php"; ini_set('memory_limit', '512M'); util_assertModerator(PRIV_EDIT); util_assertNotMirror(); $lexems = Model::factory('Lexem')->select('id')->select('formNoAccent')->select('description')->where('consistentAccent', 0)->order_by_asc('formNoAccent')->limit(1000)->find_many(); RecentLink::createOrUpdate('Lexeme fără accent'); SmartyWrap::assign('recentLinks', RecentLink::loadForUser()); SmartyWrap::assign('lexems', $lexems); SmartyWrap::displayAdminPage('admin/viewLexemsWithoutAccents.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']; }
<?php require_once "../../phplib/util.php"; util_assertModerator(PRIV_EDIT); util_assertNotMirror(); RecentLink::createOrUpdate('Definiții nemoderate'); $sourceId = 0; $sourceUrlName = util_getRequestParameter('source'); if ($sourceUrlName) { $source = $sourceUrlName ? Source::get_by_urlName($sourceUrlName) : null; $sourceId = $source ? $source->id : 0; SmartyWrap::assign('src_selected', $sourceId); } $ip = $_SERVER['REMOTE_ADDR']; $defs = Definition::searchModerator('*', '', $sourceId, Definition::ST_PENDING, 0, 0, time(), 1, 500); $searchResults = SearchResult::mapDefinitionArray($defs); FileCache::putModeratorQueryResults($ip, $searchResults); SmartyWrap::assign('searchResults', $searchResults); SmartyWrap::assign('recentLinks', RecentLink::loadForUser()); SmartyWrap::displayAdminPage('admin/viewPendingDefinitions.tpl');
} } $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"); } SmartyWrap::assign('search', $search); SmartyWrap::assign('replace', $replace); SmartyWrap::assign('sourceId', $sourceId); SmartyWrap::assign('searchResults', $searchResults); SmartyWrap::assign('recentLinks', RecentLink::loadForUser()); SmartyWrap::displayAdminPage('admin/bulkReplace.tpl');
<?php require_once "../../phplib/util.php"; util_assertModerator(PRIV_EDIT); util_assertNotMirror(); RecentLink::createOrUpdate('Definiții neasociate'); $defs = Model::factory('Definition')->where_raw("status != 2 and id not in (select definitionId from LexemDefinitionMap)")->find_many(); SmartyWrap::assign('searchResults', SearchResult::mapDefinitionArray($defs)); SmartyWrap::assign('recentLinks', RecentLink::loadForUser()); SmartyWrap::displayAdminPage('admin/viewUnassociatedDefinitions.tpl');
<?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 " : ''; SmartyWrap::assign('src_selected', $sourceId); } $defs = Model::factory('Definition')->raw_query("select * from Definition where {$sourceClause} id in (select definitionId from Typo) order by lexicon")->find_many(); SmartyWrap::assign('searchResults', SearchResult::mapDefinitionArray($defs)); SmartyWrap::assign('recentLinks', RecentLink::loadForUser()); SmartyWrap::displayAdminPage('admin/viewTypos.tpl');
<?php require_once "../../phplib/util.php"; util_assertModerator(PRIV_EDIT); util_assertNotMirror(); RecentLink::createOrUpdate('Definiții nemoderate'); $sourceId = 0; $sourceUrlName = util_getRequestParameter('source'); if ($sourceUrlName) { $source = $sourceUrlName ? Source::get_by_urlName($sourceUrlName) : null; $sourceId = $source ? $source->id : 0; SmartyWrap::assign('src_selected', $sourceId); } $ip = $_SERVER['REMOTE_ADDR']; $defs = Definition::searchModerator('*', '', $sourceId, ST_PENDING, 0, 0, time(), 1, 500); $searchResults = SearchResult::mapDefinitionArray($defs); FileCache::putModeratorQueryResults($ip, $searchResults); SmartyWrap::assign('searchResults', $searchResults); SmartyWrap::assign('sectionTitle', 'Definiții nemoderate'); SmartyWrap::assign('sectionCount', count($searchResults)); SmartyWrap::assign('allStatuses', util_getAllStatuses()); SmartyWrap::assign('recentLinks', RecentLink::loadForUser()); SmartyWrap::displayAdminPage('admin/definitionList.ihtml');
$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');
$ocr = Model::factory('OCR')->create(); $ocr->lotId = $lotId; $ocr->userId = $userId; $ocr->sourceId = $sourceId; if ($editorId) { $ocr->editorId = $editorId; } $ocr->ocrText = $line; $ocr->dateAdded = date('Y-m-d H:i:s'); try { $ocr->save(); } catch (Exception $e) { $errCount++; $class = "msgErr"; $message .= "<div> Eroare: " . $e->getMessage() . "</div>"; } } } $ocrLot->status = 'done'; $ocrLot->save(); $message .= "Fișierul " . $_FILES["file"]["name"] . " (" . $lineCount . " linii) a fost salvat" . ($class == "msgErr" ? " cu " . $errCount . " erori..." : "!"); } } } SmartyWrap::assign("sectionTitle", "OCR Input"); SmartyWrap::assign("msgClass", $class); SmartyWrap::assign("message", $message); SmartyWrap::assign("allModeratorSources", Model::factory('Source')->where('canModerate', true)->order_by_asc('displayOrder')->find_many()); SmartyWrap::assign("allOCRModerators", Model::factory('User')->where_raw('moderator & 4')->order_by_asc('id')->find_many()); SmartyWrap::displayAdminPage('admin/ocrInput.ihtml');