本文整理汇总了PHP中admin_redirect函数的典型用法代码示例。如果您正苦于以下问题:PHP admin_redirect函数的具体用法?PHP admin_redirect怎么用?PHP admin_redirect使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了admin_redirect函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mysupport_do_uninstall
function mysupport_do_uninstall()
{
global $mybb, $db, $cache, $mysupport_uninstall_confirm_override;
// this is a check to make sure we want to uninstall
// if 'No' was chosen on the confirmation screen, redirect back to the plugins page
if ($mybb->input['no']) {
admin_redirect("index.php?module=config-plugins");
} else {
// there's a post request so we submitted the form and selected yes
// or the confirmation is being overridden by the installation function; this is for when mysupport_uninstall() is called at the start of mysupport_install(), we just want to execute the uninstall code at this point
if ($mybb->request_method == "post" || $mysupport_uninstall_confirm_override === true || $mybb->input['action'] == "delete") {
mysupport_table_columns(-1);
if ($db->table_exists("mysupport")) {
$db->drop_table("mysupport");
}
$db->delete_query("settinggroups", "name = 'mysupport'");
$settings = mysupport_setting_names();
$settings = "'" . implode("','", array_map($db->escape_string, $settings)) . "'";
// have to use $db->escape_string above instead of around $settings directly because otherwise it escapes the ' around the names, which are important
$db->delete_query("settings", "name IN ({$settings})");
rebuild_settings();
mysupport_do_templates(0, false);
mysupport_stylesheet(-1);
$cache->update_forums();
$cache->update_usergroups();
$db->delete_query("datacache", "title = 'mysupport'");
} else {
global $lang, $page;
$lang->load("config_mysupport");
$page->output_confirm_action("index.php?module=config-plugins&action=deactivate&uninstall=1&plugin=mysupport&my_post_key={$mybb->post_code}", $lang->mysupport_uninstall_warning);
}
}
}
示例2: mytwconnect_uninstall
function mytwconnect_uninstall()
{
global $db, $PL, $cache, $lang;
if (!$lang->mytwconnect) {
$lang->load('mytwconnect');
}
if (!file_exists(PLUGINLIBRARY)) {
flash_message($lang->mytwconnect_pluginlibrary_missing, "error");
admin_redirect("index.php?module=config-plugins");
}
$PL or (require_once PLUGINLIBRARY);
// Drop settings
$PL->settings_delete('mytwconnect');
// Delete our columns
$db->query("ALTER TABLE " . TABLE_PREFIX . "users DROP `twavatar`, DROP `twbio`, DROP `twlocation`, DROP `mytw_uid`");
// Delete the plugin from cache
$info = mytwconnect_info();
$shadePlugins = $cache->read('shade_plugins');
unset($shadePlugins[$info['name']]);
$cache->update('shade_plugins', $shadePlugins);
$PL->templates_delete('mytwconnect');
// Try to update templates
require_once MYBB_ROOT . 'inc/adminfunctions_templates.php';
find_replace_templatesets('header_welcomeblock_guest', '#' . preg_quote('— <a href="{$mybb->settings[\'bburl\']}/mytwconnect.php?action=login">{$lang->mytwconnect_login}</a>') . '#i', '');
}
示例3: update
private function update()
{
global $db, $mybb, $cache, $lang;
$new_settings = $drop_settings = array();
// Get the gid
$query = $db->simple_select("settinggroups", "gid", "name='mytwconnect'");
$gid = (int) $db->fetch_field($query, "gid");
// 1.0.2
if (version_compare($this->old_version, '1.0.1', "<")) {
require_once MYBB_ROOT . "inc/adminfunctions_templates.php";
find_replace_templatesets('mytwconnect_usercp_settings', '#' . preg_quote('<input type="submit" value="{$lang->mytwconnect_settings_save}" />') . '#i', '<input type="submit" class=\\"button\\" value="{$lang->mytwconnect_settings_save}" />{$unlink}');
}
// 2.0
if (version_compare($this->old_version, '2.0', "<")) {
$new_settings[] = array("name" => "mytwconnect_twavatar", "title" => $db->escape_string($lang->setting_mytwconnect_twavatar), "description" => $db->escape_string($lang->setting_mytwconnect_twavatar_desc), "optionscode" => "yesno", "value" => 1, "disporder" => 30, "gid" => $gid);
$new_settings[] = array("name" => "mytwconnect_tweet", "title" => $db->escape_string($lang->setting_mytwconnect_tweet), "description" => $db->escape_string($lang->setting_mytwconnect_tweet_desc), "optionscode" => "yesno", "value" => 0, "disporder" => 31, "gid" => $gid);
$new_settings[] = array("name" => "mytwconnect_tweet_message", "title" => $db->escape_string($lang->setting_mytwconnect_tweet_message), "description" => $db->escape_string($lang->setting_mytwconnect_tweet_message_desc), "optionscode" => "textarea", "value" => $lang->mytwconnect_default_tweet, "disporder" => 32, "gid" => $gid);
// Let's at least try to change that, anyway, 2.0 has backward compatibility so it doesn't matter if this fails
require_once MYBB_ROOT . "inc/adminfunctions_templates.php";
find_replace_templatesets('header_welcomeblock_guest', '#' . preg_quote('twlogin') . '#i', 'login');
}
if ($new_settings) {
$db->insert_query_multiple('settings', $new_settings);
}
if ($drop_settings) {
$db->delete_query('settings', "name IN ('mytwconnect_" . implode("','mytwconnect_", $drop_settings) . "')");
}
rebuild_settings();
// Update the current version number and redirect
$this->plugins[$this->info['name']] = array('title' => $this->info['name'], 'version' => $this->version);
$cache->update('shade_plugins', $this->plugins);
flash_message($lang->sprintf($lang->mytwconnect_success_updated, $this->old_version, $this->version), "success");
admin_redirect($_SERVER['HTTP_REFERER']);
}
示例4: tslink_install
function tslink_install()
{
global $db, $PL, $lang, $mybb;
if (!$lang->tslink) {
$lang->load('tslink');
}
if (!file_exists(PLUGINLIBRARY)) {
flash_message($lang->tslink_pluginlibrary_missing, 'error');
admin_redirect('index.php?module=config-plugins');
}
$PL or (require_once PLUGINLIBRARY);
$PL->settings('tslink_settings', $lang->setting_group_tslink, $lang->setting_group_tslink_desc, ['enabled' => ['title' => $lang->setting_tslink_enable, 'description' => $lang->setting_tslink_enable_desc, 'value' => '1'], 'onregister' => ['title' => $lang->setting_tslink_onregister, 'description' => $lang->setting_tslink_onregister_desc, 'value' => '1'], 'admincp' => ['title' => $lang->setting_tslink_admincp, 'description' => $lang->setting_tslink_admincp_desc, 'value' => '1'], 'modcp' => ['title' => $lang->setting_tslink_modcp, 'description' => $lang->setting_tslink_modcp_desc, 'value' => '1'], 'usercp' => ['title' => $lang->setting_tslink_usercp, 'description' => $lang->setting_tslink_usercp_desc, 'value' => '1']]);
if ($db->field_exists('memberstatus', 'users')) {
// Don't do anything
} else {
// Insert our memberstatus column into the database.
$db->query('ALTER TABLE ' . TABLE_PREFIX . 'users ADD (`memberstatus` int(10) NOT NULL DEFAULT 0)');
}
$db->query('CREATE TABLE IF NOT EXISTS ' . TABLE_PREFIX . 'tslink_uids (
uid int(10) NOT NULL,
ts_uid varchar(50) NOT NULL,
ts_cldbid int(10) DEFAULT NULL,
UNIQUE KEY (uid)
) ');
}
示例5: loginconvert_activate
function loginconvert_activate()
{
global $db;
// Don't activate the plugin if it isn't needed
if (!$db->field_exists("passwordconvert", "users")) {
flash_message("There's no need to activate this plugin as there aren't any passwords which need to be converted", "error");
admin_redirect("index.php?module=config-plugins");
}
}
示例6: myalerts_acp_manage_alert_types
function myalerts_acp_manage_alert_types()
{
global $mybb, $lang, $page, $db, $cache;
$alertTypeManager = MybbStuff_MyAlerts_AlertTypeManager::getInstance();
$alertTypes = $alertTypeManager->getAlertTypes();
if (strtolower($mybb->request_method) == 'post') {
if (!verify_post_check($mybb->get_input('my_post_key'))) {
flash_message($lang->invalid_post_verify_key2, 'error');
admin_redirect("index.php?module=config-myalerts_alert_types");
}
$enabledAlertTypes = $mybb->get_input('alert_types_enabled', MyBB::INPUT_ARRAY);
$canBeUserDisabled = $mybb->get_input('alert_types_can_be_user_disabled', MyBB::INPUT_ARRAY);
$enabledAlertTypes = array_map('intval', array_keys($enabledAlertTypes));
$canBeUserDisabled = array_map('intval', array_keys($canBeUserDisabled));
$updateArray = array();
foreach ($alertTypes as $alertType) {
$type = MybbStuff_MyAlerts_Entity_AlertType::unserialize($alertType);
$type->setEnabled(in_array($type->getId(), $enabledAlertTypes));
$type->setCanBeUserDisabled(in_array($type->getId(), $canBeUserDisabled));
$updateArray[] = $type;
}
$alertTypeManager->updateAlertTypes($updateArray);
flash_message($lang->myalerts_alert_types_updated, 'success');
admin_redirect("index.php?module=config-myalerts_alert_types");
} else {
$page->output_header($lang->myalerts_alert_types);
$form = new Form('index.php?module=config-myalerts_alert_types', 'post');
$table = new Table();
$table->construct_header($lang->myalerts_alert_type_code);
$table->construct_header($lang->myalerts_alert_type_enabled, array('width' => '5%', 'class' => 'align_center'));
$table->construct_header($lang->myalerts_alert_type_can_be_user_disabled, array('width' => '10%', 'class' => 'align_center'));
$noResults = false;
if (!empty($alertTypes)) {
foreach ($alertTypes as $type) {
$alertCode = htmlspecialchars_uni($type['code']);
$table->construct_cell($alertCode);
$table->construct_cell($form->generate_check_box('alert_types_enabled[' . $type['id'] . ']', '', '', array('checked' => $type['enabled'])));
$table->construct_cell($form->generate_check_box('alert_types_can_be_user_disabled[' . $type['id'] . ']', '', '', array('checked' => $type['can_be_user_disabled'])));
$table->construct_row();
}
} else {
$table->construct_cell($lang->myalerts_no_alert_types, array('colspan' => 2));
$table->construct_row();
$noResults = true;
}
$table->output($lang->myalerts_alert_types);
if (!$noResults) {
$buttons[] = $form->generate_submit_button($lang->myalerts_update_alert_types);
$form->output_submit_wrapper($buttons);
}
$form->end();
$page->output_footer();
}
}
示例7: ApprovePicture
function ApprovePicture()
{
global $db, $lang;
$id = intval($_REQUEST['id']);
if (empty($id)) {
fatal_error($lang['gallery_error_no_pic_selected']);
}
// Update the approval
$db->query("UPDATE " . TABLE_PREFIX . "gallery_pic SET approved = 1 WHERE ID_PICTURE = {$id} LIMIT 1");
// Redirect to approval list
admin_redirect('index.php?module=config/ezgallery&action=approvelist');
}
示例8: cloudflare_install
function cloudflare_install()
{
global $mybb, $db, $config;
$setting_group = array("name" => "cloudflare", "title" => "CloudFlare Manager", "description" => "Configures options for the CloudFlare Manager plugin.", "disporder" => "1");
$gid = $db->insert_query("settinggroups", $setting_group);
$dispnum = 0;
$parse = parse_url($mybb->settings['bburl']);
$domain = $parse['host'];
$domain = str_replace('www.', '', $domain);
$settings = array("cloudflare_domain" => array("title" => "Domain", "description" => "The domain (of this forum) that is active under CloudFlare", "optionscode" => "text", "value" => $domain, "disporder" => ++$dispnum), "cloudflare_email" => array("title" => "Email", "description" => "Your email address linked to your CloudFlare account", "optionscode" => "text", "value" => $mybb->user['email'], "disporder" => ++$dispnum), "cloudflare_api" => array("title" => "API Key", "description" => "Your CloudFlare API key. You can get this key <a href=\"https://www.cloudflare.com/a/account/my-account\">here</a>", "optionscode" => "text", "value" => "", "disporder" => ++$dispnum), "cloudflare_showdns" => array("title" => "Show DNS?", "description" => "Do you want to show the IP address host on Recent Visitors? *May slow down process if enabled.", "optionscode" => "yesno", "value" => "0", "disporder" => ++$dispnum), "cloudflare_backlink" => array("title" => "Show \"Enhanced By CloudFlare\" message?", "description" => "Do you want to show the enchanced by CloudFlare message in your board footer? It helps to expand the CloudFlare network and speed up more websites on the internet.", "optionscode" => "yesno", "value" => "1", "disporder" => ++$dispnum));
foreach ($settings as $name => $setting) {
$setting['gid'] = $gid;
$setting['name'] = $name;
$db->insert_query("settings", $setting);
}
rebuild_settings();
admin_redirect("index.php?module=config-settings&action=change&gid={$gid}");
}
示例9: myprofile_uninstall
function myprofile_uninstall()
{
global $mybb;
if ($mybb->request_method == 'post') {
if (!verify_post_check($mybb->input['my_post_key'])) {
global $lang;
flash_message($lang->invalid_post_verify_key2, 'error');
admin_redirect("index.php?module=config-plugins");
}
if (isset($mybb->input['no'])) {
admin_redirect('index.php?module=config-plugins');
}
myprofile_bundles_propagate_call("uninstall");
$mybb->cache->delete("myprofile");
return true;
}
global $page;
$page->output_confirm_action("index.php?module=config-plugins&action=deactivate&uninstall=1&plugin=myprofile");
}
示例10: cloudflare_meta
function cloudflare_meta()
{
global $mybb, $page, $plugins, $cache;
if ($mybb->input['module'] == 'cloudflare') {
if (cloudflare_is_installed() == false) {
flash_message('CloudFlare Manager hasn\'t been installed. Please install it before continuing.', 'error');
admin_redirect("index.php?module=config-plugins");
exit;
}
}
if (!$cache->read("cloudflare_zone_id")) {
get_cloudflare_zone_id();
}
$sub_menu = array();
$sub_menu['10'] = array("id" => "overview", "title" => "CloudFlare Overview", "link" => "index.php?module=cloudflare-overview");
$sub_menu['20'] = array("id" => "dev_mode", "title" => "Development Mode", "link" => "index.php?module=cloudflare-dev_mode");
$sub_menu = $plugins->run_hooks("admin_cloudflare_menu", $sub_menu);
$page->add_menu_item("CloudFlare Manager", "cloudflare", "index.php?module=cloudflare", 60, $sub_menu);
return true;
}
示例11: recentthread_install
function recentthread_install()
{
global $db, $mybb;
if ($mybb->version_code < 1801) {
flash_message("Sorry, but this plugin requires you to update to 1.8.1 or higher.", "error");
admin_redirect("index.php?module=config-plugins");
}
// Add some settings
$new_setting_group = array("name" => "recentthreads", "title" => "Recent Threads Settings", "description" => "Customize various aspects of recent threads", "disporder" => 77, "isdefault" => 0);
$gid = $db->insert_query("settinggroups", $new_setting_group);
$new_setting[] = array("name" => "recentthread_threadcount", "title" => "Number of Threads", "description" => "How many threads are shown.", "optionscode" => "numeric", "disporder" => 1, "value" => 15, "gid" => $gid);
$new_setting[] = array("name" => "recentthread_threadavatar", "title" => $db->escape_string("Show thread starter's avatar"), "description" => $db->escape_string("If set to yes, the thread starter's avatar will be shown."), "optionscode" => "yesno", "disporder" => 2, "value" => 0, "gid" => $gid);
$new_setting[] = array("name" => "recentthread_lastavatar", "title" => $db->escape_string("Show last poster's avatar"), "description" => $db->escape_string("If set to yes, the last poster's avatar will be shown."), "optionscode" => "yesno", "disporder" => 3, "value" => 0, "gid" => $gid);
$new_setting[] = array("name" => "recentthread_forumskip", "title" => "Forums To Ignore", "description" => "The forums threads should not be pulled from.", "optionscode" => "forumselect", "disporder" => 4, "value" => "", "gid" => $gid);
$new_setting[] = array("name" => "recentthread_subject_length", "title" => "Max Title Length", "description" => "The amount of characters before the rest of the title is truncated. Enter 0 for no limit.", "optionscode" => "numeric", "disporder" => 5, "value" => 0, "gid" => $gid);
$new_setting[] = array("name" => "recentthread_subject_breaker", "title" => "Word Breaking", "description" => "If selected, the title will be kept to full words only in cut off.", "optionscode" => "yesno", "disporder" => 6, "value" => 0, "gid" => $gid);
$new_setting[] = array("name" => "recentthread_which_groups", "title" => "Permissions", "description" => "These groups cannot view the reccent threads on index.", "optionscode" => "groupselect", "disporder" => 7, "value" => 7, "gid" => $gid);
$db->insert_query_multiple("settings", $new_setting);
rebuild_settings();
}
示例12: minecraftconnect_install
function minecraftconnect_install()
{
global $db, $mybb, $lang;
if (!$lang->mcc) {
$lang->load('minecraftconnect');
}
// Check if cURL is enabled before we do anything...
if (!function_exists('curl_version')) {
flash_message($lang->mcc_curl_disabled, 'error');
admin_redirect('index.php?module=config-plugins');
exit;
} else {
// Now check if cURL can connect using SSL
$v = curl_version();
if (($v['features'] & CURL_VERSION_SSL) != 4) {
flash_message($lang->mcc_curl_ssl, 'error');
admin_redirect('index.php?module=config-plugins');
exit;
}
// Now check if cURL Certificate Authority is valid
$cainfo = ini_get('curl.cainfo');
if (empty($cainfo) or strlen($cainfo) < 4) {
flash_message($lang->mcc_curl_ca, 'error');
admin_redirect('index.php?module=config-plugins');
exit;
}
}
$mcc_group = array('name' => 'mcc', 'title' => 'Minecraft Connect', 'description' => 'Edit the settings for Minecraft Connect here.', 'disporder' => '1', 'isdefault' => 'no');
$db->insert_query('settinggroups', $mcc_group);
$gid = intval($db->insert_id());
$psettings[] = array('name' => 'mcc_enabled', 'title' => 'Enabled', 'description' => 'Do you want to enable Minecraft Connect?', 'optionscode' => 'yesno', 'value' => '1', 'disporder' => '1', 'gid' => $gid);
foreach ($psettings as $setting) {
$db->insert_query('settings', $setting);
}
// Add new columns to user table
$db->add_column('users', 'mcc_username', 'varchar(65)');
$db->add_column('users', 'mcc_accesstoken', 'varchar(32)');
$db->add_column('users', 'mcc_id', 'varchar(32)');
// ID == Client token
rebuild_settings();
}
示例13: jb_install_plugin
/**
* @param string $codename
* @param array $register
* @param int $core_minimum
* @param int $mybb_minimum
* @param string $php_minimum
*/
function jb_install_plugin($codename, $register = array(), $core_minimum = false, $mybb_minimum = false, $php_minimum = "5.3")
{
$installed = false;
if (JB_CORE_INSTALLED === false) {
$installed = jb_install_core();
}
// In case we installed the core and this plugin needs to register itself we need to do this here. Otherwise the installer can't find its files
if ($installed === true && isset($register['vendor']) && isset($register['prefix'])) {
JB_Core::i();
// Needed to register the autoloader
JB_Packages::i()->register($register['prefix'], $register['vendor'], $codename);
}
// Don't use an else as the function above might change the value
if (JB_CORE_INSTALLED === true || $installed === true) {
JB_Core::i()->install($codename, $core_minimum, $mybb_minimum, $php_minimum);
} else {
// This message should normally never appear as "jb_install_core" should already throw an error
flash_message("Couldn't install", 'error');
admin_redirect('index.php?module=config-plugins');
}
}
示例14: captchapack_install
/**
* Install function for the plugin.
*
* Creates <code>captcha_captchapack</code> table in the database. Add
* cleanup task.
*/
function captchapack_install()
{
global $db, $PL, $cache;
// PluginLibrary dependency check
if (!file_exists(PLUGINLIBRARY)) {
flash_message("The selected plugin could not be installed because <a href=\"http://mods.mybb.com/view/pluginlibrary\">PluginLibrary</a> is missing.", "error");
admin_redirect("index.php?module=config-plugins");
}
// Load PluginLibrary
$PL or (require_once PLUGINLIBRARY);
// PluginLibrary version check
if ($PL->version < 11) {
flash_message("PluginLibrary is too old.", "error");
admin_redirect("index.php?module=config-plugins");
}
// Create table
$tbl_name = TABLE_PREFIX . 'captcha_captchapack';
$db->write_query("create table `{$tbl_name}` (\n `hash` binary(20) not null,\n `ip` int unsigned not null default '0',\n `dateline` bigint(30) not null default '0',\n `answer` char(255) not null default '',\n primary key (`hash`, `ip`)\n );");
// Add index to dateline to accelerate CAPTCHA cleanup
$db->write_query("alter table `{$tbl_name}` add index (`dateline`);");
// Insert task
captchapack_task_add(array("title" => 'CAPTCHA Pack Cleanup', "description" => 'Clean up old CAPTCHA entries.', "file" => 'captchapack', "minute" => '0'));
}
示例15: cloudflare_meta
function cloudflare_meta()
{
global $mybb, $page, $plugins, $cache, $db;
if ($mybb->input['module'] == 'cloudflare') {
$query = $db->simple_select("settinggroups", "gid", "name='cloudflare'", array("order_by" => 'name', "order_dir" => 'DESC', "limit" => 1));
$gid = $db->fetch_array($query);
if (!$gid['gid']) {
flash_message('Your settings are not set correctly. Please double check they are correct.', 'error');
admin_redirect("index.php?module=config-settings&action=change&gid=" . intval($gid['gid']));
exit;
} elseif (cloudflare_is_installed() == false) {
flash_message('CloudFlare Manager hasn\'t been installed. Please install it before continuing.', 'error');
admin_redirect("index.php?module=config-plugins");
exit;
}
}
$sub_menu = array();
$sub_menu['10'] = array("id" => "overview", "title" => "CloudFlare Overview", "link" => "index.php?module=cloudflare-overview");
$sub_menu['20'] = array("id" => "dev_mode", "title" => "Development Mode", "link" => "index.php?module=cloudflare-dev_mode");
$sub_menu = $plugins->run_hooks("admin_cloudflare_menu", $sub_menu);
$page->add_menu_item("CloudFlare Manager", "cloudflare", "index.php?module=cloudflare", 60, $sub_menu);
return true;
}