diff options
Diffstat (limited to 'phpBB/includes/acp')
| -rw-r--r-- | phpBB/includes/acp/acp_icons.php | 14 | ||||
| -rw-r--r-- | phpBB/includes/acp/acp_main.php | 14 | ||||
| -rw-r--r-- | phpBB/includes/acp/acp_reasons.php | 53 |
3 files changed, 21 insertions, 60 deletions
diff --git a/phpBB/includes/acp/acp_icons.php b/phpBB/includes/acp/acp_icons.php index 537c0425a2..b4ac697a52 100644 --- a/phpBB/includes/acp/acp_icons.php +++ b/phpBB/includes/acp/acp_icons.php @@ -477,16 +477,12 @@ class acp_icons // The user has already selected a smilies_pak file if ($current == 'delete') { - switch ($db->sql_layer) + if ($db->truncate) { - case 'sqlite': - case 'firebird': - $db->sql_query('DELETE FROM ' . $table); - break; - - default: - $db->sql_query('TRUNCATE TABLE ' . $table); - break; + $db->sql_query('TRUNCATE TABLE ' . $table); + else + { + $db->sql_query('DELETE FROM ' . $table); } switch ($mode) diff --git a/phpBB/includes/acp/acp_main.php b/phpBB/includes/acp/acp_main.php index d41e1f4a62..ca3ac20630 100644 --- a/phpBB/includes/acp/acp_main.php +++ b/phpBB/includes/acp/acp_main.php @@ -202,16 +202,12 @@ class acp_main break; case 'db_track': - switch ($db->sql_layer) + if ($db->truncate) { - case 'sqlite': - case 'firebird': - $db->sql_query('DELETE FROM ' . TOPICS_POSTED_TABLE); - break; - - default: - $db->sql_query('TRUNCATE TABLE ' . TOPICS_POSTED_TABLE); - break; + $db->sql_query('TRUNCATE TABLE ' . TOPICS_POSTED_TABLE); + else + { + $db->sql_query('DELETE FROM ' . TOPICS_POSTED_TABLE); } // This can get really nasty... therefore we only do the last six months diff --git a/phpBB/includes/acp/acp_reasons.php b/phpBB/includes/acp/acp_reasons.php index 8d7bc88769..80c8e5323d 100644 --- a/phpBB/includes/acp/acp_reasons.php +++ b/phpBB/includes/acp/acp_reasons.php @@ -211,53 +211,22 @@ class acp_reasons // Let the deletion be confirmed... if (confirm_box(true)) { - $sql = 'SELECT reason_id + $sql = 'SELECT reason_id, report_text FROM ' . REPORTS_REASONS_TABLE . " WHERE LOWER(reason_title) = 'other'"; $result = $db->sql_query($sql); - $other_reason_id = (int) $db->sql_fetchfield('reason_id'); + $row = $db->sql_fetchrow($result); + + $other_reason_id = (int) $row['reason_id']; + $report_text = $row['report_text']; + $db->sql_freeresult($result); - switch ($db->sql_layer) - { - // The ugly one! - case 'mysqli': - case 'mysql4': - case 'mysql': - // Change the reports using this reason to 'other' - $sql = 'UPDATE ' . REPORTS_TABLE . ' - SET reason_id = ' . $other_reason_id . ", report_text = CONCAT('" . $db->sql_escape($reason_row['reason_description']) . "\n\n', report_text) - WHERE reason_id = $reason_id"; - break; - - // Standard? What's that? - case 'mssql': - case 'mssql_odbc': - // Change the reports using this reason to 'other' - $sql = "DECLARE @ptrval binary(16) - - SELECT @ptrval = TEXTPTR(report_text) - FROM " . REPORTS_TABLE . " - WHERE reason_id = " . $reason_id . " - - UPDATETEXT " . REPORTS_TABLE . ".report_text @ptrval 0 0 '" . $db->sql_escape($reason_row['reason_description']) . "\n\n' - - UPDATE " . REPORTS_TABLE . ' - SET reason_id = ' . $other_reason_id . " - WHERE reason_id = $reason_id"; - break; - - // Teh standard - case 'postgres': - case 'oracle': - case 'firebird': - case 'sqlite': - // Change the reports using this reason to 'other' - $sql = 'UPDATE ' . REPORTS_TABLE . ' - SET reason_id = ' . $other_reason_id . ", report_text = '" . $db->sql_escape($reason_row['reason_description']) . "\n\n' || report_text - WHERE reason_id = $reason_id"; - break; - } + $report_text .= $reason_row['reason_description'] . "\n\n"; + + $sql = 'UPDATE ' . REPORTS_TABLE . ' + SET reason_id = ' . $other_reason_id . ", report_text = '" . $db->sql_escape($report_text) "' + WHERE reason_id = $reason_id"; $db->sql_query($sql); $db->sql_query('DELETE FROM ' . REPORTS_REASONS_TABLE . ' WHERE reason_id = ' . $reason_id); |
