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


PHP Input::setPost方法代码示例

本文整理汇总了PHP中Contao\Input::setPost方法的典型用法代码示例。如果您正苦于以下问题:PHP Input::setPost方法的具体用法?PHP Input::setPost怎么用?PHP Input::setPost使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Contao\Input的用法示例。


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

示例1: onImportUser

 /**
  * Contao ImportUser Hook Implementation
  *
  * Imports a user from phpbb if login credentials match
  *
  * @param $username
  * @param $password
  * @param $scope
  * @return bool
  */
 public function onImportUser($username, $password, $scope)
 {
     if ($scope == 'tl_member') {
         // Before we try to import a user, we must check is username is maybe = username_clean
         // We already now that the user could not be found by username column
         if (($real_username = $this->findByCleanUsername($username)) != '') {
             // So we found the user by it's clean username, then we overwrite the POST Value
             // because contao will recheck it.
             Input::setPost('username', $real_username);
             return true;
         }
         $loginResult = System::getContainer()->get('phpbb_bridge.connector')->validateLogin($username, $password);
         // Only import user if login to forum succeeded
         if ($loginResult === true) {
             System::log("Trying to import User: " . $username, __METHOD__, TL_ACCESS);
             // Try to import the user to contao (tl_member / frontend)
             $importResult = System::getContainer()->get('phpbb_bridge.connector')->importUser($username, $password);
             return $importResult;
             // Should usually be true
         }
     }
     return false;
 }
开发者ID:ctsmedia,项目名称:contao-phpbb-bridge-bundle,代码行数:33,代码来源:ContaoFrontendListener.php

示例2: saveClassesToCssClass

 /**
  * @param array $arrClasses
  * @param DataContainer $dc
  */
 protected function saveClassesToCssClass(array $arrClasses, DataContainer $dc)
 {
     $strCssClassName = $this->getCssClassName($dc->id);
     $strClasses = implode(' ', $arrClasses);
     $strClasses = str_replace('  ', ' ', $strClasses);
     $strClasses = trim($strClasses);
     $dc->activeRecord->cssClass = $strClasses;
     Input::setPost($strCssClassName, $strClasses);
     $objDatabase = Database::getInstance();
     $objDatabase->prepare("UPDATE {$dc->table} SET cssClass=? WHERE id=?")->execute($strClasses, $dc->id);
 }
开发者ID:craffft,项目名称:css-style-selector-bundle,代码行数:15,代码来源:CssStyleSelectorUtil.php

示例3: validateWidget

 /**
  * Validate the widget using the value.
  *
  * @param Widget      $widget The widget to validate.
  *
  * @param string|null $value  The value to validate.
  *
  * @return void
  *
  * @SuppressWarnings(PHPMD.Superglobals)
  * @SuppressWarnings(PHPMD.CamelCaseVariableName)
  */
 protected function validateWidget($widget, $value)
 {
     if (null === $value) {
         return;
     }
     $name = $widget->name;
     // Backup $_POST value.
     $keeper = Input::post($name);
     Input::setPost($name, $value);
     $widget->validate();
     // Restore $_POST value.
     Input::setPost($name, $keeper);
 }
开发者ID:metamodels,项目名称:core,代码行数:25,代码来源:Simple.php

示例4: setPostPassword

 /**
  * @param $strNewPassword
  * @param null $intId
  */
 protected function setPostPassword($strNewPassword, $intId = null)
 {
     if (Input::get('act') == 'editAll' && is_numeric($intId)) {
         Input::setPost('password_' . $intId, $strNewPassword);
         Input::setPost('password_' . $intId . '_confirm', $strNewPassword);
     } else {
         Input::setPost('password', $strNewPassword);
         Input::setPost('password_confirm', $strNewPassword);
     }
 }
开发者ID:craffft,项目名称:accountmail-bundle,代码行数:14,代码来源:Account.php

示例5: generate

 /**
  * Display a login form
  *
  * @return string
  */
 public function generate()
 {
     if (TL_MODE == 'BE') {
         /** @var BackendTemplate|object $objTemplate */
         $objTemplate = new \BackendTemplate('be_wildcard');
         $objTemplate->wildcard = '### ' . Utf8::strtoupper($GLOBALS['TL_LANG']['FMD']['login'][0]) . ' ###';
         $objTemplate->title = $this->headline;
         $objTemplate->id = $this->id;
         $objTemplate->link = $this->name;
         $objTemplate->href = 'contao/main.php?do=themes&table=tl_module&act=edit&id=' . $this->id;
         return $objTemplate->parse();
     }
     // Set the last page visited
     if (!$_POST && $this->redirectBack) {
         $_SESSION['LAST_PAGE_VISITED'] = $this->getReferer();
     }
     // Login
     if (\Input::post('FORM_SUBMIT') == 'tl_login_' . $this->id) {
         // Check whether username and password are set
         if (empty($_POST['username']) || empty($_POST['password'])) {
             \System::getContainer()->get('session')->getFlashBag()->set($this->strFlashType, $GLOBALS['TL_LANG']['MSC']['emptyField']);
             $this->reload();
         }
         $this->import('FrontendUser', 'User');
         $strRedirect = \Environment::get('request');
         // Redirect to the last page visited
         if ($this->redirectBack && $_SESSION['LAST_PAGE_VISITED'] != '') {
             $strRedirect = $_SESSION['LAST_PAGE_VISITED'];
         } else {
             // Redirect to the jumpTo page
             if ($this->jumpTo && ($objTarget = $this->objModel->getRelated('jumpTo')) instanceof PageModel) {
                 /** @var PageModel $objTarget */
                 $strRedirect = $objTarget->getFrontendUrl();
             }
             // Overwrite the jumpTo page with an individual group setting
             $objMember = \MemberModel::findByUsername(\Input::post('username'));
             if ($objMember !== null) {
                 $arrGroups = \StringUtil::deserialize($objMember->groups);
                 if (!empty($arrGroups) && is_array($arrGroups)) {
                     $objGroupPage = \PageModel::findFirstActiveByMemberGroups($arrGroups);
                     if ($objGroupPage !== null) {
                         $strRedirect = $objGroupPage->getFrontendUrl();
                     }
                 }
             }
         }
         // Auto login is not allowed
         if (isset($_POST['autologin']) && !$this->autologin) {
             unset($_POST['autologin']);
             \Input::setPost('autologin', null);
         }
         // Login and redirect
         if ($this->User->login()) {
             $this->redirect($strRedirect);
         }
         $this->reload();
     }
     // Logout and redirect to the website root if the current page is protected
     if (\Input::post('FORM_SUBMIT') == 'tl_logout_' . $this->id) {
         /** @var PageModel $objPage */
         global $objPage;
         $this->import('FrontendUser', 'User');
         $strRedirect = \Environment::get('request');
         // Redirect to last page visited
         if ($this->redirectBack && strlen($_SESSION['LAST_PAGE_VISITED'])) {
             $strRedirect = $_SESSION['LAST_PAGE_VISITED'];
         } elseif ($objPage->protected) {
             $strRedirect = \Environment::get('base');
         }
         // Logout and redirect
         if ($this->User->logout()) {
             $this->redirect($strRedirect);
         }
         $this->reload();
     }
     return parent::generate();
 }
开发者ID:contao,项目名称:core-bundle,代码行数:82,代码来源:ModuleLogin.php

示例6: addFileMetaInformationToRequest

 /**
  * Add the file meta information to the request
  *
  * @param string  $strUuid
  * @param string  $strPtable
  * @param integer $intPid
  */
 public static function addFileMetaInformationToRequest($strUuid, $strPtable, $intPid)
 {
     $objFile = \FilesModel::findByUuid($strUuid);
     if ($objFile === null) {
         return;
     }
     $arrMeta = \StringUtil::deserialize($objFile->meta);
     if (empty($arrMeta)) {
         return;
     }
     $objPage = null;
     if ($strPtable == 'tl_article') {
         $objPage = \PageModel::findOneBy(array('tl_page.id=(SELECT pid FROM tl_article WHERE id=?)'), $intPid);
     } else {
         // HOOK: support custom modules
         if (isset($GLOBALS['TL_HOOKS']['addFileMetaInformationToRequest']) && is_array($GLOBALS['TL_HOOKS']['addFileMetaInformationToRequest'])) {
             foreach ($GLOBALS['TL_HOOKS']['addFileMetaInformationToRequest'] as $callback) {
                 if (($val = \System::importStatic($callback[0])->{$callback[1]}($strPtable, $intPid)) !== false) {
                     $objPage = $val;
                 }
             }
             if ($objPage instanceof Result && $objPage->numRows < 1) {
                 return;
             }
             if (is_object($objPage) && !$objPage instanceof PageModel) {
                 $objPage = \PageModel::findByPk($objPage->id);
             }
         }
     }
     if ($objPage === null) {
         return;
     }
     $objPage->loadDetails();
     // Convert the language to a locale (see #5678)
     $strLanguage = str_replace('-', '_', $objPage->rootLanguage);
     if (isset($arrMeta[$strLanguage])) {
         if (\Input::post('title') == '' && !empty($arrMeta[$strLanguage]['title'])) {
             \Input::setPost('title', $arrMeta[$strLanguage]['title']);
         }
         if (\Input::post('alt') == '' && !empty($arrMeta[$strLanguage]['alt'])) {
             \Input::setPost('alt', $arrMeta[$strLanguage]['alt']);
         }
         if (\Input::post('caption') == '' && !empty($arrMeta[$strLanguage]['caption'])) {
             \Input::setPost('caption', $arrMeta[$strLanguage]['caption']);
         }
     }
 }
开发者ID:contao,项目名称:core-bundle,代码行数:54,代码来源:Backend.php

示例7: importUser

 /**
  * Imports a user from phpbb to contao
  *
  * @param $username
  * @param $password
  * @return bool
  * @throws \Exception
  */
 public function importUser($username, $password)
 {
     if ($this->debug) {
         System::log("phpbb_bridge: " . __METHOD__, __METHOD__, TL_ACCESS);
     }
     // Find User in forum
     $user = $this->getUser($username);
     if ($user) {
         System::log('Importing User ' . $username, __METHOD__, TL_ACCESS);
         // Try to find user by real username if he entered username_clean
         // he may not be imported yet with it's clean username
         $contaoUser = MemberModel::findByUsername($user->username);
         if (null == $contaoUser) {
             $contaoUser = new MemberModel();
         }
         $contaoUser->username = $user->username;
         $contaoUser->username_clean = $user->username_clean;
         $contaoUser->email = $user->user_email;
         $contaoUser->firstname = 'Vorname';
         $contaoUser->lastname = 'Nachname';
         $contaoUser->password = Encryption::hash($password);
         $contaoUser->login = 1;
         $contaoUser->tstamp = $contaoUser->dateAdded = time();
         $contaoUser->groups = $this->getForumMemberGroupIds(true);
         // @todo add try catch, make it more safe, logout phpbb user on fail?
         $contaoUser->save();
         System::log('User imported: ' . $contaoUser->username, __METHOD__, TL_ACCESS);
         // username_clean used for login
         if ($username != $contaoUser->username) {
             Input::setPost('username', $contaoUser->username);
         }
         return true;
     } else {
         System::log($username . ' could not be found in phpbb db', __METHOD__, TL_ACCESS);
         return false;
     }
 }
开发者ID:ctsmedia,项目名称:contao-phpbb-bridge-bundle,代码行数:45,代码来源:Connector.php

示例8: addFileMetaInformationToRequest

 /**
  * Add the file meta information to the request
  *
  * @param string  $strUuid
  * @param string  $strPtable
  * @param integer $intPid
  */
 public static function addFileMetaInformationToRequest($strUuid, $strPtable, $intPid)
 {
     $objFile = \FilesModel::findByUuid($strUuid);
     if ($objFile === null) {
         return;
     }
     $arrMeta = deserialize($objFile->meta);
     if (empty($arrMeta)) {
         return;
     }
     $objPage = null;
     $db = \Database::getInstance();
     switch ($strPtable) {
         case 'tl_article':
             $objPage = $db->prepare("SELECT * FROM tl_page WHERE id=(SELECT pid FROM tl_article WHERE id=?)")->execute($intPid);
             break;
         case 'tl_news':
             $objPage = $db->prepare("SELECT * FROM tl_page WHERE id=(SELECT jumpTo FROM tl_news_archive WHERE id=(SELECT pid FROM tl_news WHERE id=?))")->execute($intPid);
             break;
         case 'tl_news_archive':
             $objPage = $db->prepare("SELECT * FROM tl_page WHERE id=(SELECT jumpTo FROM tl_news_archive WHERE id=?)")->execute($intPid);
             break;
         case 'tl_calendar_events':
             $objPage = $db->prepare("SELECT * FROM tl_page WHERE id=(SELECT jumpTo FROM tl_calendar WHERE id=(SELECT pid FROM tl_calendar_events WHERE id=?))")->execute($intPid);
             break;
         case 'tl_calendar':
             $objPage = $db->prepare("SELECT * FROM tl_page WHERE id=(SELECT jumpTo FROM tl_calendar WHERE id=?)")->execute($intPid);
             break;
         case 'tl_faq_category':
             $objPage = $db->prepare("SELECT * FROM tl_page WHERE id=(SELECT jumpTo FROM tl_faq_category WHERE id=?)")->execute($intPid);
             break;
         default:
             // HOOK: support custom modules
             if (isset($GLOBALS['TL_HOOKS']['addFileMetaInformationToRequest']) && is_array($GLOBALS['TL_HOOKS']['addFileMetaInformationToRequest'])) {
                 foreach ($GLOBALS['TL_HOOKS']['addFileMetaInformationToRequest'] as $callback) {
                     if (($val = \System::importStatic($callback[0])->{$callback[1]}($strPtable, $intPid)) !== false) {
                         $objPage = $val;
                     }
                 }
             }
             break;
     }
     if ($objPage === null || $objPage->numRows < 1) {
         return;
     }
     $objModel = new \PageModel();
     $objModel->setRow($objPage->row());
     $objModel->loadDetails();
     // Convert the language to a locale (see #5678)
     $strLanguage = str_replace('-', '_', $objModel->rootLanguage);
     if (isset($arrMeta[$strLanguage])) {
         if (\Input::post('alt') == '' && !empty($arrMeta[$strLanguage]['title'])) {
             \Input::setPost('alt', $arrMeta[$strLanguage]['title']);
         }
         if (\Input::post('caption') == '' && !empty($arrMeta[$strLanguage]['caption'])) {
             \Input::setPost('caption', $arrMeta[$strLanguage]['caption']);
         }
     }
 }
开发者ID:Mozan,项目名称:core-bundle,代码行数:66,代码来源:Backend.php


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