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


PHP Utility\HttpUtility类代码示例

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


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

示例1: main

 /**
  * Main function
  * Will issue a location-header, redirecting either BACK or to a new alt_doc.php instance...
  *
  * @return void
  * @todo Define visibility
  */
 public function main()
 {
     // Get this record
     $origRow = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord($this->P['table'], $this->P['uid']);
     // Get TSconfig for it.
     $TSconfig = \TYPO3\CMS\Backend\Utility\BackendUtility::getTCEFORM_TSconfig($this->table, is_array($origRow) ? $origRow : array('pid' => $this->P['pid']));
     // Set [params][pid]
     if (substr($this->P['params']['pid'], 0, 3) == '###' && substr($this->P['params']['pid'], -3) == '###') {
         $this->pid = intval($TSconfig['_' . substr($this->P['params']['pid'], 3, -3)]);
     } else {
         $this->pid = intval($this->P['params']['pid']);
     }
     // Make redirect:
     // If pid is blank OR if id is set, then return...
     if (!strcmp($this->pid, '') || strcmp($this->id, '')) {
         $redirectUrl = \TYPO3\CMS\Core\Utility\GeneralUtility::sanitizeLocalUrl($this->P['returnUrl']);
     } else {
         // Otherwise, show the list:
         $urlParameters = array();
         $urlParameters['id'] = $this->pid;
         $urlParameters['table'] = $this->P['params']['table'];
         $urlParameters['returnUrl'] = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REQUEST_URI');
         $redirectUrl = \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('web_list', $urlParameters);
     }
     \TYPO3\CMS\Core\Utility\HttpUtility::redirect($redirectUrl);
 }
开发者ID:noxludo,项目名称:TYPO3v4-Core,代码行数:33,代码来源:ListController.php

示例2: execute

 /**
  * Set defaults of auto configuration, mark installation as completed
  *
  * @return array<\TYPO3\CMS\Install\Status\StatusInterface>
  */
 public function execute()
 {
     /** @var \TYPO3\CMS\Install\Configuration\FeatureManager $featureManager */
     $featureManager = $this->objectManager->get('TYPO3\\CMS\\Install\\Configuration\\FeatureManager');
     // Get best matching configuration presets
     $configurationValues = $featureManager->getBestMatchingConfigurationForAllFeatures();
     // let the admin user redirect to the distributions page on first login
     if (isset($this->postValues['values']['loaddistributions'])) {
         // update the admin backend user to show the distribution management on login
         $adminUserFirstLogin = array('startModuleOnFirstLogin' => 'tools_ExtensionmanagerExtensionmanager->tx_extensionmanager_tools_extensionmanagerextensionmanager%5Baction%5D=distributions&tx_extensionmanager_tools_extensionmanagerextensionmanager%5Bcontroller%5D=List', 'ucSetByInstallTool' => '1');
         $this->getDatabaseConnection()->exec_UPDATEquery('be_users', 'admin=1', array('uc' => serialize($adminUserFirstLogin)));
     }
     // Setting SYS/isInitialInstallationInProgress to FALSE marks this instance installation as complete
     $configurationValues['SYS/isInitialInstallationInProgress'] = FALSE;
     /** @var $configurationManager \TYPO3\CMS\Core\Configuration\ConfigurationManager */
     $configurationManager = $this->objectManager->get('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager');
     $configurationManager->setLocalConfigurationValuesByPathValuePairs($configurationValues);
     /** @var \TYPO3\CMS\Install\Service\SessionService $session */
     $session = $this->objectManager->get('TYPO3\\CMS\\Install\\Service\\SessionService');
     $session->destroySession();
     /** @var $formProtection \TYPO3\CMS\Core\FormProtection\InstallToolFormProtection */
     $formProtection = \TYPO3\CMS\Core\FormProtection\FormProtectionFactory::get('TYPO3\\CMS\\Core\\FormProtection\\InstallToolFormProtection');
     $formProtection->clean();
     if (!EnableFileService::isInstallToolEnableFilePermanent()) {
         EnableFileService::removeInstallToolEnableFile();
     }
     \TYPO3\CMS\Core\Utility\HttpUtility::redirect('../../../index.php', \TYPO3\CMS\Core\Utility\HttpUtility::HTTP_STATUS_303);
 }
开发者ID:khanhdeux,项目名称:typo3test,代码行数:33,代码来源:DefaultConfiguration.php

示例3: isValid

 /**
  * Check whether the vote exists or not.
  *
  * @param Vote $vote
  * @return void
  */
 public function isValid($vote)
 {
     if ($this->getVoteRepository()->exists($vote)) {
         print 'Sorry, a vote already exists for this object.';
         HttpUtility::setResponseCodeAndExit(HttpUtility::HTTP_STATUS_403);
     }
 }
开发者ID:visol,项目名称:ext-votable,代码行数:13,代码来源:VoteDoesNotExistValidator.php

示例4: main

 /**
  * Processed Backend session creation and redirect to backend.php
  *
  * @return 	void
  */
 public function main()
 {
     if ($GLOBALS['BE_USER']->user['uid']) {
         \TYPO3\CMS\Core\Utility\GeneralUtility::cleanOutputBuffers();
         $backendURL = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . TYPO3_mainDir . 'backend.php';
         \TYPO3\CMS\Core\Utility\HttpUtility::redirect($backendURL);
     }
 }
开发者ID:noxludo,项目名称:TYPO3v4-Core,代码行数:13,代码来源:OpenidReturn.php

示例5: execute

    /**
     * Set defaults of auto configuration, mark installation as completed
     *
     * @return array<\TYPO3\CMS\Install\Status\StatusInterface>
     */
    public function execute()
    {
        /** @var \TYPO3\CMS\Install\Configuration\FeatureManager $featureManager */
        $featureManager = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Configuration\FeatureManager::class);
        // Get best matching configuration presets
        $configurationValues = $featureManager->getBestMatchingConfigurationForAllFeatures();
        // let the admin user redirect to the distributions page on first login
        switch ($this->postValues['values']['sitesetup']) {
            // Update the admin backend user to show the distribution management on login
            case 'loaddistribution':
                $adminUserFirstLogin = array('startModuleOnFirstLogin' => 'tools_ExtensionmanagerExtensionmanager->tx_extensionmanager_tools_extensionmanagerextensionmanager%5Baction%5D=distributions&tx_extensionmanager_tools_extensionmanagerextensionmanager%5Bcontroller%5D=List', 'ucSetByInstallTool' => '1');
                $this->getDatabaseConnection()->exec_UPDATEquery('be_users', 'admin=1', array('uc' => serialize($adminUserFirstLogin)));
                break;
                // Create a page with UID 1 and PID1 and fluid_styled_content for page TS config, respect ownership
            // Create a page with UID 1 and PID1 and fluid_styled_content for page TS config, respect ownership
            case 'createsite':
                $this->getDatabaseConnection()->exec_INSERTquery('pages', array('pid' => 0, 'crdate' => time(), 'cruser_id' => 1, 'tstamp' => time(), 'title' => 'Home', 'doktype' => 1, 'is_siteroot' => 1, 'perms_userid' => 1, 'perms_groupid' => 1, 'perms_user' => 32, 'perms_group' => 32, 'perms_everybody' => 1));
                $pageUid = $this->getDatabaseConnection()->sql_insert_id();
                // add a root sys_template with fluid_styled_content and a default PAGE typoscript snippet
                $this->getDatabaseConnection()->exec_INSERTquery('sys_template', array('pid' => $pageUid, 'crdate' => time(), 'cruser_id' => 1, 'tstamp' => time(), 'title' => 'Main TypoScript Rendering', 'sitetitle' => $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'], 'root' => 1, 'clear' => 1, 'include_static_file' => 'EXT:fluid_styled_content/Configuration/TypoScript/Static/,EXT:fluid_styled_content/Configuration/TypoScript/Styling/', 'constants' => '', 'config' => 'page = PAGE
page.10 = TEXT
page.10.value (
   <div style="width: 800px; margin: 15% auto;">
      <div style="width: 300px;">
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 150 42"><path d="M60.2 14.4v27h-3.8v-27h-6.7v-3.3h17.1v3.3h-6.6zm20.2 12.9v14h-3.9v-14l-7.7-16.2h4.1l5.7 12.2 5.7-12.2h3.9l-7.8 16.2zm19.5 2.6h-3.6v11.4h-3.8V11.1s3.7-.3 7.3-.3c6.6 0 8.5 4.1 8.5 9.4 0 6.5-2.3 9.7-8.4 9.7m.4-16c-2.4 0-4.1.3-4.1.3v12.6h4.1c2.4 0 4.1-1.6 4.1-6.3 0-4.4-1-6.6-4.1-6.6m21.5 27.7c-7.1 0-9-5.2-9-15.8 0-10.2 1.9-15.1 9-15.1s9 4.9 9 15.1c.1 10.6-1.8 15.8-9 15.8m0-27.7c-3.9 0-5.2 2.6-5.2 12.1 0 9.3 1.3 12.4 5.2 12.4 3.9 0 5.2-3.1 5.2-12.4 0-9.4-1.3-12.1-5.2-12.1m19.9 27.7c-2.1 0-5.3-.6-5.7-.7v-3.1c1 .2 3.7.7 5.6.7 2.2 0 3.6-1.9 3.6-5.2 0-3.9-.6-6-3.7-6H138V24h3.1c3.5 0 3.7-3.6 3.7-5.3 0-3.4-1.1-4.8-3.2-4.8-1.9 0-4.1.5-5.3.7v-3.2c.5-.1 3-.7 5.2-.7 4.4 0 7 1.9 7 8.3 0 2.9-1 5.5-3.3 6.3 2.6.2 3.8 3.1 3.8 7.3 0 6.6-2.5 9-7.3 9"/><path fill="#FF8700" d="M31.7 28.8c-.6.2-1.1.2-1.7.2-5.2 0-12.9-18.2-12.9-24.3 0-2.2.5-3 1.3-3.6C12 1.9 4.3 4.2 1.9 7.2 1.3 8 1 9.1 1 10.6c0 9.5 10.1 31 17.3 31 3.3 0 8.8-5.4 13.4-12.8M28.4.5c6.6 0 13.2 1.1 13.2 4.8 0 7.6-4.8 16.7-7.2 16.7-4.4 0-9.9-12.1-9.9-18.2C24.5 1 25.6.5 28.4.5"/></svg>
      </div>
      <h4 style="font-family: sans-serif;">Welcome to a default website made with <a href="https://typo3.org">TYPO3</a></h4>
   </div>
)
page.100 < styles.content.get', 'description' => 'This is an Empty Site Package TypoScript template.

For each website you need a TypoScript template on the main page of your website (on the top level). For better maintenance all TypoScript should be extracted into external files via <INCLUDE_TYPOSCRIPT: source="FILE:EXT:site_myproject/Configuration/TypoScript/setup.ts">.'));
                break;
        }
        // Setting SYS/isInitialInstallationInProgress to FALSE marks this instance installation as complete
        $configurationValues['SYS/isInitialInstallationInProgress'] = false;
        // Mark upgrade wizards as done
        $this->loadExtLocalconfDatabaseAndExtTables();
        if (!empty($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'])) {
            $registry = GeneralUtility::makeInstance(Registry::class);
            foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'] as $updateClassName) {
                $registry->set('installUpdate', $updateClassName, 1);
            }
        }
        /** @var $configurationManager \TYPO3\CMS\Core\Configuration\ConfigurationManager */
        $configurationManager = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Configuration\ConfigurationManager::class);
        $configurationManager->setLocalConfigurationValuesByPathValuePairs($configurationValues);
        /** @var \TYPO3\CMS\Install\Service\SessionService $session */
        $session = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Service\SessionService::class);
        $session->destroySession();
        /** @var $formProtection \TYPO3\CMS\Core\FormProtection\InstallToolFormProtection */
        $formProtection = \TYPO3\CMS\Core\FormProtection\FormProtectionFactory::get(\TYPO3\CMS\Core\FormProtection\InstallToolFormProtection::class);
        $formProtection->clean();
        if (!EnableFileService::isInstallToolEnableFilePermanent()) {
            EnableFileService::removeInstallToolEnableFile();
        }
        \TYPO3\CMS\Core\Utility\HttpUtility::redirect('../../../index.php', \TYPO3\CMS\Core\Utility\HttpUtility::HTTP_STATUS_303);
    }
开发者ID:dachcom-digital,项目名称:TYPO3.CMS,代码行数:63,代码来源:DefaultConfiguration.php

示例6: redirectToPage

 /**
  * Redirect to a page with given id
  *
  * @param integer $pageId
  *
  * @return void
  */
 protected function redirectToPage($pageId)
 {
     /** @var \TYPO3\CMS\Extbase\Object\ObjectManager $objectManager */
     $objectManager = GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\ObjectManager::class);
     /** @var \TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder $uriBuilder */
     $uriBuilder = $objectManager->get(\TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder::class);
     $url = $uriBuilder->setTargetPageUid($pageId)->build();
     \TYPO3\CMS\Core\Utility\HttpUtility::redirect($url);
 }
开发者ID:electricretina,项目名称:sf_register,代码行数:16,代码来源:FeuserControllerSignal.php

示例7: redirectToUriFinisher

 /**
  * Redirect user after form submit
  *
  * @return void
  */
 public function redirectToUriFinisher()
 {
     /** @var RedirectUriService $redirectService */
     $redirectService = $this->objectManager->get(RedirectUriService::class, $this->contentObject);
     $uri = $redirectService->getRedirectUri();
     if (!empty($uri) && $this->isRedirectEnabled()) {
         HttpUtility::redirect($uri);
     }
 }
开发者ID:VladStawizki,项目名称:ipl-logistik.de,代码行数:14,代码来源:RedirectFinisher.php

示例8: switchBack

 /**
  * Switch backend user session.
  *
  * @param array $params
  * @param AbstractUserAuthentication $authentication
  * @see AbstractUserAuthentication
  * @return void
  */
 public function switchBack($params, AbstractUserAuthentication $authentication)
 {
     if ($this->isAHandledBackendSession($authentication)) {
         $objectManager = GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\ObjectManager::class);
         $backendUserSessionRepository = $objectManager->get(\TYPO3\CMS\Beuser\Domain\Repository\BackendUserSessionRepository::class);
         $backendUserSessionRepository->switchBackToOriginalUser($authentication);
         HttpUtility::redirect(\TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('main'));
     }
 }
开发者ID:rickymathew,项目名称:TYPO3.CMS,代码行数:17,代码来源:SwitchBackUserHook.php

示例9: switchBack

 /**
  * Switch backend user session.
  *
  * @param array $params
  * @param AbstractUserAuthentication $authentication
  * @see AbstractUserAuthentication
  * @return void
  */
 public function switchBack($params, AbstractUserAuthentication $authentication)
 {
     if ($this->isAHandledBackendSession($authentication)) {
         $objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
         $backendUserSessionRepository = $objectManager->get('TYPO3\\CMS\\Beuser\\Domain\\Repository\\BackendUserSessionRepository');
         $backendUserSessionRepository->switchBackToOriginalUser($authentication);
         \TYPO3\CMS\Core\Utility\HttpUtility::redirect($GLOBALS['BACK_PATH'] . 'backend.php');
     }
 }
开发者ID:khanhdeux,项目名称:typo3test,代码行数:17,代码来源:SwitchBackUserHook.php

示例10: redirectToUriFinisher

 /**
  * Redirect user after form submit
  *
  * @return void
  */
 public function redirectToUriFinisher()
 {
     /** @var RedirectUriService $redirectService */
     $redirectService = $this->objectManager->get('In2code\\Powermail\\Domain\\Service\\RedirectUriService', $this->contentObject);
     $uri = $redirectService->getRedirectUri();
     if (!empty($uri) && $this->isRedirectEnabled()) {
         HttpUtility::redirect($uri);
     }
 }
开发者ID:bernhardberger,项目名称:powermail,代码行数:14,代码来源:RedirectFinisher.php

示例11: logout

 /**
  * Performs the logout processing
  *
  * @return void
  */
 public function logout()
 {
     // Logout written to log
     $GLOBALS['BE_USER']->writelog(255, 2, 0, 1, 'User %s logged out from TYPO3 Backend', array($GLOBALS['BE_USER']->user['username']));
     \TYPO3\CMS\Core\FormProtection\FormProtectionFactory::get()->removeSessionTokenFromRegistry();
     $GLOBALS['BE_USER']->logoff();
     $redirect = GeneralUtility::sanitizeLocalUrl(GeneralUtility::_GP('redirect'));
     $redirectUrl = $redirect ? $redirect : 'index.php';
     \TYPO3\CMS\Core\Utility\HttpUtility::redirect($redirectUrl);
 }
开发者ID:Mr-Robota,项目名称:TYPO3.CMS,代码行数:15,代码来源:LogoutController.php

示例12: logout

 /**
  * Performs the logout processing
  *
  * @return void
  */
 public function logout()
 {
     // Logout written to log
     $this->getBackendUser()->writelog(255, 2, 0, 1, 'User %s logged out from TYPO3 Backend', array($this->getBackendUser()->user['username']));
     /** @var \TYPO3\CMS\Core\FormProtection\BackendFormProtection $backendFormProtection */
     $backendFormProtection = FormProtectionFactory::get();
     $backendFormProtection->removeSessionTokenFromRegistry();
     $this->getBackendUser()->logoff();
     $redirect = GeneralUtility::sanitizeLocalUrl(GeneralUtility::_GP('redirect'));
     $redirectUrl = $redirect ? $redirect : 'index.php';
     HttpUtility::redirect($redirectUrl);
 }
开发者ID:plan2net,项目名称:TYPO3.CMS,代码行数:17,代码来源:LogoutController.php

示例13: switchBack

 /**
  * Switch backen user session
  *
  * @param array $params
  * @param \TYPO3\CMS\Core\Authentication\AbstractUserAuthentication $that
  * @see t3lib_userauth::logoff()
  * @todo Define visibility
  */
 public function switchBack($params, $that)
 {
     // Is a backend session handled?
     if ($that->session_table !== 'be_sessions' || !$that->user['uid'] || !$that->user['ses_backuserid']) {
         return;
     }
     // @TODO: Move update functionality to Tx_Beuser_Domain_Repository_BackendUserSessionRepository
     $updateData = array('ses_userid' => $that->user['ses_backuserid'], 'ses_backuserid' => 0);
     $GLOBALS['TYPO3_DB']->exec_UPDATEquery('be_sessions', 'ses_id = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr($GLOBALS['BE_USER']->id, 'be_sessions') . ' AND ses_name = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr(\TYPO3\CMS\Core\Authentication\BackendUserAuthentication::getCookieName(), 'be_sessions') . ' AND ses_userid=' . intval($GLOBALS['BE_USER']->user['uid']), $updateData);
     $redirectUrl = $GLOBALS['BACK_PATH'] . 'index.php' . ($GLOBALS['TYPO3_CONF_VARS']['BE']['interfaces'] ? '' : '?commandLI=1');
     \TYPO3\CMS\Core\Utility\HttpUtility::redirect($redirectUrl);
 }
开发者ID:noxludo,项目名称:TYPO3v4-Core,代码行数:20,代码来源:SwitchBackUserHook.php

示例14: sendHeaderAndFilename

 /**
  * Send the content type header and the right file extension in front of the content
  *
  * @param $contentType
  * @param $fileExtension
  */
 protected function sendHeaderAndFilename($contentType, $fileExtension)
 {
     $testMode = (bool) $this->settings['feed']['debugMode'];
     if ($testMode) {
         header('Content-Type: text/plain; charset=utf-8');
     } else {
         header('Content-Type: ' . $contentType . '; charset=utf-8');
         header('Content-Disposition: inline; filename=calendar.' . $fileExtension);
     }
     echo $this->response->getContent();
     HttpUtility::setResponseCodeAndExit(HttpUtility::HTTP_STATUS_200);
 }
开发者ID:mkalus,项目名称:calendarize,代码行数:18,代码来源:AbstractController.php

示例15: process

 /**
  * @param array $values
  * @param string $insertOrUpdate
  * @return array
  */
 public function process(array $values, $insertOrUpdate = '')
 {
     // Redirect
     if ($this->shouldDelete()) {
         // Reset values.
         $values = [];
         $values['tstamp'] = time();
         $values['deleted'] = 1;
         $tableName = $this->getTemplateService()->getPersistingTable();
         $this->getDatabaseConnection()->exec_UPDATEquery($tableName, $this->getClause(), $values);
         HttpUtility::redirect($this->getUrl());
     }
     return $values;
 }
开发者ID:Ecodev,项目名称:formule_newsletter,代码行数:19,代码来源:NewsletterDeleteProcessor.php


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