<?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;
    smarty_assign('src_selected', $sourceId);
}
$ip = $_SERVER['REMOTE_ADDR'];
$defs = Definition::searchModerator('*', '', $sourceId, ST_PENDING, 0, 0, time());
$searchResults = SearchResult::mapDefinitionArray($defs);
FileCache::putModeratorQueryResults($ip, $searchResults);
smarty_assign('searchResults', $searchResults);
smarty_assign('sectionTitle', 'Definiții nemoderate');
smarty_assign('allStatuses', util_getAllStatuses());
smarty_assign('recentLinks', RecentLink::loadForUser());
smarty_displayWithoutSkin('admin/definitionList.ihtml');
<?php

require_once "../../phplib/util.php";
util_assertModerator(PRIV_EDIT);
util_assertNotMirror();
RecentLink::createOrUpdate('Lexeme ambigue');
$lexems = Model::factory('Lexem')->raw_query("select * from Lexem where description = '' group by form having count(*) > 1", null)->find_many();
smarty_assign('sectionTitle', 'Lexeme ambigue (cu nume și descriere identice)');
smarty_assign('recentLinks', RecentLink::loadForUser());
smarty_assign('lexems', $lexems);
smarty_displayWithoutSkin('admin/lexemList.ihtml');
Esempio n. 3
0
                $lm = $lexem->getFirstLexemModel();
                $lm->modelType = $parts[0];
                $lm->modelNumber = $parts[1];
                $lm->restriction = util_getRequestParameter('restr_' . $lexem->id);
                $lm->save();
                $lm->regenerateParadigm();
            } else {
                $lexem->comment = util_getRequestParameter('comment_' . $lexem->id);
                $lexem->save();
            }
        }
    }
    util_redirect("bulkLabel.php?suffix={$suffix}");
}
$reverseSuffix = StringUtil::reverse($suffix);
RecentLink::createOrUpdate("Etichetare asistată: -{$suffix}");
$numLabeled = Model::factory('Lexem')->table_alias('l')->join('LexemModel', 'lm.lexemId = l.id', 'lm')->where_not_equal('lm.modelType', 'T')->where_like('l.reverse', "{$reverseSuffix}%")->count();
// Collect all the models that appear in at least 5% of the already
// labeled lexems. Always select at least one model, in the unlikely case
// that no model has over 5%.
$models = array();
$hasInvariableModel = false;
$dbResult = db_execute("select canonical, modelNumber, count(*) as c " . "from Lexem " . "join LexemModel on lexemId = Lexem.id " . "join ModelType on modelType = code " . "where modelType != 'T' " . "and reverse like '{$reverseSuffix}%' " . "group by canonical, modelNumber " . "order by c desc", PDO::FETCH_ASSOC);
foreach ($dbResult as $row) {
    $modelType = $row['canonical'];
    $modelNumber = $row['modelNumber'];
    $count = $row['c'];
    if (!count($models) || $count / $numLabeled >= 0.05) {
        if ($modelType == 'V' || $modelType == 'VT') {
            $m = Model::factory('FlexModel')->where('modelType', 'V')->where('number', $modelNumber)->find_one();
            $models[] = $m;
Esempio n. 4
0
<?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');
Esempio n. 5
0
        }
    }
    // 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');
<?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');
Esempio n. 7
0
<?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');
<?php

require_once "../../phplib/util.php";
util_assertModerator(PRIV_EDIT);
util_assertNotMirror();
RecentLink::createOrUpdate('Căutare definiții');
$name = util_getRequestParameter('name');
$status = util_getRequestIntParameter('status');
$nick = util_getRequestParameter('nick');
$sourceId = util_getRequestIntParameter('source');
$yr1 = util_getRequestIntParameter('yr1');
$mo1 = util_getRequestIntParameter('mo1');
$da1 = util_getRequestIntParameter('da1');
$yr2 = util_getRequestIntParameter('yr2');
$mo2 = util_getRequestIntParameter('mo2');
$da2 = util_getRequestIntParameter('da2');
$searchButton = util_getRequestParameter('searchButton');
$ip = $_SERVER['REMOTE_ADDR'];
// Execute query and display results
// Convert wildcards to mysql format
if ($searchButton) {
    $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) {
Esempio n. 9
0
}
if ($deleteLexem) {
    $homonyms = Model::factory('Lexem')->where('formNoAccent', $lexem->formNoAccent)->where_not_equal('id', $lexem->id)->find_many();
    $lexem->delete();
    smarty_assign('lexem', $lexem);
    smarty_assign('homonyms', $homonyms);
    smarty_displayWithoutSkin('admin/lexemDeleted.ihtml');
    return;
}
if ($cloneLexem) {
    $newLexem = _cloneLexem($lexem);
    log_userLog("Cloned lexem {$lexem->id} ({$lexem->form}), new id is {$newLexem->id}");
    util_redirect("lexemEdit.php?lexemId={$newLexem->id}");
}
if (!$similarModel && !$similarLexemName && !$refreshLexem && !$updateLexem) {
    RecentLink::createOrUpdate("Lexem: {$lexem}");
}
if ($lexemForm !== null) {
    $oldUnaccented = $lexem->formNoAccent;
    $lexem->form = AdminStringUtil::formatLexem($lexemForm);
    $lexem->formNoAccent = str_replace("'", '', $lexem->form);
    $lexem->reverse = StringUtil::reverse($lexem->formNoAccent);
    if ($lexem->formNoAccent != $oldUnaccented) {
        $lexem->modelType = 'T';
        $lexem->modelNumber = 1;
    }
}
if ($lexemDescription !== null) {
    $lexem->description = AdminStringUtil::internalize($lexemDescription, false);
}
if ($lexemTags !== null) {
Esempio n. 10
0
<?php

require_once "../../phplib/util.php";
util_assertModerator(PRIV_WOTD);
util_assertNotMirror();
RecentLink::createOrUpdate('Imaginea zilei');
SmartyWrap::addCss('elfinder', 'jqueryui');
SmartyWrap::addJs('jquery', 'jqueryui', 'elfinder');
SmartyWrap::displayAdminPage('admin/wotdImages.tpl');
Esempio n. 11
0
<?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');
            }
        }
    } else {
        db_execute("delete from LexemDefinitionMap where definitionId = {$definitionId}");
        foreach ($ldms as $ldm) {
            $ldm->save();
        }
    }
    log_userLog("Edited definition {$definition->id} ({$definition->lexicon})");
    util_redirect('definitionEdit.php?definitionId=' . $definitionId);
}
$source = Source::get_by_id($definition->sourceId);
if (!$refreshButton && !$acceptButton && !$moveButton) {
    // If a button was pressed, then this is a POST request and the URL
    // does not contain the definition ID.
    RecentLink::createOrUpdate(sprintf("Definiție: %s (%s)", $definition->lexicon, $source->shortName));
}
smarty_assign('def', $definition);
smarty_assign('source', $source);
smarty_assign('user', User::get_by_id($definition->userId));
smarty_assign('comment', $comment);
smarty_assign('commentUser', $commentUser);
smarty_assign('lexems', $lexems);
smarty_assign('typos', Typo::get_all_by_definitionId($definition->id));
smarty_assign('homonyms', loadSetHomonyms($lexems));
smarty_assign("allStatuses", util_getAllStatuses());
smarty_assign("allModeratorSources", Model::factory('Source')->where('canModerate', true)->order_by_asc('displayOrder')->find_many());
smarty_assign('recentLinks', RecentLink::loadForUser());
smarty_displayWithoutSkin('admin/definitionEdit.ihtml');
/**
 * Load all lexems having the same form as one of the given lexems, but exclude the given lexems.
Esempio n. 13
0
<?php

require_once "../../phplib/util.php";
util_assertModerator(PRIV_WOTD);
util_assertNotMirror();
RecentLink::createOrUpdate('Word of the Day');
SmartyWrap::assign('sectionTitle', 'Word of the Day');
SmartyWrap::assign('allStatuses', util_getAllStatuses());
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.ihtml');
Esempio n. 14
0
                        $lm->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")->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) ? '&nbsp;' : $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');
Esempio n. 15
0
                    }
                }
            }
            // 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;
    }
Esempio n. 16
0
    smarty_assign('lexems', $lexems);
    smarty_assign('regenForms', $regenForms);
    smarty_assign('regenTransforms', $regenTransforms);
}
if ($modelType == 'V') {
    smarty_assign('adjModels', FlexModel::loadByType('A'));
}
$inputValues = array();
foreach ($inflections as $infl) {
    $inputValues[$infl->id] = array();
    foreach ($newForms[$infl->id] as $form) {
        $inputValues[$infl->id][] = array('form' => $form, 'isLoc' => 1, 'recommended' => 1);
    }
}
if (!$previewButton && !$confirmButton) {
    RecentLink::createOrUpdate("Editare model: {$model}");
}
smarty_assign('inflections', $inflections);
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());
Esempio n. 17
0
<?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');
Esempio n. 18
0
<?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');
<?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');
Esempio n. 20
0
<?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');
<?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');
Esempio n. 22
0
<?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 neasociate');
$defs = Model::factory('Definition')->where_raw("status != 2 and id not in (select definitionId from LexemDefinitionMap)")->find_many();
smarty_assign('searchResults', SearchResult::mapDefinitionArray($defs));
smarty_assign('sectionTitle', 'Definiții neasociate');
smarty_assign('allStatuses', util_getAllStatuses());
smarty_assign('recentLinks', RecentLink::loadForUser());
smarty_displayWithoutSkin('admin/definitionList.ihtml');
Esempio n. 24
0
<?php

require_once '../../phplib/util.php';
util_assertModerator(PRIV_VISUAL);
util_assertNotMirror();
RecentLink::createOrUpdate('Etichetare Imagini Definiții');
$fileName = util_getRequestParameter('fileName');
$id = util_getRequestParameter('id');
$lexemId = util_getRequestParameter('lexemId');
$revised = util_getBoolean('revised');
$saveButton = util_getRequestParameter('saveButton');
$tagLexemId = util_getRequestParameter('tagLexemId');
$tagLabel = util_getRequestParameter('tagLabel');
$textXCoord = util_getRequestParameter('textXCoord');
$textYCoord = util_getRequestParameter('textYCoord');
$imgXCoord = util_getRequestParameter('imgXCoord');
$imgYCoord = util_getRequestParameter('imgYCoord');
$addTagButton = util_getRequestParameter('addTagButton');
// Tag the image specified by $fileName. Create a Visual object if one doesn't exist, then redirect to it.
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();
Esempio n. 25
0
<?php

require_once '../../phplib/util.php';
ini_set('memory_limit', '512M');
util_hideEmptyRequestParameters();
util_assertModerator(PRIV_EDIT);
util_assertNotMirror();
$sourceId = util_getRequestParameter('source');
if ($sourceId) {
    $source = Source::get_by_id($sourceId);
    RecentLink::createOrUpdate("Lexeme neetichetate {$source->shortName}");
    $lexems = Model::factory('Lexem')->table_alias('l')->select('l.*')->distinct()->join('LexemModel', 'lm.lexemId = l.id', 'lm')->join('LexemDefinitionMap', 'ldm.lexemId = l.id', 'ldm')->join('Definition', 'd.id = ldm.definitionId', 'd')->where('d.status', Definition::ST_ACTIVE)->where('d.sourceId', $sourceId)->where('lm.modelType', 'T')->order_by_asc('formNoAccent')->limit(1000)->find_many();
} else {
    RecentLink::createOrUpdate('Lexeme neetichetate');
    $lexems = Model::factory('Lexem')->table_alias('l')->select('l.*')->join('LexemModel', 'lm.lexemId = l.id', 'lm')->where('lm.modelType', 'T')->order_by_asc('formNoAccent')->limit(1000)->find_many();
}
SmartyWrap::assign('recentLinks', RecentLink::loadForUser());
SmartyWrap::assign('lexems', $lexems);
SmartyWrap::displayAdminPage('admin/viewTemporaryLexems.tpl');