function ModifyPostSettings($return_config = false) { global $context, $txt, $modSettings, $scripturl, $sourcedir, $backend_subdir; // All the settings... $config_vars = array(array('check', 'enableUserTagging'), array('int', 'maxTagsPerPost'), array('check', 'removeNestedQuotes'), array('check', 'disable_wysiwyg'), array('check', 'use_post_cache'), array('int', 'post_cache_cutoff'), '', array('int', 'max_messageLength', 'subtext' => $txt['max_messageLength_zero'], 'postinput' => $txt['manageposts_characters']), array('int', 'fixLongWords', 'subtext' => $txt['fixLongWords_zero'] . ($context['utf8'] ? ' <span class="alert">' . $txt['fixLongWords_warning'] . '</span>' : ''), 'postinput' => $txt['manageposts_characters']), array('int', 'topicSummaryPosts', 'postinput' => $txt['manageposts_posts']), '', array('int', 'spamWaitTime', 'postinput' => $txt['manageposts_seconds']), array('int', 'edit_wait_time', 'postinput' => $txt['manageposts_seconds']), array('int', 'edit_disable_time', 'subtext' => $txt['edit_disable_time_zero'], 'postinput' => $txt['manageposts_minutes'])); if (!isset($modSettings['post_cache_cutoff']) || $modSettings['post_cache_cutoff'] < 10) { $modSettings['post_cache_cutoff'] = 10; } if ($modSettings['post_cache_cutoff'] > 9999) { $modSettings['post_cache_cutoff'] = 9999; } if (empty($modSettings['maxTagsPerPost']) || $modSettings['maxTagsPerPost'] > 20) { $modSettings['maxTagsPerPost'] = 10; } if ($return_config) { return $config_vars; } // We'll want this for our easy save. require_once $sourcedir . '/' . $backend_subdir . '/ManageServer.php'; // Setup the template. $context['page_title'] = $txt['manageposts_settings']; $context['sub_template'] = 'show_settings'; // Are we saving them - are we?? if (isset($_GET['save'])) { checkSession(); // If we're changing the message length let's check the column is big enough. if (!empty($_POST['max_messageLength']) && $_POST['max_messageLength'] != $modSettings['max_messageLength']) { db_extend('packages'); $colData = smf_db_list_columns('{db_prefix}messages', true); foreach ($colData as $column) { if ($column['name'] == 'body') { $body_type = $column['type']; } } $indData = smf_db_list_indexes('{db_prefix}messages', true); foreach ($indData as $index) { foreach ($index['columns'] as $column) { if ($column == 'body' && $index['type'] == 'fulltext') { $fulltext = true; } } } if (isset($body_type) && $_POST['max_messageLength'] > 65535 && $body_type == 'text') { // !!! Show an error message?! // MySQL only likes fulltext indexes on text columns... for now? if (!empty($fulltext)) { $_POST['max_messageLength'] = 65535; } else { // Make it longer so we can do their limit. smf_db_change_column('{db_prefix}messages', 'body', array('type' => 'mediumtext')); } } elseif (isset($body_type) && $_POST['max_messageLength'] <= 65535 && $body_type != 'text') { // Shorten the column so we can have the benefit of fulltext searching again! smf_db_change_column('{db_prefix}messages', 'body', array('type' => 'text')); } } saveDBSettings($config_vars); redirectexit('action=admin;area=postsettings;sa=posts'); } // Final settings... $context['post_url'] = $scripturl . '?action=admin;area=postsettings;save;sa=posts'; $context['settings_title'] = $txt['manageposts_settings']; // Prepare the settings... prepareDBSettingContext($config_vars); }
function smf_db_table_structure($table_name, $parameters = array()) { global $db_prefix; $table_name = str_replace('{db_prefix}', $db_prefix, $table_name); return array('name' => $table_name, 'columns' => smf_db_list_columns($table_name, true), 'indexes' => smf_db_list_indexes($table_name, true)); }