本文整理汇总了PHP中System::redirect方法的典型用法代码示例。如果您正苦于以下问题:PHP System::redirect方法的具体用法?PHP System::redirect怎么用?PHP System::redirect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System
的用法示例。
在下文中一共展示了System::redirect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: view
/**
* This method provides a generic item list overview.
*
* @param string $ot Treated object type.
* @param string $sort Sorting field.
* @param string $sortdir Sorting direction.
* @param int $pos Current pager position.
* @param int $num Amount of entries to display.
* @param string $tpl Name of alternative template (for alternative display options, feeds and xml output)
* @param boolean $raw Optional way to display a template instead of fetching it (needed for standalone output)
* @return mixed Output.
*/
public function view($args)
{
$ot = $this->request->getGet()->filter('ot', 'category', FILTER_SANITIZE_STRING);
$type = $this->request->getGet()->filter('type', 'user', FILTER_SANITIZE_STRING);
$func = $this->request->getGet()->filter('func', 'view', FILTER_SANITIZE_STRING);
if ($ot == 'category') {
$sortdir = ModUtil::getVar('MUBoard', 'sortingCategories');
}
if ($ot == 'posting') {
$sortdir = ModUtil::getVar('MUBoard', 'sortingPostings');
}
//view of postings is blocked
if ($ot == 'posting') {
return System::redirect(ModUtil::url($this->name, 'user', 'view'));
}
if (($ot == 'category' || $ot == 'forum') && $type == 'user') {
$args['sort'] = 'pos';
if ($sortdir == 'descending') {
$args['sortdir'] = 'desc';
} else {
$args['sortdir'] = 'asc';
}
}
// get actual time
$nowtime = DateUtil::getDatetime();
// set sessionvar with calling time
SessionUtil::setVar('muboardonline', $nowtime);
$lastlogin = SessionUtil::getVar('muboardonline');
$this->view->assign('func', $func)->assign('lastlogin', $lastlogin);
$dom = ZLanguage::getModuleDomain($this->name);
$sitename = ModUtil::getVar('ZConfig', 'sitename');
PageUtil::setVar('title', $sitename . ' - ' . __('Forum - Category Overview', $dom));
return parent::view($args);
}
示例2: confupdate
/**
* Update the configuration values
* @author: Sara Arjona Téllez (sarjona@xtec.cat)
* @params The config values from the form
* @return Thue if success
*/
public function confupdate($args) {
$skins = FormUtil::getPassedValue('skins', isset($args['skins']) ? $args['skins'] : null, 'POST');
$langs = FormUtil::getPassedValue('langs', isset($args['langs']) ? $args['langs'] : null, 'POST');
$maxdelivers = FormUtil::getPassedValue('maxdelivers', isset($args['maxdelivers']) ? $args['maxdelivers'] : null, 'POST');
$basedisturl = FormUtil::getPassedValue('basedisturl', isset($args['basedisturl']) ? $args['basedisturl'] : null, 'POST');
// Security check
if (!SecurityUtil::checkPermission('IWqv::', "::", ACCESS_ADMIN)) {
throw new Zikula_Exception_Forbidden();
}
// Confirm authorisation code
$this->checkCsrfToken();
if (isset($skins))
ModUtil::setVar('IWqv', 'skins', $skins);
if (isset($langs))
ModUtil::setVar('IWqv', 'langs', $langs);
if (isset($maxdelivers))
ModUtil::setVar('IWqv', 'maxdelivers', $maxdelivers);
if (isset($basedisturl))
ModUtil::setVar('IWqv', 'basedisturl', $basedisturl);
LogUtil::registerStatus($this->__f('Done! %1$s updated.', $this->__('settings')));
return System::redirect(ModUtil::url('IWqv', 'admin', 'main'));
}
示例3: edit
/**
* This method provides a generic handling of all edit requests.
*
* @param string $ot Treated object type.
* @param string $tpl Name of alternative template (for alternative display options, feeds and xml output)
* @param boolean $raw Optional way to display a template instead of fetching it (needed for standalone output)
*
* @return mixed Output.
*/
public function edit()
{
$id = $this->request->query->filter('id', 0);
if ($id > 0) {
$url = ModUtil::url($this->name, 'user', 'view');
return System::redirect($url);
}
$controllerHelper = new Reviews_Util_Controller($this->serviceManager);
// parameter specifying which type of objects we are treating
$objectType = $this->request->query->filter('ot', 'review', FILTER_SANITIZE_STRING);
$utilArgs = array('controller' => 'user', 'action' => 'edit');
if (!in_array($objectType, $controllerHelper->getObjectTypes('controllerAction', $utilArgs))) {
$objectType = $controllerHelper->getDefaultObjectType('controllerAction', $utilArgs);
}
$this->throwForbiddenUnless(SecurityUtil::checkPermission($this->name . ':' . ucwords($objectType) . ':', '::', ACCESS_EDIT), LogUtil::getErrorMsgPermission());
// create new Form reference
$view = FormUtil::newForm($this->name, $this);
// build form handler class name
$handlerClass = $this->name . '_Form_Handler_User_' . ucfirst($objectType) . '_Edit';
// determine the output template
$viewHelper = new Reviews_Util_View($this->serviceManager);
$template = $viewHelper->getViewTemplate($this->view, 'user', $objectType, 'edit', array());
// execute form using supplied template and page event handler
return $view->execute($template, new $handlerClass());
}
示例4: updateConfig
public function updateConfig($args)
{
// Security check
if (!SecurityUtil::checkPermission('SiriusXtecAuth::', '::', ACCESS_ADMIN)) {
return LogUtil::registerPermissionError();
}
$items = array( 'ldap_active' => FormUtil::getPassedValue('ldap_active', false, 'POST')?true:false,
'users_creation' => FormUtil::getPassedValue('users_creation', false, 'POST')?true:false,
'new_users_activation' => FormUtil::getPassedValue('new_users_activation', false, 'POST')?true:false,
'iw_write' => FormUtil::getPassedValue('iw_write', false, 'POST')?true:false,
'iw_lastnames' => FormUtil::getPassedValue('iw_lastnames', false, 'POST')?true:false,
'new_users_groups' => FormUtil::getPassedValue('new_users_groups', array(), 'POST'),
'ldap_server' => FormUtil::getPassedValue('ldap_server', false, 'POST'),
'ldap_basedn' => FormUtil::getPassedValue('ldap_basedn', false, 'POST'),
'ldap_searchattr' => FormUtil::getPassedValue('ldap_searchattr', false, 'POST'),
'loginXtecApps' => FormUtil::getPassedValue('loginXtecApps', false, 'POST'),
'logoutXtecApps' => FormUtil::getPassedValue('logoutXtecApps', false, 'POST'),
'gtafProtocol' => FormUtil::getPassedValue('gtafProtocol', false, 'POST'),
'e13Protocol' => FormUtil::getPassedValue('e13Protocol', false, 'POST'),
'gtafURL' => FormUtil::getPassedValue('gtafURL', false, 'POST'),
'e13URL' => FormUtil::getPassedValue('e13URL', false, 'POST'),
'loginTime' => FormUtil::getPassedValue('loginTime', false, 'POST'),
'logoutTime' => FormUtil::getPassedValue('logoutTime', false, 'POST'));
ModUtil::setVars($this->name,$items);
LogUtil::registerStatus($this->__('S\'ha actualitzat la configuració del mòdul.'));
return System::redirect(ModUtil::url('SiriusXtecAuth', 'admin', 'main'));
}
示例5: delete
function delete()
{
// security check
if (!SecurityUtil::checkPermission('AddressBook::', '::', ACCESS_ADMIN)) {
return LogUtil::registerPermissionError();
}
$ot = FormUtil::getPassedValue('ot', 'categories', 'GETPOST');
$id = (int) FormUtil::getPassedValue('id', 0, 'GETPOST');
$url = ModUtil::url('AddressBook', 'admin', 'view', array('ot' => $ot));
$class = 'AddressBook_DBObject_' . ucfirst($ot);
if (!class_exists($class)) {
return z_exit(__f('Error! Unable to load class [%s]', $ot));
}
$object = new $class();
$data = $object->get($id);
if (!$data) {
LogUtil::registerError(__f('%1$s with ID of %2$s doesn\'\\t seem to exist', array($ot, $id)));
return System::redirect($url);
}
$object->delete();
if ($ot == "customfield") {
$sql = "ALTER TABLE addressbook_address DROP adr_custom_" . $id;
try {
DBUtil::executeSQL($sql, -1, -1, true, true);
} catch (Exception $e) {
}
}
LogUtil::registerStatus($this->__('Done! Item deleted.'));
return System::redirect($url);
}
示例6: validate
/**
* Validate name for ID in URL and redirect if necessary
* @param string
* @param int
* @param string
*/
public static function validate($strKey, $intId, $strName)
{
$strValid = $intId . '-' . standardize($strName);
if (Input::getAutoItem($strKey) != $strValid) {
/** @type \PageModel $objPage */
global $objPage;
$strParams = '/' . $strValid;
// Check if key is auto_item enabled
if (!$GLOBALS['TL_CONFIG']['useAutoItem'] || !in_array($strKey, $GLOBALS['TL_AUTO_ITEM'])) {
$strParams = '/' . $strKey . $strParams;
}
\System::redirect($objPage->getFrontendUrl($strParams), 301);
}
}
示例7: run
/**
* Export data
*
* @access public
* @param string
* @return void
*/
public static function run($dc = null, $strName = 'formsubmissions', $blnHeaders = true)
{
if (!in_array('!composer', \ModuleLoader::getActive())) {
\Message::addError($GLOBALS['TL_LANG']['ERR']['exportExcelNoComposer']);
\System::redirect(str_ireplace('&key=exportExcel', '', \Environment::get('request')));
return;
}
if (!is_file(TL_ROOT . '/composer/vendor/phpoffice/phpexcel/Classes/PHPExcel.php')) {
\Message::addError($GLOBALS['TL_LANG']['ERR']['exportExcelNoPHPExcel']);
\System::redirect(str_ireplace('&key=exportExcel', '', \Environment::get('request')));
return;
}
parent::run($dc, $strName, $blnHeaders);
}
示例8: checkSessionFixation
/**
* Session fixation detection.
* This method should be called after succesfull login.
*/
public static function checkSessionFixation()
{
if (Config::SESSION_FIXATION_DETECTION_ENABLED !== true) {
return;
}
if (!isset($_SESSION[Config::SERVER_FQDN]["remote_addr"]) || !isset($_SESSION[Config::SERVER_FQDN]["http_user_agent"])) {
$_SESSION[Config::SERVER_FQDN]["remote_addr"] = $_SERVER["REMOTE_ADDR"];
$_SESSION[Config::SERVER_FQDN]["http_user_agent"] = $_SERVER["HTTP_USER_AGENT"];
} else {
if ($_SESSION[Config::SERVER_FQDN]["remote_addr"] !== $_SERVER["REMOTE_ADDR"] || $_SESSION[Config::SERVER_FQDN]["http_user_agent"] !== $_SERVER["HTTP_USER_AGENT"]) {
session_unset();
session_destroy();
System::redirect(Config::SITE_PATH . Config::SESSION_FIXATION_REDIRECT_PATH);
}
}
}
示例9: getYoutubeVideos
public function getYoutubeVideos($channelId = '', $collectionId = 0)
{
$dom = ZLanguage::getModuleDomain($this->name);
$youtubeApi = ModUtil::getVar($this->name, 'youtubeApi');
$collectionRepository = MUVideo_Util_Model::getCollectionRepository();
$collectionObject = $collectionRepository->selectById($collectionId);
$api = self::getData("https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=" . $channelId . "&key=" . $youtubeApi);
// https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=UCJC8ynLpY_q89tmNhqIf1Sg&key={YOUR_API_KEY}
//$api = self::getData("https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&playlistId={DEINE_PLAYLIST_ID}&maxResults=10&fields=items%2Fsnippet&key=" . $youtubeApi);
$videos = json_decode($api, true);
$movieRepository = MUVideo_Util_Model::getMovieRepository();
$where = 'tbl.urlOfYoutube != \'' . DataUtil::formatForStore('') . '\'';
// we look for movies with a youtube url entered
$existingYoutubeVideos = $movieRepository->selectWhere($where);
if ($existingYoutubeVideos && count($existingYoutubeVideos > 0)) {
foreach ($existingYoutubeVideos as $existingYoutubeVideo) {
$youtubeId = str_replace('https://www.youtube.com/watch?v=', '', $existingYoutubeVideo['urlOfYoutube']);
$videoIds[] = $youtubeId;
}
}
if (is_array($videos['items'])) {
foreach ($videos['items'] as $videoData) {
if (isset($videoData['id']['videoId'])) {
if (isset($videoIds) && is_array($videoIds)) {
if (in_array($videoData['id']['videoId'], $videoIds)) {
continue;
}
}
$serviceManager = ServiceUtil::getManager();
$entityManager = $serviceManager->getService('doctrine.entitymanager');
$newYoutubeVideo = new MUVideo_Entity_Movie();
$newYoutubeVideo->setTitle($videoData['snippet']['title']);
$newYoutubeVideo->setDescription($videoData['snippet']['description']);
$newYoutubeVideo->setUrlOfYoutube('https://www.youtube.com/watch?v=' . $videoData['id']['videoId']);
$newYoutubeVideo->setWidthOfMovie('400');
$newYoutubeVideo->setHeightOfMovie('300');
$newYoutubeVideo->setWorkflowState('approved');
$newYoutubeVideo->setCollection($collectionObject);
$entityManager->persist($newYoutubeVideo);
$entityManager->flush();
LogUtil::registerStatus(__('The movie', $dom) . ' ' . $videoData['snippet']['title'] . ' ' . __('was created and put into the collection', $dom) . ' ' . $collectionObject['title']);
}
}
}
$redirectUrl = ModUtil::url($this->name, 'user', 'display', array('ot' => 'collection', 'id' => $collectionId));
return System::redirect($redirectUrl);
}
示例10: handleCommand
/**
* Command event handler.
*
* This event handler is called when a command is issued by the user.
*/
public function handleCommand(Zikula_Form_View $view, &$args)
{
parent::HandleCommand($view, $args);
$dom = ZLanguage::getModuleDomain($this->name);
// we handle the redirect to the frontend after moving an issue
// to another forum
$work = $this->request->query->filter('work', 'none', FILTER_SANITIZE_STRING);
$id = $this->request->query->filter('id', 0, FILTER_SANITIZE_NUMBER_INT);
if ($id > 0) {
$url = ModUtil::url($this->name, 'user', 'display', array('ot' => 'posting', 'id' => $id));
return LogUtil::registerStatus(__('Done! Moving of issue successful.', $dom), $url);
} else {
$url = ModUtil::url($this->name, 'user');
LogUtil::registerError('Sorry! Moving the issue failed', $dom);
}
return System::redirect($url);
}
示例11: route
/**
* Redirects to a route.
*/
public function route()
{
$url = strtolower($_SERVER['REQUEST_URI']);
if (strpos($url, Configuration::WEB_ROOT) === 0) {
$url = substr($url, strlen(Configuration::WEB_ROOT));
}
$url = '/' . trim($url, '/');
foreach ($this->routes as $pattern => $callback) {
if (preg_match($pattern, $url, $params)) {
array_shift($params);
$actions = explode('/', $callback);
$class = $actions[0];
$function = $actions[1];
$this->matchfound = true;
$route = new $class();
call_user_func_array(array($route, $function), array_values($params));
}
}
if (!$this->matchfound) {
System::redirect(Configuration::NOTFOUND_URI);
}
}
示例12: compile
/**
* Generate module
*/
protected function compile()
{
// get all dca tables
foreach ($GLOBALS['BE_MOD'] as $groupName => $group) {
foreach ($group as $moduleName => $modules) {
if (is_array($modules['tables'])) {
foreach ($modules['tables'] as $table) {
$arrGroups[$groupName]['title'] = $GLOBALS['TL_LANG']['MOD'][$groupName];
$arrGroups[$groupName]['tables'][] = array($table, $GLOBALS['TL_LANG']['MOD'][$moduleName][0], $moduleName);
}
}
}
}
// handle submit
if (\Input::post('FORM_SUBMIT') == 'om_backend_id_search' && \Input::post('option')) {
// handle post data
$arrSelected = explode('::', \Input::post('option'));
// get data
$objData = $this->Database->prepare("SELECT * FROM " . $arrSelected[1] . " WHERE id=?")->execute(\Input::post('id'));
// id exists
if ($objData->numRows) {
// redirect
\System::redirect('contao/main.php?do=' . $arrSelected[0] . '&table=' . $arrSelected[1] . '&act=edit&id=' . \Input::post('id') . '&rt=' . $_SESSION['REQUEST_TOKEN']);
} else {
// error
$this->Template->id = \Input::post('id');
$this->Template->selected = $arrSelected[1];
$this->Template->error = sprintf($GLOBALS['TL_LANG']['om_backend']['error_id_not_found'], \Input::post('id'));
}
}
// set template vars
$this->Template->button = $GLOBALS['TL_LANG']['MSC']['backBT'];
$this->Template->title = specialchars($GLOBALS['TL_LANG']['MSC']['backBT']);
$this->Template->headline = $GLOBALS['TL_LANG']['aid_training_overview']['headline'];
$this->Template->groups = $arrGroups;
}
示例13: initialize
public static function initialize()
{
if (static::$blnInitialized === false) {
static::$blnInitialized = true;
// Make sure field data is available
Haste::getInstance()->call('loadDataContainer', 'tl_iso_product');
\System::loadLanguageFile('tl_iso_product');
// Initialize request cache for product list filters
if (\Input::get('isorc') != '') {
if (static::getRequestCache()->isEmpty()) {
global $objPage;
$objPage->noSearch = 1;
} elseif (static::getRequestCache()->id != \Input::get('isorc')) {
unset($_GET['isorc']);
// Unset the language parameter
if ($GLOBALS['TL_CONFIG']['addLanguageToUrl']) {
unset($_GET['language']);
}
$strQuery = http_build_query($_GET);
\System::redirect(preg_replace('/\\?.*$/i', '', \Environment::get('request')) . ($strQuery ? '?' . $strQuery : ''));
}
}
}
}
示例14: updateConf
/**
* Update the module configuration
* @author: Albert Pérez Monfort (aperezm@xtec.cat)
* @param: Configuration values
* @return: The form with needed to change the parameters
*/
public function updateConf($args) {
$friendsSystemAvailable = FormUtil::getPassedValue('friendsSystemAvailable', isset($args['friendsSystemAvailable']) ? $args['friendsSystemAvailable'] : 0, 'POST');
$groups = FormUtil::getPassedValue('groups', isset($args['groups']) ? $args['groups'] : null, 'POST');
$usersCanManageName = FormUtil::getPassedValue('usersCanManageName', isset($args['usersCanManageName']) ? $args['usersCanManageName'] : null, 'POST');
$allowUserChangeAvatar = FormUtil::getPassedValue('allowUserChangeAvatar', isset($args['allowUserChangeAvatar']) ? $args['allowUserChangeAvatar'] : 0, 'POST');
$avatarChangeValidationNeeded = FormUtil::getPassedValue('avatarChangeValidationNeeded', isset($args['avatarChangeValidationNeeded']) ? $args['avatarChangeValidationNeeded'] : 0, 'POST');
$usersPictureFolder = FormUtil::getPassedValue('usersPictureFolder', isset($args['usersPictureFolder']) ? $args['usersPictureFolder'] : null, 'POST');
$allowUserSetTheirSex = FormUtil::getPassedValue('allowUserSetTheirSex', isset($args['allowUserSetTheirSex']) ? $args['allowUserSetTheirSex'] : 0, 'POST');
$allowUserDescribeTheirSelves = FormUtil::getPassedValue('allowUserDescribeTheirSelves', isset($args['allowUserDescribeTheirSelves']) ? $args['allowUserDescribeTheirSelves'] : 0, 'POST');
// Security check
if (!SecurityUtil::checkPermission('IWusers::', "::", ACCESS_ADMIN)) {
throw new Zikula_Exception_Forbidden();
}
$this->checkCsrfToken();
$groupsString = '$';
foreach ($groups as $group) {
$groupsString .= '$' . $group . '$';
}
$this->setVar('friendsSystemAvailable', $friendsSystemAvailable)
->setVar('invisibleGroupsInList', $groupsString)
->setVar('usersPictureFolder', $usersPictureFolder)
->setVar('allowUserChangeAvatar', $allowUserChangeAvatar)
->setVar('avatarChangeValidationNeeded', $avatarChangeValidationNeeded)
->setVar('usersCanManageName', $usersCanManageName)
->setVar('allowUserSetTheirSex', $allowUserSetTheirSex)
->setVar('allowUserDescribeTheirSelves', $allowUserDescribeTheirSelves);
LogUtil::registerStatus($this->__('The configuration has changed'));
return System::redirect(ModUtil::url('IWusers', 'admin', 'config'));
}
示例15: removeGCalendarUseVar
public function removeGCalendarUseVar($args) {
// Security check
$this->throwForbiddenUnless(SecurityUtil::checkPermission('IWagendas::', '::', ACCESS_READ));
$mes = FormUtil::getPassedValue('mes', isset($args['mes']) ? $args['mes'] : date("m"), 'GET');
$any = FormUtil::getPassedValue('any', isset($args['any']) ? $args['any'] : date("Y"), 'GET');
$daid = FormUtil::getPassedValue('daid', isset($args['daid']) ? $args['daid'] : 0, 'GET');
$sv = ModUtil::func('IWmain', 'user', 'genSecurityValue');
$result = ModUtil::func('IWmain', 'user', 'userDelVar', array('uid' => UserUtil::getVar('uid'),
'name' => 'sincroGCalendar',
'module' => 'IWagendas',
'sv' => $sv));
return System::redirect(ModUtil::url('IWagendas', 'user', 'main', array('mes' => $mes,
'any' => $any,
'daid' => $daid)));
}