12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391 |
- /* ATTENTION: You don't need to run or use this file! The upgrade.php script does everything for you! */
- /******************************************************************************/
- --- Adding new settings...
- /******************************************************************************/
- ---# Adding login history...
- CREATE TABLE IF NOT EXISTS {$db_prefix}member_logins (
- id_login integer NOT NULL auto_increment,
- id_member integer NOT NULL,
- time integer NOT NULL,
- ip varchar(255) NOT NULL default '',
- ip2 varchar(255) NOT NULL default '',
- PRIMARY KEY id_login(id_login)
- KEY id_member (id_member)
- KEY time (time)
- );
- ---#
- ---# Copying the current package backup setting...
- ---{
- if (!isset($modSettings['package_make_full_backups']) && isset($modSettings['package_make_backups']))
- upgrade_query("
- INSERT INTO {$db_prefix}settings
- (variable, value)
- VALUES
- ('package_make_full_backups', '" . $modSettings['package_make_backups'] . "')");
- ---}
- ---#
- ---# Copying the current "allow users to disable word censor" setting...
- ---{
- if (!isset($modSettings['allow_no_censored']))
- {
- $request = upgrade_query("
- SELECT value
- FROM {$db_prefix}settings
- WHERE variable='allow_no_censored'
- AND id_theme = 1 OR id_theme = '$modSettings[theme_default]'
- ");
- // Is it set for either "default" or the one they've set as default?
- while ($row = $smcFunc['db_fetch_assoc']($request))
- {
- if ($row['value'] == 1)
- {
- upgrade_query("
- INSERT INTO {$db_prefix}settings
- VALUES ('allow_no_censored', 1)
- ");
- // Don't do this twice...
- break;
- }
- }
- }
- ---}
- ---#
- ---# Adding new "topic_move_any" setting
- INSERT INTO {$db_prefix}settings (variable, value) VALUES ('topic_move_any', '1');
- ---#
- ---# Adding new "browser_cache" setting
- INSERT INTO {$db_prefix}settings (variable, value) VALUES ('browser_cache', '?alph21');
- ---#
- /******************************************************************************/
- --- Updating legacy attachments...
- /******************************************************************************/
- ---# Converting legacy attachments.
- ---{
- // Need to know a few things first.
- $custom_av_dir = !empty($modSettings['custom_avatar_dir']) ? $modSettings['custom_avatar_dir'] : $GLOBALS['boarddir'] .'/custom_avatar';
- // This little fellow has to cooperate...
- if (!is_writable($custom_av_dir))
- @chmod($custom_av_dir, 0777);
- $request = upgrade_query("
- SELECT MAX(id_attach)
- FROM {$db_prefix}attachments");
- list ($step_progress['total']) = $smcFunc['db_fetch_row']($request);
- $smcFunc['db_free_result']($request);
- $_GET['a'] = isset($_GET['a']) ? (int) $_GET['a'] : 0;
- $step_progress['name'] = 'Converting legacy attachments';
- $step_progress['current'] = $_GET['a'];
- // We may be using multiple attachment directories.
- if (!empty($modSettings['currentAttachmentUploadDir']) && !is_array($modSettings['attachmentUploadDir']))
- $modSettings['attachmentUploadDir'] = unserialize($modSettings['attachmentUploadDir']);
- $is_done = false;
- while (!$is_done)
- {
- nextSubStep($substep);
- $request = upgrade_query("
- SELECT id_attach, id_member, id_folder, filename, file_hash, mime_type
- FROM {$db_prefix}attachments
- WHERE attachment_type != 1
- LIMIT $_GET[a], 100");
- // Finished?
- if ($smcFunc['db_num_rows']($request) == 0)
- $is_done = true;
- while ($row = $smcFunc['db_fetch_assoc']($request))
- {
- // The current folder.
- $currentFolder = !empty($modSettings['currentAttachmentUploadDir']) ? $modSettings['attachmentUploadDir'][$row['id_folder']] : $modSettings['attachmentUploadDir'];
- $fileHash = '';
- // Old School?
- if (empty($row['file_hash']))
- {
- // Remove international characters (windows-1252)
- // These lines should never be needed again. Still, behave.
- if (empty($db_character_set) || $db_character_set != 'utf8')
- {
- $row['filename'] = strtr($row['filename'],
- "\x8a\x8e\x9a\x9e\x9f\xc0\xc1\xc2\xc3\xc4\xc5\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd1\xd2\xd3\xd4\xd5\xd6\xd8\xd9\xda\xdb\xdc\xdd\xe0\xe1\xe2\xe3\xe4\xe5\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf1\xf2\xf3\xf4\xf5\xf6\xf8\xf9\xfa\xfb\xfc\xfd\xff",
- 'SZszYAAAAAACEEEEIIIINOOOOOOUUUUYaaaaaaceeeeiiiinoooooouuuuyy');
- $row['filename'] = strtr($row['filename'], array("\xde" => 'TH', "\xfe" =>
- 'th', "\xd0" => 'DH', "\xf0" => 'dh', "\xdf" => 'ss', "\x8c" => 'OE',
- "\x9c" => 'oe', "\xc6" => 'AE', "\xe6" => 'ae', "\xb5" => 'u'));
- }
- // Sorry, no spaces, dots, or anything else but letters allowed.
- $row['filename'] = preg_replace(array('/\s/', '/[^\w_\.\-]/'), array('_', ''), $row['filename']);
- // Create a nice hash.
- $fileHash = sha1(md5($row['filename'] . time()) . mt_rand());
- // Iterate through the possible attachment names until we find the one that exists
- $oldFile = $currentFolder . '/' . $row['id_attach']. '_' . strtr($row['filename'], '.', '_') . md5($row['filename']);
- if (!file_exists($oldFile))
- {
- $oldFile = $currentFolder . '/' . $row['filename'];
- if (!file_exists($oldFile)) $oldFile = false;
- }
- // Build the new file.
- $newFile = $currentFolder . '/' . $row['id_attach'] . '_' . $fileHash .'.dat';
- }
- // Just rename the file.
- else
- {
- $oldFile = $currentFolder . '/' . $row['id_attach'] . '_' . $row['file_hash'];
- $newFile = $currentFolder . '/' . $row['id_attach'] . '_' . $row['file_hash'] .'.dat';
- }
- if (!$oldFile)
- {
- // Existing attachment could not be found. Just skip it...
- continue;
- }
- // Check if the av is an attachment
- if ($row['id_member'] != 0)
- {
- if (rename($oldFile, $custom_av_dir . '/' . $row['filename']))
- upgrade_query("
- UPDATE {$db_prefix}attachments
- SET file_hash = '', attachment_type = 1
- WHERE id_attach = $row[id_attach]");
- }
- // Just a regular attachment.
- else
- {
- rename($oldFile, $newFile);
- }
- // Only update this if it was successful and the file was using the old system.
- if (empty($row['file_hash']) && !empty($fileHash) && file_exists($newFile) && !file_exists($oldFile))
- upgrade_query("
- UPDATE {$db_prefix}attachments
- SET file_hash = '$fileHash'
- WHERE id_attach = $row[id_attach]");
- // While we're here, do we need to update the mime_type?
- if (empty($row['mime_type']) && file_exists($newFile))
- {
- $size = @getimagesize($newFile);
- if (!empty($size['mime']))
- $smcFunc['db_query']('', '
- UPDATE {db_prefix}attachments
- SET mime_type = {string:mime_type}
- WHERE id_attach = {int:id_attach}',
- array(
- 'id_attach' => $row['id_attach'],
- 'mime_type' => substr($size['mime'], 0, 20),
- )
- );
- }
- }
- $smcFunc['db_free_result']($request);
- $_GET['a'] += 100;
- $step_progress['current'] = $_GET['a'];
- }
- unset($_GET['a']);
- ---}
- ---#
- ---# Fixing invalid sizes on attachments
- ---{
- $attachs = array();
- // If id_member = 0, then it's not an avatar
- // If attachment_type = 0, then it's also not a thumbnail
- // Theory says there shouldn't be *that* many of these
- $request = $smcFunc['db_query']('', '
- SELECT id_attach, mime_type, width, height
- FROM {db_prefix}attachments
- WHERE id_member = 0
- AND attachment_type = 0');
- while ($row = $smcFunc['db_fetch_assoc']($request))
- {
- if (($row['width'] > 0 || $row['height'] > 0) && strpos($row['mime_type'], 'image') !== 0)
- $attachs[] = $row['id_attach'];
- }
- $smcFunc['db_free_result']($request);
- if (!empty($attachs))
- $smcFunc['db_query']('', '
- UPDATE {db_prefix}attachments
- SET width = 0,
- height = 0
- WHERE id_attach IN ({array_int:attachs})',
- array(
- 'attachs' => $attachs,
- )
- );
- ---}
- ---#
- /******************************************************************************/
- --- Adding support for IPv6...
- /******************************************************************************/
- ---# Adding new columns to ban items...
- ALTER TABLE {$db_prefix}ban_items
- ADD COLUMN ip_low5 smallint(255) unsigned NOT NULL DEFAULT '0',
- ADD COLUMN ip_high5 smallint(255) unsigned NOT NULL DEFAULT '0',
- ADD COLUMN ip_low6 smallint(255) unsigned NOT NULL DEFAULT '0',
- ADD COLUMN ip_high6 smallint(255) unsigned NOT NULL DEFAULT '0',
- ADD COLUMN ip_low7 smallint(255) unsigned NOT NULL DEFAULT '0',
- ADD COLUMN ip_high7 smallint(255) unsigned NOT NULL DEFAULT '0',
- ADD COLUMN ip_low8 smallint(255) unsigned NOT NULL DEFAULT '0',
- ADD COLUMN ip_high8 smallint(255) unsigned NOT NULL DEFAULT '0';
- ---#
- ---# Changing existing columns to ban items...
- ALTER TABLE {$db_prefix}ban_items
- CHANGE ip_low1 ip_low1 smallint(255) unsigned NOT NULL DEFAULT '0',
- CHANGE ip_high1 ip_high1 smallint(255) unsigned NOT NULL DEFAULT '0',
- CHANGE ip_low2 ip_low2 smallint(255) unsigned NOT NULL DEFAULT '0',
- CHANGE ip_high2 ip_high2 smallint(255) unsigned NOT NULL DEFAULT '0',
- CHANGE ip_low3 ip_low3 smallint(255) unsigned NOT NULL DEFAULT '0',
- CHANGE ip_high3 ip_high3 smallint(255) unsigned NOT NULL DEFAULT '0',
- CHANGE ip_low4 ip_low4 smallint(255) unsigned NOT NULL DEFAULT '0',
- CHANGE ip_high4 ip_high4 smallint(255) unsigned NOT NULL DEFAULT '0';
- ---#
- /******************************************************************************/
- --- Adding support for logging who fulfils a group request.
- /******************************************************************************/
- ---# Adding new columns to log_group_requests
- ALTER TABLE {$db_prefix}log_group_requests
- ADD COLUMN status smallint unsigned NOT NULL default '0',
- ADD COLUMN id_member_acted int unsigned NOT NULL default '0',
- ADD COLUMN member_name_acted varchar(255) NOT NULL default '',
- ADD COLUMN time_acted int unsigned NOT NULL default '0',
- ADD COLUMN act_reason text NOT NULL;
- ---#
- ---# Adjusting the indexes for log_group_requests
- DROP INDEX {$db_prefix}log_group_requests_id_member;
- CREATE INDEX {$db_prefix}log_group_requests_id_member ON {$db_prefix}log_group_requests (id_member, id_group);
- ---#
- /******************************************************************************/
- --- Adding support for <credits> tag in package manager
- /******************************************************************************/
- ---# Adding new columns to log_packages ..
- ALTER TABLE {$db_prefix}log_packages
- ADD COLUMN credits varchar(255) NOT NULL DEFAULT '';
- ---#
- /******************************************************************************/
- --- Adding more space for session ids
- /******************************************************************************/
- ---# Altering the session_id columns...
- ALTER TABLE {$db_prefix}log_online
- CHANGE `session` `session` varchar(64) NOT NULL DEFAULT '';
- ALTER TABLE {$db_prefix}log_errors
- CHANGE `session` `session` char(64) NOT NULL default ' ';
- ALTER TABLE {$db_prefix}sessions
- CHANGE `session_id` `session_id` char(64) NOT NULL;
- ---#
- /******************************************************************************/
- --- Adding new columns for MOVED topic updates
- /******************************************************************************/
- ---# Adding new custom fields columns.
- ---{
- $smcFunc['db_alter_table']('{db_prefix}topics', array(
- 'add' => array(
- 'redirect_expires' => array(
- 'name' => 'redirect_expires',
- 'null' => false,
- 'default' => '0',
- 'type' => 'int',
- 'auto' => false,
- ),
- )
- ));
- $smcFunc['db_alter_table']('{db_prefix}topics', array(
- 'add' => array(
- 'id_redirect_topic' => array(
- 'name' => 'id_redirect_topic',
- 'null' => false,
- 'default' => '0',
- 'type' => 'int',
- 'auto' => false,
- ),
- )
- ));
- ---}
- ---#
- /******************************************************************************/
- --- Adding new scheduled tasks
- /******************************************************************************/
- ---# Adding new scheduled tasks
- INSERT INTO {$db_prefix}scheduled_tasks
- (next_time, time_offset, time_regularity, time_unit, disabled, task)
- VALUES
- (0, 120, 1, 'd', 0, 'remove_temp_attachments');
- INSERT INTO {$db_prefix}scheduled_tasks
- (next_time, time_offset, time_regularity, time_unit, disabled, task)
- VALUES
- (0, 180, 1, 'd', 0, 'remove_topic_redirect');
- INSERT INTO {$db_prefix}scheduled_tasks
- (next_time, time_offset, time_regularity, time_unit, disabled, task)
- VALUES
- (0, 240, 1, 'd', 0, 'remove_old_drafts');
- ---#
- /******************************************************************************/
- ---- Adding background tasks support
- /******************************************************************************/
- ---# Adding the new table
- CREATE TABLE IF NOT EXISTS {$db_prefix}background_tasks (
- id_task integer primary key,
- task_file varchar(255) NOT NULL default '',
- task_class varchar(255) NOT NULL default '',
- task_data text NOT NULL,
- claimed_time int NOT NULL default '0',
- PRIMARY KEY (id_task)
- );
- ---#
- /******************************************************************************/
- --- Adding support for deny boards access
- /******************************************************************************/
- ---# Adding new columns to boards...
- ---{
- $smcFunc['db_alter_table']('{db_prefix}boards', array(
- 'add' => array(
- 'deny_member_groups' => array(
- 'name' => 'deny_member_groups',
- 'null' => false,
- 'default' => '',
- 'type' => varchar,
- 'size' => 255,
- 'auto' => false,
- ),
- )
- ));
- ---}
- ---#
- /******************************************************************************/
- --- Updating board access rules
- /******************************************************************************/
- ---# Updating board access rules
- ---{
- $member_groups = array(
- 'allowed' => array(),
- 'denied' => array(),
- );
- $request = $smcFunc['db_query']('', '
- SELECT id_group, add_deny
- FROM {db_prefix}permissions
- WHERE permission = {string:permission}',
- array(
- 'permission' => 'manage_boards',
- )
- );
- while ($row = $smcFunc['db_fetch_assoc']($request))
- $member_groups[$row['add_deny'] === '1' ? 'allowed' : 'denied'][] = $row['id_group'];
- $smcFunc['db_free_result']($request);
- $member_groups = array_diff($member_groups['allowed'], $member_groups['denied']);
- if (!empty($member_groups))
- {
- $count = count($member_groups);
- $changes = array();
- $request = $smcFunc['db_query']('', '
- SELECT id_board, member_groups
- FROM {db_prefix}boards');
- while ($row = $smcFunc['db_fetch_assoc']($request))
- {
- $current_groups = explode(',', $row['member_groups']);
- if (count(array_intersect($current_groups, $member_groups)) != $count)
- {
- $new_groups = array_unique(array_merge($current_groups, $member_groups));
- $changes[$row['id_board']] = implode(',', $new_groups);
- }
- }
- $smcFunc['db_free_result']($request);
- if (!empty($changes))
- {
- foreach ($changes as $id_board => $member_groups)
- $smcFunc['db_query']('', '
- UPDATE {db_prefix}boards
- SET member_groups = {string:member_groups}
- WHERE id_board = {int:id_board}',
- array(
- 'member_groups' => $member_groups,
- 'id_board' => $id_board,
- )
- );
- }
- }
- ---}
- ---#
- /******************************************************************************/
- --- Adding support for category descriptions
- /******************************************************************************/
- ---# Adding new columns to categories...
- ---{
- $smcFunc['db_alter_table']('{db_prefix}log_topics', array(
- 'add' => array(
- 'description' => array(
- 'name' => 'description',
- 'null' => false,
- 'type' => 'text',
- 'auto' => false,
- ),
- )
- ));
- ---}
- ---#
- /******************************************************************************/
- --- Adding support for alerts
- /******************************************************************************/
- ---# Adding the count to the members table...
- ---{
- $smcFunc['db_alter_table']('{db_prefix}members', array(
- 'add' => array(
- 'alerts' => array(
- 'name' => 'ualerts',
- 'null' => false,
- 'default' => 0,
- 'type' => 'int',
- 'auto' => false,
- ),
- )
- ));
- ---}
- ---#
- ---# Adding the new table for alerts.
- CREATE TABLE IF NOT EXISTS {$db_prefix}user_alerts (
- id_alert int primary key,
- alert_time int unsigned NOT NULL default '0',
- id_member int unsigned NOT NULL default '0',
- id_member_started int unsigned NOT NULL default '0',
- member_name varchar(255) NOT NULL default '',
- content_type varchar(255) NOT NULL default '',
- content_id int unsigned NOT NULL default '0',
- content_action varchar(255) NOT NULL default '',
- is_read int unsigned NOT NULL default '0',
- extra text NOT NULL,
- PRIMARY KEY (id_alert)
- );
- CREATE INDEX {$db_prefix}user_alerts_id_member ON {$db_prefix}user_alerts (id_member);
- CREATE INDEX {$db_prefix}user_alerts_alert_time ON {$db_prefix}user_alerts (alert_time);
- ---#
- ---# Adding alert preferences.
- CREATE TABLE IF NOT EXISTS {$db_prefix}user_alerts_prefs (
- id_member int unsigned NOT NULL default '0',
- alert_pref varchar(32) NOT NULL default '',
- alert_value tinyint(3) NOT NULL default '0',
- PRIMARY KEY (id_member, alert_pref)
- );
- INSERT INTO {$db_prefix}user_alerts_prefs (id_member, alert_pref, alert_value) VALUES (0, 'member_group_request', 1);
- INSERT INTO {$db_prefix}user_alerts_prefs (id_member, alert_pref, alert_value) VALUES (0, 'member_register', 1);
- INSERT INTO {$db_prefix}user_alerts_prefs (id_member, alert_pref, alert_value) VALUES (0, 'msg_like', 1);
- INSERT INTO {$db_prefix}user_alerts_prefs (id_member, alert_pref, alert_value) VALUES (0, 'msg_report', 1);
- INSERT INTO {$db_prefix}user_alerts_prefs (id_member, alert_pref, alert_value) VALUES (0, 'msg_report_reply', 1);
- ---#
- /******************************************************************************/
- --- Adding support for topic unwatch
- /******************************************************************************/
- ---# Adding new columns to log_topics...
- ---{
- $smcFunc['db_alter_table']('{db_prefix}log_topics', array(
- 'add' => array(
- 'unwatched' => array(
- 'name' => 'unwatched',
- 'null' => false,
- 'default' => 0,
- 'type' => 'int',
- 'auto' => false,
- ),
- )
- ));
- UPDATE {$db_prefix}log_topics
- SET unwatched = 0;
- INSERT INTO {$db_prefix}settings
- (variable, value)
- VALUES
- ('enable_unwatch', 0);
- ---}
- ---#
- ---# Fixing column name change...
- ---{
- $smcFunc['db_alter_table']('{db_prefix}log_topics', array(
- 'change' => array(
- 'disregarded' => array(
- 'name' => 'unwatched',
- 'null' => false,
- 'default' => 0,
- 'type' => 'int',
- 'auto' => false,
- ),
- )
- ));
- ---}
- ---#
- /******************************************************************************/
- --- Name changes
- /******************************************************************************/
- ---# Altering the membergroup stars to icons
- ---{
- upgrade_query("
- ALTER TABLE {$db_prefix}membergroups
- CHANGE `stars` `icons` varchar(255) NOT NULL DEFAULT ''");
- ---}
- ---#
- ---# Renaming default theme...
- UPDATE {$db_prefix}themes
- SET value = 'SMF Default Theme - Curve2'
- WHERE value LIKE 'SMF Default Theme%';
- ---#
- ---# Adding the enableThemes setting.
- INSERT INTO {$db_prefix}settings
- (variable, value)
- VALUES
- ('enableThemes', '1');
- ---#
- ---# Setting "default" as the default...
- UPDATE {$db_prefix}settings
- SET value = '1'
- WHERE variable = 'theme_guests';
- UPDATE {$db_prefix}boards
- SET id_theme = 0;
- UPDATE {$db_prefix}members
- SET id_theme = 0;
- ---#
- /******************************************************************************/
- --- Cleaning up after old themes...
- /******************************************************************************/
- ---# Checking for "core" and removing it if necessary...
- ---{
- // Do they have "core" installed?
- if (file_exists($GLOBALS['boarddir'] . '/Themes/core'))
- {
- $core_dir = $GLOBALS['boarddir'] . '/Themes/core';
- $theme_request = upgrade_query("
- SELECT id_theme
- FROM {$db_prefix}themes
- WHERE variable = 'theme_dir'
- AND value ='$core_dir'");
- // Don't do anything if this theme is already uninstalled
- if ($smcFunc['db_num_rows']($theme_request) == 1)
- {
- list($id_theme) = $smcFunc['db_fetch_row']($theme_request, 0);
- $smcFunc['db_free_result']($theme_request);
- $known_themes = explode(', ', $modSettings['knownThemes']);
- // Remove this value...
- $known_themes = array_diff($known_themes, array($id_theme));
- // Change back to a string...
- $known_themes = implode(', ', $known_themes);
- // Update the database
- upgrade_query("
- UPDATE {$db_prefix}settings
- SET value = '$known_themes'
- WHERE variable = 'knownThemes'");
- // Delete any info about this theme
- upgrade_query("
- DELETE FROM {$db_prefix}themes
- WHERE id_theme = $id_theme");
- }
- }
- /******************************************************************************/
- --- Messenger fields
- /******************************************************************************/
- ---# Adding new field_order column...
- ALTER TABLE {$db_prefix}custom_fields
- ADD COLUMN field_order smallint NOT NULL default '0';
- ---#
- ---# Adding new show_mlist column...
- ALTER TABLE {$db_prefix}custom_fields
- ADD COLUMN show_mlist smallint NOT NULL default '0';
- ---#
- ---# Insert fields
- INSERT INTO `{$db_prefix}custom_fields` (`col_name`, `field_name`, `field_desc`, `field_type`, `field_length`, `field_options`, `field_order`, `mask`, `show_reg`, `show_display`, `show_mlist`, `show_profile`, `private`, `active`, `bbc`, `can_search`, `default_value`, `enclose`, `placement`) VALUES
- ('cust_aolins', 'AOL Instant Messenger', 'This is your AOL Instant Messenger nickname.', 'text', 50, '', 1, 'regex~[a-z][0-9a-z.-]{1,31}~i', 0, 1, 0, 'forumprofile', 0, 1, 0, 0, '', '<a class="aim" href="aim:goim?screenname={INPUT}&message=Hello!+Are+you+there?" target="_blank" title="AIM - {INPUT}"><img src="{IMAGES_URL}/aim.png" alt="AIM - {INPUT}"></a>', 1),
- ('cust_icq', 'ICQ', 'This is your ICQ number.', 'text', 12, '', 2, 'regex~[1-9][0-9]{4,9}~i', 0, 1, 0, 'forumprofile', 0, 1, 0, 0, '', '<a class="icq" href="http://www.icq.com/people/{INPUT}" target="_blank" title="ICQ - {INPUT}"><img src="{DEFAULT_IMAGES_URL}/icq.png" alt="ICQ - {INPUT}"></a>', 1),
- ('cust_skype', 'Skype', 'Your Skype name', 'text', 32, '', 3, 'nohtml', 0, 1, 0, 'forumprofile', 0, 1, 0, 0, '', '<a href="skype:{INPUT}?call"><img src="{DEFAULT_IMAGES_URL}/skype.png" alt="{INPUT}" title="{INPUT}" /></a> ', 1),
- ('cust_yahoo', 'Yahoo! Messenger', 'This is your Yahoo! Instant Messenger nickname.', 'text', 50, '', 4, 'nohtml', 0, 1, 0, 'forumprofile', 0, 1, 0, 0, '', '<a class="yim" href="http://edit.yahoo.com/config/send_webmesg?.target={INPUT}" target="_blank" title="Yahoo! Messenger - {INPUT}"><img src="{IMAGES_URL}/yahoo.png" alt="Yahoo! Messenger - {INPUT}"></a>', 1),
- ('cust_loca', 'Location', 'Geographic location.', 'text', 50, '', 5, 'nohtml', 0, 1, 0, 'forumprofile', 0, 1, 0, 0, '', '', 0),
- ('cust_gender', 'Gender', 'Your gender.', 'radio', 255, 'Male,Female', 6, 'nohtml', 1, 1, 0, 'forumprofile', 0, 1, 0, 0, 'Male', '<span class=" generic_icons gender_{INPUT}" alt="{INPUT}" title="{INPUT}">', 1);
- ---#
- ---# Add an order value to each existing cust profile field.
- ---{
- $ocf = $smcFunc['db_query']('', '
- SELECT id_field
- FROM {db_prefix}custom_fields');
- // We start counting from 6 because we already have the first 6 fields.
- $fields_count = 6;
- while ($row = $smcFunc['db_fetch_assoc']($ocf))
- {
- $fields_count++;
- if (!empty($row['id_field']))
- $smcFunc['db_query']('', '
- UPDATE {db_prefix}custom_fields
- SET field_order = {int:field_count}, show_mlist = {int:show_mlist}
- WHERE id_field = {int:id_field}
- AND field_order = {int:show_mlist}',
- array(
- 'field_count' => $fields_count,
- 'show_list' => 0,
- 'id_field' => $row['id_field'],
- 'six' => 6,
- )
- );
- }
- $smcFunc['db_free_result']($ocf);
- ---}
- ---#
- ---# Converting member values...
- ---{
- // We cannot do this twice
- if (@$modSettings['smfVersion'] < '2.1')
- {
- $request = $smcFunc['db_query']('', '
- SELECT id_member, aim, icq, msn, yim, location, gender
- FROM {db_prefix}members');
- $inserts = array();
- while ($row = $smcFunc['db_fetch_assoc']($request))
- {
- if (!empty($row['aim']))
- $inserts[] = array($row['id_member'], -1, 'cust_aolins', $row['aim']);
- if (!empty($row['icq']))
- $inserts[] = array($row['id_member'], -1, 'cust_icq', $row['icq']);
- if (!empty($row['msn']))
- $inserts[] = array($row['id_member'], -1, 'cust_skyp', $row['msn']);
- if (!empty($row['yim']))
- $inserts[] = array($row['id_member'], -1, 'cust_yim', $row['yim']);
- if (!empty($row['location']))
- $inserts[] = array($row['id_member'], -1, 'cust_loca', $row['location']);
- if (!empty($row['gender']))
- $inserts[] = array($row['id_member'], -1, 'cust_gender', $row['gender']);
- }
- $smcFunc['db_free_result']($request);
- if (!empty($inserts))
- $smcFunc['db_insert']('replace',
- '{db_prefix}themes',
- array('id_member' => 'int', 'id_theme' => 'int', 'variable' => 'string', 'value' => 'string'),
- $inserts,
- array('id_theme', 'id_member', 'variable')
- );
- }
- ---}
- ---#
- ---# Dropping old fields
- ALTER TABLE `{$db_prefix}members`
- DROP `icq`,
- DROP `aim`,
- DROP `yim`,
- DROP `msn`,
- DROP `location`,
- DROP `gender`;
- ---#
- /******************************************************************************/
- --- Adding support for drafts
- /******************************************************************************/
- ---# Creating drafts table.
- CREATE TABLE IF NOT EXISTS {$db_prefix}user_drafts (
- id_draft int unsigned NOT NULL auto_increment,
- id_topic int unsigned NOT NULL default '0',
- id_board smallint unsigned NOT NULL default '0',
- id_reply int unsigned NOT NULL default '0',
- type smallint NOT NULL default '0',
- poster_time int unsigned NOT NULL default '0',
- id_member int unsigned NOT NULL default '0',
- subject varchar(255) NOT NULL default '',
- smileys_enabled smallint NOT NULL default '1',
- body text NOT NULL,
- icon varchar(16) NOT NULL default 'xx',
- locked smallint NOT NULL default '0',
- is_sticky smallint NOT NULL default '0',
- to_list varchar(255) NOT NULL default '',
- PRIMARY KEY (id_draft)
- );
- CREATE UNIQUE INDEX {$db_prefix}user_drafts_id_member ON {$db_prefix}user_drafts (id_member, id_draft, type);
- ---#
- ---# Adding draft permissions...
- ---{
- // We cannot do this twice
- if (@$modSettings['smfVersion'] < '2.1')
- {
- // Anyone who can currently post unapproved topics we assume can create drafts as well ...
- $request = upgrade_query("
- SELECT id_group, id_board, add_deny, permission
- FROM {$db_prefix}board_permissions
- WHERE permission = 'post_unapproved_topics'");
- $inserts = array();
- while ($row = $smcFunc['db_fetch_assoc']($request))
- {
- $inserts[] = "($row[id_group], $row[id_board], 'post_draft', $row[add_deny])";
- $inserts[] = "($row[id_group], $row[id_board], 'post_autosave_draft', $row[add_deny])";
- }
- $smcFunc['db_free_result']($request);
- if (!empty($inserts))
- {
- foreach ($inserts AS $insert)
- {
- upgrade_query("
- INSERT INTO {$db_prefix}board_permissions
- (id_group, id_board, permission, add_deny)
- VALUES
- " . $insert);
- }
- }
- // Next we find people who can send PMs, and assume they can save pm_drafts as well
- $request = upgrade_query("
- SELECT id_group, add_deny, permission
- FROM {$db_prefix}permissions
- WHERE permission = 'pm_send'");
- $inserts = array();
- while ($row = $smcFunc['db_fetch_assoc']($request))
- {
- $inserts[] = "($row[id_group], 'pm_draft', $row[add_deny])";
- $inserts[] = "($row[id_group], 'pm_autosave_draft', $row[add_deny])";
- }
- $smcFunc['db_free_result']($request);
- if (!empty($inserts))
- {
- foreach ($inserts AS $insert)
- {
- upgrade_query("
- INSERT INTO {$db_prefix}permissions
- (id_group, permission, add_deny)
- VALUES
- " . $insert);
- }
- }
- }
- ---}
- INSERT INTO {$db_prefix}settings (variable, value) VALUES ('drafts_autosave_enabled', '1');
- INSERT INTO {$db_prefix}settings (variable, value) VALUES ('drafts_show_saved_enabled', '1');
- INSERT INTO {$db_prefix}settings (variable, value) VALUES ('drafts_keep_days', '7');
- INSERT INTO {$db_prefix}themes (id_theme, variable, value) VALUES ('1', 'drafts_autosave_enabled', '1');
- INSERT INTO {$db_prefix}themes (id_theme, variable, value) VALUES ('1', 'drafts_show_saved_enabled', '1');
- ---#
- /******************************************************************************/
- --- Adding support for likes
- /******************************************************************************/
- ---# Creating likes table.
- CREATE TABLE IF NOT EXISTS {$db_prefix}user_likes (
- id_member int NOT NULL default '0',
- content_type char(6) default '',
- content_id int NOT NULL default '0',
- like_time int NOT NULL default '0',
- PRIMARY KEY (content_id, content_type, id_member)
- );
- CREATE INDEX {$db_prefix}user_likes_content ON {$db_prefix}user_likes (content_id, content_type);
- CREATE INDEX {$db_prefix}user_likes_liker ON {$db_prefix}user_likes (id_member);
- ---#
- ---# Adding count to the messages table.
- ALTER TABLE {$db_prefix}messages
- ADD COLUMN likes smallint NOT NULL default '0';
- ---#
- /******************************************************************************/
- --- Adding support for group-based board moderation
- /******************************************************************************/
- ---# Creating moderator_groups table
- CREATE TABLE IF NOT EXISTS {$db_prefix}moderator_groups (
- id_board smallint NOT NULL default '0',
- id_group smallint NOT NULL default '0',
- PRIMARY KEY (id_board, id_group)
- );
- ---#
- /******************************************************************************/
- --- Cleaning up integration hooks
- /******************************************************************************/
- ---#
- DELETE FROM {$db_prefix}settings
- WHERE variable LIKE 'integrate_%';
- ---#
- /******************************************************************************/
- --- Cleaning up old settings
- /******************************************************************************/
- ---# Updating the default time format
- ---{
- if (!empty($modSettings['time_format']))
- {
- // First, use the shortened form of the month in the date.
- $time_format = str_replace('%B', '%b', $modSettings['time_format']);
- // Second, shorten the time to stop including seconds.
- $time_format = str_replace(':%S', '', $time_format);
- // Then, update the database.
- $smcFunc['db_query']('', '
- UPDATE {db_prefix}settings
- SET value = {string:new_format}
- WHERE variable = {literal:time_format}',
- array(
- 'new_format' => $time_format,
- )
- );
- }
- ---}
- ---#
- ---# Fixing a deprecated option.
- UPDATE {$db_prefix}settings
- SET value = 'option_css_resize'
- WHERE variable = 'avatar_action_too_large'
- AND (value = 'option_html_resize' OR value = 'option_js_resize');
- ---#
- ---# Cleaning up the old Core Features page.
- ---{
- // First get the original value
- $request = $smcFunc['db_query']('', '
- SELECT value
- FROM {db_prefix}settings
- WHERE variable = {literal:admin_features}');
- if ($smcFunc['db_num_rows']($request) > 0 && $row = $smcFunc['db_fetch_assoc']($request))
- {
- // Some of these *should* already be set but you never know.
- $new_settings = array();
- $admin_features = explode(',', $row['value']);
- // Now, let's just recap something.
- // cd = calendar, should also have set cal_enabled already
- // cp = custom profile fields, which already has several fields that cover tracking
- // k = karma, should also have set karmaMode already
- // ps = paid subs, should also have set paid_enabled already
- // rg = reports generation, which is now permanently on
- // sp = spider tracking, should also have set spider_mode already
- // w = warning system, which will be covered with warning_settings
- // The rest we have to deal with manually.
- // Moderation log - modlog_enabled itself should be set but we have others now
- if (in_array('ml', $admin_features))
- {
- $new_settings[] = array('adminlog_enabled', '1');
- $new_settings[] = array('userlog_enabled', '1');
- }
- // Post moderation
- if (in_array('pm', $admin_features))
- {
- $new_settings[] = array('postmod_active', '1');
- }
- // And now actually apply it.
- if (!empty($new_settings))
- {
- $smcFunc['db_insert']('replace',
- '{db_prefix}settings',
- array('variable' => 'string', 'value' => 'string'),
- $new_settings,
- array('variable')
- );
- }
- }
- $smcFunc['db_free_result']($request);
- ---}
- ---#
- ---# Cleaning up old settings.
- DELETE FROM {$db_prefix}settings
- WHERE variable IN ('enableStickyTopics', 'guest_hideContacts', 'notify_new_registration', 'attachmentEncryptFilenames', 'hotTopicPosts', 'hotTopicVeryPosts', 'fixLongWords', 'admin_features', 'topbottomEnable', 'simpleSearch', 'enableVBStyleLogin');
- ---#
- ---# Cleaning up old theme settings.
- DELETE FROM {$db_prefix}themes
- WHERE variable IN ('show_board_desc', 'no_new_reply_warning', 'display_quick_reply', 'show_mark_read', 'show_member_bar', 'linktree_link');
- ---#
- /******************************************************************************/
- --- Updating files that fetched from simplemachines.org
- /******************************************************************************/
- ---# We no longer call on several files.
- DELETE FROM {$db_prefix}admin_info_files
- WHERE filename IN ('latest-packages.js', 'latest-support.js', 'latest-themes.js')
- AND path = '/smf/';
- ---#
- ---# But we do need new files.
- ---{
- $smcFunc['db_insert']('',
- '{db_prefix}admin_info_files',
- array('filename' => 'string', 'path' => 'string', 'parameters' => 'string', 'data' => 'string', 'filetype' => 'string'),
- array('latest-versions.txt', '/smf/', 'version=%3$s', '', 'text/plain'),
- array('id_file')
- );
- ---}
- ---#
- /******************************************************************************/
- --- Upgrading "verification questions" feature
- /******************************************************************************/
- ---# Creating qanda table
- CREATE TABLE IF NOT EXISTS {$db_prefix}qanda (
- id_question smallint(5) unsigned NOT NULL auto_increment,
- lngfile varchar(255) NOT NULL default '',
- question varchar(255) NOT NULL default '',
- answers text NOT NULL,
- PRIMARY KEY (id_question),
- KEY lngfile (lngfile)
- );
- ---#
- ---# Moving questions and answers to the new table
- ---{
- $questions = array();
- $get_questions = upgrade_query("
- SELECT body AS question, recipient_name AS answer
- FROM {$db_prefix}log_comments
- WHERE comment_type = 'ver_test'");
- while ($row = $smcFunc['db_fetch_assoc']($get_questions))
- $questions[] = array($language, $row['question'], serialize(array($row['answer'])));
- $smcFunc['db_free_result']($get_questions);
- if (!empty($questions))
- {
- $smcFunc['db_insert']('',
- '{db_prefix}qanda',
- array('lngfile' => 'string', 'question' => 'string', 'answers' => 'string'),
- $questions,
- array('id_question')
- );
- // Delete the questions from log_comments now
- upgrade_query("
- DELETE FROM {$db_prefix}log_comments
- WHERE comment_type = 'ver_test'
- ");
- }
- ---}
- ---#
- /******************************************************************************/
- --- Marking packages as uninstalled...
- /******************************************************************************/
- ---# Updating log_packages
- UPDATE {$db_prefix}log_packages
- SET install_state = 0;
- ---#
- /******************************************************************************/
- --- Updating profile permissions...
- /******************************************************************************/
- ---# Removing the old "view your own profile" permission
- DELETE FROM {$db_prefix}permissions
- WHERE permission = 'profile_view_own';
- ---#
- ---# Updating the old "view any profile" permission
- UPDATE {$db_prefix}permissions
- SET permission = 'profile_view'
- WHERE permission = 'profile_view_any';
- ---#
- ---# Removing the old notification permissions
- DELETE FROM {$db_prefix}board_permissions
- WHERE permission = 'mark_notify' OR permission = 'mark_any_notify';
- ---#
- ---# Removing the send-topic permission
- DELETE FROM {$db_prefix}board_permissions
- WHERE permission = 'send_topic';
- ---#
- ---# Adding "profile_password_own"
- ---{
- $inserts = array();
- $request = upgrade_query("
- SELECT id_group, add_deny
- FROM {$db_prefix}permissions
- WHERE permission = 'profile_identity_own'");
- while ($row = $smcFunc['db_fetch_assoc']($request))
- {
- $inserts[] = "($row[id_group], 'profile_password_own', $row[add_deny])";
- }
- $smcFunc['db_free_result']($request);
- if (!empty($inserts))
- {
- foreach ($inserts as $insert)
- {
- upgrade_query("
- INSERT INTO {$db_prefix}permissions
- (id_group, permission, add_deny)
- VALUES
- " . $insert);
- }
- }
- ---}
- ---#
- ---# Adding other profile permissions
- ---{
- $inserts = array();
- $request = upgrade_query("
- SELECT id_group, add_deny
- FROM {$db_prefix}permissions
- WHERE permission = 'profile_extra_own'");
- while ($row = $smcFunc['db_fetch_assoc']($request))
- {
- $inserts[] = "($row[id_group], 'profile_blurb_own', $row[add_deny])";
- $inserts[] = "($row[id_group], 'profile_displayed_name_own', $row[add_deny])";
- $inserts[] = "($row[id_group], 'profile_forum_own', $row[add_deny])";
- $inserts[] = "($row[id_group], 'profile_other_own', $row[add_deny])";
- $inserts[] = "($row[id_group], 'profile_signature_own', $row[add_deny])";
- }
- $smcFunc['db_free_result']($request);
- if (!empty($inserts))
- {
- foreach ($inserts as $insert)
- {
- upgrade_query("
- INSERT INTO {$db_prefix}permissions
- (id_group, permission, add_deny)
- VALUES
- " . $insert);
- }
- }
- ---}
- ---#
- /******************************************************************************/
- --- Upgrading PM labels...
- /******************************************************************************/
- ---# Adding pm_labels table...
- CREATE TABLE IF NOT EXISTS {$db_prefix}pm_labels (
- id_label integer primary key,
- id_member int NOT NULL default '0',
- name varchar(30) NOT NULL default '',
- );
- ---#
- ---# Adding pm_labeled_messages table...
- CREATE TABLE IF NOT EXISTS {$db_prefix}pm_labeled_messages (
- id_label int NOT NULL default '0',
- id_pm int NOT NULL default '0',
- PRIMARY KEY (id_label, id_pm)
- );
- ---#
- ---# Adding "in_inbox" column to pm_recipients
- ALTER TABLE {$db_prefix}pm_recipients
- ADD COLUMN in_inbox tinyint(3) NOT NULL default '1';
- ---#
- ---# Moving label info to new tables and updating rules...
- ---{
- // First see if we still have a message_labels column
- $results = $smcFunc['db_list_columns']('{db_prefix}members');
- if (in_array('message_labels', $results))
- {
- // They've still got it, so pull the label info
- $get_labels = $smcFunc['db_query']('', '
- SELECT id_member, message_labels
- FROM {db_prefix}members
- WHERE message_labels != {string:blank}',
- array(
- 'blank' => '',
- )
- );
- $inserts = array();
- $label_info = array();
- while ($row = $smcFunc['db_fetch_assoc']($get_labels))
- {
- // Stick this in an array
- $labels = explode(',', $row['message_labels']);
- // Build some inserts
- foreach ($labels AS $index => $label)
- {
- // Keep track of the index of this label - we'll need that in a bit...
- $label_info[$row['id_member']][$label] = $index;
- }
- }
- $smcFunc['db_free_result']($get_labels);
- foreach ($label_info AS $id_member => $labels)
- {
- foreach ($labels as $label => $index)
- {
- $inserts[] = array($id_member, $label);
- }
- }
- if (!empty($inserts))
- {
- $smcFunc['db_insert']('', '{db_prefix}pm_labels', array('id_member' => 'int', 'name' => 'string-30'), $inserts, array());
- // Clear this out for our next query below
- $inserts = array();
- }
- // This is the easy part - update the inbox stuff
- $smcFunc['db_query']('', '
- UPDATE {db_prefix}pm_recipients
- SET in_inbox = {int:in_inbox}
- WHERE FIND_IN_SET({int:minusone}, labels)',
- array(
- 'in_inbox' => 1,
- 'minusone' => -1,
- )
- );
- // Now we go pull the new IDs for each label
- $get_new_label_ids = $smcFunc['db_query']('', '
- SELECT *
- FROM {db_prefix}pm_labels',
- array(
- )
- );
- $label_info_2 = array();
- while ($label_row = $smcFunc['db_fetch_assoc']($get_new_label_ids))
- {
- // Map the old index values to the new ID values...
- $old_index = $label_info[$label_row['id_member']][$label_row['name']];
- $label_info_2[$label_row['id_member']][$old_index] = $label_row['id_label'];
- }
- $smcFunc['db_free_result']($get_new_label_ids);
- // Pull label info from pm_recipients
- // Ignore any that are only in the inbox
- $get_pm_labels = $smcFunc['db_query']('', '
- SELECT id_pm, id_member, labels
- FROM {db_prefix}pm_recipients
- WHERE deleted = {int:not_deleted}
- AND labels != {string:minus_one}',
- array(
- 'not_deleted' => 0,
- 'minus_one' => -1,
- )
- );
- while ($row = $smcFunc['db_fetch_assoc']($get_pm_labels))
- {
- $labels = explode(',', $row['labels']);
- foreach ($labels as $a_label)
- {
- if ($a_label == '-1')
- continue;
- $new_label_info = $label_info_2[$row['id_member']][$a_label];
- $inserts[] = array($row['id_pm'], $new_label_info);
- }
- }
- $smcFunc['db_free_result']($get_pm_labels);
- // Insert the new data
- if (!empty($inserts))
- {
- $smcFunc['db_insert']('', '{db_prefix}pm_labeled_messages', array('id_pm' => 'int', 'id_label' => 'int'), $inserts, array());
- }
- // Final step of this ridiculously massive process
- $get_pm_rules = $smcFunc['db_query']('', '
- SELECT id_member, id_rule, actions
- FROM {db_prefix}pm_rules',
- array(
- )
- );
- // Go through the rules, unserialize the actions, then figure out if there's anything we can use
- while ($row = $smcFunc['db_fetch_assoc']($get_pm_rules))
- {
- // Turn this into an array...
- $actions = unserialize($row['actions']);
- // Loop through the actions and see if we're applying a label anywhere
- foreach ($actions as $index => $action)
- {
- if ($action['t'] == 'lab')
- {
- // Update the value of this label...
- $actions[$index]['v'] = $label_info_2[$row['id_member']][$action['v']];
- }
- }
- // Put this back into a string
- $actions = serialize($actions);
- $smcFunc['db_query']('', '
- UPDATE {db_prefix}pm_rules
- SET actions = {string:actions}
- WHERE id_rule = {int:id_rule}',
- array(
- 'actions' => $actions,
- 'id_rule' => $row['id_rule'],
- )
- );
- }
- $smcFunc['db_free_result']($get_pm_rules);
- // Lastly, we drop the old columns
- $smcFunc['db_remove_column']('{db_prefix}members', 'message_labels');
- $smcFunc['db_remove_column']('{db_prefix}pm_recipients', 'labels');
- }
- ---}
- ---#
- /******************************************************************************/
- --- Adding support for edit reasons
- /******************************************************************************/
- ---# Adding "modified_reason" column to messages
- ALTER TABLE {$db_prefix}messages
- ADD COLUMN modified_reason varchar(255) NOT NULL default '';
- ---#
- /******************************************************************************/
- --- Cleaning up guest permissions
- /******************************************************************************/
- ---# Removing permissions guests can no longer have...
- ---{
- $illegal_board_permissions = array(
- 'announce_topic',
- 'delete_any',
- 'lock_any',
- 'make_sticky',
- 'merge_any',
- 'modify_any',
- 'modify_replies',
- 'move_any',
- 'poll_add_any',
- 'poll_edit_any',
- 'poll_lock_any',
- 'poll_remove_any',
- 'remove_any',
- 'report_any',
- 'split_any'
- );
- $illegal_permissions = array('calendar_edit_any', 'moderate_board', 'moderate_forum', 'send_email_to_members');
- $smcFunc['db_query']('', '
- DELETE FROM {db_prefix}board_permissions
- WHERE id_group = {int:guests}
- AND permission IN ({array_string:illegal_board_perms})',
- array(
- 'guests' => -1,
- 'illegal_board_perms' => $illegal_board_permissions,
- )
- );
- $smcFunc['db_query']('', '
- DELETE FROM {db_prefix}permissions
- WHERE id_group = {int:guests}
- AND permission IN ({array_string:illegal_perms})',
- array(
- 'guests' => -1,
- 'illegal_perms' => $illegal_permissions,
- )
- );
- ---}
- ---#
- /******************************************************************************/
- --- Adding mail queue settings
- /******************************************************************************/
- ---#
- ---{
- if (empty($modSettings['mail_limit']))
- {
- $smcFunc['db_insert']('replace',
- '{db_prefix}settings',
- array('variable' => 'string-255', 'value' => 'string'),
- array(
- array('mail_limit', '5'),
- array('mail_quantity', '5'),
- ),
- array('variable')
- );
- }
- ---}
- ---#
|