当前位置: 首页>>代码示例>>PHP>>正文


PHP util_redirect函数代码示例

本文整理汇总了PHP中util_redirect函数的典型用法代码示例。如果您正苦于以下问题:PHP util_redirect函数的具体用法?PHP util_redirect怎么用?PHP util_redirect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了util_redirect函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: session_logout

function session_logout()
{
    log_userLog('Logging out, IP=' . $_SERVER['REMOTE_ADDR']);
    $cookieString = session_getCookieSetting('lll');
    $cookie = Cookie::get_by_cookieString($cookieString);
    if ($cookie) {
        $cookie->delete();
    }
    setcookie("prefs[lll]", NULL, time() - 3600, '/');
    unset($_COOKIE['prefs']['lll']);
    session_kill();
    util_redirect(util_getWwwRoot());
}
开发者ID:florinp,项目名称:dexonline,代码行数:13,代码来源:session.php

示例2: substr

$similar = Definition::get_by_id($similarId);
if ($ins) {
    $from = $def;
    $to = $similar;
    $fstart = $dstart;
    $flen = $dlen;
    $tstart = $sstart;
    $tlen = $slen;
} else {
    $from = $similar;
    $to = $def;
    $fstart = $sstart;
    $flen = $slen;
    $tstart = $dstart;
    $tlen = $dlen;
}
// copy text from $from to $to
$mid = substr($from->internalRep, $fstart, $flen);
if (!$tlen) {
    if ($tstart >= strlen($to->internalRep)) {
        $mid = " {$mid}";
    } else {
        $mid = "{$mid} ";
    }
}
$to->internalRep = substr($to->internalRep, 0, $tstart) . $mid . substr($to->internalRep, $tstart + $tlen);
$to->internalRep = AdminStringUtil::internalizeDefinition($to->internalRep, $to->sourceId);
$to->htmlRep = AdminStringUtil::htmlize($to->internalRep, $to->sourceId);
$to->save();
util_redirect("definitionEdit.php?definitionId={$defId}");
开发者ID:florinp,项目名称:dexonline,代码行数:30,代码来源:editSimilarDefinition.php

示例3: foreach

                    foreach ($matches as $match) {
                        LexemDefinitionMap::associate($match->id, $definition->id);
                        log_userLog("Associating with lexem {$match->id} ({$match->form})");
                    }
                } else {
                    // Create a new lexem.
                    $lexem = Lexem::create($lexemName, 'T', '1', '');
                    $lexem->save();
                    $lexem->regenerateParadigm();
                    LexemDefinitionMap::associate($lexem->id, $definition->id);
                    log_userLog("Created 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 {
    smarty_assign('sourceId', session_getDefaultContribSourceId());
}
smarty_assign('contribSources', Model::factory('Source')->where('canContribute', true)->order_by_asc('displayOrder')->find_many());
smarty_assign('page_title', 'Contribuie cu definiții');
smarty_assign('suggestNoBanner', true);
smarty_displayCommonPageWithSkin('contribuie.ihtml');
/**************************************************************************/
function deleteEmptyElements(&$v)
{
    $result = array();
    foreach ($v as $elem) {
        if (!empty($elem)) {
            $result[] = $elem;
开发者ID:nastasie-octavian,项目名称:DEXonline,代码行数:31,代码来源:contribuie.php

示例4: util_redirect

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');
开发者ID:florinp,项目名称:dexonline,代码行数:31,代码来源:visualTag.php

示例5: util_getRequestParameter

// Parse or initialize the GET/POST arguments
$nick = util_getRequestParameter('n');
$medalSaveButton = util_getRequestParameter('medalSaveButton');
$userId = util_getRequestParameter('userId');
$medalsGranted = util_getRequestParameter('medalsGranted');
if ($medalSaveButton) {
    util_assertModerator(PRIV_ADMIN);
    $user = User::get_by_id($userId);
    $user->medalMask = Medal::getCanonicalMask(array_sum($medalsGranted));
    $user->save();
    util_redirect(util_getWwwRoot() . "utilizator/{$user->nick}");
}
$user = User::get_by_nick($nick);
if (!$user) {
    FlashMessage::add('Utilizatorul ' . htmlspecialchars($nick) . ' nu există.');
    util_redirect(util_getWwwRoot());
}
$userData = array();
$user->email = StringUtil::scrambleEmail($user->email);
// Find the rank of this user by number of words and number of characters
$topWords = TopEntry::getTopData(CRIT_WORDS, SORT_DESC, true);
$numUsers = count($topWords);
$rankWords = 0;
while ($rankWords < $numUsers && $topWords[$rankWords]->userNick != $nick) {
    $rankWords++;
}
$userData['rank_words'] = $rankWords + 1;
if ($rankWords < $numUsers) {
    $topEntry = $topWords[$rankWords];
    $userData['last_submission'] = $topEntry->timestamp;
    $userData['num_words'] = $topEntry->numDefinitions;
开发者ID:florinp,项目名称:dexonline,代码行数:31,代码来源:user.php

示例6: preg_split

            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}");
}
$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) {
开发者ID:florinp,项目名称:dexonline,代码行数:31,代码来源:bulkLabel.php

示例7: authenticate

 function authenticate($clientId, $secret)
 {
     $this->fetchWellKnownConfig();
     if (!$clientId || !$secret) {
         throw new OpenIDException('Autentificare eșuată.');
     }
     $url = $this->wellKnownConfig['authorization_endpoint'];
     $nonce = util_randomCapitalLetterString(32);
     $state = util_randomCapitalLetterString(32);
     session_setVariable('openid_connect_nonce', $nonce);
     session_setVariable('openid_connect_state', $state);
     session_setVariable('openid_connect_provider', $this->provider);
     session_setVariable('openid_connect_client', $clientId);
     session_setVariable('openid_connect_secret', $secret);
     $params = array('client_id' => $clientId, 'openid.realm' => util_getFullServerUrl(), 'nonce' => $nonce, 'redirect_uri' => $this->getReturnTo(), 'response_type' => 'code', 'scope' => 'openid email', 'state' => $state);
     $url .= '?' . http_build_query($params, null, '&');
     util_redirect($url);
 }
开发者ID:florinp,项目名称:dexonline,代码行数:18,代码来源:OpenIDConnect.php

示例8: foreach

        if ($modelType == 'V') {
            $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');
开发者ID:florinp,项目名称:dexonline,代码行数:31,代码来源:cloneModel.php

示例9: smarty_assign

    smarty_assign('rss_pubDate', date('D, d M Y H:i:s') . ' EEST');
    smarty_assign('results', $results);
    smarty_displayWithoutSkin('common/rss.ixml');
    exit;
}
$today = date('Y-m-d', time());
$timestamp = $date ? strtotime($date) : time();
$mysqlDate = date("Y-m-d", $timestamp);
if ($mysqlDate < WOTD_BIG_BANG || $mysqlDate > $today) {
    util_redirect(util_getWwwRoot() . 'cuvantul-zilei');
}
$wotd = WordOfTheDay::get_by_displayDate($mysqlDate);
if (!$wotd) {
    // We shouldn't have missing words since the Big Bang.
    if ($mysqlDate != $today) {
        util_redirect(util_getWwwRoot() . 'cuvantul-zilei');
    }
    WordOfTheDay::updateTodaysWord();
    $wotd = WordOfTheDay::get_by_displayDate($mysqlDate);
}
$archive = WordOfTheDay::getArchiveWotD(date('Y', $timestamp), date('m', $timestamp));
$defId = WordOfTheDayRel::getRefId($wotd->id);
$def = Definition::get_by_id($defId);
$searchResults = SearchResult::mapDefinitionArray(array($def));
setlocale(LC_ALL, 'ro_RO');
$roDate = strftime("%e %B %Y", $timestamp);
$pageTitle = sprintf("Cuvântul zilei: %s (%s)", $def->lexicon, $roDate);
if ($mysqlDate > WOTD_BIG_BANG) {
    smarty_assign('prevday', date('Y/m/d', $timestamp - 86400));
}
if ($mysqlDate < $today) {
开发者ID:nastasie-octavian,项目名称:DEXonline,代码行数:31,代码来源:wotd.php

示例10: util_redirectToFriendlyUrl

/**
 * Search engine friendly URLs used for the search page:
 * 1) http://dexonline.ro/definitie[-<sursa>]/<cuvânt>[/<defId>][/paradigma]
 * 2) http://dexonline.ro/lexem[-<sursa>]/<cuvânt>[/<lexemId>][/paradigma]
 * 3) http://dexonline.ro/text[-<sursa>]/<text>
 * Links of the old form (search.php?...) can only come via the search form and should not contain lexemId / definitionId.
 */
function util_redirectToFriendlyUrl($cuv, $sourceUrlName, $text, $showParadigm, $xml)
{
    if (strpos($_SERVER['REQUEST_URI'], '/search.php?') === false) {
        return;
        // The url is already friendly.
    }
    if ($xml) {
        return;
    }
    $cuv = urlencode($cuv);
    $sourceUrlName = urlencode($sourceUrlName);
    $sourcePart = $sourceUrlName ? "-{$sourceUrlName}" : '';
    $paradigmPart = $showParadigm ? '/paradigma' : '';
    if ($text) {
        $url = "text{$sourcePart}/{$cuv}";
    } else {
        $url = "definitie{$sourcePart}/{$cuv}{$paradigmPart}";
    }
    util_redirect(util_getWwwRoot() . $url);
}
开发者ID:nastasie-octavian,项目名称:DEXonline,代码行数:27,代码来源:util.php

示例11: setlocale

<?php

require_once "../phplib/util.php";
setlocale(LC_ALL, "ro_RO.utf8");
DebugInfo::disable();
$locVersion = util_getRequestParameter('locVersion');
$modelType = util_getRequestParameter('modelType');
$modelType = ModelType::get_by_code($modelType);
// Use the ModelType object from this point on
if (!$locVersion || !$modelType) {
    FlashMessage::add('Date incorecte');
    util_redirect('scrabble');
}
LocVersion::changeDatabase($locVersion);
$models = FlexModel::loadByType($modelType->code);
$lexemModels = array();
foreach ($models as $m) {
    $lexemModels[] = getLexemModel($m->exponent, $modelType->code, $m->number);
}
SmartyWrap::addCss('paradigm');
SmartyWrap::assign('page_title', 'Modele de flexiune');
SmartyWrap::assign('models', $models);
SmartyWrap::assign('lexemModels', $lexemModels);
SmartyWrap::assign('locVersion', $locVersion);
SmartyWrap::assign('modelType', $modelType);
SmartyWrap::display('modele-flexiune.ihtml');
/*************************************************************************/
/**
 * Returns a LexemModel for a given word and model. Creates one if one doesn't exist.
 **/
function getLexemModel($form, $modelType, $modelNumber)
开发者ID:Jobava,项目名称:mirror-dexonline,代码行数:31,代码来源:modele-flexiune.php

示例12: foreach

                LexemDefinitionMap::associate($dest->id, $def->id);
            }
            // Add $dest to LOC if $src is in LOC
            if ($src->isLoc() && !$dest->isLoc()) {
                $lm = $dest->getFirstLexemModel();
                $lm->isLoc = true;
                $lm->save();
            }
            // Delay the deletion because we might have to merge $src with other lexems.
            $lexemsToDelete[] = $src;
        }
    }
    foreach ($lexemsToDelete as $lexem) {
        $lexem->delete();
    }
    util_redirect("mergeLexems.php?modelType={$modelType}");
    exit;
}
$PLURAL_INFLECTIONS = array(3, 11, 19, 27, 35);
if ($modelType == 'T') {
    $whereClause = 'modelType = "T"';
} else {
    if ($modelType) {
        $whereClause = "modelType = '{$modelType}' and restriction like '%P%'";
    } else {
        $whereClause = '(modelType = "T") or (modelType in ("M", "F", "N") and restriction like "%P%")';
    }
}
$dbResult = db_execute("select distinct l.* " . "from Lexem l " . "join LexemModel lm on lm.lexemId = l.id " . "where {$whereClause} " . "order by formNoAccent", PDO::FETCH_ASSOC);
$lexems = array();
foreach ($dbResult as $row) {
开发者ID:Jobava,项目名称:mirror-dexonline,代码行数:31,代码来源:mergeLexems.php

示例13: util_assertModerator

<?php

require_once "../../phplib/util.php";
util_assertModerator(PRIV_EDIT);
util_assertNotMirror();
$id1 = util_getRequestParameter('id1');
$id2 = util_getRequestParameter('id2');
$l1 = Lexem::get_by_id($id1);
$l2 = Lexem::get_by_id($id2);
$defs = Definition::loadByLexemId($l1->id);
foreach ($defs as $def) {
    LexemDefinitionMap::associate($l2->id, $def->id);
}
$l1->delete();
util_redirect("lexemEdit.php?lexemId={$l2->id}");
开发者ID:nastasie-octavian,项目名称:DEXonline,代码行数:15,代码来源:lexemMerge.php

示例14: util_redirect

        FlashMessage::add('Am salvat descrierea.', 'info');
        util_redirect('tipuri-modele.php');
    } else {
        SmartyWrap::assign('editModelType', $mt);
    }
}
if ($editId) {
    // Load model type to be edited
    SmartyWrap::assign('editModelType', ModelType::get_by_id($editId));
}
if ($deleteId) {
    $mt = ModelType::get_by_id($deleteId);
    if (validateDelete($mt)) {
        FlashMessage::add("Am șters tipul de model '{$mt->code}'.", 'info');
        $mt->delete();
        util_redirect('tipuri-modele.php');
    }
}
// Load model type table data
$modelTypes = Model::factory('ModelType')->order_by_asc('code')->find_many();
$modelCounts = array();
$lexemCounts = array();
$canDelete = array();
foreach ($modelTypes as $mt) {
    $numLexems = Model::factory('LexemModel')->where('modelType', $mt->code)->count();
    $numDependants = Model::factory('ModelType')->where('canonical', $mt->code)->count();
    $modelCounts[] = Model::factory('FlexModel')->where('modelType', $mt->code)->count();
    $lexemCounts[] = $numLexems;
    $canDelete[] = $numLexems == 0 && $numDependants <= 1;
}
SmartyWrap::assign('canonicalModelTypes', ModelType::loadCanonical());
开发者ID:florinp,项目名称:dexonline,代码行数:31,代码来源:tipuri-modele.php

示例15: date

<?php

require_once "../phplib/util.php";
$TODAY = date("Y-m-d");
$REMOTE_FOLDER = 'download/xmldump';
$STATIC_FILES = file(Config::get('static.url') . 'fileList.txt');
$URL = Config::get('static.url') . 'download/xmldump';
if (count($_GET) == 0) {
    util_redirect("http://wiki.dexonline.ro/wiki/Protocol_de_exportare_a_datelor");
}
$lastDump = getLastDumpDate($TODAY, $REMOTE_FOLDER);
SmartyWrap::assign('lastDump', $lastDump);
SmartyWrap::assign('url', $URL);
$lastClientUpdate = util_getRequestParameterWithDefault('last', '0');
if ($lastClientUpdate == '0') {
    // Dump the freshest full dump we have
    // TODO: return an error if there is no full dump
    SmartyWrap::assign('serveFullDump', true);
    $lastClientUpdate = $lastDump;
}
SmartyWrap::assign('diffs', getDiffsBetween($lastClientUpdate, $TODAY, $REMOTE_FOLDER));
header('Content-type: text/xml');
print SmartyWrap::fetch('update4.ihtml');
/**************************************************************************/
// Do not return a dump for today, in case it is still being built
function getLastDumpDate($today, $folder)
{
    global $STATIC_FILES;
    // Group existing files by date, excluding the diff files
    $map = array();
    foreach ($STATIC_FILES as $file) {
开发者ID:Jobava,项目名称:mirror-dexonline,代码行数:31,代码来源:update4.php


注:本文中的util_redirect函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。