예제 #1
0
파일: CommonAPI.php 프로젝트: norv/EosAlpha
 public function removeHooks()
 {
     HookAPI::removeAll($this->productShortName);
 }
예제 #2
0
function ModifyBBCSettings($return_config = false)
{
    global $context, $txt, $modSettings, $scripturl, $sourcedir, $backend_subdir;
    $config_vars = array(array('check', 'enableBBC'), array('check', 'enablePostHTML'), array('check', 'autoLinkUrls'), array('check', 'legacyBBC'), array('check', 'linkSecurity'), '', array('bbc', 'disabledBBC'), array('callback_template', 'template_bbc_settings'));
    if ($return_config) {
        return $config_vars;
    }
    // Setup the template.
    require_once $sourcedir . '/' . $backend_subdir . '/ManageServer.php';
    $context['sub_template'] = 'show_settings';
    $context['page_title'] = $txt['manageposts_bbc_settings_title'];
    // Make sure we check the right tags!
    $modSettings['bbc_disabled_disabledBBC'] = empty($modSettings['disabledBBC']) ? array() : explode(',', $modSettings['disabledBBC']);
    // Saving?
    if (isset($_GET['save'])) {
        checkSession();
        // Clean up the tags.
        $bbcTags = array();
        foreach (parse_bbc(false) as $tag) {
            $bbcTags[] = $tag['tag'];
        }
        if (!isset($_POST['disabledBBC_enabledTags'])) {
            $_POST['disabledBBC_enabledTags'] = array();
        } elseif (!is_array($_POST['disabledBBC_enabledTags'])) {
            $_POST['disabledBBC_enabledTags'] = array($_POST['disabledBBC_enabledTags']);
        }
        // Work out what is actually disabled!
        $_POST['disabledBBC'] = implode(',', array_diff($bbcTags, $_POST['disabledBBC_enabledTags']));
        $hidden_content_messages = array();
        for ($i = 1; $i <= 3; $i++) {
            if (isset($_POST['hidden_content_level_' . $i]) && !empty($_POST['hidden_content_level_' . $i])) {
                $hidden_content_messages[$i] = $_POST['hidden_content_level_' . $i];
            }
        }
        if (isset($_POST['legacyBBC']) && !empty($_POST['legacyBBC'])) {
            HookAPI::addHook('integrate_bbc_codes', 'LegacyBBC', 'main.php', 'legacybbc_addtags');
        } else {
            HookAPI::removeAll('LegacyBBC');
        }
        saveDBSettings($config_vars);
        if (count($hidden_content_messages)) {
            updateSettings(array('hidden_content_no_view' => serialize($hidden_content_messages)));
        }
        redirectexit('action=admin;area=postsettings;sa=bbc');
    }
    $context['post_url'] = $scripturl . '?action=admin;area=postsettings;save;sa=bbc';
    $context['settings_title'] = $txt['manageposts_bbc_settings_title'];
    prepareDBSettingContext($config_vars);
}