本文整理汇总了PHP中LocalRedirect函数的典型用法代码示例。如果您正苦于以下问题:PHP LocalRedirect函数的具体用法?PHP LocalRedirect怎么用?PHP LocalRedirect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LocalRedirect函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: route
/**
* @param array $languageUrlMap - ['language' => 'url', ..., 'default' => 'url']
*/
public function route(array $languageUrlMap)
{
$language = $this->getBestMatch($this->languageList);
$languageUrlMap['default'] = $languageUrlMap['default'] ?: '/404.php';
LanguageLink::setRootAlternateHeader($language);
LocalRedirect($languageUrlMap[$language] ?: $languageUrlMap['default'], false, '301 Moved Permanently');
}
示例2: Authorize
public function Authorize($identity=false, $var=false)
{
if($var === false)
$var = 'OPENID_IDENTITY_OPENID';
$step = TrCOpenIDClient::GetOpenIDAuthStep($var);
if($step > 0)
{
$obOpenID = new TrCOpenIDClient();
if($step == 2)
{
return $obOpenID->Authorize();
}
elseif($step == 1)
{
if($identity === false)
$identity = $_POST['OPENID_IDENTITY_OPENID'];
$return_to = TrCSocServUtil::GetCurUrl("auth_service_id=".urlencode($_REQUEST["auth_service_id"]));
if($url = $obOpenID->GetRedirectUrl($identity, $return_to))
LocalRedirect($url, true);
else
return false;
}
}
return false;
}
示例3: registerUser
function registerUser($userInfo)
{
$errors = array();
$result = '';
if (empty($userInfo['name'])) {
$errors[] = 'Вы не ввели имя';
}
if (empty($userInfo['email'])) {
$errors[] = 'Вы не ввели email';
}
if (empty($userInfo['phone'])) {
$errors[] = 'Вы не ввели телефон';
}
if (empty($errors)) {
$user = new CUser();
$password = make_password(8);
$arFields = array("NAME" => $userInfo['name'], "EMAIL" => $userInfo['email'], "LOGIN" => $userInfo['email'], "ACTIVE" => "Y", "GROUP_ID" => array(6), "PASSWORD" => $password, "CONFIRM_PASSWORD" => $password, "PERSONAL_PHONE" => $userInfo['phone']);
$ID = $user->Add($arFields);
if (intval($ID) > 0) {
$result = "Вы успешно зарегистрированы.";
$arEventField = array("NAME" => $userInfo['name'], "EMAIL" => $userInfo['email'], "PASSWORD" => $password);
CEvent::SendImmediate("NEW_REG", "s1", $arEventField);
unset($_POST['user']);
global $USER;
global $APPLICATION;
$USER->Authorize($ID);
LocalRedirect($APPLICATION->GetCurPageParam('', array('user[name]', 'user[email]', 'ELEMENT_CODE', 'code')));
} else {
$errors[] = $user->LAST_ERROR;
}
}
return $errors;
}
示例4: processBeforeAction
protected function processBeforeAction($actionName)
{
if ($actionName != 'start' && $this->request->getQuery('document_action') != 'start') {
//todo hack. SocServ set backurl!
if (strpos($_SERVER['HTTP_REFERER'], 'tools/oauth') !== false) {
$uri = \CHTTP::urlDeleteParams($this->request->getRequestUri(), array("sessid", "document_action"));
$uri = \CHTTP::urlAddParams($uri, array('document_action' => 'start'));
//restart process after authorization in social services
LocalRedirect($uri);
}
}
if ($this->isActionWithExistsFile()) {
$this->initializeData();
$this->checkReadPermissions();
}
if ($actionName != 'start') {
if (!$this->initializeDocumentService()) {
$this->sendJsonErrorResponse();
}
if (!$this->documentHandler->checkAccessibleTokenService()) {
$this->errorCollection->add(array(new Error(Loc::getMessage('DISK_DOC_CONTROLLER_ERROR_COULD_NOT_WORK_WITH_TOKEN_SERVICE', array('#NAME#' => $this->documentHandler->getName())), self::ERROR_COULD_NOT_WORK_WITH_TOKEN_SERVICE)));
$this->errorCollection->add($this->documentHandler->getErrors());
$this->sendJsonErrorResponse();
}
if (!$this->documentHandler->queryAccessToken()->hasAccessToken() || $this->documentHandler->isRequiredAuthorization()) {
$this->sendNeedAuth();
}
}
return true;
}
示例5: Authorize
public function Authorize($identity=false, $var=false)
{
if($var === false)
$var = 'OPENID_IDENTITY_OPENID';
$step = COpenIDClient::GetOpenIDAuthStep($var);
if($step > 0)
{
$obOpenID = new COpenIDClient();
if($step == 2)
{
return $obOpenID->Authorize();
}
elseif($step == 1)
{
if($identity === false)
$identity = $_REQUEST['OPENID_IDENTITY_OPENID'];
CSocServAuthManager::SetUniqueKey();
$return_to = CSocServUtil::GetCurUrl("auth_service_id=".urlencode($_REQUEST["auth_service_id"])."&check_key=".$_SESSION["UNIQUE_KEY"]);
if($url = $obOpenID->GetRedirectUrl($identity, $return_to))
LocalRedirect($url, true);
else
return false;
}
}
return false;
}
示例6: execute
public function execute($context)
{
// ищем оцениваемого по ключу респондента
$assess = $this->registry->getDbHelper('MembersHelper')->findAssessByRespondentKey($context['respondent']['private_access_key']);
if (!$assess) {
$this->component->arResult['error'] = 'Неверный ключ';
} else {
// проверяем статус оцениваемого
if ($assess['status'] != \Ecoplay\Helper\Db\MembersHelper::ASSESS_STATUS_ASSESS) {
// редиректим в лк
$respondentMember = $this->registry->getDbHelper('MembersHelper')->findById($context['respondent']['project_memberID']);
LocalRedirect('/enter/' . $respondentMember['private_lk_access_key'] . '/');
}
// ключ не ЛК, значит ищем сеанс для этого ключа
$seance = $this->registry->getDbHelper('SeancesHelper')->findSeanceByAccessKey($context['respondent']['private_access_key']);
if (!$seance) {
$seance = $this->registry->getModel('Blanks')->createSeance($context['respondent']['private_access_key']);
}
if (!$seance) {
$this->component->arResult['error'] = 'Неверный ключ';
} else {
LocalRedirect('/s/' . $seance['seance_key'] . '/');
}
}
}
示例7: Authorize
public function Authorize($identity = false, $var = false)
{
if ($var === false) {
$var = 'OPENID_IDENTITY_OPENID';
}
$step = COpenIDClient::GetOpenIDAuthStep($var);
if ($step > 0) {
$obOpenID = new COpenIDClient();
if ($step == 2) {
return $obOpenID->Authorize();
} elseif ($step == 1) {
if ($identity === false) {
$identity = $_REQUEST['OPENID_IDENTITY_OPENID'];
}
CSocServAuthManager::SetUniqueKey();
$return_to = CSocServUtil::GetCurUrl("auth_service_id=" . urlencode($_REQUEST["auth_service_id"]) . "&check_key=" . $_SESSION["UNIQUE_KEY"], array("SEF_APPLICATION_CUR_PAGE_URL", "auth_service_error", "auth_service_id", "login"));
if ($url = $obOpenID->GetRedirectUrl($identity, $return_to)) {
LocalRedirect($url, true);
} else {
LocalRedirect(CSocServUtil::GetCurUrl("auth_service_id=" . urlencode($_REQUEST["auth_service_id"]) . "&auth_service_error=1"));
}
return false;
}
}
return false;
}
示例8: RedirectToSite
function RedirectToSite($site)
{
if(strlen($site)<=0) return false;
$db_site = CSite::GetByID($site);
if($arSite = $db_site->Fetch())
{
$arSite["DIR"] = RTrim($arSite["DIR"], ' \/');
if(strlen($arSite["DIR"])>0)
LocalRedirect((strlen($arSite["SERVER_NAME"])>0?"http://".$arSite["SERVER_NAME"]:"").$arSite["DIR"].$_SERVER["REQUEST_URI"], true);
}
}
示例9: ShowPanel
function ShowPanel()
{
global $USER, $APPLICATION;
if (defined("ADMIN_SECTION") && ADMIN_SECTION == true) {
return;
}
if ($USER->IsAdmin()) {
if ($_REQUEST['add_new_site_sol'] == 'sol' && check_bitrix_sessid()) {
$dbrSites = CSite::GetList($by, $ord);
$arSitesID = array();
$arSitesPath = array();
$siteCnt = 0;
while ($arSite = $dbrSites->Fetch()) {
if ($arSite["ACTIVE"] == "Y") {
$siteCnt++;
}
$arSitesID[] = strtolower($arSite["ID"]);
$arSitesPath[] = strtolower($arSite["PATH"]);
}
$newSiteID = "";
while (true) {
$newSiteID = chr(rand(ord("a"), ord("z"))) . chr(rand(ord("a"), ord("z")));
if (!in_array($newSiteID, $arSitesID) && !in_array("/site" . $newSiteID . "/", $arSitesPath) && !file_exists($_SERVER['DOCUMENT_ROOT'] . "/site" . $newSiteID)) {
break;
}
}
$culture = CultureTable::getRow(array('filter' => array("=FORMAT_DATE" => FORMAT_DATE, "=FORMAT_DATETIME" => FORMAT_DATETIME, "=FORMAT_NAME" => CSite::GetDefaultNameFormat(), "=CHARSET" => SITE_CHARSET)));
if ($culture) {
$cultureId = $culture["ID"];
} else {
$addResult = CultureTable::add(array("NAME" => $newSiteID, "CODE" => $newSiteID, "FORMAT_DATE" => FORMAT_DATE, "FORMAT_DATETIME" => FORMAT_DATETIME, "FORMAT_NAME" => CSite::GetDefaultNameFormat(), "CHARSET" => SITE_CHARSET));
$cultureId = $addResult->getId();
}
$arFields = array("LID" => $newSiteID, "ACTIVE" => "Y", "SORT" => 100, "DEF" => "N", "NAME" => $newSiteID, "DIR" => "/site_" . $newSiteID . "/", "SITE_NAME" => $newSiteID, "SERVER_NAME" => $_SERVER["SERVER_NAME"], "EMAIL" => COption::GetOptionString("main", "email_from"), "LANGUAGE_ID" => LANGUAGE_ID, "DOC_ROOT" => "", "CULTURE_ID" => $cultureId);
$obSite = new CSite();
$result = $obSite->Add($arFields);
if ($result) {
LocalRedirect("/bitrix/admin/wizard_install.php?lang=" . LANGUAGE_ID . "&wizardName=bitrix:portal&wizardSiteID=" . $newSiteID . "&" . bitrix_sessid_get());
} else {
echo $obSite->LAST_ERROR;
}
}
$arMenu = array(array("ACTION" => "jsUtils.Redirect([], '" . CUtil::JSEscape(SITE_DIR) . "?add_new_site_sol=sol&" . bitrix_sessid_get() . "')", "TEXT" => "<b>" . GetMessage("SOL_BUTTON_TEST_TEXT", array("#BR#" => " ")) . "</b>", "TITLE" => GetMessage("SOL_BUTTON_TEST_TITLE")));
$arSites = array();
$dbrSites = CSite::GetList($by, $ord, array("ACTIVE" => "Y"));
while ($arSite = $dbrSites->GetNext()) {
$arSites[] = array("ACTION" => "jsUtils.Redirect([], '" . CUtil::JSEscape($arSite["DIR"]) . "');", "ICON" => $arSite["LID"] == SITE_ID ? "checked" : "", "TEXT" => $arSite["NAME"], "TITLE" => GetMessage("SOL_BUTTON_GOTOSITE") . " " . $arSite["NAME"]);
}
$arMenu[] = array("SEPARATOR" => true);
$arMenu[] = array("TEXT" => GetMessage("SOL_BUTTON_GOTOSITE"), "MENU" => $arSites);
$APPLICATION->AddPanelButton(array("HREF" => SITE_DIR . "?add_new_site_sol=sol&" . bitrix_sessid_get(), "ID" => "solutions_wizard", "ICON" => "bx-panel-install-solution-icon", "TYPE" => "BIG", "ALT" => GetMessage("SOL_BUTTON_TEST_TITLE"), "TEXT" => GetMessage("SOL_BUTTON_TEST_TEXT"), "MAIN_SORT" => 2520, "SORT" => 20, "MENU" => $arMenu, 'HINT' => array('TITLE' => str_replace('#BR#', ' ', GetMessage("SOL_BUTTON_TEST_TEXT")), 'TEXT' => GetMessage('SOL_BUTTON_TEST_TEXT_HINT')), 'HINT_MENU' => array('TITLE' => str_replace('#BR#', ' ', GetMessage("SOL_BUTTON_TEST_TEXT")), 'TEXT' => GetMessage('SOL_BUTTON_TEST_MENU_HINT'))));
}
}
示例10: execute
public function execute($context)
{
// проверяем, возможно сеанс уже существует
$seance = $this->registry->getDbHelper('TestsSeancesHelper')->findSeanceByAccessKey($context['respondent']['private_access_key']);
if (!$seance) {
$seance = $this->registry->getModel('Tests')->createSeance($context['respondent']);
}
if (!$seance) {
$this->component->arResult['error'] = 'Неверный ключ';
} else {
LocalRedirect('/s/' . $seance['seance_key'] . '/');
}
}
示例11: DoUninstall
public function DoUninstall()
{
if (!check_bitrix_sessid()) {
return false;
}
UnRegisterModule($this->MODULE_ID);
$modPath = $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/" . $this->MODULE_ID . "/install/components";
$comPath = $_SERVER["DOCUMENT_ROOT"] . "/bitrix/components";
DeleteDirFiles($modPath, $comPath);
DeleteDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/" . $this->MODULE_ID . "/install/images", $_SERVER["DOCUMENT_ROOT"] . "/bitrix/images/maxposter");
LocalRedirect("partner_modules.php?lang=" . LANGUAGE_ID);
return true;
}
示例12: ServicesRedirect
public static function ServicesRedirect()
{
if (isset($_REQUEST["add_service"]) && $_REQUEST["add_service"]) {
$service = DrclinicsHelper::getServices($_REQUEST["add_service"]);
$service = end($service);
if ($service) {
$section = self::getSefviceMediaspect($service["ID"], $service["IBLOCK_SECTION_ID"]);
if ($section) {
self::ServicesSession($service["ID"], "add");
LocalRedirect($section["SECTION_PAGE_URL"]);
}
}
}
}
示例13: execute
public function execute($context)
{
if ($context['respondent']['status'] != \Ecoplay\Helper\Db\MembersHelper::RESPONDENT_STATUS_ACTIVE) {
$this->component->arResult['error'] = 'Неверный ключ';
} else {
// ключ не ЛК, значит ищем сеанс для этого ключа
$seance = $this->registry->getDbHelper('SeancesHelper')->findSeanceByAccessKey($context['respondent']['private_access_key']);
if (!$seance) {
$seance = $this->registry->getModel('Blanks')->createSeance($context['respondent']['private_access_key']);
}
if (!$seance) {
$this->component->arResult['error'] = 'Неверный ключ';
} else {
LocalRedirect('/s/' . $seance['seance_key'] . '/');
}
}
}
示例14: OnBeforePrologHandler
public function OnBeforePrologHandler()
{
global $USER;
$rsUser = CUser::GetByID($USER->GetId());
$arUser = $rsUser->Fetch();
$uri = $_SERVER['REQUEST_URI'];
if ($pos = strpos($_SERVER['REQUEST_URI'], '?')) {
$uri = substr($_SERVER['REQUEST_URI'], 0, $pos);
}
if ($arUser['ID'] > 0 && $arUser['UF_RULES'] != '1' && $uri != '/licenzionnoe-soglasheniye/' && $uri != '/personal/registration/license_agreement.php') {
$backUrl = '';
if (isset($_GET['backurl'])) {
$backUrl = '?backurl=' . $_GET['backurl'];
}
LocalRedirect("/licenzionnoe-soglasheniye/" . $backUrl);
}
}
示例15: addProductById
public function addProductById()
{
$request = Application::getInstance()->getContext()->getRequest();
if (!$request->isAjaxRequest() && !$request->isPost()) {
return $this->pageNotFound();
}
if (!(int) $request->get('id') || !(int) $request->get('quantity')) {
return $this->pageNotFound();
}
/** @var \TAO\Bundle\Shop\Bundle $shop */
$shop = \TAO::bundle('Shop');
$product = $shop->getProductById((int) $request->get('id'));
$shop->addProductToCart($product, (int) $request->get('quantity'));
if ($request->isAjaxRequest()) {
return 'ok';
}
LocalRedirect($request->get('backurl') ? urldecode($request->get('backurl')) : $shop->cartUrl());
}