本文整理汇总了PHP中redirectexit函数的典型用法代码示例。如果您正苦于以下问题:PHP redirectexit函数的具体用法?PHP redirectexit怎么用?PHP redirectexit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了redirectexit函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action_avatarSettings_display
/**
* This action handler method displays and allows to change avatar settings.
*
* - Called by index.php?action=admin;area=manageattachments;sa=avatars.
*
* @uses 'avatars' sub-template.
*/
public function action_avatarSettings_display()
{
global $txt, $context, $scripturl;
// Initialize the form
$this->_initAvatarSettingsForm();
$config_vars = $this->_avatarSettings->settings();
// Saving avatar settings?
if (isset($_GET['save'])) {
checkSession();
call_integration_hook('integrate_save_avatar_settings');
// Disable if invalid values would result
if (isset($_POST['custom_avatar_enabled']) && $_POST['custom_avatar_enabled'] == 1 && (empty($_POST['custom_avatar_dir']) || empty($_POST['custom_avatar_url']))) {
$_POST['custom_avatar_enabled'] = 0;
}
Settings_Form::save_db($config_vars);
redirectexit('action=admin;area=manageattachments;sa=avatars');
}
// Attempt to figure out if the admin is trying to break things.
$context['settings_save_onclick'] = 'return document.getElementById(\'custom_avatar_enabled\').value == 1 && (document.getElementById(\'custom_avatar_dir\').value == \'\' || document.getElementById(\'custom_avatar_url\').value == \'\') ? confirm(\'' . $txt['custom_avatar_check_empty'] . '\') : true;';
// We need this for the in-line permissions
createToken('admin-mp');
// Prepare the context.
$context['post_url'] = $scripturl . '?action=admin;area=manageattachments;save;sa=avatars';
Settings_Form::prepare_db($config_vars);
// Add a layer for the javascript.
Template_Layers::getInstance()->add('avatar_settings');
$context['sub_template'] = 'show_settings';
}
示例2: sportal_admin_state_change
function sportal_admin_state_change()
{
checkSession('get');
if (!empty($_REQUEST['block_id'])) {
$id = (int) $_REQUEST['block_id'];
} elseif (!empty($_REQUEST['category_id'])) {
$id = (int) $_REQUEST['category_id'];
} elseif (!empty($_REQUEST['article_id'])) {
$id = (int) $_REQUEST['article_id'];
} else {
fatal_lang_error('error_sp_id_empty', false);
}
changeState($_REQUEST['type'], $id);
if ($_REQUEST['type'] == 'block') {
$sides = array(1 => 'left', 2 => 'top', 3 => 'bottom', 4 => 'right');
$list = !empty($_GET['redirect']) && isset($sides[$_GET['redirect']]) ? $sides[$_GET['redirect']] : 'list';
redirectexit('action=admin;area=portalblocks;sa=' . $list);
} elseif ($_REQUEST['type'] == 'category') {
redirectexit('action=admin;area=portalarticles;sa=categories');
} elseif ($_REQUEST['type'] == 'article') {
redirectexit('action=admin;area=portalarticles;sa=articles');
} else {
redirectexit('action=admin;area=portalconfig');
}
}
示例3: action_topicSettings_display
/**
* Adminstration page for topics: allows to display and set settings related to topics.
*
* Requires the admin_forum permission.
* Accessed from ?action=admin;area=postsettings;sa=topics.
* @uses Admin template, edit_topic_settings sub-template.
*/
public function action_topicSettings_display()
{
global $context, $txt, $scripturl;
// Initialize the form
$this->_initTopicSettingsForm();
// Retrieve the current config settings
$config_vars = $this->_topicSettings->settings();
// Setup the template.
$context['sub_template'] = 'show_settings';
// Are we saving them - are we??
if (isset($_GET['save'])) {
// Security checks
checkSession();
// Notify addons and integrations of the settings change.
call_integration_hook('integrate_save_topic_settings');
// Save the result!
Settings_Form::save_db($config_vars);
// We're done here, pal.
redirectexit('action=admin;area=postsettings;sa=topics');
}
// Set up the template stuff nicely.
$context['post_url'] = $scripturl . '?action=admin;area=postsettings;save;sa=topics';
$context['settings_title'] = $txt['manageposts_topic_settings'];
// Prepare the settings
Settings_Form::prepare_db($config_vars);
}
示例4: ModifyKarmaSettings
/**
* Config array for chaning the karma settings
* Accessed from ?action=admin;area=featuresettings;sa=karma;
*
* @param $return_config
*/
function ModifyKarmaSettings($return_config = false)
{
global $txt, $scripturl, $context, $modSettings;
loadLanguage('Karma+ManageKarma');
if (empty($modSettings['karmaMode'])) {
$config_vars = array(array('select', 'karmaMode', explode('|', $txt['karma_options'])));
} else {
$config_vars = array(array('select', 'karmaMode', explode('|', $txt['karma_options'])), '', array('int', 'karmaMinPosts', 6, 'postinput' => strtolower($txt['posts'])), array('float', 'karmaWaitTime', 6, 'postinput' => $txt['hours']), array('check', 'karmaTimeRestrictAdmins'));
}
call_integration_hook('integrate_karma_settings', array(&$config_vars));
if ($return_config) {
return $config_vars;
}
// Saving?
if (isset($_GET['save'])) {
checkSession();
call_integration_hook('integrate_save_karma_settings');
saveDBSettings($config_vars);
$_SESSION['adm-save'] = true;
redirectexit('action=admin;area=featuresettings;sa=karma');
}
$context['post_url'] = $scripturl . '?action=admin;area=featuresettings;save;sa=karma';
$context['settings_title'] = $txt['karma'];
loadLanguage('ManageKarma');
prepareDBSettingContext($config_vars);
}
示例5: fbc_friend
public function fbc_friend()
{
global $context, $fbuser, $Url, $FacebookId, $fb_hook_object, $friends, $scripturl, $fb_object, $curOffset;
$context['sub_template'] = 'fbc_friends';
$context['fb_do'] = 'friends';
SAFacebookhooks::face_init();
$facebook = new Facebook(array('appId' => $fb_hook_object->modSettings['fb_app_id'], 'secret' => $fb_hook_object->modSettings['fb_app_secret']));
$Url = $facebook->getLoginUrl(array('redirect_uri' => $scripturl . '?action=facebook', 'scope' => 'email,publish_actions'));
$fb_object->fbc_cons_pages('friends', 32);
if (!$fb_hook_object->modSettings['fb_mode2']) {
redirectexit();
}
$fbuser = $FacebookId;
if ($fbuser) {
//Try it!!!!!
try {
//These api calls can be slow so were only do it if needed
if (empty($_SESSION['safbfriends'][$curOffset])) {
$_SESSION['safbfriends'][$curOffset] = $facebook->api('/me/friends?offset=' . $curOffset . '&limit=32');
}
$friends = $_SESSION['safbfriends'][$curOffset];
} catch (FacebookApiException $e) {
//Throw it!!!!!
fatal_error($e, false);
}
}
}
示例6: activateAccount
function activateAccount($memID)
{
global $sourcedir, $context, $user_profile, $modSettings;
isAllowedTo('moderate_forum');
if (isset($_REQUEST['save']) && isset($user_profile[$memID]['is_activated']) && $user_profile[$memID]['is_activated'] != 1) {
// If we are approving the deletion of an account, we do something special ;)
if ($user_profile[$memID]['is_activated'] == 4) {
require_once $sourcedir . '/Subs-Members.php';
deleteMembers($context['id_member']);
redirectexit();
}
// Let the integrations know of the activation.
call_integration_hook('integrate_activate', array($user_profile[$memID]['member_name']));
// Actually update this member now, as it guarantees the unapproved count can't get corrupted.
updateMemberData($context['id_member'], array('is_activated' => $user_profile[$memID]['is_activated'] >= 10 ? 11 : 1, 'validation_code' => ''));
// If we are doing approval, update the stats for the member just in case.
if (in_array($user_profile[$memID]['is_activated'], array(3, 4, 13, 14))) {
updateSettings(array('unapprovedMembers' => $modSettings['unapprovedMembers'] > 1 ? $modSettings['unapprovedMembers'] - 1 : 0));
}
// Make sure we update the stats too.
updateStats('member', false);
}
// Leave it be...
redirectexit('action=profile;u=' . $memID . ';area=summary');
}
示例7: save
function save()
{
global $boarddir, $context;
checkSession('post');
$styleheaders = $_POST['headers'];
$stylefooters = $_POST['footers'];
$styleheaders = stripslashes($styleheaders);
$stylefooters = stripslashes($stylefooters);
//Save Headers
$filename = $boarddir . '/smfheader.txt';
@chmod($filename, 0644);
if (!($handle = fopen($filename, 'w'))) {
fatal_error('Can not open' . $filename . '.', false);
}
// Write the headers to our opened file.
if (!fwrite($handle, $styleheaders)) {
//fatal_error('Can not write to' . $filename . '.',false);
}
fclose($handle);
//Save Footers
$filename = $boarddir . '/smffooter.txt';
@chmod($filename, 0644);
if (!($handle = fopen($filename, 'w'))) {
fatal_error('Can not open' . $filename . '.', false);
}
// Write the headers to our opened file.
if (!fwrite($handle, $stylefooters)) {
//fatal_error('Can not write to' . $filename . '.',false);
}
fclose($handle);
redirectexit('action=globalhf;sesc=' . $context['session_id']);
}
示例8: EditSearchSettings
/**
* Edit some general settings related to the search function.
* Called by ?action=admin;area=managesearch;sa=settings.
* Requires the admin_forum permission.
*
* @param $return_config
* @uses ManageSearch template, 'modify_settings' sub-template.
*/
function EditSearchSettings($return_config = false)
{
global $txt, $context, $scripturl, $sourcedir, $modSettings;
// What are we editing anyway?
$config_vars = array(array('permissions', 'search_posts'), array('check', 'simpleSearch'), array('check', 'search_dropdown'), array('int', 'search_results_per_page'), array('int', 'search_max_results', 'subtext' => $txt['search_max_results_disable']), '', array('int', 'search_floodcontrol_time', 'subtext' => $txt['search_floodcontrol_time_desc'], 6, 'postinput' => $txt['seconds']));
call_integration_hook('integrate_modify_search_settings', array(&$config_vars));
// Perhaps the search method wants to add some settings?
require_once $sourcedir . '/Search.php';
$searchAPI = findSearchAPI();
if (is_callable(array($searchAPI, 'searchSettings'))) {
call_user_func_array($searchAPI->searchSettings, array(&$config_vars));
}
if ($return_config) {
return $config_vars;
}
$context['page_title'] = $txt['search_settings_title'];
$context['sub_template'] = 'show_settings';
call_integration_hook('integrate_modify_search_weights', array(&$factors));
// We'll need this for the settings.
require_once $sourcedir . '/ManageServer.php';
// A form was submitted.
if (isset($_REQUEST['save'])) {
checkSession();
call_integration_hook('integrate_save_search_settings');
saveDBSettings($config_vars);
redirectexit('action=admin;area=managesearch;sa=settings;' . $context['session_var'] . '=' . $context['session_id']);
}
// Prep the template!
$context['post_url'] = $scripturl . '?action=admin;area=managesearch;save;sa=settings';
$context['settings_title'] = $txt['search_settings_title'];
// We need this for the in-line permissions
createToken('admin-mp');
prepareDBSettingContext($config_vars);
}
示例9: PrintTopic
function PrintTopic()
{
global $topic, $txt, $scripturl, $context, $user_info;
global $board_info, $smcFunc, $modSettings;
// Redirect to the boardindex if no valid topic id is provided.
if (empty($topic)) {
redirectexit();
}
// Whatever happens don't index this.
$context['robot_no_index'] = true;
// Get the topic starter information.
$request = $smcFunc['db_query']('', '
SELECT m.poster_time, IFNULL(mem.real_name, m.poster_name) AS poster_name
FROM {db_prefix}messages AS m
LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)
WHERE m.id_topic = {int:current_topic}
ORDER BY m.id_msg
LIMIT 1', array('current_topic' => $topic));
// Redirect to the boardindex if no valid topic id is provided.
if ($smcFunc['db_num_rows']($request) == 0) {
redirectexit();
}
$row = $smcFunc['db_fetch_assoc']($request);
$smcFunc['db_free_result']($request);
// Lets "output" all that info.
loadTemplate('Printpage');
$context['template_layers'] = array('print');
$context['board_name'] = $board_info['name'];
$context['category_name'] = $board_info['cat']['name'];
$context['poster_name'] = $row['poster_name'];
$context['post_time'] = timeformat($row['poster_time'], false);
$context['parent_boards'] = array();
foreach ($board_info['parent_boards'] as $parent) {
$context['parent_boards'][] = $parent['name'];
}
// Split the topics up so we can print them.
$request = $smcFunc['db_query']('', '
SELECT subject, poster_time, body, IFNULL(mem.real_name, poster_name) AS poster_name
FROM {db_prefix}messages AS m
LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)
WHERE m.id_topic = {int:current_topic}' . ($modSettings['postmod_active'] && !allowedTo('approve_posts') ? '
AND (m.approved = {int:is_approved}' . ($user_info['is_guest'] ? '' : ' OR m.id_member = {int:current_member}') . ')' : '') . '
ORDER BY m.id_msg', array('current_topic' => $topic, 'is_approved' => 1, 'current_member' => $user_info['id']));
$context['posts'] = array();
while ($row = $smcFunc['db_fetch_assoc']($request)) {
// Censor the subject and message.
censorText($row['subject']);
censorText($row['body']);
$context['posts'][] = array('subject' => $row['subject'], 'member' => $row['poster_name'], 'time' => timeformat($row['poster_time'], false), 'timestamp' => forum_time(true, $row['poster_time']), 'body' => parse_bbc($row['body'], 'print'));
if (!isset($context['topic_subject'])) {
$context['topic_subject'] = $row['subject'];
}
}
$smcFunc['db_free_result']($request);
// Set a canonical URL for this page.
$context['canonical_url'] = $scripturl . '?topic=' . $topic . '.0';
}
示例10: action_index
/**
* This is the main function for markasread file.
*
* @see Action_Controller::action_index()
*/
public function action_index()
{
// These checks have been moved here.
// Do NOT call the specific handlers directly.
// Guests can't mark things.
is_not_guest();
checkSession('get');
$redir = $this->_dispatch();
redirectexit($redir);
}
示例11: SaveNote
function SaveNote()
{
global $db_prefix;
//Check if they are allowed to admin forum.
isAllowedTo('admin_forum');
//Make the html safe if used so it does not mess up the page
$anotes = htmlspecialchars($_POST['txtnotes'], ENT_QUOTES);
//Insert the admin notes into the database
db_query("REPLACE INTO {$db_prefix}settings\n\t\t\t(variable, value)\n\t\tVALUES ('adminnotes','{$anotes}')", __FILE__, __LINE__);
//Redirect to the main admin page to see the changed notes
redirectexit('action=admin');
}
示例12: SaveNote
function SaveNote()
{
global $smcFunc;
// Check if they are allowed to admin forum.
isAllowedTo('admin_forum');
// Make the html safe if used so it does not mess up the page
$anotes = htmlspecialchars($_POST['txtnotes'], ENT_QUOTES);
// Insert the admin notes into the database
updateSettings(array('adminnotes' => $anotes));
// Redirect to the main admin page to see the changed notes
redirectexit('action=admin');
}
示例13: RelatedTopicsAdminBuildIndex
/**
* Related Topics
*
* @package RelatedTopics
* @author Niko Pahajoki http://madjoki.com/
* @version 1.5
* @license http://madjoki.com/smf-mods/license/ New-BSD
*/
function RelatedTopicsAdminBuildIndex()
{
global $smcFunc, $scripturl, $modSettings, $context, $txt;
loadTemplate('Admin');
loadLanguage('Admin');
if (!isset($context['relatedClass']) && !initRelated()) {
fatal_lang_error('no_methods_selected');
}
$context['step'] = empty($_REQUEST['step']) ? 0 : (int) $_REQUEST['step'];
if ($context['step'] == 0) {
// Clear caches
foreach ($context['relatedClass'] as $class) {
$class->recreateIndexTables();
}
$smcFunc['db_query']('', '
DELETE FROM {db_prefix}related_topics');
}
$request = $smcFunc['db_query']('', '
SELECT MAX(id_topic)
FROM {db_prefix}topics');
list($max_topics) = $smcFunc['db_fetch_row']($request);
$smcFunc['db_free_result']($request);
// How many topics to do per page load?
$perStep = 150;
$last = $context['step'] + $perStep;
// Search for topic ids between first and last which are not in ignored boards
$request = $smcFunc['db_query']('', '
SELECT t.id_topic
FROM {db_prefix}topics AS t
WHERE t.id_topic > {int:start}
AND t.id_topic <= {int:last}' . (!empty($context['rt_ignore']) ? '
AND t.id_board NOT IN({array_int:ignored})' : ''), array('start' => $context['step'], 'last' => $last, 'ignored' => $context['rt_ignore']));
$topics = array();
while ($row = $smcFunc['db_fetch_assoc']($request)) {
$topics[] = $row['id_topic'];
}
$smcFunc['db_free_result']($request);
// Update topics
relatedUpdateTopics($topics, true);
if ($last >= $max_topics) {
redirectexit('action=admin;area=relatedtopics;sa=methods');
}
$context['sub_template'] = 'not_done';
$context['continue_get_data'] = '?action=admin;area=relatedtopics;sa=buildIndex;step=' . $last;
$context['continue_percent'] = round(100 * ($last / $max_topics));
$context['continue_post_data'] = '';
$context['continue_countdown'] = '2';
obExit();
}
示例14: action_addonSettings_display
/**
* If you have a general mod setting to add stick it here.
*/
public function action_addonSettings_display()
{
// Initialize the form
$this->_initAddonSettingsForm();
// Initialize settings
$config_vars = $this->_addonSettings->settings();
// Saving?
if (isset($_GET['save'])) {
checkSession();
call_integration_hook('integrate_save_general_mod_settings');
Settings_Form::save_db($config_vars);
redirectexit('action=admin;area=addonsettings;sa=general');
}
Settings_Form::prepare_db($config_vars);
}
示例15: validate
/**
* Openid_uri is the URI given by the user
* Validates the URI and changes it to a fully canonical URL
* Determines the IDP server and delegation
* Optional array of fields to restore when validation complete.
* Redirects the user to the IDP for validation
*
* @param string $openid_uri
* @param bool $return = false
* @param mixed[]|null $save_fields = array()
* @param string|null $return_action = null
* @return string
*/
public function validate($openid_uri, $return = false, $save_fields = array(), $return_action = null)
{
global $scripturl, $modSettings;
$openid_url = $this->canonize($openid_uri);
$response_data = $this->getServerInfo($openid_url);
// We can't do anything without the proper response data.
if ($response_data === false || empty($response_data['provider'])) {
return 'no_data';
}
// Is there an existing association?
if (($assoc = $this->getAssociation($response_data['provider'])) == null) {
$assoc = $this->makeAssociation($response_data['provider']);
}
// Include file for member existence
require_once SUBSDIR . '/Members.subs.php';
// Before we go wherever it is we are going, store the GET and POST data, because it might be useful when we get back.
$request_time = time();
// Just in case they are doing something else at this time.
while (isset($_SESSION['openid']['saved_data'][$request_time])) {
$request_time = md5($request_time);
}
$_SESSION['openid']['saved_data'][$request_time] = array('get' => $_GET, 'post' => $_POST, 'openid_uri' => $openid_url, 'cookieTime' => $modSettings['cookieTime']);
// Set identity and claimed id to match the specs.
$openid_identity = 'http://specs.openid.net/auth/2.0/identifier_select';
$openid_claimedid = $openid_identity;
// OpenID url an server response equal?
if ($openid_url != $response_data['server']) {
$openid_identity = urlencode(empty($response_data['delegate']) ? $openid_url : $response_data['delegate']);
if (strpos($openid_identity, 'https') === 0) {
$openid_claimedid = str_replace('http://', 'https://', $openid_url);
} else {
$openid_claimedid = $openid_url;
}
}
// Prepare parameters for the OpenID setup.
$parameters = array('openid.mode=checkid_setup', 'openid.realm=' . $scripturl, 'openid.ns=http://specs.openid.net/auth/2.0', 'openid.identity=' . $openid_identity, 'openid.claimed_id=' . $openid_claimedid, 'openid.assoc_handle=' . urlencode($assoc['handle']), 'openid.return_to=' . urlencode($scripturl . '?action=openidreturn&sa=' . (!empty($return_action) ? $return_action : $_REQUEST['action']) . '&t=' . $request_time . (!empty($save_fields) ? '&sf=' . base64_encode(serialize($save_fields)) : '')), 'openid.sreg.required=email');
// If they are logging in but don't yet have an account or they are registering, let's request some additional information
if ($_REQUEST['action'] == 'login2' && !memberExists($openid_url) || ($_REQUEST['action'] == 'register' || $_REQUEST['action'] == 'register2')) {
$parameters[] = 'openid.sreg.optional=nickname,dob,gender';
}
$redir_url = $response_data['server'] . '?' . implode('&', $parameters);
if ($return) {
return $redir_url;
} else {
redirectexit($redir_url);
}
}