本文整理汇总了PHP中CoreUtils::redirect方法的典型用法代码示例。如果您正苦于以下问题:PHP CoreUtils::redirect方法的具体用法?PHP CoreUtils::redirect怎么用?PHP CoreUtils::redirect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CoreUtils
的用法示例。
在下文中一共展示了CoreUtils::redirect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepareData
public function prepareData()
{
parent::prepareData();
$this->form = new CoreForm('post');
$this->createFormFields();
$this->errorMessageContainer = new CoreFormValidationMessageContainer();
if (CoreServices::get('request')->isSetGet('logout')) {
$this->logAction('logout');
CoreServices::get('access')->logout();
$this->currentUser = null;
} elseif ($this->form->isSubmitted()) {
$this->addFormValidators();
CoreServices::get('access')->logout();
$this->currentUser = null;
$this->form->setFieldValuesFromRequest();
$this->errorMessageContainer = $this->form->getValidationResults();
if (!$this->errorMessageContainer->isAnyErrorMessage()) {
CoreServices::get('access')->login($this->form->getField('adminName')->getValue(), $this->form->getField('password')->getValue(), $this->errorMessageContainer);
$this->logAction('login');
}
}
if (!$this->form->isSubmitted() || !$this->errorMessageContainer->isAnyErrorMessage()) {
$adminId = CoreServices::get('access')->getCurrentUserId();
if ($adminId) {
$this->currentUser = CoreServices::get('access')->getCurrentUserData();
$redirectAddress = $this->getFirstAccessiblePage();
if ($redirectAddress == CoreServices::get('url')->getCurrentPageUrl()) {
$this->errorMessageContainer->addMessage('youHaveNoPermissions');
} else {
CoreUtils::redirect($redirectAddress);
}
}
}
}
示例2: checkUserPermissionsForRecord
protected function checkUserPermissionsForRecord()
{
if ($this->currentUser['adminRole'] < $this->adminRoles['adminRoleSuperadmin'] && $this->currentUser['id'] != $this->record['id']) {
CoreServices2::getDB()->transactionCommit();
CoreUtils::redirect($this->getListPageAddress());
}
}
示例3: prepareData
public function prepareData()
{
parent::prepareData();
if (CoreServices2::getRequest()->getFromGet('_sm')) {
$this->successMessage = 1;
return;
}
$this->dao = new UserDAO();
$this->initRecord();
$this->initForm();
$this->createFormFields();
if (empty($this->record['id'])) {
// @TODO: własciwie w tym wypadku powinno sie przejść z powrotem do pierwszego
// formularza i rozpocząć całą procedurę od nowa
$this->errorMessageContainer = new CoreFormValidationMessageContainer();
$this->errorMessageContainer->addMessage('errorInvalidCode');
return;
}
if ($this->form->isSubmitted()) {
$this->addFormValidators();
$this->form->setFieldValuesFromRequest();
$this->handleRequest();
} else {
$this->setFormFieldValuesFromRecord();
}
if (!empty($this->redirectAddress)) {
CoreUtils::redirect($this->redirectAddress);
}
}
开发者ID:piotrPiechura,项目名称:3dPathProject,代码行数:29,代码来源:UserWebsitePasswordRecovery2Controller.class.php
示例4: initRecord
protected function initRecord()
{
parent::initRecord();
if (empty($this->record['id']) || $this->record['subpageModule'] != 'Subpage' || $this->record['subpageMode'] != 'Website') {
CoreUtils::redirect($this->getListPageAddress());
}
}
示例5: checkHTTPS
/**
* Teoretycznie jest to odporne na thickboxy.
*/
protected function checkHTTPS()
{
$httpsOn = CoreServices2::getUrl()->isHTTPSOn();
$httpsRequired = CoreConfig::get('Environment', 'httpsForWebsite');
if ($httpsRequired && !$httpsOn) {
CoreUtils::redirect(CoreServices2::getUrl()->getCurrentExactAddress('https'));
}
if (!$httpsRequired && $httpsOn) {
CoreUtils::redirect(CoreServices2::getUrl()->getCurrentExactAddress('http'));
}
}
示例6: redirectToPage
protected function redirectToPage($url, $layoutType)
{
switch ($layoutType) {
case 'standard':
CoreUtils::redirect(CoreServices2::getUrl()->createAddress('_m', 'Helper', '_o', 'WebsiteThickboxParentRedirect', 'url', $url));
case 'thickbox':
CoreUtils::redirect($url);
default:
throw new CoreException('Invalid layout type ' . $layoutType);
}
}
开发者ID:piotrPiechura,项目名称:3dPathProject,代码行数:11,代码来源:WebsiteAbstractControllerThickboxLayout.class.php
示例7: prepareData
public function prepareData()
{
if (!$this->isCLI()) {
CoreUtils::redirect(CoreServices::get('url')->createAddress());
}
$this->garbageCollector = new TmpRecordGarbageCollector();
try {
$this->garbageCollector->clean();
} catch (Exception $e) {
$this->reportError($e->getMessage());
}
}
示例8: prepareData
public function prepareData()
{
$this->checkHTTPS();
$this->adminRoles = array_flip(CoreConfig::get('Data', 'adminRoles'));
$this->currentUser = CoreServices::get('access')->getCurrentUserData();
if (!$this->isControllerUsagePermitted()) {
CoreUtils::redirect($this->getNoPermissionsAddress());
}
$this->initDAO();
$this->initLayout();
$this->initCompany();
$this->initProject();
}
示例9: prepareData
public function prepareData()
{
parent::prepareData();
$this->initDAO();
$this->initSearchForm();
if ($this->searchForm->isSubmitted()) {
$this->searchForm->setFieldValuesFromRequest();
}
$this->initRecordList();
$this->initDeletionForm();
if ($this->deletionForm->isSubmitted()) {
$this->deletionForm->setFieldValuesFromRequest();
$this->handleDeleteRequest();
CoreUtils::redirect(CoreServices::get('url')->getCurrentPageUrl('_sm', 'MassDelete'));
}
}
示例10: initRecord
protected function initRecord()
{
$id = CoreServices::get('request')->getFromRequest('id');
if (!empty($id)) {
$this->record = $this->dao->getRecordById($id);
if (!$this->record['id']) {
CoreServices::get('db')->transactionCommit();
CoreUtils::redirect($this->getListPageAddress());
}
} else {
CoreUtils::redirect(CoreServices2::getUrl()->createAddress('_m', 'Settings', '_o', 'CMSList'));
}
$this->initMultiselectRelations();
$this->recordOldValues = $this->record;
// clone!
$this->checkUserPermissionsForRecord();
}
示例11: checkHTTPS
protected function checkHTTPS()
{
$httpsOn = CoreServices2::getUrl()->isHTTPSOn();
if ($this->getSessionName() == 'CMSSession') {
$httpsRequired = CoreConfig::get('Environment', 'httpsForCMS');
} elseif ($this->getSessionName() == 'WebsiteSession') {
$httpsRequired = CoreConfig::get('Environment', 'httpsForWebsite');
} else {
$httpsRequired = False;
// i tak nie ma sesji!
}
if ($httpsRequired && !$httpsOn) {
CoreUtils::redirect(CoreServices::get('url')->getCurrentExactAddress('https'));
}
if (!$httpsRequired && $httpsOn) {
CoreUtils::redirect(CoreServices::get('url')->getCurrentExactAddress('http'));
}
}
示例12: prepareData
public function prepareData()
{
parent::prepareData();
$this->dao = new UserDAO();
if (CoreServices::get('request')->getFromGet('_sm')) {
$this->successMessage = 1;
return;
}
$this->initForm();
$this->createFormFields();
if ($this->form->isSubmitted()) {
$this->addFormValidators();
$this->form->setFieldValuesFromRequest();
$this->handleRequest();
}
if (!is_null($this->redirectAddress)) {
CoreUtils::redirect($this->redirectAddress);
}
}
开发者ID:piotrPiechura,项目名称:3dPathProject,代码行数:19,代码来源:UserWebsitePasswordRecovery1Controller.class.php
示例13: prepareData
public function prepareData()
{
parent::prepareData();
$this->initDAO();
$this->form = new CoreForm('post');
if ($this->form->isSubmitted()) {
CoreServices::get('db')->transactionStart();
$this->initRecordList();
$this->initActions();
$this->createFormFields();
$this->addFormValidators();
$this->form->setFieldValuesFromRequest();
$this->handleRequest();
CoreServices::get('db')->transactionCommit();
} else {
$this->initRecordList();
$this->initActions();
$this->createFormFields();
}
if (!is_null($this->redirectAddress)) {
CoreUtils::redirect($this->redirectAddress);
}
}
示例14: redirectToPage
protected function redirectToPage($url, $layoutType)
{
switch ($layoutType) {
case 'standard':
CoreUtils::redirect($url);
case 'thickbox':
throw new CoreException('Can\'t redirect from standard layout to thickbox.');
default:
throw new CoreException('Unknown layout type ' . $layoutType);
}
}
开发者ID:piotrPiechura,项目名称:3dPathProject,代码行数:11,代码来源:WebsiteAbstractControllerStandardLayout.class.php
示例15: initRecord
protected function initRecord()
{
if ($this->hasSWFUpload()) {
$id = CoreServices::get('request')->getFromRequest('id');
if (!empty($id)) {
$this->record = $this->dao->getRecordById($id);
if (empty($this->record['id'])) {
CoreServices::get('db')->transactionCommit();
CoreUtils::redirect($this->getListPageAddress());
}
} else {
$this->record = $this->dao->getRecordTemplate();
$this->initTmpRecord();
}
$this->initMultiselectRelations();
$this->recordOldValues = $this->record;
// clone!
$this->checkUserPermissionsForRecord();
} else {
parent::initRecord();
}
}
开发者ID:piotrPiechura,项目名称:3dPathProject,代码行数:22,代码来源:CMSAbstractControllerEditWithFileUpload.class.php