|
@@ -97,10 +97,9 @@ $is_done = false;
|
|
|
while (!$is_done)
|
|
|
{
|
|
|
nextSubStep($substep);
|
|
|
- $fileHash = '';
|
|
|
|
|
|
$request = upgrade_query("
|
|
|
- SELECT id_attach, id_folder, filename, file_hash, mime_type
|
|
|
+ SELECT id_attach, id_member, id_folder, filename, file_hash, mime_type
|
|
|
FROM {$db_prefix}attachments
|
|
|
WHERE attachment_type != 1
|
|
|
LIMIT $_GET[a], 100");
|
|
@@ -114,6 +113,8 @@ while (!$is_done)
|
|
|
// The current folder.
|
|
|
$currentFolder = !empty($modSettings['currentAttachmentUploadDir']) ? $modSettings['attachmentUploadDir'][$row['id_folder']] : $modSettings['attachmentUploadDir'];
|
|
|
|
|
|
+ $fileHash = '';
|
|
|
+
|
|
|
// Old School?
|
|
|
if (empty($row['file_hash']))
|
|
|
{
|
|
@@ -134,12 +135,13 @@ while (!$is_done)
|
|
|
// Create a nice hash.
|
|
|
$fileHash = sha1(md5($row['filename'] . time()) . mt_rand());
|
|
|
|
|
|
- // The old file, we need to know if the filename was encrypted or not.
|
|
|
- if (file_exists($currentFolder . '/' . $row['id_attach']. '_' . strtr($row['filename'], '.', '_') . md5($row['filename'])))
|
|
|
- $oldFile = $currentFolder . '/' . $row['id_attach']. '_' . strtr($row['filename'], '.', '_') . md5($row['filename']);
|
|
|
-
|
|
|
- else if (file_exists($currentFolder . '/' . $row['filename']));
|
|
|
+ // 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';
|
|
@@ -152,17 +154,26 @@ while (!$is_done)
|
|
|
$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))
|
|
@@ -638,35 +649,49 @@ 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_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, '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, '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, '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, 'email', 0, 1, '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, 'email', 0, 1, 'forumprofile', 0, 1, 0, 0, '', '', 1),
|
|
|
-('cust_gender', 'Gender', 'Your gender.', 'radio', 255, 'Male,Female', 6, 'nohtml', 1, 1, 'forumprofile', 0, 1, 0, 0, 'Male', '<span class=" generic_icons gender_{INPUT}" alt="{INPUT}" title="{INPUT}">', 1);
|
|
|
+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 exiting cust profile field.
|
|
|
+---# Add an order value to each existing cust profile field.
|
|
|
---{
|
|
|
- $old_cust_fields = upgrade_query("
|
|
|
+ $ocf = $smcFunc['db_query']('', '
|
|
|
SELECT id_field
|
|
|
- FROM {$db_prefix}custom_fields");
|
|
|
+ FROM {db_prefix}custom_fields');
|
|
|
|
|
|
- // We start counting from 7 because we already have the first 6 fields.
|
|
|
- $fields_count = 7;
|
|
|
+ // We start counting from 6 because we already have the first 6 fields.
|
|
|
+ $fields_count = 6;
|
|
|
|
|
|
- while ($row = mysql_fetch_assoc($old_cust_fields))
|
|
|
+ while ($row = $smcFunc['db_fetch_assoc']($ocf))
|
|
|
{
|
|
|
$fields_count++;
|
|
|
|
|
|
- upgrade_query("
|
|
|
- UPDATE {$db_prefix}custom_fields
|
|
|
- SET field_order = $fields_count,
|
|
|
- WHERE id_attach = $row[id_field]");
|
|
|
+ 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']($old_cust_fields);
|
|
|
+ $smcFunc['db_free_result']($ocf);
|
|
|
---}
|
|
|
---#
|
|
|
|
|
@@ -675,38 +700,40 @@ INSERT INTO `{$db_prefix}custom_fields` (`col_name`, `field_name`, `field_desc`,
|
|
|
// We cannot do this twice
|
|
|
if (@$modSettings['smfVersion'] < '2.1')
|
|
|
{
|
|
|
- $request = upgrade_query("
|
|
|
+ $request = $smcFunc['db_query']('', '
|
|
|
SELECT id_member, aim, icq, msn, yim, location, gender
|
|
|
- FROM {$db_prefix}members");
|
|
|
+ FROM {db_prefix}members');
|
|
|
+
|
|
|
$inserts = array();
|
|
|
- while ($row = mysql_fetch_assoc($request))
|
|
|
+ while ($row = $smcFunc['db_fetch_assoc']($request))
|
|
|
{
|
|
|
- if (!empty($row[aim]))
|
|
|
- $inserts[] = "($row[id_member], -1, 'cust_aolins', $row[aim])";
|
|
|
+ if (!empty($row['aim']))
|
|
|
+ $inserts[] = array($row['id_member'], -1, 'cust_aolins', $row['aim']);
|
|
|
|
|
|
- if (!empty($row[icq]))
|
|
|
- $inserts[] = "($row[id_member], -1, 'cust_icq', $row[icq])";
|
|
|
+ if (!empty($row['icq']))
|
|
|
+ $inserts[] = array($row['id_member'], -1, 'cust_icq', $row['icq']);
|
|
|
|
|
|
- if (!empty($row[msn]))
|
|
|
- $inserts[] = "($row[id_member], -1, 'cust_skype', $row[msn])";
|
|
|
+ if (!empty($row['msn']))
|
|
|
+ $inserts[] = array($row['id_member'], -1, 'cust_skyp', $row['msn']);
|
|
|
|
|
|
- if (!empty($row[yim]))
|
|
|
- $inserts[] = "($row[id_member], -1, 'cust_yahoo', $row[yim])";
|
|
|
+ if (!empty($row['yim']))
|
|
|
+ $inserts[] = array($row['id_member'], -1, 'cust_yim', $row['yim']);
|
|
|
|
|
|
- if (!empty($row[location]))
|
|
|
- $inserts[] = "($row[id_member], -1, 'cust_loca', $row[location])";
|
|
|
+ if (!empty($row['location']))
|
|
|
+ $inserts[] = array($row['id_member'], -1, 'cust_loca', $row['location']);
|
|
|
|
|
|
- if (!empty($row[gender]))
|
|
|
- $inserts[] = "($row[id_member], -1, 'cust_gender', $row[gender])";
|
|
|
+ if (!empty($row['gender']))
|
|
|
+ $inserts[] = array($row['id_member'], -1, 'cust_gender', $row['gender']);
|
|
|
}
|
|
|
$smcFunc['db_free_result']($request);
|
|
|
|
|
|
if (!empty($inserts))
|
|
|
- upgrade_query("
|
|
|
- INSERT INTO {$db_prefix}themes
|
|
|
- (id_member, id_theme, variable, value)
|
|
|
- VALUES
|
|
|
- " . implode(',', $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')
|
|
|
+ );
|
|
|
}
|
|
|
---}
|
|
|
---#
|
|
@@ -1156,15 +1183,22 @@ ADD COLUMN in_inbox tinyint(3) NOT NULL default '1';
|
|
|
{
|
|
|
// Keep track of the index of this label - we'll need that in a bit...
|
|
|
$label_info[$row['id_member']][$label] = $index;
|
|
|
- $inserts[] = array($row['id_member'], $label);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
$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' => 'int'), $inserts, array());
|
|
|
+ $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();
|
|
@@ -1174,10 +1208,10 @@ ADD COLUMN in_inbox tinyint(3) NOT NULL default '1';
|
|
|
$smcFunc['db_query']('', '
|
|
|
UPDATE {db_prefix}pm_recipients
|
|
|
SET in_inbox = {int:in_inbox}
|
|
|
- WHERE FIND_IN_SET({int:minus_one}, labels)',
|
|
|
+ WHERE FIND_IN_SET({int:minusone}, labels)',
|
|
|
array(
|
|
|
'in_inbox' => 1,
|
|
|
- 'minus_one' => -1,
|
|
|
+ 'minusone' => -1,
|
|
|
)
|
|
|
);
|
|
|
|
|
@@ -1193,8 +1227,8 @@ ADD COLUMN in_inbox tinyint(3) NOT NULL default '1';
|
|
|
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[$row['id_member']][$row['label_name']];
|
|
|
- $label_info_2[$row['id_member']][$old_index] = $row['id_label'];
|
|
|
+ $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);
|
|
@@ -1231,7 +1265,7 @@ ADD COLUMN in_inbox tinyint(3) NOT NULL default '1';
|
|
|
// Insert the new data
|
|
|
if (!empty($inserts))
|
|
|
{
|
|
|
- $smcFunc['db_insert']('', '{db_prefix}pm_labeled_messages', array('id_pm', 'id_label'), $inserts, array());
|
|
|
+ $smcFunc['db_insert']('', '{db_prefix}pm_labeled_messages', array('id_pm' => 'int', 'id_label' => 'int'), $inserts, array());
|
|
|
}
|
|
|
|
|
|
// Final step of this ridiculously massive process
|
|
@@ -1239,7 +1273,7 @@ ADD COLUMN in_inbox tinyint(3) NOT NULL default '1';
|
|
|
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
|
|
@@ -1278,9 +1312,10 @@ ADD COLUMN in_inbox tinyint(3) NOT NULL default '1';
|
|
|
$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
|