本文整理汇总了PHP中util_assertModerator函数的典型用法代码示例。如果您正苦于以下问题:PHP util_assertModerator函数的具体用法?PHP util_assertModerator怎么用?PHP util_assertModerator使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了util_assertModerator函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: util_assertModerator
<?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();
示例2: util_assertModerator
<?php
require_once "../../phplib/util.php";
util_assertModerator(PRIV_ADMIN);
util_assertNotMirror();
$MAX_AFFECTED = 1000;
$search = util_getRequestParameter('search');
$replace = util_getRequestParameter('replace');
$sourceId = util_getRequestParameter('source');
$realRun = util_getRequestParameter('realRun');
$sourceClause = $sourceId ? "and sourceId = {$sourceId}" : '';
$count = Model::factory('Definition')->where_raw("status = 0 {$sourceClause} and binary internalRep like '%{$search}%'")->count();
if ($count > $MAX_AFFECTED) {
if ($realRun) {
FlashMessage::add("{$count} definiții se potrivesc, numai {$MAX_AFFECTED} au fost modificate.", 'info');
} else {
FlashMessage::add("{$count} definiții se potrivesc, maxim {$MAX_AFFECTED} vor fi modificate.");
}
}
$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) {
示例3: util_assertModerator
<?php
require_once "../../phplib/util.php";
util_assertModerator(PRIV_EDIT);
util_assertNotMirror();
$suffix = util_getRequestParameter('suffix');
$submitButton = util_getRequestParameter('submitButton');
if ($submitButton) {
foreach ($_REQUEST as $name => $modelId) {
if (StringUtil::startsWith($name, 'lexem_')) {
$parts = preg_split('/_/', $name);
assert(count($parts) == 2);
assert($parts[0] == 'lexem');
$lexem = Lexem::get_by_id($parts[1]);
if ($modelId) {
$parts = preg_split('/_/', $modelId);
assert(count($parts) == 2);
$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}");
}
示例4: util_assertModerator
<?php
require_once "../../phplib/util.php";
util_assertModerator(PRIV_WOTD);
util_assertNotMirror();
$WOTD_IMAGE_DIR = realpath(__DIR__ . '/../img/wotd/');
$EXTENSIONS = array('jpg', 'jpeg', 'png', 'gif');
$IGNORED_DIRS = array('.', '..', '.svn', '.tmb', 'thumb');
$query = util_getRequestParameter('q');
$files = recursiveScan($WOTD_IMAGE_DIR, $query);
foreach ($files as $file) {
print "{$file}\n";
}
/*************************************************************************/
function recursiveScan($path, $query)
{
global $WOTD_IMAGE_DIR, $EXTENSIONS, $IGNORED_DIRS;
$files = scandir($path);
$results = array();
foreach ($files as $file) {
if (in_array($file, $IGNORED_DIRS)) {
continue;
}
$full = "{$path}/{$file}";
if (is_dir($full)) {
$results = array_merge($results, recursiveScan($full, $query));
} else {
$extension = pathinfo(strtolower($full), PATHINFO_EXTENSION);
if (in_array($extension, $EXTENSIONS)) {
$candidate = substr($full, strlen($WOTD_IMAGE_DIR) + 1);
$regexp = '/' . str_replace('/', "\\/", $query) . '/i';
示例5: ini_set
<?php
require_once "../../phplib/util.php";
ini_set('max_execution_time', '3600');
ini_set('memory_limit', '256M');
util_assertModerator(PRIV_LOC);
util_assertNotMirror();
DebugInfo::disable();
$modelType = util_getRequestParameter('modelType');
$modelNumber = util_getRequestParameter('modelNumber');
$newModelNumber = util_getRequestParameter('newModelNumber');
$chooseLexems = util_getRequestParameter('chooseLexems');
$lexemModelIds = util_getRequestParameter('lexemModelId');
$cloneButton = util_getRequestParameter('cloneButton');
$errorMessages = array();
if ($cloneButton) {
// Disallow duplicate model numbers
$m = FlexModel::loadCanonicalByTypeNumber($modelType, $newModelNumber);
if ($m) {
$errorMessages[] = "Modelul {$modelType}{$newModelNumber} există deja.";
}
if (!$newModelNumber) {
$errorMessages[] = "Numărul modelului nu poate fi vid.";
}
if (!count($errorMessages)) {
// Clone the model
$model = Model::factory('FlexModel')->where('modelType', $modelType)->where('number', $modelNumber)->find_one();
$cloneModel = FlexModel::create($modelType, $newModelNumber, "Clonat după {$modelType}{$modelNumber}", $model->exponent);
$cloneModel->save();
// Clone the model descriptions
$mds = Model::factory('ModelDescription')->where('modelId', $model->id)->order_by_asc('inflectionId')->order_by_asc('variant')->order_by_asc('applOrder')->find_many();
示例6: util_assertModerator
<?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');
示例7: util_assertModerator
<?php
require_once "../phplib/util.php";
util_assertModerator(PRIV_SUPER);
define('DEBUG', 0);
require_once "../phplib/util.php";
$word_start = util_getRequestParameter('i');
$word_end = util_getRequestParameter('e');
$sources = util_getRequestParameter('s');
$searchResults = null;
if ($word_start && $word_end && $sources) {
$definitions = Definition::getListOfWordsFromSources($word_start, $word_end, $sources);
$searchResults = SearchResult::mapDefinitionArray($definitions);
}
if (DEBUG) {
echo "<pre>";
print_r($sources);
//print_r($definitions);
echo "</pre>";
}
$s = "[" . ($sources ? implode($sources, ",") : "") . "]";
SmartyWrap::assign('suggestHiddenSearchForm', true);
SmartyWrap::assign('results', $searchResults);
SmartyWrap::assign('s', $s);
SmartyWrap::assign('i', $word_start);
SmartyWrap::assign('e', $word_end);
SmartyWrap::display('cuvinte.tpl');