Skip to content

Instantly share code, notes, and snippets.

@Sama34
Last active August 29, 2015 14:10
Show Gist options
  • Save Sama34/416feefe00f7f9612851 to your computer and use it in GitHub Desktop.
Save Sama34/416feefe00f7f9612851 to your computer and use it in GitHub Desktop.
MyBB::Plugin uninstallation confirmation page
<?php
// _uninstall() routine for our plugins
function foo_uninstall()
{
global $mybb;
// Only run if a post request
if($mybb->request_method != 'post')
{
global $page;
$message = $title = '';
// You can ignore the following if you don't want to bother to load language files
//$message = 'Are you sure you wish to uninstall the Foo plugin?';
//$title = 'Uninstall Foo Plugin';
$page->output_confirm_action('index.php?module=config-plugins&action=deactivate&uninstall=1&plugin=foo', $message, $title);
}
// Verify post requests for XSS attempts
if(!verify_post_check($mybb->get_input('my_post_key')))
{
global $lang;
flash_message($lang->invalid_post_verify_key2, 'error');
admin_redirect('index.php?module=config-plugins');
}
// So administrator is not sure..
if(isset($mybb->input['no']))
{
admin_redirect('index.php?module=config-plugins');
}
// drop tables
// remove our templates
// delete settings and/or setting groups
// rebuild_settings
// etcetera
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment