From 77fab9717440eb6c87b61123dbf67d4a4183d5b4 Mon Sep 17 00:00:00 2001
From: Meik Sievertsen
Date: Sun, 28 Jan 2007 18:35:55 +0000
Subject: [PATCH 001/707] tagged and up the number...
git-svn-id: file:///svn/phpbb/trunk@6950 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/install/schemas/schema_data.sql | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql
index ce151c020b..d6703479a7 100644
--- a/phpBB/install/schemas/schema_data.sql
+++ b/phpBB/install/schemas/schema_data.sql
@@ -203,7 +203,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('topics_per_page',
INSERT INTO phpbb_config (config_name, config_value) VALUES ('tpl_allow_php', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('upload_icons_path', 'images/upload_icons');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('upload_path', 'files');
-INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '3.0.B5');
+INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '3.0.B6-dev');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('warnings_expire_days', '90');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('warnings_gc', '14400');
From 49470a87c3a248507d1e098d638cbbaa7f31b8d2 Mon Sep 17 00:00:00 2001
From: Meik Sievertsen
Date: Mon, 29 Jan 2007 16:52:30 +0000
Subject: [PATCH 002/707] i hope this helps a bit. :o
git-svn-id: file:///svn/phpbb/trunk@6951 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/includes/db/mssql.php | 2 +-
phpBB/install/index.php | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/phpBB/includes/db/mssql.php b/phpBB/includes/db/mssql.php
index b28ea01acb..6429d4be41 100644
--- a/phpBB/includes/db/mssql.php
+++ b/phpBB/includes/db/mssql.php
@@ -35,7 +35,7 @@ class dbal_mssql extends dbal
$this->server = $sqlserver . (($port) ? ':' . $port : '');
$this->dbname = $database;
- ini_set('mssql.charset', 'UTF-8');
+ @ini_set('mssql.charset', 'UTF-8');
$this->db_connect_id = ($this->persistency) ? @mssql_pconnect($this->server, $this->user, $sqlpassword) : @mssql_connect($this->server, $this->user, $sqlpassword);
diff --git a/phpBB/install/index.php b/phpBB/install/index.php
index 0a8a45b771..eb49ac5c9b 100755
--- a/phpBB/install/index.php
+++ b/phpBB/install/index.php
@@ -102,7 +102,9 @@ else
define('STRIP', (get_magic_quotes_gpc()) ? true : false);
}
+// Try to override some limits - maybe it helps some...
@set_time_limit(0);
+@ini_set('memory_limit', '128M');
// Include essential scripts
require($phpbb_root_path . 'includes/functions.' . $phpEx);
From 6ec09e6f74abce923cc409cd5473790f3221ffd8 Mon Sep 17 00:00:00 2001
From: David M
Date: Wed, 31 Jan 2007 21:20:17 +0000
Subject: [PATCH 003/707] #7474 #7308
git-svn-id: file:///svn/phpbb/trunk@6952 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/includes/utf/data/recode_basic.php | 34 ++++++++++++
phpBB/includes/utf/utf_tools.php | 71 +++++-------------------
2 files changed, 47 insertions(+), 58 deletions(-)
diff --git a/phpBB/includes/utf/data/recode_basic.php b/phpBB/includes/utf/data/recode_basic.php
index 8950b0550b..fe29e3ddb9 100644
--- a/phpBB/includes/utf/data/recode_basic.php
+++ b/phpBB/includes/utf/data/recode_basic.php
@@ -929,6 +929,40 @@ function cp1251($string)
return strtr($string, $transform);
}
+function cp1252($string)
+{
+ static $transform = array(
+ "\xC2\x80" => "\xE2\x82\xAC",
+ "\xC2\x82" => "\xE2\x80\x9A",
+ "\xC2\x83" => "\xC6\x92",
+ "\xC2\x84" => "\xE2\x80\x9E",
+ "\xC2\x85" => "\xE2\x80\xA6",
+ "\xC2\x86" => "\xE2\x80\xA0",
+ "\xC2\x87" => "\xE2\x80\xA1",
+ "\xC2\x88" => "\xCB\x86",
+ "\xC2\x89" => "\xE2\x80\xB0",
+ "\xC2\x8A" => "\xC5\xA0",
+ "\xC2\x8B" => "\xE2\x80\xB9",
+ "\xC2\x8C" => "\xC5\x92",
+ "\xC2\x8E" => "\xC5\xBD",
+ "\xC2\x91" => "\xE2\x80\x98",
+ "\xC2\x92" => "\xE2\x80\x99",
+ "\xC2\x93" => "\xE2\x80\x9C",
+ "\xC2\x94" => "\xE2\x80\x9D",
+ "\xC2\x95" => "\xE2\x80\xA2",
+ "\xC2\x96" => "\xE2\x80\x93",
+ "\xC2\x97" => "\xE2\x80\x94",
+ "\xC2\x98" => "\xCB\x9C",
+ "\xC2\x99" => "\xE2\x84\xA2",
+ "\xC2\x9A" => "\xC5\xA1",
+ "\xC2\x9B" => "\xE2\x80\xBA",
+ "\xC2\x9C" => "\xC5\x93",
+ "\xC2\x9E" => "\xC5\xBE",
+ "\xC2\x9F" => "\xC5\xB8"
+ );
+ return strtr(utf8_encode($string), $transform);
+}
+
function cp1254($string)
{
static $tranform = array(
diff --git a/phpBB/includes/utf/utf_tools.php b/phpBB/includes/utf/utf_tools.php
index f9558c12b4..a0bee0ad74 100644
--- a/phpBB/includes/utf/utf_tools.php
+++ b/phpBB/includes/utf/utf_tools.php
@@ -6,6 +6,9 @@
* @copyright (c) 2006 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
+* @todo make sure the replacements are called correctly
+* already done: strtolower, strtoupper, ucfirst, str_split, strrpos, strlen (hopefully!), strpos, substr, htmlspecialchars
+* remaining: strspn, chr, ord
*/
/**
@@ -307,7 +310,7 @@ else
{
if (!is_int($offset))
{
- trigger_error('utf8_strpos: Offset must be an integer', E_USER_ERROR);
+ trigger_error('utf8_strpos: Offset must be an integer', E_USER_ERROR);
return false;
}
@@ -580,7 +583,7 @@ else
$ly = (-$length) % 65535;
// negative length requires ... capture everything
- // except a group of -length characters
+ // except a group of -length characters
// anchored at the tail-end of the string
if ($lx)
{
@@ -700,15 +703,15 @@ function utf8_recode($string, $encoding)
{
$encoding = strtolower($encoding);
- if ($encoding == 'utf-8' || !is_string($string) || !isset($string[0]))
+ if ($encoding == 'utf-8' || !is_string($string) || empty($string))
{
return $string;
}
- // start with something simple
+ // we force iso-8859-1 to be cp1252
if ($encoding == 'iso-8859-1')
{
- return utf8_encode($string);
+ $encoding = 'cp1252';
}
// First, try iconv()
@@ -790,6 +793,7 @@ function utf8_recode($string, $encoding)
break;
case '1250':
case '1251':
+ case '1252':
case '1254':
case '1255':
case '1256':
@@ -1103,6 +1107,9 @@ function utf8_clean_string($text)
utf_normalizer::nfc($text);
static $homographs = array(
+ "\x08" => '', // BACKSPACE => empty string
+ "\x09" => "\x20", // CHARACTER TABULATION => SPACE
+ "\x11" => "\x20", // Device Controls => SPACE
"\xC2\xA1" => "\x69", // EXCLAMATION MARK, INVERTED => LATIN SMALL LETTER I
"\xC2\xAD" => '', // HYPHEN, SOFT => empty string
"\xC4\x90" => "\xC3\x90", // LATIN CAPITAL LETTER D WITH STROKE => LATIN CAPITAL LETTER ETH
@@ -1172,6 +1179,7 @@ function utf8_clean_string($text)
"\xE1\xB4\xA8" => "\xD0\xBF", // GREEK LETTER SMALL CAPITAL PI => CYRILLIC SMALL LETTER PE
"\xE1\xB4\xA9" => "\xE1\xB4\x98", // GREEK LETTER SMALL CAPITAL RHO => LATIN LETTER SMALL CAPITAL P
"\xE1\xB4\xAB" => "\xD0\xBB", // CYRILLIC LETTER SMALL CAPITAL EL => CYRILLIC SMALL LETTER EL
+ "\xE2\x80\x81" => "\x20", // EM QUAD => SPACE
"\xE2\x8D\xB3" => "\xC9\xA9", // APL FUNCTIONAL SYMBOL IOTA => LATIN SMALL LETTER IOTA
"\xE2\x8D\xB4" => "\xCF\x81", // APL FUNCTIONAL SYMBOL RHO => GREEK SMALL LETTER RHO
"\xE2\x8D\xB5" => "\xCF\x89", // APL FUNCcTIONAL SYMBOL OMEGA => GREEK SMALL LETTER OMEGA
@@ -1182,63 +1190,10 @@ function utf8_clean_string($text)
"\xF0\x90\x8F\x93" => "\xF0\x90\x8E\x93", // OLD PERSIAN NUMBER TEN => UGARITIC LETTER AIN
"\xF0\x90\x92\xA0" => "\xF0\x90\x92\x86", // OSMANYA DIGIT ZERO => OSMANYA LETTER DEEL
"\xF0\x92\x80\xB8" => "\xF0\x90\x8E\x9A", // CUNEIFORM SIGN ASH => UGARITIC LETTER TO
-
- "\xC2\xA0" => "\x20", // NO-BREAK SPACE
- "\xE1\x9A\x80" => "\x20", // OGHAM SPACE MARK
- "\xE2\x80\x80" => "\x20", // EN QUAD
- "\xE2\x80\x81" => "\x20", // EM QUAD
- "\xE2\x80\x82" => "\x20", // EN SPACE
- "\xE2\x80\x83" => "\x20", // EM SPACE
- "\xE2\x80\x84" => "\x20", // THREE-PER-EM SPACE
- "\xE2\x80\x85" => "\x20", // FOUR-PER-EM SPACE
- "\xE2\x80\x86" => "\x20", // SIX-PER-EM SPACE
- "\xE2\x80\x87" => "\x20", // FIGURE SPACE
- "\xE2\x80\x88" => "\x20", // PUNCTUATION SPACE
- "\xE2\x80\x89" => "\x20", // THIN SPACE
- "\xE2\x80\x8A" => "\x20", // HAIR SPACE
- "\xE2\x80\xAF" => "\x20", // NARROW NO-BREAK SPACE
- "\xE2\x81\x9F" => "\x20", // MEDIUM MATHEMATICAL SPACE
- "\xE3\x80\x80" => "\x20", // IDEOGRAPHIC SPACE
-
- "\xDB\x9D" => '', // ARABIC END OF AYAH
- "\xDC\x8F" => '', // SYRIAC ABBREVIATION MARK
- "\xE1\xA0\x86" => '', // MONGOLIAN TODO SOFT HYPHEN
- "\xE1\xA0\x8E" => '', // MONGOLIAN VOWEL SEPARATOR
- "\xE2\x80\x8B" => '', // ZERO WIDTH SPACE
- "\xE2\x80\x8C" => '', // ZERO WIDTH NON-JOINER
- "\xE2\x80\x8D" => '', // ZERO WIDTH JOINER
- "\xE2\x80\xA8" => '', // LINE SEPARATOR
- "\xE2\x80\xA9" => '', // PARAGRAPH SEPARATOR
- "\xE2\x81\xA0" => '', // WORD JOINER
- "\xE2\x81\xA1" => '', // FUNCTION APPLICATION
- "\xE2\x81\xA2" => '', // INVISIBLE TIMES
- "\xE2\x81\xA3" => '', // INVISIBLE SEPARATOR
- "\xE2\x81\xAA" => '', // [CONTROL CHARACTERS]
- "\xE2\x81\xAB" => '', // [CONTROL CHARACTERS]
- "\xE2\x81\xAC" => '', // [CONTROL CHARACTERS]
- "\xE2\x81\xAD" => '', // [CONTROL CHARACTERS]
- "\xE2\x81\xAE" => '', // [CONTROL CHARACTERS]
- "\xE2\x81\xAF" => '', // [CONTROL CHARACTERS]
- "\xEF\xBB\xBF" => '', // ZERO WIDTH NO-BREAK SPACE
- "\xEF\xBF\xB9" => '', // [CONTROL CHARACTERS]
- "\xEF\xBF\xBA" => '', // [CONTROL CHARACTERS]
- "\xEF\xBF\xBB" => '', // [CONTROL CHARACTERS]
- "\xEF\xBF\xBC" => '', // [CONTROL CHARACTERS]
- "\xF0\x9D\x85\xB3" => '', // [MUSICAL CONTROL CHARACTERS]
- "\xF0\x9D\x85\xB4" => '', // [MUSICAL CONTROL CHARACTERS]
- "\xF0\x9D\x85\xB5" => '', // [MUSICAL CONTROL CHARACTERS]
- "\xF0\x9D\x85\xB6" => '', // [MUSICAL CONTROL CHARACTERS]
- "\xF0\x9D\x85\xB7" => '', // [MUSICAL CONTROL CHARACTERS]
- "\xF0\x9D\x85\xB8" => '', // [MUSICAL CONTROL CHARACTERS]
- "\xF0\x9D\x85\xB9" => '', // [MUSICAL CONTROL CHARACTERS]
- "\xF0\x9D\x85\xBA" => '', // [MUSICAL CONTROL CHARACTERS]
);
$text = strtr($text, $homographs);
- // Other control characters
- $text = preg_replace('#(?:[\x00-\x1F\x7F]+|(?:\xC2[\x80-\x9F])+)#', '', $text);
-
return $text;
}
From 2db7def46a2172a8611fc232a53b4484f6fbe22d Mon Sep 17 00:00:00 2001
From: David M
Date: Thu, 1 Feb 2007 01:22:46 +0000
Subject: [PATCH 004/707] eh? meh.
git-svn-id: file:///svn/phpbb/trunk@6953 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/includes/utf/utf_tools.php | 57 +++++++++++++++++++++++++++++---
1 file changed, 53 insertions(+), 4 deletions(-)
diff --git a/phpBB/includes/utf/utf_tools.php b/phpBB/includes/utf/utf_tools.php
index a0bee0ad74..a13246c65d 100644
--- a/phpBB/includes/utf/utf_tools.php
+++ b/phpBB/includes/utf/utf_tools.php
@@ -1107,9 +1107,6 @@ function utf8_clean_string($text)
utf_normalizer::nfc($text);
static $homographs = array(
- "\x08" => '', // BACKSPACE => empty string
- "\x09" => "\x20", // CHARACTER TABULATION => SPACE
- "\x11" => "\x20", // Device Controls => SPACE
"\xC2\xA1" => "\x69", // EXCLAMATION MARK, INVERTED => LATIN SMALL LETTER I
"\xC2\xAD" => '', // HYPHEN, SOFT => empty string
"\xC4\x90" => "\xC3\x90", // LATIN CAPITAL LETTER D WITH STROKE => LATIN CAPITAL LETTER ETH
@@ -1179,7 +1176,6 @@ function utf8_clean_string($text)
"\xE1\xB4\xA8" => "\xD0\xBF", // GREEK LETTER SMALL CAPITAL PI => CYRILLIC SMALL LETTER PE
"\xE1\xB4\xA9" => "\xE1\xB4\x98", // GREEK LETTER SMALL CAPITAL RHO => LATIN LETTER SMALL CAPITAL P
"\xE1\xB4\xAB" => "\xD0\xBB", // CYRILLIC LETTER SMALL CAPITAL EL => CYRILLIC SMALL LETTER EL
- "\xE2\x80\x81" => "\x20", // EM QUAD => SPACE
"\xE2\x8D\xB3" => "\xC9\xA9", // APL FUNCTIONAL SYMBOL IOTA => LATIN SMALL LETTER IOTA
"\xE2\x8D\xB4" => "\xCF\x81", // APL FUNCTIONAL SYMBOL RHO => GREEK SMALL LETTER RHO
"\xE2\x8D\xB5" => "\xCF\x89", // APL FUNCcTIONAL SYMBOL OMEGA => GREEK SMALL LETTER OMEGA
@@ -1190,10 +1186,63 @@ function utf8_clean_string($text)
"\xF0\x90\x8F\x93" => "\xF0\x90\x8E\x93", // OLD PERSIAN NUMBER TEN => UGARITIC LETTER AIN
"\xF0\x90\x92\xA0" => "\xF0\x90\x92\x86", // OSMANYA DIGIT ZERO => OSMANYA LETTER DEEL
"\xF0\x92\x80\xB8" => "\xF0\x90\x8E\x9A", // CUNEIFORM SIGN ASH => UGARITIC LETTER TO
+
+ "\xC2\xA0" => "\x20", // NO-BREAK SPACE
+ "\xE1\x9A\x80" => "\x20", // OGHAM SPACE MARK
+ "\xE2\x80\x80" => "\x20", // EN QUAD
+ "\xE2\x80\x81" => "\x20", // EM QUAD
+ "\xE2\x80\x82" => "\x20", // EN SPACE
+ "\xE2\x80\x83" => "\x20", // EM SPACE
+ "\xE2\x80\x84" => "\x20", // THREE-PER-EM SPACE
+ "\xE2\x80\x85" => "\x20", // FOUR-PER-EM SPACE
+ "\xE2\x80\x86" => "\x20", // SIX-PER-EM SPACE
+ "\xE2\x80\x87" => "\x20", // FIGURE SPACE
+ "\xE2\x80\x88" => "\x20", // PUNCTUATION SPACE
+ "\xE2\x80\x89" => "\x20", // THIN SPACE
+ "\xE2\x80\x8A" => "\x20", // HAIR SPACE
+ "\xE2\x80\xAF" => "\x20", // NARROW NO-BREAK SPACE
+ "\xE2\x81\x9F" => "\x20", // MEDIUM MATHEMATICAL SPACE
+ "\xE3\x80\x80" => "\x20", // IDEOGRAPHIC SPACE
+
+ "\xDB\x9D" => '', // ARABIC END OF AYAH
+ "\xDC\x8F" => '', // SYRIAC ABBREVIATION MARK
+ "\xE1\xA0\x86" => '', // MONGOLIAN TODO SOFT HYPHEN
+ "\xE1\xA0\x8E" => '', // MONGOLIAN VOWEL SEPARATOR
+ "\xE2\x80\x8B" => '', // ZERO WIDTH SPACE
+ "\xE2\x80\x8C" => '', // ZERO WIDTH NON-JOINER
+ "\xE2\x80\x8D" => '', // ZERO WIDTH JOINER
+ "\xE2\x80\xA8" => '', // LINE SEPARATOR
+ "\xE2\x80\xA9" => '', // PARAGRAPH SEPARATOR
+ "\xE2\x81\xA0" => '', // WORD JOINER
+ "\xE2\x81\xA1" => '', // FUNCTION APPLICATION
+ "\xE2\x81\xA2" => '', // INVISIBLE TIMES
+ "\xE2\x81\xA3" => '', // INVISIBLE SEPARATOR
+ "\xE2\x81\xAA" => '', // [CONTROL CHARACTERS]
+ "\xE2\x81\xAB" => '', // [CONTROL CHARACTERS]
+ "\xE2\x81\xAC" => '', // [CONTROL CHARACTERS]
+ "\xE2\x81\xAD" => '', // [CONTROL CHARACTERS]
+ "\xE2\x81\xAE" => '', // [CONTROL CHARACTERS]
+ "\xE2\x81\xAF" => '', // [CONTROL CHARACTERS]
+ "\xEF\xBB\xBF" => '', // ZERO WIDTH NO-BREAK SPACE
+ "\xEF\xBF\xB9" => '', // [CONTROL CHARACTERS]
+ "\xEF\xBF\xBA" => '', // [CONTROL CHARACTERS]
+ "\xEF\xBF\xBB" => '', // [CONTROL CHARACTERS]
+ "\xEF\xBF\xBC" => '', // [CONTROL CHARACTERS]
+ "\xF0\x9D\x85\xB3" => '', // [MUSICAL CONTROL CHARACTERS]
+ "\xF0\x9D\x85\xB4" => '', // [MUSICAL CONTROL CHARACTERS]
+ "\xF0\x9D\x85\xB5" => '', // [MUSICAL CONTROL CHARACTERS]
+ "\xF0\x9D\x85\xB6" => '', // [MUSICAL CONTROL CHARACTERS]
+ "\xF0\x9D\x85\xB7" => '', // [MUSICAL CONTROL CHARACTERS]
+ "\xF0\x9D\x85\xB8" => '', // [MUSICAL CONTROL CHARACTERS]
+ "\xF0\x9D\x85\xB9" => '', // [MUSICAL CONTROL CHARACTERS]
+ "\xF0\x9D\x85\xBA" => '', // [MUSICAL CONTROL CHARACTERS]
);
$text = strtr($text, $homographs);
+ // Other control characters
+ $text = preg_replace('#(?:[\x00-\x1F\x7F]+|(?:\xC2[\x80-\x9F])+)#', '', $text);
+
return $text;
}
From 9a685e7a4839058a99ddcb5f9c79c126f5ce318b Mon Sep 17 00:00:00 2001
From: David M
Date: Thu, 1 Feb 2007 03:13:08 +0000
Subject: [PATCH 005/707] - should fix some Firebird issues ( can't believe
that nobody found this until now )
git-svn-id: file:///svn/phpbb/trunk@6954 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/includes/acp/acp_database.php | 16 ++++++++--
phpBB/includes/acp/acp_icons.php | 12 ++++++-
phpBB/includes/acp/acp_main.php | 12 ++++++-
phpBB/includes/functions_admin.php | 12 ++++++-
phpBB/includes/functions_convert.php | 12 ++++++-
phpBB/includes/search/fulltext_native.php | 38 +++++++++++++++++++++--
phpBB/install/install_convert.php | 14 ++++++++-
7 files changed, 106 insertions(+), 10 deletions(-)
diff --git a/phpBB/includes/acp/acp_database.php b/phpBB/includes/acp/acp_database.php
index c5fadbfd0a..87c40ef78f 100644
--- a/phpBB/includes/acp/acp_database.php
+++ b/phpBB/includes/acp/acp_database.php
@@ -167,6 +167,7 @@ class acp_database
// Get the table structure
if ($structure)
{
+ $sql_data .= "\n";
switch ($db->sql_layer)
{
case 'mysqli':
@@ -213,7 +214,18 @@ class acp_database
else
{
// We might wanna empty out all that junk :D
- $sql_data .= (($db->sql_layer == 'sqlite') ? 'DELETE FROM ' : 'TRUNCATE TABLE ') . $table_name . ";\n";
+ switch ($db->sql_layer)
+ {
+ case 'sqlite':
+ case 'firebird':
+ $sql_data .= 'DELETE FROM ';
+ break;
+
+ default:
+ $sql_data .= 'TRUNCATE TABLE ';
+ break;
+ }
+ $sql_data .= $table_name . ";\n";
}
// Now write the data for the first time. :)
@@ -757,7 +769,7 @@ class acp_database
if ($retrieved_data)
{
- $sql_data = "\nGO\n";
+ $sql_data = "GO\n";
if ($ident_set)
{
$sql_data .= "\nSET IDENTITY_INSERT $table_name OFF\nGO\n";
diff --git a/phpBB/includes/acp/acp_icons.php b/phpBB/includes/acp/acp_icons.php
index 321df3ecb1..bcdd8c71d8 100644
--- a/phpBB/includes/acp/acp_icons.php
+++ b/phpBB/includes/acp/acp_icons.php
@@ -334,7 +334,17 @@ class acp_icons
// The user has already selected a smilies_pak file
if ($current == 'delete')
{
- $db->sql_query((($db->sql_layer != 'sqlite') ? 'TRUNCATE TABLE ' : 'DELETE FROM ') . $table);
+ switch ($db->sql_layer)
+ {
+ case 'sqlite':
+ case 'firebird':
+ $db->sql_query('DELETE FROM ' . $table);
+ break;
+
+ default:
+ $db->sql_query('TRUNCATE TABLE ' . $table);
+ break;
+ }
switch ($mode)
{
diff --git a/phpBB/includes/acp/acp_main.php b/phpBB/includes/acp/acp_main.php
index fad9ad47b7..bf958ba319 100644
--- a/phpBB/includes/acp/acp_main.php
+++ b/phpBB/includes/acp/acp_main.php
@@ -147,7 +147,17 @@ class acp_main
break;
case 'db_track':
- $db->sql_query((($db->sql_layer != 'sqlite') ? 'TRUNCATE TABLE ' : 'DELETE FROM ') . TOPICS_POSTED_TABLE);
+ switch ($db->sql_layer)
+ {
+ case 'sqlite':
+ case 'firebird':
+ $db->sql_query('DELETE FROM ' . TOPICS_POSTED_TABLE);
+ break;
+
+ default:
+ $db->sql_query('TRUNCATE TABLE ' . TOPICS_POSTED_TABLE);
+ break;
+ }
// This can get really nasty... therefore we only do the last six months
$get_from_time = time() - (6 * 4 * 7 * 24 * 60 * 60);
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php
index 8e4865fa97..7208aee113 100644
--- a/phpBB/includes/functions_admin.php
+++ b/phpBB/includes/functions_admin.php
@@ -1983,7 +1983,17 @@ function cache_moderators()
$cache->destroy('sql', MODERATOR_CACHE_TABLE);
// Clear table
- $db->sql_query((($db->sql_layer != 'sqlite') ? 'TRUNCATE TABLE ' : 'DELETE FROM ') . MODERATOR_CACHE_TABLE);
+ switch ($db->sql_layer)
+ {
+ case 'sqlite':
+ case 'firebird':
+ $db->sql_query('DELETE FROM ' . MODERATOR_CACHE_TABLE);
+ break;
+
+ default:
+ $db->sql_query('TRUNCATE TABLE ' . MODERATOR_CACHE_TABLE);
+ break;
+ }
// We add moderators who have forum moderator permissions without an explicit ACL_NEVER setting
$hold_ary = $ug_id_ary = $sql_ary = array();
diff --git a/phpBB/includes/functions_convert.php b/phpBB/includes/functions_convert.php
index 14dd4c370b..ab903ac2ad 100644
--- a/phpBB/includes/functions_convert.php
+++ b/phpBB/includes/functions_convert.php
@@ -1833,7 +1833,17 @@ function update_topics_posted()
{
global $db, $config;
- $db->sql_query((($db->sql_layer != 'sqlite') ? 'TRUNCATE TABLE ' : 'DELETE FROM ') . TOPICS_POSTED_TABLE);
+ switch ($db->sql_layer)
+ {
+ case 'sqlite':
+ case 'firebird':
+ $db->sql_query('DELETE FROM ' . TOPICS_POSTED_TABLE);
+ break;
+
+ default:
+ $db->sql_query('TRUNCATE TABLE ' . TOPICS_POSTED_TABLE);
+ break;
+ }
// This can get really nasty... therefore we only do the last six months
$get_from_time = time() - (6 * 4 * 7 * 24 * 60 * 60);
diff --git a/phpBB/includes/search/fulltext_native.php b/phpBB/includes/search/fulltext_native.php
index 11ca09805a..bd197feede 100755
--- a/phpBB/includes/search/fulltext_native.php
+++ b/phpBB/includes/search/fulltext_native.php
@@ -1266,9 +1266,41 @@ class fulltext_native extends search_backend
{
global $db;
- $db->sql_query((($db->sql_layer != 'sqlite') ? 'TRUNCATE TABLE ' : 'DELETE FROM ') . SEARCH_WORDLIST_TABLE);
- $db->sql_query((($db->sql_layer != 'sqlite') ? 'TRUNCATE TABLE ' : 'DELETE FROM ') . SEARCH_WORDMATCH_TABLE);
- $db->sql_query((($db->sql_layer != 'sqlite') ? 'TRUNCATE TABLE ' : 'DELETE FROM ') . SEARCH_RESULTS_TABLE);
+ switch ($db->sql_layer)
+ {
+ case 'sqlite':
+ case 'firebird':
+ $db->sql_query('DELETE FROM ' . SEARCH_WORDLIST_TABLE);
+ break;
+
+ default:
+ $db->sql_query('TRUNCATE TABLE ' . SEARCH_WORDLIST_TABLE);
+ break;
+ }
+
+ switch ($db->sql_layer)
+ {
+ case 'sqlite':
+ case 'firebird':
+ $db->sql_query('DELETE FROM ' . SEARCH_WORDMATCH_TABLE);
+ break;
+
+ default:
+ $db->sql_query('TRUNCATE TABLE ' . SEARCH_WORDMATCH_TABLE);
+ break;
+ }
+
+ switch ($db->sql_layer)
+ {
+ case 'sqlite':
+ case 'firebird':
+ $db->sql_query('DELETE FROM ' . SEARCH_RESULTS_TABLE);
+ break;
+
+ default:
+ $db->sql_query('TRUNCATE TABLE ' . SEARCH_RESULTS_TABLE);
+ break;
+ }
}
/**
diff --git a/phpBB/install/install_convert.php b/phpBB/install/install_convert.php
index 256dd13b67..2b910f78a7 100644
--- a/phpBB/install/install_convert.php
+++ b/phpBB/install/install_convert.php
@@ -545,7 +545,19 @@ class install_convert extends module
// Make some short variables accessible, for easier referencing
$convert->convertor_tag = basename($convert->options['tag']);
$convert->src_table_prefix = $convert->options['table_prefix'];
- $convert->truncate_statement = ($db->sql_layer != 'sqlite') ? 'TRUNCATE TABLE ' : 'DELETE FROM ';
+
+
+ switch ($db->sql_layer)
+ {
+ case 'sqlite':
+ case 'firebird':
+ $convert->truncate_statement = 'DELETE FROM ';
+ break;
+
+ default:
+ $convert->truncate_statement = 'TRUNCATE TABLE ');
+ break;
+ }
$get_info = false;
From c83a2fa1d3acf39efdb1441f4049e0825aa23a9b Mon Sep 17 00:00:00 2001
From: David M
Date: Thu, 1 Feb 2007 19:49:48 +0000
Subject: [PATCH 006/707] #7672
git-svn-id: file:///svn/phpbb/trunk@6955 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/install/install_convert.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/phpBB/install/install_convert.php b/phpBB/install/install_convert.php
index 2b910f78a7..c8f50a6f21 100644
--- a/phpBB/install/install_convert.php
+++ b/phpBB/install/install_convert.php
@@ -555,7 +555,7 @@ class install_convert extends module
break;
default:
- $convert->truncate_statement = 'TRUNCATE TABLE ');
+ $convert->truncate_statement = 'TRUNCATE TABLE ';
break;
}
From 7c8f4431d346ed17ae9d8b8c13bd27987913f386 Mon Sep 17 00:00:00 2001
From: Meik Sievertsen
Date: Fri, 2 Feb 2007 15:36:43 +0000
Subject: [PATCH 007/707] only very tiny fixes.
git-svn-id: file:///svn/phpbb/trunk@6956 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/includes/acp/auth.php | 8 +++++++-
phpBB/includes/functions_convert.php | 2 +-
phpBB/includes/functions_user.php | 5 +++++
phpBB/includes/ucp/ucp_register.php | 2 +-
phpBB/install/database_update.php | 2 +-
phpBB/install/install_install.php | 2 +-
6 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/phpBB/includes/acp/auth.php b/phpBB/includes/acp/auth.php
index b32d435d7b..375a9c9ba3 100644
--- a/phpBB/includes/acp/auth.php
+++ b/phpBB/includes/acp/auth.php
@@ -264,7 +264,7 @@ class auth_admin extends auth
{
$hold_ary[$row['forum_id']]['groups'][] = $row['group_id'];
}
- $db->sql_freeresult($result);
+ $db->sql_freeresult($result);
return $hold_ary;
}
@@ -620,6 +620,12 @@ class auth_admin extends auth
foreach ($hold_ary as $forum_id => $auth_ary)
{
+ // If there is no forum present the database holds auth information for a non-existent forum... continue then
+ if ($forum_id && !isset($forum_names[$forum_id]))
+ {
+ continue;
+ }
+
$template->assign_block_vars('role_mask', array(
'NAME' => ($forum_id == 0) ? $user->lang['GLOBAL_MASK'] : $forum_names[$forum_id],
'FORUM_ID' => $forum_id)
diff --git a/phpBB/includes/functions_convert.php b/phpBB/includes/functions_convert.php
index ab903ac2ad..e96cf5aaf1 100644
--- a/phpBB/includes/functions_convert.php
+++ b/phpBB/includes/functions_convert.php
@@ -1701,7 +1701,7 @@ function add_bots()
'W3C [Linkcheck]' => array('W3C-checklink/', ''),
'W3C [Validator]' => array('W3C_*Validator', ''),
'WiseNut [Bot]' => array('http://www.WISEnutbot.com', ''),
- 'Yacy [Bot]' => array('yacybot', ''),
+ 'YaCy [Bot]' => array('yacybot', ''),
'Yahoo MMCrawler [Bot]' => array('Yahoo-MMCrawler/', ''),
'Yahoo Slurp [Bot]' => array('Yahoo! DE Slurp', ''),
'Yahoo [Bot]' => array('Yahoo! Slurp', ''),
diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php
index 933124ce28..3ef03ece67 100644
--- a/phpBB/includes/functions_user.php
+++ b/phpBB/includes/functions_user.php
@@ -2508,6 +2508,11 @@ function group_update_listings($group_id)
if ($mod_permissions || $admin_permissions)
{
+ if (!function_exists('update_foes'))
+ {
+ global $phpbb_root_path, $phpEx;
+ include($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
+ }
update_foes();
}
}
diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php
index 9fffdff5fd..4d42cbd344 100644
--- a/phpBB/includes/ucp/ucp_register.php
+++ b/phpBB/includes/ucp/ucp_register.php
@@ -372,7 +372,7 @@ class ucp_register
$messenger->assign_vars(array(
'USERNAME' => htmlspecialchars_decode($data['username']),
- 'U_USER_DETAILS' => "$server_url/memberlist.$phpEx?mode=viewprofile&u=$user_id",
+ 'U_USER_DETAILS' => "$server_url/memberlist.$phpEx?mode=viewprofile&u=$user_id",
'U_ACTIVATE' => "$server_url/ucp.$phpEx?mode=activate&u=$user_id&k=$user_actkey")
);
diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php
index 666cb1aad3..7818e4ef90 100644
--- a/phpBB/install/database_update.php
+++ b/phpBB/install/database_update.php
@@ -1421,7 +1421,7 @@ function add_bots()
'W3C [Linkcheck]' => array('W3C-checklink/', ''),
'W3C [Validator]' => array('W3C_*Validator', ''),
'WiseNut [Bot]' => array('http://www.WISEnutbot.com', ''),
- 'Yacy [Bot]' => array('yacybot', ''),
+ 'YaCy [Bot]' => array('yacybot', ''),
'Yahoo MMCrawler [Bot]' => array('Yahoo-MMCrawler/', ''),
'Yahoo Slurp [Bot]' => array('Yahoo! DE Slurp', ''),
'Yahoo [Bot]' => array('Yahoo! Slurp', ''),
diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php
index ba80f40eb2..79fd828784 100755
--- a/phpBB/install/install_install.php
+++ b/phpBB/install/install_install.php
@@ -2325,7 +2325,7 @@ class install_install extends module
'W3C [Linkcheck]' => array('W3C-checklink/', ''),
'W3C [Validator]' => array('W3C_*Validator', ''),
'WiseNut [Bot]' => array('http://www.WISEnutbot.com', ''),
- 'Yacy [Bot]' => array('yacybot', ''),
+ 'YaCy [Bot]' => array('yacybot', ''),
'Yahoo MMCrawler [Bot]' => array('Yahoo-MMCrawler/', ''),
'Yahoo Slurp [Bot]' => array('Yahoo! DE Slurp', ''),
'Yahoo [Bot]' => array('Yahoo! Slurp', ''),
From bad991ee82b34a04bd951b068c3bdc31bec28305 Mon Sep 17 00:00:00 2001
From: Meik Sievertsen
Date: Fri, 2 Feb 2007 21:38:19 +0000
Subject: [PATCH 008/707] suggestion by bart for those having a lot of forums.
git-svn-id: file:///svn/phpbb/trunk@6957 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/mcp.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/phpBB/mcp.php b/phpBB/mcp.php
index bf2666102a..9a22289495 100644
--- a/phpBB/mcp.php
+++ b/phpBB/mcp.php
@@ -585,7 +585,7 @@ function mcp_sorting($mode, &$sort_days, &$sort_key, &$sort_dir, &$sort_by_sql,
}
else
{
- $where_sql .= ' ' . $db->sql_in_set('p.forum_id', get_forum_list('m_report'));
+ $where_sql .= ' ' . $db->sql_in_set('p.forum_id', get_forum_list('!m_report'), true, true);
}
if ($mode == 'reports')
From 6e4f7aee0546859c60bc35c1ed1ffadb5790ce36 Mon Sep 17 00:00:00 2001
From: David M
Date: Fri, 2 Feb 2007 23:07:28 +0000
Subject: [PATCH 009/707] #7742
git-svn-id: file:///svn/phpbb/trunk@6958 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/install/database_update.php | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php
index 7818e4ef90..bf8dfd7b9c 100644
--- a/phpBB/install/database_update.php
+++ b/phpBB/install/database_update.php
@@ -1026,12 +1026,13 @@ function sql_column_add($dbms, $table_name, $column_name, $column_data)
case 'sqlite':
if (version_compare(sqlite_libversion(), '3.0') == -1)
{
+ global $db;
$sql = "SELECT sql
FROM sqlite_master
WHERE type = 'table'
AND name = '{$table_name}'
ORDER BY type DESC, name;";
- $result = _sql($sql, $errored, $error_ary);
+ $result = $db->sql_query($sql);
if (!$result)
{
From fa075585e382f85ec3e7ce8ec16135a7dfb99fb2 Mon Sep 17 00:00:00 2001
From: David M
Date: Sat, 3 Feb 2007 00:44:58 +0000
Subject: [PATCH 010/707] #7550 - this sucker required a cleverish regex, there
should be no further problems. it is also optimized :D
git-svn-id: file:///svn/phpbb/trunk@6959 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/includes/db/oracle.php | 48 ++++++++++++++++++++----------------
1 file changed, 27 insertions(+), 21 deletions(-)
diff --git a/phpBB/includes/db/oracle.php b/phpBB/includes/db/oracle.php
index 860c7a3614..9aa98ba9c8 100644
--- a/phpBB/includes/db/oracle.php
+++ b/phpBB/includes/db/oracle.php
@@ -113,41 +113,47 @@ class dbal_oracle extends dbal
$array = array();
// We overcome Oracle's 4000 char limit by binding vars
- if (preg_match('/^(INSERT INTO[^(]+)\\(([^()]+)\\) VALUES[^(]+\\(([^()]+)\\)$/', $query, $regs))
+ if (preg_match('/^(INSERT INTO[^(]+)\\(([^()]+)\\) VALUES[^(]+\\((.*?)\\)$/', $query, $regs))
{
if (strlen($regs[3]) > 4000)
{
$cols = explode(', ', $regs[2]);
- $vals = explode(', ', $regs[3]);
- foreach ($vals as $key => $value)
+ preg_match_all('/\'(?:[^\']++|\'\')*+\'|\\d+/', $regs[3], $vals, PREG_PATTERN_ORDER);
+
+ $inserts = $vals[0];
+ unset($vals);
+
+ foreach ($inserts as $key => $value)
{
- if (strlen($value) > 4002) // check to see if this thing is greater than the max + 'x2
+ if (!empty($value) && $value[0] === "'" && strlen($value) > 4002) // check to see if this thing is greater than the max + 'x2
{
- $vals[$key] = ':' . strtoupper($cols[$key]);
- $array[$vals[$key]] = substr($value, 1, -1);
+ $inserts[$key] = ':' . strtoupper($cols[$key]);
+ $array[$inserts[$key]] = str_replace("''", "'", substr($value, 1, -1));
}
}
- $query = $regs[1] . '(' . implode(', ', $cols) . ') VALUES (' . implode(', ', $vals) . ')';
+ $query = $regs[1] . '(' . $regs[2] . ') VALUES (' . implode(', ', $inserts) . ')';
}
}
- else if (preg_match('/^(UPDATE.*?)SET (.*)(\\sWHERE.*)$/s', $query, $regs))
+ else if (preg_match_all('/^(UPDATE [\\w_]++\\s+SET )(\\w+ = (?:\'(?:[^\']++|\'\')*+\'|\\d+)(?:, \\w+ = (?:\'(?:[^\']++|\'\')*+\'|\\d+))*+)\\s+(WHERE.*)$/s', $query, $data, PREG_SET_ORDER))
{
- if (strlen($regs[2]) > 4000)
+ if (strlen($data[0][2]) > 4000)
{
- $args = explode(', ', $regs[2]);
- $cols = array();
- foreach ($args as $value)
- {
- $temp_array = explode('=', $value);
- $cols[$temp_array[0]] = $temp_array[1];
- }
+ $update = $data[0][1];
+ $where = $data[0][3];
+ preg_match_all('/(\\w++) = (\'(?:[^\']++|\'\')*+\'|\\d++)/', $data[0][2], $temp, PREG_SET_ORDER);
+ unset($data);
- foreach ($cols as $col => $val)
+ $cols = array();
+ foreach ($temp as $value)
{
- if (strlen($val) > 4003) // check to see if this thing is greater than the max + 'x2 + a space
+ if (!empty($value[2]) && $value[2][0] === "'" && strlen($value[2]) > 4002) // check to see if this thing is greater than the max + 'x2 + a space
{
- $cols[$col] = ' :' . strtoupper(rtrim($col));
- $array[ltrim($cols[$col])] = substr(trim($val), 2, -1);
+ $cols[$value[1]] = ':' . strtoupper($value[1]);
+ $array[$cols[$value[1]]] = str_replace("''", "'", substr($value[2], 1, -1));
+ }
+ else
+ {
+ $cols[$value[1]] = $value[2];
}
}
@@ -156,7 +162,7 @@ class dbal_oracle extends dbal
{
$art[] = $col . '=' . $val;
}
- $query = $regs[1] . 'SET ' . implode(', ', $art) . $regs[3];
+ $query = $update . implode(', ', $art) . ' ' . $where;
}
}
From 22aa2b7c52c93c6869a8776e509da8df8d10480d Mon Sep 17 00:00:00 2001
From: David M
Date: Sat, 3 Feb 2007 02:17:46 +0000
Subject: [PATCH 011/707] #7742 (and some unfound bugs :D), thanks Mr_E
git-svn-id: file:///svn/phpbb/trunk@6960 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/install/database_update.php | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php
index bf8dfd7b9c..b68eab59be 100644
--- a/phpBB/install/database_update.php
+++ b/phpBB/install/database_update.php
@@ -1052,13 +1052,13 @@ function sql_column_add($dbms, $table_name, $column_name, $column_data)
preg_match('#\((.*)\)#s', $row['sql'], $matches);
$new_table_cols = trim($matches[1]);
- $old_table_cols = preg_split('/,(?=[\\sa-z])/im', $new_table_cols);
+ $old_table_cols = preg_split('/,(?![\s\w]+\))/m', $new_table_cols);
$column_list = array();
foreach ($old_table_cols as $declaration)
{
$entities = preg_split('#\s+#', trim($declaration));
- if ($entities == 'PRIMARY')
+ if ($entities[0] == 'PRIMARY')
{
continue;
}
@@ -1171,13 +1171,13 @@ function sql_create_primary_key($dbms, $table_name, $column)
preg_match('#\((.*)\)#s', $row['sql'], $matches);
$new_table_cols = trim($matches[1]);
- $old_table_cols = preg_split('/,(?=[\\sa-z])/im', $new_table_cols);
+ $old_table_cols = preg_split('/,(?![\s\w]+\))/m', $new_table_cols);
$column_list = array();
foreach ($old_table_cols as $declaration)
{
$entities = preg_split('#\s+#', trim($declaration));
- if ($entities == 'PRIMARY')
+ if ($entities[0] == 'PRIMARY')
{
continue;
}
@@ -1262,7 +1262,7 @@ function sql_column_change($dbms, $table_name, $column_name, $column_data)
preg_match('#\((.*)\)#s', $row['sql'], $matches);
$new_table_cols = trim($matches[1]);
- $old_table_cols = preg_split('/,(?=[\\sa-z])/im', $new_table_cols);
+ $old_table_cols = preg_split('/,(?![\s\w]+\))/m', $new_table_cols);
$column_list = array();
foreach ($old_table_cols as $key => $declaration)
From 9bf3bd0cbce2176663b5fd53af22c83286241f3e Mon Sep 17 00:00:00 2001
From: David M
Date: Sat, 3 Feb 2007 04:26:10 +0000
Subject: [PATCH 012/707] eh? meh.
git-svn-id: file:///svn/phpbb/trunk@6961 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/includes/db/oracle.php | 17 ++++++-----------
1 file changed, 6 insertions(+), 11 deletions(-)
diff --git a/phpBB/includes/db/oracle.php b/phpBB/includes/db/oracle.php
index 9aa98ba9c8..4195bcfe52 100644
--- a/phpBB/includes/db/oracle.php
+++ b/phpBB/includes/db/oracle.php
@@ -113,7 +113,7 @@ class dbal_oracle extends dbal
$array = array();
// We overcome Oracle's 4000 char limit by binding vars
- if (preg_match('/^(INSERT INTO[^(]+)\\(([^()]+)\\) VALUES[^(]+\\((.*?)\\)$/', $query, $regs))
+ if (preg_match('/^(INSERT INTO[^(]+)\\(([^()]+)\\) VALUES[^(]+\\((.*?)\\)$/s', $query, $regs))
{
if (strlen($regs[3]) > 4000)
{
@@ -143,26 +143,21 @@ class dbal_oracle extends dbal
preg_match_all('/(\\w++) = (\'(?:[^\']++|\'\')*+\'|\\d++)/', $data[0][2], $temp, PREG_SET_ORDER);
unset($data);
- $cols = array();
+ $art = array();
foreach ($temp as $value)
{
- if (!empty($value[2]) && $value[2][0] === "'" && strlen($value[2]) > 4002) // check to see if this thing is greater than the max + 'x2 + a space
+ if (!empty($value[2]) && $value[2][0] === "'" && strlen($value[2]) > 4002) // check to see if this thing is greater than the max + 'x2
{
- $cols[$value[1]] = ':' . strtoupper($value[1]);
+ $art[] = $value[1] . '=:' . strtoupper($value[1]);
$array[$cols[$value[1]]] = str_replace("''", "'", substr($value[2], 1, -1));
}
else
{
- $cols[$value[1]] = $value[2];
+ $art[] = $value[1] . '=' . $value[2];
}
}
- $art = array();
- foreach ($cols as $col => $val)
- {
- $art[] = $col . '=' . $val;
- }
- $query = $update . implode(', ', $art) . ' ' . $where;
+ $query = $update . implode(', ', $art) . ' ' . $where;
}
}
From 8061b5b61408208c1fbe9da5d11f0abde2644ce8 Mon Sep 17 00:00:00 2001
From: Meik Sievertsen
Date: Sat, 3 Feb 2007 11:59:16 +0000
Subject: [PATCH 013/707] #7618
git-svn-id: file:///svn/phpbb/trunk@6962 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/install/convertors/convert_phpbb20.php | 2 +-
phpBB/install/convertors/functions_phpbb20.php | 10 ++++++++++
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/phpBB/install/convertors/convert_phpbb20.php b/phpBB/install/convertors/convert_phpbb20.php
index 14fde80478..fac58a7d7d 100644
--- a/phpBB/install/convertors/convert_phpbb20.php
+++ b/phpBB/install/convertors/convert_phpbb20.php
@@ -408,7 +408,7 @@ if (!$get_info)
'target' => DISALLOW_TABLE,
'query_first' => $convert->truncate_statement . DISALLOW_TABLE,
- array('disallow_username', 'disallow.disallow_username', 'phpbb_set_encoding'),
+ array('disallow_username', 'disallow.disallow_username', 'phpbb_disallowed_username'),
),
array(
diff --git a/phpBB/install/convertors/functions_phpbb20.php b/phpBB/install/convertors/functions_phpbb20.php
index 05daae473b..271c1cf1e3 100644
--- a/phpBB/install/convertors/functions_phpbb20.php
+++ b/phpBB/install/convertors/functions_phpbb20.php
@@ -1446,4 +1446,14 @@ function phpbb_inactive_reason()
return INACTIVE_REGISTER;
}
+/**
+* Adjust 2.0.x disallowed names to 3.0.x format
+*/
+function phpbb_disallowed_username($username)
+{
+ // Replace * with %
+ $username = phpbb_set_default_encoding(str_replace('*', '%', $username));
+ return utf8_htmlspecialchars($username);
+}
+
?>
\ No newline at end of file
From fb8dc345ddfcbcd6e6192c7361cb8f75a08940e6 Mon Sep 17 00:00:00 2001
From: Meik Sievertsen
Date: Sat, 3 Feb 2007 12:30:59 +0000
Subject: [PATCH 014/707] because so many 2.0.x users expect this we set every
2.0.x admin as a founder and full admin rights in 3.0.x. After conversion the
main admin may want to remove the founder status from the other admins.
Before, this only was able to be done by the first admin who was not always
the one converting the board.
git-svn-id: file:///svn/phpbb/trunk@6963 89ea8834-ac86-4346-8a33-228a782c2dd0
---
.../install/convertors/functions_phpbb20.php | 33 +++++++++++--------
1 file changed, 19 insertions(+), 14 deletions(-)
diff --git a/phpBB/install/convertors/functions_phpbb20.php b/phpBB/install/convertors/functions_phpbb20.php
index 271c1cf1e3..14d98deed2 100644
--- a/phpBB/install/convertors/functions_phpbb20.php
+++ b/phpBB/install/convertors/functions_phpbb20.php
@@ -475,22 +475,27 @@ function phpbb_convert_authentication($mode)
$db->sql_query($convert->truncate_statement . ACL_USERS_TABLE);
$db->sql_query($convert->truncate_statement . ACL_GROUPS_TABLE);
- // Grab user id of first user with user_level of ADMIN
+ // What we will do is handling all 2.0.x admins as founder to replicate what is common in 2.0.x.
+ // After conversion the main admin need to make sure he is removing permissions and the founder status if wanted.
+
+ // Grab user ids of users with user_level of ADMIN
$sql = "SELECT user_id
FROM {$convert->src_table_prefix}users
WHERE user_level = 1
ORDER BY user_regdate ASC";
- $result = $db->sql_query_limit($sql, 1);
- $row = $db->sql_fetchrow($result);
+ $result = $db->sql_query($sql);
+
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $user_id = (int) phpbb_user_id($row['user_id']);
+
+ // Set founder admin...
+ $sql = 'UPDATE ' . USERS_TABLE . '
+ SET user_type = ' . USER_FOUNDER . "
+ WHERE user_id = $user_id";
+ $db->sql_query($sql);
+ }
$db->sql_freeresult($result);
-
- $founder_id = phpbb_user_id($row['user_id']);
-
- // Set a founder admin ... we'll assume it's the first user with admin level access
- $sql = 'UPDATE ' . USERS_TABLE . '
- SET user_type = ' . USER_FOUNDER . "
- WHERE user_id = $founder_id";
- $db->sql_query($sql);
}
// Grab forum auth information
@@ -666,7 +671,7 @@ function phpbb_convert_authentication($mode)
}
else if ($mode == 'first')
{
- // Go through all 2.0.x forums (we saved those ids for reference)
+ // Go through all 2.0.x forums
foreach ($forum_access as $forum)
{
$new_forum_id = (int) $forum['forum_id'];
@@ -817,8 +822,8 @@ function phpbb_convert_authentication($mode)
mass_auth('group_role', 0, 'administrators', 'USER_FULL');
mass_auth('group_role', 0, 'global_moderators', 'USER_FULL');
- // By default all converted administrators are given standard access (the founder still have full access)
- mass_auth('group_role', 0, 'administrators', 'ADMIN_STANDARD');
+ // By default all converted administrators are given full access
+ mass_auth('group_role', 0, 'administrators', 'ADMIN_FULL');
// All registered users are assigned the standard user role
mass_auth('group_role', 0, 'registered', 'USER_STANDARD');
From ba639e20eb85a5bbe1c84e2308a166eae10b2e0a Mon Sep 17 00:00:00 2001
From: Meik Sievertsen
Date: Sat, 3 Feb 2007 12:48:36 +0000
Subject: [PATCH 015/707] make sure the session table is empty after conversion
and the current session being killed. This makes sure the user converting
does not inherit wrong user settings becuase the 3.0.x users table being
completely new.
git-svn-id: file:///svn/phpbb/trunk@6964 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/install/install_convert.php | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
diff --git a/phpBB/install/install_convert.php b/phpBB/install/install_convert.php
index c8f50a6f21..9a5177c941 100644
--- a/phpBB/install/install_convert.php
+++ b/phpBB/install/install_convert.php
@@ -191,7 +191,28 @@ class install_convert extends module
'TITLE' => $lang['CONVERT_COMPLETE'],
'BODY' => $lang['CONVERT_COMPLETE_EXPLAIN'],
));
-
+
+ // If we reached this step (conversion completed) we want to purge the cache and log the user out.
+ // This is for making sure the session get not screwed due to the 3.0.x users table being completely new.
+ $cache->purge();
+
+ // Make sure this session gets killed
+ $user->session_kill();
+
+ switch ($db->sql_layer)
+ {
+ case 'sqlite':
+ case 'firebird':
+ $db->sql_query('DELETE FROM ' . SESSIONS_KEYS_TABLE);
+ $db->sql_query('DELETE FROM ' . SESSIONS_TABLE);
+ break;
+
+ default:
+ $db->sql_query('TRUNCATE TABLE ' . SESSIONS_KEYS_TABLE);
+ $db->sql_query('TRUNCATE TABLE ' . SESSIONS_TABLE);
+ break;
+ }
+
break;
}
}
From 36c78d35f0fa84b7b6c9f95667f83a7b8b801041 Mon Sep 17 00:00:00 2001
From: David M
Date: Sun, 4 Feb 2007 19:10:57 +0000
Subject: [PATCH 016/707] - added a cp1255 to UTF-8 convertor
git-svn-id: file:///svn/phpbb/trunk@6965 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/includes/utf/data/recode_basic.php | 130 +++++++++++++++++++++++
1 file changed, 130 insertions(+)
diff --git a/phpBB/includes/utf/data/recode_basic.php b/phpBB/includes/utf/data/recode_basic.php
index fe29e3ddb9..8e2adcb106 100644
--- a/phpBB/includes/utf/data/recode_basic.php
+++ b/phpBB/includes/utf/data/recode_basic.php
@@ -1371,4 +1371,134 @@ function cp1257($string)
return strtr($string, $transform);
}
+function cp1255_to_utf8($string)
+{
+ static $transform = array(
+ "\xE2\x82\xAC" => "\x80",
+ "\xE2\x80\x9A" => "\x82",
+ "\xC6\x92" => "\x83",
+ "\xE2\x80\x9E" => "\x84",
+ "\xE2\x80\xA6" => "\x85",
+ "\xE2\x80\xA0" => "\x86",
+ "\xE2\x80\xA1" => "\x87",
+ "\xCB\x86" => "\x88",
+ "\xE2\x80\xB0" => "\x89",
+ "\xC5\xA0" => "\x8A",
+ "\xE2\x80\xB9" => "\x8B",
+ "\xC5\x92" => "\x8C",
+ "\xC5\xBD" => "\x8E",
+ "\xE2\x80\x98" => "\x91",
+ "\xE2\x80\x99" => "\x92",
+ "\xE2\x80\x9C" => "\x93",
+ "\xE2\x80\x9D" => "\x94",
+ "\xE2\x80\xA2" => "\x95",
+ "\xE2\x80\x93" => "\x96",
+ "\xE2\x80\x94" => "\x97",
+ "\xCB\x9C" => "\x98",
+ "\xE2\x84\xA2" => "\x99",
+ "\xC5\xA1" => "\x9A",
+ "\xE2\x80\xBA" => "\x9B",
+ "\xC5\x93" => "\x9C",
+ "\xC5\xBE" => "\x9E",
+ "\xC5\xB8" => "\x9F",
+ "\xC2\xA0" => "\xA0",
+ "\xC2\xA1" => "\xA1",
+ "\xC2\xA2" => "\xA2",
+ "\xC2\xA3" => "\xA3",
+ "\xC2\xA4" => "\xA4",
+ "\xC2\xA5" => "\xA5",
+ "\xC2\xA6" => "\xA6",
+ "\xC2\xA7" => "\xA7",
+ "\xC2\xA8" => "\xA8",
+ "\xC2\xA9" => "\xA9",
+ "\xC2\xAA" => "\xAA",
+ "\xC2\xAB" => "\xAB",
+ "\xC2\xAC" => "\xAC",
+ "\xC2\xAD" => "\xAD",
+ "\xC2\xAE" => "\xAE",
+ "\xC2\xAF" => "\xAF",
+ "\xC2\xB0" => "\xB0",
+ "\xC2\xB1" => "\xB1",
+ "\xC2\xB2" => "\xB2",
+ "\xC2\xB3" => "\xB3",
+ "\xC2\xB4" => "\xB4",
+ "\xC2\xB5" => "\xB5",
+ "\xC2\xB6" => "\xB6",
+ "\xC2\xB7" => "\xB7",
+ "\xC2\xB8" => "\xB8",
+ "\xC2\xB9" => "\xB9",
+ "\xC2\xBA" => "\xBA",
+ "\xC2\xBB" => "\xBB",
+ "\xC2\xBC" => "\xBC",
+ "\xC2\xBD" => "\xBD",
+ "\xC2\xBE" => "\xBE",
+ "\xC2\xBF" => "\xBF",
+ "\xC3\x80" => "\xC0",
+ "\xC3\x81" => "\xC1",
+ "\xC3\x82" => "\xC2",
+ "\xC3\x83" => "\xC3",
+ "\xC3\x84" => "\xC4",
+ "\xC3\x85" => "\xC5",
+ "\xC3\x86" => "\xC6",
+ "\xC3\x87" => "\xC7",
+ "\xC3\x88" => "\xC8",
+ "\xC3\x89" => "\xC9",
+ "\xC3\x8A" => "\xCA",
+ "\xC3\x8B" => "\xCB",
+ "\xC3\x8C" => "\xCC",
+ "\xC3\x8D" => "\xCD",
+ "\xC3\x8E" => "\xCE",
+ "\xC3\x8F" => "\xCF",
+ "\xC3\x90" => "\xD0",
+ "\xC3\x91" => "\xD1",
+ "\xC3\x92" => "\xD2",
+ "\xC3\x93" => "\xD3",
+ "\xC3\x94" => "\xD4",
+ "\xC3\x95" => "\xD5",
+ "\xC3\x96" => "\xD6",
+ "\xC3\x97" => "\xD7",
+ "\xC3\x98" => "\xD8",
+ "\xC3\x99" => "\xD9",
+ "\xC3\x9A" => "\xDA",
+ "\xC3\x9B" => "\xDB",
+ "\xC3\x9C" => "\xDC",
+ "\xC3\x9D" => "\xDD",
+ "\xC3\x9E" => "\xDE",
+ "\xC3\x9F" => "\xDF",
+ "\xC3\xA0" => "\xE0",
+ "\xC3\xA1" => "\xE1",
+ "\xC3\xA2" => "\xE2",
+ "\xC3\xA3" => "\xE3",
+ "\xC3\xA4" => "\xE4",
+ "\xC3\xA5" => "\xE5",
+ "\xC3\xA6" => "\xE6",
+ "\xC3\xA7" => "\xE7",
+ "\xC3\xA8" => "\xE8",
+ "\xC3\xA9" => "\xE9",
+ "\xC3\xAA" => "\xEA",
+ "\xC3\xAB" => "\xEB",
+ "\xC3\xAC" => "\xEC",
+ "\xC3\xAD" => "\xED",
+ "\xC3\xAE" => "\xEE",
+ "\xC3\xAF" => "\xEF",
+ "\xC3\xB0" => "\xF0",
+ "\xC3\xB1" => "\xF1",
+ "\xC3\xB2" => "\xF2",
+ "\xC3\xB3" => "\xF3",
+ "\xC3\xB4" => "\xF4",
+ "\xC3\xB5" => "\xF5",
+ "\xC3\xB6" => "\xF6",
+ "\xC3\xB7" => "\xF7",
+ "\xC3\xB8" => "\xF8",
+ "\xC3\xB9" => "\xF9",
+ "\xC3\xBA" => "\xFA",
+ "\xC3\xBB" => "\xFB",
+ "\xC3\xBC" => "\xFC",
+ "\xC3\xBD" => "\xFD",
+ "\xC3\xBE" => "\xFE",
+ "\xC3\xBF" => "\xFF"
+ );
+ return strtr($string, $transform);
+}
+
?>
\ No newline at end of file
From 0ea74d63a7903512ec6d449b604b1cc9731f3ab0 Mon Sep 17 00:00:00 2001
From: David M
Date: Sun, 4 Feb 2007 20:49:39 +0000
Subject: [PATCH 017/707] eh? meh.
git-svn-id: file:///svn/phpbb/trunk@6966 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/includes/utf/data/recode_basic.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/phpBB/includes/utf/data/recode_basic.php b/phpBB/includes/utf/data/recode_basic.php
index 8e2adcb106..59b1d1be3b 100644
--- a/phpBB/includes/utf/data/recode_basic.php
+++ b/phpBB/includes/utf/data/recode_basic.php
@@ -1371,7 +1371,7 @@ function cp1257($string)
return strtr($string, $transform);
}
-function cp1255_to_utf8($string)
+function cp1252_to_utf8($string)
{
static $transform = array(
"\xE2\x82\xAC" => "\x80",
From 590893b83a216affed6efd0a34ecf1763573cc15 Mon Sep 17 00:00:00 2001
From: Jonathan Stanley
Date: Mon, 5 Feb 2007 16:16:37 +0000
Subject: [PATCH 018/707] #7796
Less is more. :P
git-svn-id: file:///svn/phpbb/trunk@6967 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/language/en/groups.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/phpBB/language/en/groups.php b/phpBB/language/en/groups.php
index 2f9f6826e9..b670187270 100644
--- a/phpBB/language/en/groups.php
+++ b/phpBB/language/en/groups.php
@@ -42,7 +42,7 @@ $lang = array_merge($lang, array(
'GROUP_DESC' => 'Group description',
'GROUP_HIDDEN' => 'Hidden',
'GROUP_INFORMATION' => 'Usergroup information',
- 'GROUP_IS_CLOSED' => 'This is a closed group, where new members cannot automatically join and only upon invitation of a group leader.',
+ 'GROUP_IS_CLOSED' => 'This is a closed group, new members only join upon invitation of a group leader.',
'GROUP_IS_FREE' => 'This is a freely open group, all new members are welcome.',
'GROUP_IS_HIDDEN' => 'This is a hidden group, only members of this group can view its membership.',
'GROUP_IS_OPEN' => 'This is an open group, members can apply to join.',
From 1d12ca12b3cf828c0857a8678bda2a81d51fd58c Mon Sep 17 00:00:00 2001
From: Jonathan Stanley
Date: Mon, 5 Feb 2007 16:22:38 +0000
Subject: [PATCH 019/707] Blargh @_@
git-svn-id: file:///svn/phpbb/trunk@6968 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/language/en/groups.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/phpBB/language/en/groups.php b/phpBB/language/en/groups.php
index b670187270..8e44d32a0d 100644
--- a/phpBB/language/en/groups.php
+++ b/phpBB/language/en/groups.php
@@ -42,7 +42,7 @@ $lang = array_merge($lang, array(
'GROUP_DESC' => 'Group description',
'GROUP_HIDDEN' => 'Hidden',
'GROUP_INFORMATION' => 'Usergroup information',
- 'GROUP_IS_CLOSED' => 'This is a closed group, new members only join upon invitation of a group leader.',
+ 'GROUP_IS_CLOSED' => 'This is a closed group, new members can only join upon invitation of a group leader.',
'GROUP_IS_FREE' => 'This is a freely open group, all new members are welcome.',
'GROUP_IS_HIDDEN' => 'This is a hidden group, only members of this group can view its membership.',
'GROUP_IS_OPEN' => 'This is an open group, members can apply to join.',
From 10f775cb1cc44b083373543a6c08214d1dd291f0 Mon Sep 17 00:00:00 2001
From: Meik Sievertsen
Date: Mon, 5 Feb 2007 16:24:15 +0000
Subject: [PATCH 020/707] only some minor fixes
git-svn-id: file:///svn/phpbb/trunk@6969 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/includes/acp/acp_language.php | 1 +
phpBB/includes/functions.php | 5 ++-
phpBB/includes/ucp/ucp_groups.php | 1 +
phpBB/index.php | 6 ++-
phpBB/install/install_convert.php | 10 ++++-
phpBB/memberlist.php | 42 ++++++++++++-------
.../template/ucp_groups_membership.html | 8 ++--
phpBB/viewtopic.php | 1 +
8 files changed, 48 insertions(+), 26 deletions(-)
diff --git a/phpBB/includes/acp/acp_language.php b/phpBB/includes/acp/acp_language.php
index b1f6554809..7dcd64265c 100644
--- a/phpBB/includes/acp/acp_language.php
+++ b/phpBB/includes/acp/acp_language.php
@@ -1010,6 +1010,7 @@ class acp_language
* {FILENAME} [{LANG_NAME}]
*
* @package language
+* @version $Id: $
* @copyright (c) ' . date('Y') . ' phpBB Group
* @author {CHANGED} - {AUTHOR}
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index ff514e7ec5..4147e87556 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -1351,7 +1351,8 @@ function generate_pagination($base_url, $num_items, $per_page, $start_item, $add
$tpl_prefix . 'PER_PAGE' => $per_page,
$tpl_prefix . 'PREVIOUS_PAGE' => ($on_page == 1) ? '' : $base_url . '&start=' . (($on_page - 2) * $per_page),
- $tpl_prefix . 'NEXT_PAGE' => ($on_page == $total_pages) ? '' : $base_url . '&start=' . ($on_page * $per_page))
+ $tpl_prefix . 'NEXT_PAGE' => ($on_page == $total_pages) ? '' : $base_url . '&start=' . ($on_page * $per_page),
+ $tpl_prefix . 'TOTAL_PAGES' => $total_pages)
);
return $page_string;
@@ -1370,7 +1371,7 @@ function on_page($num_items, $per_page, $start)
$on_page = floor($start / $per_page) + 1;
$template->assign_vars(array(
- 'ON_PAGE' => $on_page)
+ 'ON_PAGE' => $on_page)
);
return sprintf($user->lang['PAGE_OF'], $on_page, max(ceil($num_items / $per_page), 1));
diff --git a/phpBB/includes/ucp/ucp_groups.php b/phpBB/includes/ucp/ucp_groups.php
index 119f496d21..98d008da2c 100644
--- a/phpBB/includes/ucp/ucp_groups.php
+++ b/phpBB/includes/ucp/ucp_groups.php
@@ -297,6 +297,7 @@ class ucp_groups
'GROUP_DESC' => ($row['group_type'] <> GROUP_SPECIAL) ? generate_text_for_display($row['group_desc'], $row['group_desc_uid'], $row['group_desc_bitfield'], $row['group_desc_options']) : $user->lang['GROUP_IS_SPECIAL'],
'GROUP_SPECIAL' => ($row['group_type'] <> GROUP_SPECIAL) ? false : true,
'GROUP_STATUS' => $user->lang['GROUP_IS_' . $group_status],
+ 'GROUP_COLOUR' => $row['group_colour'],
'U_VIEW_GROUP' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&g=' . $row['group_id']),
diff --git a/phpBB/index.php b/phpBB/index.php
index 6d24ac8e5d..53b9d4754f 100644
--- a/phpBB/index.php
+++ b/phpBB/index.php
@@ -46,13 +46,15 @@ $result = $db->sql_query($sql);
$legend = '';
while ($row = $db->sql_fetchrow($result))
{
+ $colour_text = ($row['group_colour']) ? ' style="color:#' . $row['group_colour'] . '"' : '';
+
if ($row['group_name'] == 'BOTS')
{
- $legend .= (($legend != '') ? ', ' : '') . '' . $user->lang['G_BOTS'] . ' ';
+ $legend .= (($legend != '') ? ', ' : '') . '' . $user->lang['G_BOTS'] . ' ';
}
else
{
- $legend .= (($legend != '') ? ', ' : '') . '' . (($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']) . ' ';
+ $legend .= (($legend != '') ? ', ' : '') . '' . (($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']) . ' ';
}
}
$db->sql_freeresult($result);
diff --git a/phpBB/install/install_convert.php b/phpBB/install/install_convert.php
index 9a5177c941..0750bfa4f6 100644
--- a/phpBB/install/install_convert.php
+++ b/phpBB/install/install_convert.php
@@ -196,8 +196,14 @@ class install_convert extends module
// This is for making sure the session get not screwed due to the 3.0.x users table being completely new.
$cache->purge();
- // Make sure this session gets killed
- $user->session_kill();
+ require($phpbb_root_path . 'config.' . $phpEx);
+ require($phpbb_root_path . 'includes/constants.' . $phpEx);
+ require($phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx);
+ require($phpbb_root_path . 'includes/functions_convert.' . $phpEx);
+
+ $db = new $sql_db();
+ $db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false);
+ unset($dbpasswd);
switch ($db->sql_layer)
{
diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php
index 9b43d0be24..e759d9af4f 100644
--- a/phpBB/memberlist.php
+++ b/phpBB/memberlist.php
@@ -1144,7 +1144,7 @@ switch ($mode)
$s_char_options .= '' . $user->lang['OTHER'] . ' ';
// Build a relevant pagination_url
- $params = array();
+ $params = $sort_params = array();
foreach (array('_POST', '_GET') as $global_var)
{
foreach ($$global_var as $key => $var)
@@ -1159,14 +1159,24 @@ switch ($mode)
continue;
}
- $params[] = urlencode($key) . '=' . urlencode(htmlspecialchars($var));
+ $param = urlencode($key) . '=' . urlencode(htmlspecialchars($var));
+ $params[] = $param;
+
+ if (!in_array($key, array('sk', 'sd')))
+ {
+ $sort_params[] = $param;
+ }
}
}
$u_hide_find_member = append_sid("{$phpbb_root_path}memberlist.$phpEx", implode('&', $params));
$params[] = "mode=$mode";
+ $sort_params[] = "mode=$mode";
$pagination_url = append_sid("{$phpbb_root_path}memberlist.$phpEx", implode('&', $params));
+ $sort_url = append_sid("{$phpbb_root_path}memberlist.$phpEx", implode('&', $sort_params));
+
+ unset($params, $sort_params);
// Some search user specific data
if ($mode == 'searchuser' && ($config['load_search'] || $auth->acl_get('a_')))
@@ -1319,20 +1329,20 @@ switch ($mode)
'U_FIND_MEMBER' => ($config['load_search'] || $auth->acl_get('a_')) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser') : '',
'U_HIDE_FIND_MEMBER' => ($mode == 'searchuser') ? $u_hide_find_member : '',
- 'U_SORT_USERNAME' => $pagination_url . '&sk=a&sd=' . (($sort_key == 'a' && $sort_dir == 'a') ? 'd' : 'a'),
- 'U_SORT_FROM' => $pagination_url . '&sk=b&sd=' . (($sort_key == 'b' && $sort_dir == 'a') ? 'd' : 'a'),
- 'U_SORT_JOINED' => $pagination_url . '&sk=c&sd=' . (($sort_key == 'c' && $sort_dir == 'a') ? 'd' : 'a'),
- 'U_SORT_POSTS' => $pagination_url . '&sk=d&sd=' . (($sort_key == 'd' && $sort_dir == 'a') ? 'd' : 'a'),
- 'U_SORT_EMAIL' => $pagination_url . '&sk=e&sd=' . (($sort_key == 'e' && $sort_dir == 'a') ? 'd' : 'a'),
- 'U_SORT_WEBSITE' => $pagination_url . '&sk=f&sd=' . (($sort_key == 'f' && $sort_dir == 'a') ? 'd' : 'a'),
- 'U_SORT_LOCATION' => $pagination_url . '&sk=n&sd=' . (($sort_key == 'n' && $sort_dir == 'a') ? 'd' : 'a'),
- 'U_SORT_ICQ' => $pagination_url . '&sk=g&sd=' . (($sort_key == 'g' && $sort_dir == 'a') ? 'd' : 'a'),
- 'U_SORT_AIM' => $pagination_url . '&sk=h&sd=' . (($sort_key == 'h' && $sort_dir == 'a') ? 'd' : 'a'),
- 'U_SORT_MSN' => $pagination_url . '&sk=i&sd=' . (($sort_key == 'i' && $sort_dir == 'a') ? 'd' : 'a'),
- 'U_SORT_YIM' => $pagination_url . '&sk=j&sd=' . (($sort_key == 'j' && $sort_dir == 'a') ? 'd' : 'a'),
- 'U_SORT_ACTIVE' => $pagination_url . '&sk=k&sd=' . (($sort_key == 'k' && $sort_dir == 'a') ? 'd' : 'a'),
- 'U_SORT_RANK' => $pagination_url . '&sk=m&sd=' . (($sort_key == 'm' && $sort_dir == 'a') ? 'd' : 'a'),
- 'U_LIST_CHAR' => $pagination_url . '&sk=a&sd=' . (($sort_key == 'l' && $sort_dir == 'a') ? 'd' : 'a'),
+ 'U_SORT_USERNAME' => $sort_url . '&sk=a&sd=' . (($sort_key == 'a' && $sort_dir == 'a') ? 'd' : 'a'),
+ 'U_SORT_FROM' => $sort_url . '&sk=b&sd=' . (($sort_key == 'b' && $sort_dir == 'a') ? 'd' : 'a'),
+ 'U_SORT_JOINED' => $sort_url . '&sk=c&sd=' . (($sort_key == 'c' && $sort_dir == 'a') ? 'd' : 'a'),
+ 'U_SORT_POSTS' => $sort_url . '&sk=d&sd=' . (($sort_key == 'd' && $sort_dir == 'a') ? 'd' : 'a'),
+ 'U_SORT_EMAIL' => $sort_url . '&sk=e&sd=' . (($sort_key == 'e' && $sort_dir == 'a') ? 'd' : 'a'),
+ 'U_SORT_WEBSITE' => $sort_url . '&sk=f&sd=' . (($sort_key == 'f' && $sort_dir == 'a') ? 'd' : 'a'),
+ 'U_SORT_LOCATION' => $sort_url . '&sk=n&sd=' . (($sort_key == 'n' && $sort_dir == 'a') ? 'd' : 'a'),
+ 'U_SORT_ICQ' => $sort_url . '&sk=g&sd=' . (($sort_key == 'g' && $sort_dir == 'a') ? 'd' : 'a'),
+ 'U_SORT_AIM' => $sort_url . '&sk=h&sd=' . (($sort_key == 'h' && $sort_dir == 'a') ? 'd' : 'a'),
+ 'U_SORT_MSN' => $sort_url . '&sk=i&sd=' . (($sort_key == 'i' && $sort_dir == 'a') ? 'd' : 'a'),
+ 'U_SORT_YIM' => $sort_url . '&sk=j&sd=' . (($sort_key == 'j' && $sort_dir == 'a') ? 'd' : 'a'),
+ 'U_SORT_ACTIVE' => $sort_url . '&sk=k&sd=' . (($sort_key == 'k' && $sort_dir == 'a') ? 'd' : 'a'),
+ 'U_SORT_RANK' => $sort_url . '&sk=m&sd=' . (($sort_key == 'm' && $sort_dir == 'a') ? 'd' : 'a'),
+ 'U_LIST_CHAR' => $sort_url . '&sk=a&sd=' . (($sort_key == 'l' && $sort_dir == 'a') ? 'd' : 'a'),
'S_SHOW_GROUP' => ($mode == 'group') ? true : false,
'S_MODE_SELECT' => $s_sort_key,
diff --git a/phpBB/styles/subSilver/template/ucp_groups_membership.html b/phpBB/styles/subSilver/template/ucp_groups_membership.html
index a0020f69d8..af1b2248a0 100644
--- a/phpBB/styles/subSilver/template/ucp_groups_membership.html
+++ b/phpBB/styles/subSilver/template/ucp_groups_membership.html
@@ -23,7 +23,7 @@
checked="checked" value="{leader.GROUP_ID}" />
- {leader.GROUP_NAME}
+ style="color:#{leader.GROUP_COLOUR}">{leader.GROUP_NAME}
{leader.GROUP_DESC}
{leader.GROUP_STATUS}
@@ -41,7 +41,7 @@
checked="checked" value="{member.GROUP_ID}" />
- {member.GROUP_NAME}
+ style="color:#{member.GROUP_COLOUR}">{member.GROUP_NAME}
{member.GROUP_DESC}
{member.GROUP_STATUS}
@@ -59,7 +59,7 @@
- {pending.GROUP_NAME}
+ style="color:#{pending.GROUP_COLOUR}">{pending.GROUP_NAME}
{pending.GROUP_DESC}
{pending.GROUP_STATUS}
@@ -77,7 +77,7 @@
- {nonmember.GROUP_NAME}
+ style="color:#{nonmember.GROUP_COLOUR}">{nonmember.GROUP_NAME}
{nonmember.GROUP_DESC}
{nonmember.GROUP_STATUS}
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php
index 4ef45eddc0..15058f1295 100644
--- a/phpBB/viewtopic.php
+++ b/phpBB/viewtopic.php
@@ -111,6 +111,7 @@ if ($view && !$post_id)
LEFT JOIN ' . TOPICS_TABLE . " t2 ON (t2.topic_id = $topic_id AND t.forum_id = t2.forum_id)
WHERE t.topic_last_post_time $sql_condition t2.topic_last_post_time
" . (($auth->acl_get('m_approve', $forum_id)) ? '' : 'AND t.topic_approved = 1') . "
+ AND t.topic_moved_id = 0
ORDER BY t.topic_last_post_time $sql_ordering";
$result = $db->sql_query_limit($sql, 1);
$row = $db->sql_fetchrow($result);
From 333b3515ed1e94dba1593b2eb3f9fb9d5a1f1440 Mon Sep 17 00:00:00 2001
From: Meik Sievertsen
Date: Tue, 6 Feb 2007 19:09:43 +0000
Subject: [PATCH 021/707] Some... fixes... laying around here.
git-svn-id: file:///svn/phpbb/trunk@6970 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/adm/style/acp_users.html | 2 +-
phpBB/download.php | 13 ++++----
phpBB/includes/acp/acp_bots.php | 13 ++++----
phpBB/includes/acp/acp_email.php | 29 ++++++++++++------
phpBB/includes/acp/acp_permissions.php | 31 ++++++++++---------
phpBB/includes/acp/acp_users.php | 41 ++------------------------
phpBB/includes/functions_admin.php | 27 ++++++++++++++++-
phpBB/includes/functions_convert.php | 7 +++++
phpBB/includes/mcp/mcp_forum.php | 21 +++++++++----
phpBB/includes/mcp/mcp_reports.php | 6 +++-
phpBB/install/database_update.php | 13 ++++----
11 files changed, 115 insertions(+), 88 deletions(-)
diff --git a/phpBB/adm/style/acp_users.html b/phpBB/adm/style/acp_users.html
index d44832b9b7..adbabb7089 100644
--- a/phpBB/adm/style/acp_users.html
+++ b/phpBB/adm/style/acp_users.html
@@ -54,7 +54,7 @@
« {L_BACK}
- {L_USER_ADMIN}
+ {L_USER_ADMIN} :: {MANAGED_USERNAME}
{L_USER_ADMIN_EXPLAIN}
diff --git a/phpBB/download.php b/phpBB/download.php
index 41d09287de..cec44eaf1c 100644
--- a/phpBB/download.php
+++ b/phpBB/download.php
@@ -265,21 +265,20 @@ function send_file_to_browser($attachment, $upload_dir, $category)
exit;
}
-/*
+/**
* Get a browser friendly UTF-8 encoded filename
*/
function header_filename($file)
{
// There be dragons here...
- // IE follows no RFC, follow the RFC for extended filename for the rest
- if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false)
+ // IE and Safari follows no RFC.
+ if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false || strpos($_SERVER['HTTP_USER_AGENT'], 'Safari') !== false)
{
return "filename=" . rawurlencode($file);
}
- else
- {
- return "filename*=UTF-8''" . rawurlencode($file);
- }
+
+ // follow the RFC for extended filename for the rest
+ return "filename*=UTF-8''" . rawurlencode($file);
}
/**
diff --git a/phpBB/includes/acp/acp_bots.php b/phpBB/includes/acp/acp_bots.php
index 72fb40216d..43984c5a5c 100644
--- a/phpBB/includes/acp/acp_bots.php
+++ b/phpBB/includes/acp/acp_bots.php
@@ -94,12 +94,15 @@ class acp_bots
WHERE bot_id $sql_id";
$db->sql_query($sql);
- $_tables = array(USERS_TABLE, USER_GROUP_TABLE);
- foreach ($_tables as $table)
+ if (sizeof($user_id_ary))
{
- $sql = "DELETE FROM $table
- WHERE " . $db->sql_in_set('user_id', $user_id_ary);
- $db->sql_query($sql);
+ $_tables = array(USERS_TABLE, USER_GROUP_TABLE);
+ foreach ($_tables as $table)
+ {
+ $sql = "DELETE FROM $table
+ WHERE " . $db->sql_in_set('user_id', $user_id_ary);
+ $db->sql_query($sql);
+ }
}
$db->sql_transaction('commit');
diff --git a/phpBB/includes/acp/acp_email.php b/phpBB/includes/acp/acp_email.php
index 6b2904b245..57d03ff67e 100644
--- a/phpBB/includes/acp/acp_email.php
+++ b/phpBB/includes/acp/acp_email.php
@@ -55,6 +55,7 @@ class acp_email
{
if ($usernames)
{
+ // If giving usernames the admin is able to email inactive users too...
$sql = 'SELECT username, user_email, user_jabber, user_notify_type, user_lang
FROM ' . USERS_TABLE . '
WHERE ' . $db->sql_in_set('username_clean', array_map('utf8_clean_string', explode("\n", $usernames))) . '
@@ -66,18 +67,20 @@ class acp_email
if ($group_id)
{
$sql = 'SELECT u.user_email, u.username, u.username_clean, u.user_lang, u.user_jabber, u.user_notify_type
- FROM ' . USERS_TABLE . ' u, ' . USER_GROUP_TABLE . " ug
- WHERE ug.group_id = $group_id
+ FROM ' . USERS_TABLE . ' u, ' . USER_GROUP_TABLE . ' ug
+ WHERE ug.group_id = ' . $group_id . '
AND ug.user_pending = 0
AND u.user_id = ug.user_id
AND u.user_allow_massemail = 1
- ORDER BY u.user_lang, u.user_notify_type";
+ AND u.user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ')
+ ORDER BY u.user_lang, u.user_notify_type';
}
else
{
$sql = 'SELECT username, username_clean, user_email, user_jabber, user_notify_type, user_lang
FROM ' . USERS_TABLE . '
WHERE user_allow_massemail = 1
+ AND user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ')
ORDER BY user_lang, user_notify_type';
}
}
@@ -172,17 +175,25 @@ class acp_email
$messenger->save_queue();
- if ($group_id)
+ if ($usernames)
{
- $group_name = get_group_name($group_id);
+ $usernames = explode("\n", $usernames);
+ add_log('admin', 'LOG_MASS_EMAIL', implode(', ', $usernames));
}
else
{
- // Not great but the logging routine doesn't cope well with localising on the fly
- $group_name = $user->lang['ALL_USERS'];
- }
+ if ($group_id)
+ {
+ $group_name = get_group_name($group_id);
+ }
+ else
+ {
+ // Not great but the logging routine doesn't cope well with localising on the fly
+ $group_name = $user->lang['ALL_USERS'];
+ }
- add_log('admin', 'LOG_MASS_EMAIL', $group_name);
+ add_log('admin', 'LOG_MASS_EMAIL', $group_name);
+ }
if (!$errored)
{
diff --git a/phpBB/includes/acp/acp_permissions.php b/phpBB/includes/acp/acp_permissions.php
index c7e9e31d66..b0a163fc60 100644
--- a/phpBB/includes/acp/acp_permissions.php
+++ b/phpBB/includes/acp/acp_permissions.php
@@ -355,7 +355,10 @@ class acp_permissions
case 'usergroup':
case 'usergroup_view':
- if (sizeof($user_id) || sizeof($group_id))
+ $all_users = (isset($_POST['all_users'])) ? true : false;
+ $all_groups = (isset($_POST['all_groups'])) ? true : false;
+
+ if ((sizeof($user_id) && !$all_users) || (sizeof($group_id) && !$all_groups))
{
if (sizeof($user_id))
{
@@ -370,11 +373,8 @@ class acp_permissions
continue 2;
}
- $items = $this->retrieve_defined_user_groups($permission_scope, $forum_id, $permission_type);
-
// Now we check the users... because the "all"-selection is different here (all defined users/groups)
- $all_users = (isset($_POST['all_users'])) ? true : false;
- $all_groups = (isset($_POST['all_groups'])) ? true : false;
+ $items = $this->retrieve_defined_user_groups($permission_scope, $forum_id, $permission_type);
if ($all_users && sizeof($items['user_ids']))
{
@@ -565,17 +565,20 @@ class acp_permissions
break;
}
- $sql = "SELECT $sql_id
- FROM $table
- WHERE " . $db->sql_in_set($sql_id, $ids);
- $result = $db->sql_query($sql);
-
- $ids = array();
- while ($row = $db->sql_fetchrow($result))
+ if (sizeof($ids))
{
- $ids[] = $row[$sql_id];
+ $sql = "SELECT $sql_id
+ FROM $table
+ WHERE " . $db->sql_in_set($sql_id, $ids);
+ $result = $db->sql_query($sql);
+
+ $ids = array();
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $ids[] = $row[$sql_id];
+ }
+ $db->sql_freeresult($result);
}
- $db->sql_freeresult($result);
if (!sizeof($ids))
{
diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php
index 24fd028bad..87744660a2 100644
--- a/phpBB/includes/acp/acp_users.php
+++ b/phpBB/includes/acp/acp_users.php
@@ -134,7 +134,8 @@ class acp_users
'U_BACK' => $this->u_action,
'U_MODE_SELECT' => append_sid("{$phpbb_admin_path}index.$phpEx", "i=$id&u=$user_id"),
'U_ACTION' => $this->u_action . '&u=' . $user_id,
- 'S_FORM_OPTIONS' => $s_form_options)
+ 'S_FORM_OPTIONS' => $s_form_options,
+ 'MANAGED_USERNAME' => $user_row['username'])
);
// Prevent normal users/admins change/view founders if they are not a founder by themselves
@@ -398,44 +399,6 @@ class acp_users
if (confirm_box(true))
{
- $sql = 'SELECT topic_id, COUNT(post_id) AS total_posts
- FROM ' . POSTS_TABLE . "
- WHERE poster_id = $user_id
- GROUP BY topic_id";
- $result = $db->sql_query($sql);
-
- $topic_id_ary = array();
- while ($row = $db->sql_fetchrow($result))
- {
- $topic_id_ary[$row['topic_id']] = $row['total_posts'];
- }
- $db->sql_freeresult($result);
-
- if (sizeof($topic_id_ary))
- {
- $sql = 'SELECT topic_id, topic_replies, topic_replies_real
- FROM ' . TOPICS_TABLE . '
- WHERE ' . $db->sql_in_set('topic_id', array_keys($topic_id_ary));
- $result = $db->sql_query($sql);
-
- $del_topic_ary = array();
- while ($row = $db->sql_fetchrow($result))
- {
- if (max($row['topic_replies'], $row['topic_replies_real']) + 1 == $topic_id_ary[$row['topic_id']])
- {
- $del_topic_ary[] = $row['topic_id'];
- }
- }
- $db->sql_freeresult($result);
-
- if (sizeof($del_topic_ary))
- {
- $sql = 'DELETE FROM ' . TOPICS_TABLE . '
- WHERE ' . $db->sql_in_set('topic_id', $del_topic_ary);
- $db->sql_query($sql);
- }
- }
-
// Delete posts, attachments, etc.
delete_posts('poster_id', $user_id);
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php
index 7208aee113..e0b7b8a554 100644
--- a/phpBB/includes/functions_admin.php
+++ b/phpBB/includes/functions_admin.php
@@ -598,7 +598,7 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync =
}
$approved_posts = 0;
- $post_ids = $topic_ids = $forum_ids = $post_counts = array();
+ $post_ids = $topic_ids = $forum_ids = $post_counts = $remove_topics = array();
$sql = 'SELECT post_id, poster_id, post_approved, post_postcount, topic_id, forum_id
FROM ' . POSTS_TABLE . '
@@ -653,6 +653,25 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync =
}
}
+ // Remove topics now having no posts?
+ if (sizeof($topic_ids))
+ {
+ $sql = 'SELECT topic_id
+ FROM ' . POSTS_TABLE . '
+ WHERE ' . $db->sql_in_set('topic_id', $topic_ids) . '
+ GROUP BY topic_id';
+ $result = $db->sql_query($sql);
+
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $remove_topics[] = $row['topic_id'];
+ }
+ $db->sql_freeresult($result);
+
+ // Actually, those not within remove_topics should be removed. ;)
+ $remove_topics = array_diff($topic_ids, $remove_topics);
+ }
+
// Remove the message from the search index
$search_type = basename($config['search_type']);
@@ -695,6 +714,12 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync =
set_config('num_posts', $config['num_posts'] - $approved_posts, true);
}
+ // We actually remove topics now to not be inconsistent (the delete_topics function calls this function too)
+ if (sizeof($remove_topics))
+ {
+ delete_topics('topic_id', $remove_topics);
+ }
+
return sizeof($post_ids);
}
diff --git a/phpBB/includes/functions_convert.php b/phpBB/includes/functions_convert.php
index e96cf5aaf1..08ecd7c5e7 100644
--- a/phpBB/includes/functions_convert.php
+++ b/phpBB/includes/functions_convert.php
@@ -308,6 +308,13 @@ function decode_ip($int_ip)
}
$hexipbang = explode('.', chunk_split($int_ip, 2, '.'));
+
+ // Any mod changing the way ips are stored? Then we are not able to convert.
+ if (sizeof($hexipbang) != 4)
+ {
+ return '';
+ }
+
return hexdec($hexipbang[0]). '.' . hexdec($hexipbang[1]) . '.' . hexdec($hexipbang[2]) . '.' . hexdec($hexipbang[3]);
}
diff --git a/phpBB/includes/mcp/mcp_forum.php b/phpBB/includes/mcp/mcp_forum.php
index cf41df646d..2f02a21a3f 100644
--- a/phpBB/includes/mcp/mcp_forum.php
+++ b/phpBB/includes/mcp/mcp_forum.php
@@ -117,6 +117,7 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
ORDER BY t.topic_type DESC, $sort_order_sql";
$result = $db->sql_query_limit($sql, $topics_per_page, $start);
+ $topic_list = $topic_tracking_info = array();
while ($row = $db->sql_fetchrow($result))
{
$topic_rows[$row['topic_id']] = $row;
@@ -124,15 +125,23 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
}
$db->sql_freeresult($result);
- $topic_tracking_info = array();
- // Get topic tracking info
- if ($config['load_db_lastread'])
+ // If there is more than one page, but we have no topic list, then the start parameter is... erm... out of sync
+ if (!sizeof($topic_list) && $forum_topics && $start > 0)
{
- $topic_tracking_info = get_topic_tracking($forum_id, $topic_list, $topic_rows, array($forum_id => $forum_info['mark_time']), array());
+ redirect($url . "&i=$id&action=$action&mode=$mode");
}
- else
+
+ // Get topic tracking info
+ if (sizeof($topic_list))
{
- $topic_tracking_info = get_complete_topic_tracking($forum_id, $topic_list, array());
+ if ($config['load_db_lastread'])
+ {
+ $topic_tracking_info = get_topic_tracking($forum_id, $topic_list, $topic_rows, array($forum_id => $forum_info['mark_time']), array());
+ }
+ else
+ {
+ $topic_tracking_info = get_complete_topic_tracking($forum_id, $topic_list, array());
+ }
}
foreach ($topic_rows as $topic_id => $row)
diff --git a/phpBB/includes/mcp/mcp_reports.php b/phpBB/includes/mcp/mcp_reports.php
index 78fa02cccc..a57dadb301 100755
--- a/phpBB/includes/mcp/mcp_reports.php
+++ b/phpBB/includes/mcp/mcp_reports.php
@@ -192,7 +192,7 @@ class mcp_reports
$forum_info = array();
$forum_list_reports = get_forum_list('m_report', false, true);
- if ($topic_id)
+ if ($topic_id && $forum_id)
{
$topic_info = get_topic_data(array($topic_id));
@@ -204,6 +204,10 @@ class mcp_reports
$topic_info = $topic_info[$topic_id];
$forum_id = $topic_info['forum_id'];
}
+ else if ($topic_id && !$forum_id)
+ {
+ $topic_id = 0;
+ }
$forum_list = array();
diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php
index b68eab59be..0e4b0381f0 100644
--- a/phpBB/install/database_update.php
+++ b/phpBB/install/database_update.php
@@ -1354,12 +1354,15 @@ function add_bots()
WHERE bot_id $sql_id";
$db->sql_query($sql);
- $_tables = array(USERS_TABLE, USER_GROUP_TABLE);
- foreach ($_tables as $table)
+ if (sizeof($user_id_ary))
{
- $sql = "DELETE FROM $table
- WHERE " . $db->sql_in_set('user_id', $user_id_ary);
- $db->sql_query($sql);
+ $_tables = array(USERS_TABLE, USER_GROUP_TABLE);
+ foreach ($_tables as $table)
+ {
+ $sql = "DELETE FROM $table
+ WHERE " . $db->sql_in_set('user_id', $user_id_ary);
+ $db->sql_query($sql);
+ }
}
}
else
From 0fc55efc7d887a07061b52456bfb01e0bc298d9a Mon Sep 17 00:00:00 2001
From: David M
Date: Wed, 7 Feb 2007 04:02:00 +0000
Subject: [PATCH 022/707] #7698 - small UTF-8 thing
git-svn-id: file:///svn/phpbb/trunk@6971 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/includes/functions_convert.php | 2 +-
phpBB/includes/utf/utf_tools.php | 6 +-
.../install/convertors/functions_phpbb20.php | 4 +-
phpBB/install/install_convert.php | 90 +++++++++++++++++++
4 files changed, 96 insertions(+), 6 deletions(-)
diff --git a/phpBB/includes/functions_convert.php b/phpBB/includes/functions_convert.php
index 08ecd7c5e7..64cb63de3a 100644
--- a/phpBB/includes/functions_convert.php
+++ b/phpBB/includes/functions_convert.php
@@ -1205,7 +1205,7 @@ function update_folder_pm_count()
$sql = 'SELECT user_id, folder_id, COUNT(msg_id) as num_messages
FROM ' . PRIVMSGS_TO_TABLE . '
WHERE folder_id NOT IN (' . PRIVMSGS_NO_BOX . ', ' . PRIVMSGS_HOLD_BOX . ', ' . PRIVMSGS_INBOX . ', ' . PRIVMSGS_OUTBOX . ', ' . PRIVMSGS_SENTBOX . ')
- GROUP BY folder_id';
+ GROUP BY folder_id, user_id';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
diff --git a/phpBB/includes/utf/utf_tools.php b/phpBB/includes/utf/utf_tools.php
index a13246c65d..9ab31e60e4 100644
--- a/phpBB/includes/utf/utf_tools.php
+++ b/phpBB/includes/utf/utf_tools.php
@@ -719,7 +719,7 @@ function utf8_recode($string, $encoding)
{
$ret = @iconv($encoding, 'utf-8', $string);
- if (isset($ret[0]))
+ if (!empty($ret))
{
return $ret;
}
@@ -730,7 +730,7 @@ function utf8_recode($string, $encoding)
{
$ret = @mb_convert_encoding($string, 'utf-8', $encoding);
- if (isset($ret[0]))
+ if (!empty($ret))
{
return $ret;
}
@@ -741,7 +741,7 @@ function utf8_recode($string, $encoding)
{
$ret = @recode_string($encoding . '..utf-8', $string);
- if (isset($ret[0]))
+ if (!empty($ret))
{
return $ret;
}
diff --git a/phpBB/install/convertors/functions_phpbb20.php b/phpBB/install/convertors/functions_phpbb20.php
index 14d98deed2..7610c4725d 100644
--- a/phpBB/install/convertors/functions_phpbb20.php
+++ b/phpBB/install/convertors/functions_phpbb20.php
@@ -158,9 +158,9 @@ function phpbb_insert_forums()
}
// Now insert the forums
- $sql = 'SELECT f.*, fp.prune_days, fp.prune_freq FROM ' . $convert->src_table_prefix . 'forums f
+ $sql = 'SELECT f.forum_id, f.forum_name, f.cat_id, f.forum_desc, f.forum_status, f.prune_enable, f.prune_next, fp.prune_days, fp.prune_freq FROM ' . $convert->src_table_prefix . 'forums f
LEFT JOIN ' . $convert->src_table_prefix . 'forum_prune fp ON f.forum_id = fp.forum_id
- GROUP BY f.forum_id
+ GROUP BY f.forum_id, f.forum_name, f.cat_id, f.forum_desc, f.forum_status, f.prune_enable, f.prune_next, f.forum_order, fp.prune_days, fp.prune_freq
ORDER BY f.cat_id, f.forum_order';
if ($convert->mysql_convert)
diff --git a/phpBB/install/install_convert.php b/phpBB/install/install_convert.php
index 0750bfa4f6..fbca8913c1 100644
--- a/phpBB/install/install_convert.php
+++ b/phpBB/install/install_convert.php
@@ -909,6 +909,51 @@ class install_convert extends module
$db->sql_query($query_first);
}
}
+
+ if ($db->sql_layer === 'postgres')
+ {
+ $tables = array(
+ ATTACHMENTS_TABLE => 'attach_id',
+ ACL_OPTIONS_TABLE => 'auth_option_id',
+ ACL_ROLES_TABLE => 'role_id',
+ BANLIST_TABLE => 'ban_id',
+ BOTS_TABLE => 'bot_id',
+ DISALLOW_TABLE => 'disallow_id',
+ DRAFTS_TABLE => 'draft_id',
+ EXTENSIONS_TABLE => 'extension_id',
+ EXTENSION_GROUPS_TABLE => 'group_id',
+ FORUMS_TABLE => 'forum_id',
+ GROUPS_TABLE => 'group_id',
+ ICONS_TABLE => 'icons_id',
+ LANG_TABLE => 'lang_id',
+ LOG_TABLE => 'log_id',
+ MODULES_TABLE => 'module_id',
+ POSTS_TABLE => 'post_id',
+ PRIVMSGS_TABLE => 'msg_id',
+ PRIVMSGS_FOLDER_TABLE => 'folder_id',
+ PRIVMSGS_RULES_TABLE => 'rule_id',
+ PROFILE_FIELDS_TABLE => 'field_id',
+ RANKS_TABLE => 'rank_id',
+ REPORTS_TABLE => 'report_id',
+ REPORTS_REASONS_TABLE => 'reason_id',
+ SEARCH_WORDLIST_TABLE => 'word_id',
+ SITELIST_TABLE => 'site_id',
+ SMILIES_TABLE => 'smiley_id',
+ STYLES_TABLE => 'style_id',
+ STYLES_TEMPLATE_TABLE => 'template_id',
+ STYLES_TEMPLATE_DATA_TABLE => 'template_id',
+ STYLES_THEME_TABLE => 'theme_id',
+ STYLES_IMAGESET_TABLE => 'imageset_id',
+ TOPICS_TABLE => 'topic_id',
+ USERS_TABLE => 'user_id',
+ WARNINGS_TABLE => 'warning_id',
+ WORDS_TABLE => 'word_id'
+ );
+ if (!empty($tables[$schema['target']]))
+ {
+ $db->sql_query("SELECT SETVAL('" . $schema['target'] . "_seq',(select case when max(" . $tables[$schema['target']] . ")>0 then max(" . $tables[$schema['target']] . ")+1 else 1 end from " . $schema['target'] . '));');
+ }
+ }
}
// Process execute_always for this table
@@ -1122,6 +1167,51 @@ class install_convert extends module
$waiting_rows = array();
}
+
+ if ($db->sql_layer === 'postgres')
+ {
+ $tables = array(
+ ATTACHMENTS_TABLE => 'attach_id',
+ ACL_OPTIONS_TABLE => 'auth_option_id',
+ ACL_ROLES_TABLE => 'role_id',
+ BANLIST_TABLE => 'ban_id',
+ BOTS_TABLE => 'bot_id',
+ DISALLOW_TABLE => 'disallow_id',
+ DRAFTS_TABLE => 'draft_id',
+ EXTENSIONS_TABLE => 'extension_id',
+ EXTENSION_GROUPS_TABLE => 'group_id',
+ FORUMS_TABLE => 'forum_id',
+ GROUPS_TABLE => 'group_id',
+ ICONS_TABLE => 'icons_id',
+ LANG_TABLE => 'lang_id',
+ LOG_TABLE => 'log_id',
+ MODULES_TABLE => 'module_id',
+ POSTS_TABLE => 'post_id',
+ PRIVMSGS_TABLE => 'msg_id',
+ PRIVMSGS_FOLDER_TABLE => 'folder_id',
+ PRIVMSGS_RULES_TABLE => 'rule_id',
+ PROFILE_FIELDS_TABLE => 'field_id',
+ RANKS_TABLE => 'rank_id',
+ REPORTS_TABLE => 'report_id',
+ REPORTS_REASONS_TABLE => 'reason_id',
+ SEARCH_WORDLIST_TABLE => 'word_id',
+ SITELIST_TABLE => 'site_id',
+ SMILIES_TABLE => 'smiley_id',
+ STYLES_TABLE => 'style_id',
+ STYLES_TEMPLATE_TABLE => 'template_id',
+ STYLES_TEMPLATE_DATA_TABLE => 'template_id',
+ STYLES_THEME_TABLE => 'theme_id',
+ STYLES_IMAGESET_TABLE => 'imageset_id',
+ TOPICS_TABLE => 'topic_id',
+ USERS_TABLE => 'user_id',
+ WARNINGS_TABLE => 'warning_id',
+ WORDS_TABLE => 'word_id'
+ );
+ if (!empty($tables[$schema['target']]))
+ {
+ $db->sql_query("SELECT SETVAL('" . $schema['target'] . "_seq',(select case when max(" . $tables[$schema['target']] . ")>0 then max(" . $tables[$schema['target']] . ")+1 else 1 end from " . $schema['target'] . '));');
+ }
+ }
}
// When we reach this point, either the current table has been processed or we're running out of time.
From 458bd5b3cdec51fd64f4a4056cb419bbbc099907 Mon Sep 17 00:00:00 2001
From: Meik Sievertsen
Date: Wed, 7 Feb 2007 16:32:15 +0000
Subject: [PATCH 023/707] fix permission bug for added categories during
conversion as well as lowering the maximum execution limit.
git-svn-id: file:///svn/phpbb/trunk@6972 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/includes/functions_convert.php | 4 ++--
phpBB/install/convertors/functions_phpbb20.php | 15 +++++++++++++++
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/phpBB/includes/functions_convert.php b/phpBB/includes/functions_convert.php
index 64cb63de3a..01ca16d1e8 100644
--- a/phpBB/includes/functions_convert.php
+++ b/phpBB/includes/functions_convert.php
@@ -34,10 +34,10 @@ function still_on_time()
// If zero, then set to something higher to not let the user catch the ten seconds barrier.
if ($max_execution_time === 0)
{
- $max_execution_time = 250;
+ $max_execution_time = 65;
}
- $max_execution_time = min(max(10, ($max_execution_time - 15)), 250);
+ $max_execution_time = min(max(10, ($max_execution_time - 15)), 50);
// For debugging purposes
// $max_execution_time = 10;
diff --git a/phpBB/install/convertors/functions_phpbb20.php b/phpBB/install/convertors/functions_phpbb20.php
index 7610c4725d..eb660f84d0 100644
--- a/phpBB/install/convertors/functions_phpbb20.php
+++ b/phpBB/install/convertors/functions_phpbb20.php
@@ -900,6 +900,7 @@ function phpbb_convert_authentication($mode)
if ($row['parent_id'] == 0)
{
mass_auth('group_role', $row['forum_id'], 'administrators', 'FORUM_FULL');
+ mass_auth('group_role', $row['forum_id'], 'global_moderators', 'FORUM_FULL');
$parent_forums[] = $row;
}
else
@@ -936,6 +937,20 @@ function phpbb_convert_authentication($mode)
{
mass_auth('group', $row['forum_id'], 'guests', 'f_list', ACL_YES);
mass_auth('group', $row['forum_id'], 'registered', 'f_list', ACL_YES);
+ mass_auth('group', $row['forum_id'], 'registered_coppa', 'f_list', ACL_YES);
+ mass_auth('group', $row['forum_id'], 'bots', 'f_list', ACL_YES);
+ }
+ else
+ {
+ // Now make sure the user is able to read these forums
+ $hold_ary = $auth->acl_group_raw_data(get_group_id('registered'), 'f_list', $forum_ids);
+
+ if (!empty($hold_ary))
+ {
+ mass_auth('group', $row['forum_id'], 'registered', 'f_list', ACL_YES);
+ mass_auth('group', $row['forum_id'], 'registered_coppa', 'f_list', ACL_YES);
+ mass_auth('group', $row['forum_id'], 'bots', 'f_list', ACL_YES);
+ }
}
}
}
From 766e311ff35b486a2f01b1cb2cf4fef3df290825 Mon Sep 17 00:00:00 2001
From: Meik Sievertsen
Date: Wed, 7 Feb 2007 16:32:25 +0000
Subject: [PATCH 024/707] adjust text for getting image dimensions as well as
not suppressing warnings for getimagesize()
git-svn-id: file:///svn/phpbb/trunk@6973 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/includes/acp/acp_icons.php | 4 ++--
phpBB/includes/functions.php | 4 ++--
phpBB/includes/functions_posting.php | 4 ++--
phpBB/includes/functions_upload.php | 2 +-
phpBB/includes/functions_user.php | 2 +-
phpBB/includes/message_parser.php | 2 +-
phpBB/language/en/common.php | 3 ++-
7 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/phpBB/includes/acp/acp_icons.php b/phpBB/includes/acp/acp_icons.php
index bcdd8c71d8..994b8ee7f6 100644
--- a/phpBB/includes/acp/acp_icons.php
+++ b/phpBB/includes/acp/acp_icons.php
@@ -65,7 +65,7 @@ class acp_icons
{
foreach ($img_ary as $img)
{
- $img_size = @getimagesize($phpbb_root_path . $img_path . '/' . $path . $img);
+ $img_size = getimagesize($phpbb_root_path . $img_path . '/' . $path . $img);
if (!$img_size[0] || !$img_size[1] || strlen($img) > 255)
{
@@ -222,7 +222,7 @@ class acp_icons
{
if ($image_width[$image] == 0 || $image_height[$image] == 0)
{
- $img_size = @getimagesize($phpbb_root_path . $img_path . '/' . $image);
+ $img_size = getimagesize($phpbb_root_path . $img_path . '/' . $image);
$image_width[$image] = $img_size[0];
$image_height[$image] = $img_size[1];
}
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 4147e87556..7e1a7ac679 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -2619,7 +2619,7 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count,
{
if ($config['img_link_width'] || $config['img_link_height'])
{
- list($width, $height) = @getimagesize($filename);
+ list($width, $height) = getimagesize($filename);
$display_cat = (!$width && !$height) ? ATTACHMENT_CATEGORY_IMAGE : (($width <= $config['img_link_width'] && $height <= $config['img_link_height']) ? ATTACHMENT_CATEGORY_IMAGE : ATTACHMENT_CATEGORY_NONE);
}
@@ -2704,7 +2704,7 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count,
// Macromedia Flash Files
case ATTACHMENT_CATEGORY_FLASH:
- list($width, $height) = @getimagesize($filename);
+ list($width, $height) = getimagesize($filename);
$l_downloaded_viewed = $user->lang['VIEWED'];
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index d68aa9f645..f138802e40 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -358,7 +358,7 @@ function upload_attachment($form_name, $forum_id, $local = false, $local_storage
// If this error occurs a user tried to exploit an IE Bug by renaming extensions
// Since the image category is displaying content inline we need to catch this.
- trigger_error($user->lang['UNABLE_GET_IMAGE_SIZE']);
+ trigger_error($user->lang['ATTACHED_IMAGE_NOT_IMAGE']);
}
// Do we have to create a thumbnail?
@@ -552,7 +552,7 @@ function create_thumbnail($source, $destination, $mimetype)
return false;
}
- list($width, $height, $type, ) = @getimagesize($source);
+ list($width, $height, $type, ) = getimagesize($source);
if (!$width || !$height)
{
diff --git a/phpBB/includes/functions_upload.php b/phpBB/includes/functions_upload.php
index 489f3e942e..3f40a35bb2 100644
--- a/phpBB/includes/functions_upload.php
+++ b/phpBB/includes/functions_upload.php
@@ -313,7 +313,7 @@ class filespec
{
$this->width = $this->height = 0;
- if (($this->image_info = @getimagesize($this->destination_file)) !== false)
+ if (($this->image_info = getimagesize($this->destination_file)) !== false)
{
$this->width = $this->image_info[0];
$this->height = $this->image_info[1];
diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php
index 3ef03ece67..c78238b25f 100644
--- a/phpBB/includes/functions_user.php
+++ b/phpBB/includes/functions_user.php
@@ -1394,7 +1394,7 @@ function avatar_remote($data, &$error)
}
// Make sure getimagesize works...
- if (($image_data = @getimagesize($data['remotelink'])) === false)
+ if (($image_data = getimagesize($data['remotelink'])) === false)
{
$error[] = $user->lang['UNABLE_GET_IMAGE_SIZE'];
return false;
diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php
index e5e2240b6d..e2c0b37fe7 100644
--- a/phpBB/includes/message_parser.php
+++ b/phpBB/includes/message_parser.php
@@ -273,7 +273,7 @@ class bbcode_firstpass extends bbcode
if ($config['max_' . $this->mode . '_img_height'] || $config['max_' . $this->mode . '_img_width'])
{
- $stats = @getimagesize($in);
+ $stats = getimagesize($in);
if ($stats === false)
{
diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php
index 953a5c9644..c765f6d112 100644
--- a/phpBB/language/en/common.php
+++ b/phpBB/language/en/common.php
@@ -65,6 +65,7 @@ $lang = array_merge($lang, array(
'ARE_WATCHING_TOPIC' => 'You have subscribed to receive updates on this topic.',
'ASCENDING' => 'Ascending',
'ATTACHMENTS' => 'Attachments',
+ 'ATTACHED_IMAGE_NOT_IMAGE' => 'You tried to attach an invalid image file.',
'AUTHOR' => 'Author',
'AUTH_NO_PROFILE_CREATED' => 'Creating a user profile failed',
'AVATAR_DISALLOWED_EXTENSION' => 'The extension %s is not allowed',
@@ -559,7 +560,7 @@ $lang = array_merge($lang, array(
'TOTAL_USERS_ZERO' => 'Total members 0 ',
'TRACKED_PHP_ERROR' => 'Tracked PHP errors: %s',
- 'UNABLE_GET_IMAGE_SIZE' => 'Accessing the image was impossible or file isn’t a valid image.',
+ 'UNABLE_GET_IMAGE_SIZE' => 'It was not possible to determine the dimensions of the image.',
'UNABLE_TO_DELIVER_FILE'=> 'Unable to deliver file.',
'UNKNOWN_BROWSER' => 'Unknown browser',
'UNMARK_ALL' => 'Unmark all',
From 56a93bdfdddde618fe826c23c9151086f9540860 Mon Sep 17 00:00:00 2001
From: Nils Adermann
Date: Thu, 8 Feb 2007 22:11:14 +0000
Subject: [PATCH 025/707] - Pruning doesn't lower user post counts anymore [Bug
#7676] - Better resync explanations in ACP - relative link to board shouldn't
result in an empty link [Bug #7762] - allow spaces to define multiple classes
[Bug #7700] - forgot addslashes for password conversion [Bug #7530] -
adjusted get_post_data call in mcp_post to retrieve read tracking info [Bug
#7538] - fixed sorting in reports/queue by properly generating the pagination
links [Bug #7666] - send UTF-8 charset header in database_update.php [Bug
#7564]
git-svn-id: file:///svn/phpbb/trunk@6974 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/adm/style/acp_main.html | 46 ++++++++++++++++++++++---
phpBB/adm/style/admin.css | 1 +
phpBB/includes/acp/acp_main.php | 55 ++++++++++++++++++++++++------
phpBB/includes/acp/acp_styles.php | 5 ++-
phpBB/includes/auth/auth_db.php | 4 +--
phpBB/includes/functions.php | 2 +-
phpBB/includes/functions_admin.php | 12 +++----
phpBB/includes/mcp/mcp_queue.php | 2 +-
phpBB/includes/mcp/mcp_reports.php | 2 +-
phpBB/install/database_update.php | 2 ++
phpBB/language/en/acp/common.php | 42 ++++++++++++++---------
11 files changed, 129 insertions(+), 44 deletions(-)
diff --git a/phpBB/adm/style/acp_main.html b/phpBB/adm/style/acp_main.html
index 41d00a3b41..85a1c4a225 100644
--- a/phpBB/adm/style/acp_main.html
+++ b/phpBB/adm/style/acp_main.html
@@ -89,13 +89,49 @@
-
diff --git a/phpBB/adm/style/admin.css b/phpBB/adm/style/admin.css
index 3f655663a0..b081230ee2 100644
--- a/phpBB/adm/style/admin.css
+++ b/phpBB/adm/style/admin.css
@@ -637,6 +637,7 @@ dt label {
}
dd label {
+ font-size:100%;
white-space: nowrap;
margin: 0 10px 0 0;
}
diff --git a/phpBB/includes/acp/acp_main.php b/phpBB/includes/acp/acp_main.php
index bf958ba319..14f6571177 100644
--- a/phpBB/includes/acp/acp_main.php
+++ b/phpBB/includes/acp/acp_main.php
@@ -51,6 +51,46 @@ class acp_main
$action = request_var('action', '');
+ if ($action && !confirm_box(true))
+ {
+ switch ($action)
+ {
+ case 'online':
+ $confirm = true;
+ $confirm_lang = 'RESET_ONLINE_CONFIRM';
+ break;
+ case 'stats':
+ $confirm = true;
+ $confirm_lang = 'RESYNC_STATS_CONFIRM';
+ break;
+ case 'user':
+ $confirm = true;
+ $confirm_lang = 'RESYNC_POSTCOUNTS_CONFIRM';
+ break;
+ case 'date':
+ $confirm = true;
+ $confirm_lang = 'RESET_DATE_CONFIRM';
+ break;
+ case 'db_track':
+ $confirm = true;
+ $confirm_lang = 'RESYNC_POST_MARKING_CONFIRM';
+ break;
+
+ default:
+ $confirm = true;
+ $confirm_lang = 'CONFIRM_OPERATION';
+ }
+
+ if ($confirm)
+ {
+ confirm_box(false, $user->lang[$confirm_lang], build_hidden_fields(array(
+ 'i' => $id,
+ 'mode' => $mode,
+ 'action' => $action,
+ )));
+ }
+ }
+
switch ($action)
{
case 'online':
@@ -74,29 +114,23 @@ class acp_main
FROM ' . POSTS_TABLE . '
WHERE post_approved = 1';
$result = $db->sql_query($sql);
- $row = $db->sql_fetchrow($result);
+ set_config('num_posts', (int) $db->sql_fetchfield('stat'), true);
$db->sql_freeresult($result);
- set_config('num_posts', (int) $row['stat'], true);
-
$sql = 'SELECT COUNT(topic_id) AS stat
FROM ' . TOPICS_TABLE . '
WHERE topic_approved = 1';
$result = $db->sql_query($sql);
- $row = $db->sql_fetchrow($result);
+ set_config('num_topics', (int) $db->sql_fetchfield('stat'), true);
$db->sql_freeresult($result);
- set_config('num_topics', (int) $row['stat'], true);
-
$sql = 'SELECT COUNT(user_id) AS stat
FROM ' . USERS_TABLE . '
WHERE user_type IN (' . USER_NORMAL . ',' . USER_FOUNDER . ')';
$result = $db->sql_query($sql);
- $row = $db->sql_fetchrow($result);
+ set_config('num_users', (int) $db->sql_fetchfield('stat'), true);
$db->sql_freeresult($result);
- set_config('num_users', (int) $row['stat'], true);
-
$sql = 'SELECT COUNT(attach_id) as stat
FROM ' . ATTACHMENTS_TABLE . '
WHERE is_orphan = 0';
@@ -296,7 +330,6 @@ class acp_main
}
$dbsize = get_database_size();
- $s_action_options = build_select(array('online' => 'RESET_ONLINE', 'date' => 'RESET_DATE', 'stats' => 'RESYNC_STATS', 'user' => 'RESYNC_POSTCOUNTS', 'db_track' => 'RESYNC_POST_MARKING'));
$template->assign_vars(array(
'TOTAL_POSTS' => $total_posts,
@@ -320,7 +353,7 @@ class acp_main
'U_ADMIN_LOG' => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=logs&mode=admin'),
'U_INACTIVE_USERS' => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=inactive&mode=list'),
- 'S_ACTION_OPTIONS' => ($auth->acl_get('a_board')) ? $s_action_options : '',
+ 'S_ACTION_OPTIONS' => ($auth->acl_get('a_board')) ? true : false,
)
);
diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php
index ec69944f5e..2a7b993cd9 100644
--- a/phpBB/includes/acp/acp_styles.php
+++ b/phpBB/includes/acp/acp_styles.php
@@ -939,6 +939,9 @@ parse_css_file = {PARSE_CSS_FILE}
$add_custom = isset($_POST['add_custom']) ? true : false;
$matches = array();
+ // no curly brackets inside a CSS block please
+ $css_data = str_replace(array('{', '}'), '', $css_data);
+
// Retrieve some information about the theme
$sql = 'SELECT theme_storedb, theme_path, theme_name, theme_data
FROM ' . STYLES_THEME_TABLE . "
@@ -1266,7 +1269,7 @@ parse_css_file = {PARSE_CSS_FILE}
else
{
// check whether the custom class name is valid
- if (!preg_match('/^[a-z0-9\.,:#_\->*]+$/i', $custom_class))
+ if (!preg_match('/^[a-z0-9\.,:#_\ \t->*]+$/i', $custom_class))
{
trigger_error($user->lang['THEME_ERR_CLASS_CHARS'] . adm_back_link($this->u_action . "&action=edit&id=$theme_id&text_rows=$text_rows"), E_USER_WARNING);
}
diff --git a/phpBB/includes/auth/auth_db.php b/phpBB/includes/auth/auth_db.php
index 3be896cfd6..baf193ecdb 100644
--- a/phpBB/includes/auth/auth_db.php
+++ b/phpBB/includes/auth/auth_db.php
@@ -98,9 +98,9 @@ function login_db(&$username, &$password)
// If the password convert flag is set we need to convert it
if ($row['user_pass_convert'])
{
- // in phpBB2 passwords were used exactly as they were sent
+ // in phpBB2 passwords were used exactly as they were sent, with addslashes applied
$password_old_format = isset($_REQUEST['password']) ? (string) $_REQUEST['password'] : '';
- $password_old_format = (STRIP) ? stripslashes($password_old_format) : $password_old_format;
+ $password_old_format = (!STRIP) ? addslashes($password_old_format) : $password_old_format;
$password_new_format = '';
set_var($password_new_format, $password_old_format, 'string');
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 7e1a7ac679..8639df6ab0 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -2398,7 +2398,7 @@ function make_clickable($text, $server_url = false)
// relative urls for this board
$magic_url_match[] = '#(^|[\n\t (])(' . preg_quote($server_url, '#') . ')/(' . get_preg_expression('relative_url_inline') . ')#ie';
- $magic_url_replace[] = "'\$1' . preg_replace('/(&|\?)sid=[0-9a-f]{32}/', '\\\\1', '\$3') . ' '";
+ $magic_url_replace[] = "'\$1' . ((strlen('\$3')) ? preg_replace('/(&|\?)sid=[0-9a-f]{32}/', '\\\\1', '\$3') : '\$2/') . ' '";
// matches a xxxx://aaaaa.bbb.cccc. ...
$magic_url_match[] = '#(^|[\n\t (])(' . get_preg_expression('url_inline') . ')#ie';
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php
index e0b7b8a554..f319873e2c 100644
--- a/phpBB/includes/functions_admin.php
+++ b/phpBB/includes/functions_admin.php
@@ -495,7 +495,7 @@ function move_posts($post_ids, $topic_id, $auto_sync = true)
/**
* Remove topic(s)
*/
-function delete_topics($where_type, $where_ids, $auto_sync = true)
+function delete_topics($where_type, $where_ids, $auto_sync = true, $post_count_sync = true)
{
global $db, $config;
@@ -517,7 +517,7 @@ function delete_topics($where_type, $where_ids, $auto_sync = true)
}
$return = array(
- 'posts' => delete_posts($where_type, $where_ids, false, true)
+ 'posts' => delete_posts($where_type, $where_ids, false, true, $post_count_sync)
);
$sql = 'SELECT topic_id, forum_id, topic_approved
@@ -579,7 +579,7 @@ function delete_topics($where_type, $where_ids, $auto_sync = true)
/**
* Remove post(s)
*/
-function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync = true)
+function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync = true, $post_count_sync = true)
{
global $db, $config, $phpbb_root_path, $phpEx;
@@ -612,7 +612,7 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync =
$topic_ids[] = $row['topic_id'];
$forum_ids[] = $row['forum_id'];
- if ($row['post_postcount'])
+ if ($row['post_postcount'] && $post_count_sync)
{
$post_counts[$row['poster_id']] = (!empty($post_counts[$row['poster_id']])) ? $post_counts[$row['poster_id']] + 1 : 1;
}
@@ -642,7 +642,7 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync =
unset($table_ary);
// Adjust users post counts
- if (sizeof($post_counts))
+ if (sizeof($post_counts) && $post_count_sync)
{
foreach ($post_counts as $poster_id => $substract)
{
@@ -1896,7 +1896,7 @@ function prune($forum_id, $prune_mode, $prune_date, $prune_flags = 0, $auto_sync
$topic_list = array_unique($topic_list);
}
- return delete_topics('topic_id', $topic_list, $auto_sync);
+ return delete_topics('topic_id', $topic_list, $auto_sync, false);
}
/**
diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php
index 6378295191..6733a73a7e 100644
--- a/phpBB/includes/mcp/mcp_queue.php
+++ b/phpBB/includes/mcp/mcp_queue.php
@@ -379,7 +379,7 @@ class mcp_queue
'S_MCP_ACTION' => build_url(array('t', 'f', 'sd', 'st', 'sk')),
'S_TOPICS' => ($mode == 'unapproved_posts') ? false : true,
- 'PAGINATION' => generate_pagination($this->u_action . "&f=$forum_id", $total, $config['topics_per_page'], $start),
+ 'PAGINATION' => generate_pagination($this->u_action . "&f=$forum_id&st=$sort_days&sk=$sort_key&sd=$sort_dir", $total, $config['topics_per_page'], $start),
'PAGE_NUMBER' => on_page($total, $config['topics_per_page'], $start),
'TOPIC_ID' => $topic_id,
'TOTAL' => $total)
diff --git a/phpBB/includes/mcp/mcp_reports.php b/phpBB/includes/mcp/mcp_reports.php
index a57dadb301..a4cd1dd5d1 100755
--- a/phpBB/includes/mcp/mcp_reports.php
+++ b/phpBB/includes/mcp/mcp_reports.php
@@ -353,7 +353,7 @@ class mcp_reports
'S_FORUM_OPTIONS' => $forum_options,
'S_CLOSED' => ($mode == 'reports_closed') ? true : false,
- 'PAGINATION' => generate_pagination($this->u_action . "&f=$forum_id&t=$topic_id", $total, $config['topics_per_page'], $start),
+ 'PAGINATION' => generate_pagination($this->u_action . "&f=$forum_id&t=$topic_id&st=$sort_days&sk=$sort_key&sd=$sort_dir", $total, $config['topics_per_page'], $start),
'PAGE_NUMBER' => on_page($total, $config['topics_per_page'], $start),
'TOPIC_ID' => $topic_id,
'TOTAL' => $total,
diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php
index 0e4b0381f0..2d19b46245 100644
--- a/phpBB/install/database_update.php
+++ b/phpBB/install/database_update.php
@@ -378,6 +378,8 @@ switch ($db->sql_layer)
$error_ary = array();
$errored = false;
+header('Content-type: text/html; charset=UTF-8');
+
?>
diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php
index a35e239a81..27e0e7afa3 100644
--- a/phpBB/language/en/acp/common.php
+++ b/phpBB/language/en/acp/common.php
@@ -317,13 +317,23 @@ $lang = array_merge($lang, array(
'POSTS_PER_DAY' => 'Posts per day',
- 'RESET_DATE' => 'Reset date',
- 'RESET_ONLINE' => 'Reset online',
- 'RESYNC_POSTCOUNTS' => 'Resynchronise post counts',
- 'RESYNC_POST_MARKING' => 'Resynchronise dotted topics',
- 'RESYNC_STATS' => 'Resynchronise statistics',
+ 'RESET_DATE' => 'Reset board’s start date',
+ 'RESET_DATE_CONFIRM' => 'Are you sure you wish to reset the board’s start date?',
+ 'RESET_ONLINE' => 'Reset most users ever online',
+ 'RESET_ONLINE_CONFIRM' => 'Are you sure you wish to reset the most users ever online counter?',
+ 'RESYNC_POSTCOUNTS' => 'Resynchronise post counts',
+ 'RESYNC_POSTCOUNTS_EXPLAIN' => 'Only existing posts will be taken into consideration. Pruned posts will not be counted.',
+ 'RESYNC_POSTCOUNTS_CONFIRM' => 'Are you sure you wish to resynchronise post counts?',
+ 'RESYNC_POST_MARKING' => 'Resynchronise dotted topics',
+ 'RESYNC_POST_MARKING_CONFIRM' => 'Are you sure you wish to resynchronise dotted topics?',
+ 'RESYNC_POST_MARKING_EXPLAIN' => 'First unmarks all topics and then correctly marks topics that have seen any activity during the past six months',
+ 'RESYNC_STATS' => 'Resynchronise statistics',
+ 'RESYNC_STATS_CONFIRM' => 'Are you sure you wish to resynchronise statistics?',
+ 'RESYNC_STATS_EXPLAIN' => 'Recalculates the total number of posts, topics, users and files.',
+ 'RUN' => 'Run now',
- 'STATISTIC' => 'Statistic',
+ 'STATISTIC' => 'Statistic',
+ 'STATISTIC_RESYNC_OPTIONS' => 'Resynchronise or reset statistics',
'TOPICS_PER_DAY' => 'Topics per day',
@@ -362,20 +372,20 @@ $lang = array_merge($lang, array(
// Log Entries
$lang = array_merge($lang, array(
- 'LOG_ACL_ADD_USER_GLOBAL_U_' => 'Added or edited users user permissions » %s',
- 'LOG_ACL_ADD_GROUP_GLOBAL_U_' => 'Added or edited groups user permissions » %s',
- 'LOG_ACL_ADD_USER_GLOBAL_M_' => 'Added or edited users global moderator permissions » %s',
- 'LOG_ACL_ADD_GROUP_GLOBAL_M_' => 'Added or edited groups global moderator permissions » %s',
- 'LOG_ACL_ADD_USER_GLOBAL_A_' => 'Added or edited users administrator permissions » %s',
- 'LOG_ACL_ADD_GROUP_GLOBAL_A_' => 'Added or edited groups administrator permissions » %s',
+ 'LOG_ACL_ADD_USER_GLOBAL_U_' => 'Added or edited users’ user permissions » %s',
+ 'LOG_ACL_ADD_GROUP_GLOBAL_U_' => 'Added or edited groups’ user permissions » %s',
+ 'LOG_ACL_ADD_USER_GLOBAL_M_' => 'Added or edited users’ global moderator permissions » %s',
+ 'LOG_ACL_ADD_GROUP_GLOBAL_M_' => 'Added or edited groups’ global moderator permissions » %s',
+ 'LOG_ACL_ADD_USER_GLOBAL_A_' => 'Added or edited users’ administrator permissions » %s',
+ 'LOG_ACL_ADD_GROUP_GLOBAL_A_' => 'Added or edited groups’ administrator permissions » %s',
'LOG_ACL_ADD_ADMIN_GLOBAL_A_' => 'Added or edited Administrators » %s',
'LOG_ACL_ADD_MOD_GLOBAL_M_' => 'Added or edited Global Moderators » %s',
- 'LOG_ACL_ADD_USER_LOCAL_F_' => 'Added or edited users forum access from %1$s » %2$s',
- 'LOG_ACL_ADD_USER_LOCAL_M_' => 'Added or edited users forum moderator access from %1$s » %2$s',
- 'LOG_ACL_ADD_GROUP_LOCAL_F_' => 'Added or edited groups forum access from %1$s » %2$s',
- 'LOG_ACL_ADD_GROUP_LOCAL_M_' => 'Added or edited groups forum moderator access from %1$s » %2$s',
+ 'LOG_ACL_ADD_USER_LOCAL_F_' => 'Added or edited users’ forum access from %1$s » %2$s',
+ 'LOG_ACL_ADD_USER_LOCAL_M_' => 'Added or edited users’ forum moderator access from %1$s » %2$s',
+ 'LOG_ACL_ADD_GROUP_LOCAL_F_' => 'Added or edited groups’ forum access from %1$s » %2$s',
+ 'LOG_ACL_ADD_GROUP_LOCAL_M_' => 'Added or edited groups’ forum moderator access from %1$s » %2$s',
'LOG_ACL_ADD_MOD_LOCAL_M_' => 'Added or edited Moderators from %1$s » %2$s',
'LOG_ACL_ADD_FORUM_LOCAL_F_' => 'Added or edited forum permissions from %1$s » %2$s',
From 7216ffe8be85a58eedb4f1e7fe2278a89110be9d Mon Sep 17 00:00:00 2001
From: Meik Sievertsen
Date: Fri, 9 Feb 2007 14:24:34 +0000
Subject: [PATCH 026/707] some fixes to be committed.
git-svn-id: file:///svn/phpbb/trunk@6975 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/adm/style/install_update.html | 4 ++--
phpBB/includes/acp/acp_prune.php | 8 +++++++-
phpBB/includes/functions_convert.php | 27 +++++++--------------------
phpBB/includes/functions_upload.php | 15 ++++++++++++++-
phpBB/includes/session.php | 2 +-
phpBB/install/install_convert.php | 7 +++++--
phpBB/language/en/acp/prune.php | 2 ++
phpBB/language/en/common.php | 1 +
phpBB/memberlist.php | 20 +++++++++++++++-----
9 files changed, 54 insertions(+), 32 deletions(-)
diff --git a/phpBB/adm/style/install_update.html b/phpBB/adm/style/install_update.html
index a948ceb3fc..c393352edf 100644
--- a/phpBB/adm/style/install_update.html
+++ b/phpBB/adm/style/install_update.html
@@ -193,11 +193,11 @@
{L_MERGE_NO_MERGE_NEW_OPTION}
- [{L_SHOW_DIFF_FINAL} ]
+ [{L_SHOW_DIFF_FINAL} ]
{L_MERGE_NO_MERGE_MOD_OPTION}
- [{L_SHOW_DIFF_FINAL} ]
+ [{L_SHOW_DIFF_FINAL} ]
diff --git a/phpBB/includes/acp/acp_prune.php b/phpBB/includes/acp/acp_prune.php
index 851671e36d..9e680e4714 100644
--- a/phpBB/includes/acp/acp_prune.php
+++ b/phpBB/includes/acp/acp_prune.php
@@ -219,6 +219,11 @@ class acp_prune
$active = ($active) ? explode('-', $active) : array();
$joined = ($joined) ? explode('-', $joined) : array();
+ if ((sizeof($active) && sizeof($active) != 3) || (sizeof($joined) && sizeof($joined) != 3))
+ {
+ trigger_error($user->lang['WRONG_ACTIVE_JOINED_DATE'] . adm_back_link($this->u_action), E_USER_WARNING);
+ }
+
$count = request_var('count', 0);
$key_match = array('lt' => '<', 'gt' => '>', 'eq' => '=');
@@ -257,7 +262,8 @@ class acp_prune
while ($row = $db->sql_fetchrow($result))
{
- if (!in_array($row['user_id'], $bot_ids))
+ // Do not prune bots and the user currently pruning.
+ if ($row['user_id'] != $user->data['user_id'] && !in_array($row['user_id'], $bot_ids))
{
$user_ids[] = $row['user_id'];
$usernames[$row['user_id']] = $row['username'];
diff --git a/phpBB/includes/functions_convert.php b/phpBB/includes/functions_convert.php
index 01ca16d1e8..a0b8740a7d 100644
--- a/phpBB/includes/functions_convert.php
+++ b/phpBB/includes/functions_convert.php
@@ -34,10 +34,10 @@ function still_on_time()
// If zero, then set to something higher to not let the user catch the ten seconds barrier.
if ($max_execution_time === 0)
{
- $max_execution_time = 65;
+ $max_execution_time = 250;
}
- $max_execution_time = min(max(10, ($max_execution_time - 15)), 50);
+ $max_execution_time = min(max(10, ($max_execution_time - 15)), 250);
// For debugging purposes
// $max_execution_time = 10;
@@ -439,7 +439,8 @@ function import_avatar_gallery($gallery_name = '', $subdirs_as_galleries = false
if (is_dir($src_path))
{
- copy_dir($convert->convertor['avatar_gallery_path'], path($config['avatar_gallery_path']) . $gallery_name, !$subdirs_as_galleries, false, true, $relative_path);
+ // Do not die on failure... safe mode restrictions may be in effect.
+ copy_dir($convert->convertor['avatar_gallery_path'], path($config['avatar_gallery_path']) . $gallery_name, !$subdirs_as_galleries, false, false, $relative_path);
// only doing 1 level deep. (ibf 1.x)
// notes: ibf has 2 tiers: directly in the avatar directory for base gallery (handled in the above statement), plus subdirs(handled below).
@@ -483,7 +484,9 @@ function import_avatar_gallery($gallery_name = '', $subdirs_as_galleries = false
for ($i = 0; $i < sizeof($dirlist); ++$i)
{
$dir = $dirlist[$i];
- copy_dir(path($convert->convertor['avatar_gallery_path'], $relative_path) . $dir, path($config['avatar_gallery_path']) . $dir, true, false, true, $relative_path);
+
+ // Do not die on failure... safe mode restrictions may be in effect.
+ copy_dir(path($convert->convertor['avatar_gallery_path'], $relative_path) . $dir, path($config['avatar_gallery_path']) . $dir, true, false, false, $relative_path);
}
}
}
@@ -1927,22 +1930,6 @@ function fix_empty_primary_groups()
$db->sql_query('UPDATE ' . USERS_TABLE . ' SET group_id = ' . get_group_id('guests') . ' WHERE user_id = ' . ANONYMOUS);
- $sql = 'SELECT ban_userid as user_id FROM ' . BANLIST_TABLE . ' WHERE ban_userid > 0';
- $result = $db->sql_query($sql);
-
- $user_ids = array();
- while ($row = $db->sql_fetchrow($result))
- {
- $user_ids[] = $row['user_id'];
- }
- $db->sql_freeresult($result);
-
- if (sizeof($user_ids))
- {
- $db->sql_query('UPDATE ' . USERS_TABLE . ' SET user_type = ' . USER_IGNORE . '
- WHERE user_id IN (' . implode(',', $user_ids) . ')');
- }
-
$sql = 'SELECT user_id FROM ' . USER_GROUP_TABLE . ' WHERE group_id = ' . get_group_id('administrators');
$result = $db->sql_query($sql);
diff --git a/phpBB/includes/functions_upload.php b/phpBB/includes/functions_upload.php
index 3f40a35bb2..1dd40f3f1c 100644
--- a/phpBB/includes/functions_upload.php
+++ b/phpBB/includes/functions_upload.php
@@ -561,7 +561,20 @@ class fileupload
{
$_FILES[$form_name]['name'] = basename($source_file);
$_FILES[$form_name]['size'] = 0;
- $_FILES[$form_name]['type'] = '';
+ $mimetype = '';
+
+ if (function_exists('mime_content_type'))
+ {
+ $mimetype = mime_content_type($filename);
+ }
+
+ // Some browsers choke on a mimetype of application/octet-stream
+ if (!$mimetype || $mimetype == 'application/octet-stream')
+ {
+ $mimetype = 'application/octetstream';
+ }
+
+ $_FILES[$form_name]['type'] = $mimetype;
}
else
{
diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php
index 9121a965fd..71e83fbd11 100644
--- a/phpBB/includes/session.php
+++ b/phpBB/includes/session.php
@@ -1440,7 +1440,7 @@ class user extends session
if (!$this->lang_path)
{
global $phpbb_root_path, $config;
-
+
$this->lang_path = $phpbb_root_path . 'language/' . $config['default_lang'] . '/';
}
diff --git a/phpBB/install/install_convert.php b/phpBB/install/install_convert.php
index fbca8913c1..4636bbeecc 100644
--- a/phpBB/install/install_convert.php
+++ b/phpBB/install/install_convert.php
@@ -1845,8 +1845,11 @@ class install_convert extends module
if ($convert->options['refresh'])
{
- $template->assign_var('S_REFRESH', true);
- meta_refresh(5, $url);
+ // Because we should not rely on correct settings, we simply use the relative path here directly.
+ $template->assign_vars(array(
+ 'S_REFRESH' => true,
+ 'META' => ' ')
+ );
}
}
diff --git a/phpBB/language/en/acp/prune.php b/phpBB/language/en/acp/prune.php
index 9c23848623..aec44a86c9 100644
--- a/phpBB/language/en/acp/prune.php
+++ b/phpBB/language/en/acp/prune.php
@@ -48,6 +48,8 @@ $lang = array_merge($lang, array(
'USER_DEACTIVATE_SUCCESS' => 'The selected users have been deactivated successfully.',
'USER_DELETE_SUCCESS' => 'The selected users have been deleted successfully.',
+
+ 'WRONG_ACTIVE_JOINED_DATE' => 'The date entered is wrong, it is expected in YYYY-MM-DD format.',
));
// Forum Pruning
diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php
index c765f6d112..d4fd7bd4af 100644
--- a/phpBB/language/en/common.php
+++ b/phpBB/language/en/common.php
@@ -346,6 +346,7 @@ $lang = array_merge($lang, array(
'NO_ONLINE_USERS' => 'No registered users',
'NO_POSTS' => 'No posts',
'NO_POSTS_TIME_FRAME' => 'No posts exist inside this topic for the selected time frame.',
+ 'NO_SUBJECT' => 'No subject specified',
'NO_SUCH_SEARCH_MODULE' => 'The specified search backend doesn’t exist',
'NO_SUPPORTED_AUTH_METHODS' => 'No supported authentication methods',
'NO_TOPIC' => 'The requested topic does not exist.',
diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php
index e759d9af4f..3d8c2bf767 100644
--- a/phpBB/memberlist.php
+++ b/phpBB/memberlist.php
@@ -74,14 +74,21 @@ switch ($mode)
$user_ary = $auth->acl_get_list(false, array('a_', 'm_'), false);
- $admin_id_ary = $mod_id_ary = $forum_id_ary = array();
+ $admin_id_ary = $global_mod_id_ary = $mod_id_ary = $forum_id_ary = array();
foreach ($user_ary as $forum_id => $forum_ary)
{
foreach ($forum_ary as $auth_option => $id_ary)
{
- if (!$forum_id && $auth_option == 'a_')
+ if (!$forum_id)
{
- $admin_id_ary = array_merge($admin_id_ary, $id_ary);
+ if ($auth_option == 'a_')
+ {
+ $admin_id_ary = array_merge($admin_id_ary, $id_ary);
+ }
+ else
+ {
+ $global_mod_id_ary = array_merge($global_mod_id_ary, $id_ary);
+ }
continue;
}
else
@@ -100,6 +107,9 @@ switch ($mode)
}
$admin_id_ary = array_unique($admin_id_ary);
+ $global_mod_id_ary = array_unique($global_mod_id_ary);
+
+ $mod_id_ary = array_merge($mod_id_ary, $global_mod_id_ary);
$mod_id_ary = array_unique($mod_id_ary);
// Admin group id...
@@ -158,7 +168,7 @@ switch ($mode)
// Remove from admin_id_ary, because the user may be a mod instead
unset($admin_id_ary[array_search($row['user_id'], $admin_id_ary)]);
- if (!in_array($row['user_id'], $mod_id_ary))
+ if (!in_array($row['user_id'], $mod_id_ary) && !in_array($row['user_id'], $global_mod_id_ary))
{
continue;
}
@@ -171,7 +181,7 @@ switch ($mode)
$s_forum_select = '';
$undisclosed_forum = false;
- if (isset($forum_id_ary[$row['user_id']]))
+ if (isset($forum_id_ary[$row['user_id']]) && !in_array($row['user_id'], $global_mod_id_ary))
{
if ($which_row == 'mod' && sizeof(array_diff(array_keys($forums), $forum_id_ary[$row['user_id']])))
{
From ffb28e03aefcd6ae88ef68448cd7b313c1c77722 Mon Sep 17 00:00:00 2001
From: Meik Sievertsen
Date: Fri, 9 Feb 2007 14:28:40 +0000
Subject: [PATCH 027/707] grrr
git-svn-id: file:///svn/phpbb/trunk@6976 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/includes/functions_convert.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/phpBB/includes/functions_convert.php b/phpBB/includes/functions_convert.php
index a0b8740a7d..ee97dcb3ab 100644
--- a/phpBB/includes/functions_convert.php
+++ b/phpBB/includes/functions_convert.php
@@ -34,10 +34,10 @@ function still_on_time()
// If zero, then set to something higher to not let the user catch the ten seconds barrier.
if ($max_execution_time === 0)
{
- $max_execution_time = 250;
+ $max_execution_time = 65;
}
- $max_execution_time = min(max(10, ($max_execution_time - 15)), 250);
+ $max_execution_time = min(max(10, ($max_execution_time - 15)), 50);
// For debugging purposes
// $max_execution_time = 10;
From 5e3afe73ecfbae4e9b2e134e8e617f843da5be90 Mon Sep 17 00:00:00 2001
From: Meik Sievertsen
Date: Fri, 9 Feb 2007 14:31:17 +0000
Subject: [PATCH 028/707] those were missing
git-svn-id: file:///svn/phpbb/trunk@6977 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/includes/functions_messenger.php | 4 ++--
phpBB/includes/functions_posting.php | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php
index 755a6d9116..d63a31ffb5 100644
--- a/phpBB/includes/functions_messenger.php
+++ b/phpBB/includes/functions_messenger.php
@@ -209,12 +209,12 @@ class messenger
$match = array();
if (preg_match('#^(Subject:(.*?))$#m', $this->msg, $match))
{
- $this->subject = (trim($match[2]) != '') ? trim($match[2]) : (($this->subject != '') ? $this->subject : $user->lang['NO_SUBJECT']);
+ $this->subject = (trim($match[2]) != '') ? trim($match[2]) : (($this->subject != '') ? $this->subject : $user->lang['NO_EMAIL_SUBJECT']);
$drop_header .= '[\r\n]*?' . preg_quote($match[1], '#');
}
else
{
- $this->subject = (($this->subject != '') ? $this->subject : $user->lang['NO_SUBJECT']);
+ $this->subject = (($this->subject != '') ? $this->subject : $user->lang['NO_EMAIL_SUBJECT']);
}
if ($drop_header)
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index f138802e40..eb03143aa1 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -311,7 +311,7 @@ function posting_gen_topic_types($forum_id, $cur_topic_type = POST_NORMAL)
* Upload Attachment - filedata is generated here
* Uses upload class
*/
-function upload_attachment($form_name, $forum_id, $local = false, $local_storage = '', $is_message = false)
+function upload_attachment($form_name, $forum_id, $local = false, $local_storage = '', $is_message = false, $local_filedata = false)
{
global $auth, $user, $config, $db, $cache;
global $phpbb_root_path, $phpEx;
@@ -341,7 +341,7 @@ function upload_attachment($form_name, $forum_id, $local = false, $local_storage
$extensions = $cache->obtain_attach_extensions((($is_message) ? false : (int) $forum_id));
$upload->set_allowed_extensions(array_keys($extensions['_allowed_']));
- $file = ($local) ? $upload->local_upload($local_storage) : $upload->form_upload($form_name);
+ $file = ($local) ? $upload->local_upload($local_storage, $local_filedata) : $upload->form_upload($form_name);
if ($file->init_error)
{
From 3062c3643df8b10dae9abf1165f1a4b8d1bbafe2 Mon Sep 17 00:00:00 2001
From: Jonathan Stanley
Date: Fri, 9 Feb 2007 20:48:08 +0000
Subject: [PATCH 029/707] Missed:
.pagination span.page-sep {
display:none;
}
... for the ACP ^o^;
git-svn-id: file:///svn/phpbb/trunk@6978 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/adm/style/admin.css | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/phpBB/adm/style/admin.css b/phpBB/adm/style/admin.css
index b081230ee2..8e6df68b41 100644
--- a/phpBB/adm/style/admin.css
+++ b/phpBB/adm/style/admin.css
@@ -820,6 +820,10 @@ input.autowidth { width: auto !important;}
font-weight: normal;
}
+.pagination span.page-sep {
+ display:none;
+}
+
.pagination span strong {
padding: 0 2px;
margin: 0 2px;
From b8b1aa812b2713a7b261c94cde7e5af426086ce2 Mon Sep 17 00:00:00 2001
From: Jonathan Stanley
Date: Sat, 10 Feb 2007 01:55:53 +0000
Subject: [PATCH 030/707] #6872
Missed this one... suprised no one complained about warnings or whatever.
git-svn-id: file:///svn/phpbb/trunk@6979 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/adm/index.php | 3 ---
1 file changed, 3 deletions(-)
diff --git a/phpBB/adm/index.php b/phpBB/adm/index.php
index e441b9ff7f..5cee30b4c2 100644
--- a/phpBB/adm/index.php
+++ b/phpBB/adm/index.php
@@ -63,9 +63,6 @@ $template->assign_var('T_TEMPLATE_PATH', $phpbb_admin_path . 'style');
// the acp template is never stored in the database
$user->theme['template_storedb'] = false;
-// Force pagination seperation for admin style
-$user->theme['pagination_sep'] = '';
-
// Instantiate new module
$module = new p_master();
From f885fc36ae05d5fea595e9beb34beea0ad4bae18 Mon Sep 17 00:00:00 2001
From: David M
Date: Sat, 10 Feb 2007 06:41:38 +0000
Subject: [PATCH 031/707] - reimplemented autoincrement support in the
convertor, made it more generic #7528
git-svn-id: file:///svn/phpbb/trunk@6980 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/install/convertors/convert_phpbb20.php | 13 +++
phpBB/install/install_convert.php | 106 +++++--------------
2 files changed, 39 insertions(+), 80 deletions(-)
diff --git a/phpBB/install/convertors/convert_phpbb20.php b/phpBB/install/convertors/convert_phpbb20.php
index fac58a7d7d..6c55a42440 100644
--- a/phpBB/install/convertors/convert_phpbb20.php
+++ b/phpBB/install/convertors/convert_phpbb20.php
@@ -314,6 +314,7 @@ if (!$get_info)
'target' => (defined('MOD_ATTACHMENT')) ? ATTACHMENTS_TABLE : '',
'primary' => 'attachments.attach_id',
'query_first' => (defined('MOD_ATTACHMENT')) ? $convert->truncate_statement . ATTACHMENTS_TABLE : '',
+ 'autoincrement' => 'attach_id',
array('attach_id', 'attachments.attach_id', ''),
array('post_msg_id', 'attachments.post_id', ''),
@@ -338,6 +339,7 @@ if (!$get_info)
array(
'target' => (defined('MOD_ATTACHMENT')) ? ATTACHMENTS_TABLE : '',
'primary' => 'attachments.attach_id',
+ 'autoincrement' => 'attach_id',
array('attach_id', 'attachments.attach_id', ''),
array('post_msg_id', 'attachments.privmsgs_id', ''),
@@ -362,6 +364,7 @@ if (!$get_info)
array(
'target' => (defined('MOD_ATTACHMENT')) ? EXTENSIONS_TABLE : '',
'query_first' => (defined('MOD_ATTACHMENT')) ? $convert->truncate_statement . EXTENSIONS_TABLE : '',
+ 'autoincrement' => 'extension_id',
array('extension_id', 'extensions.ext_id', ''),
array('group_id', 'extensions.group_id', ''),
@@ -371,6 +374,7 @@ if (!$get_info)
array(
'target' => (defined('MOD_ATTACHMENT')) ? EXTENSION_GROUPS_TABLE : '',
'query_first' => (defined('MOD_ATTACHMENT')) ? $convert->truncate_statement . EXTENSION_GROUPS_TABLE : '',
+ 'autoincrement' => 'group_id',
array('group_id', 'extension_groups.group_id', ''),
array('group_name', 'extension_groups.group_name', array('function1' => 'phpbb_set_encoding', 'function2' => 'utf8_htmlspecialchars')),
@@ -414,6 +418,7 @@ if (!$get_info)
array(
'target' => RANKS_TABLE,
'query_first' => $convert->truncate_statement . RANKS_TABLE,
+ 'autoincrement' => 'rank_id',
array('rank_id', 'ranks.rank_id', ''),
array('rank_title', 'ranks.rank_title', array('function1' => 'phpbb_set_encoding', 'function2' => 'utf8_htmlspecialchars')),
@@ -426,6 +431,7 @@ if (!$get_info)
'target' => TOPICS_TABLE,
'query_first' => $convert->truncate_statement . TOPICS_TABLE,
'primary' => 'topics.topic_id',
+ 'autoincrement' => 'topic_id',
array('topic_id', 'topics.topic_id', ''),
array('forum_id', 'topics.forum_id', ''),
@@ -456,6 +462,7 @@ if (!$get_info)
array(
'target' => TOPICS_TABLE,
'primary' => 'topics.topic_id',
+ 'autoincrement' => 'topic_id',
array('topic_id', 'topics.topic_id', ''),
array('forum_id', 'topics.forum_id', ''),
@@ -496,6 +503,7 @@ if (!$get_info)
array(
'target' => SMILIES_TABLE,
'query_first' => $convert->truncate_statement . SMILIES_TABLE,
+ 'autoincrement' => 'smiley_id',
array('smiley_id', 'smilies.smilies_id', ''),
array('code', 'smilies.code', 'phpbb_set_encoding'),
@@ -543,6 +551,7 @@ if (!$get_info)
'target' => WORDS_TABLE,
'primary' => 'words.word_id',
'query_first' => $convert->truncate_statement . WORDS_TABLE,
+ 'autoincrement' => 'word_id',
array('word_id', 'words.word_id', ''),
array('word', 'words.word', 'phpbb_set_encoding'),
@@ -552,6 +561,7 @@ if (!$get_info)
array(
'target' => POSTS_TABLE,
'primary' => 'posts.post_id',
+ 'autoincrement' => 'post_id',
'query_first' => $convert->truncate_statement . POSTS_TABLE,
'execute_first' => '
$config["max_post_chars"] = 0;
@@ -595,6 +605,7 @@ if (!$get_info)
array(
'target' => PRIVMSGS_TABLE,
'primary' => 'privmsgs.privmsgs_id',
+ 'autoincrement' => 'privmsgs_id',
'query_first' => array(
$convert->truncate_statement . PRIVMSGS_TABLE,
$convert->truncate_statement . PRIVMSGS_RULES_TABLE,
@@ -741,6 +752,7 @@ if (!$get_info)
array(
'target' => GROUPS_TABLE,
+ 'autoincrement' => 'group_id',
'query_first' => $convert->truncate_statement . GROUPS_TABLE,
array('group_id', 'groups.group_id', ''),
@@ -781,6 +793,7 @@ if (!$get_info)
array(
'target' => USERS_TABLE,
'primary' => 'users.user_id',
+ 'autoincrement' => 'user_id',
'query_first' => array(
'DELETE FROM ' . USERS_TABLE . ' WHERE user_id <> ' . ANONYMOUS,
$convert->truncate_statement . BOTS_TABLE
diff --git a/phpBB/install/install_convert.php b/phpBB/install/install_convert.php
index 4636bbeecc..0d1fec4a1c 100644
--- a/phpBB/install/install_convert.php
+++ b/phpBB/install/install_convert.php
@@ -910,48 +910,13 @@ class install_convert extends module
}
}
- if ($db->sql_layer === 'postgres')
+ if (!empty($schema['autoincrement']))
{
- $tables = array(
- ATTACHMENTS_TABLE => 'attach_id',
- ACL_OPTIONS_TABLE => 'auth_option_id',
- ACL_ROLES_TABLE => 'role_id',
- BANLIST_TABLE => 'ban_id',
- BOTS_TABLE => 'bot_id',
- DISALLOW_TABLE => 'disallow_id',
- DRAFTS_TABLE => 'draft_id',
- EXTENSIONS_TABLE => 'extension_id',
- EXTENSION_GROUPS_TABLE => 'group_id',
- FORUMS_TABLE => 'forum_id',
- GROUPS_TABLE => 'group_id',
- ICONS_TABLE => 'icons_id',
- LANG_TABLE => 'lang_id',
- LOG_TABLE => 'log_id',
- MODULES_TABLE => 'module_id',
- POSTS_TABLE => 'post_id',
- PRIVMSGS_TABLE => 'msg_id',
- PRIVMSGS_FOLDER_TABLE => 'folder_id',
- PRIVMSGS_RULES_TABLE => 'rule_id',
- PROFILE_FIELDS_TABLE => 'field_id',
- RANKS_TABLE => 'rank_id',
- REPORTS_TABLE => 'report_id',
- REPORTS_REASONS_TABLE => 'reason_id',
- SEARCH_WORDLIST_TABLE => 'word_id',
- SITELIST_TABLE => 'site_id',
- SMILIES_TABLE => 'smiley_id',
- STYLES_TABLE => 'style_id',
- STYLES_TEMPLATE_TABLE => 'template_id',
- STYLES_TEMPLATE_DATA_TABLE => 'template_id',
- STYLES_THEME_TABLE => 'theme_id',
- STYLES_IMAGESET_TABLE => 'imageset_id',
- TOPICS_TABLE => 'topic_id',
- USERS_TABLE => 'user_id',
- WARNINGS_TABLE => 'warning_id',
- WORDS_TABLE => 'word_id'
- );
- if (!empty($tables[$schema['target']]))
+ switch ($db->sql_layer)
{
- $db->sql_query("SELECT SETVAL('" . $schema['target'] . "_seq',(select case when max(" . $tables[$schema['target']] . ")>0 then max(" . $tables[$schema['target']] . ")+1 else 1 end from " . $schema['target'] . '));');
+ case 'postgres':
+ $db->sql_query("SELECT SETVAL('" . $schema['target'] . "_seq',(select case when max(" . $schema['autoincrement'] . ")>0 then max(" . $schema['autoincrement'] . ")+1 else 1 end from " . $schema['target'] . '));');
+ break;
}
}
}
@@ -1051,6 +1016,17 @@ class install_convert extends module
$convert->row = $convert_row = array();
+ if (!empty($schema['autoincrement']))
+ {
+ switch ($db->sql_layer)
+ {
+ case 'mssql':
+ case 'mssql_odbc':
+ $db->sql_query('SET IDENTITY_INSERT ' . $schema['target'] . ' ON');
+ break;
+ }
+ }
+
// Now handle the rows until time is over or no more rows to process...
while (still_on_time())
{
@@ -1168,48 +1144,18 @@ class install_convert extends module
$waiting_rows = array();
}
- if ($db->sql_layer === 'postgres')
+ if (!empty($schema['autoincrement']))
{
- $tables = array(
- ATTACHMENTS_TABLE => 'attach_id',
- ACL_OPTIONS_TABLE => 'auth_option_id',
- ACL_ROLES_TABLE => 'role_id',
- BANLIST_TABLE => 'ban_id',
- BOTS_TABLE => 'bot_id',
- DISALLOW_TABLE => 'disallow_id',
- DRAFTS_TABLE => 'draft_id',
- EXTENSIONS_TABLE => 'extension_id',
- EXTENSION_GROUPS_TABLE => 'group_id',
- FORUMS_TABLE => 'forum_id',
- GROUPS_TABLE => 'group_id',
- ICONS_TABLE => 'icons_id',
- LANG_TABLE => 'lang_id',
- LOG_TABLE => 'log_id',
- MODULES_TABLE => 'module_id',
- POSTS_TABLE => 'post_id',
- PRIVMSGS_TABLE => 'msg_id',
- PRIVMSGS_FOLDER_TABLE => 'folder_id',
- PRIVMSGS_RULES_TABLE => 'rule_id',
- PROFILE_FIELDS_TABLE => 'field_id',
- RANKS_TABLE => 'rank_id',
- REPORTS_TABLE => 'report_id',
- REPORTS_REASONS_TABLE => 'reason_id',
- SEARCH_WORDLIST_TABLE => 'word_id',
- SITELIST_TABLE => 'site_id',
- SMILIES_TABLE => 'smiley_id',
- STYLES_TABLE => 'style_id',
- STYLES_TEMPLATE_TABLE => 'template_id',
- STYLES_TEMPLATE_DATA_TABLE => 'template_id',
- STYLES_THEME_TABLE => 'theme_id',
- STYLES_IMAGESET_TABLE => 'imageset_id',
- TOPICS_TABLE => 'topic_id',
- USERS_TABLE => 'user_id',
- WARNINGS_TABLE => 'warning_id',
- WORDS_TABLE => 'word_id'
- );
- if (!empty($tables[$schema['target']]))
+ switch ($db->sql_layer)
{
- $db->sql_query("SELECT SETVAL('" . $schema['target'] . "_seq',(select case when max(" . $tables[$schema['target']] . ")>0 then max(" . $tables[$schema['target']] . ")+1 else 1 end from " . $schema['target'] . '));');
+ case 'mssql':
+ case 'mssql_odbc':
+ $db->sql_query('SET IDENTITY_INSERT ' . $schema['target'] . ' OFF');
+ break;
+
+ case 'postgres':
+ $db->sql_query("SELECT SETVAL('" . $schema['target'] . "_seq',(select case when max(" . $schema['autoincrement'] . ")>0 then max(" . $schema['autoincrement'] . ")+1 else 1 end from " . $schema['target'] . '));');
+ break;
}
}
}
From 5227d3ce2109c4d9b62166b85b3b1c29967d30ac Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dominik=20Dr=C3=B6scher?=
Date: Mon, 12 Feb 2007 15:19:28 +0000
Subject: [PATCH 032/707] Some changes and additions, still not perfect in IE.
Test it till your eyes and ears start bleeding!
git-svn-id: file:///svn/phpbb/trunk@6982 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/styles/subSilver/template/editor.js | 52 ++++++++++++++++-------
1 file changed, 36 insertions(+), 16 deletions(-)
diff --git a/phpBB/styles/subSilver/template/editor.js b/phpBB/styles/subSilver/template/editor.js
index 2ef2853ed3..51634a60cd 100644
--- a/phpBB/styles/subSilver/template/editor.js
+++ b/phpBB/styles/subSilver/template/editor.js
@@ -32,11 +32,21 @@ function helpline(help)
*/
function initInsertions()
{
- var textarea = document.forms[form_name].elements[text_name];
- textarea.focus();
- if (is_ie && typeof(baseHeight) != 'number')
+ var doc;
+ if(document.forms[form_name])
{
- baseHeight = document.selection.createRange().duplicate().boundingHeight;
+ doc = document;
+ }
+ else
+ {
+ doc = opener.document;
+ }
+ var textarea = doc.forms[form_name].elements[text_name];
+ if (is_ie && typeof(baseHeight) != 'number')
+ {
+ textarea.focus();
+ baseHeight = doc.selection.createRange().duplicate().boundingHeight;
+ document.body.focus();
}
}
@@ -48,7 +58,9 @@ function bbstyle(bbnumber)
if (bbnumber != -1)
{
bbfontstyle(bbtags[bbnumber], bbtags[bbnumber+1]);
- } else {
+ }
+ else
+ {
insert_text('[*]');
document.forms[form_name].elements[text_name].focus();
}
@@ -62,6 +74,7 @@ function bbfontstyle(bbopen, bbclose)
theSelection = false;
var textarea = document.forms[form_name].elements[text_name];
+
textarea.focus();
if ((clientVer >= 4) && is_ie && is_win)
@@ -85,9 +98,10 @@ function bbfontstyle(bbopen, bbclose)
theSelection = '';
return;
}
-
+
//The new position for the cursor after adding the bbcode
- var new_pos = getCaretPosition(textarea).start + bbopen.length;
+ var caret_pos = getCaretPosition(textarea).start;
+ var new_pos = caret_pos + bbopen.length;
// Open tag
insert_text(bbopen + bbclose);
@@ -102,13 +116,14 @@ function bbfontstyle(bbopen, bbclose)
// IE
else if (document.selection)
{
+
var range = textarea.createTextRange();
- range.move("character", new_pos);
+ range.move("character", new_pos);
range.select();
- storeCaret(document.forms[form_name].elements[text_name]);
+ storeCaret(textarea);
}
- document.forms[form_name].elements[text_name].focus();
+ textarea.focus();
return;
}
@@ -122,7 +137,8 @@ function insert_text(text, spaces, popup)
if (!popup)
{
textarea = document.forms[form_name].elements[text_name];
- } else
+ }
+ else
{
textarea = opener.document.forms[form_name].elements[text_name];
}
@@ -152,12 +168,15 @@ function insert_text(text, spaces, popup)
caret_pos.text = caret_pos.text.charAt(caret_pos.text.length - 1) == ' ' ? caret_pos.text + text + ' ' : caret_pos.text + text;
}
-
else
{
textarea.value = textarea.value + text;
}
- document.forms[form_name].elements[text_name].focus();
+ if (!popup)
+ {
+ textarea.focus();
+ }
+
}
/**
@@ -352,6 +371,7 @@ function getCaretPosition(txtarea)
// dirty and slow IE way
else if(document.selection)
{
+
// get current selection
var range = document.selection.createRange();
@@ -365,12 +385,12 @@ function getCaretPosition(txtarea)
{
range_all.moveStart('character', 1);
}
-
+
txtarea.sel_start = sel_start;
-
+
// we ignore the end value for IE, this is already dirty enough and we don't need it
caretPos.start = txtarea.sel_start;
- caretPos.end = txtarea.sel_start;
+ caretPos.end = txtarea.sel_start;
}
return caretPos;
From 4d1a25e8a16172e358ce5f4460c3e52dad034d0c Mon Sep 17 00:00:00 2001
From: David M
Date: Mon, 12 Feb 2007 23:19:41 +0000
Subject: [PATCH 033/707] #8058
git-svn-id: file:///svn/phpbb/trunk@6983 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/includes/utf/utf_normalizer.php | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/phpBB/includes/utf/utf_normalizer.php b/phpBB/includes/utf/utf_normalizer.php
index 542c1aeeb8..c1a0fc9a7b 100644
--- a/phpBB/includes/utf/utf_normalizer.php
+++ b/phpBB/includes/utf/utf_normalizer.php
@@ -230,8 +230,8 @@ class utf_normalizer
// Load some commonly-used tables
if (!isset($utf_jamo_index, $utf_jamo_type, $utf_combining_class))
{
- global $phpbb_root_path;
- include($phpbb_root_path . 'includes/utf/data/utf_normalizer_common.php');
+ global $phpbb_root_path, $phpEx;
+ include($phpbb_root_path . 'includes/utf/data/utf_normalizer_common.' . $phpEx);
}
// Buffer the last ASCII char before the UTF-8 stuff if applicable
@@ -920,12 +920,13 @@ class utf_normalizer
*/
function decompose($str, $pos, $len, &$decomp_map)
{
- global $utf_combining_class, $phpbb_root_path;
+ global $utf_combining_class;
// Load some commonly-used tables
if (!isset($utf_combining_class))
{
- include($phpbb_root_path . 'includes/utf/data/utf_normalizer_common.php');
+ global $phpbb_root_path, $phpEx;
+ include($phpbb_root_path . 'includes/utf/data/utf_normalizer_common.' . $phpEx);
}
// UTF char length array
From 4c487c1cdc03f50d7aee4021588572a9358e06ec Mon Sep 17 00:00:00 2001
From: David M
Date: Tue, 13 Feb 2007 00:14:39 +0000
Subject: [PATCH 034/707] #8084
git-svn-id: file:///svn/phpbb/trunk@6984 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/includes/acp/acp_database.php | 2 +-
phpBB/includes/functions_convert.php | 5 +++--
phpBB/install/convertors/functions_phpbb20.php | 16 ++++++++++++++++
3 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/phpBB/includes/acp/acp_database.php b/phpBB/includes/acp/acp_database.php
index 87c40ef78f..f09856b7fa 100644
--- a/phpBB/includes/acp/acp_database.php
+++ b/phpBB/includes/acp/acp_database.php
@@ -1494,7 +1494,7 @@ class acp_database
}
else
{
- $row['rowdefault'] = $db->sql_fetchfield('rowdefault', 0, $def_res);
+ $row['rowdefault'] = $db->sql_fetchfield('rowdefault', false, $def_res);
}
$db->sql_freeresult($def_res);
diff --git a/phpBB/includes/functions_convert.php b/phpBB/includes/functions_convert.php
index ee97dcb3ab..6df29fc0f4 100644
--- a/phpBB/includes/functions_convert.php
+++ b/phpBB/includes/functions_convert.php
@@ -1647,7 +1647,7 @@ function add_bots()
$sql = 'SELECT group_id FROM ' . GROUPS_TABLE . " WHERE group_name = 'BOTS'";
$result = $db->sql_query($sql);
- $group_id = (int) $db->sql_fetchfield('group_id', 0, $result);
+ $group_id = (int) $db->sql_fetchfield('group_id', false, $result);
$db->sql_freeresult($result);
if (!$group_id)
@@ -1656,11 +1656,12 @@ function add_bots()
$sql = 'SELECT group_id FROM ' . GROUPS_TABLE . " WHERE group_name = 'BOTS'";
$result = $db->sql_query($sql);
- $group_id = (int) $db->sql_fetchfield('group_id', 0, $result);
+ $group_id = (int) $db->sql_fetchfield('group_id', false, $result);
$db->sql_freeresult($result);
if (!$group_id)
{
+ global $install;
$install->error($user->lang['CONV_ERROR_INCONSISTENT_GROUPS'], __LINE__, __FILE__);
}
}
diff --git a/phpBB/install/convertors/functions_phpbb20.php b/phpBB/install/convertors/functions_phpbb20.php
index eb660f84d0..fdde80c82c 100644
--- a/phpBB/install/convertors/functions_phpbb20.php
+++ b/phpBB/install/convertors/functions_phpbb20.php
@@ -76,6 +76,14 @@ function phpbb_insert_forums()
$db->sql_query("SET NAMES 'utf8'");
}
+ switch ($db->sql_layer)
+ {
+ case 'mssql':
+ case 'mssql_odbc':
+ $db->sql_query('SET IDENTITY_INSERT ' . FORUMS_TABLE . ' ON');
+ break;
+ }
+
$cats_added = array();
while ($row = $db->sql_fetchrow($result))
{
@@ -259,6 +267,14 @@ function phpbb_insert_forums()
$db->sql_query($sql);
}
$db->sql_freeresult($result);
+
+ switch ($db->sql_layer)
+ {
+ case 'mssql':
+ case 'mssql_odbc':
+ $db->sql_query('SET IDENTITY_INSERT ' . FORUMS_TABLE . ' OFF');
+ break;
+ }
}
/**
From c16beb34af123b810cfd8a4a625075fcb59540ef Mon Sep 17 00:00:00 2001
From: David M
Date: Tue, 13 Feb 2007 20:49:39 +0000
Subject: [PATCH 035/707] found you!
git-svn-id: file:///svn/phpbb/trunk@6985 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/install/install_convert.php | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/phpBB/install/install_convert.php b/phpBB/install/install_convert.php
index 0d1fec4a1c..0656f7e5f4 100644
--- a/phpBB/install/install_convert.php
+++ b/phpBB/install/install_convert.php
@@ -835,6 +835,12 @@ class install_convert extends module
if (!empty($convert->config_schema))
{
restore_config($convert->config_schema);
+
+ // Override a couple of config variables for the duration
+ $config['max_quote_depth'] = 0;
+
+ // @todo Need to confirm that max post length in source is <= max post length in destination or there may be interesting formatting issues
+ $config['max_post_chars'] = -1;
}
$template->assign_block_vars('checks', array(
From deadc44c9ca1a1a0e060d036cc7cc58825a1c20f Mon Sep 17 00:00:00 2001
From: David M
Date: Tue, 13 Feb 2007 23:20:34 +0000
Subject: [PATCH 036/707] -Topic review is fast :D #7894
git-svn-id: file:///svn/phpbb/trunk@6986 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/includes/functions_posting.php | 34 ++++++++++++++++++++++------
1 file changed, 27 insertions(+), 7 deletions(-)
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index eb03143aa1..4b80464d22 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -863,28 +863,48 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id
global $config, $phpbb_root_path, $phpEx;
// Go ahead and pull all data for this topic
- $sql = 'SELECT u.username, u.user_id, u.user_colour, p.*
- FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . " u
+ $sql = 'SELECT p.post_id
+ FROM ' . POSTS_TABLE . ' p' . "
WHERE p.topic_id = $topic_id
- AND p.poster_id = u.user_id
" . ((!$auth->acl_get('m_approve', $forum_id)) ? 'AND p.post_approved = 1' : '') . '
' . (($mode == 'post_review') ? " AND p.post_id > $cur_post_id" : '') . '
ORDER BY p.post_time DESC';
$result = $db->sql_query_limit($sql, $config['posts_per_page']);
- if (!$row = $db->sql_fetchrow($result))
+ $post_list = array();
+
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $post_list[] = $row['post_id'];
+ }
+
+ $db->sql_freeresult($result);
+
+ if (!sizeof($post_list))
{
- $db->sql_freeresult($result);
return false;
}
+ $sql = $db->sql_build_query('SELECT', array(
+ 'SELECT' => 'u.username, u.user_id, u.user_colour, p.*',
+
+ 'FROM' => array(
+ USERS_TABLE => 'u',
+ POSTS_TABLE => 'p',
+ ),
+
+ 'WHERE' => $db->sql_in_set('p.post_id', $post_list) . '
+ AND u.user_id = p.poster_id'
+ ));
+
+ $result = $db->sql_query($sql);
+
$bbcode_bitfield = '';
- do
+ while ($row = $db->sql_fetchrow($result))
{
$rowset[] = $row;
$bbcode_bitfield = $bbcode_bitfield | base64_decode($row['bbcode_bitfield']);
}
- while ($row = $db->sql_fetchrow($result));
$db->sql_freeresult($result);
// Instantiate BBCode class
From 225d91b4f225d989fe8feadeb623038f9a0b2124 Mon Sep 17 00:00:00 2001
From: David M
Date: Tue, 13 Feb 2007 23:22:42 +0000
Subject: [PATCH 037/707] - might as well...
git-svn-id: file:///svn/phpbb/trunk@6987 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/includes/functions_posting.php | 1 +
1 file changed, 1 insertion(+)
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index 4b80464d22..11ec1b8b1e 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -900,6 +900,7 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id
$result = $db->sql_query($sql);
$bbcode_bitfield = '';
+ $rowset = array();
while ($row = $db->sql_fetchrow($result))
{
$rowset[] = $row;
From cecdbaa4c3074992c900e3f161d6f43582357811 Mon Sep 17 00:00:00 2001
From: David M
Date: Thu, 15 Feb 2007 20:30:41 +0000
Subject: [PATCH 038/707] #7570 #7232 - pretty much rewrote backup/restore.
whatever is not new code is refactored. Download now works properly with gzip
on the fly, bzip2 is still very much not on the fly ( will to take
suggestions on this ). Should *never* hit any memory issue. Loads of bug
fixes, tested with every DB we support
git-svn-id: file:///svn/phpbb/trunk@6988 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/includes/acp/acp_database.php | 3412 ++++++++++++++-------------
1 file changed, 1806 insertions(+), 1606 deletions(-)
diff --git a/phpBB/includes/acp/acp_database.php b/phpBB/includes/acp/acp_database.php
index f09856b7fa..b6405d88fe 100644
--- a/phpBB/includes/acp/acp_database.php
+++ b/phpBB/includes/acp/acp_database.php
@@ -73,143 +73,44 @@ class acp_database
$time = time();
$filename = 'backup_' . $time . '_' . unique_id();
-
- // We set up the info needed for our on-the-fly creation :D
- switch ($format)
- {
- case 'text':
- $ext = '.sql';
- $open = 'fopen';
- $write = 'fwrite';
- $close = 'fclose';
- $oper = '';
- $mimetype = 'text/x-sql';
- break;
- case 'bzip2':
- $ext = '.sql.bz2';
- $open = 'bzopen';
- $write = 'bzwrite';
- $close = 'bzclose';
- $mimetype = 'application/x-bzip2';
- break;
- case 'gzip':
- $ext = '.sql.gz';
- $open = 'gzopen';
- $write = 'gzwrite';
- $close = 'gzclose';
- $mimetype = 'application/x-gzip';
- break;
- }
-
- // We write the file to "store" first (and then compress the file) to not use too much
- // memory. The server process can be easily killed by storing too much data at once.
-
- if ($download == true)
- {
- $fh = fopen('php://output', 'wb');
-
- switch ($format)
- {
- case 'bzip2':
- ob_start('ob_bz2handler');
- break;
- case 'gzip':
- ob_start('ob_gzhandler');
- break;
- }
-
- $name = $filename . $ext;
- header('Pragma: no-cache');
- header("Content-Type: $mimetype; name=\"$name\"");
- header("Content-disposition: attachment; filename=$name");
- }
-
- if ($store == true)
- {
- $file = $phpbb_root_path . 'store/' . $filename . $ext;
-
- $fp = $open($file, 'w');
-
- if (!$fp)
- {
- trigger_error('Unable to write temporary file to storage folder', E_USER_ERROR);
- }
- }
-
- // All of the generated queries go here
- $sql_data = '';
- $sql_data .= "#\n";
- $sql_data .= "# phpBB Backup Script\n";
- $sql_data .= "# Dump of tables for $table_prefix\n";
- $sql_data .= "# DATE : " . gmdate("d-m-Y H:i:s", $time) . " GMT\n";
- $sql_data .= "#\n";
-
switch ($db->sql_layer)
{
+ case 'mysqli':
+ case 'mysql4':
+ case 'mysql':
+ $extractor = new mysql_extractor($download, $store, $format, $filename, $time);
+ break;
+
case 'sqlite':
- $sql_data .= "BEGIN TRANSACTION;\n";
- $sqlite_version = sqlite_libversion();
+ $extractor = new sqlite_extractor($download, $store, $format, $filename, $time);
break;
case 'postgres':
- $sql_data .= "BEGIN;\n";
+ $extractor = new postgres_extractor($download, $store, $format, $filename, $time);
+ break;
+
+ case 'oracle':
+ $extractor = new oracle_extractor($download, $store, $format, $filename, $time);
break;
case 'mssql':
case 'mssql_odbc':
- $sql_data .= "BEGIN TRANSACTION\n";
- $sql_data .= "GO\n";
+ $extractor = new mssql_extractor($download, $store, $format, $filename, $time);
+ break;
+
+ case 'firebird':
+ $extractor = new firebird_extractor($download, $store, $format, $filename, $time);
break;
}
+ $extractor->write_start($table_prefix);
+
foreach ($table as $table_name)
{
// Get the table structure
if ($structure)
{
- $sql_data .= "\n";
- switch ($db->sql_layer)
- {
- case 'mysqli':
- case 'mysql4':
- case 'mysql':
- $sql_data .= '# Table: ' . $table_name . "\n";
- $sql_data .= "DROP TABLE IF EXISTS $table_name;\n";
- break;
-
- case 'oracle':
- $sql_data .= '# Table: ' . $table_name . "\n";
- $sql_data .= "DROP TABLE $table_name;\n";
- $sql_data .= '\\' . "\n";
- break;
-
- case 'sqlite':
- $sql_data .= '# Table: ' . $table_name . "\n";
- if (version_compare($sqlite_version, '3.0') == -1)
- {
- $sql_data .= "DROP TABLE $table_name;\n";
- }
- else
- {
- $sql_data .= "DROP TABLE IF EXISTS $table_name;\n";
- }
- break;
-
- case 'postgres':
- case 'firebird':
- $sql_data .= '# Table: ' . $table_name . "\n";
- $sql_data .= "DROP TABLE $table_name;\n";
- break;
-
- case 'mssql':
- case 'mssql_odbc':
- $sql_data .= '# Table: ' . $table_name . "\n";
- $sql_data .= "IF OBJECT_ID(N'$table_name', N'U') IS NOT NULL\n";
- $sql_data .= "DROP TABLE $table_name;\n";
- $sql_data .= "GO\n";
- break;
- }
- $sql_data .= $this->get_table_structure($table_name);
+ $extractor->write_table($table_name);
}
else
{
@@ -218,752 +119,38 @@ class acp_database
{
case 'sqlite':
case 'firebird':
- $sql_data .= 'DELETE FROM ';
+ $extractor->flush('DELETE FROM ' . $table_name . ";\n");
+ break;
+
+ case 'mssql':
+ case 'mssql_odbc':
+ $extractor->flush('TRUNCATE TABLE ' . $table_name . "GO\n");
+ break;
+
+ case 'oracle':
+ $extractor->flush('TRUNCATE TABLE ' . $table_name . "\\\n");
break;
default:
- $sql_data .= 'TRUNCATE TABLE ';
+ $extractor->flush('TRUNCATE TABLE ' . $table_name . ";\n");
break;
}
- $sql_data .= $table_name . ";\n";
}
- // Now write the data for the first time. :)
- if ($store == true)
- {
- $write($fp, $sql_data);
- }
-
- if ($download == true)
- {
- fwrite($fh, $sql_data);
- }
-
- $sql_data = '';
-
// Data
if ($schema_data)
{
- $sql_data .= "\n";
-
- switch ($db->sql_layer)
- {
- case 'mysqli':
-
- $sql = "SELECT *
- FROM $table_name";
- $result = mysqli_query($db->db_connect_id, $sql, MYSQLI_USE_RESULT);
- if ($result != false)
- {
- $fields_cnt = mysqli_num_fields($result);
-
- // Get field information
- $field = mysqli_fetch_fields($result);
- $field_set = array();
-
- for ($j = 0; $j < $fields_cnt; $j++)
- {
- $field_set[$j] = $field[$j]->name;
- }
-
- $search = array("\\", "'", "\x00", "\x0a", "\x0d", "\x1a", '"');
- $replace = array("\\\\", "\\'", '\0', '\n', '\r', '\Z', '\\"');
- $fields = implode(', ', $field_set);
- $values = array();
- $schema_insert = 'INSERT INTO ' . $table_name . ' (' . $fields . ') VALUES (';
-
- while ($row = mysqli_fetch_row($result))
- {
- for ($j = 0; $j < $fields_cnt; $j++)
- {
- if (!isset($row[$j]) || is_null($row[$j]))
- {
- $values[$j] = 'NULL';
- }
- else if (($field[$j]->flags & 32768) && !($field[$j]->flags & 1024))
- {
- $values[$j] = $row[$j];
- }
- else
- {
- $values[$j] = "'" . str_replace($search, $replace, $row[$j]) . "'";
- }
- }
- $sql_data .= $schema_insert . implode(', ', $values) . ");\n";
-
- if ($store == true)
- {
- $write($fp, $sql_data);
- }
-
- if ($download == true)
- {
- fwrite($fh, $sql_data);
- }
- $sql_data = '';
-
- $values = array();
- }
- mysqli_free_result($result);
- }
- break;
-
- case 'mysql4':
- case 'mysql':
-
- $sql = "SELECT *
- FROM $table_name";
- $result = mysql_unbuffered_query($sql, $db->db_connect_id);
-
- if ($result != false)
- {
- $fields_cnt = mysql_num_fields($result);
-
- // Get field information
- $field = array();
- for ($i = 0; $i < $fields_cnt; $i++)
- {
- $field[$i] = mysql_fetch_field($result, $i);
- }
- $field_set = array();
-
- for ($j = 0; $j < $fields_cnt; $j++)
- {
- $field_set[$j] = $field[$j]->name;
- }
-
- $search = array("\\", "'", "\x00", "\x0a", "\x0d", "\x1a", '"');
- $replace = array("\\\\", "\\'", '\0', '\n', '\r', '\Z', '\\"');
- $fields = implode(', ', $field_set);
- $schema_insert = 'INSERT INTO ' . $table_name . ' (' . $fields . ') VALUES (';
-
- while ($row = mysql_fetch_row($result))
- {
- $values = array();
-
- for ($j = 0; $j < $fields_cnt; $j++)
- {
- if (!isset($row[$j]) || is_null($row[$j]))
- {
- $values[$j] = 'NULL';
- }
- else if ($field[$j]->numeric && ($field[$j]->type !== 'timestamp'))
- {
- $values[$j] = $row[$j];
- }
- else
- {
- $values[$j] = "'" . str_replace($search, $replace, $row[$j]) . "'";
- }
- }
- $sql_data .= $schema_insert . implode(', ', $values) . ");\n";
-
- if ($store == true)
- {
- $write($fp, $sql_data);
- }
-
- if ($download == true)
- {
- fwrite($fh, $sql_data);
- }
- $sql_data = '';
- }
- mysql_free_result($result);
- }
- break;
-
- case 'sqlite':
- // This is *not* my fault. The PHP guys forgot a call to finalize when they wrote this function. This forces all the tables to stay locked...
- // They finally fixed it in 5.1.3 but 5.1.2 and under still have this so instead, we go and grab the column types by smashing open the sqlite_master table
- // and grope around for things that remind us of datatypes...
- if (version_compare(phpversion(), '5.1.3', '>='))
- {
- $col_types = sqlite_fetch_column_types($db->db_connect_id, $table_name);
- }
- else
- {
- $sql = "SELECT sql
- FROM sqlite_master
- WHERE type = 'table'
- AND name = '" . $table_name . "'";
- $table_data = sqlite_single_query($db->db_connect_id, $sql);
- $table_data = preg_replace('#CREATE\s+TABLE\s+"?' . $table_name . '"?#i', '', $table_data);
- $table_data = trim($table_data);
-
- preg_match('#\((.*)\)#s', $table_data, $matches);
-
- $column_list = array();
- $table_cols = explode(',', trim($matches[1]));
- foreach ($table_cols as $declaration)
- {
- $entities = preg_split('#\s+#', trim($declaration));
- $column_name = preg_replace('/"?([^"]+)"?/', '\1', $entities[0]);
-
- // Hit a primary key, those are not what we need :D
- if (empty($entities[1]))
- {
- continue;
- }
- $col_types[$column_name] = $entities[1];
- }
- }
-
- // Unbueffered query and the foreach make this ultra fast, we wait for nothing.
- $sql = "SELECT *
- FROM $table_name";
- $result = sqlite_unbuffered_query($db->db_connect_id, $sql);
- $rows = sqlite_fetch_all($result, SQLITE_ASSOC);
-
- foreach ($rows as $row)
- {
- $names = $data = array();
- foreach ($row as $row_name => $row_data)
- {
- $names[] = $row_name;
-
- // Figure out what this data is, escape it properly
- if (is_null($row_data))
- {
- $row_data = 'NULL';
- }
- else if ($row_data == '')
- {
- $row_data = "''";
- }
- else if (strpos($col_types[$row_name], 'text') !== false || strpos($col_types[$row_name], 'char') !== false || strpos($col_types[$row_name], 'blob') !== false)
- {
- $row_data = "'" . $row_data . "'";
- }
-
- $data[] = $row_data;
- }
- $sql_data .= 'INSERT INTO ' . $table_name . ' (' . implode(', ', $names) . ') VALUES ('. implode(', ', $data) .");\n";
-
- if ($store == true)
- {
- $write($fp, $sql_data);
- }
-
- if ($download == true)
- {
- fwrite($fh, $sql_data);
- }
- $sql_data = '';
-
- }
- $db->sql_freeresult($result);
- break;
-
- case 'postgres':
-
- $ary_type = $ary_name = array();
-
- // Grab all of the data from current table.
- $sql = "SELECT *
- FROM $table_name";
- $result = $db->sql_query($sql);
-
- $i_num_fields = pg_num_fields($result);
- $seq = '';
-
- for ($i = 0; $i < $i_num_fields; $i++)
- {
- $ary_type[$i] = pg_field_type($result, $i);
- $ary_name[$i] = pg_field_name($result, $i);
-
-
- $sql = "SELECT pg_get_expr(d.adbin, d.adrelid) as rowdefault
- FROM pg_attrdef d, pg_class c
- WHERE (c.relname = '{$table_name}')
- AND (c.oid = d.adrelid)
- AND d.adnum = " . strval($i + 1);
- $result2 = $db->sql_query($sql);
- if ($row = $db->sql_fetchrow($result2))
- {
- // Determine if we must reset the sequences
- if (strpos($row['rowdefault'], "nextval('") === 0)
- {
- $seq .= "SELECT SETVAL('{$table_name}_seq',(select case when max({$ary_name[$i]})>0 then max({$ary_name[$i]})+1 else 1 end FROM {$table_name}));\n";
- }
- }
- }
-
- while ($row = $db->sql_fetchrow($result))
- {
- $schema_vals = $schema_fields = array();
-
- // Build the SQL statement to recreate the data.
- for ($i = 0; $i < $i_num_fields; $i++)
- {
- $str_val = $row[$ary_name[$i]];
-
- if (preg_match('#char|text|bool|bytea#i', $ary_type[$i]))
- {
- $str_quote = "'";
- $str_empty = '';
- $str_val = addslashes($str_val);
- }
- else if (preg_match('#date|timestamp#i', $ary_type[$i]))
- {
- if (empty($str_val))
- {
- $str_quote = '';
- }
- else
- {
- $str_quote = "'";
- }
- }
- else
- {
- $str_quote = '';
- $str_empty = 'NULL';
- }
-
- if (empty($str_val) && $str_val !== '0')
- {
- $str_val = $str_empty;
- }
-
- $schema_vals[$i] = $str_quote . $str_val . $str_quote;
- $schema_fields[$i] = $ary_name[$i];
- }
-
- // Take the ordered fields and their associated data and build it
- // into a valid sql statement to recreate that field in the data.
- $sql_data .= "INSERT INTO $table_name (" . implode(', ', $schema_fields) . ') VALUES (' . implode(', ', $schema_vals) . ");\n";
-
- if ($store == true)
- {
- $write($fp, $sql_data);
- }
-
- if ($download == true)
- {
- fwrite($fh, $sql_data);
- }
-
- $sql_data = '';
-
- }
- $db->sql_freeresult($result);
-
- // Write out the sequence statements
- if ($store == true)
- {
- $write($fp, $seq);
- }
-
- if ($download == true)
- {
- if (!empty($oper))
- {
- echo $oper($seq);
- }
- else
- {
- echo $seq;
- }
- }
- $seq = '';
- break;
-
- case 'mssql_odbc':
- $ary_type = $ary_name = array();
- $ident_set = false;
-
- // Grab all of the data from current table.
- $sql = "SELECT *
- FROM $table_name";
- $result = $db->sql_query($sql);
-
- $retrieved_data = odbc_num_rows($result);
-
- if ($retrieved_data)
- {
- $sql = "SELECT 1 as has_identity
- FROM INFORMATION_SCHEMA.COLUMNS
- WHERE COLUMNPROPERTY(object_id('$table_name'), COLUMN_NAME, 'IsIdentity') = 1";
- $result2 = $db->sql_query($sql);
- $row2 = $db->sql_fetchrow($result2);
- if (!empty($row2['has_identity']))
- {
- $sql_data .= "\nSET IDENTITY_INSERT $table_name ON\nGO\n";
- $ident_set = true;
- }
- $db->sql_freeresult($result2);
- }
-
- $i_num_fields = odbc_num_fields($result);
-
- for ($i = 0; $i < $i_num_fields; $i++)
- {
- $ary_type[$i] = odbc_field_type($result, $i + 1);
- $ary_name[$i] = odbc_field_name($result, $i + 1);
- }
-
- while ($row = $db->sql_fetchrow($result))
- {
- $schema_vals = $schema_fields = array();
-
- // Build the SQL statement to recreate the data.
- for ($i = 0; $i < $i_num_fields; $i++)
- {
- $str_val = $row[$ary_name[$i]];
-
- if (preg_match('#char|text|bool|varbinary#i', $ary_type[$i]))
- {
- $str_quote = "'";
- $str_empty = '';
- $str_val = addslashes($str_val);
- }
- else if (preg_match('#date|timestamp#i', $ary_type[$i]))
- {
- if (empty($str_val))
- {
- $str_quote = '';
- }
- else
- {
- $str_quote = "'";
- }
- }
- else
- {
- $str_quote = '';
- $str_empty = 'NULL';
- }
-
- if (empty($str_val) && $str_val !== '0' && !(is_int($str_val) || is_float($str_val)))
- {
- $str_val = $str_empty;
- }
-
- $schema_vals[$i] = $str_quote . $str_val . $str_quote;
- $schema_fields[$i] = $ary_name[$i];
- }
-
- // Take the ordered fields and their associated data and build it
- // into a valid sql statement to recreate that field in the data.
- $sql_data .= "INSERT INTO $table_name (" . implode(', ', $schema_fields) . ') VALUES (' . implode(', ', $schema_vals) . ");\n";
-
- if ($store == true)
- {
- $write($fp, $sql_data);
- }
-
- if ($download == true)
- {
- fwrite($fh, $sql_data);
- }
-
- $sql_data = '';
-
- }
- $db->sql_freeresult($result);
-
- if ($retrieved_data)
- {
- $sql_data = "\nGO\n";
- if ($ident_set)
- {
- $sql_data .= "\nSET IDENTITY_INSERT $table_name OFF\nGO\n";
- }
- }
- break;
-
- case 'mssql':
- $ary_type = $ary_name = array();
- $ident_set = false;
-
- // Grab all of the data from current table.
- $sql = "SELECT *
- FROM $table_name";
- $result = $db->sql_query($sql);
-
- $retrieved_data = mssql_num_rows($result);
-
- $i_num_fields = mssql_num_fields($result);
-
- for ($i = 0; $i < $i_num_fields; $i++)
- {
- $ary_type[$i] = mssql_field_type($result, $i);
- $ary_name[$i] = mssql_field_name($result, $i);
- }
-
- if ($retrieved_data)
- {
- $sql = "SELECT 1 as has_identity
- FROM INFORMATION_SCHEMA.COLUMNS
- WHERE COLUMNPROPERTY(object_id('$table_name'), COLUMN_NAME, 'IsIdentity') = 1";
- $result2 = $db->sql_query($sql);
- $row2 = $db->sql_fetchrow($result2);
- if (!empty($row2['has_identity']))
- {
- $sql_data .= "\nSET IDENTITY_INSERT $table_name ON\nGO\n";
- $ident_set = true;
- }
- $db->sql_freeresult($result2);
- }
-
- while ($row = $db->sql_fetchrow($result))
- {
- $schema_vals = $schema_fields = array();
-
- // Build the SQL statement to recreate the data.
- for ($i = 0; $i < $i_num_fields; $i++)
- {
- $str_val = $row[$ary_name[$i]];
-
- if (preg_match('#char|text|bool|varbinary#i', $ary_type[$i]))
- {
- $str_quote = "'";
- $str_empty = '';
- $str_val = addslashes($str_val);
- }
- else if (preg_match('#date|timestamp#i', $ary_type[$i]))
- {
- if (empty($str_val))
- {
- $str_quote = '';
- }
- else
- {
- $str_quote = "'";
- }
- }
- else
- {
- $str_quote = '';
- $str_empty = 'NULL';
- }
-
- if (empty($str_val) && $str_val !== '0' && !(is_int($str_val) || is_float($str_val)))
- {
- $str_val = $str_empty;
- }
-
- $schema_vals[$i] = $str_quote . $str_val . $str_quote;
- $schema_fields[$i] = $ary_name[$i];
- }
-
- // Take the ordered fields and their associated data and build it
- // into a valid sql statement to recreate that field in the data.
- $sql_data .= "INSERT INTO $table_name (" . implode(', ', $schema_fields) . ') VALUES (' . implode(', ', $schema_vals) . ");\n";
-
- if ($store == true)
- {
- $write($fp, $sql_data);
- }
-
- if ($download == true)
- {
- fwrite($fh, $sql_data);
- }
-
- $sql_data = '';
-
- }
- $db->sql_freeresult($result);
-
- if ($retrieved_data)
- {
- $sql_data = "GO\n";
- if ($ident_set)
- {
- $sql_data .= "\nSET IDENTITY_INSERT $table_name OFF\nGO\n";
- }
- }
- break;
-
- case 'firebird':
-
- $ary_type = $ary_name = array();
-
- // Grab all of the data from current table.
- $sql = "SELECT *
- FROM $table_name";
- $result = $db->sql_query($sql);
-
- $i_num_fields = ibase_num_fields($result);
-
- for ($i = 0; $i < $i_num_fields; $i++)
- {
- $info = ibase_field_info($result, $i);
- $ary_type[$i] = $info['type'];
- $ary_name[$i] = $info['name'];
- }
-
- while ($row = $db->sql_fetchrow($result))
- {
- $schema_vals = $schema_fields = array();
-
- // Build the SQL statement to recreate the data.
- for ($i = 0; $i < $i_num_fields; $i++)
- {
- $str_val = $row[strtolower($ary_name[$i])];
-
- if (preg_match('#char|text|bool|varbinary#i', $ary_type[$i]))
- {
- $str_quote = "'";
- $str_empty = '';
- $str_val = addslashes($str_val);
- }
- else if (preg_match('#date|timestamp#i', $ary_type[$i]))
- {
- if (empty($str_val))
- {
- $str_quote = '';
- }
- else
- {
- $str_quote = "'";
- }
- }
- else
- {
- $str_quote = '';
- $str_empty = 'NULL';
- }
-
- if (empty($str_val) && $str_val !== '0')
- {
- $str_val = $str_empty;
- }
-
- $schema_vals[$i] = $str_quote . $str_val . $str_quote;
- $schema_fields[$i] = "'" . $ary_name[$i] . "'";
- }
-
- // Take the ordered fields and their associated data and build it
- // into a valid sql statement to recreate that field in the data.
- $sql_data .= "INSERT INTO $table_name (" . implode(', ', $schema_fields) . ') VALUES (' . implode(', ', $schema_vals) . ");\n";
-
- if ($store == true)
- {
- $write($fp, $sql_data);
- }
-
- if ($download == true)
- {
- fwrite($fh, $sql_data);
- }
-
- $sql_data = '';
-
- }
- $db->sql_freeresult($result);
- break;
-
- case 'oracle':
- $ary_type = $ary_name = array();
-
- // Grab all of the data from current table.
- $sql = "SELECT *
- FROM $table_name";
- $result = $db->sql_query($sql);
-
- $i_num_fields = ocinumcols($result);
-
- for ($i = 0; $i < $i_num_fields; $i++)
- {
- $ary_type[$i] = ocicolumntype($result, $i + 1);
- $ary_name[$i] = ocicolumnname($result, $i + 1);
- }
-
- while ($row = $db->sql_fetchrow($result))
- {
- $schema_vals = $schema_fields = array();
-
- // Build the SQL statement to recreate the data.
- for ($i = 0; $i < $i_num_fields; $i++)
- {
- $str_val = $row[$ary_name[$i]];
-
- if (preg_match('#char|text|bool|raw#i', $ary_type[$i]))
- {
- $str_quote = "'";
- $str_empty = '';
- $str_val = addslashes($str_val);
- }
- else if (preg_match('#date|timestamp#i', $ary_type[$i]))
- {
- if (empty($str_val))
- {
- $str_quote = '';
- }
- else
- {
- $str_quote = "'";
- }
- }
- else
- {
- $str_quote = '';
- $str_empty = 'NULL';
- }
-
- if (empty($str_val) && $str_val !== '0')
- {
- $str_val = $str_empty;
- }
-
- $schema_vals[$i] = $str_quote . $str_val . $str_quote;
- $schema_fields[$i] = '"' . $ary_name[$i] . "'";
- }
-
- // Take the ordered fields and their associated data and build it
- // into a valid sql statement to recreate that field in the data.
- $sql_data .= "INSERT INTO $table_name (" . implode(', ', $schema_fields) . ') VALUES (' . implode(', ', $schema_vals) . ");\n";
-
- if ($store == true)
- {
- $write($fp, $sql_data);
- }
-
- if ($download == true)
- {
- fwrite($fh, $sql_data);
- }
-
- $sql_data = '';
-
- }
- $db->sql_freeresult($result);
- break;
- }
+ $extractor->write_data($table_name);
}
}
- switch ($db->sql_layer)
- {
- case 'sqlite':
- case 'postgres':
- $sql_data .= "COMMIT;";
- break;
-
- case 'mssql':
- case 'mssql_odbc':
- $sql_data .= "COMMIT\nGO";
- break;
- }
-
- if ($store == true)
- {
- $write($fp, $sql_data);
- $close($fp);
- }
+ $extractor->write_end($table_name);
if ($download == true)
{
- fwrite($fh, $sql_data);
- fclose($fh);
exit;
}
- unset($sql_data);
-
add_log('admin', 'LOG_DB_BACKUP');
trigger_error($user->lang['BACKUP_SUCCESS'] . adm_back_link($this->u_action));
break;
@@ -1120,18 +307,6 @@ class acp_database
trigger_error($user->lang['BACKUP_DELETE'] . adm_back_link($this->u_action));
}
- $data = file_get_contents($file_name);
-
- switch ($matches[1])
- {
- case 'sql.bz2':
- $data = bzdecompress($data);
- break;
- case 'sql.gz':
- $data = gzinflate(substr($data, 10));
- break;
- }
-
$download = request_var('download', '');
if ($download)
@@ -1154,58 +329,112 @@ class acp_database
header('Pragma: no-cache');
header("Content-Type: $mimetype; name=\"$name\"");
header("Content-disposition: attachment; filename=$name");
- echo $data;
- die;
+
+ @set_time_limit(0);
+
+ $fp = @fopen($file_name, 'rb');
+
+ if ($fp !== false)
+ {
+ while (!feof($fp))
+ {
+ echo fread($fp, 8192);
+ }
+ fclose($fp);
+ }
+
+ flush();
+ exit;
}
- if (!empty($data))
+ switch ($matches[1])
{
- // Strip out sql comments...
- remove_remarks($data);
+ case 'sql':
+ $fp = fopen($file_name, 'rb');
+ $read = 'fread';
+ $seek = 'fseek';
+ $eof = 'feof';
+ $close = 'fclose';
+ break;
- // SQLite gets improved performance when you shove all of these disk write queries at once :D
- if ($db->sql_layer == 'sqlite')
- {
- $db->sql_query($data);
- }
- else
- {
- switch ($db->sql_layer)
+ case 'sql.bz2':
+ $fp = bzopen($file_name, 'r');
+ $read = 'bzread';
+ $seek = 'bzseek';
+ $eof = 'feof';
+ $close = 'bzclose';
+ break;
+
+ case 'sql.gz':
+ $fp = gzopen($file_name, 'rb');
+ $read = 'gzread';
+ $seek = 'gzseek';
+ $eof = 'gzeof';
+ $close = 'gzclose';
+ break;
+ }
+
+ switch ($db->sql_layer)
+ {
+ case 'mysql':
+ case 'mysql4':
+ case 'mysqli':
+ case 'sqlite':
+ while (!$eof($fp))
{
- case 'firebird':
- $delim = ';;';
- break;
-
- case 'mysql':
- case 'mysql4':
- case 'mysqli':
- case 'postgres':
- $delim = ';';
- break;
-
- case 'oracle':
- $delim = '/';
- break;
-
- case 'mssql':
- case 'mssql_odbc':
- $delim = 'GO';
- break;
+ $db->sql_query(fgetd($fp, ";\n", $read, $seek, $eof));
}
- $pieces = split_sql_file($data, $delim);
+ break;
- $sql_count = count($pieces);
- for ($i = 0; $i < $sql_count; $i++)
+ case 'firebird':
+ $delim = ";\n";
+ while (!$eof($fp))
{
- $sql = trim($pieces[$i]);
-
- if (!empty($sql) && $sql[0] != '#')
+ $query = trim(fgetd($fp, $delim, $read, $seek, $eof));
+ if (substr($query, 0, 8) === 'SET TERM')
{
- $db->sql_query($sql);
+ $delim = $query[9] . "\n";
+ continue;
+ }
+ $db->sql_query($query);
+ }
+ break;
+
+ case 'postgres':
+ while (!$eof($fp))
+ {
+ $query = trim(fgetd($fp, ";\n", $read, $seek, $eof));
+ $db->sql_query($query);
+ if (substr($query, 0, 4) == 'COPY')
+ {
+ while (($sub = fgetd($fp, "\n", $read, $seek, $eof)) !== '\.')
+ {
+ pg_put_line($db->db_connect_id, $sub . "\n");
+ }
+ pg_put_line($db->db_connect_id, "\\.\n");
+ pg_end_copy($db->db_connect_id);
}
}
- }
+ break;
+
+ case 'oracle':
+ while (!$eof($fp))
+ {
+ $db->sql_query(fgetd($fp, "/\n", $read, $seek, $eof));
+ }
+ break;
+
+ case 'mssql':
+ case 'mssql_odbc':
+ while (!$eof($fp))
+ {
+ $db->sql_query(fgetd($fp, "GO\n", $read, $seek, $eof));
+ }
+ break;
}
+
+ $close($fp);
+
add_log('admin', 'LOG_DB_RESTORE');
trigger_error($user->lang['RESTORE_SUCCESS'] . adm_back_link($this->u_action));
break;
@@ -1255,723 +484,1666 @@ class acp_database
break;
}
}
+}
- /**
- * Return table structure
- */
- function get_table_structure($table_name)
+class base_extractor
+{
+ var $fh;
+ var $fp;
+ var $write;
+ var $close;
+ var $store;
+ var $download;
+ var $time;
+
+ function base_extractor($download = false, $store = false, $format, $filename, $time)
{
- global $db, $domains_created;
- static $has_index_type;
-
- $sql_data = '';
-
- switch ($db->sql_layer)
+ $this->download = $download;
+ $this->store = $store;
+ $this->time = $time;
+ switch ($format)
{
- case 'mysqli':
- case 'mysql4':
- case 'mysql':
-
- if ($has_index_type === null)
- {
- if ($db->sql_layer === 'mysqli' || version_compare($db->mysql_version, '4.0.2', '>='))
- {
- $has_index_type = true;
- }
- else
- {
- $has_index_type = false;
- }
- }
-
- $sql_data .= "CREATE TABLE $table_name(\n";
- $rows = array();
-
- $sql = "SHOW FIELDS
- FROM $table_name";
- $result = $db->sql_query($sql);
-
- while ($row = $db->sql_fetchrow($result))
- {
- $line = ' ' . $row['Field'] . ' ' . $row['Type'];
-
- if (!is_null($row['Default']))
- {
- $line .= " DEFAULT '{$row['Default']}'";
- }
-
- if ($row['Null'] != 'YES')
- {
- $line .= ' NOT NULL';
- }
-
- if ($row['Extra'] != '')
- {
- $line .= ' ' . $row['Extra'];
- }
-
- $rows[] = $line;
- }
- $db->sql_freeresult($result);
-
- $sql = "SHOW KEYS
- FROM $table_name";
-
- $result = $db->sql_query($sql);
-
- $index = array();
- while ($row = $db->sql_fetchrow($result))
- {
- $kname = $row['Key_name'];
-
- if ($kname != 'PRIMARY')
- {
- if ($has_index_type && $row['Index_type'] == 'FULLTEXT')
- {
- $kname = "FULLTEXT|$kname";
- }
- else if ($row['Non_unique'] == 0)
- {
- $kname = "UNIQUE|$kname";
- }
- }
-
- if ($row['Sub_part'])
- {
- $row['Column_name'] .= '(' . $row['Sub_part'] . ')';
- }
- $index[$kname][] = $row['Column_name'];
- }
- $db->sql_freeresult($result);
-
- foreach ($index as $key => $columns)
- {
- $line = ' ';
-
- if ($key == 'PRIMARY')
- {
- $line .= 'PRIMARY KEY (' . implode(', ', $columns) . ')';
- }
- else if (strpos($key, 'UNIQUE') === 0)
- {
- $line .= 'UNIQUE ' . substr($key, 7) . ' (' . implode(', ', $columns) . ')';
- }
- else if (strpos($key, 'FULLTEXT') === 0)
- {
- $line .= 'FULLTEXT ' . substr($key, 9) . ' (' . implode(', ', $columns) . ')';
- }
- else
- {
- $line .= "KEY $key (" . implode(', ', $columns) . ')';
- }
-
- $rows[] = $line;
- }
-
- $sql_data .= implode(",\n", $rows);
- $sql_data .= "\n)";
- if ($db->sql_layer == 'mysql4' || $db->sql_layer == 'mysqli')
- {
- $sql_data .= ' CHARACTER SET `utf8` COLLATE `utf8_bin`';
- }
- $sql_data .= ";\n\n";
-
+ case 'text':
+ $ext = '.sql';
+ $open = 'fopen';
+ $this->write = 'fwrite';
+ $this->close = 'fclose';
+ $mimetype = 'text/x-sql';
break;
-
- case 'sqlite':
-
- $sql = "SELECT sql
- FROM sqlite_master
- WHERE type = 'table'
- AND name = '" . $db->sql_escape($table_name) . "'
- ORDER BY type DESC, name;";
- $result = $db->sql_query($sql);
- $row = $db->sql_fetchrow($result);
- $db->sql_freeresult($result);
-
- // Create Table
- $sql_data .= $row['sql'] . "\n";
-
- $result = $db->sql_query("PRAGMA index_list('" . $db->sql_escape($table_name) . "');");
-
- $ar = array();
- while ($row = $db->sql_fetchrow($result))
- {
- $ar[] = $row;
- }
- $db->sql_freeresult($result);
-
- foreach ($ar as $value)
- {
- if (strpos($value['name'], 'autoindex') !== false)
- {
- continue;
- }
-
- $result = $db->sql_query("PRAGMA index_info('" . $db->sql_escape($value['name']) . "');");
-
- $fields = array();
- while ($row = $db->sql_fetchrow($result))
- {
- $fields[] = $row['name'];
- }
- $db->sql_freeresult($result);
-
- $sql_data .= 'CREATE ' . ($value['unique'] ? 'UNIQUE ' : '') . 'INDEX ' . $value['name'] . ' on ' . $table_name . ' (' . implode(', ', $fields) . ");\n";
- }
-
- $sql_data .= "\n";
+ case 'bzip2':
+ $ext = '.sql.bz2';
+ $open = 'bzopen';
+ $this->write = 'bzwrite';
+ $this->close = 'bzclose';
+ $mimetype = 'application/x-bzip2';
break;
-
- case 'postgres':
- if (empty($domains_created))
- {
- $domains_created = array();
- }
-
- $sql = "SELECT a.domain_name, a.data_type, a.character_maximum_length, a.domain_default
- FROM INFORMATION_SCHEMA.domains a, INFORMATION_SCHEMA.column_domain_usage b
- WHERE a.domain_name = b.domain_name
- AND b.table_name = '{$table_name}'";
- $result = $db->sql_query($sql);
- while ($row = $db->sql_fetchrow($result))
- {
- if (empty($domains_created[$row['domain_name']]))
- {
- $domains_created[$row['domain_name']] = true;
- $sql_data .= "CREATE DOMAIN {$row['domain_name']} as {$row['data_type']}";
- if (!empty($row['character_maximum_length']))
- {
- $sql_data .= '(' . $row['character_maximum_length'] . ')';
- }
- $sql_data .= ' NOT NULL';
- if (!empty($row['domain_default']))
- {
- $sql_data .= 'DEFAULT ' . $row['domain_default'];
- }
- $sql_data .= ";\n";
- }
- }
-
- // PGSQL does not "tightly" bind sequences and tables, we must guess...
- $sql = "SELECT relname
- FROM pg_class
- WHERE relkind = 'S'
- AND relname = '{$table_name}_seq'";
- $result = $db->sql_query($sql);
- // We don't even care about storing the results. We already know the answer if we get rows back.
- if ($db->sql_fetchrow($result))
- {
- $sql_data .= "DROP SEQUENCE {$table_name}_seq;\n";
- $sql_data .= "CREATE SEQUENCE {$table_name}_seq;\n";
- }
- $db->sql_freeresult($result);
-
- $field_query = "SELECT a.attnum, a.attname as field, t.typname as type, a.attlen as length, a.atttypmod as lengthvar, a.attnotnull as notnull
- FROM pg_class c, pg_attribute a, pg_type t
- WHERE c.relname = '" . $db->sql_escape($table_name) . "'
- AND a.attnum > 0
- AND a.attrelid = c.oid
- AND a.atttypid = t.oid
- ORDER BY a.attnum";
- $result = $db->sql_query($field_query);
-
- $sql_data .= "CREATE TABLE $table_name(\n";
- $lines = array();
- while ($row = $db->sql_fetchrow($result))
- {
- // Get the data from the table
- $sql_get_default = "SELECT pg_get_expr(d.adbin, d.adrelid) as rowdefault
- FROM pg_attrdef d, pg_class c
- WHERE (c.relname = '" . $db->sql_escape($table_name) . "')
- AND (c.oid = d.adrelid)
- AND d.adnum = " . $row['attnum'];
- $def_res = $db->sql_query($sql_get_default);
-
- if (!$def_res)
- {
- unset($row['rowdefault']);
- }
- else
- {
- $row['rowdefault'] = $db->sql_fetchfield('rowdefault', false, $def_res);
- }
- $db->sql_freeresult($def_res);
-
- if ($row['type'] == 'bpchar')
- {
- // Internally stored as bpchar, but isn't accepted in a CREATE TABLE statement.
- $row['type'] = 'char';
- }
-
- $line = ' ' . $row['field'] . ' ' . $row['type'];
-
- if (strpos($row['type'], 'char') !== false)
- {
- if ($row['lengthvar'] > 0)
- {
- $line .= '(' . ($row['lengthvar'] - 4) . ')';
- }
- }
-
- if (strpos($row['type'], 'numeric') !== false)
- {
- $line .= '(';
- $line .= sprintf("%s,%s", (($row['lengthvar'] >> 16) & 0xffff), (($row['lengthvar'] - 4) & 0xffff));
- $line .= ')';
- }
-
- if (!empty($row['rowdefault']))
- {
- $line .= ' DEFAULT ' . $row['rowdefault'];
- }
-
- if ($row['notnull'] == 't')
- {
- $line .= ' NOT NULL';
- }
-
- $lines[] = $line;
- }
- $db->sql_freeresult($result);
-
-
- // Get the listing of primary keys.
- $sql_pri_keys = "SELECT ic.relname as index_name, bc.relname as tab_name, ta.attname as column_name, i.indisunique as unique_key, i.indisprimary as primary_key
- FROM pg_class bc, pg_class ic, pg_index i, pg_attribute ta, pg_attribute ia
- WHERE (bc.oid = i.indrelid)
- AND (ic.oid = i.indexrelid)
- AND (ia.attrelid = i.indexrelid)
- AND (ta.attrelid = bc.oid)
- AND (bc.relname = '" . $db->sql_escape($table_name) . "')
- AND (ta.attrelid = i.indrelid)
- AND (ta.attnum = i.indkey[ia.attnum-1])
- ORDER BY index_name, tab_name, column_name";
-
- $result = $db->sql_query($sql_pri_keys);
-
- $index_create = $index_rows = $primary_key = array();
-
- // We do this in two steps. It makes placing the comma easier
- while ($row = $db->sql_fetchrow($result))
- {
- if ($row['primary_key'] == 't')
- {
- $primary_key[] = $row['column_name'];
- $primary_key_name = $row['index_name'];
- }
- else
- {
- // We have to store this all this info because it is possible to have a multi-column key...
- // we can loop through it again and build the statement
- $index_rows[$row['index_name']]['table'] = $table_name;
- $index_rows[$row['index_name']]['unique'] = ($row['unique_key'] == 't') ? true : false;
- $index_rows[$row['index_name']]['column_names'][] = $row['column_name'];
- }
- }
- $db->sql_freeresult($result);
-
- if (!empty($index_rows))
- {
- foreach ($index_rows as $idx_name => $props)
- {
- $index_create[] = 'CREATE ' . ($props['unique'] ? 'UNIQUE ' : '') . "INDEX $idx_name ON $table_name (" . implode(', ', $props['column_names']) . ");";
- }
- }
-
- if (!empty($primary_key))
- {
- $lines[] = " CONSTRAINT $primary_key_name PRIMARY KEY (" . implode(', ', $primary_key) . ")";
- }
-
- // Generate constraint clauses for CHECK constraints
- $sql_checks = "SELECT conname as index_name, consrc
- FROM pg_constraint, pg_class bc
- WHERE conrelid = bc.oid
- AND bc.relname = '" . $db->sql_escape($table_name) . "'
- AND NOT EXISTS (
- SELECT *
- FROM pg_constraint as c, pg_inherits as i
- WHERE i.inhrelid = pg_constraint.conrelid
- AND c.conname = pg_constraint.conname
- AND c.consrc = pg_constraint.consrc
- AND c.conrelid = i.inhparent
- )";
- $result = $db->sql_query($sql_checks);
-
- // Add the constraints to the sql file.
- while ($row = $db->sql_fetchrow($result))
- {
- if (!is_null($row['consrc']))
- {
- $lines[] = ' CONSTRAINT ' . $row['index_name'] . ' CHECK ' . $row['consrc'];
- }
- }
- $db->sql_freeresult($result);
-
- $sql_data .= implode(", \n", $lines);
- $sql_data .= "\n);\n";
-
- if (!empty($index_create))
- {
- $sql_data .= implode("\n", $index_create) . "\n\n";
- }
- break;
-
- case 'mssql':
- case 'mssql_odbc':
- $sql_data .= "\nCREATE TABLE [$table_name] (\n";
- $rows = array();
-
- $text_flag = false;
-
- $sql = "SELECT COLUMN_NAME, COLUMN_DEFAULT, IS_NULLABLE, DATA_TYPE, CHARACTER_MAXIMUM_LENGTH, COLUMNPROPERTY(object_id(TABLE_NAME), COLUMN_NAME, 'IsIdentity') as IS_IDENTITY
- FROM INFORMATION_SCHEMA.COLUMNS
- WHERE TABLE_NAME = '$table_name'";
- $result = $db->sql_query($sql);
-
- while ($row = $db->sql_fetchrow($result))
- {
- $line = "\t[{$row['COLUMN_NAME']}] [{$row['DATA_TYPE']}]";
-
- if ($row['DATA_TYPE'] == 'text')
- {
- $text_flag = true;
- }
-
- if ($row['IS_IDENTITY'])
- {
- $line .= ' IDENTITY (1 , 1)';
- }
-
- if ($row['CHARACTER_MAXIMUM_LENGTH'] && $row['DATA_TYPE'] !== 'text')
- {
- $line .= ' (' . $row['CHARACTER_MAXIMUM_LENGTH'] . ')';
- }
-
- if ($row['IS_NULLABLE'] == 'YES')
- {
- $line .= ' NULL';
- }
- else
- {
- $line .= ' NOT NULL';
- }
-
- if ($row['COLUMN_DEFAULT'])
- {
- $line .= ' DEFAULT ' . $row['COLUMN_DEFAULT'];
- }
-
- $rows[] = $line;
- }
- $db->sql_freeresult($result);
-
- $sql_data .= implode(",\n", $rows);
- $sql_data .= "\n) ON [PRIMARY]";
-
- if ($text_flag)
- {
- $sql_data .= " TEXTIMAGE_ON [PRIMARY]";
- }
-
- $sql_data .= "\nGO\n\n";
- $rows = array();
-
- $sql = "SELECT CONSTRAINT_NAME, COLUMN_NAME
- FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE
- WHERE TABLE_NAME = '$table_name'";
- $result = $db->sql_query($sql);
- while ($row = $db->sql_fetchrow($result))
- {
- if (!sizeof($rows))
- {
- $sql_data .= "ALTER TABLE [$table_name] WITH NOCHECK ADD\n";
- $sql_data .= "\tCONSTRAINT [{$row['CONSTRAINT_NAME']}] PRIMARY KEY CLUSTERED \n\t(\n";
- }
- $rows[] = "\t\t[{$row['COLUMN_NAME']}]";
- }
- if (sizeof($rows))
- {
- $sql_data .= implode(",\n", $rows);
- $sql_data .= "\n\t) ON [PRIMARY] \nGO\n";
- }
- $db->sql_freeresult($result);
-
- $index = array();
- $sql = "EXEC sp_statistics '$table_name'";
- $result = $db->sql_query($sql);
- while ($row = $db->sql_fetchrow($result))
- {
- if ($row['TYPE'] == 3)
- {
- $index[$row['INDEX_NAME']][] = '[' . $row['COLUMN_NAME'] . ']';
- }
- }
- $db->sql_freeresult($result);
-
- foreach ($index as $index_name => $column_name)
- {
- $index[$index_name] = implode(', ', $index[$index_name]);
- }
-
- foreach ($index as $index_name => $columns)
- {
- $sql_data .= "\nCREATE INDEX [$index_name] ON [$table_name]($columns) ON [PRIMARY]\nGO\n";
- }
- break;
-
- case 'firebird':
-
- $data_types = array(7 => 'SMALLINT', 8 => 'INTEGER', 10 => 'FLOAT', 12 => 'DATE', 13 => 'TIME', 14 => 'CHARACTER', 27 => 'DOUBLE PRECISION', 35 => 'TIMESTAMP', 37 => 'VARCHAR', 40 => 'CSTRING', 261 => 'BLOB', 701 => 'DECIMAL', 702 => 'NUMERIC');
-
- $sql_data .= "\nCREATE TABLE $table_name (\n";
-
- $sql = 'SELECT DISTINCT R.RDB$FIELD_NAME as FNAME, R.RDB$NULL_FLAG as NFLAG, R.RDB$DEFAULT_SOURCE as DSOURCE, F.RDB$FIELD_TYPE as FTYPE, F.RDB$FIELD_SUB_TYPE as STYPE, F.RDB$FIELD_LENGTH as FLEN
- FROM RDB$RELATION_FIELDS R
- JOIN RDB$FIELDS F ON R.RDB$FIELD_SOURCE=F.RDB$FIELD_NAME
- LEFT JOIN RDB$FIELD_DIMENSIONS D ON R.RDB$FIELD_SOURCE = D.RDB$FIELD_NAME
- WHERE F.RDB$SYSTEM_FLAG = 0
- AND R.RDB$RELATION_NAME = \''. $table_name . '\'
- ORDER BY R.RDB$FIELD_POSITION';
- $result = $db->sql_query($sql);
-
- $rows = array();
- while ($row = $db->sql_fetchrow($result))
- {
- $line = "\t" . '"' . $row['fname'] . '" ' . $data_types[$row['ftype']];
-
- if ($row['ftype'] == 261 && $row['stype'] == 1)
- {
- $line .= ' SUB_TYPE TEXT';
- }
-
- if ($row['ftype'] == 37 || $row['ftype'] == 14)
- {
- $line .= ' (' . $row['flen'] . ')';
- }
-
- if (!empty($row['dsource']))
- {
- $line .= ' ' . $row['dsource'];
- }
-
- if (!empty($row['nflag']))
- {
- $line .= ' NOT NULL';
- }
- $rows[] = $line;
- }
- $db->sql_freeresult($result);
-
- $sql_data .= implode(",\n", $rows);
- $sql_data .= "\n);;\n";
- $keys = array();
-
- $sql = 'SELECT I.RDB$FIELD_NAME as NAME
- FROM RDB$RELATION_CONSTRAINTS RC, RDB$INDEX_SEGMENTS I, RDB$INDICES IDX
- WHERE (I.RDB$INDEX_NAME = RC.RDB$INDEX_NAME)
- AND (IDX.RDB$INDEX_NAME = RC.RDB$INDEX_NAME)
- AND (RC.RDB$RELATION_NAME = \''. $table_name . '\')
- ORDER BY I.RDB$FIELD_POSITION';
- $result = $db->sql_query($sql);
-
- while ($row = $db->sql_fetchrow($result))
- {
- $keys[] = $row['name'];
- }
-
- if (sizeof($keys))
- {
- $sql_data .= "\nALTER TABLE $table_name ADD PRIMARY KEY (" . implode(', ', $keys) . ');;';
- }
-
- $db->sql_freeresult($result);
-
- $sql = 'SELECT I.RDB$INDEX_NAME as INAME, I.RDB$UNIQUE_FLAG as UFLAG, S.RDB$FIELD_NAME as FNAME
- FROM RDB$INDICES I JOIN RDB$INDEX_SEGMENTS S ON S.RDB$INDEX_NAME=I.RDB$INDEX_NAME
- WHERE (I.RDB$SYSTEM_FLAG IS NULL OR I.RDB$SYSTEM_FLAG=0)
- AND I.RDB$FOREIGN_KEY IS NULL
- AND I.RDB$RELATION_NAME = \''. $table_name . '\'
- AND I.RDB$INDEX_NAME NOT STARTING WITH \'RDB$\'
- ORDER BY S.RDB$FIELD_POSITION';
- $result = $db->sql_query($sql);
-
- $index = array();
- while ($row = $db->sql_fetchrow($result))
- {
- $index[$row['iname']]['unique'] = !empty($row['uflag']);
- $index[$row['iname']]['values'][] = $row['fname'];
- }
-
- foreach ($index as $index_name => $data)
- {
- $sql_data .= "\nCREATE ";
- if ($data['unique'])
- {
- $sql_data .= 'UNIQUE ';
- }
- $sql_data .= "INDEX $index_name ON $table_name(" . implode(', ', $data['values']) . ");;";
- }
- $sql_data .= "\n";
-
- $db->sql_freeresult($result);
-
- $sql = 'SELECT D1.RDB$DEPENDENT_NAME as DNAME, D1.RDB$FIELD_NAME as FNAME, D1.RDB$DEPENDENT_TYPE, R1.RDB$RELATION_NAME
- FROM RDB$DEPENDENCIES D1
- LEFT JOIN RDB$RELATIONS R1 ON ((D1.RDB$DEPENDENT_NAME = R1.RDB$RELATION_NAME) AND (NOT (R1.RDB$VIEW_BLR IS NULL)))
- WHERE (D1.RDB$DEPENDED_ON_TYPE = 0)
- AND (D1.RDB$DEPENDENT_TYPE <> 3)
- AND (D1.RDB$DEPENDED_ON_NAME = \'' . $table_name . '\')
- UNION SELECT DISTINCT F2.RDB$RELATION_NAME, D2.RDB$FIELD_NAME, D2.RDB$DEPENDENT_TYPE, R2.RDB$RELATION_NAME FROM RDB$DEPENDENCIES D2, RDB$RELATION_FIELDS F2
- LEFT JOIN RDB$RELATIONS R2 ON ((F2.RDB$RELATION_NAME = R2.RDB$RELATION_NAME) AND (NOT (R2.RDB$VIEW_BLR IS NULL)))
- WHERE (D2.RDB$DEPENDENT_TYPE = 3)
- AND (D2.RDB$DEPENDENT_NAME = F2.RDB$FIELD_SOURCE)
- AND (D2.RDB$DEPENDED_ON_NAME = \'' . $table_name . '\')
- ORDER BY 1, 2';
- $result = $db->sql_query($sql);
- while ($row = $db->sql_fetchrow($result))
- {
- $sql = 'SELECT T1.RDB$DEPENDED_ON_NAME as GEN, T1.RDB$FIELD_NAME, T1.RDB$DEPENDED_ON_TYPE
- FROM RDB$DEPENDENCIES T1
- WHERE (T1.RDB$DEPENDENT_NAME = \'' . $row['dname'] . '\')
- AND (T1.RDB$DEPENDENT_TYPE = 2 AND T1.RDB$DEPENDED_ON_TYPE = 14)
- UNION ALL SELECT DISTINCT D.RDB$DEPENDED_ON_NAME, D.RDB$FIELD_NAME, D.RDB$DEPENDED_ON_TYPE
- FROM RDB$DEPENDENCIES D, RDB$RELATION_FIELDS F
- WHERE (D.RDB$DEPENDENT_TYPE = 3)
- AND (D.RDB$DEPENDENT_NAME = F.RDB$FIELD_SOURCE)
- AND (F.RDB$RELATION_NAME = \'' . $row['dname'] . '\')
- ORDER BY 1,2';
- $result2 = $db->sql_query($sql);
- $row2 = $db->sql_fetchrow($result2);
- $db->sql_freeresult($result2);
- $gen_name = $row2['gen'];
-
- $sql_data .= "\nCREATE GENERATOR " . $gen_name . ";;";
- $sql_data .= "\nSET GENERATOR " . $gen_name . " TO 0;;\n";
- $sql_data .= "\nCREATE TRIGGER {$row['dname']} FOR $table_name";
- $sql_data .= "\nBEFORE INSERT\nAS\nBEGIN";
- $sql_data .= "\n NEW.{$row['fname']} = GEN_ID(" . $gen_name . ", 1);";
- $sql_data .= "\nEND;;\n";
- }
-
- $db->sql_freeresult($result);
- break;
-
- case 'oracle':
- $sql_data .= "\nCREATE TABLE $table_name (\n";
-
- $sql = "SELECT COLUMN_NAME, DATA_TYPE, DATA_PRECISION, DATA_LENGTH, NULLABLE, DATA_DEFAULT
- FROM ALL_TAB_COLS
- WHERE table_name = '{$table_name}'";
- $result = $db->sql_query($sql);
-
- $rows = array();
- while ($row = $db->sql_fetchrow($result))
- {
- $line = ' "' . $row['column_name'] . '" ' . $row['data_type'];
-
- if ($row['data_type'] !== 'CLOB')
- {
- if ($row['data_type'] !== 'VARCHAR2')
- {
- $line .= '(' . $row['data_precision'] . ')';
- }
- else
- {
- $line .= '(' . $row['data_length'] . ')';
- }
- }
-
- if (!empty($row['data_default']))
- {
- $line .= ' DEFAULT ' . $row['data_default'];
- }
-
- if ($row['nullable'] == 'N')
- {
- $line .= ' NOT NULL';
- }
- $rows[] = $line;
- }
- $db->sql_freeresult($result);
-
- $sql = "SELECT A.CONSTRAINT_NAME, A.COLUMN_NAME
- FROM USER_CONS_COLUMNS A, USER_CONSTRAINTS B
- WHERE A.CONSTRAINT_NAME = B.CONSTRAINT_NAME
- AND B.CONSTRAINT_TYPE = 'P'
- AND A.TABLE_NAME = '{$table_name}'";
- $result = $db->sql_query($sql);
-
- while ($row = $db->sql_fetchrow($result))
- {
- $rows[] = " CONSTRAINT {$row['constraint_name']} PRIMARY KEY ({$row['column_name']})";
- }
- $db->sql_freeresult($result);
-
- $sql = "SELECT A.CONSTRAINT_NAME, A.COLUMN_NAME
- FROM USER_CONS_COLUMNS A, USER_CONSTRAINTS B
- WHERE A.CONSTRAINT_NAME = B.CONSTRAINT_NAME
- AND B.CONSTRAINT_TYPE = 'U'
- AND A.TABLE_NAME = '{$table_name}'";
- $result = $db->sql_query($sql);
-
- while ($row = $db->sql_fetchrow($result))
- {
- $rows[] = " CONSTRAINT {$row['constraint_name']} UNIQUE ({$row['column_name']})";
- }
- $db->sql_freeresult($result);
-
- $sql_data .= implode(",\n", $rows);
- $sql_data .= "\n)\n\\";
-
- $sql = "SELECT A.REFERENCED_NAME
- FROM USER_DEPENDENCIES A, USER_TRIGGERS B
- WHERE A.REFERENCED_TYPE = 'SEQUENCE'
- AND A.NAME = B.TRIGGER_NAME
- AND B. TABLE_NAME = '{$table_name}'";
- $result = $db->sql_query($sql);
- while ($row = $db->sql_fetchrow($result))
- {
- $sql_data .= "\nCREATE SEQUENCE {$row['referenced_name']}\\\n";
- }
- $db->sql_freeresult($result);
-
- $sql = "SELECT DESCRIPTION, WHEN_CLAUSE, TRIGGER_BODY
- FROM USER_TRIGGERS
- WHERE TABLE_NAME = '{$table_name}'";
- $result = $db->sql_query($sql);
- while ($row = $db->sql_fetchrow($result))
- {
- $sql_data .= "\nCREATE OR REPLACE TRIGGER {$row['description']}WHEN ({$row['when_clause']})\n{$row['trigger_body']}\\";
- }
- $db->sql_freeresult($result);
-
- $sql = "SELECT A.INDEX_NAME, B.COLUMN_NAME
- FROM USER_INDEXES A, USER_IND_COLUMNS B
- WHERE A.UNIQUENESS = 'NONUNIQUE'
- AND A.INDEX_NAME = B.INDEX_NAME
- AND B.TABLE_NAME = '{$table_name}'";
- $result = $db->sql_query($sql);
-
- $index = array();
-
- while ($row = $db->sql_fetchrow($result))
- {
- $index[$row['index_name']][] = $row['column_name'];
- }
-
- foreach ($index as $index_name => $column_names)
- {
- $sql_data .= "\nCREATE INDEX $index_name ON $table_name(" . implode(', ', $column_names) . ")\n\\";
- }
- $db->sql_freeresult($result);
-
+ case 'gzip':
+ $ext = '.sql.gz';
+ $open = 'gzopen';
+ $this->write = 'gzwrite';
+ $this->close = 'gzclose';
+ $mimetype = 'application/x-gzip';
break;
}
- return $sql_data;
+ if ($download == true)
+ {
+ $this->fh = fopen('php://output', 'wb');
+
+ $name = $filename . $ext;
+ header('Pragma: no-cache');
+ header("Content-Type: $mimetype; name=\"$name\"");
+ header("Content-disposition: attachment; filename=$name");
+
+ switch ($format)
+ {
+ case 'bzip2':
+ ob_start('ob_bz2handler');
+ break;
+ case 'gzip':
+ ob_start('ob_gzhandler');
+ break;
+ }
+ }
+
+ if ($store == true)
+ {
+ global $phpbb_root_path;
+ $file = $phpbb_root_path . 'store/' . $filename . $ext;
+
+ $this->fp = $open($file, 'w');
+
+ if (!$this->fp)
+ {
+ trigger_error('Unable to write temporary file to storage folder', E_USER_ERROR);
+ }
+ }
}
+
+ function write_end()
+ {
+ static $close;
+ if ($this->store)
+ {
+ if ($close === null)
+ {
+ $close = $this->close;
+ }
+ $close($this->fp);
+ }
+
+ if ($this->download)
+ {
+ fclose($this->fh);
+ }
+ }
+
+ function flush($data)
+ {
+ static $write;
+ if ($this->store === true)
+ {
+ if ($write === null)
+ {
+ $write = $this->write;
+ }
+ $write($this->fp, $data);
+ }
+
+ if ($this->download === true)
+ {
+ fwrite($this->fh, $data);
+ }
+ }
+}
+
+class mysql_extractor extends base_extractor
+{
+ function write_start($table_prefix)
+ {
+ $sql_data = "#\n";
+ $sql_data .= "# phpBB Backup Script\n";
+ $sql_data .= "# Dump of tables for $table_prefix\n";
+ $sql_data .= "# DATE : " . gmdate("d-m-Y H:i:s", $this->time) . " GMT\n";
+ $sql_data .= "#\n";
+ $this->flush($sql_data);
+ }
+
+ function write_table($table_name)
+ {
+ global $db;
+ static $new_extract;
+
+ if ($new_extract === null)
+ {
+ $new_extract = version_compare($db->mysql_version, '3.23.20', '>=');
+ }
+
+ if ($new_extract)
+ {
+ $this->new_write_table($table_name);
+ }
+ else
+ {
+ $this->old_write_table($table_name);
+ }
+ }
+
+ function write_data($table_name)
+ {
+ global $db;
+ if ($db->sql_layer === 'mysqli')
+ {
+ $this->write_data_mysqli($table_name);
+ }
+ else
+ {
+ $this->write_data_mysql($table_name);
+ }
+ }
+
+ function write_data_mysqli($table_name)
+ {
+ global $db;
+ $sql = "SELECT *
+ FROM $table_name";
+ $result = mysqli_query($db->db_connect_id, $sql, MYSQLI_USE_RESULT);
+ if ($result != false)
+ {
+ $fields_cnt = mysqli_num_fields($result);
+
+ // Get field information
+ $field = mysqli_fetch_fields($result);
+ $field_set = array();
+
+ for ($j = 0; $j < $fields_cnt; $j++)
+ {
+ $field_set[] = $field[$j]->name;
+ }
+
+ $search = array("\\", "'", "\x00", "\x0a", "\x0d", "\x1a", '"');
+ $replace = array("\\\\", "\\'", '\0', '\n', '\r', '\Z', '\\"');
+ $fields = implode(', ', $field_set);
+ $sql_data = 'INSERT INTO ' . $table_name . ' (' . $fields . ') VALUES ';
+ $first_set = true;
+
+ while ($row = mysqli_fetch_row($result))
+ {
+ $values = array();
+ if ($first_set)
+ {
+ $sql_data .= '(';
+ }
+ else
+ {
+ $sql_data .= ',(';
+ }
+
+ for ($j = 0; $j < $fields_cnt; $j++)
+ {
+ if (!isset($row[$j]) || is_null($row[$j]))
+ {
+ $values[$j] = 'NULL';
+ }
+ else if (($field[$j]->flags & 32768) && !($field[$j]->flags & 1024))
+ {
+ $values[$j] = $row[$j];
+ }
+ else
+ {
+ $values[$j] = "'" . str_replace($search, $replace, $row[$j]) . "'";
+ }
+ }
+ $sql_data .= implode(', ', $values) . ')';
+
+ $this->flush($sql_data);
+
+ $sql_data = '';
+ $first_set = false;
+ }
+ mysqli_free_result($result);
+
+ if (!$first_set)
+ {
+ $this->flush(";\n\n");
+ }
+ }
+ }
+
+ function write_data_mysql($table_name)
+ {
+ global $db;
+ $sql = "SELECT *
+ FROM $table_name";
+ $result = mysql_unbuffered_query($sql, $db->db_connect_id);
+
+ if ($result != false)
+ {
+ $fields_cnt = mysql_num_fields($result);
+
+ // Get field information
+ $field = array();
+ for ($i = 0; $i < $fields_cnt; $i++)
+ {
+ $field[] = mysql_fetch_field($result, $i);
+ }
+ $field_set = array();
+
+ for ($j = 0; $j < $fields_cnt; $j++)
+ {
+ $field_set[] = $field[$j]->name;
+ }
+
+ $search = array("\\", "'", "\x00", "\x0a", "\x0d", "\x1a", '"');
+ $replace = array("\\\\", "\\'", '\0', '\n', '\r', '\Z', '\\"');
+ $fields = implode(', ', $field_set);
+ $sql_data = 'INSERT INTO ' . $table_name . ' (' . $fields . ') VALUES ';
+
+ $first_set = true;
+
+ while ($row = mysql_fetch_row($result))
+ {
+ $values = array();
+ if ($first_set)
+ {
+ $sql_data .= '(';
+ }
+ else
+ {
+ $sql_data .= ',(';
+ }
+
+ for ($j = 0; $j < $fields_cnt; $j++)
+ {
+ if (!isset($row[$j]) || is_null($row[$j]))
+ {
+ $values[$j] = 'NULL';
+ }
+ else if ($field[$j]->numeric && ($field[$j]->type !== 'timestamp'))
+ {
+ $values[$j] = $row[$j];
+ }
+ else
+ {
+ $values[$j] = "'" . str_replace($search, $replace, $row[$j]) . "'";
+ }
+ }
+ $sql_data .= implode(', ', $values) . ')';
+
+ $this->flush($sql_data);
+
+ $sql_data = '';
+ $first_set = false;
+ }
+ mysql_free_result($result);
+
+ if (!$first_set)
+ {
+ $this->flush(";\n\n");
+ }
+ }
+ }
+
+ function new_write_table($table_name)
+ {
+ global $db;
+
+ $sql = 'SHOW CREATE TABLE ' . $table_name;
+ $result = $db->sql_query($sql);
+ $row = $db->sql_fetchrow($result);
+
+ $sql_data = '# Table: ' . $table_name . "\n";
+ $sql_data .= "DROP TABLE IF EXISTS $table_name;\n";
+ $this->flush($sql_data . $row['Create Table'] . ";\n\n");
+
+ $db->sql_freeresult($result);
+ }
+
+ function old_write_table($table_name)
+ {
+ global $db;
+
+ $sql_data = '# Table: ' . $table_name . "\n";
+ $sql_data .= "DROP TABLE IF EXISTS $table_name;\n";
+ $sql_data .= "CREATE TABLE $table_name(\n";
+ $rows = array();
+
+ $sql = "SHOW FIELDS
+ FROM $table_name";
+ $result = $db->sql_query($sql);
+
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $line = ' ' . $row['Field'] . ' ' . $row['Type'];
+
+ if (!is_null($row['Default']))
+ {
+ $line .= " DEFAULT '{$row['Default']}'";
+ }
+
+ if ($row['Null'] != 'YES')
+ {
+ $line .= ' NOT NULL';
+ }
+
+ if ($row['Extra'] != '')
+ {
+ $line .= ' ' . $row['Extra'];
+ }
+
+ $rows[] = $line;
+ }
+ $db->sql_freeresult($result);
+
+ $sql = "SHOW KEYS
+ FROM $table_name";
+
+ $result = $db->sql_query($sql);
+
+ $index = array();
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $kname = $row['Key_name'];
+
+ if ($kname != 'PRIMARY')
+ {
+ if ($row['Non_unique'] == 0)
+ {
+ $kname = "UNIQUE|$kname";
+ }
+ }
+
+ if ($row['Sub_part'])
+ {
+ $row['Column_name'] .= '(' . $row['Sub_part'] . ')';
+ }
+ $index[$kname][] = $row['Column_name'];
+ }
+ $db->sql_freeresult($result);
+
+ foreach ($index as $key => $columns)
+ {
+ $line = ' ';
+
+ if ($key == 'PRIMARY')
+ {
+ $line .= 'PRIMARY KEY (' . implode(', ', $columns) . ')';
+ }
+ else if (strpos($key, 'UNIQUE') === 0)
+ {
+ $line .= 'UNIQUE ' . substr($key, 7) . ' (' . implode(', ', $columns) . ')';
+ }
+ else if (strpos($key, 'FULLTEXT') === 0)
+ {
+ $line .= 'FULLTEXT ' . substr($key, 9) . ' (' . implode(', ', $columns) . ')';
+ }
+ else
+ {
+ $line .= "KEY $key (" . implode(', ', $columns) . ')';
+ }
+
+ $rows[] = $line;
+ }
+
+ $sql_data .= implode(",\n", $rows);
+ $sql_data .= "\n);\n\n";
+
+ $this->flush($sql_data);
+ }
+}
+
+class sqlite_extractor extends base_extractor
+{
+ function write_start($prefix)
+ {
+ $sql_data = "--\n";
+ $sql_data .= "-- phpBB Backup Script\n";
+ $sql_data .= "-- Dump of tables for $prefix\n";
+ $sql_data .= "-- DATE : " . gmdate("d-m-Y H:i:s", $this->time) . " GMT\n";
+ $sql_data .= "--\n";
+ $sql_data .= "BEGIN TRANSACTION;\n";
+ $this->flush($sql_data);
+ }
+
+ function write_table($table_name)
+ {
+ global $db;
+ $sql_data = '-- Table: ' . $table_name . "\n";
+ $sql_data .= "DROP TABLE $table_name;\n";
+
+ $sql = "SELECT sql
+ FROM sqlite_master
+ WHERE type = 'table'
+ AND name = '" . $db->sql_escape($table_name) . "'
+ ORDER BY type DESC, name;";
+ $result = $db->sql_query($sql);
+ $row = $db->sql_fetchrow($result);
+ $db->sql_freeresult($result);
+
+ // Create Table
+ $sql_data .= $row['sql'] . ";\n";
+
+ $result = $db->sql_query("PRAGMA index_list('" . $db->sql_escape($table_name) . "');");
+
+ $ar = array();
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $ar[] = $row;
+ }
+ $db->sql_freeresult($result);
+
+ foreach ($ar as $value)
+ {
+ if (strpos($value['name'], 'autoindex') !== false)
+ {
+ continue;
+ }
+
+ $result = $db->sql_query("PRAGMA index_info('" . $db->sql_escape($value['name']) . "');");
+
+ $fields = array();
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $fields[] = $row['name'];
+ }
+ $db->sql_freeresult($result);
+
+ $sql_data .= 'CREATE ' . ($value['unique'] ? 'UNIQUE ' : '') . 'INDEX ' . $value['name'] . ' on ' . $table_name . ' (' . implode(', ', $fields) . ");\n";
+ }
+
+ $this->flush($sql_data . "\n");
+ }
+
+ function write_data($table_name)
+ {
+ global $db;
+ static $proper;
+
+ if (is_null($proper))
+ {
+ $proper = version_compare(phpversion(), '5.1.3', '>=');
+ }
+
+ if ($proper)
+ {
+ $col_types = sqlite_fetch_column_types($db->db_connect_id, $table_name);
+ }
+ else
+ {
+ $sql = "SELECT sql
+ FROM sqlite_master
+ WHERE type = 'table'
+ AND name = '" . $table_name . "'";
+ $table_data = sqlite_single_query($db->db_connect_id, $sql);
+ $table_data = preg_replace('#CREATE\s+TABLE\s+"?' . $table_name . '"?#i', '', $table_data);
+ $table_data = trim($table_data);
+
+ preg_match('#\((.*)\)#s', $table_data, $matches);
+
+ $table_cols = explode(',', trim($matches[1]));
+ foreach ($table_cols as $declaration)
+ {
+ $entities = preg_split('#\s+#', trim($declaration));
+ $column_name = preg_replace('/"?([^"]+)"?/', '\1', $entities[0]);
+
+ // Hit a primary key, those are not what we need :D
+ if (empty($entities[1]) || (strtolower($entities[0]) === 'primary' && strtolower($entities[1]) === 'key'))
+ {
+ continue;
+ }
+ $col_types[$column_name] = $entities[1];
+ }
+ }
+
+ $sql = "SELECT *
+ FROM $table_name";
+ $result = sqlite_unbuffered_query($db->db_connect_id, $sql);
+ $rows = sqlite_fetch_all($result, SQLITE_ASSOC);
+ $sql_insert = 'INSERT INTO ' . $table_name . ' (' . implode(', ', array_keys($col_types)) . ') VALUES (';
+ foreach ($rows as $row)
+ {
+ foreach ($row as $column_name => $column_data)
+ {
+ if (is_null($column_data))
+ {
+ $row[$column_name] = 'NULL';
+ }
+ else if ($column_data == '')
+ {
+ $row[$column_name] = "''";
+ }
+ else if (strpos($col_types[$column_name], 'text') !== false || strpos($col_types[$column_name], 'char') !== false || strpos($col_types[$column_name], 'blob') !== false)
+ {
+ $row[$column_name] = "'" . sanitize_data_generic(str_replace("'", "''", $column_data)) . "'";
+ }
+ }
+ $this->flush($sql_insert . implode(', ', $row) . ");\n");
+ }
+ }
+
+ function write_end()
+ {
+ $this->flush("COMMIT;\n");
+ parent::write_end();
+ }
+}
+
+class postgres_extractor extends base_extractor
+{
+ function write_start($prefix)
+ {
+ $sql_data = "--\n";
+ $sql_data .= "-- phpBB Backup Script\n";
+ $sql_data .= "-- Dump of tables for $prefix\n";
+ $sql_data .= "-- DATE : " . gmdate("d-m-Y H:i:s", $this->time) . " GMT\n";
+ $sql_data .= "--\n";
+ $sql_data .= "BEGIN TRANSACTION;\n";
+ $this->flush($sql_data);
+ }
+
+ function write_table($table_name)
+ {
+ global $db;
+ static $domains_created = array();
+
+ $sql = "SELECT a.domain_name, a.data_type, a.character_maximum_length, a.domain_default
+ FROM INFORMATION_SCHEMA.domains a, INFORMATION_SCHEMA.column_domain_usage b
+ WHERE a.domain_name = b.domain_name
+ AND b.table_name = '{$table_name}'";
+ $result = $db->sql_query($sql);
+ while ($row = $db->sql_fetchrow($result))
+ {
+ if (empty($domains_created[$row['domain_name']]))
+ {
+ $domains_created[$row['domain_name']] = true;
+ //$sql_data = "DROP DOMAIN {$row['domain_name']};\n";
+ $sql_data = "CREATE DOMAIN {$row['domain_name']} as {$row['data_type']}";
+ if (!empty($row['character_maximum_length']))
+ {
+ $sql_data .= '(' . $row['character_maximum_length'] . ')';
+ }
+ $sql_data .= ' NOT NULL';
+ if (!empty($row['domain_default']))
+ {
+ $sql_data .= ' DEFAULT ' . $row['domain_default'];
+ }
+ $this->flush($sql_data . ";\n");
+ }
+ }
+
+ $sql_data = '-- Table: ' . $table_name . "\n";
+ //$sql_data .= "DROP TABLE $table_name;\n";
+ // PGSQL does not "tightly" bind sequences and tables, we must guess...
+ $sql = "SELECT relname
+ FROM pg_class
+ WHERE relkind = 'S'
+ AND relname = '{$table_name}_seq'";
+ $result = $db->sql_query($sql);
+ // We don't even care about storing the results. We already know the answer if we get rows back.
+ if ($db->sql_fetchrow($result))
+ {
+ $sql_data .= "DROP SEQUENCE {$table_name}_seq;\n";
+ $sql_data .= "CREATE SEQUENCE {$table_name}_seq;\n";
+ }
+ $db->sql_freeresult($result);
+
+ $field_query = "SELECT a.attnum, a.attname as field, t.typname as type, a.attlen as length, a.atttypmod as lengthvar, a.attnotnull as notnull
+ FROM pg_class c, pg_attribute a, pg_type t
+ WHERE c.relname = '" . $db->sql_escape($table_name) . "'
+ AND a.attnum > 0
+ AND a.attrelid = c.oid
+ AND a.atttypid = t.oid
+ ORDER BY a.attnum";
+ $result = $db->sql_query($field_query);
+
+ $sql_data .= "CREATE TABLE $table_name(\n";
+ $lines = array();
+ while ($row = $db->sql_fetchrow($result))
+ {
+ // Get the data from the table
+ $sql_get_default = "SELECT pg_get_expr(d.adbin, d.adrelid) as rowdefault
+ FROM pg_attrdef d, pg_class c
+ WHERE (c.relname = '" . $db->sql_escape($table_name) . "')
+ AND (c.oid = d.adrelid)
+ AND d.adnum = " . $row['attnum'];
+ $def_res = $db->sql_query($sql_get_default);
+
+ if (!$def_res)
+ {
+ unset($row['rowdefault']);
+ }
+ else
+ {
+ $row['rowdefault'] = $db->sql_fetchfield('rowdefault', false, $def_res);
+ }
+ $db->sql_freeresult($def_res);
+
+ if ($row['type'] == 'bpchar')
+ {
+ // Internally stored as bpchar, but isn't accepted in a CREATE TABLE statement.
+ $row['type'] = 'char';
+ }
+
+ $line = ' ' . $row['field'] . ' ' . $row['type'];
+
+ if (strpos($row['type'], 'char') !== false)
+ {
+ if ($row['lengthvar'] > 0)
+ {
+ $line .= '(' . ($row['lengthvar'] - 4) . ')';
+ }
+ }
+
+ if (strpos($row['type'], 'numeric') !== false)
+ {
+ $line .= '(';
+ $line .= sprintf("%s,%s", (($row['lengthvar'] >> 16) & 0xffff), (($row['lengthvar'] - 4) & 0xffff));
+ $line .= ')';
+ }
+
+ if (!empty($row['rowdefault']))
+ {
+ $line .= ' DEFAULT ' . $row['rowdefault'];
+ }
+
+ if ($row['notnull'] == 't')
+ {
+ $line .= ' NOT NULL';
+ }
+
+ $lines[] = $line;
+ }
+ $db->sql_freeresult($result);
+
+
+ // Get the listing of primary keys.
+ $sql_pri_keys = "SELECT ic.relname as index_name, bc.relname as tab_name, ta.attname as column_name, i.indisunique as unique_key, i.indisprimary as primary_key
+ FROM pg_class bc, pg_class ic, pg_index i, pg_attribute ta, pg_attribute ia
+ WHERE (bc.oid = i.indrelid)
+ AND (ic.oid = i.indexrelid)
+ AND (ia.attrelid = i.indexrelid)
+ AND (ta.attrelid = bc.oid)
+ AND (bc.relname = '" . $db->sql_escape($table_name) . "')
+ AND (ta.attrelid = i.indrelid)
+ AND (ta.attnum = i.indkey[ia.attnum-1])
+ ORDER BY index_name, tab_name, column_name";
+
+ $result = $db->sql_query($sql_pri_keys);
+
+ $index_create = $index_rows = $primary_key = array();
+
+ // We do this in two steps. It makes placing the comma easier
+ while ($row = $db->sql_fetchrow($result))
+ {
+ if ($row['primary_key'] == 't')
+ {
+ $primary_key[] = $row['column_name'];
+ $primary_key_name = $row['index_name'];
+ }
+ else
+ {
+ // We have to store this all this info because it is possible to have a multi-column key...
+ // we can loop through it again and build the statement
+ $index_rows[$row['index_name']]['table'] = $table_name;
+ $index_rows[$row['index_name']]['unique'] = ($row['unique_key'] == 't') ? true : false;
+ $index_rows[$row['index_name']]['column_names'][] = $row['column_name'];
+ }
+ }
+ $db->sql_freeresult($result);
+
+ if (!empty($index_rows))
+ {
+ foreach ($index_rows as $idx_name => $props)
+ {
+ $index_create[] = 'CREATE ' . ($props['unique'] ? 'UNIQUE ' : '') . "INDEX $idx_name ON $table_name (" . implode(', ', $props['column_names']) . ");";
+ }
+ }
+
+ if (!empty($primary_key))
+ {
+ $lines[] = " CONSTRAINT $primary_key_name PRIMARY KEY (" . implode(', ', $primary_key) . ")";
+ }
+
+ // Generate constraint clauses for CHECK constraints
+ $sql_checks = "SELECT conname as index_name, consrc
+ FROM pg_constraint, pg_class bc
+ WHERE conrelid = bc.oid
+ AND bc.relname = '" . $db->sql_escape($table_name) . "'
+ AND NOT EXISTS (
+ SELECT *
+ FROM pg_constraint as c, pg_inherits as i
+ WHERE i.inhrelid = pg_constraint.conrelid
+ AND c.conname = pg_constraint.conname
+ AND c.consrc = pg_constraint.consrc
+ AND c.conrelid = i.inhparent
+ )";
+ $result = $db->sql_query($sql_checks);
+
+ // Add the constraints to the sql file.
+ while ($row = $db->sql_fetchrow($result))
+ {
+ if (!is_null($row['consrc']))
+ {
+ $lines[] = ' CONSTRAINT ' . $row['index_name'] . ' CHECK ' . $row['consrc'];
+ }
+ }
+ $db->sql_freeresult($result);
+
+ $sql_data .= implode(", \n", $lines);
+ $sql_data .= "\n);\n";
+
+ if (!empty($index_create))
+ {
+ $sql_data .= implode("\n", $index_create) . "\n\n";
+ }
+ $this->flush($sql_data);
+ }
+
+ function write_data($table_name)
+ {
+ global $db;
+ // Grab all of the data from current table.
+ $sql = "SELECT *
+ FROM $table_name";
+ $result = $db->sql_query($sql);
+
+ $i_num_fields = pg_num_fields($result);
+ $seq = '';
+
+ for ($i = 0; $i < $i_num_fields; $i++)
+ {
+ $ary_type[] = pg_field_type($result, $i);
+ $ary_name[] = pg_field_name($result, $i);
+
+
+ $sql = "SELECT pg_get_expr(d.adbin, d.adrelid) as rowdefault
+ FROM pg_attrdef d, pg_class c
+ WHERE (c.relname = '{$table_name}')
+ AND (c.oid = d.adrelid)
+ AND d.adnum = " . strval($i + 1);
+ $result2 = $db->sql_query($sql);
+ if ($row = $db->sql_fetchrow($result2))
+ {
+ // Determine if we must reset the sequences
+ if (strpos($row['rowdefault'], "nextval('") === 0)
+ {
+ $seq .= "SELECT SETVAL('{$table_name}_seq',(select case when max({$ary_name[$i]})>0 then max({$ary_name[$i]})+1 else 1 end FROM {$table_name}));\n";
+ }
+ }
+ }
+
+ $this->flush("COPY $table_name (" . implode(', ', $ary_name) . ') FROM stdin;' . "\n");
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $schema_vals = array();
+
+ // Build the SQL statement to recreate the data.
+ for ($i = 0; $i < $i_num_fields; $i++)
+ {
+ $str_val = $row[$ary_name[$i]];
+
+ if (preg_match('#char|text|bool|bytea#i', $ary_type[$i]))
+ {
+ $str_val = str_replace(array("\n", "\t", "\r", "\b", "\f", "\v"), array('\n', '\t', '\r', '\b', '\f', '\v'), addslashes($str_val));
+ $str_empty = '';
+ }
+ else
+ {
+ $str_empty = '\N';
+ }
+
+ if (empty($str_val) && $str_val !== '0')
+ {
+ $str_val = $str_empty;
+ }
+
+ $schema_vals[] = $str_val;
+ }
+
+ // Take the ordered fields and their associated data and build it
+ // into a valid sql statement to recreate that field in the data.
+ $this->flush(implode("\t", $schema_vals) . "\n");
+ }
+ $db->sql_freeresult($result);
+ $this->flush("\\.\n");
+
+ // Write out the sequence statements
+ $this->flush($seq);
+ }
+
+ function write_end()
+ {
+ $this->flush("COMMIT;\n");
+ parent::write_end();
+ }
+}
+
+class mssql_extractor extends base_extractor
+{
+ function write_end()
+ {
+ $this->flush("COMMIT\nGO\n");
+ }
+
+ function write_start($prefix)
+ {
+ $sql_data = "--\n";
+ $sql_data .= "-- phpBB Backup Script\n";
+ $sql_data .= "-- Dump of tables for $prefix\n";
+ $sql_data .= "-- DATE : " . gmdate("d-m-Y H:i:s", $this->time) . " GMT\n";
+ $sql_data .= "--\n";
+ $sql_data .= "BEGIN TRANSACTION\n";
+ $sql_data .= "GO\n";
+ $this->flush($sql_data);
+ }
+
+ function write_table($table_name)
+ {
+ global $db;
+ $sql_data = '-- Table: ' . $table_name . "\n";
+ $sql_data .= "IF OBJECT_ID(N'$table_name', N'U') IS NOT NULL\n";
+ $sql_data .= "DROP TABLE $table_name;\n";
+ $sql_data .= "GO\n";
+ $sql_data .= "\nCREATE TABLE [$table_name] (\n";
+ $rows = array();
+
+ $text_flag = false;
+
+ $sql = "SELECT COLUMN_NAME, COLUMN_DEFAULT, IS_NULLABLE, DATA_TYPE, CHARACTER_MAXIMUM_LENGTH, COLUMNPROPERTY(object_id(TABLE_NAME), COLUMN_NAME, 'IsIdentity') as IS_IDENTITY
+ FROM INFORMATION_SCHEMA.COLUMNS
+ WHERE TABLE_NAME = '$table_name'";
+ $result = $db->sql_query($sql);
+
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $line = "\t[{$row['COLUMN_NAME']}] [{$row['DATA_TYPE']}]";
+
+ if ($row['DATA_TYPE'] == 'text')
+ {
+ $text_flag = true;
+ }
+
+ if ($row['IS_IDENTITY'])
+ {
+ $line .= ' IDENTITY (1 , 1)';
+ }
+
+ if ($row['CHARACTER_MAXIMUM_LENGTH'] && $row['DATA_TYPE'] !== 'text')
+ {
+ $line .= ' (' . $row['CHARACTER_MAXIMUM_LENGTH'] . ')';
+ }
+
+ if ($row['IS_NULLABLE'] == 'YES')
+ {
+ $line .= ' NULL';
+ }
+ else
+ {
+ $line .= ' NOT NULL';
+ }
+
+ if ($row['COLUMN_DEFAULT'])
+ {
+ $line .= ' DEFAULT ' . $row['COLUMN_DEFAULT'];
+ }
+
+ $rows[] = $line;
+ }
+ $db->sql_freeresult($result);
+
+ $sql_data .= implode(",\n", $rows);
+ $sql_data .= "\n) ON [PRIMARY]";
+
+ if ($text_flag)
+ {
+ $sql_data .= " TEXTIMAGE_ON [PRIMARY]";
+ }
+
+ $sql_data .= "\nGO\n\n";
+ $rows = array();
+
+ $sql = "SELECT CONSTRAINT_NAME, COLUMN_NAME
+ FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE
+ WHERE TABLE_NAME = '$table_name'";
+ $result = $db->sql_query($sql);
+ while ($row = $db->sql_fetchrow($result))
+ {
+ if (!sizeof($rows))
+ {
+ $sql_data .= "ALTER TABLE [$table_name] WITH NOCHECK ADD\n";
+ $sql_data .= "\tCONSTRAINT [{$row['CONSTRAINT_NAME']}] PRIMARY KEY CLUSTERED \n\t(\n";
+ }
+ $rows[] = "\t\t[{$row['COLUMN_NAME']}]";
+ }
+ if (sizeof($rows))
+ {
+ $sql_data .= implode(",\n", $rows);
+ $sql_data .= "\n\t) ON [PRIMARY] \nGO\n";
+ }
+ $db->sql_freeresult($result);
+
+ $index = array();
+ $sql = "EXEC sp_statistics '$table_name'";
+ $result = $db->sql_query($sql);
+ while ($row = $db->sql_fetchrow($result))
+ {
+ if ($row['TYPE'] == 3)
+ {
+ $index[$row['INDEX_NAME']][] = '[' . $row['COLUMN_NAME'] . ']';
+ }
+ }
+ $db->sql_freeresult($result);
+
+ foreach ($index as $index_name => $column_name)
+ {
+ $index[$index_name] = implode(', ', $column_name);
+ }
+
+ foreach ($index as $index_name => $columns)
+ {
+ $sql_data .= "\nCREATE INDEX [$index_name] ON [$table_name]($columns) ON [PRIMARY]\nGO\n";
+ }
+ $this->flush($sql_data);
+ }
+
+ function write_data($table_name)
+ {
+ global $db;
+
+ if ($db->sql_layer === 'mssql')
+ {
+ $this->write_data_mssql($table_name);
+ }
+ else
+ {
+ $this->write_data_odbc($table_name);
+ }
+ }
+
+ function write_data_mssql($table_name)
+ {
+ global $db;
+ $ary_type = $ary_name = array();
+ $ident_set = false;
+ $sql_data = '';
+
+ // Grab all of the data from current table.
+ $sql = "SELECT *
+ FROM $table_name";
+ $result = $db->sql_query($sql);
+
+ $retrieved_data = mssql_num_rows($result);
+
+ $i_num_fields = mssql_num_fields($result);
+
+ for ($i = 0; $i < $i_num_fields; $i++)
+ {
+ $ary_type[$i] = mssql_field_type($result, $i);
+ $ary_name[$i] = mssql_field_name($result, $i);
+ }
+
+ if ($retrieved_data)
+ {
+ $sql = "SELECT 1 as has_identity
+ FROM INFORMATION_SCHEMA.COLUMNS
+ WHERE COLUMNPROPERTY(object_id('$table_name'), COLUMN_NAME, 'IsIdentity') = 1";
+ $result2 = $db->sql_query($sql);
+ $row2 = $db->sql_fetchrow($result2);
+ if (!empty($row2['has_identity']))
+ {
+ $sql_data .= "\nSET IDENTITY_INSERT $table_name ON\nGO\n";
+ $ident_set = true;
+ }
+ $db->sql_freeresult($result2);
+ }
+
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $schema_vals = $schema_fields = array();
+
+ // Build the SQL statement to recreate the data.
+ for ($i = 0; $i < $i_num_fields; $i++)
+ {
+ $str_val = $row[$ary_name[$i]];
+
+ if (preg_match('#char|text|bool|varbinary#i', $ary_type[$i]))
+ {
+ $str_quote = "'";
+ $str_empty = '';
+ $str_val = sanitize_data_mssql(str_replace("'", "''", $str_val));
+ }
+ else if (preg_match('#date|timestamp#i', $ary_type[$i]))
+ {
+ if (empty($str_val))
+ {
+ $str_quote = '';
+ }
+ else
+ {
+ $str_quote = "'";
+ }
+ }
+ else
+ {
+ $str_quote = '';
+ $str_empty = 'NULL';
+ }
+
+ if (empty($str_val) && $str_val !== '0' && !(is_int($str_val) || is_float($str_val)))
+ {
+ $str_val = $str_empty;
+ }
+
+ $schema_vals[$i] = $str_quote . $str_val . $str_quote;
+ $schema_fields[$i] = $ary_name[$i];
+ }
+
+ // Take the ordered fields and their associated data and build it
+ // into a valid sql statement to recreate that field in the data.
+ $sql_data .= "INSERT INTO $table_name (" . implode(', ', $schema_fields) . ') VALUES (' . implode(', ', $schema_vals) . ");\nGO\n";
+
+ $this->flush($sql_data);
+ $sql_data = '';
+ }
+ $db->sql_freeresult($result);
+
+ if ($retrieved_data && $ident_set)
+ {
+ $sql_data .= "\nSET IDENTITY_INSERT $table_name OFF\nGO\n";
+ }
+ $this->flush($sql_data);
+ }
+
+ function write_data_odbc($table_name)
+ {
+ global $db;
+ $ary_type = $ary_name = array();
+ $ident_set = false;
+ $sql_data = '';
+
+ // Grab all of the data from current table.
+ $sql = "SELECT *
+ FROM $table_name";
+ $result = $db->sql_query($sql);
+
+ $retrieved_data = odbc_num_rows($result);
+
+ if ($retrieved_data)
+ {
+ $sql = "SELECT 1 as has_identity
+ FROM INFORMATION_SCHEMA.COLUMNS
+ WHERE COLUMNPROPERTY(object_id('$table_name'), COLUMN_NAME, 'IsIdentity') = 1";
+ $result2 = $db->sql_query($sql);
+ $row2 = $db->sql_fetchrow($result2);
+ if (!empty($row2['has_identity']))
+ {
+ $sql_data .= "\nSET IDENTITY_INSERT $table_name ON\nGO\n";
+ $ident_set = true;
+ }
+ $db->sql_freeresult($result2);
+ }
+
+ $i_num_fields = odbc_num_fields($result);
+
+ for ($i = 0; $i < $i_num_fields; $i++)
+ {
+ $ary_type[$i] = odbc_field_type($result, $i + 1);
+ $ary_name[$i] = odbc_field_name($result, $i + 1);
+ }
+
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $schema_vals = $schema_fields = array();
+
+ // Build the SQL statement to recreate the data.
+ for ($i = 0; $i < $i_num_fields; $i++)
+ {
+ $str_val = $row[$ary_name[$i]];
+
+ if (preg_match('#char|text|bool|varbinary#i', $ary_type[$i]))
+ {
+ $str_quote = "'";
+ $str_empty = '';
+ $str_val = sanitize_data_mssql(str_replace("'", "''", $str_val));
+ }
+ else if (preg_match('#date|timestamp#i', $ary_type[$i]))
+ {
+ if (empty($str_val))
+ {
+ $str_quote = '';
+ }
+ else
+ {
+ $str_quote = "'";
+ }
+ }
+ else
+ {
+ $str_quote = '';
+ $str_empty = 'NULL';
+ }
+
+ if (empty($str_val) && $str_val !== '0' && !(is_int($str_val) || is_float($str_val)))
+ {
+ $str_val = $str_empty;
+ }
+
+ $schema_vals[$i] = $str_quote . $str_val . $str_quote;
+ $schema_fields[$i] = $ary_name[$i];
+ }
+
+ // Take the ordered fields and their associated data and build it
+ // into a valid sql statement to recreate that field in the data.
+ $sql_data .= "INSERT INTO $table_name (" . implode(', ', $schema_fields) . ') VALUES (' . implode(', ', $schema_vals) . ");\nGO\n";
+
+ $this->flush($sql_data);
+
+ $sql_data = '';
+
+ }
+ $db->sql_freeresult($result);
+
+ if ($retrieved_data && $ident_set)
+ {
+ $sql_data .= "\nSET IDENTITY_INSERT $table_name OFF\nGO\n";
+ }
+ $this->flush($sql_data);
+ }
+
+}
+
+class oracle_extractor extends base_extractor
+{
+ function write_table($table_name)
+ {
+ global $db;
+ $sql_data = '-- Table: ' . $table_name . "\n";
+ $sql_data .= "DROP TABLE $table_name;\n";
+ $sql_data .= '\\' . "\n";
+ $sql_data .= "\nCREATE TABLE $table_name (\n";
+
+ $sql = "SELECT COLUMN_NAME, DATA_TYPE, DATA_PRECISION, DATA_LENGTH, NULLABLE, DATA_DEFAULT
+ FROM ALL_TAB_COLS
+ WHERE table_name = '{$table_name}'";
+ $result = $db->sql_query($sql);
+
+ $rows = array();
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $line = ' "' . $row['column_name'] . '" ' . $row['data_type'];
+
+ if ($row['data_type'] !== 'CLOB')
+ {
+ if ($row['data_type'] !== 'VARCHAR2')
+ {
+ $line .= '(' . $row['data_precision'] . ')';
+ }
+ else
+ {
+ $line .= '(' . $row['data_length'] . ')';
+ }
+ }
+
+ if (!empty($row['data_default']))
+ {
+ $line .= ' DEFAULT ' . $row['data_default'];
+ }
+
+ if ($row['nullable'] == 'N')
+ {
+ $line .= ' NOT NULL';
+ }
+ $rows[] = $line;
+ }
+ $db->sql_freeresult($result);
+
+ $sql = "SELECT A.CONSTRAINT_NAME, A.COLUMN_NAME
+ FROM USER_CONS_COLUMNS A, USER_CONSTRAINTS B
+ WHERE A.CONSTRAINT_NAME = B.CONSTRAINT_NAME
+ AND B.CONSTRAINT_TYPE = 'P'
+ AND A.TABLE_NAME = '{$table_name}'";
+ $result = $db->sql_query($sql);
+
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $rows[] = " CONSTRAINT {$row['constraint_name']} PRIMARY KEY ({$row['column_name']})";
+ }
+ $db->sql_freeresult($result);
+
+ $sql = "SELECT A.CONSTRAINT_NAME, A.COLUMN_NAME
+ FROM USER_CONS_COLUMNS A, USER_CONSTRAINTS B
+ WHERE A.CONSTRAINT_NAME = B.CONSTRAINT_NAME
+ AND B.CONSTRAINT_TYPE = 'U'
+ AND A.TABLE_NAME = '{$table_name}'";
+ $result = $db->sql_query($sql);
+
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $rows[] = " CONSTRAINT {$row['constraint_name']} UNIQUE ({$row['column_name']})";
+ }
+ $db->sql_freeresult($result);
+
+ $sql_data .= implode(",\n", $rows);
+ $sql_data .= "\n)\n\\";
+
+ $sql = "SELECT A.REFERENCED_NAME
+ FROM USER_DEPENDENCIES A, USER_TRIGGERS B
+ WHERE A.REFERENCED_TYPE = 'SEQUENCE'
+ AND A.NAME = B.TRIGGER_NAME
+ AND B. TABLE_NAME = '{$table_name}'";
+ $result = $db->sql_query($sql);
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $sql_data .= "\nCREATE SEQUENCE {$row['referenced_name']}\\\n";
+ }
+ $db->sql_freeresult($result);
+
+ $sql = "SELECT DESCRIPTION, WHEN_CLAUSE, TRIGGER_BODY
+ FROM USER_TRIGGERS
+ WHERE TABLE_NAME = '{$table_name}'";
+ $result = $db->sql_query($sql);
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $sql_data .= "\nCREATE OR REPLACE TRIGGER {$row['description']}WHEN ({$row['when_clause']})\n{$row['trigger_body']}\\";
+ }
+ $db->sql_freeresult($result);
+
+ $sql = "SELECT A.INDEX_NAME, B.COLUMN_NAME
+ FROM USER_INDEXES A, USER_IND_COLUMNS B
+ WHERE A.UNIQUENESS = 'NONUNIQUE'
+ AND A.INDEX_NAME = B.INDEX_NAME
+ AND B.TABLE_NAME = '{$table_name}'";
+ $result = $db->sql_query($sql);
+
+ $index = array();
+
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $index[$row['index_name']][] = $row['column_name'];
+ }
+
+ foreach ($index as $index_name => $column_names)
+ {
+ $sql_data .= "\nCREATE INDEX $index_name ON $table_name(" . implode(', ', $column_names) . ")\n\\";
+ }
+ $db->sql_freeresult($result);
+ $this->flush($sql_data);
+ }
+
+ function write_data($table_name)
+ {
+ global $db;
+ $ary_type = $ary_name = array();
+
+ // Grab all of the data from current table.
+ $sql = "SELECT *
+ FROM $table_name";
+ $result = $db->sql_query($sql);
+
+ $i_num_fields = ocinumcols($result);
+
+ for ($i = 0; $i < $i_num_fields; $i++)
+ {
+ $ary_type[$i] = ocicolumntype($result, $i + 1);
+ $ary_name[$i] = ocicolumnname($result, $i + 1);
+ }
+
+ $sql_data = '';
+
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $schema_vals = $schema_fields = array();
+
+ // Build the SQL statement to recreate the data.
+ for ($i = 0; $i < $i_num_fields; $i++)
+ {
+ $str_val = $row[$ary_name[$i]];
+
+ if (preg_match('#char|text|bool|raw#i', $ary_type[$i]))
+ {
+ $str_quote = "'";
+ $str_empty = '';
+ $str_val = sanitize_data_oracle($str_val);
+ }
+ else if (preg_match('#date|timestamp#i', $ary_type[$i]))
+ {
+ if (empty($str_val))
+ {
+ $str_quote = '';
+ }
+ else
+ {
+ $str_quote = "'";
+ }
+ }
+ else
+ {
+ $str_quote = '';
+ $str_empty = 'NULL';
+ }
+
+ if (empty($str_val) && $str_val !== '0')
+ {
+ $str_val = $str_empty;
+ }
+
+ $schema_vals[$i] = $str_quote . $str_val . $str_quote;
+ $schema_fields[$i] = '"' . $ary_name[$i] . "'";
+ }
+
+ // Take the ordered fields and their associated data and build it
+ // into a valid sql statement to recreate that field in the data.
+ $sql_data = "INSERT INTO $table_name (" . implode(', ', $schema_fields) . ') VALUES (' . implode(', ', $schema_vals) . ");\n";
+
+ $this->flush($sql_data);
+ }
+ $db->sql_freeresult($result);
+ }
+
+ function write_start($prefix)
+ {
+ $sql_data = "--\n";
+ $sql_data .= "-- phpBB Backup Script\n";
+ $sql_data .= "-- Dump of tables for $prefix\n";
+ $sql_data .= "-- DATE : " . gmdate("d-m-Y H:i:s", $this->time) . " GMT\n";
+ $sql_data .= "--\n";
+ $this->flush($sql_data);
+ }
+}
+
+class firebird_extractor extends base_extractor
+{
+ function write_start($prefix)
+ {
+ $sql_data = "--\n";
+ $sql_data .= "-- phpBB Backup Script\n";
+ $sql_data .= "-- Dump of tables for $prefix\n";
+ $sql_data .= "-- DATE : " . gmdate("d-m-Y H:i:s", $this->time) . " GMT\n";
+ $sql_data .= "--\n";
+ $this->flush($sql_data);
+ }
+
+ function write_data($table_name)
+ {
+ global $db;
+ $ary_type = $ary_name = array();
+
+ // Grab all of the data from current table.
+ $sql = "SELECT *
+ FROM $table_name";
+ $result = $db->sql_query($sql);
+
+ $i_num_fields = ibase_num_fields($result);
+
+ for ($i = 0; $i < $i_num_fields; $i++)
+ {
+ $info = ibase_field_info($result, $i);
+ $ary_type[$i] = $info['type'];
+ $ary_name[$i] = $info['name'];
+ }
+
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $schema_vals = $schema_fields = array();
+
+ // Build the SQL statement to recreate the data.
+ for ($i = 0; $i < $i_num_fields; $i++)
+ {
+ $str_val = $row[strtolower($ary_name[$i])];
+
+ if (preg_match('#char|text|bool|varbinary|blob#i', $ary_type[$i]))
+ {
+ $str_quote = "'";
+ $str_empty = '';
+ $str_val = sanitize_data_generic(str_replace("'", "''", $str_val));
+ }
+ else if (preg_match('#date|timestamp#i', $ary_type[$i]))
+ {
+ if (empty($str_val))
+ {
+ $str_quote = '';
+ }
+ else
+ {
+ $str_quote = "'";
+ }
+ }
+ else
+ {
+ $str_quote = '';
+ $str_empty = 'NULL';
+ }
+
+ if (empty($str_val) && $str_val !== '0')
+ {
+ $str_val = $str_empty;
+ }
+
+ $schema_vals[$i] = $str_quote . $str_val . $str_quote;
+ $schema_fields[$i] = '"' . $ary_name[$i] . '"';
+ }
+
+ // Take the ordered fields and their associated data and build it
+ // into a valid sql statement to recreate that field in the data.
+ $sql_data = "INSERT INTO $table_name (" . implode(', ', $schema_fields) . ') VALUES (' . implode(', ', $schema_vals) . ");\n";
+
+ $this->flush($sql_data);
+ }
+ $db->sql_freeresult($result);
+ }
+
+ function write_table($table_name)
+ {
+ global $db;
+
+ $sql_data = '-- Table: ' . $table_name . "\n";
+ $sql_data .= "DROP TABLE $table_name;\n";
+
+ $data_types = array(7 => 'SMALLINT', 8 => 'INTEGER', 10 => 'FLOAT', 12 => 'DATE', 13 => 'TIME', 14 => 'CHARACTER', 27 => 'DOUBLE PRECISION', 35 => 'TIMESTAMP', 37 => 'VARCHAR', 40 => 'CSTRING', 261 => 'BLOB', 701 => 'DECIMAL', 702 => 'NUMERIC');
+
+ $sql_data .= "\nCREATE TABLE $table_name (\n";
+
+ $sql = 'SELECT DISTINCT R.RDB$FIELD_NAME as FNAME, R.RDB$NULL_FLAG as NFLAG, R.RDB$DEFAULT_SOURCE as DSOURCE, F.RDB$FIELD_TYPE as FTYPE, F.RDB$FIELD_SUB_TYPE as STYPE, F.RDB$FIELD_LENGTH as FLEN
+ FROM RDB$RELATION_FIELDS R
+ JOIN RDB$FIELDS F ON R.RDB$FIELD_SOURCE=F.RDB$FIELD_NAME
+ LEFT JOIN RDB$FIELD_DIMENSIONS D ON R.RDB$FIELD_SOURCE = D.RDB$FIELD_NAME
+ WHERE F.RDB$SYSTEM_FLAG = 0
+ AND R.RDB$RELATION_NAME = \''. $table_name . '\'
+ ORDER BY R.RDB$FIELD_POSITION';
+ $result = $db->sql_query($sql);
+
+ $rows = array();
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $line = "\t" . '"' . $row['fname'] . '" ' . $data_types[$row['ftype']];
+
+ if ($row['ftype'] == 261 && $row['stype'] == 1)
+ {
+ $line .= ' SUB_TYPE TEXT';
+ }
+
+ if ($row['ftype'] == 37 || $row['ftype'] == 14)
+ {
+ $line .= ' (' . $row['flen'] . ')';
+ }
+
+ if (!empty($row['dsource']))
+ {
+ $line .= ' ' . $row['dsource'];
+ }
+
+ if (!empty($row['nflag']))
+ {
+ $line .= ' NOT NULL';
+ }
+ $rows[] = $line;
+ }
+ $db->sql_freeresult($result);
+
+ $sql_data .= implode(",\n", $rows);
+ $sql_data .= "\n);\n";
+ $keys = array();
+
+ $sql = 'SELECT I.RDB$FIELD_NAME as NAME
+ FROM RDB$RELATION_CONSTRAINTS RC, RDB$INDEX_SEGMENTS I, RDB$INDICES IDX
+ WHERE (I.RDB$INDEX_NAME = RC.RDB$INDEX_NAME)
+ AND (IDX.RDB$INDEX_NAME = RC.RDB$INDEX_NAME)
+ AND (RC.RDB$RELATION_NAME = \''. $table_name . '\')
+ ORDER BY I.RDB$FIELD_POSITION';
+ $result = $db->sql_query($sql);
+
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $keys[] = $row['name'];
+ }
+
+ if (sizeof($keys))
+ {
+ $sql_data .= "\nALTER TABLE $table_name ADD PRIMARY KEY (" . implode(', ', $keys) . ');';
+ }
+
+ $db->sql_freeresult($result);
+
+ $sql = 'SELECT I.RDB$INDEX_NAME as INAME, I.RDB$UNIQUE_FLAG as UFLAG, S.RDB$FIELD_NAME as FNAME
+ FROM RDB$INDICES I JOIN RDB$INDEX_SEGMENTS S ON S.RDB$INDEX_NAME=I.RDB$INDEX_NAME
+ WHERE (I.RDB$SYSTEM_FLAG IS NULL OR I.RDB$SYSTEM_FLAG=0)
+ AND I.RDB$FOREIGN_KEY IS NULL
+ AND I.RDB$RELATION_NAME = \''. $table_name . '\'
+ AND I.RDB$INDEX_NAME NOT STARTING WITH \'RDB$\'
+ ORDER BY S.RDB$FIELD_POSITION';
+ $result = $db->sql_query($sql);
+
+ $index = array();
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $index[$row['iname']]['unique'] = !empty($row['uflag']);
+ $index[$row['iname']]['values'][] = $row['fname'];
+ }
+
+ foreach ($index as $index_name => $data)
+ {
+ $sql_data .= "\nCREATE ";
+ if ($data['unique'])
+ {
+ $sql_data .= 'UNIQUE ';
+ }
+ $sql_data .= "INDEX $index_name ON $table_name(" . implode(', ', $data['values']) . ");";
+ }
+ $sql_data .= "\n";
+
+ $db->sql_freeresult($result);
+
+ $sql = 'SELECT D1.RDB$DEPENDENT_NAME as DNAME, D1.RDB$FIELD_NAME as FNAME, D1.RDB$DEPENDENT_TYPE, R1.RDB$RELATION_NAME
+ FROM RDB$DEPENDENCIES D1
+ LEFT JOIN RDB$RELATIONS R1 ON ((D1.RDB$DEPENDENT_NAME = R1.RDB$RELATION_NAME) AND (NOT (R1.RDB$VIEW_BLR IS NULL)))
+ WHERE (D1.RDB$DEPENDED_ON_TYPE = 0)
+ AND (D1.RDB$DEPENDENT_TYPE <> 3)
+ AND (D1.RDB$DEPENDED_ON_NAME = \'' . $table_name . '\')
+ UNION SELECT DISTINCT F2.RDB$RELATION_NAME, D2.RDB$FIELD_NAME, D2.RDB$DEPENDENT_TYPE, R2.RDB$RELATION_NAME FROM RDB$DEPENDENCIES D2, RDB$RELATION_FIELDS F2
+ LEFT JOIN RDB$RELATIONS R2 ON ((F2.RDB$RELATION_NAME = R2.RDB$RELATION_NAME) AND (NOT (R2.RDB$VIEW_BLR IS NULL)))
+ WHERE (D2.RDB$DEPENDENT_TYPE = 3)
+ AND (D2.RDB$DEPENDENT_NAME = F2.RDB$FIELD_SOURCE)
+ AND (D2.RDB$DEPENDED_ON_NAME = \'' . $table_name . '\')
+ ORDER BY 1, 2';
+ $result = $db->sql_query($sql);
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $sql = 'SELECT T1.RDB$DEPENDED_ON_NAME as GEN, T1.RDB$FIELD_NAME, T1.RDB$DEPENDED_ON_TYPE
+ FROM RDB$DEPENDENCIES T1
+ WHERE (T1.RDB$DEPENDENT_NAME = \'' . $row['dname'] . '\')
+ AND (T1.RDB$DEPENDENT_TYPE = 2 AND T1.RDB$DEPENDED_ON_TYPE = 14)
+ UNION ALL SELECT DISTINCT D.RDB$DEPENDED_ON_NAME, D.RDB$FIELD_NAME, D.RDB$DEPENDED_ON_TYPE
+ FROM RDB$DEPENDENCIES D, RDB$RELATION_FIELDS F
+ WHERE (D.RDB$DEPENDENT_TYPE = 3)
+ AND (D.RDB$DEPENDENT_NAME = F.RDB$FIELD_SOURCE)
+ AND (F.RDB$RELATION_NAME = \'' . $row['dname'] . '\')
+ ORDER BY 1,2';
+ $result2 = $db->sql_query($sql);
+ $row2 = $db->sql_fetchrow($result2);
+ $db->sql_freeresult($result2);
+ $gen_name = $row2['gen'];
+
+ $sql_data .= "\nDROP GENERATOR " . $gen_name . ";";
+ $sql_data .= "\nSET TERM ^ ;";
+ $sql_data .= "\nCREATE GENERATOR " . $gen_name . "^";
+ $sql_data .= "\nSET GENERATOR " . $gen_name . " TO 0^\n";
+ $sql_data .= "\nCREATE TRIGGER {$row['dname']} FOR $table_name";
+ $sql_data .= "\nBEFORE INSERT\nAS\nBEGIN";
+ $sql_data .= "\n NEW.{$row['fname']} = GEN_ID(" . $gen_name . ", 1);";
+ $sql_data .= "\nEND^\n";
+ $sql_data .= "\nSET TERM ; ^\n";
+ }
+
+ $this->flush($sql_data);
+
+ $db->sql_freeresult($result);
+ }
+}
+
+function sanitize_data_mssql($text)
+{
+ $data = preg_split('/[\n\t\r\b\f]/', $text);
+ preg_match_all('/[\n\t\r\b\f]/', $text, $matches);
+
+ $val = array();
+
+ foreach ($data as $value)
+ {
+ if (strlen($value))
+ {
+ $val[] = $value;
+ }
+ if (sizeof($matches[0]))
+ {
+ $val[] = 'char(' . ord(array_shift($matches[0])) . ')';
+ }
+ }
+
+ return implode('+', $val);
+}
+
+function sanitize_data_oracle($text)
+{
+ $data = preg_split('/[\0\n\t\r\b\f\'"\\\]/', $text);
+ preg_match_all('/[\0\n\t\r\b\f\'"\\\]/', $text, $matches);
+
+ $val = array();
+
+ foreach ($data as $value)
+ {
+ if (strlen($value))
+ {
+ $val[] = $value;
+ }
+ if (sizeof($matches[0]))
+ {
+ $val[] = 'chr(' . ord(array_shift($matches[0])) . ')';
+ }
+ }
+
+ return implode('||', $val);
+}
+
+function sanitize_data_generic($text)
+{
+ $data = preg_split('/[\n\t\r\b\f]/', $text);
+ preg_match_all('/[\n\t\r\b\f]/', $text, $matches);
+
+ $val = array();
+
+ foreach ($data as $value)
+ {
+ if (strlen($value))
+ {
+ $val[] = $value;
+ }
+ if (sizeof($matches[0]))
+ {
+ $val[] = "'" . array_shift($matches[0]) . "'";
+ }
+ }
+
+ return implode('||', $val);
}
// Internal handler for BZip2
@@ -1985,4 +2157,32 @@ function ob_bz2handler($data, $mode)
}
}
+// modified from PHP.net
+function fgetd(&$fp, $delim, $read, $seek, $eof, $buffer = 8192)
+{
+ $record = '';
+ $delim_len = strlen($delim);
+
+ while (!$eof($fp))
+ {
+ $pos = strpos($record, $delim);
+ if ($pos === false)
+ {
+ $record .= $read($fp, $buffer);
+ if ($eof($fp) && ($pos = strpos($record, $delim)) !== false)
+ {
+ $seek($fp, $pos + $delim_len - strlen($record), SEEK_CUR);
+ return substr($record, 0, $pos);
+ }
+ }
+ else
+ {
+ $seek($fp, $pos + $delim_len - strlen($record), SEEK_CUR);
+ return substr($record, 0, $pos);
+ }
+ }
+
+ return false;
+}
+
?>
\ No newline at end of file
From a014f237de59b30385f750b0b17b2f62622d8e00 Mon Sep 17 00:00:00 2001
From: David M
Date: Thu, 15 Feb 2007 21:51:54 +0000
Subject: [PATCH 039/707] #8144
git-svn-id: file:///svn/phpbb/trunk@6989 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/includes/acp/acp_database.php | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/phpBB/includes/acp/acp_database.php b/phpBB/includes/acp/acp_database.php
index b6405d88fe..f450d1a284 100644
--- a/phpBB/includes/acp/acp_database.php
+++ b/phpBB/includes/acp/acp_database.php
@@ -616,7 +616,14 @@ class mysql_extractor extends base_extractor
if ($new_extract === null)
{
- $new_extract = version_compare($db->mysql_version, '3.23.20', '>=');
+ if ($db->sql_layer === 'mysqli' || version_compare($db->mysql_version, '3.23.20', '>='))
+ {
+ $new_extract = true;
+ }
+ else
+ {
+ $new_extract = false;
+ }
}
if ($new_extract)
From caf5bfffd7e15b31f040746db1a18530b2a5642f Mon Sep 17 00:00:00 2001
From: David M
Date: Fri, 16 Feb 2007 00:46:21 +0000
Subject: [PATCH 040/707] #8146 - came up with an alternate chunking algorithm,
it does not require additional calls to seek (it reads exactly what it needs
to and does not need to look at the same piece of data twice) and may or may
not be more optimal than the previous chunking algorithm (may be faster, may
use more memory). For this reason, it is only used when the stream is not
seekable (bzip2 is the only format that is not seekable)
git-svn-id: file:///svn/phpbb/trunk@6990 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/includes/acp/acp_database.php | 52 +++++++++++++++++++++++++----
1 file changed, 45 insertions(+), 7 deletions(-)
diff --git a/phpBB/includes/acp/acp_database.php b/phpBB/includes/acp/acp_database.php
index f450d1a284..e1ec9fa8bc 100644
--- a/phpBB/includes/acp/acp_database.php
+++ b/phpBB/includes/acp/acp_database.php
@@ -355,14 +355,16 @@ class acp_database
$seek = 'fseek';
$eof = 'feof';
$close = 'fclose';
+ $fgetd = 'fgetd';
break;
case 'sql.bz2':
$fp = bzopen($file_name, 'r');
$read = 'bzread';
- $seek = 'bzseek';
+ $seek = '';
$eof = 'feof';
$close = 'bzclose';
+ $fgetd = 'fgetd_seekless';
break;
case 'sql.gz':
@@ -371,6 +373,7 @@ class acp_database
$seek = 'gzseek';
$eof = 'gzeof';
$close = 'gzclose';
+ $fgetd = 'fgetd';
break;
}
@@ -382,7 +385,7 @@ class acp_database
case 'sqlite':
while (!$eof($fp))
{
- $db->sql_query(fgetd($fp, ";\n", $read, $seek, $eof));
+ $db->sql_query($fgetd($fp, ";\n", $read, $seek, $eof));
}
break;
@@ -390,7 +393,7 @@ class acp_database
$delim = ";\n";
while (!$eof($fp))
{
- $query = trim(fgetd($fp, $delim, $read, $seek, $eof));
+ $query = trim($fgetd($fp, $delim, $read, $seek, $eof));
if (substr($query, 0, 8) === 'SET TERM')
{
$delim = $query[9] . "\n";
@@ -403,11 +406,11 @@ class acp_database
case 'postgres':
while (!$eof($fp))
{
- $query = trim(fgetd($fp, ";\n", $read, $seek, $eof));
+ $query = trim($fgetd($fp, ";\n", $read, $seek, $eof));
$db->sql_query($query);
if (substr($query, 0, 4) == 'COPY')
{
- while (($sub = fgetd($fp, "\n", $read, $seek, $eof)) !== '\.')
+ while (($sub = $fgetd($fp, "\n", $read, $seek, $eof)) !== '\.')
{
pg_put_line($db->db_connect_id, $sub . "\n");
}
@@ -420,7 +423,7 @@ class acp_database
case 'oracle':
while (!$eof($fp))
{
- $db->sql_query(fgetd($fp, "/\n", $read, $seek, $eof));
+ $db->sql_query($fgetd($fp, "/\n", $read, $seek, $eof));
}
break;
@@ -428,7 +431,7 @@ class acp_database
case 'mssql_odbc':
while (!$eof($fp))
{
- $db->sql_query(fgetd($fp, "GO\n", $read, $seek, $eof));
+ $db->sql_query($fgetd($fp, "GO\n", $read, $seek, $eof));
}
break;
}
@@ -2192,4 +2195,39 @@ function fgetd(&$fp, $delim, $read, $seek, $eof, $buffer = 8192)
return false;
}
+function fgetd_seekless(&$fp, $delim, $read, $seek, $eof, $buffer = 8192)
+{
+ static $array = array();
+ static $record = '';
+
+ if (!sizeof($array))
+ {
+ while (!$eof($fp))
+ {
+ if (strpos($record, $delim) !== false)
+ {
+ $array = explode($delim, $record);
+ $record = array_pop($array);
+ break;
+ }
+ else
+ {
+ $record .= $read($fp, $buffer);
+ }
+ }
+ if ($eof($fp) && strpos($record, $delim) !== false)
+ {
+ $array = explode($delim, $record);
+ $record = array_pop($array);
+ }
+ }
+
+ if (sizeof($array))
+ {
+ return array_shift($array);
+ }
+
+ return false;
+}
+
?>
\ No newline at end of file
From e10e47044e0034b8224f65598739b2c3d6e0ddbd Mon Sep 17 00:00:00 2001
From: David M
Date: Fri, 16 Feb 2007 04:20:45 +0000
Subject: [PATCH 041/707] #8154
git-svn-id: file:///svn/phpbb/trunk@6991 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/includes/acp/acp_database.php | 33 ++++++++++++++---------------
1 file changed, 16 insertions(+), 17 deletions(-)
diff --git a/phpBB/includes/acp/acp_database.php b/phpBB/includes/acp/acp_database.php
index e1ec9fa8bc..1424bdb84d 100644
--- a/phpBB/includes/acp/acp_database.php
+++ b/phpBB/includes/acp/acp_database.php
@@ -498,12 +498,15 @@ class base_extractor
var $store;
var $download;
var $time;
+ var $format;
function base_extractor($download = false, $store = false, $format, $filename, $time)
{
$this->download = $download;
$this->store = $store;
$this->time = $time;
+ $this->format = $format;
+
switch ($format)
{
case 'text':
@@ -531,8 +534,6 @@ class base_extractor
if ($download == true)
{
- $this->fh = fopen('php://output', 'wb');
-
$name = $filename . $ext;
header('Pragma: no-cache');
header("Content-Type: $mimetype; name=\"$name\"");
@@ -541,8 +542,9 @@ class base_extractor
switch ($format)
{
case 'bzip2':
- ob_start('ob_bz2handler');
+ ob_start();
break;
+
case 'gzip':
ob_start('ob_gzhandler');
break;
@@ -575,9 +577,11 @@ class base_extractor
$close($this->fp);
}
- if ($this->download)
+ // bzip2 must be written all the way at the end
+ if ($this->format === 'bzip2')
{
- fclose($this->fh);
+ $c = ob_get_clean();
+ echo bzcompress($c);
}
}
@@ -595,7 +599,13 @@ class base_extractor
if ($this->download === true)
{
- fwrite($this->fh, $data);
+ echo $data;
+
+ // we can write the gzip data as soon as we get it
+ if ($this->format === 'gzip')
+ {
+ ob_flush();
+ }
}
}
}
@@ -2156,17 +2166,6 @@ function sanitize_data_generic($text)
return implode('||', $val);
}
-// Internal handler for BZip2
-function ob_bz2handler($data, $mode)
-{
- static $internal = '';
- $internal .= $data;
- if ($mode & PHP_OUTPUT_HANDLER_END)
- {
- return bzcompress($internal);
- }
-}
-
// modified from PHP.net
function fgetd(&$fp, $delim, $read, $seek, $eof, $buffer = 8192)
{
From 795d50523dac70128a308f4fa602ec55b716054a Mon Sep 17 00:00:00 2001
From: David M
Date: Fri, 16 Feb 2007 04:26:19 +0000
Subject: [PATCH 042/707] wrong function name :P
git-svn-id: file:///svn/phpbb/trunk@6992 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/includes/utf/data/recode_basic.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/phpBB/includes/utf/data/recode_basic.php b/phpBB/includes/utf/data/recode_basic.php
index 59b1d1be3b..03391c9376 100644
--- a/phpBB/includes/utf/data/recode_basic.php
+++ b/phpBB/includes/utf/data/recode_basic.php
@@ -1371,7 +1371,7 @@ function cp1257($string)
return strtr($string, $transform);
}
-function cp1252_to_utf8($string)
+function utf8_to_cp1252($string)
{
static $transform = array(
"\xE2\x82\xAC" => "\x80",
From 40441562861395f9efcc292428cefb2fa8241838 Mon Sep 17 00:00:00 2001
From: David M
Date: Fri, 16 Feb 2007 04:31:42 +0000
Subject: [PATCH 043/707] - small mistake :-(
git-svn-id: file:///svn/phpbb/trunk@6993 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/includes/acp/acp_database.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/phpBB/includes/acp/acp_database.php b/phpBB/includes/acp/acp_database.php
index 1424bdb84d..e3da57fdfb 100644
--- a/phpBB/includes/acp/acp_database.php
+++ b/phpBB/includes/acp/acp_database.php
@@ -578,7 +578,7 @@ class base_extractor
}
// bzip2 must be written all the way at the end
- if ($this->format === 'bzip2')
+ if ($this->download && $this->format === 'bzip2')
{
$c = ob_get_clean();
echo bzcompress($c);
From ec9a091669e37b799c0fa66f81ccca1ca434afdb Mon Sep 17 00:00:00 2001
From: David M
Date: Fri, 16 Feb 2007 20:37:12 +0000
Subject: [PATCH 044/707] - some stupid bugs
git-svn-id: file:///svn/phpbb/trunk@6994 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/includes/acp/acp_database.php | 7 ++++++-
phpBB/language/en/acp/database.php | 1 +
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/phpBB/includes/acp/acp_database.php b/phpBB/includes/acp/acp_database.php
index e3da57fdfb..ed1dab4fd8 100644
--- a/phpBB/includes/acp/acp_database.php
+++ b/phpBB/includes/acp/acp_database.php
@@ -46,6 +46,11 @@ class acp_database
$format = request_var('method', '');
$where = request_var('where', '');
+ if (!sizeof($table))
+ {
+ trigger_error($user->lang['TABLE_SELECT_ERROR'] . adm_back_link($this->u_action));
+ }
+
$store = $download = $structure = $schema_data = false;
if ($where == 'store_and_download' || $where == 'store')
@@ -144,7 +149,7 @@ class acp_database
}
}
- $extractor->write_end($table_name);
+ $extractor->write_end();
if ($download == true)
{
diff --git a/phpBB/language/en/acp/database.php b/phpBB/language/en/acp/database.php
index 07605cc4cb..a59ebc416f 100644
--- a/phpBB/language/en/acp/database.php
+++ b/phpBB/language/en/acp/database.php
@@ -62,6 +62,7 @@ $lang = array_merge($lang, array(
'STRUCTURE_ONLY' => 'Structure only',
'TABLE_SELECT' => 'Table select',
+ 'TABLE_SELECT_ERROR'=> 'You must select at least one table.',
));
?>
\ No newline at end of file
From 72594577015eb9464aa0916c20ed9f8b41f6dfd6 Mon Sep 17 00:00:00 2001
From: Nils Adermann
Date: Fri, 16 Feb 2007 23:06:14 +0000
Subject: [PATCH 045/707] - allow converting from one database to another, no
need for tables to be in one database anylonger (this also allows switching
from one DBMS that was used with phpBB2 to another DBMS supported by phpBB3
including new systems available in Olympus only) - abstracted some
installation code that is now relevant to converting as well into
functions_install.php (mostly DBMS selection related) - fixed a weird smiley
path problem, no idea why nobody else noticed this, maybe my fix was
incorrect? - forgot to commit a file last time
git-svn-id: file:///svn/phpbb/trunk@6995 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/includes/functions_convert.php | 58 +-
phpBB/includes/functions_install.php | 455 ++++++++++++++++
phpBB/includes/mcp/mcp_post.php | 2 +-
phpBB/install/convertors/convert_phpbb20.php | 59 ++-
.../install/convertors/functions_phpbb20.php | 167 +++---
phpBB/install/index.php | 1 +
phpBB/install/install_convert.php | 432 ++++++++++++---
phpBB/install/install_install.php | 501 ++----------------
phpBB/language/en/install.php | 2 +-
9 files changed, 1071 insertions(+), 606 deletions(-)
create mode 100644 phpBB/includes/functions_install.php
diff --git a/phpBB/includes/functions_convert.php b/phpBB/includes/functions_convert.php
index 6df29fc0f4..4244645af8 100644
--- a/phpBB/includes/functions_convert.php
+++ b/phpBB/includes/functions_convert.php
@@ -558,7 +558,7 @@ function _import_check($config_var, $source, $use_target)
'relative_path' => (empty($convert->convertor['source_path_absolute'])) ? true : false,
);
- $target = $config[$config_var] . '/' . basename(($use_target === false) ? $source : $use_target);
+ $target = '../' . $config[$config_var] . '/' . basename(($use_target === false) ? $source : $use_target);
if (!empty($convert->convertor[$config_var]) && strpos($source, $convert->convertor[$config_var]) !== 0)
{
@@ -1068,7 +1068,7 @@ function add_user_group($group_id, $user_id, $group_leader=false)
*/
function user_group_auth($group, $select_query)
{
- global $convert, $phpbb_root_path, $config, $user, $db;
+ global $convert, $phpbb_root_path, $config, $user, $db, $src_db, $same_db;
if (!in_array($group, array('guests', 'registered', 'registered_coppa', 'global_moderators', 'administrators', 'bots')))
{
@@ -1089,9 +1089,33 @@ function user_group_auth($group, $select_query)
return;
}
- $sql = 'INSERT INTO ' . USER_GROUP_TABLE . ' (user_id, group_id, user_pending)
- ' . str_replace('{' . strtoupper($group) . '}', $group_id . ', 0', $select_query);
- $db->sql_query($sql);
+ if ($same_db)
+ {
+ $sql = 'INSERT INTO ' . USER_GROUP_TABLE . ' (user_id, group_id, user_pending)
+ ' . str_replace('{' . strtoupper($group) . '}', $group_id . ', 0', $select_query);
+ $db->sql_query($sql);
+ }
+ else
+ {
+ $result = $src_db->sql_query(str_replace('{' . strtoupper($group) . '}', $group_id . ', 0', $select_query));
+ while ($row = $src_db->sql_fetchrow($result))
+ {
+ // make sure it's exactly 3 ints that were returned
+ $data = array();
+ reset($row);
+ for ($i = 0; $i < 3; $i++)
+ {
+ $data[] = (int) current($row);
+ next($row);
+ }
+
+ // this might become quite a lot of INSERTS unfortunately
+ $sql = 'INSERT INTO ' . USER_GROUP_TABLE . ' (user_id, group_id, user_pending)
+ VALUES (' . implode(', ', $data) . ')';
+ $db->sql_query($sql);
+ }
+ $src_db->sql_freeresult($result);
+ }
}
/**
@@ -1109,14 +1133,19 @@ function get_config()
return $convert_config;
}
- global $db, $phpbb_root_path, $config;
+ global $src_db, $same_db, $phpbb_root_path, $config;
global $convert;
if ($convert->config_schema['table_format'] != 'file')
{
+ if ($convert->mysql_convert && $same_db)
+ {
+ $src_db->sql_query("SET NAMES 'binary'");
+ }
+
$sql = 'SELECT * FROM ' . $convert->src_table_prefix . $convert->config_schema['table_name'];
- $result = $db->sql_query($sql);
- $row = $db->sql_fetchrow($result);
+ $result = $src_db->sql_query($sql);
+ $row = $src_db->sql_fetchrow($result);
if (!$row)
{
@@ -1133,8 +1162,13 @@ function get_config()
{
$convert_config[$row[$key]] = $row[$val];
}
- while ($row = $db->sql_fetchrow($result));
- $db->sql_freeresult($result);
+ while ($row = $src_db->sql_fetchrow($result));
+ $src_db->sql_freeresult($result);
+
+ if ($convert->mysql_convert && $same_db)
+ {
+ $src_db->sql_query("SET NAMES 'utf8'");
+ }
}
else if ($convert->config_schema['table_format'] == 'file')
{
@@ -1153,6 +1187,10 @@ function get_config()
else
{
$convert_config = $row;
+ if ($convert->mysql_convert && $same_db)
+ {
+ $src_db->sql_query("SET NAMES 'utf8'");
+ }
}
if (!sizeof($convert_config))
diff --git a/phpBB/includes/functions_install.php b/phpBB/includes/functions_install.php
new file mode 100644
index 0000000000..0b7bbb607f
--- /dev/null
+++ b/phpBB/includes/functions_install.php
@@ -0,0 +1,455 @@
+ array(
+ 'LABEL' => 'FireBird',
+ 'SCHEMA' => 'firebird',
+ 'MODULE' => 'interbase',
+ 'DELIM' => ';;',
+ 'COMMENTS' => 'remove_remarks',
+ 'DRIVER' => 'firebird',
+ 'AVAILABLE' => true,
+ ),
+ 'mysqli' => array(
+ 'LABEL' => 'MySQL with MySQLi Extension',
+ 'SCHEMA' => 'mysql_41',
+ 'MODULE' => 'mysqli',
+ 'DELIM' => ';',
+ 'COMMENTS' => 'remove_remarks',
+ 'DRIVER' => 'mysqli',
+ 'AVAILABLE' => true,
+ ),
+ 'mysql' => array(
+ 'LABEL' => 'MySQL',
+ 'SCHEMA' => 'mysql',
+ 'MODULE' => 'mysql',
+ 'DELIM' => ';',
+ 'COMMENTS' => 'remove_remarks',
+ 'DRIVER' => 'mysql',
+ 'AVAILABLE' => true,
+ ),
+ 'mssql' => array(
+ 'LABEL' => 'MS SQL Server 2000+',
+ 'SCHEMA' => 'mssql',
+ 'MODULE' => 'mssql',
+ 'DELIM' => 'GO',
+ 'COMMENTS' => 'remove_comments',
+ 'DRIVER' => 'mssql',
+ 'AVAILABLE' => true,
+ ),
+ 'mssql_odbc'=> array(
+ 'LABEL' => 'MS SQL Server [ ODBC ]',
+ 'SCHEMA' => 'mssql',
+ 'MODULE' => 'odbc',
+ 'DELIM' => 'GO',
+ 'COMMENTS' => 'remove_comments',
+ 'DRIVER' => 'mssql_odbc',
+ 'AVAILABLE' => true,
+ ),
+ 'oracle' => array(
+ 'LABEL' => 'Oracle',
+ 'SCHEMA' => 'oracle',
+ 'MODULE' => 'oci8',
+ 'DELIM' => '/',
+ 'COMMENTS' => 'remove_comments',
+ 'DRIVER' => 'oracle',
+ 'AVAILABLE' => true,
+ ),
+ 'postgres' => array(
+ 'LABEL' => 'PostgreSQL 7.x/8.x',
+ 'SCHEMA' => 'postgres',
+ 'MODULE' => 'pgsql',
+ 'DELIM' => ';',
+ 'COMMENTS' => 'remove_comments',
+ 'DRIVER' => 'postgres',
+ 'AVAILABLE' => true,
+ ),
+ 'sqlite' => array(
+ 'LABEL' => 'SQLite',
+ 'SCHEMA' => 'sqlite',
+ 'MODULE' => 'sqlite',
+ 'DELIM' => ';',
+ 'COMMENTS' => 'remove_remarks',
+ 'DRIVER' => 'sqlite',
+ 'AVAILABLE' => true,
+ ),
+ );
+
+ if ($dbms)
+ {
+ if (isset($available_dbms[$dbms]))
+ {
+ $available_dbms = array($dbms => $available_dbms[$dbms]);
+ }
+ else
+ {
+ return array();
+ }
+ }
+
+ // now perform some checks whether they are really available
+ foreach ($available_dbms as $db_name => $db_ary)
+ {
+ $dll = $db_ary['MODULE'];
+
+ if (!@extension_loaded($dll))
+ {
+ if (!can_load_dll($dll))
+ {
+ if ($return_unavailable)
+ {
+ $available_dbms[$db_name]['AVAILABLE'] = false;
+ }
+ else
+ {
+ unset($available_dbms[$db_name]);
+ }
+ continue;
+ }
+ }
+ $any_db_support = true;
+ }
+
+ if ($return_unavailable)
+ {
+ $available_dbms['ANY_DB_SUPPORT'] = $any_db_support;
+ }
+ return $available_dbms;
+}
+
+/**
+* Generate the drop down of available database options
+*/
+function dbms_select($default='')
+{
+ $available_dbms = get_available_dbms();
+ $dbms_options = '';
+ foreach ($available_dbms as $dbms_name => $details)
+ {
+ $selected = ($dbms_name == $default) ? ' selected="selected"' : '';
+ $dbms_options .= '' . $details['LABEL'] . ' ';
+ }
+ return $dbms_options;
+}
+
+
+/**
+* Used to test whether we are able to connect to the database the user has specified
+* and identify any problems (eg there are already tables with the names we want to use
+* @param array $dbms should be of the format of an element of the array returned by {@link get_available_dbms get_available_dbms()}
+* necessary extensions should be loaded already
+*/
+function connect_check_db($error_connect, &$error, $dbms, $table_prefix, $dbhost, $dbuser, $dbpasswd, $dbname, $dbport, $prefix_may_exist = false, $load_dbal = true)
+{
+ global $phpbb_root_path, $phpEx, $config, $lang;
+
+ if ($load_dbal)
+ {
+ // Include the DB layer
+ include($phpbb_root_path . 'includes/db/' . $dbms['DRIVER'] . '.' . $phpEx);
+ }
+
+ // Instantiate it and set return on error true
+ $sql_db = 'dbal_' . $dbms['DRIVER'];
+ $db = new $sql_db();
+ $db->sql_return_on_error(true);
+
+ // Check that we actually have a database name before going any further.....
+ if ($dbms['DRIVER'] != 'sqlite' && $dbname === '')
+ {
+ $error[] = $lang['INST_ERR_DB_NO_NAME'];
+ return false;
+ }
+
+ // Make sure we don't have a daft user who thinks having the SQLite database in the forum directory is a good idea
+ if ($dbms['DRIVER'] == 'sqlite' && stripos(phpbb_realpath($dbhost), phpbb_realpath('../')) === 0)
+ {
+ $error[] = $lang['INST_ERR_DB_FORUM_PATH'];
+ return false;
+ }
+
+ // Check the prefix length to ensure that index names are not too long and does not contain invalid characters
+ switch ($dbms['DRIVER'])
+ {
+ case 'mysql':
+ case 'mysqli':
+ if (strpos($table_prefix, '-') !== false)
+ {
+ $error[] = $lang['INST_ERR_PREFIX_INVALID'];
+ return false;
+ }
+
+ // no break;
+
+ case 'postgres':
+ $prefix_length = 36;
+ break;
+
+ case 'mssql':
+ case 'mssql_odbc':
+ $prefix_length = 90;
+ break;
+
+ case 'sqlite':
+ $prefix_length = 200;
+ break;
+
+ case 'firebird':
+ case 'oracle':
+ $prefix_length = 6;
+ break;
+ }
+
+ if (strlen($table_prefix) > $prefix_length)
+ {
+ $error[] = sprintf($lang['INST_ERR_PREFIX_TOO_LONG'], $prefix_length);
+ return false;
+ }
+
+ // Try and connect ...
+ if (is_array($db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false)))
+ {
+ $db_error = $db->sql_error();
+ $error[] = $lang['INST_ERR_DB_CONNECT'] . ' ' . (($db_error['message']) ? $db_error['message'] : $lang['INST_ERR_DB_NO_ERROR']);
+ }
+ else
+ {
+ switch ($dbms['DRIVER'])
+ {
+ case 'mysql':
+ case 'mysqli':
+ $sql = 'SHOW TABLES';
+ $field = "Tables_in_{$dbname}";
+ break;
+
+ case 'sqlite':
+ $sql = 'SELECT name
+ FROM sqlite_master
+ WHERE type = "table"';
+ $field = 'name';
+ break;
+
+ case 'mssql':
+ case 'mssql_odbc':
+ $sql = "SELECT name
+ FROM sysobjects
+ WHERE type='U'";
+ $field = 'name';
+ break;
+
+ case 'postgres':
+ $sql = "SELECT relname
+ FROM pg_class
+ WHERE relkind = 'r'
+ AND relname NOT LIKE 'pg\_%'";
+ $field = 'relname';
+ break;
+
+ case 'firebird':
+ $sql = 'SELECT rdb$relation_name
+ FROM rdb$relations
+ WHERE rdb$view_source is null
+ AND rdb$system_flag = 0';
+ $field = 'rdb$relation_name';
+ break;
+
+ case 'oracle':
+ $sql = 'SELECT table_name
+ FROM USER_TABLES';
+ $field = 'table_name';
+ break;
+ }
+ $result = $db->sql_query($sql);
+
+ if ($row = $db->sql_fetchrow($result))
+ {
+ // Likely matches for an existing phpBB installation
+ $temp_prefix = strtolower($table_prefix);
+ $table_ary = array($temp_prefix . 'attachments', $temp_prefix . 'config', $temp_prefix . 'sessions', $temp_prefix . 'topics', $temp_prefix . 'users');
+
+ do
+ {
+ // All phpBB installations will at least have config else it won't work
+ if (in_array(strtolower($row[$field]), $table_ary))
+ {
+ if (!$prefix_may_exist)
+ {
+ $error[] = $lang['INST_ERR_PREFIX'];
+ }
+ break;
+ }
+ }
+ while ($row = $db->sql_fetchrow($result));
+ }
+ $db->sql_freeresult($result);
+
+ // Make sure that the user has selected a sensible DBAL for the DBMS actually installed
+ switch ($dbms['DRIVER'])
+ {
+ case 'mysqli':
+ if (version_compare(mysqli_get_server_info($db->db_connect_id), '4.1.3', '<'))
+ {
+ $error[] = $lang['INST_ERR_DB_NO_MYSQLI'];
+ }
+ break;
+
+ case 'sqlite':
+ if (version_compare(sqlite_libversion(), '2.8.2', '<'))
+ {
+ $error[] = $lang['INST_ERR_DB_NO_SQLITE'];
+ }
+ break;
+
+ case 'firebird':
+ // check the version of FB, use some hackery if we can't get access to the server info
+ if ($db->service_handle !== false && function_exists('ibase_server_info'))
+ {
+ $val = @ibase_server_info($db->service_handle, IBASE_SVC_SERVER_VERSION);
+ preg_match('#V([\d.]+)#', $val, $match);
+ if ($match[1] < 2)
+ {
+ $error[] = $lang['INST_ERR_DB_NO_FIREBIRD'];
+ }
+ $db_info = @ibase_db_info($db->service_handle, $dbname, IBASE_STS_HDR_PAGES);
+
+ preg_match('/^\\s*Page size\\s*(\\d+)/m', $db_info, $regs);
+ $page_size = intval($regs[1]);
+ if ($page_size < 8192)
+ {
+ $error[] = $lang['INST_ERR_DB_NO_FIREBIRD_PS'];
+ }
+ }
+ else
+ {
+ $sql = "SELECT *
+ FROM RDB$FUNCTIONS
+ WHERE RDB$SYSTEM_FLAG IS NULL
+ AND RDB$FUNCTION_NAME = 'CHAR_LENGTH'";
+ $result = $db->sql_query($sql);
+ $row = $db->sql_fetchrow($result);
+ $db->sql_freeresult($result);
+
+ // if its a UDF, its too old
+ if ($row)
+ {
+ $error[] = $lang['INST_ERR_DB_NO_FIREBIRD'];
+ }
+ else
+ {
+ $sql = "SELECT FIRST 0 char_length('')
+ FROM RDB\$DATABASE";
+ $result = $db->sql_query($sql);
+ if (!$result) // This can only fail if char_length is not defined
+ {
+ $error[] = $lang['INST_ERR_DB_NO_FIREBIRD'];
+ }
+ $db->sql_freeresult($result);
+ }
+
+ // Setup the stuff for our random table
+ $char_array = array_merge(range('A', 'Z'), range('0', '9'));
+ $char_len = mt_rand(7, 9);
+ $char_array_len = sizeof($char_array) - 1;
+
+ $final = '';
+
+ for ($i = 0; $i < $char_len; $i++)
+ {
+ $final .= $char_array[mt_rand(0, $char_array_len)];
+ }
+
+ // Create some random table
+ $sql = 'CREATE TABLE ' . $final . " (
+ FIELD1 VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE,
+ FIELD2 INTEGER DEFAULT 0 NOT NULL);";
+ $db->sql_query($sql);
+
+ // Create an index that should fail if the page size is less than 8192
+ $sql = 'CREATE INDEX ' . $final . ' ON ' . $final . '(FIELD1, FIELD2);';
+ $db->sql_query($sql);
+
+ if (ibase_errmsg() !== false)
+ {
+ $error[] = $lang['INST_ERR_DB_NO_FIREBIRD_PS'];
+ }
+ else
+ {
+ // Kill the old table
+ $db->sql_query('DROP TABLE ' . $final . ';');
+ }
+ unset($final);
+ }
+ break;
+
+ case 'oracle':
+ $sql = "SELECT *
+ FROM NLS_DATABASE_PARAMETERS
+ WHERE PARAMETER = 'NLS_RDBMS_VERSION'
+ OR PARAMETER = 'NLS_CHARACTERSET'";
+ $result = $db->sql_query($sql);
+
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $stats[$row['parameter']] = $row['value'];
+ }
+ $db->sql_freeresult($result);
+
+ if (version_compare($stats['NLS_RDBMS_VERSION'], '9.2', '<') && $stats['NLS_CHARACTERSET'] !== 'UTF8')
+ {
+ $error[] = $lang['INST_ERR_DB_NO_ORACLE'];
+ }
+ break;
+
+ case 'postgres':
+ $sql = "SHOW server_encoding;";
+ $result = $db->sql_query($sql);
+ $row = $db->sql_fetchrow($result);
+ $db->sql_freeresult($result);
+
+ if ($row['server_encoding'] !== 'UNICODE' && $row['server_encoding'] !== 'UTF8')
+ {
+ $error[] = $lang['INST_ERR_DB_NO_POSTGRES'];
+ }
+ break;
+ }
+
+ $db->sql_close();
+ }
+
+ if ($error_connect && (!isset($error) || !sizeof($error)))
+ {
+ return true;
+ }
+ return false;
+}
+
+?>
\ No newline at end of file
diff --git a/phpBB/includes/mcp/mcp_post.php b/phpBB/includes/mcp/mcp_post.php
index 67f5472134..6ce9067d9e 100644
--- a/phpBB/includes/mcp/mcp_post.php
+++ b/phpBB/includes/mcp/mcp_post.php
@@ -426,7 +426,7 @@ function change_poster(&$post_info, $userdata)
$to_username = $userdata['username'];
// Renew post info
- $post_info = get_post_data(array($post_id));
+ $post_info = get_post_data(array($post_id), false, true);
if (!sizeof($post_info))
{
diff --git a/phpBB/install/convertors/convert_phpbb20.php b/phpBB/install/convertors/convert_phpbb20.php
index 6c55a42440..4f66d3848a 100644
--- a/phpBB/install/convertors/convert_phpbb20.php
+++ b/phpBB/install/convertors/convert_phpbb20.php
@@ -31,6 +31,12 @@ $convertor_data = array(
'version' => '0.9',
'phpbb_version' => '3.0.0',
'author' => 'phpBB Group ',
+ 'dbms' => 'mysql',
+ 'dbhost' => 'localhost',
+ 'dbport' => '',
+ 'dbuser' => 'user',
+ 'dbpasswd' => 'password',
+ 'dbname' => '',
'table_prefix' => 'phpbb_',
'forum_path' => '../forums',
'author_notes' => 'Avatars may be on a different width/height than with the old forum. This is due to dimensions being stored within phpBB3 but not within phpBB2. The default dimension was set to 80x80 for avatars where dimension settings could not be determined. You might wish to instruct your users to check their profiles after the conversion to ensure that the size is correct.',
@@ -210,7 +216,8 @@ if (!$get_info)
* 'schema' Syntax Description
* -> 'target' => Target Table. If not specified the next table will be handled
* -> 'primary' => Primary Key. If this is specified then this table is processed in batches
-* -> 'query_first' => Query to execute before beginning the process (if more than one then specified as array)
+* -> 'query_first' => array('target' or 'src', Query to execute before beginning the process
+* (if more than one then specified as array))
* -> 'function_first' => Function to execute before beginning the process (if more than one then specified as array)
* (This is mostly useful if variables need to be given to the converting process)
* -> 'test_file' => This is not used at the moment but should be filled with a file from the old installation
@@ -276,10 +283,10 @@ if (!$get_info)
// We empty some tables to have clean data available
'query_first' => array(
- $convert->truncate_statement . SEARCH_RESULTS_TABLE,
- $convert->truncate_statement . SEARCH_WORDLIST_TABLE,
- $convert->truncate_statement . SEARCH_WORDMATCH_TABLE,
- $convert->truncate_statement . LOG_TABLE,
+ array('target', $convert->truncate_statement . SEARCH_RESULTS_TABLE),
+ array('target', $convert->truncate_statement . SEARCH_WORDLIST_TABLE),
+ array('target', $convert->truncate_statement . SEARCH_WORDMATCH_TABLE),
+ array('target', $convert->truncate_statement . LOG_TABLE),
),
// with this you are able to import all attachment files on the fly. For large boards this is not an option, therefore commented out by default.
@@ -313,7 +320,7 @@ if (!$get_info)
array(
'target' => (defined('MOD_ATTACHMENT')) ? ATTACHMENTS_TABLE : '',
'primary' => 'attachments.attach_id',
- 'query_first' => (defined('MOD_ATTACHMENT')) ? $convert->truncate_statement . ATTACHMENTS_TABLE : '',
+ 'query_first' => (defined('MOD_ATTACHMENT')) ? array('target', $convert->truncate_statement . ATTACHMENTS_TABLE) : '',
'autoincrement' => 'attach_id',
array('attach_id', 'attachments.attach_id', ''),
@@ -363,7 +370,7 @@ if (!$get_info)
array(
'target' => (defined('MOD_ATTACHMENT')) ? EXTENSIONS_TABLE : '',
- 'query_first' => (defined('MOD_ATTACHMENT')) ? $convert->truncate_statement . EXTENSIONS_TABLE : '',
+ 'query_first' => (defined('MOD_ATTACHMENT')) ? array('target', $convert->truncate_statement . EXTENSIONS_TABLE) : '',
'autoincrement' => 'extension_id',
array('extension_id', 'extensions.ext_id', ''),
@@ -373,7 +380,7 @@ if (!$get_info)
array(
'target' => (defined('MOD_ATTACHMENT')) ? EXTENSION_GROUPS_TABLE : '',
- 'query_first' => (defined('MOD_ATTACHMENT')) ? $convert->truncate_statement . EXTENSION_GROUPS_TABLE : '',
+ 'query_first' => (defined('MOD_ATTACHMENT')) ? array('target', $convert->truncate_statement . EXTENSION_GROUPS_TABLE) : '',
'autoincrement' => 'group_id',
array('group_id', 'extension_groups.group_id', ''),
@@ -389,7 +396,7 @@ if (!$get_info)
array(
'target' => BANLIST_TABLE,
- 'query_first' => $convert->truncate_statement . BANLIST_TABLE,
+ 'query_first' => array('target', $convert->truncate_statement . BANLIST_TABLE),
array('ban_ip', 'banlist.ban_ip', 'decode_ban_ip'),
array('ban_userid', 'banlist.ban_userid', 'phpbb_user_id'),
@@ -410,14 +417,14 @@ if (!$get_info)
array(
'target' => DISALLOW_TABLE,
- 'query_first' => $convert->truncate_statement . DISALLOW_TABLE,
+ 'query_first' => array('target', $convert->truncate_statement . DISALLOW_TABLE),
array('disallow_username', 'disallow.disallow_username', 'phpbb_disallowed_username'),
),
array(
'target' => RANKS_TABLE,
- 'query_first' => $convert->truncate_statement . RANKS_TABLE,
+ 'query_first' => array('target', $convert->truncate_statement . RANKS_TABLE),
'autoincrement' => 'rank_id',
array('rank_id', 'ranks.rank_id', ''),
@@ -429,7 +436,7 @@ if (!$get_info)
array(
'target' => TOPICS_TABLE,
- 'query_first' => $convert->truncate_statement . TOPICS_TABLE,
+ 'query_first' => array('target', $convert->truncate_statement . TOPICS_TABLE),
'primary' => 'topics.topic_id',
'autoincrement' => 'topic_id',
@@ -493,7 +500,7 @@ if (!$get_info)
array(
'target' => TOPICS_WATCH_TABLE,
'primary' => 'topics_watch.topic_id',
- 'query_first' => $convert->truncate_statement . TOPICS_WATCH_TABLE,
+ 'query_first' => array('target', $convert->truncate_statement . TOPICS_WATCH_TABLE),
array('topic_id', 'topics_watch.topic_id', ''),
array('user_id', 'topics_watch.user_id', 'phpbb_user_id'),
@@ -502,7 +509,7 @@ if (!$get_info)
array(
'target' => SMILIES_TABLE,
- 'query_first' => $convert->truncate_statement . SMILIES_TABLE,
+ 'query_first' => array('target', $convert->truncate_statement . SMILIES_TABLE),
'autoincrement' => 'smiley_id',
array('smiley_id', 'smilies.smilies_id', ''),
@@ -522,7 +529,7 @@ if (!$get_info)
array(
'target' => POLL_OPTIONS_TABLE,
'primary' => 'vote_results.vote_option_id',
- 'query_first' => $convert->truncate_statement . POLL_OPTIONS_TABLE,
+ 'query_first' => array('target', $convert->truncate_statement . POLL_OPTIONS_TABLE),
array('poll_option_id', 'vote_results.vote_option_id', ''),
array('topic_id', 'vote_desc.topic_id', ''),
@@ -537,7 +544,7 @@ if (!$get_info)
array(
'target' => POLL_VOTES_TABLE,
'primary' => 'vote_desc.topic_id',
- 'query_first' => $convert->truncate_statement . POLL_VOTES_TABLE,
+ 'query_first' => array('target', $convert->truncate_statement . POLL_VOTES_TABLE),
array('poll_option_id', 1, ''),
array('topic_id', 'vote_desc.topic_id', ''),
@@ -550,7 +557,7 @@ if (!$get_info)
array(
'target' => WORDS_TABLE,
'primary' => 'words.word_id',
- 'query_first' => $convert->truncate_statement . WORDS_TABLE,
+ 'query_first' => array('target', $convert->truncate_statement . WORDS_TABLE),
'autoincrement' => 'word_id',
array('word_id', 'words.word_id', ''),
@@ -562,7 +569,7 @@ if (!$get_info)
'target' => POSTS_TABLE,
'primary' => 'posts.post_id',
'autoincrement' => 'post_id',
- 'query_first' => $convert->truncate_statement . POSTS_TABLE,
+ 'query_first' => array('target', $convert->truncate_statement . POSTS_TABLE),
'execute_first' => '
$config["max_post_chars"] = 0;
',
@@ -607,8 +614,8 @@ if (!$get_info)
'primary' => 'privmsgs.privmsgs_id',
'autoincrement' => 'privmsgs_id',
'query_first' => array(
- $convert->truncate_statement . PRIVMSGS_TABLE,
- $convert->truncate_statement . PRIVMSGS_RULES_TABLE,
+ array('target', $convert->truncate_statement . PRIVMSGS_TABLE),
+ array('target', $convert->truncate_statement . PRIVMSGS_RULES_TABLE),
),
'execute_first' => '
@@ -645,7 +652,7 @@ if (!$get_info)
array(
'target' => PRIVMSGS_FOLDER_TABLE,
'primary' => 'users.user_id',
- 'query_first' => $convert->truncate_statement . PRIVMSGS_FOLDER_TABLE,
+ 'query_first' => array('target', $convert->truncate_statement . PRIVMSGS_FOLDER_TABLE),
array('user_id', 'users.user_id', 'phpbb_user_id'),
array('folder_name', $user->lang['CONV_SAVED_MESSAGES'], ''),
@@ -658,7 +665,7 @@ if (!$get_info)
array(
'target' => PRIVMSGS_TO_TABLE,
'primary' => 'privmsgs.privmsgs_id',
- 'query_first' => $convert->truncate_statement . PRIVMSGS_TO_TABLE,
+ 'query_first' => array('target', $convert->truncate_statement . PRIVMSGS_TO_TABLE),
array('msg_id', 'privmsgs.privmsgs_id', ''),
array('user_id', 'privmsgs.privmsgs_to_userid', 'phpbb_user_id'),
@@ -753,7 +760,7 @@ if (!$get_info)
array(
'target' => GROUPS_TABLE,
'autoincrement' => 'group_id',
- 'query_first' => $convert->truncate_statement . GROUPS_TABLE,
+ 'query_first' => array('target', $convert->truncate_statement . GROUPS_TABLE),
array('group_id', 'groups.group_id', ''),
array('group_type', 'groups.group_type', 'phpbb_convert_group_type'),
@@ -766,7 +773,7 @@ if (!$get_info)
array(
'target' => USER_GROUP_TABLE,
- 'query_first' => $convert->truncate_statement . USER_GROUP_TABLE,
+ 'query_first' => array('target', $convert->truncate_statement . USER_GROUP_TABLE),
'execute_first' => '
add_default_groups();
',
@@ -795,8 +802,8 @@ if (!$get_info)
'primary' => 'users.user_id',
'autoincrement' => 'user_id',
'query_first' => array(
- 'DELETE FROM ' . USERS_TABLE . ' WHERE user_id <> ' . ANONYMOUS,
- $convert->truncate_statement . BOTS_TABLE
+ array('target', 'DELETE FROM ' . USERS_TABLE . ' WHERE user_id <> ' . ANONYMOUS),
+ array('target', $convert->truncate_statement . BOTS_TABLE)
),
array('user_id', 'users.user_id', 'phpbb_user_id'),
diff --git a/phpBB/install/convertors/functions_phpbb20.php b/phpBB/install/convertors/functions_phpbb20.php
index fdde80c82c..c80a0a0de2 100644
--- a/phpBB/install/convertors/functions_phpbb20.php
+++ b/phpBB/install/convertors/functions_phpbb20.php
@@ -46,16 +46,16 @@ function phpbb_forum_flags()
*/
function phpbb_insert_forums()
{
- global $db, $convert, $user, $config;
+ global $db, $src_db, $same_db, $convert, $user, $config;
$db->sql_query($convert->truncate_statement . FORUMS_TABLE);
// Determine the highest id used within the old forums table (we add the categories after the forum ids)
$sql = 'SELECT MAX(forum_id) AS max_forum_id
FROM ' . $convert->src_table_prefix . 'forums';
- $result = $db->sql_query($sql);
- $max_forum_id = (int) $db->sql_fetchfield('max_forum_id');
- $db->sql_freeresult($result);
+ $result = $src_db->sql_query($sql);
+ $max_forum_id = (int) $src_db->sql_fetchfield('max_forum_id');
+ $src_db->sql_freeresult($result);
$max_forum_id++;
@@ -64,16 +64,16 @@ function phpbb_insert_forums()
FROM ' . $convert->src_table_prefix . 'categories
ORDER BY cat_order';
- if ($convert->mysql_convert)
+ if ($convert->mysql_convert && $same_db)
{
- $db->sql_query("SET NAMES 'binary'");
+ $src_db->sql_query("SET NAMES 'binary'");
}
- $result = $db->sql_query($sql);
+ $result = $src_db->sql_query($sql);
- if ($convert->mysql_convert)
+ if ($convert->mysql_convert && $same_db)
{
- $db->sql_query("SET NAMES 'utf8'");
+ $src_db->sql_query("SET NAMES 'utf8'");
}
switch ($db->sql_layer)
@@ -85,7 +85,7 @@ function phpbb_insert_forums()
}
$cats_added = array();
- while ($row = $db->sql_fetchrow($result))
+ while ($row = $src_db->sql_fetchrow($result))
{
$sql_ary = array(
'forum_id' => $max_forum_id,
@@ -113,17 +113,17 @@ function phpbb_insert_forums()
$cats_added[$row['cat_id']] = $max_forum_id;
$max_forum_id++;
}
- $db->sql_freeresult($result);
+ $src_db->sql_freeresult($result);
// There may be installations having forums with non-existant category ids.
// We try to catch them and add them to an "unknown" category instead of leaving them out.
$sql = 'SELECT cat_id
FROM ' . $convert->src_table_prefix . 'forums
GROUP BY cat_id';
- $result = $db->sql_query($sql);
+ $result = $src_db->sql_query($sql);
$unknown_cat_id = false;
- while ($row = $db->sql_fetchrow($result))
+ while ($row = $src_db->sql_fetchrow($result))
{
// Catch those categories not been added before
if (!isset($cats_added[$row['cat_id']]))
@@ -131,7 +131,7 @@ function phpbb_insert_forums()
$unknown_cat_id = true;
}
}
- $db->sql_freeresult($result);
+ $src_db->sql_freeresult($result);
// Is there at least one category not known?
if ($unknown_cat_id === true)
@@ -171,19 +171,19 @@ function phpbb_insert_forums()
GROUP BY f.forum_id, f.forum_name, f.cat_id, f.forum_desc, f.forum_status, f.prune_enable, f.prune_next, f.forum_order, fp.prune_days, fp.prune_freq
ORDER BY f.cat_id, f.forum_order';
- if ($convert->mysql_convert)
+ if ($convert->mysql_convert && $same_db)
{
- $db->sql_query("SET NAMES 'binary'");
+ $src_db->sql_query("SET NAMES 'binary'");
}
- $result = $db->sql_query($sql);
+ $result = $src_db->sql_query($sql);
- if ($convert->mysql_convert)
+ if ($convert->mysql_convert && $same_db)
{
- $db->sql_query("SET NAMES 'utf8'");
+ $src_db->sql_query("SET NAMES 'utf8'");
}
- while ($row = $db->sql_fetchrow($result))
+ while ($row = $src_db->sql_fetchrow($result))
{
// Some might have forums here with an id not being "possible"...
// To be somewhat friendly we "change" the category id for those to a previously created ghost category
@@ -266,7 +266,7 @@ function phpbb_insert_forums()
$sql = 'INSERT INTO ' . FORUMS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary);
$db->sql_query($sql);
}
- $db->sql_freeresult($result);
+ $src_db->sql_freeresult($result);
switch ($db->sql_layer)
{
@@ -342,14 +342,24 @@ function phpbb_set_encoding($text, $grab_user_lang = true)
}
else if (!empty($convert_row['poster_id']))
{
- global $db;
+ global $src_db, $same_db;
+
+ if ($convert->mysql_convert && $same_db)
+ {
+ $src_db->sql_query("SET NAMES 'binary'");
+ }
$sql = 'SELECT user_lang
FROM ' . $convert->src_table_prefix . 'users
WHERE user_id = ' . (int) $convert_row['poster_id'];
- $result = $db->sql_query($sql);
- $get_lang = (string) $db->sql_fetchfield('user_lang');
- $db->sql_freeresult($result);
+ $result = $src_db->sql_query($sql);
+ $get_lang = (string) $src_db->sql_fetchfield('user_lang');
+ $src_db->sql_freeresult($result);
+
+ if ($convert->mysql_convert && $same_db)
+ {
+ $src_db->sql_query("SET NAMES 'utf8'");
+ }
$get_lang = (!trim($get_lang)) ? trim(get_config_value('default_lang')) : trim($get_lang);
}
@@ -441,15 +451,25 @@ function phpbb_user_id($user_id)
// Increment user id if the old forum is having a user with the id 1
if (!isset($config['increment_user_id']))
{
- global $db, $convert;
+ global $src_db, $same_db, $convert;
+
+ if ($convert->mysql_convert && $same_db)
+ {
+ $src_db->sql_query("SET NAMES 'binary'");
+ }
// Now let us set a temporary config variable for user id incrementing
$sql = "SELECT user_id
FROM {$convert->src_table_prefix}users
WHERE user_id = 1";
- $result = $db->sql_query($sql);
- $id = (int) $db->sql_fetchfield('user_id');
- $db->sql_freeresult($result);
+ $result = $src_db->sql_query($sql);
+ $id = (int) $src_db->sql_fetchfield('user_id');
+ $src_db->sql_freeresult($result);
+
+ if ($convert->mysql_convert && $same_db)
+ {
+ $src_db->sql_query("SET NAMES 'utf8'");
+ }
// If there is a user id 1, we need to increment user ids. :/
if ($id === 1)
@@ -484,7 +504,7 @@ function phpbb_copy_table_fields()
*/
function phpbb_convert_authentication($mode)
{
- global $db, $convert, $user, $config, $cache;
+ global $db, $src_db, $same_db, $convert, $user, $config, $cache;
if ($mode == 'start')
{
@@ -494,14 +514,15 @@ function phpbb_convert_authentication($mode)
// What we will do is handling all 2.0.x admins as founder to replicate what is common in 2.0.x.
// After conversion the main admin need to make sure he is removing permissions and the founder status if wanted.
+
// Grab user ids of users with user_level of ADMIN
$sql = "SELECT user_id
FROM {$convert->src_table_prefix}users
WHERE user_level = 1
ORDER BY user_regdate ASC";
- $result = $db->sql_query($sql);
+ $result = $src_db->sql_query($sql);
- while ($row = $db->sql_fetchrow($result))
+ while ($row = $src_db->sql_fetchrow($result))
{
$user_id = (int) phpbb_user_id($row['user_id']);
@@ -511,49 +532,58 @@ function phpbb_convert_authentication($mode)
WHERE user_id = $user_id";
$db->sql_query($sql);
}
- $db->sql_freeresult($result);
+ $src_db->sql_freeresult($result);
}
// Grab forum auth information
$sql = "SELECT *
FROM {$convert->src_table_prefix}forums";
- $result = $db->sql_query($sql);
+ $result = $src_db->sql_query($sql);
$forum_access = array();
- while ($row = $db->sql_fetchrow($result))
+ while ($row = $src_db->sql_fetchrow($result))
{
$forum_access[] = $row;
}
- $db->sql_freeresult($result);
+ $src_db->sql_freeresult($result);
+ if ($convert->mysql_convert && $same_db)
+ {
+ $src_db->sql_query("SET NAMES 'binary'");
+ }
// Grab user auth information from 2.0.x board
$sql = "SELECT ug.user_id, aa.*
FROM {$convert->src_table_prefix}auth_access aa, {$convert->src_table_prefix}user_group ug, {$convert->src_table_prefix}groups g
WHERE g.group_id = aa.group_id
AND g.group_single_user = 1
AND ug.group_id = g.group_id";
- $result = $db->sql_query($sql);
+ $result = $src_db->sql_query($sql);
$user_access = array();
- while ($row = $db->sql_fetchrow($result))
+ while ($row = $src_db->sql_fetchrow($result))
{
$user_access[$row['forum_id']][] = $row;
}
- $db->sql_freeresult($result);
+ $src_db->sql_freeresult($result);
// Grab group auth information
$sql = "SELECT g.group_id, aa.*
FROM {$convert->src_table_prefix}auth_access aa, {$convert->src_table_prefix}groups g
WHERE g.group_id = aa.group_id
AND g.group_single_user <> 1";
- $result = $db->sql_query($sql);
+ $result = $src_db->sql_query($sql);
$group_access = array();
- while ($row = $db->sql_fetchrow($result))
+ while ($row = $src_db->sql_fetchrow($result))
{
$group_access[$row['forum_id']][] = $row;
}
- $db->sql_freeresult($result);
+ $src_db->sql_freeresult($result);
+
+ if ($convert->mysql_convert && $same_db)
+ {
+ $src_db->sql_query("SET NAMES 'utf8'");
+ }
// Add Forum Access List
$auth_map = array(
@@ -852,25 +882,25 @@ function phpbb_convert_authentication($mode)
$sql = 'SELECT user_id FROM ' . $convert->src_table_prefix . 'users
WHERE user_allowavatar = 0
AND user_id > 0';
- $result = $db->sql_query($sql);
+ $result = $src_db->sql_query($sql);
- while ($row = $db->sql_fetchrow($result))
+ while ($row = $src_db->sql_fetchrow($result))
{
mass_auth('user_role', 0, (int) phpbb_user_id($row['user_id']), 'USER_NOAVATAR');
}
- $db->sql_freeresult($result);
+ $src_db->sql_freeresult($result);
// And the same for those who have had their PM rights removed
$sql = 'SELECT user_id FROM ' . $convert->src_table_prefix . 'users
WHERE user_allow_pm = 0
AND user_id > 0';
- $result = $db->sql_query($sql);
+ $result = $src_db->sql_query($sql);
- while ($row = $db->sql_fetchrow($result))
+ while ($row = $src_db->sql_fetchrow($result))
{
mass_auth('user_role', 0, (int) phpbb_user_id($row['user_id']), 'USER_NOPM');
}
- $db->sql_freeresult($result);
+ $src_db->sql_freeresult($result);
}
else if ($mode == 'third')
{
@@ -1169,21 +1199,30 @@ function phpbb_get_files_dir()
return;
}
- global $db, $convert, $user, $config, $cache;
+ global $src_db, $same_db, $convert, $user, $config, $cache;
+ if ($convert->mysql_convert && $same_db)
+ {
+ $src_db->sql_query("SET NAMES 'binary'");
+ }
$sql = 'SELECT config_value AS upload_dir
FROM ' . $convert->src_table_prefix . "attachments_config
WHERE config_name = 'upload_dir'";
- $result = $db->sql_query($sql);
- $upload_path = $db->sql_fetchfield('upload_dir');
- $db->sql_freeresult($result);
+ $result = $src_db->sql_query($sql);
+ $upload_path = $src_db->sql_fetchfield('upload_dir');
+ $src_db->sql_freeresult($result);
$sql = 'SELECT config_value AS ftp_upload
FROM ' . $convert->src_table_prefix . "attachments_config
WHERE config_name = 'allow_ftp_upload'";
- $result = $db->sql_query($sql);
- $ftp_upload = (int) $db->sql_fetchfield('ftp_upload');
- $db->sql_freeresult($result);
+ $result = $src_db->sql_query($sql);
+ $ftp_upload = (int) $src_db->sql_fetchfield('ftp_upload');
+ $src_db->sql_freeresult($result);
+
+ if ($convert->mysql_convert && $same_db)
+ {
+ $src_db->sql_query("SET NAMES 'utf8'");
+ }
if ($ftp_upload)
{
@@ -1402,18 +1441,28 @@ function phpbb_get_savebox_id($user_id)
*/
function phpbb_import_attach_config()
{
- global $db, $convert, $config;
+ global $db, $src_db, $same_db, $convert, $config;
+
+ if ($convert->mysql_convert && $same_db)
+ {
+ $src_db->sql_query("SET NAMES 'binary'");
+ }
$sql = 'SELECT *
FROM ' . $convert->src_table_prefix . 'attachments_config';
- $result = $db->sql_query($sql);
+ $result = $src_db->sql_query($sql);
+
+ if ($convert->mysql_convert && $same_db)
+ {
+ $src_db->sql_query("SET NAMES 'utf8'");
+ }
$attach_config = array();
- while ($row = $db->sql_fetchrow($result))
+ while ($row = $src_db->sql_fetchrow($result))
{
$attach_config[$row['config_name']] = $row['config_value'];
}
- $db->sql_freeresult($result);
+ $src_db->sql_freeresult($result);
set_config('allow_attachments', 1);
diff --git a/phpBB/install/index.php b/phpBB/install/index.php
index eb49ac5c9b..146f55ddb6 100755
--- a/phpBB/install/index.php
+++ b/phpBB/install/index.php
@@ -115,6 +115,7 @@ include($phpbb_root_path . 'includes/acm/acm_file.' . $phpEx);
include($phpbb_root_path . 'includes/cache.' . $phpEx);
include($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
include($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx);
+require($phpbb_root_path . 'includes/functions_install.' . $phpEx);
// Try and load an appropriate language if required
$language = request_var('language', '');
diff --git a/phpBB/install/install_convert.php b/phpBB/install/install_convert.php
index 0656f7e5f4..a3541f6f29 100644
--- a/phpBB/install/install_convert.php
+++ b/phpBB/install/install_convert.php
@@ -39,12 +39,19 @@ class convert
var $options = array();
var $convertor_tag = '';
+ var $src_dbms = '';
+ var $src_dbhost = '';
+ var $src_dbport = '';
+ var $src_dbuser = '';
+ var $src_dbpasswd = '';
+ var $src_dbname = '';
var $src_table_prefix = '';
var $convertor_data = array();
var $tables = array();
var $config_schema = array();
var $convertor = array();
+ var $src_truncate_statement = 'DELETE FROM ';
var $truncate_statement = 'DELETE FROM ';
var $fulltext_search;
@@ -142,19 +149,32 @@ class install_convert extends module
if ($new_conversion)
{
$config['convert_progress'] = '';
- $db->sql_query('DELETE FROM ' . CONFIG_TABLE . " WHERE config_name = 'convert_progress'");
+ $config['convert_db_server'] = '';
+ $config['convert_db_user'] = '';
+ $db->sql_query('DELETE FROM ' . CONFIG_TABLE . "
+ WHERE config_name = 'convert_progress'
+ OR config_name = 'convert_db_server'
+ OR config_name = 'convert_db_user'"
+ );
}
// Let's see if there is a conversion in the works...
$options = array();
- if (!empty($config['convert_progress']) && !empty($config['convert_options']))
+ if (!empty($config['convert_progress']) && !empty($config['convert_db_server']) && !empty($config['convert_db_user']) && !empty($config['convert_options']))
{
$options = unserialize($config['convert_progress']);
- $options = array_merge($options, unserialize($config['convert_options']));
+ $options = array_merge($options, unserialize($config['convert_db_server']), unserialize($config['convert_db_user']), unserialize($config['convert_options']));
}
// This information should have already been checked once, but do it again for safety
- if (!empty($options) && !empty($options['tag']) && isset($options['table_prefix']))
+ if (!empty($options) && !empty($options['tag']) &&
+ isset($convert->options['dbms']) &&
+ isset($convert->options['dbhost']) &&
+ isset($convert->options['dbport']) &&
+ isset($convert->options['dbuser']) &&
+ isset($convert->options['dbpasswd']) &&
+ isset($convert->options['dbname']) &&
+ isset($convert->options['table_prefix']))
{
$this->page_title = $lang['CONTINUE_CONVERT'];
@@ -270,6 +290,12 @@ class install_convert extends module
'tag' => $m[1],
'forum_name' => $convertor_data['forum_name'],
'version' => $convertor_data['version'],
+ 'dbms' => $convertor_data['dbms'],
+ 'dbhost' => $convertor_data['dbhost'],
+ 'dbport' => $convertor_data['dbport'],
+ 'dbuser' => $convertor_data['dbuser'],
+ 'dbpasswd' => $convertor_data['dbpasswd'],
+ 'dbname' => $convertor_data['dbname'],
'table_prefix' => $convertor_data['table_prefix'],
'author' => $convertor_data['author']
);
@@ -347,6 +373,12 @@ class install_convert extends module
$submit = (isset($_POST['submit'])) ? true : false;
+ $src_dbms = request_var('src_dbms', $convertor_data['dbms']);
+ $src_dbhost = request_var('src_dbhost', $convertor_data['dbhost']);
+ $src_dbport = request_var('src_dbport', $convertor_data['dbport']);
+ $src_dbuser = request_var('src_dbuser', $convertor_data['dbuser']);
+ $src_dbpasswd = request_var('src_dbpasswd', $convertor_data['dbpasswd']);
+ $src_dbname = request_var('src_dbname', $convertor_data['dbname']);
$src_table_prefix = request_var('src_table_prefix', $convertor_data['table_prefix']);
$forum_path = request_var('forum_path', $convertor_data['forum_path']);
$refresh = request_var('refresh', 1);
@@ -364,10 +396,22 @@ class install_convert extends module
$error[] = sprintf($lang['COULD_NOT_FIND_PATH'], $forum_path);
}
- // The forum prefix of the old and the new forum can't be the same because the
- // convertor requires all tables to be in one database. I.e. there can't be
- // two tables named 'phpbb_users'
- if ($src_table_prefix == $table_prefix)
+ $connect_test = false;
+ $available_dbms = get_available_dbms(false, true);
+
+ if (!isset($available_dbms[$src_dbms]) || !$available_dbms[$src_dbms]['AVAILABLE'])
+ {
+ $error['db'][] = $lang['INST_ERR_NO_DB'];
+ $connect_test = false;
+ }
+ else
+ {
+ $src_dbpasswd = htmlspecialchars_decode($src_dbpasswd);
+ $connect_test = connect_check_db(true, $error, $available_dbms[$src_dbms], false, $src_dbhost, $src_dbuser, $src_dbpasswd, $src_dbname, $src_dbport, ($src_dbms == $dbms) ? false : true);
+ }
+
+ // The forum prefix of the old and the new forum can only be the same if two different databases are used.
+ if ($src_table_prefix == $table_prefix && $src_dbms == $dbms && $src_dbhost == $dbhost && $src_dbport == $dbport && $src_dbname == $dbname)
{
$error[] = sprintf($lang['TABLE_PREFIX_SAME'], $src_table_prefix);
}
@@ -375,17 +419,35 @@ class install_convert extends module
// Check table prefix
if (!sizeof($error))
{
+ // initiate database connection to old db if old and new db differ
+ global $src_db, $same_db;
+ $src_db = $same_db = null;
+
+ if ($src_dbms != $dbms || $src_dbhost != $dbhost || $src_dbport != $dbport || $src_dbname != $dbname || $src_dbuser != $dbuser)
+ {
+ $sql_db = 'dbal_' . $src_dbms;
+ $src_db = new $sql_db();
+ $src_db->sql_connect($src_dbhost, $src_dbuser, $src_dbpasswd, $src_dbname, $src_dbport, false);
+ $same_db = false;
+ }
+ else
+ {
+ $src_db = &$db;
+ $same_db = true;
+ }
+
+ $src_db->sql_return_on_error(true);
$db->sql_return_on_error(true);
// Try to select one row from the first table to see if the prefix is OK
- $result = $db->sql_query_limit('SELECT * FROM ' . $src_table_prefix . $tables[0], 1);
+ $result = $src_db->sql_query_limit('SELECT * FROM ' . $src_table_prefix . $tables[0], 1);
if (!$result)
{
$prefixes = array();
- if ($result = $db->sql_query('SHOW TABLES'))
+ if ($result = $src_db->sql_query('SHOW TABLES'))
{
- while ($row = $db->sql_fetchrow($result))
+ while ($row = $src_db->sql_fetchrow($result))
{
if (sizeof($row) > 1)
{
@@ -396,7 +458,7 @@ class install_convert extends module
compare_table($tables, $tablename, $prefixes);
}
}
- $db->sql_freeresult($result);
+ $src_->sql_freeresult($result);
}
foreach ($prefixes as $prefix => $count)
@@ -423,14 +485,28 @@ class install_convert extends module
$error[] = $msg;
}
- $db->sql_freeresult($result);
- $db->sql_return_on_error(false);
+ $src_db->sql_freeresult($result);
+ $src_db->sql_return_on_error(false);
}
if (!sizeof($error))
{
// Save convertor Status
- set_config('convert_progress', serialize(array('step' => '', 'table_prefix' => $src_table_prefix, 'tag' => $convertor_tag)), true);
+ set_config('convert_progress', serialize(array(
+ 'step' => '',
+ 'table_prefix' => $src_table_prefix,
+ 'tag' => $convertor_tag,
+ )), true);
+ set_config('convert_db_server', serialize(array(
+ 'dbms' => $src_dbms,
+ 'dbhost' => $src_dbhost,
+ 'dbport' => $src_dbport,
+ 'dbname' => $src_dbname,
+ )), true);
+ set_config('convert_db_user', serialize(array(
+ 'dbuser' => $src_dbuser,
+ 'dbpasswd' => $src_dbpasswd,
+ )), true);
// Save options
set_config('convert_options', serialize(array('forum_path' => './../' . $forum_path, 'refresh' => $refresh)), true);
@@ -527,24 +603,6 @@ class install_convert extends module
// @todo Need to confirm that max post length in source is <= max post length in destination or there may be interesting formatting issues
$config['max_post_chars'] = -1;
- $convert->mysql_convert = false;
-
- switch ($db->sql_layer)
- {
- // Thanks MySQL, for silently converting...
- case 'mysql':
- case 'mysql4':
- if (version_compare($db->mysql_version, '4.1.3', '>='))
- {
- $convert->mysql_convert = true;
- }
- break;
-
- case 'mysqli':
- $convert->mysql_convert = true;
- break;
- }
-
// Set up a user as well. We _should_ have enough of a database here at this point to do this
// and it helps for any core code we call
$user->session_begin();
@@ -560,19 +618,84 @@ class install_convert extends module
if (isset($config['convert_progress']))
{
$convert->options = unserialize($config['convert_progress']);
- $convert->options = array_merge($convert->options, unserialize($config['convert_options']));
+ $convert->options = array_merge($convert->options, unserialize($config['convert_db_server']), unserialize($config['convert_db_user']), unserialize($config['convert_options']));
}
// This information should have already been checked once, but do it again for safety
- if (empty($convert->options) || empty($convert->options['tag']) || !isset($convert->options['table_prefix']))
+ if (empty($convert->options) || empty($convert->options['tag']) ||
+ !isset($convert->options['dbms']) ||
+ !isset($convert->options['dbhost']) ||
+ !isset($convert->options['dbport']) ||
+ !isset($convert->options['dbuser']) ||
+ !isset($convert->options['dbpasswd']) ||
+ !isset($convert->options['dbname']) ||
+ !isset($convert->options['table_prefix']))
{
$this->p_master->error($user->lang['NO_CONVERT_SPECIFIED'], __LINE__, __FILE__);
}
// Make some short variables accessible, for easier referencing
$convert->convertor_tag = basename($convert->options['tag']);
+ $convert->src_dbms = $convert->options['dbms'];
+ $convert->src_dbhost = $convert->options['dbhost'];
+ $convert->src_dbport = $convert->options['dbport'];
+ $convert->src_dbuser = $convert->options['dbuser'];
+ $convert->src_dbpasswd = $convert->options['dbpasswd'];
+ $convert->src_dbname = $convert->options['dbname'];
$convert->src_table_prefix = $convert->options['table_prefix'];
+ // initiate database connection to old db if old and new db differ
+ global $src_db, $same_db;
+ $src_db = $same_db = null;
+ if ($convert->src_dbms != $dbms || $convert->src_dbhost != $dbhost || $convert->src_dbport != $dbport || $convert->src_dbname != $dbname || $convert->src_dbuser != $dbuser)
+ {
+ if ($convert->src_dbms != $dbms)
+ {
+ require($phpbb_root_path . 'includes/db/' . $convert->src_dbms . '.' . $phpEx);
+ }
+ $sql_db = 'dbal_' . $convert->src_dbms;
+ $src_db = new $sql_db();
+ $src_db->sql_connect($convert->src_dbhost, $convert->src_dbuser, $convert->src_dbpasswd, $convert->src_dbname, $convert->src_dbport, false);
+ $same_db = false;
+ }
+ else
+ {
+ $src_db = &$db;
+ $same_db = true;
+ }
+
+ $convert->mysql_convert = false;
+ switch ($src_db->sql_layer)
+ {
+ case 'sqlite':
+ case 'firebird':
+ $convert->src_truncate_statement = 'DELETE FROM ';
+ break;
+
+ // Thanks MySQL, for silently converting...
+ case 'mysql':
+ case 'mysql4':
+ if (version_compare($src_db->mysql_version, '4.1.3', '>='))
+ {
+ $convert->mysql_convert = true;
+ }
+ $convert->src_truncate_statement = 'TRUNCATE TABLE ';
+ break;
+
+ case 'mysqli':
+ $convert->mysql_convert = true;
+ $convert->src_truncate_statement = 'TRUNCATE TABLE ';
+ break;
+
+ default:
+ $convert->src_truncate_statement = 'TRUNCATE TABLE ';
+ break;
+ }
+
+ if ($convert->mysql_convert && !$same_db)
+ {
+ $src_db->sql_query("SET NAMES 'binary'");
+ }
switch ($db->sql_layer)
{
@@ -785,19 +908,19 @@ class install_convert extends module
}
// Check if the tables that we need exist
- $db->sql_return_on_error(true);
+ $src_db->sql_return_on_error(true);
foreach ($tables_list as $table => $null)
{
$sql = 'SELECT 1 FROM ' . $table;
- $_result = $db->sql_query_limit($sql, 1);
+ $_result = $src_db->sql_query_limit($sql, 1);
if (!$_result)
{
$missing_tables[] = $table;
}
- $db->sql_freeresult($_result);
+ $src_db->sql_freeresult($_result);
}
- $db->sql_return_on_error(false);
+ $src_db->sql_return_on_error(false);
// Throw an error if some tables are missing
// We used to do some guessing here, but since we have a suggestion of possible values earlier, I don't see it adding anything here to do it again
@@ -812,7 +935,21 @@ class install_convert extends module
}
$step = '&confirm=1';
- set_config('convert_progress', serialize(array('step' => $step, 'table_prefix' => $convert->src_table_prefix, 'tag' => $convert->convertor_tag)), true);
+ set_config('convert_progress', serialize(array(
+ 'step' => $step,
+ 'table_prefix' => $convert->src_table_prefix,
+ 'tag' => $convert->convertor_tag,
+ )), true);
+ set_config('convert_db_server', serialize(array(
+ 'dbms' => $convert->src_dbms,
+ 'dbhost' => $convert->src_dbhost,
+ 'dbport' => $convert->src_dbport,
+ 'dbname' => $convert->src_dbname,
+ )), true);
+ set_config('convert_db_user', serialize(array(
+ 'dbuser' => $convert->src_dbuser,
+ 'dbpasswd' => $convert->src_dbpasswd,
+ )), true);
$msg = $user->lang['PRE_CONVERT_COMPLETE'] . '' . sprintf($user->lang['AUTHOR_NOTES'], $convert->convertor_data['author_notes']);
$url = $this->p_master->module_url . "?mode=$mode&sub=in_progress&tag={$convert->convertor_tag}$step";
@@ -858,12 +995,33 @@ class install_convert extends module
{
if (!is_array($convert->convertor['query_first']))
{
- $convert->convertor['query_first'] = array($convert->convertor['query_first']);
+ $convert->convertor['query_first'] = array('target', array($convert->convertor['query_first']));
+ }
+ else if (!is_array($convert->convertor['query_first'][0]))
+ {
+ $convert->convertor['query_first'] = array(array($convert->convertor['query_first'][0], $convert->convertor['query_first'][1]));
}
foreach ($convert->convertor['query_first'] as $query_first)
{
- $db->sql_query($query_first);
+ if ($query_first[0] == 'src')
+ {
+ if ($convert->mysql_convert && $same_db)
+ {
+ $src_db->sql_query("SET NAMES 'binary'");
+ }
+
+ $src_db->sql_query($query_first[1]);
+
+ if ($convert->mysql_convert && $same_db)
+ {
+ $src_db->sql_query("SET NAMES 'utf8'");
+ }
+ }
+ else
+ {
+ $db->sql_query($query_first[1]);
+ }
}
}
@@ -907,12 +1065,31 @@ class install_convert extends module
{
if (!is_array($schema['query_first']))
{
- $schema['query_first'] = array($schema['query_first']);
+ $schema['query_first'] = array('target', array($schema['query_first']));
+ }
+ else if (!is_array($schema['query_first'][0]))
+ {
+ $schema['query_first'] = array(array($schema['query_first'][0], $schema['query_first'][1]));
}
foreach ($schema['query_first'] as $query_first)
{
- $db->sql_query($query_first);
+ if ($query_first[0] == 'src')
+ {
+ if ($convert->mysql_convert && $same_db)
+ {
+ $src_db->sql_query("SET NAMES 'binary'");
+ }
+ $src_db->sql_query($query_first[1]);
+ if ($convert->mysql_convert && $same_db)
+ {
+ $src_db->sql_query("SET NAMES 'utf8'");
+ }
+ }
+ else
+ {
+ $db->sql_query($query_first[1]);
+ }
}
}
@@ -1004,17 +1181,17 @@ class install_convert extends module
$mtime = explode(' ', microtime());
$batch_time = $mtime[0] + $mtime[1];
- if ($convert->mysql_convert)
+ if ($convert->mysql_convert && $same_db)
{
- $db->sql_query("SET NAMES 'binary'");
+ $src_db->sql_query("SET NAMES 'binary'");
}
// Take skip rows into account and only fetch batch_size amount of rows
- $___result = $db->sql_query_limit($sql, $convert->batch_size, $skip_rows);
+ $___result = $src_db->sql_query_limit($sql, $convert->batch_size, $skip_rows);
- if ($convert->mysql_convert)
+ if ($convert->mysql_convert && $same_db)
{
- $db->sql_query("SET NAMES 'utf8'");
+ $src_db->sql_query("SET NAMES 'utf8'");
}
// This loop processes each row
@@ -1036,12 +1213,12 @@ class install_convert extends module
// Now handle the rows until time is over or no more rows to process...
while (still_on_time())
{
- $convert_row = $db->sql_fetchrow($___result);
+ $convert_row = $src_db->sql_fetchrow($___result);
if (!$convert_row)
{
// move to the next batch or table
- $db->sql_freeresult($___result);
+ $src_db->sql_freeresult($___result);
break;
}
@@ -1184,7 +1361,21 @@ class install_convert extends module
$step = '¤t_table=' . $current_table . '&skip_rows=' . $skip_rows;
// Save convertor Status
- set_config('convert_progress', serialize(array('step' => $step, 'table_prefix' => $convert->src_table_prefix, 'tag' => $convert->convertor_tag)), true);
+ set_config('convert_progress', serialize(array(
+ 'step' => $step,
+ 'table_prefix' => $convert->src_table_prefix,
+ 'tag' => $convert->convertor_tag,
+ )), true);
+ set_config('convert_db_server', serialize(array(
+ 'dbms' => $convert->src_dbms,
+ 'dbhost' => $convert->src_dbhost,
+ 'dbport' => $convert->src_dbport,
+ 'dbname' => $convert->src_dbname,
+ )), true);
+ set_config('convert_db_user', serialize(array(
+ 'dbuser' => $convert->src_dbuser,
+ 'dbpasswd' => $convert->src_dbpasswd,
+ )), true);
$current_table++;
// $percentage = ($skip_rows == 0) ? 0 : floor(100 / ($total_rows / $skip_rows));
@@ -1208,7 +1399,21 @@ class install_convert extends module
$step = '&jump=1';
// Save convertor Status
- set_config('convert_progress', serialize(array('step' => $step, 'table_prefix' => $convert->src_table_prefix, 'tag' => $convert->convertor_tag)), true);
+ set_config('convert_progress', serialize(array(
+ 'step' => $step,
+ 'table_prefix' => $convert->src_table_prefix,
+ 'tag' => $convert->convertor_tag,
+ )), true);
+ set_config('convert_db_server', serialize(array(
+ 'dbms' => $convert->src_dbms,
+ 'dbhost' => $convert->src_dbhost,
+ 'dbport' => $convert->src_dbport,
+ 'dbname' => $convert->src_dbname,
+ )), true);
+ set_config('convert_db_user', serialize(array(
+ 'dbuser' => $convert->src_dbuser,
+ 'dbpasswd' => $convert->src_dbpasswd,
+ )), true);
$url = $this->p_master->module_url . "?mode=$mode&sub=in_progress&tag={$convert->convertor_tag}$step";
@@ -1278,7 +1483,10 @@ class install_convert extends module
$sync_batch = -1;
$db->sql_query('DELETE FROM ' . CONFIG_TABLE . "
- WHERE config_name = 'convert_progress' OR config_name = 'convert_options'");
+ WHERE config_name = 'convert_progress'
+ OR config_name = 'convert_options'
+ OR config_name = 'convert_db_server'
+ OR config_name = 'convert_db_user'");
$db->sql_query('DELETE FROM ' . SESSIONS_TABLE);
@unlink($phpbb_root_path . 'cache/data_global.php');
@@ -1305,7 +1513,21 @@ class install_convert extends module
$step = '&sync_batch=' . $sync_batch;
// Save convertor Status
- set_config('convert_progress', serialize(array('step' => $step, 'table_prefix' => $convert->options['table_prefix'], 'tag' => $convert->convertor_tag)), true);
+ set_config('convert_progress', serialize(array(
+ 'step' => $step,
+ 'table_prefix' => $convert->src_table_prefix,
+ 'tag' => $convert->convertor_tag,
+ )), true);
+ set_config('convert_db_server', serialize(array(
+ 'dbms' => $convert->src_dbms,
+ 'dbhost' => $convert->src_dbhost,
+ 'dbport' => $convert->src_dbport,
+ 'dbname' => $convert->src_dbname,
+ )), true);
+ set_config('convert_db_user', serialize(array(
+ 'dbuser' => $convert->src_dbuser,
+ 'dbpasswd' => $convert->src_dbpasswd,
+ )), true);
$url = $this->p_master->module_url . "?mode=$this->mode&sub=in_progress&tag={$convert->convertor_tag}$step";
@@ -1323,7 +1545,7 @@ class install_convert extends module
*/
function jump($jump, $last_statement)
{
- global $template, $user, $db, $phpbb_root_path, $phpEx, $config, $cache;
+ global $template, $user, $src_db, $same_db, $db, $phpbb_root_path, $phpEx, $config, $cache;
global $convert;
$template->assign_block_vars('checks', array(
@@ -1355,7 +1577,21 @@ class install_convert extends module
$step = '&jump=1&last=' . $last_statement;
// Save convertor Status
- set_config('convert_progress', serialize(array('step' => $step, 'table_prefix' => $convert->src_table_prefix, 'tag' => $convert->convertor_tag)), true);
+ set_config('convert_progress', serialize(array(
+ 'step' => $step,
+ 'table_prefix' => $convert->src_table_prefix,
+ 'tag' => $convert->convertor_tag,
+ )), true);
+ set_config('convert_db_server', serialize(array(
+ 'dbms' => $convert->src_dbms,
+ 'dbhost' => $convert->src_dbhost,
+ 'dbport' => $convert->src_dbport,
+ 'dbname' => $convert->src_dbname,
+ )), true);
+ set_config('convert_db_user', serialize(array(
+ 'dbuser' => $convert->src_dbuser,
+ 'dbpasswd' => $convert->src_dbpasswd,
+ )), true);
$percentage = ($last_statement == 0) ? 0 : floor(100 / (sizeof($convert->convertor['execute_last']) / $last_statement));
$msg = sprintf($user->lang['STEP_PERCENT_COMPLETED'], $last_statement, sizeof($convert->convertor['execute_last']), $percentage);
@@ -1377,17 +1613,39 @@ class install_convert extends module
{
if (!is_array($convert->convertor['query_last']))
{
- $convert->convertor['query_last'] = array($convert->convertor['query_last']);
+ $convert->convertor['query_last'] = array('target', array($convert->convertor['query_last']));
+ }
+ else if (!is_array($convert->convertor['query_last'][0]))
+ {
+ $convert->convertor['query_last'] = array(array($convert->convertor['query_last'][0], $convert->convertor['query_last'][1]));
}
foreach ($convert->convertor['query_last'] as $query_last)
{
- $db->sql_query($query_last);
+ if ($query_last[0] == 'src')
+ {
+ if ($convert->mysql_convert && $same_db)
+ {
+ $src_db->sql_query("SET NAMES 'binary'");
+ }
+
+ $src_db->sql_query($query_last[1]);
+
+ if ($convert->mysql_convert && $same_db)
+ {
+ $src_db->sql_query("SET NAMES 'utf8'");
+ }
+ }
+ else
+ {
+ $db->sql_query($query_last[1]);
+ }
}
}
// Sanity check
$db->sql_return_on_error(false);
+ $src_db->sql_return_on_error(false);
fix_empty_primary_groups();
@@ -1416,7 +1674,21 @@ class install_convert extends module
$step = '&jump=2';
// Save convertor Status
- set_config('convert_progress', serialize(array('step' => $step, 'table_prefix' => $convert->src_table_prefix, 'tag' => $convert->convertor_tag)), true);
+ set_config('convert_progress', serialize(array(
+ 'step' => $step,
+ 'table_prefix' => $convert->src_table_prefix,
+ 'tag' => $convert->convertor_tag,
+ )), true);
+ set_config('convert_db_server', serialize(array(
+ 'dbms' => $convert->src_dbms,
+ 'dbhost' => $convert->src_dbhost,
+ 'dbport' => $convert->src_dbport,
+ 'dbname' => $convert->src_dbname,
+ )), true);
+ set_config('convert_db_user', serialize(array(
+ 'dbuser' => $convert->src_dbuser,
+ 'dbpasswd' => $convert->src_dbpasswd,
+ )), true);
$url = $this->p_master->module_url . "?mode={$this->mode}&sub=in_progress&tag={$convert->convertor_tag}$step";
@@ -1446,7 +1718,21 @@ class install_convert extends module
$step = '&jump=3';
// Save convertor Status
- set_config('convert_progress', serialize(array('step' => $step, 'table_prefix' => $convert->src_table_prefix, 'tag' => $convert->convertor_tag)), true);
+ set_config('convert_progress', serialize(array(
+ 'step' => $step,
+ 'table_prefix' => $convert->src_table_prefix,
+ 'tag' => $convert->convertor_tag,
+ )), true);
+ set_config('convert_db_server', serialize(array(
+ 'dbms' => $convert->src_dbms,
+ 'dbhost' => $convert->src_dbhost,
+ 'dbport' => $convert->src_dbport,
+ 'dbname' => $convert->src_dbname,
+ )), true);
+ set_config('convert_db_user', serialize(array(
+ 'dbuser' => $convert->src_dbuser,
+ 'dbpasswd' => $convert->src_dbpasswd,
+ )), true);
$url = $this->p_master->module_url . "?mode={$this->mode}&sub=in_progress&tag={$convert->convertor_tag}$step";
@@ -1472,7 +1758,21 @@ class install_convert extends module
$step = '&sync_batch=0';
// Save convertor Status
- set_config('convert_progress', serialize(array('step' => $step, 'table_prefix' => $convert->src_table_prefix, 'tag' => $convert->convertor_tag)), true);
+ set_config('convert_progress', serialize(array(
+ 'step' => $step,
+ 'table_prefix' => $convert->src_table_prefix,
+ 'tag' => $convert->convertor_tag,
+ )), true);
+ set_config('convert_db_server', serialize(array(
+ 'dbms' => $convert->src_dbms,
+ 'dbhost' => $convert->src_dbhost,
+ 'dbport' => $convert->src_dbport,
+ 'dbname' => $convert->src_dbname,
+ )), true);
+ set_config('convert_db_user', serialize(array(
+ 'dbuser' => $convert->src_dbuser,
+ 'dbpasswd' => $convert->src_dbpasswd,
+ )), true);
$url = $this->p_master->module_url . "?mode={$this->mode}&sub=in_progress&tag={$convert->convertor_tag}$step";
@@ -1810,10 +2110,16 @@ class install_convert extends module
*/
var $convert_options = array(
'legend1' => 'SPECIFY_OPTIONS',
+ 'src_dbms' => array('lang' => 'DBMS', 'type' => 'select', 'options' => 'dbms_select(\'{VALUE}\')', 'explain' => false),
+ 'src_dbhost' => array('lang' => 'DB_HOST', 'type' => 'text:25:100', 'explain' => true),
+ 'src_dbport' => array('lang' => 'DB_PORT', 'type' => 'text:25:100', 'explain' => true),
+ 'src_dbname' => array('lang' => 'DB_NAME', 'type' => 'text:25:100', 'explain' => false),
+ 'src_dbuser' => array('lang' => 'DB_USERNAME', 'type' => 'text:25:100', 'explain' => false),
+ 'src_dbpasswd' => array('lang' => 'DB_PASSWORD', 'type' => 'password:25:100', 'explain' => false),
'src_table_prefix' => array('lang' => 'TABLE_PREFIX', 'type' => 'text:25:100', 'explain' => false),
//'src_url' => array('lang' => 'FORUM_ADDRESS', 'type' => 'text:50:100', 'explain' => true),
'forum_path' => array('lang' => 'FORUM_PATH', 'type' => 'text:25:100', 'explain' => true),
- 'refresh' => array('lang' => 'REFRESH_PAGE', 'type' => 'radio:yes_no', 'explain' => true),
+ 'refresh' => array('lang' => 'REFRESH_PAGE', 'type' => 'radio:yes_no', 'explain' => true),
);
}
diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php
index 79fd828784..ca91cf6396 100755
--- a/phpBB/install/install_install.php
+++ b/phpBB/install/install_install.php
@@ -208,7 +208,7 @@ class install_install extends module
* Better not enabling and adding to the loaded extensions due to the specific requirements needed
if (!@extension_loaded('mbstring'))
{
- $this->can_load_dll('mbstring');
+ can_load_dll('mbstring');
}
*/
@@ -276,35 +276,32 @@ class install_install extends module
'LEGEND_EXPLAIN' => $lang['PHP_SUPPORTED_DB_EXPLAIN'],
));
- $dlls_db = array();
- $passed['db'] = false;
- foreach ($this->available_dbms as $db_name => $db_ary)
+ $available_dbms = get_available_dbms(false, true);
+ $passed['db'] = $available_dbms['ANY_DB_SUPPORT'];
+ unset($available_dbms['ANY_DB_SUPPORT']);
+
+ foreach ($available_dbms as $db_name => $db_ary)
{
- $dll = $db_ary['MODULE'];
-
- if (!@extension_loaded($dll))
+ if (!$db_ary['AVAILABLE'])
{
- if (!$this->can_load_dll($dll))
- {
- $template->assign_block_vars('checks', array(
- 'TITLE' => $lang['DLL_' . strtoupper($db_name)],
- 'RESULT' => '' . $lang['UNAVAILABLE'] . ' ',
+ $template->assign_block_vars('checks', array(
+ 'TITLE' => $lang['DLL_' . strtoupper($db_name)],
+ 'RESULT' => '' . $lang['UNAVAILABLE'] . ' ',
- 'S_EXPLAIN' => false,
- 'S_LEGEND' => false,
- ));
- continue;
- }
+ 'S_EXPLAIN' => false,
+ 'S_LEGEND' => false,
+ ));
}
+ else
+ {
+ $template->assign_block_vars('checks', array(
+ 'TITLE' => $lang['DLL_' . strtoupper($db_name)],
+ 'RESULT' => '' . $lang['AVAILABLE'] . ' ',
- $template->assign_block_vars('checks', array(
- 'TITLE' => $lang['DLL_' . strtoupper($db_name)],
- 'RESULT' => '' . $lang['AVAILABLE'] . ' ',
-
- 'S_EXPLAIN' => false,
- 'S_LEGEND' => false,
- ));
- $passed['db'] = true;
+ 'S_EXPLAIN' => false,
+ 'S_LEGEND' => false,
+ ));
+ }
}
// Test for other modules
@@ -318,7 +315,7 @@ class install_install extends module
{
if (!@extension_loaded($dll))
{
- if (!$this->can_load_dll($dll))
+ if (!can_load_dll($dll))
{
$template->assign_block_vars('checks', array(
'TITLE' => $lang['DLL_' . strtoupper($dll)],
@@ -502,21 +499,22 @@ class install_install extends module
}
$connect_test = false;
+ $error = array();
+ $available_dbms = get_available_dbms(false, true);
// Has the user opted to test the connection?
if (isset($_POST['testdb']))
{
- // If the module for the selected database isn't loaded, let's try and load it now
- if (!@extension_loaded($this->available_dbms[$dbms]['MODULE']))
+ if (!isset($available_dbms[$dbms]) || !$available_dbms[$dbms]['AVAILABLE'])
{
- if (!$this->can_load_dll($this->available_dbms[$dbms]['MODULE']))
- {
- $error['db'][] = $lang['INST_ERR_NO_DB'];
- }
+ $error['db'][] = $lang['INST_ERR_NO_DB'];
+ $connect_test = false;
+ }
+ else
+ {
+ $dbpasswd = htmlspecialchars_decode($dbpasswd);
+ $connect_test = connect_check_db(true, $error, $available_dbms[$dbms], $table_prefix, $dbhost, $dbuser, $dbpasswd, $dbname, $dbport);
}
-
- $dbpasswd = htmlspecialchars_decode($dbpasswd);
- $connect_test = $this->connect_check_db(true, $error, $dbms, $table_prefix, $dbhost, $dbuser, $dbpasswd, $dbname, $dbport);
$template->assign_block_vars('checks', array(
'S_LEGEND' => true,
@@ -550,20 +548,17 @@ class install_install extends module
{
// Update the list of available DBMS modules to only contain those which can be used
$available_dbms_temp = array();
- foreach ($this->available_dbms as $type => $dbms_ary)
+ foreach ($available_dbms as $type => $dbms_ary)
{
- if (!@extension_loaded($dbms_ary['MODULE']))
+ if (!$dbms_ary['AVAILABLE'])
{
- if (!$this->can_load_dll($dbms_ary['MODULE']))
- {
- continue;
- }
+ continue;
}
$available_dbms_temp[$type] = $dbms_ary;
}
- $this->available_dbms = &$available_dbms_temp;
+ $available_dbms = &$available_dbms_temp;
// And now for the main part of this page
$table_prefix = (!empty($table_prefix) ? $table_prefix : 'phpbb_');
@@ -828,7 +823,8 @@ class install_install extends module
// Create a list of any PHP modules we wish to have loaded
$load_extensions = array();
- $check_exts = array_merge(array($this->available_dbms[$dbms]['MODULE']), $this->php_dlls_other);
+ $available_dbms = get_available_dbms($dbms);
+ $check_exts = array_merge(array($available_dbms[$dbms]['MODULE']), $this->php_dlls_other);
$suffix = (defined('PHP_OS') && strpos(strtolower(PHP_OS), 'win') === 0) ? 'dll' : 'so';
@@ -836,7 +832,7 @@ class install_install extends module
{
if (!@extension_loaded($dll))
{
- if (!$this->can_load_dll($dll))
+ if (!can_load_dll($dll))
{
continue;
}
@@ -860,7 +856,7 @@ class install_install extends module
// Time to convert the data provided into a config file
$config_data = "available_dbms[$dbms]['DRIVER'] . "';\n";
+ $config_data .= "\$dbms = '" . $available_dbms[$dbms]['DRIVER'] . "';\n";
$config_data .= "\$dbhost = '$dbhost';\n";
$config_data .= "\$dbport = '$dbport';\n";
$config_data .= "\$dbname = '$dbname';\n";
@@ -1085,19 +1081,16 @@ class install_install extends module
$cookie_domain = str_replace('www.', '.', $cookie_domain);
}
- // If we get here and the extension isn't loaded it should be safe to just go ahead and load it
- if (!@extension_loaded($this->available_dbms[$dbms]['MODULE']))
- {
- $this->can_load_dll($this->available_dbms[$dbms]['MODULE']);
- }
+ // If we get here and the extension isn't loaded it should be safe to just go ahead and load it
+ $available_dbms = get_available_dbms($dbms);
$dbpasswd = htmlspecialchars_decode($dbpasswd);
// Load the appropriate database class if not already loaded
- include($phpbb_root_path . 'includes/db/' . $this->available_dbms[$dbms]['DRIVER'] . '.' . $phpEx);
+ include($phpbb_root_path . 'includes/db/' . $available_dbms[$dbms]['DRIVER'] . '.' . $phpEx);
// Instantiate the database
- $sql_db = 'dbal_' . $this->available_dbms[$dbms]['DRIVER'];
+ $sql_db = 'dbal_' . $available_dbms[$dbms]['DRIVER'];
$db = new $sql_db();
$db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false);
@@ -1109,21 +1102,21 @@ class install_install extends module
{
if (version_compare($db->mysql_version, '4.1.3', '>='))
{
- $this->available_dbms[$dbms]['SCHEMA'] .= '_41';
+ $available_dbms[$dbms]['SCHEMA'] .= '_41';
}
else
{
- $this->available_dbms[$dbms]['SCHEMA'] .= '_40';
+ $available_dbms[$dbms]['SCHEMA'] .= '_40';
}
}
// Ok we have the db info go ahead and read in the relevant schema
// and work on building the table
- $dbms_schema = 'schemas/' . $this->available_dbms[$dbms]['SCHEMA'] . '_schema.sql';
+ $dbms_schema = 'schemas/' . $available_dbms[$dbms]['SCHEMA'] . '_schema.sql';
// How should we treat this schema?
- $remove_remarks = $this->available_dbms[$dbms]['COMMENTS'];
- $delimiter = $this->available_dbms[$dbms]['DELIM'];
+ $remove_remarks = $available_dbms[$dbms]['COMMENTS'];
+ $delimiter = $available_dbms[$dbms]['DELIM'];
$sql_query = @file_get_contents($dbms_schema);
@@ -1309,7 +1302,7 @@ class install_install extends module
if (!@extension_loaded('gd'))
{
- $this->can_load_dll('gd');
+ can_load_dll('gd');
}
// This is for people who have TTF and GD
@@ -1372,16 +1365,13 @@ class install_install extends module
$dbpasswd = htmlspecialchars_decode($dbpasswd);
// If we get here and the extension isn't loaded it should be safe to just go ahead and load it
- if (!@extension_loaded($this->available_dbms[$dbms]['MODULE']))
- {
- $this->can_load_dll($this->available_dbms[$dbms]['MODULE']);
- }
+ $available_dbms = get_available_dbms($dbms);
// Load the appropriate database class if not already loaded
- include($phpbb_root_path . 'includes/db/' . $this->available_dbms[$dbms]['DRIVER'] . '.' . $phpEx);
+ include($phpbb_root_path . 'includes/db/' . $available_dbms[$dbms]['DRIVER'] . '.' . $phpEx);
// Instantiate the database
- $sql_db = 'dbal_' . $this->available_dbms[$dbms]['DRIVER'];
+ $sql_db = 'dbal_' . $available_dbms[$dbms]['DRIVER'];
$db = new $sql_db();
$db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false);
@@ -1790,317 +1780,6 @@ class install_install extends module
'U_ACTION' => append_sid($phpbb_root_path . 'adm/index.' . $phpEx),
));
}
-
- /**
- * Determine if we are able to load a specified PHP module
- */
- function can_load_dll($dll)
- {
- global $suffix;
-
- if (empty($suffix))
- {
- $suffix = (defined('PHP_OS') && strpos(strtolower(PHP_OS), 'win') === 0) ? 'dll' : 'so';
- }
-
- return ((@ini_get('enable_dl') || strtolower(@ini_get('enable_dl')) == 'on') && (!@ini_get('safe_mode') || strtolower(@ini_get('safe_mode')) == 'off') && @dl($dll . ".$suffix")) ? true : false;
- }
-
- /**
- * Used to test whether we are able to connect to the database the user has specified
- * and identify any problems (eg there are already tables with the names we want to use
- */
- function connect_check_db($error_connect, &$error, $dbms, $table_prefix, $dbhost, $dbuser, $dbpasswd, $dbname, $dbport)
- {
- global $phpbb_root_path, $phpEx, $config, $lang;
-
- // Include the DB layer
- include($phpbb_root_path . 'includes/db/' . $this->available_dbms[$dbms]['DRIVER'] . '.' . $phpEx);
-
- // Instantiate it and set return on error true
- $sql_db = 'dbal_' . $this->available_dbms[$dbms]['DRIVER'];
- $db = new $sql_db();
- $db->sql_return_on_error(true);
-
- // Check that we actually have a database name before going any further.....
- if ($dbms != 'sqlite' && $dbname === '')
- {
- $error[] = $lang['INST_ERR_DB_NO_NAME'];
- return false;
- }
-
- // Make sure we don't have a daft user who thinks having the SQLite database in the forum directory is a good idea
- if ($dbms == 'sqlite' && stripos(phpbb_realpath($dbhost), phpbb_realpath('../')) === 0)
- {
- $error[] = $lang['INST_ERR_DB_FORUM_PATH'];
- return false;
- }
-
- // Check the prefix length to ensure that index names are not too long and does not contain invalid characters
- switch ($dbms)
- {
- case 'mysql':
- case 'mysqli':
- if (strpos($table_prefix, '-') !== false)
- {
- $error[] = $lang['INST_ERR_PREFIX_INVALID'];
- return false;
- }
-
- // no break;
-
- case 'postgres':
- $prefix_length = 36;
- break;
-
- case 'mssql':
- case 'mssql_odbc':
- $prefix_length = 90;
- break;
-
- case 'sqlite':
- $prefix_length = 200;
- break;
-
- case 'firebird':
- case 'oracle':
- $prefix_length = 6;
- break;
- }
-
- if (strlen($table_prefix) > $prefix_length)
- {
- $error[] = sprintf($lang['INST_ERR_PREFIX_TOO_LONG'], $prefix_length);
- return false;
- }
-
- // Try and connect ...
- if (is_array($db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false)))
- {
- $db_error = $db->sql_error();
- $error[] = $lang['INST_ERR_DB_CONNECT'] . ' ' . (($db_error['message']) ? $db_error['message'] : $lang['INST_ERR_DB_NO_ERROR']);
- }
- else
- {
- switch ($dbms)
- {
- case 'mysql':
- case 'mysqli':
- $sql = 'SHOW TABLES';
- $field = "Tables_in_{$dbname}";
- break;
-
- case 'sqlite':
- $sql = 'SELECT name
- FROM sqlite_master
- WHERE type = "table"';
- $field = 'name';
- break;
-
- case 'mssql':
- case 'mssql_odbc':
- $sql = "SELECT name
- FROM sysobjects
- WHERE type='U'";
- $field = 'name';
- break;
-
- case 'postgres':
- $sql = "SELECT relname
- FROM pg_class
- WHERE relkind = 'r'
- AND relname NOT LIKE 'pg\_%'";
- $field = 'relname';
- break;
-
- case 'firebird':
- $sql = 'SELECT rdb$relation_name
- FROM rdb$relations
- WHERE rdb$view_source is null
- AND rdb$system_flag = 0';
- $field = 'rdb$relation_name';
- break;
-
- case 'oracle':
- $sql = 'SELECT table_name
- FROM USER_TABLES';
- $field = 'table_name';
- break;
- }
- $result = $db->sql_query($sql);
-
- if ($row = $db->sql_fetchrow($result))
- {
- // Likely matches for an existing phpBB installation
- $temp_prefix = strtolower($table_prefix);
- $table_ary = array($temp_prefix . 'attachments', $temp_prefix . 'config', $temp_prefix . 'sessions', $temp_prefix . 'topics', $temp_prefix . 'users');
-
- do
- {
- // All phpBB installations will at least have config else it won't work
- if (in_array(strtolower($row[$field]), $table_ary))
- {
- $error[] = $lang['INST_ERR_PREFIX'];
- break;
- }
- }
- while ($row = $db->sql_fetchrow($result));
- }
- $db->sql_freeresult($result);
-
- // Make sure that the user has selected a sensible DBAL for the DBMS actually installed
- switch ($dbms)
- {
- case 'mysqli':
- if (version_compare(mysqli_get_server_info($db->db_connect_id), '4.1.3', '<'))
- {
- $error[] = $lang['INST_ERR_DB_NO_MYSQLI'];
- }
- break;
-
- case 'sqlite':
- if (version_compare(sqlite_libversion(), '2.8.2', '<'))
- {
- $error[] = $lang['INST_ERR_DB_NO_SQLITE'];
- }
- break;
-
- case 'firebird':
- // check the version of FB, use some hackery if we can't get access to the server info
- if ($db->service_handle !== false && function_exists('ibase_server_info'))
- {
- $val = @ibase_server_info($db->service_handle, IBASE_SVC_SERVER_VERSION);
- preg_match('#V([\d.]+)#', $val, $match);
- if ($match[1] < 2)
- {
- $error[] = $lang['INST_ERR_DB_NO_FIREBIRD'];
- }
- $db_info = @ibase_db_info($db->service_handle, $dbname, IBASE_STS_HDR_PAGES);
-
- preg_match('/^\\s*Page size\\s*(\\d+)/m', $db_info, $regs);
- $page_size = intval($regs[1]);
- if ($page_size < 8192)
- {
- $error[] = $lang['INST_ERR_DB_NO_FIREBIRD_PS'];
- }
- }
- else
- {
- $sql = "SELECT *
- FROM RDB$FUNCTIONS
- WHERE RDB$SYSTEM_FLAG IS NULL
- AND RDB$FUNCTION_NAME = 'CHAR_LENGTH'";
- $result = $db->sql_query($sql);
- $row = $db->sql_fetchrow($result);
- $db->sql_freeresult($result);
-
- // if its a UDF, its too old
- if ($row)
- {
- $error[] = $lang['INST_ERR_DB_NO_FIREBIRD'];
- }
- else
- {
- $sql = "SELECT FIRST 0 char_length('')
- FROM RDB\$DATABASE";
- $result = $db->sql_query($sql);
- if (!$result) // This can only fail if char_length is not defined
- {
- $error[] = $lang['INST_ERR_DB_NO_FIREBIRD'];
- }
- $db->sql_freeresult($result);
- }
-
- // Setup the stuff for our random table
- $char_array = array_merge(range('A', 'Z'), range('0', '9'));
- $char_len = mt_rand(7, 9);
- $char_array_len = sizeof($char_array) - 1;
-
- $final = '';
-
- for ($i = 0; $i < $char_len; $i++)
- {
- $final .= $char_array[mt_rand(0, $char_array_len)];
- }
-
- // Create some random table
- $sql = 'CREATE TABLE ' . $final . " (
- FIELD1 VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE,
- FIELD2 INTEGER DEFAULT 0 NOT NULL);";
- $db->sql_query($sql);
-
- // Create an index that should fail if the page size is less than 8192
- $sql = 'CREATE INDEX ' . $final . ' ON ' . $final . '(FIELD1, FIELD2);';
- $db->sql_query($sql);
-
- if (ibase_errmsg() !== false)
- {
- $error[] = $lang['INST_ERR_DB_NO_FIREBIRD_PS'];
- }
- else
- {
- // Kill the old table
- $db->sql_query('DROP TABLE ' . $final . ';');
- }
- unset($final);
- }
- break;
-
- case 'oracle':
- $sql = "SELECT *
- FROM NLS_DATABASE_PARAMETERS
- WHERE PARAMETER = 'NLS_RDBMS_VERSION'
- OR PARAMETER = 'NLS_CHARACTERSET'";
- $result = $db->sql_query($sql);
-
- while ($row = $db->sql_fetchrow($result))
- {
- $stats[$row['parameter']] = $row['value'];
- }
- $db->sql_freeresult($result);
-
- if (version_compare($stats['NLS_RDBMS_VERSION'], '9.2', '<') && $stats['NLS_CHARACTERSET'] !== 'UTF8')
- {
- $error[] = $lang['INST_ERR_DB_NO_ORACLE'];
- }
- break;
-
- case 'postgres':
- $sql = "SHOW server_encoding;";
- $result = $db->sql_query($sql);
- $row = $db->sql_fetchrow($result);
- $db->sql_freeresult($result);
-
- if ($row['server_encoding'] !== 'UNICODE' && $row['server_encoding'] !== 'UTF8')
- {
- $error[] = $lang['INST_ERR_DB_NO_POSTGRES'];
- }
- break;
- }
-
- $db->sql_close();
- }
-
- if ($error_connect && (!isset($error) || !sizeof($error)))
- {
- return true;
- }
- return false;
- }
-
- /**
- * Generate the drop down of available database options
- */
- function dbms_select($default='')
- {
- $dbms_options = '';
- foreach ($this->available_dbms as $dbms_name => $details)
- {
- $selected = ($dbms_name == $default) ? ' selected="selected"' : '';
- $dbms_options .= '' . $details['LABEL'] . ' ';
- }
- return $dbms_options;
- }
/**
* Generate a list of available mail server authentication methods
@@ -2132,7 +1811,7 @@ class install_install extends module
*/
var $db_config_options = array(
'legend1' => 'DB_CONFIG',
- 'dbms' => array('lang' => 'DBMS', 'type' => 'select', 'options' => '$this->module->dbms_select(\'{VALUE}\')', 'explain' => false),
+ 'dbms' => array('lang' => 'DBMS', 'type' => 'select', 'options' => 'dbms_select(\'{VALUE}\')', 'explain' => false),
'dbhost' => array('lang' => 'DB_HOST', 'type' => 'text:25:100', 'explain' => true),
'dbport' => array('lang' => 'DB_PORT', 'type' => 'text:25:100', 'explain' => true),
'dbname' => array('lang' => 'DB_NAME', 'type' => 'text:25:100', 'explain' => false),
@@ -2172,76 +1851,6 @@ class install_install extends module
*/
var $php_dlls_other = array('zlib', 'ftp', 'gd', 'xml');
- /**
- * Details of the database management systems supported
- */
- var $available_dbms = array(
- 'firebird' => array(
- 'LABEL' => 'FireBird',
- 'SCHEMA' => 'firebird',
- 'MODULE' => 'interbase',
- 'DELIM' => ';;',
- 'COMMENTS' => 'remove_remarks',
- 'DRIVER' => 'firebird'
- ),
- 'mysqli' => array(
- 'LABEL' => 'MySQL with MySQLi Extension',
- 'SCHEMA' => 'mysql_41',
- 'MODULE' => 'mysqli',
- 'DELIM' => ';',
- 'COMMENTS' => 'remove_remarks',
- 'DRIVER' => 'mysqli'
- ),
- 'mysql' => array(
- 'LABEL' => 'MySQL',
- 'SCHEMA' => 'mysql',
- 'MODULE' => 'mysql',
- 'DELIM' => ';',
- 'COMMENTS' => 'remove_remarks',
- 'DRIVER' => 'mysql'
- ),
- 'mssql' => array(
- 'LABEL' => 'MS SQL Server 2000+',
- 'SCHEMA' => 'mssql',
- 'MODULE' => 'mssql',
- 'DELIM' => 'GO',
- 'COMMENTS' => 'remove_comments',
- 'DRIVER' => 'mssql'
- ),
- 'mssql_odbc'=> array(
- 'LABEL' => 'MS SQL Server [ ODBC ]',
- 'SCHEMA' => 'mssql',
- 'MODULE' => 'odbc',
- 'DELIM' => 'GO',
- 'COMMENTS' => 'remove_comments',
- 'DRIVER' => 'mssql_odbc'
- ),
- 'oracle' => array(
- 'LABEL' => 'Oracle',
- 'SCHEMA' => 'oracle',
- 'MODULE' => 'oci8',
- 'DELIM' => '/',
- 'COMMENTS' => 'remove_comments',
- 'DRIVER' => 'oracle'
- ),
- 'postgres' => array(
- 'LABEL' => 'PostgreSQL 7.x/8.x',
- 'SCHEMA' => 'postgres',
- 'MODULE' => 'pgsql',
- 'DELIM' => ';',
- 'COMMENTS' => 'remove_comments',
- 'DRIVER' => 'postgres'
- ),
- 'sqlite' => array(
- 'LABEL' => 'SQLite',
- 'SCHEMA' => 'sqlite',
- 'MODULE' => 'sqlite',
- 'DELIM' => ';',
- 'COMMENTS' => 'remove_remarks',
- 'DRIVER' => 'sqlite'
- ),
- );
-
/**
* A list of the web-crawlers/bots we recognise by default
*
diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php
index 42e0cf5ccf..4bcc26bccf 100755
--- a/phpBB/language/en/install.php
+++ b/phpBB/language/en/install.php
@@ -46,7 +46,7 @@ $lang = array_merge($lang, array(
'BEGIN_CONVERT' => 'Begin conversion',
'BLANK_PREFIX_FOUND' => 'A scan of your tables has shown a valid installation using no table prefix.',
'BOARD_NOT_INSTALLED' => 'No installation found',
- 'BOARD_NOT_INSTALLED_EXPLAIN' => 'To perform a conversion you need to have a default installation of phpBB3. Please note that for a conversion the new installation and the old installation need to reside within the same database. You may now want to perform an installation .',
+ 'BOARD_NOT_INSTALLED_EXPLAIN' => 'To perform a conversion you need to have a default installation of phpBB3. You may now want to perform an installation .',
'CATEGORY' => 'Category',
'CACHE_STORE' => 'Cache type',
From e526dfe83e805e8ffac5abcab0ba2fc67c7563ce Mon Sep 17 00:00:00 2001
From: Nils Adermann
Date: Sat, 17 Feb 2007 01:14:28 +0000
Subject: [PATCH 046/707] - only give DBAL options which were available in
phpBB2 - default to phpBB3 DB config
git-svn-id: file:///svn/phpbb/trunk@6996 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/includes/functions_install.php | 27 +++++++++++++++++---
phpBB/install/convertors/convert_phpbb20.php | 15 ++++++-----
phpBB/install/install_convert.php | 4 +--
3 files changed, 35 insertions(+), 11 deletions(-)
diff --git a/phpBB/includes/functions_install.php b/phpBB/includes/functions_install.php
index 0b7bbb607f..0feaeff08e 100644
--- a/phpBB/includes/functions_install.php
+++ b/phpBB/includes/functions_install.php
@@ -27,7 +27,7 @@ function can_load_dll($dll)
* Returns an array of available DBMS with some data, if a DBMS is specified it will only
* return data for that DBMS and will load its extension if necessary.
*/
-function get_available_dbms($dbms = false, $return_unavailable = false)
+function get_available_dbms($dbms = false, $return_unavailable = false, $only_20x_options = false)
{
$available_dbms = array(
'firebird' => array(
@@ -38,6 +38,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false)
'COMMENTS' => 'remove_remarks',
'DRIVER' => 'firebird',
'AVAILABLE' => true,
+ '2.0.x' => false,
),
'mysqli' => array(
'LABEL' => 'MySQL with MySQLi Extension',
@@ -47,6 +48,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false)
'COMMENTS' => 'remove_remarks',
'DRIVER' => 'mysqli',
'AVAILABLE' => true,
+ '2.0.x' => true,
),
'mysql' => array(
'LABEL' => 'MySQL',
@@ -56,6 +58,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false)
'COMMENTS' => 'remove_remarks',
'DRIVER' => 'mysql',
'AVAILABLE' => true,
+ '2.0.x' => true,
),
'mssql' => array(
'LABEL' => 'MS SQL Server 2000+',
@@ -65,6 +68,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false)
'COMMENTS' => 'remove_comments',
'DRIVER' => 'mssql',
'AVAILABLE' => true,
+ '2.0.x' => true,
),
'mssql_odbc'=> array(
'LABEL' => 'MS SQL Server [ ODBC ]',
@@ -74,6 +78,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false)
'COMMENTS' => 'remove_comments',
'DRIVER' => 'mssql_odbc',
'AVAILABLE' => true,
+ '2.0.x' => true,
),
'oracle' => array(
'LABEL' => 'Oracle',
@@ -83,6 +88,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false)
'COMMENTS' => 'remove_comments',
'DRIVER' => 'oracle',
'AVAILABLE' => true,
+ '2.0.x' => false,
),
'postgres' => array(
'LABEL' => 'PostgreSQL 7.x/8.x',
@@ -92,6 +98,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false)
'COMMENTS' => 'remove_comments',
'DRIVER' => 'postgres',
'AVAILABLE' => true,
+ '2.0.x' => true,
),
'sqlite' => array(
'LABEL' => 'SQLite',
@@ -101,6 +108,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false)
'COMMENTS' => 'remove_remarks',
'DRIVER' => 'sqlite',
'AVAILABLE' => true,
+ '2.0.x' => false,
),
);
@@ -119,6 +127,19 @@ function get_available_dbms($dbms = false, $return_unavailable = false)
// now perform some checks whether they are really available
foreach ($available_dbms as $db_name => $db_ary)
{
+ if ($only_20x_options && !$db_ary['2.0.x'])
+ {
+ if ($return_unavailable)
+ {
+ $available_dbms[$db_name]['AVAILABLE'] = false;
+ }
+ else
+ {
+ unset($available_dbms[$db_name]);
+ }
+ continue;
+ }
+
$dll = $db_ary['MODULE'];
if (!@extension_loaded($dll))
@@ -149,9 +170,9 @@ function get_available_dbms($dbms = false, $return_unavailable = false)
/**
* Generate the drop down of available database options
*/
-function dbms_select($default='')
+function dbms_select($default = '', $only_20x_options = false)
{
- $available_dbms = get_available_dbms();
+ $available_dbms = get_available_dbms(false, false, $only_20x_options);
$dbms_options = '';
foreach ($available_dbms as $dbms_name => $details)
{
diff --git a/phpBB/install/convertors/convert_phpbb20.php b/phpBB/install/convertors/convert_phpbb20.php
index 4f66d3848a..8ba43f4be8 100644
--- a/phpBB/install/convertors/convert_phpbb20.php
+++ b/phpBB/install/convertors/convert_phpbb20.php
@@ -22,6 +22,9 @@ if (!defined('IN_PHPBB'))
exit;
}
+include($phpbb_root_path . 'config.' . $phpEx);
+unset($dbpasswd);
+
/**
* $convertor_data provides some basic information about this convertor which is
* used on the initial list of convertors and to populate the default settings
@@ -31,12 +34,12 @@ $convertor_data = array(
'version' => '0.9',
'phpbb_version' => '3.0.0',
'author' => 'phpBB Group ',
- 'dbms' => 'mysql',
- 'dbhost' => 'localhost',
- 'dbport' => '',
- 'dbuser' => 'user',
- 'dbpasswd' => 'password',
- 'dbname' => '',
+ 'dbms' => $dbms,
+ 'dbhost' => $dbhost,
+ 'dbport' => $dbport,
+ 'dbuser' => $dbuser,
+ 'dbpasswd' => '',
+ 'dbname' => $dbname,
'table_prefix' => 'phpbb_',
'forum_path' => '../forums',
'author_notes' => 'Avatars may be on a different width/height than with the old forum. This is due to dimensions being stored within phpBB3 but not within phpBB2. The default dimension was set to 80x80 for avatars where dimension settings could not be determined. You might wish to instruct your users to check their profiles after the conversion to ensure that the size is correct.',
diff --git a/phpBB/install/install_convert.php b/phpBB/install/install_convert.php
index a3541f6f29..862964fccd 100644
--- a/phpBB/install/install_convert.php
+++ b/phpBB/install/install_convert.php
@@ -397,7 +397,7 @@ class install_convert extends module
}
$connect_test = false;
- $available_dbms = get_available_dbms(false, true);
+ $available_dbms = get_available_dbms(false, true, true);
if (!isset($available_dbms[$src_dbms]) || !$available_dbms[$src_dbms]['AVAILABLE'])
{
@@ -2110,7 +2110,7 @@ class install_convert extends module
*/
var $convert_options = array(
'legend1' => 'SPECIFY_OPTIONS',
- 'src_dbms' => array('lang' => 'DBMS', 'type' => 'select', 'options' => 'dbms_select(\'{VALUE}\')', 'explain' => false),
+ 'src_dbms' => array('lang' => 'DBMS', 'type' => 'select', 'options' => 'dbms_select(\'{VALUE}\', true)', 'explain' => false),
'src_dbhost' => array('lang' => 'DB_HOST', 'type' => 'text:25:100', 'explain' => true),
'src_dbport' => array('lang' => 'DB_PORT', 'type' => 'text:25:100', 'explain' => true),
'src_dbname' => array('lang' => 'DB_NAME', 'type' => 'text:25:100', 'explain' => false),
From 4a83eb22da3b576a1feaf9bd1e021068d0a310bd Mon Sep 17 00:00:00 2001
From: David M
Date: Sat, 17 Feb 2007 03:20:14 +0000
Subject: [PATCH 047/707] - finally fixed this one, IE has a bug that makes
puppies cry.
git-svn-id: file:///svn/phpbb/trunk@6997 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/includes/acp/acp_database.php | 25 ++++++++++++++++++++++---
1 file changed, 22 insertions(+), 3 deletions(-)
diff --git a/phpBB/includes/acp/acp_database.php b/phpBB/includes/acp/acp_database.php
index ed1dab4fd8..b122f15f8f 100644
--- a/phpBB/includes/acp/acp_database.php
+++ b/phpBB/includes/acp/acp_database.php
@@ -504,6 +504,7 @@ class base_extractor
var $download;
var $time;
var $format;
+ var $run_comp = false;
function base_extractor($download = false, $store = false, $format, $filename, $time)
{
@@ -551,7 +552,14 @@ class base_extractor
break;
case 'gzip':
- ob_start('ob_gzhandler');
+ if (isset($_SERVER['HTTP_ACCEPT_ENCODING']) && strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false)
+ {
+ ob_start('ob_gzhandler');
+ }
+ else
+ {
+ $this->run_comp = true;
+ }
break;
}
}
@@ -604,12 +612,23 @@ class base_extractor
if ($this->download === true)
{
- echo $data;
+ if ($this->format === 'bzip2' || ($this->format === 'gzip' && !$this->run_comp))
+ {
+ echo $data;
+ }
// we can write the gzip data as soon as we get it
if ($this->format === 'gzip')
{
- ob_flush();
+ if ($this->run_comp)
+ {
+ echo gzencode($data);
+ }
+ else
+ {
+ ob_flush();
+ flush();
+ }
}
}
}
From bb7c0ded605826b8261c1b215253d7958a773777 Mon Sep 17 00:00:00 2001
From: David M
Date: Sat, 17 Feb 2007 04:51:57 +0000
Subject: [PATCH 048/707] #8090
git-svn-id: file:///svn/phpbb/trunk@6998 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/includes/acp/acp_bbcodes.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/phpBB/includes/acp/acp_bbcodes.php b/phpBB/includes/acp/acp_bbcodes.php
index 9c2d19168a..6a492787a1 100644
--- a/phpBB/includes/acp/acp_bbcodes.php
+++ b/phpBB/includes/acp/acp_bbcodes.php
@@ -295,10 +295,10 @@ class acp_bbcodes
// @todo Make sure to change this too if something changed in message parsing
$tokens = array(
'URL' => array(
- '!([a-z0-9]+://)?([^?].*?[^ \t\n\r<"]*)!ie' => "(('\$1') ? '\$1\$2' : 'http://\$2')"
+ '!([a-z0-9]+://)?([^< "\r\n\t\]]*)!ie' => "(('\$1') ? '\$1\$2' : 'http://\$2')"
),
'LOCAL_URL' => array(
- '!([^:]+/[^ \t\n\r<"]*)!' => '$1'
+ '!([^:]+/[^< "\r\n\t\]]*)!' => '$1'
),
'EMAIL' => array(
'!([a-z0-9]+[a-z0-9\-\._]*@(?:(?:[0-9]{1,3}\.){3,5}[0-9]{1,3}|[a-z0-9]+[a-z0-9\-\._]*\.[a-z]+))!i' => '$1'
From 9300c4090078949ccb314a4dab4f5f3d300fade8 Mon Sep 17 00:00:00 2001
From: David M
Date: Sat, 17 Feb 2007 04:53:43 +0000
Subject: [PATCH 049/707] - used wrong heuristic to measure if we were done,
using a different one now.
git-svn-id: file:///svn/phpbb/trunk@6999 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/includes/acp/acp_database.php | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/phpBB/includes/acp/acp_database.php b/phpBB/includes/acp/acp_database.php
index b122f15f8f..0404ec73b7 100644
--- a/phpBB/includes/acp/acp_database.php
+++ b/phpBB/includes/acp/acp_database.php
@@ -388,15 +388,15 @@ class acp_database
case 'mysql4':
case 'mysqli':
case 'sqlite':
- while (!$eof($fp))
+ while (($sql = $fgetd($fp, ";\n", $read, $seek, $eof)) !== false)
{
- $db->sql_query($fgetd($fp, ";\n", $read, $seek, $eof));
+ $db->sql_query($sql);
}
break;
case 'firebird':
$delim = ";\n";
- while (!$eof($fp))
+ while (($sql = $fgetd($fp, $delim, $read, $seek, $eof)) !== false)
{
$query = trim($fgetd($fp, $delim, $read, $seek, $eof));
if (substr($query, 0, 8) === 'SET TERM')
@@ -409,9 +409,9 @@ class acp_database
break;
case 'postgres':
- while (!$eof($fp))
+ while (($sql = $fgetd($fp, $delim, $read, $seek, $eof)) !== false)
{
- $query = trim($fgetd($fp, ";\n", $read, $seek, $eof));
+ $query = trim($sql);
$db->sql_query($query);
if (substr($query, 0, 4) == 'COPY')
{
@@ -426,17 +426,17 @@ class acp_database
break;
case 'oracle':
- while (!$eof($fp))
+ while (($sql = $fgetd($fp, "/\n", $read, $seek, $eof)) !== false)
{
- $db->sql_query($fgetd($fp, "/\n", $read, $seek, $eof));
+ $db->sql_query($sql);
}
break;
case 'mssql':
case 'mssql_odbc':
- while (!$eof($fp))
+ while (($sql = $fgetd($fp, "GO\n", $read, $seek, $eof)) !== false)
{
- $db->sql_query($fgetd($fp, "GO\n", $read, $seek, $eof));
+ $db->sql_query($sql);
}
break;
}
From 603227a02fb0ca3de361afcc44a52820b6405a7b Mon Sep 17 00:00:00 2001
From: David M
Date: Sat, 17 Feb 2007 05:18:37 +0000
Subject: [PATCH 050/707] #7840
git-svn-id: file:///svn/phpbb/trunk@7000 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/includes/functions_admin.php | 41 +++++++++++++++++++++---------
1 file changed, 29 insertions(+), 12 deletions(-)
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php
index f319873e2c..a3e5a2c685 100644
--- a/phpBB/includes/functions_admin.php
+++ b/phpBB/includes/functions_admin.php
@@ -502,13 +502,21 @@ function delete_topics($where_type, $where_ids, $auto_sync = true, $post_count_s
$approved_topics = 0;
$forum_ids = $topic_ids = array();
- if (is_array($where_ids))
+ if ($where_type === 'range')
{
- $where_ids = array_unique($where_ids);
+ $where_clause = $where_ids;
}
else
{
- $where_ids = array($where_ids);
+ if (is_array($where_ids))
+ {
+ $where_ids = array_unique($where_ids);
+ }
+ else
+ {
+ $where_ids = array($where_ids);
+ }
+ $where_clause = $db->sql_in_set($where_type, $where_ids);
}
if (!sizeof($where_ids))
@@ -522,7 +530,7 @@ function delete_topics($where_type, $where_ids, $auto_sync = true, $post_count_s
$sql = 'SELECT topic_id, forum_id, topic_approved
FROM ' . TOPICS_TABLE . '
- WHERE ' . $db->sql_in_set($where_type, $where_ids);
+ WHERE ' . ;
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
@@ -583,18 +591,27 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync =
{
global $db, $config, $phpbb_root_path, $phpEx;
- if (is_array($where_ids))
+ if ($where_type === 'range')
{
- $where_ids = array_unique($where_ids);
+ $where_clause = $where_ids;
}
else
{
- $where_ids = array($where_ids);
- }
+ if (is_array($where_ids))
+ {
+ $where_ids = array_unique($where_ids);
+ }
+ else
+ {
+ $where_ids = array($where_ids);
+ }
- if (!sizeof($where_ids))
- {
- return false;
+ if (!sizeof($where_ids))
+ {
+ return false;
+ }
+
+ $where_clause = $db->sql_in_set($where_type, array_map('intval', $where_ids);
}
$approved_posts = 0;
@@ -602,7 +619,7 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync =
$sql = 'SELECT post_id, poster_id, post_approved, post_postcount, topic_id, forum_id
FROM ' . POSTS_TABLE . '
- WHERE ' . $db->sql_in_set($where_type, array_map('intval', $where_ids));
+ WHERE ' . $where_clause);
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
From 0af3306ee40810029d1b83a35f229661dc1bfe7a Mon Sep 17 00:00:00 2001
From: David M
Date: Sat, 17 Feb 2007 05:20:29 +0000
Subject: [PATCH 051/707] nice...
git-svn-id: file:///svn/phpbb/trunk@7001 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/includes/functions_admin.php | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php
index a3e5a2c685..53f6fb926a 100644
--- a/phpBB/includes/functions_admin.php
+++ b/phpBB/includes/functions_admin.php
@@ -530,7 +530,7 @@ function delete_topics($where_type, $where_ids, $auto_sync = true, $post_count_s
$sql = 'SELECT topic_id, forum_id, topic_approved
FROM ' . TOPICS_TABLE . '
- WHERE ' . ;
+ WHERE ' . $where_clause;
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
@@ -611,7 +611,7 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync =
return false;
}
- $where_clause = $db->sql_in_set($where_type, array_map('intval', $where_ids);
+ $where_clause = $db->sql_in_set($where_type, array_map('intval', $where_ids));
}
$approved_posts = 0;
@@ -619,7 +619,7 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync =
$sql = 'SELECT post_id, poster_id, post_approved, post_postcount, topic_id, forum_id
FROM ' . POSTS_TABLE . '
- WHERE ' . $where_clause);
+ WHERE ' . $where_clause;
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
From b0d453098b5359aa40db3fd22e5d472040fa0b64 Mon Sep 17 00:00:00 2001
From: Nils Adermann
Date: Sat, 17 Feb 2007 14:14:56 +0000
Subject: [PATCH 052/707] - fixed a referencing problem with objects (PHP4/5
conflict) - user_group_auth can take data from both target and source
database
git-svn-id: file:///svn/phpbb/trunk@7002 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/includes/functions_convert.php | 4 ++--
.../install/convertors/functions_phpbb20.php | 8 +++----
phpBB/install/install_convert.php | 22 +++++++++++++++----
3 files changed, 24 insertions(+), 10 deletions(-)
diff --git a/phpBB/includes/functions_convert.php b/phpBB/includes/functions_convert.php
index 4244645af8..fe72f3fa9e 100644
--- a/phpBB/includes/functions_convert.php
+++ b/phpBB/includes/functions_convert.php
@@ -1066,7 +1066,7 @@ function add_user_group($group_id, $user_id, $group_leader=false)
* @param string $group The name of the special group to add to
* @param string $select_query An SQL query to retrieve the user(s) to add to the group
*/
-function user_group_auth($group, $select_query)
+function user_group_auth($group, $select_query, $use_src_db)
{
global $convert, $phpbb_root_path, $config, $user, $db, $src_db, $same_db;
@@ -1089,7 +1089,7 @@ function user_group_auth($group, $select_query)
return;
}
- if ($same_db)
+ if ($same_db || !$use_src_db)
{
$sql = 'INSERT INTO ' . USER_GROUP_TABLE . ' (user_id, group_id, user_pending)
' . str_replace('{' . strtoupper($group) . '}', $group_id . ', 0', $select_query);
diff --git a/phpBB/install/convertors/functions_phpbb20.php b/phpBB/install/convertors/functions_phpbb20.php
index c80a0a0de2..0b05f4308d 100644
--- a/phpBB/install/convertors/functions_phpbb20.php
+++ b/phpBB/install/convertors/functions_phpbb20.php
@@ -698,22 +698,22 @@ function phpbb_convert_authentication($mode)
if ($mode == 'start')
{
- user_group_auth('guests', 'SELECT user_id, {GUESTS} FROM ' . USERS_TABLE . ' WHERE user_id = ' . ANONYMOUS);
- user_group_auth('registered', 'SELECT user_id, {REGISTERED} FROM ' . USERS_TABLE . ' WHERE user_id <> ' . ANONYMOUS);
+ user_group_auth('guests', 'SELECT user_id, {GUESTS} FROM ' . USERS_TABLE . ' WHERE user_id = ' . ANONYMOUS, false);
+ user_group_auth('registered', 'SELECT user_id, {REGISTERED} FROM ' . USERS_TABLE . ' WHERE user_id <> ' . ANONYMOUS, false);
// Selecting from old table
$auth_sql = 'SELECT ';
$auth_sql .= (!empty($config['increment_user_id'])) ? 'user_id + 1 as user_id' : 'user_id';
$auth_sql .= ', {ADMINISTRATORS} FROM ' . $convert->src_table_prefix . 'users WHERE user_level = 1';
- user_group_auth('administrators', $auth_sql);
+ user_group_auth('administrators', $auth_sql, true);
// Put administrators into global moderators group too...
$auth_sql = 'SELECT ';
$auth_sql .= (!empty($config['increment_user_id'])) ? 'user_id + 1 as user_id' : 'user_id';
$auth_sql .= ', {GLOBAL_MODERATORS} FROM ' . $convert->src_table_prefix . 'users WHERE user_level = 1';
- user_group_auth('global_moderators', $auth_sql);
+ user_group_auth('global_moderators', $auth_sql, true);
}
else if ($mode == 'first')
{
diff --git a/phpBB/install/install_convert.php b/phpBB/install/install_convert.php
index 862964fccd..28093f8efa 100644
--- a/phpBB/install/install_convert.php
+++ b/phpBB/install/install_convert.php
@@ -407,7 +407,7 @@ class install_convert extends module
else
{
$src_dbpasswd = htmlspecialchars_decode($src_dbpasswd);
- $connect_test = connect_check_db(true, $error, $available_dbms[$src_dbms], false, $src_dbhost, $src_dbuser, $src_dbpasswd, $src_dbname, $src_dbport, ($src_dbms == $dbms) ? false : true);
+ $connect_test = connect_check_db(true, $error, $available_dbms[$src_dbms], $src_table_prefix, $src_dbhost, $src_dbuser, $src_dbpasswd, $src_dbname, $src_dbport, true, ($src_dbms == $dbms) ? false : true);
}
// The forum prefix of the old and the new forum can only be the same if two different databases are used.
@@ -421,7 +421,7 @@ class install_convert extends module
{
// initiate database connection to old db if old and new db differ
global $src_db, $same_db;
- $src_db = $same_db = null;
+ $src_db = $same_db = false;
if ($src_dbms != $dbms || $src_dbhost != $dbhost || $src_dbport != $dbport || $src_dbname != $dbname || $src_dbuser != $dbuser)
{
@@ -432,7 +432,14 @@ class install_convert extends module
}
else
{
- $src_db = &$db;
+ if (version_compare(PHP_VERSION, '5.0.0-dev', '<'))
+ {
+ $src_db = &$db;
+ }
+ else
+ {
+ $src_db = $db;
+ }
$same_db = true;
}
@@ -660,7 +667,14 @@ class install_convert extends module
}
else
{
- $src_db = &$db;
+ if (version_compare(PHP_VERSION, '5.0.0-dev', '<'))
+ {
+ $src_db = &$db;
+ }
+ else
+ {
+ $src_db = $db;
+ }
$same_db = true;
}
From 179d06c03e5927cdd83083e273855199fba36b4b Mon Sep 17 00:00:00 2001
From: David M
Date: Sat, 17 Feb 2007 18:25:48 +0000
Subject: [PATCH 053/707] #8006
git-svn-id: file:///svn/phpbb/trunk@7003 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/adm/style/acp_users.html | 543 +----------------------
phpBB/adm/style/acp_users_avatar.html | 75 ++++
phpBB/adm/style/acp_users_feedback.html | 76 ++++
phpBB/adm/style/acp_users_overview.html | 82 ++++
phpBB/adm/style/acp_users_prefs.html | 132 ++++++
phpBB/adm/style/acp_users_profile.html | 66 +++
phpBB/adm/style/acp_users_signature.html | 106 +++++
7 files changed, 543 insertions(+), 537 deletions(-)
create mode 100644 phpBB/adm/style/acp_users_avatar.html
create mode 100644 phpBB/adm/style/acp_users_feedback.html
create mode 100644 phpBB/adm/style/acp_users_overview.html
create mode 100644 phpBB/adm/style/acp_users_prefs.html
create mode 100644 phpBB/adm/style/acp_users_profile.html
create mode 100644 phpBB/adm/style/acp_users_signature.html
diff --git a/phpBB/adm/style/acp_users.html b/phpBB/adm/style/acp_users.html
index adbabb7089..ae4134e95b 100644
--- a/phpBB/adm/style/acp_users.html
+++ b/phpBB/adm/style/acp_users.html
@@ -77,449 +77,23 @@
-
-
-
- {L_ACP_USER_OVERVIEW}
-
- {L_USERNAME}: {L_NAME_CHARS_EXPLAIN}
-
- [ {L_USE_PERMISSIONS} ]
-
-
-
- {L_USER_IS_INACTIVE}:
- {USER_INACTIVE_REASON}
-
-
-
- {L_REGISTERED}:
- {USER_REGISTERED}
-
-
-
- {L_REGISTERED_IP}:
- {REGISTERED_IP}
- [ {L_WHOIS} ]
-
-
-
- {L_LAST_ACTIVE}:
- {USER_LASTACTIVE}
-
-
- {L_POSTS}:
- {USER_POSTS}
-
-
- {L_WARNINGS}:
- {USER_WARNINGS}
-
-
- {L_FOUNDER}: {L_FOUNDER_EXPLAIN}
- id="user_founder" checked="checked" disabled="disabled" /> {L_YES} id="user_founder" checked="checked" disabled="disabled" /> {L_NO}
-
-
- {L_EMAIL}:
-
-
-
- {L_CONFIRM_EMAIL}: {L_CONFIRM_EMAIL_EXPLAIN}
-
-
-
- {L_NEW_PASSWORD}: {L_CHANGE_PASSWORD_EXPLAIN}
-
-
-
- {L_CONFIRM_PASSWORD}: {L_CONFIRM_PASSWORD_EXPLAIN}
-
-
-
-
-
-
- {L_USER_TOOLS}
-
- {L_QUICK_TOOLS}:
- {S_ACTION_OPTIONS}
-
-
-
- {L_DELETE_USER}: {L_DELETE_USER_EXPLAIN}
-
- {L_RETAIN_POSTS} {L_DELETE_POSTS}
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
- {L_DISPLAY_LOG}: {S_LIMIT_DAYS} {L_SORT_BY}: {S_SORT_KEY} {S_SORT_DIR}
-
-
-
-
-
-
-
-
-
-
-
- {L_MARK_ALL} • {L_UNMARK_ALL}
-
-
-
- {L_ADD_FEEDBACK}
-
- {L_ADD_FEEDBACK_EXPLAIN}
-
-
- {L_ACP_USER_FEEDBACK}
-
-
-
-
-
-
-
-
-
-
+
-
-
-
- {L_USER_PROFILE}
-
- {L_UCP_ICQ}:
-
-
-
- {L_UCP_AIM}:
-
-
-
- {L_UCP_MSNM}:
-
-
-
- {L_UCP_YIM}:
-
-
-
- {L_UCP_JABBER}:
-
-
-
- {L_WEBSITE}:
-
-
-
- {L_LOCATION}:
-
-
-
- {L_OCCUPATION}:
- {OCCUPATION}
-
-
- {L_INTERESTS}:
- {INTERESTS}
-
-
- {L_BIRTHDAY}: {L_BIRTHDAY_EXPLAIN}
- {L_DAY}: {S_BIRTHDAY_DAY_OPTIONS} {L_MONTH}: {S_BIRTHDAY_MONTH_OPTIONS} {L_YEAR}: {S_BIRTHDAY_YEAR_OPTIONS}
-
-
-
-
-
- {L_USER_CUSTOM_PROFILE_FIELDS}
-
-
- {profile_fields.LANG_NAME}: {profile_fields.LANG_EXPLAIN}
- {profile_fields.FIELD}
-
- {profile_fields.ERROR}
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
- {L_UCP_PREFS_PERSONAL}
-
- {L_SHOW_EMAIL}:
- id="viewemail" checked="checked" /> {L_YES} id="viewemail" checked="checked" /> {L_NO}
-
-
- {L_ADMIN_EMAIL}:
- id="massemail" checked="checked" /> {L_YES} id="massemail" checked="checked" /> {L_NO}
-
-
- {L_ALLOW_PM}: {L_ALLOW_PM_EXPLAIN}
- id="allowpm" checked="checked" /> {L_YES} id="allowpm" checked="checked" /> {L_NO}
-
-
- {L_HIDE_ONLINE}:
- id="hideonline" checked="checked" /> {L_YES} id="hideonline" checked="checked" /> {L_NO}
-
-
- {L_NOTIFY_METHOD}: {L_NOTIFY_METHOD_EXPLAIN}
- id="notifymethod" checked="checked" /> {L_NOTIFY_METHOD_EMAIL} id="notifymethod" checked="checked" disabled="disabled" /> {L_NOTIFY_METHOD_IM} id="notifymethod" checked="checked" /> {L_NOTIFY_METHOD_BOTH}
-
-
- {L_NOTIFY_ON_PM}:
- id="notifypm" checked="checked" /> {L_YES} id="notifypm" checked="checked" /> {L_NO}
-
-
- {L_POPUP_ON_PM}:
- id="popuppm" checked="checked" /> {L_YES} id="popuppm" checked="checked" />{L_NO}
-
-
- {L_BOARD_LANGUAGE}:
- {S_LANG_OPTIONS}
-
-
- {L_BOARD_STYLE}:
- {S_STYLE_OPTIONS}
-
-
- {L_BOARD_TIMEZONE}:
- {S_TZ_OPTIONS}
-
-
- {L_BOARD_DST}:
- id="dst" checked="checked" /> {L_YES} id="dst" checked="checked" /> {L_NO}
-
-
- {L_BOARD_DATE_FORMAT}: {L_BOARD_DATE_FORMAT_EXPLAIN}
- {S_DATEFORMAT_OPTIONS}
- style="display:none;">
-
-
-
-
- {L_UCP_PREFS_POST}
-
- {L_DEFAULT_BBCODE}:
- id="bbcode" checked="checked" /> {L_YES} id="bbcode" checked="checked" /> {L_NO}
-
-
- {L_DEFAULT_SMILIES}:
- id="smilies" checked="checked" /> {L_YES} id="smilies" checked="checked" /> {L_NO}
-
-
- {L_DEFAULT_ADD_SIG}:
- id="sig" checked="checked" /> {L_YES} id="sig" checked="checked" /> {L_NO}
-
-
- {L_DEFAULT_NOTIFY}:
- id="notify" checked="checked" /> {L_YES} id="notify" checked="checked" /> {L_NO}
-
-
-
-
- {L_UCP_PREFS_VIEW}
-
- {L_VIEW_IMAGES}:
- id="view_images" checked="checked" /> {L_YES} id="view_images" checked="checked" /> {L_NO}
-
-
- {L_VIEW_FLASH}:
- id="view_flash" checked="checked" /> {L_YES} id="view_flash" checked="checked" /> {L_NO}
-
-
- {L_VIEW_SMILIES}:
- id="view_smilies" checked="checked" /> {L_YES} id="view_smilies" checked="checked" /> {L_NO}
-
-
- {L_VIEW_SIGS}:
- id="view_sigs" checked="checked" /> {L_YES} id="view_sigss" checked="checked" /> {L_NO}
-
-
- {L_VIEW_AVATARS}:
- id="view_avatars" checked="checked" /> {L_YES} id="view_avatars" checked="checked" /> {L_NO}
-
-
- {L_DISABLE_CENSORS}:
- id="view_wordcensor" checked="checked" /> {L_YES} id="view_wordcensor" checked="checked" /> {L_NO}
-
-
- {L_VIEW_TOPICS_DAYS}:
- {S_TOPIC_SORT_DAYS}
-
-
- {L_VIEW_TOPICS_KEY}:
- {S_TOPIC_SORT_KEY}
-
-
- {L_VIEW_TOPICS_DIR}:
- {S_TOPIC_SORT_DIR}
-
-
- {L_VIEW_POSTS_DAYS}:
- {S_POST_SORT_DAYS}
-
-
- {L_VIEW_POSTS_KEY}:
- {S_POST_SORT_KEY}
-
-
- {L_VIEW_POSTS_DIR}:
- {S_POST_SORT_DIR}
-
-
-
-
-
-
-
-
+
- enctype="multipart/form-data">
-
-
- {L_ACP_USER_AVATAR}
-
- {L_CURRENT_IMAGE}: {L_AVATAR_EXPLAIN}
- {AVATAR_IMAGE}
- {L_DELETE_AVATAR}
-
-
-
-
- {L_UPLOAD_AVATAR_FILE}:
-
-
-
- {L_UPLOAD_AVATAR_URL}: {L_UPLOAD_AVATAR_URL_EXPLAIN}
-
-
-
-
-
- {L_LINK_REMOTE_AVATAR}: {L_LINK_REMOTE_AVATAR_EXPLAIN}
-
-
-
- {L_LINK_REMOTE_SIZE}: {L_LINK_REMOTE_SIZE_EXPLAIN}
- px X px
-
-
-
-
- {L_AVATAR_GALLERY}:
-
-
-
-
-
-
-
- {L_AVATAR_GALLERY}
-
- {L_AVATAR_CATEGORY}:
- {S_CAT_OPTIONS}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -541,112 +115,7 @@
-
-
-
-
-
-
-
- {L_ADMIN_SIG_PREVIEW}
- {SIGNATURE_PREVIEW}
-
-
-
-
- {L_SIGNATURE}
- {L_SIGNATURE_EXPLAIN}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {L_FONT_SIZE}:
- {L_FONT_TINY}
- {L_FONT_SMALL}
- {L_FONT_NORMAL}
- {L_FONT_LARGE}
- {L_FONT_HUGE}
-
-
-
-
- onmouseover="helpline('cb_{custom_tags.BBCODE_ID}')" />
-
-
-
-
-
- {SIGNATURE}
-
-
-
- {L_DISABLE_BBCODE}
-
-
- {L_DISABLE_SMILIES}
-
-
- {L_DISABLE_MAGIC_URL}
-
- {L_OPTIONS}: {BBCODE_STATUS} :: {IMG_STATUS} :: {FLASH_STATUS} :: {URL_STATUS} :: {SMILIES_STATUS}
-
-
-
-
-
-
-
-
-
+
diff --git a/phpBB/adm/style/acp_users_avatar.html b/phpBB/adm/style/acp_users_avatar.html
new file mode 100644
index 0000000000..6fc8ef46bb
--- /dev/null
+++ b/phpBB/adm/style/acp_users_avatar.html
@@ -0,0 +1,75 @@
+ enctype="multipart/form-data">
+
+
+ {L_ACP_USER_AVATAR}
+
+ {L_CURRENT_IMAGE}: {L_AVATAR_EXPLAIN}
+ {AVATAR_IMAGE}
+ {L_DELETE_AVATAR}
+
+
+
+
+ {L_UPLOAD_AVATAR_FILE}:
+
+
+
+ {L_UPLOAD_AVATAR_URL}: {L_UPLOAD_AVATAR_URL_EXPLAIN}
+
+
+
+
+
+ {L_LINK_REMOTE_AVATAR}: {L_LINK_REMOTE_AVATAR_EXPLAIN}
+
+
+
+ {L_LINK_REMOTE_SIZE}: {L_LINK_REMOTE_SIZE_EXPLAIN}
+ px X px
+
+
+
+
+ {L_AVATAR_GALLERY}:
+
+
+
+
+
+
+
+ {L_AVATAR_GALLERY}
+
+ {L_AVATAR_CATEGORY}:
+ {S_CAT_OPTIONS}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/phpBB/adm/style/acp_users_feedback.html b/phpBB/adm/style/acp_users_feedback.html
new file mode 100644
index 0000000000..0f64888170
--- /dev/null
+++ b/phpBB/adm/style/acp_users_feedback.html
@@ -0,0 +1,76 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {L_DISPLAY_LOG}: {S_LIMIT_DAYS} {L_SORT_BY}: {S_SORT_KEY} {S_SORT_DIR}
+
+
+
+
+
+
+
+
+
+
+
+ {L_MARK_ALL} • {L_UNMARK_ALL}
+
+
+
+ {L_ADD_FEEDBACK}
+
+ {L_ADD_FEEDBACK_EXPLAIN}
+
+
+ {L_ACP_USER_FEEDBACK}
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/phpBB/adm/style/acp_users_overview.html b/phpBB/adm/style/acp_users_overview.html
new file mode 100644
index 0000000000..cfdc364b48
--- /dev/null
+++ b/phpBB/adm/style/acp_users_overview.html
@@ -0,0 +1,82 @@
+
+
+
+ {L_ACP_USER_OVERVIEW}
+
+ {L_USERNAME}: {L_NAME_CHARS_EXPLAIN}
+
+ [ {L_USE_PERMISSIONS} ]
+
+
+
+ {L_USER_IS_INACTIVE}:
+ {USER_INACTIVE_REASON}
+
+
+
+ {L_REGISTERED}:
+ {USER_REGISTERED}
+
+
+
+ {L_REGISTERED_IP}:
+ {REGISTERED_IP}
+ [ {L_WHOIS} ]
+
+
+
+ {L_LAST_ACTIVE}:
+ {USER_LASTACTIVE}
+
+
+ {L_POSTS}:
+ {USER_POSTS}
+
+
+ {L_WARNINGS}:
+ {USER_WARNINGS}
+
+
+ {L_FOUNDER}: {L_FOUNDER_EXPLAIN}
+ id="user_founder" checked="checked" disabled="disabled" /> {L_YES} id="user_founder" checked="checked" disabled="disabled" /> {L_NO}
+
+
+ {L_EMAIL}:
+
+
+
+ {L_CONFIRM_EMAIL}: {L_CONFIRM_EMAIL_EXPLAIN}
+
+
+
+ {L_NEW_PASSWORD}: {L_CHANGE_PASSWORD_EXPLAIN}
+
+
+
+ {L_CONFIRM_PASSWORD}: {L_CONFIRM_PASSWORD_EXPLAIN}
+
+
+
+
+
+
+ {L_USER_TOOLS}
+
+ {L_QUICK_TOOLS}:
+ {S_ACTION_OPTIONS}
+
+
+
+ {L_DELETE_USER}: {L_DELETE_USER_EXPLAIN}
+
+ {L_RETAIN_POSTS} {L_DELETE_POSTS}
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/phpBB/adm/style/acp_users_prefs.html b/phpBB/adm/style/acp_users_prefs.html
new file mode 100644
index 0000000000..3a0d244d43
--- /dev/null
+++ b/phpBB/adm/style/acp_users_prefs.html
@@ -0,0 +1,132 @@
+
+
+
+ {L_UCP_PREFS_PERSONAL}
+
+ {L_SHOW_EMAIL}:
+ id="viewemail" checked="checked" /> {L_YES} id="viewemail" checked="checked" /> {L_NO}
+
+
+ {L_ADMIN_EMAIL}:
+ id="massemail" checked="checked" /> {L_YES} id="massemail" checked="checked" /> {L_NO}
+
+
+ {L_ALLOW_PM}: {L_ALLOW_PM_EXPLAIN}
+ id="allowpm" checked="checked" /> {L_YES} id="allowpm" checked="checked" /> {L_NO}
+
+
+ {L_HIDE_ONLINE}:
+ id="hideonline" checked="checked" /> {L_YES} id="hideonline" checked="checked" /> {L_NO}
+
+
+ {L_NOTIFY_METHOD}: {L_NOTIFY_METHOD_EXPLAIN}
+ id="notifymethod" checked="checked" /> {L_NOTIFY_METHOD_EMAIL} id="notifymethod" checked="checked" disabled="disabled" /> {L_NOTIFY_METHOD_IM} id="notifymethod" checked="checked" /> {L_NOTIFY_METHOD_BOTH}
+
+
+ {L_NOTIFY_ON_PM}:
+ id="notifypm" checked="checked" /> {L_YES} id="notifypm" checked="checked" /> {L_NO}
+
+
+ {L_POPUP_ON_PM}:
+ id="popuppm" checked="checked" /> {L_YES} id="popuppm" checked="checked" />{L_NO}
+
+
+ {L_BOARD_LANGUAGE}:
+ {S_LANG_OPTIONS}
+
+
+ {L_BOARD_STYLE}:
+ {S_STYLE_OPTIONS}
+
+
+ {L_BOARD_TIMEZONE}:
+ {S_TZ_OPTIONS}
+
+
+ {L_BOARD_DST}:
+ id="dst" checked="checked" /> {L_YES} id="dst" checked="checked" /> {L_NO}
+
+
+ {L_BOARD_DATE_FORMAT}: {L_BOARD_DATE_FORMAT_EXPLAIN}
+ {S_DATEFORMAT_OPTIONS}
+ style="display:none;">
+
+
+
+
+ {L_UCP_PREFS_POST}
+
+ {L_DEFAULT_BBCODE}:
+ id="bbcode" checked="checked" /> {L_YES} id="bbcode" checked="checked" /> {L_NO}
+
+
+ {L_DEFAULT_SMILIES}:
+ id="smilies" checked="checked" /> {L_YES} id="smilies" checked="checked" /> {L_NO}
+
+
+ {L_DEFAULT_ADD_SIG}:
+ id="sig" checked="checked" /> {L_YES} id="sig" checked="checked" /> {L_NO}
+
+
+ {L_DEFAULT_NOTIFY}:
+ id="notify" checked="checked" /> {L_YES} id="notify" checked="checked" /> {L_NO}
+
+
+
+
+ {L_UCP_PREFS_VIEW}
+
+ {L_VIEW_IMAGES}:
+ id="view_images" checked="checked" /> {L_YES} id="view_images" checked="checked" /> {L_NO}
+
+
+ {L_VIEW_FLASH}:
+ id="view_flash" checked="checked" /> {L_YES} id="view_flash" checked="checked" /> {L_NO}
+
+
+ {L_VIEW_SMILIES}:
+ id="view_smilies" checked="checked" /> {L_YES} id="view_smilies" checked="checked" /> {L_NO}
+
+
+ {L_VIEW_SIGS}:
+ id="view_sigs" checked="checked" /> {L_YES} id="view_sigss" checked="checked" /> {L_NO}
+
+
+ {L_VIEW_AVATARS}:
+ id="view_avatars" checked="checked" /> {L_YES} id="view_avatars" checked="checked" /> {L_NO}
+
+
+ {L_DISABLE_CENSORS}:
+ id="view_wordcensor" checked="checked" /> {L_YES} id="view_wordcensor" checked="checked" /> {L_NO}
+
+
+ {L_VIEW_TOPICS_DAYS}:
+ {S_TOPIC_SORT_DAYS}
+
+
+ {L_VIEW_TOPICS_KEY}:
+ {S_TOPIC_SORT_KEY}
+
+
+ {L_VIEW_TOPICS_DIR}:
+ {S_TOPIC_SORT_DIR}
+
+
+ {L_VIEW_POSTS_DAYS}:
+ {S_POST_SORT_DAYS}
+
+
+ {L_VIEW_POSTS_KEY}:
+ {S_POST_SORT_KEY}
+
+
+ {L_VIEW_POSTS_DIR}:
+ {S_POST_SORT_DIR}
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/phpBB/adm/style/acp_users_profile.html b/phpBB/adm/style/acp_users_profile.html
new file mode 100644
index 0000000000..69edb1159b
--- /dev/null
+++ b/phpBB/adm/style/acp_users_profile.html
@@ -0,0 +1,66 @@
+
+
+
+ {L_USER_PROFILE}
+
+ {L_UCP_ICQ}:
+
+
+
+ {L_UCP_AIM}:
+
+
+
+ {L_UCP_MSNM}:
+
+
+
+ {L_UCP_YIM}:
+
+
+
+ {L_UCP_JABBER}:
+
+
+
+ {L_WEBSITE}:
+
+
+
+ {L_LOCATION}:
+
+
+
+ {L_OCCUPATION}:
+ {OCCUPATION}
+
+
+ {L_INTERESTS}:
+ {INTERESTS}
+
+
+ {L_BIRTHDAY}: {L_BIRTHDAY_EXPLAIN}
+ {L_DAY}: {S_BIRTHDAY_DAY_OPTIONS} {L_MONTH}: {S_BIRTHDAY_MONTH_OPTIONS} {L_YEAR}: {S_BIRTHDAY_YEAR_OPTIONS}
+
+
+
+
+
+ {L_USER_CUSTOM_PROFILE_FIELDS}
+
+
+ {profile_fields.LANG_NAME}: {profile_fields.LANG_EXPLAIN}
+ {profile_fields.FIELD}
+
+ {profile_fields.ERROR}
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/phpBB/adm/style/acp_users_signature.html b/phpBB/adm/style/acp_users_signature.html
new file mode 100644
index 0000000000..3c66e52662
--- /dev/null
+++ b/phpBB/adm/style/acp_users_signature.html
@@ -0,0 +1,106 @@
+
+
+
+
+
+
+
+ {L_ADMIN_SIG_PREVIEW}
+ {SIGNATURE_PREVIEW}
+
+
+
+
+ {L_SIGNATURE}
+ {L_SIGNATURE_EXPLAIN}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {L_FONT_SIZE}:
+ {L_FONT_TINY}
+ {L_FONT_SMALL}
+ {L_FONT_NORMAL}
+ {L_FONT_LARGE}
+ {L_FONT_HUGE}
+
+
+
+
+ onmouseover="helpline('cb_{custom_tags.BBCODE_ID}')" />
+
+
+
+
+
+ {SIGNATURE}
+
+
+
+ {L_DISABLE_BBCODE}
+
+
+ {L_DISABLE_SMILIES}
+
+
+ {L_DISABLE_MAGIC_URL}
+
+ {L_OPTIONS}: {BBCODE_STATUS} :: {IMG_STATUS} :: {FLASH_STATUS} :: {URL_STATUS} :: {SMILIES_STATUS}
+
+
+
+
+
+
+
+
+
\ No newline at end of file
From e7de77fd8d7bbd5ed176dd82c4b81774e22c4a1d Mon Sep 17 00:00:00 2001
From: David M
Date: Sat, 17 Feb 2007 18:28:51 +0000
Subject: [PATCH 054/707] #8082
git-svn-id: file:///svn/phpbb/trunk@7004 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/includes/functions_install.php | 1 -
phpBB/install/convertors/convert_phpbb20.php | 4 ++--
phpBB/install/install_convert.php | 5 +++--
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/phpBB/includes/functions_install.php b/phpBB/includes/functions_install.php
index 0feaeff08e..30d14c985b 100644
--- a/phpBB/includes/functions_install.php
+++ b/phpBB/includes/functions_install.php
@@ -463,7 +463,6 @@ function connect_check_db($error_connect, &$error, $dbms, $table_prefix, $dbhost
break;
}
- $db->sql_close();
}
if ($error_connect && (!isset($error) || !sizeof($error)))
diff --git a/phpBB/install/convertors/convert_phpbb20.php b/phpBB/install/convertors/convert_phpbb20.php
index 8ba43f4be8..f87bf2f7d6 100644
--- a/phpBB/install/convertors/convert_phpbb20.php
+++ b/phpBB/install/convertors/convert_phpbb20.php
@@ -431,7 +431,7 @@ if (!$get_info)
'autoincrement' => 'rank_id',
array('rank_id', 'ranks.rank_id', ''),
- array('rank_title', 'ranks.rank_title', array('function1' => 'phpbb_set_encoding', 'function2' => 'utf8_htmlspecialchars')),
+ array('rank_title', 'ranks.rank_title', array('function1' => 'phpbb_set_default_encoding', 'function2' => 'utf8_htmlspecialchars')),
array('rank_min', 'ranks.rank_min', array('typecast' => 'int', 'execute' => '{RESULT} = ({VALUE}[0] < 0) ? 0 : {VALUE}[0];')),
array('rank_special', 'ranks.rank_special', ''),
array('rank_image', 'ranks.rank_image', 'import_rank'),
@@ -615,7 +615,7 @@ if (!$get_info)
array(
'target' => PRIVMSGS_TABLE,
'primary' => 'privmsgs.privmsgs_id',
- 'autoincrement' => 'privmsgs_id',
+ 'autoincrement' => 'msg_id',
'query_first' => array(
array('target', $convert->truncate_statement . PRIVMSGS_TABLE),
array('target', $convert->truncate_statement . PRIVMSGS_RULES_TABLE),
diff --git a/phpBB/install/install_convert.php b/phpBB/install/install_convert.php
index 28093f8efa..9b7e621397 100644
--- a/phpBB/install/install_convert.php
+++ b/phpBB/install/install_convert.php
@@ -279,7 +279,7 @@ class install_convert extends module
while ($entry = readdir($handle))
{
- if (preg_match('/^convert_([a-z0-9_]+).' . $phpEx . '/i', $entry, $m))
+ if (preg_match('/^convert_([a-z0-9_]+).' . $phpEx . '$/i', $entry, $m))
{
include('./convertors/' . $entry);
if (isset($convertor_data))
@@ -452,6 +452,7 @@ class install_convert extends module
if (!$result)
{
$prefixes = array();
+ // TODO: fixme
if ($result = $src_db->sql_query('SHOW TABLES'))
{
while ($row = $src_db->sql_fetchrow($result))
@@ -991,7 +992,7 @@ class install_convert extends module
$config['max_quote_depth'] = 0;
// @todo Need to confirm that max post length in source is <= max post length in destination or there may be interesting formatting issues
- $config['max_post_chars'] = -1;
+ $config['max_post_chars'] = -1;
}
$template->assign_block_vars('checks', array(
From af4a2033c55d931a2271196537be21fdf649c4f4 Mon Sep 17 00:00:00 2001
From: David M
Date: Sat, 17 Feb 2007 23:09:58 +0000
Subject: [PATCH 055/707] #8160
git-svn-id: file:///svn/phpbb/trunk@7005 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/includes/acp/acp_ban.php | 2 +-
phpBB/includes/functions_user.php | 16 +++++++++++++---
phpBB/includes/mcp/mcp_ban.php | 2 +-
3 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/phpBB/includes/acp/acp_ban.php b/phpBB/includes/acp/acp_ban.php
index b85b2d36d4..cf490a4643 100644
--- a/phpBB/includes/acp/acp_ban.php
+++ b/phpBB/includes/acp/acp_ban.php
@@ -26,7 +26,7 @@ class acp_ban
$unbansubmit= (isset($_POST['unbansubmit'])) ? true : false;
$current_time = time();
- $user->add_lang('acp/ban');
+ $user->add_lang(array('acp/ban', 'acp/users'));
$this->tpl_name = 'acp_ban';
// Ban submitted?
diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php
index c78238b25f..6df1b838b2 100644
--- a/phpBB/includes/functions_user.php
+++ b/phpBB/includes/functions_user.php
@@ -602,12 +602,12 @@ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reas
$ban_end = 0;
}
- $founder = array();
+ $founder = $founder_names = array();
if (!$ban_exclude)
{
// Create a list of founder...
- $sql = 'SELECT user_id, user_email
+ $sql = 'SELECT user_id, user_email, username_clean
FROM ' . USERS_TABLE . '
WHERE user_type = ' . USER_FOUNDER;
$result = $db->sql_query($sql);
@@ -615,6 +615,7 @@ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reas
while ($row = $db->sql_fetchrow($result))
{
$founder[$row['user_id']] = $row['user_email'];
+ $founder_names[$row['user_id']] = $row['username_clean'];
}
$db->sql_freeresult($result);
}
@@ -641,7 +642,16 @@ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reas
$username = trim($username);
if ($username != '')
{
- $sql_usernames[] = utf8_clean_string($username);
+ $clean_name = utf8_clean_string($username);
+ if ($clean_name == $user->data['username_clean'])
+ {
+ trigger_error($user->lang['CANNOT_BAN_YOURSELF']);
+ }
+ if (in_array($clean_name, $founder_names))
+ {
+ trigger_error($user->lang['CANNOT_BAN_FOUNDER']);
+ }
+ $sql_usernames[] = $clean_name;
}
}
diff --git a/phpBB/includes/mcp/mcp_ban.php b/phpBB/includes/mcp/mcp_ban.php
index aea2466888..5080ae08f2 100644
--- a/phpBB/includes/mcp/mcp_ban.php
+++ b/phpBB/includes/mcp/mcp_ban.php
@@ -29,7 +29,7 @@ class mcp_ban
$unbansubmit = (isset($_POST['unbansubmit'])) ? true : false;
$current_time = time();
- $user->add_lang('acp/ban');
+ $user->add_lang(array('acp/ban', 'acp/users'));
$this->tpl_name = 'mcp_ban';
// Ban submitted?
From 652d349b75262dd8e0db8405d5ca1b7fa654364a Mon Sep 17 00:00:00 2001
From: David M
Date: Sat, 17 Feb 2007 23:40:57 +0000
Subject: [PATCH 056/707] - IE7 should now work too
git-svn-id: file:///svn/phpbb/trunk@7006 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/includes/acp/acp_database.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/phpBB/includes/acp/acp_database.php b/phpBB/includes/acp/acp_database.php
index 0404ec73b7..2acbfb63ec 100644
--- a/phpBB/includes/acp/acp_database.php
+++ b/phpBB/includes/acp/acp_database.php
@@ -552,7 +552,7 @@ class base_extractor
break;
case 'gzip':
- if (isset($_SERVER['HTTP_ACCEPT_ENCODING']) && strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false)
+ if ((isset($_SERVER['HTTP_ACCEPT_ENCODING']) && strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false) && strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'msie') === false)
{
ob_start('ob_gzhandler');
}
From 5c6653717f0a9adce905d1417c8adb4f0f3a5b73 Mon Sep 17 00:00:00 2001
From: Meik Sievertsen
Date: Sun, 18 Feb 2007 13:42:08 +0000
Subject: [PATCH 057/707] fixing some bugs more mcp links for easier moderating
different aspects (all, forum, topic) i may have introduced new bugs with
this commit due to me having fixed some things weeks ago and some code
changed in between - please report if you see something not working as
expected.
git-svn-id: file:///svn/phpbb/trunk@7007 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/download.php | 8 +-
phpBB/includes/acp/acp_email.php | 15 ++-
phpBB/includes/acp/acp_groups.php | 95 ++++++---------
phpBB/includes/acp/acp_language.php | 11 +-
phpBB/includes/acp/acp_modules.php | 10 +-
phpBB/includes/functions.php | 2 +-
phpBB/includes/functions_convert.php | 4 +-
phpBB/includes/functions_display.php | 28 ++++-
phpBB/includes/functions_messenger.php | 2 +-
phpBB/includes/functions_user.php | 12 +-
phpBB/includes/mcp/mcp_forum.php | 12 +-
phpBB/includes/mcp/mcp_queue.php | 4 +-
phpBB/includes/ucp/ucp_groups.php | 114 ++++++++++++++++--
phpBB/includes/ucp/ucp_pm_compose.php | 2 +-
phpBB/index.php | 2 +-
phpBB/language/en/acp/attachments.php | 2 +-
phpBB/language/en/acp/common.php | 3 +-
phpBB/language/en/acp/email.php | 2 +-
phpBB/language/en/acp/groups.php | 2 +-
phpBB/language/en/common.php | 5 +-
phpBB/language/en/groups.php | 2 +-
phpBB/language/en/mcp.php | 2 +
phpBB/language/en/posting.php | 2 +-
phpBB/mcp.php | 13 ++
phpBB/memberlist.php | 20 +--
.../styles/subSilver/template/mcp_header.html | 25 ++--
phpBB/viewtopic.php | 10 +-
27 files changed, 257 insertions(+), 152 deletions(-)
diff --git a/phpBB/download.php b/phpBB/download.php
index cec44eaf1c..16b4bfa76e 100644
--- a/phpBB/download.php
+++ b/phpBB/download.php
@@ -270,9 +270,11 @@ function send_file_to_browser($attachment, $upload_dir, $category)
*/
function header_filename($file)
{
- // There be dragons here...
- // IE and Safari follows no RFC.
- if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false || strpos($_SERVER['HTTP_USER_AGENT'], 'Safari') !== false)
+ $user_agent = $_SERVER['HTTP_USER_AGENT'];
+
+ // There be dragons here.
+ // Not many follows the RFC...
+ if (strpos($user_agent, 'MSIE') !== false || strpos($user_agent, 'Safari') !== false || strpos($user_agent, 'Konqueror') !== false)
{
return "filename=" . rawurlencode($file);
}
diff --git a/phpBB/includes/acp/acp_email.php b/phpBB/includes/acp/acp_email.php
index 57d03ff67e..3fbbe6472f 100644
--- a/phpBB/includes/acp/acp_email.php
+++ b/phpBB/includes/acp/acp_email.php
@@ -51,7 +51,7 @@ class acp_email
$error[] = $user->lang['NO_EMAIL_MESSAGE'];
}
- if (!sizeof($error))
+ if (!sizeof($error))
{
if ($usernames)
{
@@ -208,16 +208,21 @@ class acp_email
}
}
- // Exclude bots...
+ // Exclude bots and guests...
$sql = 'SELECT group_id
FROM ' . GROUPS_TABLE . "
- WHERE group_name = 'BOTS'";
+ WHERE group_name IN ('BOTS', 'GUESTS')";
$result = $db->sql_query($sql);
- $bot_group_id = (int) $db->sql_fetchfield('group_id');
+
+ $exclude = array();
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $exclude[] = $row['group_id'];
+ }
$db->sql_freeresult($result);
$select_list = '' . $user->lang['ALL_USERS'] . ' ';
- $select_list .= group_select_options($group_id, array($bot_group_id));
+ $select_list .= group_select_options($group_id, $exclude);
$s_priority_options = '' . $user->lang['MAIL_LOW_PRIORITY'] . ' ';
$s_priority_options .= '' . $user->lang['MAIL_NORMAL_PRIORITY'] . ' ';
diff --git a/phpBB/includes/acp/acp_groups.php b/phpBB/includes/acp/acp_groups.php
index 7147431259..2645ac4ce3 100644
--- a/phpBB/includes/acp/acp_groups.php
+++ b/phpBB/includes/acp/acp_groups.php
@@ -272,16 +272,13 @@ class acp_groups
'receive_pm' => isset($_REQUEST['group_receive_pm']) ? 1 : 0,
'legend' => isset($_REQUEST['group_legend']) ? 1 : 0,
'message_limit' => request_var('group_message_limit', 0),
+ 'founder_manage' => 0,
);
if ($user->data['user_type'] == USER_FOUNDER)
{
$submit_ary['founder_manage'] = isset($_REQUEST['group_founder_manage']) ? 1 : 0;
}
- else
- {
- $submit_ary['founder_manage'] = 0;
- }
if (!empty($_FILES['uploadfile']['tmp_name']) || $data['uploadurl'] || $data['remotelink'])
{
@@ -318,6 +315,11 @@ class acp_groups
$submit_ary['avatar'] = $category . '/' . $avatar_select;
}
}
+ else if ($delete)
+ {
+ $submit_ary['avatar'] = '';
+ $submit_ary['avatar_type'] = $submit_ary['avatar_width'] = $submit_ary['avatar_height'] = 0;
+ }
else if ($data['width'] && $data['height'])
{
// Only update the dimensions?
@@ -346,11 +348,6 @@ class acp_groups
$submit_ary['avatar_height'] = $data['height'];
}
}
- else if ($delete)
- {
- $submit_ary['avatar'] = '';
- $submit_ary['avatar_type'] = $submit_ary['avatar_width'] = $submit_ary['avatar_height'] = 0;
- }
if ((isset($submit_ary['avatar']) && $submit_ary['avatar'] && (!isset($group_row['group_avatar']) || $group_row['group_avatar'] != $submit_ary['avatar'])) || $delete)
{
@@ -593,53 +590,38 @@ class acp_groups
$this->page_title = 'GROUP_MEMBERS';
- // Total number of group leaders
- $sql = 'SELECT COUNT(user_id) AS total_leaders
- FROM ' . USER_GROUP_TABLE . "
- WHERE group_id = $group_id
- AND group_leader = 1";
+ // Grab the leaders - always, on every page...
+ $sql = 'SELECT u.user_id, u.username, u.username_clean, u.user_regdate, u.user_posts, u.group_id, ug.group_leader, ug.user_pending
+ FROM ' . USERS_TABLE . ' u, ' . USER_GROUP_TABLE . " ug
+ WHERE ug.group_id = $group_id
+ AND u.user_id = ug.user_id
+ AND ug.group_leader = 1
+ ORDER BY ug.group_leader DESC, ug.user_pending ASC, u.username_clean";
$result = $db->sql_query($sql);
- $total_leaders = (int) $db->sql_fetchfield('total_leaders');
+
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $template->assign_block_vars('leader', array(
+ 'U_USER_EDIT' => append_sid("{$phpbb_admin_path}index.$phpEx", "i=users&action=edit&u={$row['user_id']}"),
+
+ 'USERNAME' => $row['username'],
+ 'S_GROUP_DEFAULT' => ($row['group_id'] == $group_id) ? true : false,
+ 'JOINED' => ($row['user_regdate']) ? $user->format_date($row['user_regdate']) : ' - ',
+ 'USER_POSTS' => $row['user_posts'],
+ 'USER_ID' => $row['user_id'])
+ );
+ }
$db->sql_freeresult($result);
// Total number of group members (non-leaders)
$sql = 'SELECT COUNT(user_id) AS total_members
FROM ' . USER_GROUP_TABLE . "
WHERE group_id = $group_id
- AND group_leader <> 1";
+ AND group_leader = 0";
$result = $db->sql_query($sql);
$total_members = (int) $db->sql_fetchfield('total_members');
$db->sql_freeresult($result);
- // Grab the members
- $sql = 'SELECT u.user_id, u.username, u.username_clean, u.user_regdate, u.user_posts, u.group_id, ug.group_leader, ug.user_pending
- FROM ' . USERS_TABLE . ' u, ' . USER_GROUP_TABLE . " ug
- WHERE ug.group_id = $group_id
- AND u.user_id = ug.user_id
- ORDER BY ug.group_leader DESC, ug.user_pending ASC, u.username_clean";
- $result = $db->sql_query_limit($sql, $config['topics_per_page'], $start);
-
- $leader = $member = 0;
- $group_data = array(
- 'leader' => array(),
- 'member' => array(),
- );
-
- while ($row = $db->sql_fetchrow($result))
- {
- $type = ($row['group_leader']) ? 'leader' : 'member';
-
- $group_data[$type][$$type]['user_id'] = $row['user_id'];
- $group_data[$type][$$type]['group_id'] = $row['group_id'];
- $group_data[$type][$$type]['username'] = $row['username'];
- $group_data[$type][$$type]['user_regdate'] = $row['user_regdate'];
- $group_data[$type][$$type]['user_posts'] = $row['user_posts'];
- $group_data[$type][$$type]['user_pending'] = ($row['user_pending']) ? 1 : 0;
-
- $$type++;
- }
- $db->sql_freeresult($result);
-
$s_action_options = '';
$options = array('default' => 'DEFAULT', 'approve' => 'APPROVE', 'demote' => 'DEMOTE', 'promote' => 'PROMOTE', 'deleteusers' => 'DELETE');
@@ -664,22 +646,18 @@ class acp_groups
'U_DEFAULT_ALL' => "{$this->u_action}&action=default&g=$group_id")
);
- foreach ($group_data['leader'] as $row)
- {
- $template->assign_block_vars('leader', array(
- 'U_USER_EDIT' => append_sid("{$phpbb_admin_path}index.$phpEx", "i=users&action=edit&u={$row['user_id']}"),
-
- 'USERNAME' => $row['username'],
- 'S_GROUP_DEFAULT' => ($row['group_id'] == $group_id) ? true : false,
- 'JOINED' => ($row['user_regdate']) ? $user->format_date($row['user_regdate']) : ' - ',
- 'USER_POSTS' => $row['user_posts'],
- 'USER_ID' => $row['user_id'])
- );
- }
+ // Grab the members
+ $sql = 'SELECT u.user_id, u.username, u.username_clean, u.user_regdate, u.user_posts, u.group_id, ug.group_leader, ug.user_pending
+ FROM ' . USERS_TABLE . ' u, ' . USER_GROUP_TABLE . " ug
+ WHERE ug.group_id = $group_id
+ AND u.user_id = ug.user_id
+ AND ug.group_leader = 0
+ ORDER BY ug.group_leader DESC, ug.user_pending ASC, u.username_clean";
+ $result = $db->sql_query_limit($sql, $config['topics_per_page'], $start);
$pending = false;
- foreach ($group_data['member'] as $row)
+ while ($row = $db->sql_fetchrow($result))
{
if ($row['user_pending'] && !$pending)
{
@@ -700,6 +678,7 @@ class acp_groups
'USER_ID' => $row['user_id'])
);
}
+ $db->sql_freeresult($result);
return;
break;
diff --git a/phpBB/includes/acp/acp_language.php b/phpBB/includes/acp/acp_language.php
index 7dcd64265c..50fb854d54 100644
--- a/phpBB/includes/acp/acp_language.php
+++ b/phpBB/includes/acp/acp_language.php
@@ -147,7 +147,7 @@ class acp_language
$db->sql_query('UPDATE ' . LANG_TABLE . '
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
WHERE lang_id = ' . $lang_id);
-
+
add_log('admin', 'LOG_LANGUAGE_PACK_UPDATED', $sql_ary['lang_english_name']);
trigger_error($user->lang['LANGUAGE_DETAILS_UPDATED'] . adm_back_link($this->u_action));
@@ -276,7 +276,9 @@ class acp_language
echo $buffer;
}
fclose($fp);
-
+
+ add_log('admin', 'LOG_LANGUAGE_FILE_SUBMITTED', $this->language_file);
+
exit;
}
else if ($action == 'upload_data')
@@ -340,7 +342,8 @@ class acp_language
trigger_error($user->lang['UPLOAD_COMPLETED'] . adm_back_link($this->u_action . '&action=details&id=' . $lang_id . '&language_file=' . urlencode($selected_lang_file)));
}
-
+
+ add_log('admin', 'LOG_LANGUAGE_FILE_SUBMITTED', $this->language_file);
$action = 'details';
// no break;
@@ -1010,7 +1013,7 @@ class acp_language
* {FILENAME} [{LANG_NAME}]
*
* @package language
-* @version $Id: $
+* @version $' . 'Id: ' . '$
* @copyright (c) ' . date('Y') . ' phpBB Group
* @author {CHANGED} - {AUTHOR}
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
diff --git a/phpBB/includes/acp/acp_modules.php b/phpBB/includes/acp/acp_modules.php
index 2eb45b4972..a1917b1717 100644
--- a/phpBB/includes/acp/acp_modules.php
+++ b/phpBB/includes/acp/acp_modules.php
@@ -726,7 +726,7 @@ class acp_modules
{
$sql = 'SELECT left_id, right_id
FROM ' . MODULES_TABLE . "
- WHERE module_class = '" . $db->sql_escape($this->module_class) . "'
+ WHERE module_class = '" . $db->sql_escape($module_data['module_class']) . "'
AND module_id = {$module_data['parent_id']}";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
@@ -744,13 +744,13 @@ class acp_modules
$sql = 'UPDATE ' . MODULES_TABLE . "
SET left_id = left_id + 2, right_id = right_id + 2
- WHERE module_class = '" . $db->sql_escape($this->module_class) . "'
+ WHERE module_class = '" . $db->sql_escape($module_data['module_class']) . "'
AND left_id > {$row['right_id']}";
$db->sql_query($sql);
$sql = 'UPDATE ' . MODULES_TABLE . "
SET right_id = right_id + 2
- WHERE module_class = '" . $db->sql_escape($this->module_class) . "'
+ WHERE module_class = '" . $db->sql_escape($module_data['module_class']) . "'
AND {$row['left_id']} BETWEEN left_id AND right_id";
$db->sql_query($sql);
@@ -761,7 +761,7 @@ class acp_modules
{
$sql = 'SELECT MAX(right_id) AS right_id
FROM ' . MODULES_TABLE . "
- WHERE module_class = '" . $db->sql_escape($this->module_class) . "'";
+ WHERE module_class = '" . $db->sql_escape($module_data['module_class']) . "'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
@@ -805,7 +805,7 @@ class acp_modules
$sql = 'UPDATE ' . MODULES_TABLE . '
SET ' . $db->sql_build_array('UPDATE', $update_ary) . "
- WHERE module_class = '" . $db->sql_escape($this->module_class) . "'
+ WHERE module_class = '" . $db->sql_escape($module_data['module_class']) . "'
AND module_id = {$module_data['module_id']}";
$db->sql_query($sql);
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 8639df6ab0..d3638f1941 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -2111,7 +2111,7 @@ function bump_topic_allowed($forum_id, $topic_bumped, $last_post_time, $topic_po
}
// Check bumper, only topic poster and last poster are allowed to bump
- if ($topic_poster != $user->data['user_id'] && $last_topic_poster != $user->data['user_id'] && !$auth->acl_get('m_', $forum_id))
+ if ($topic_poster != $user->data['user_id'] && $last_topic_poster != $user->data['user_id'])
{
return false;
}
diff --git a/phpBB/includes/functions_convert.php b/phpBB/includes/functions_convert.php
index fe72f3fa9e..e8c57a4db6 100644
--- a/phpBB/includes/functions_convert.php
+++ b/phpBB/includes/functions_convert.php
@@ -304,7 +304,7 @@ function decode_ip($int_ip)
{
if (!$int_ip)
{
- return '';
+ return '127.0.0.1';
}
$hexipbang = explode('.', chunk_split($int_ip, 2, '.'));
@@ -315,7 +315,7 @@ function decode_ip($int_ip)
return '';
}
- return hexdec($hexipbang[0]). '.' . hexdec($hexipbang[1]) . '.' . hexdec($hexipbang[2]) . '.' . hexdec($hexipbang[3]);
+ return hexdec($hexipbang[0]) . '.' . hexdec($hexipbang[1]) . '.' . hexdec($hexipbang[2]) . '.' . hexdec($hexipbang[3]);
}
/**
diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php
index e62bf674e6..f63d6a7da7 100644
--- a/phpBB/includes/functions_display.php
+++ b/phpBB/includes/functions_display.php
@@ -252,7 +252,8 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
$forum_unread = (isset($forum_tracking_info[$forum_id]) && $row['orig_forum_last_post_time'] > $forum_tracking_info[$forum_id]) ? true : false;
- $folder_image = $folder_alt = $subforums_list = $l_subforums = '';
+ $folder_image = $folder_alt = $l_subforums = '';
+ $subforums_list = array();
// Generate list of subforums if we need to
if (isset($subforums[$forum_id]))
@@ -267,8 +268,10 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
if ($subforum_row['display'] && $subforum_row['name'])
{
- $subforums_list .= ($subforums_list == '') ? '' : ', ';
- $subforums_list .= '' . $subforum_row['name'] . ' ';
+ $subforums_list[] = array(
+ 'link' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $subforum_id),
+ 'name' => $subforum_row['name']
+ );
}
else
{
@@ -327,11 +330,19 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
$l_post_click_count = ($row['forum_type'] == FORUM_LINK) ? 'CLICKS' : 'POSTS';
$post_click_count = ($row['forum_type'] != FORUM_LINK || $row['forum_flags'] & FORUM_FLAG_LINK_TRACK) ? $row['forum_posts'] : '';
+ $s_subforums_list = array();
+ foreach ($subforums_list as $subforum)
+ {
+ $s_subforums_list[] = '' . $subforum['name'] . ' ';
+ }
+ $s_subforums_list = (string) implode(', ', $s_subforums_list);
+
$template->assign_block_vars('forumrow', array(
'S_IS_CAT' => false,
'S_IS_LINK' => ($row['forum_type'] == FORUM_LINK) ? true : false,
'S_UNREAD_FORUM' => $forum_unread,
'S_LOCKED_FORUM' => ($row['forum_status'] == ITEM_LOCKED) ? true : false,
+ 'S_SUBFORUMS' => (sizeof($subforums_list)) ? true : false,
'FORUM_ID' => $row['forum_id'],
'FORUM_NAME' => $row['forum_name'],
@@ -342,13 +353,13 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
'FORUM_FOLDER_IMG_SRC' => $user->img($folder_image, $folder_alt, false, '', 'src'),
'FORUM_IMAGE' => ($row['forum_image']) ? ' ' : '',
'FORUM_IMAGE_SRC' => ($row['forum_image']) ? $phpbb_root_path . $row['forum_image'] : '',
- 'SUBFORUMS' => $subforums_list,
'LAST_POST_SUBJECT' => censor_text($last_post_subject),
'LAST_POST_TIME' => $last_post_time,
'LAST_POSTER' => get_username_string('username', $row['forum_last_poster_id'], $row['forum_last_poster_name'], $row['forum_last_poster_colour']),
'LAST_POSTER_COLOUR' => get_username_string('colour', $row['forum_last_poster_id'], $row['forum_last_poster_name'], $row['forum_last_poster_colour']),
'LAST_POSTER_FULL' => get_username_string('full', $row['forum_last_poster_id'], $row['forum_last_poster_name'], $row['forum_last_poster_colour']),
'MODERATORS' => $moderators_list,
+ 'SUBFORUMS' => $s_subforums_list,
'L_SUBFORUM_STR' => $l_subforums,
'L_FORUM_FOLDER_ALT' => $folder_alt,
@@ -358,6 +369,15 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
'U_LAST_POSTER' => get_username_string('profile', $row['forum_last_poster_id'], $row['forum_last_poster_name'], $row['forum_last_poster_colour']),
'U_LAST_POST' => $last_post_url)
);
+
+ // Assign subforums loop for style authors
+ foreach ($subforums_list as $subforum)
+ {
+ $template->assign_block_vars('forumrow.subforum', array(
+ 'U_SUBFORUM' => $subforum['link'],
+ 'SUBFORUM_NAME' => $subforum['name'])
+ );
+ }
}
$template->assign_vars(array(
diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php
index d63a31ffb5..dd84533b23 100644
--- a/phpBB/includes/functions_messenger.php
+++ b/phpBB/includes/functions_messenger.php
@@ -846,7 +846,7 @@ function smtpmail($addresses, $subject, $message, &$err_msg, $headers = '')
// From this point onward most server response codes should be 250
// Specify who the mail is from....
- $smtp->server_send('MAIL FROM:<' . $config['board_contact'] . '>');
+ $smtp->server_send('MAIL FROM:<' . $config['board_email'] . '>');
if ($err_msg = $smtp->server_parse('250', __LINE__))
{
$smtp->close_session($err_msg);
diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php
index 6df1b838b2..3e3ee90c1b 100644
--- a/phpBB/includes/functions_user.php
+++ b/phpBB/includes/functions_user.php
@@ -1755,17 +1755,12 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow
// Those are group-only attributes
$group_only_ary = array('group_receive_pm', 'group_legend', 'group_message_limit', 'group_founder_manage');
- // Check data
- if (!utf8_strlen($name) || utf8_strlen($name) > 40)
+ // Check data. Limit group name length.
+ if (!utf8_strlen($name) || utf8_strlen($name) > 60)
{
$error[] = (!utf8_strlen($name)) ? $user->lang['GROUP_ERR_USERNAME'] : $user->lang['GROUP_ERR_USER_LONG'];
}
- if (utf8_strlen($desc) > 255)
- {
- $error[] = $user->lang['GROUP_ERR_DESC_LONG'];
- }
-
if (!in_array($type, array(GROUP_OPEN, GROUP_CLOSED, GROUP_HIDDEN, GROUP_SPECIAL, GROUP_FREE)))
{
$error[] = $user->lang['GROUP_ERR_TYPE'];
@@ -2420,7 +2415,8 @@ function group_memberships($group_id_ary = false, $user_id_ary = false, $return_
$sql = 'SELECT ug.*, u.username, u.username_clean, u.user_email
FROM ' . USER_GROUP_TABLE . ' ug, ' . USERS_TABLE . ' u
- WHERE ug.user_id = u.user_id AND ';
+ WHERE ug.user_id = u.user_id
+ AND ug.user_pending = 0 AND ';
if ($group_id_ary)
{
diff --git a/phpBB/includes/mcp/mcp_forum.php b/phpBB/includes/mcp/mcp_forum.php
index 2f02a21a3f..3f11c96e21 100644
--- a/phpBB/includes/mcp/mcp_forum.php
+++ b/phpBB/includes/mcp/mcp_forum.php
@@ -28,11 +28,11 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
unset($_POST['sk'], $_POST['sd'], $_REQUEST['sk'], $_REQUEST['sd']);
}
- $forum_id = $forum_info['forum_id'];
- $start = request_var('start', 0);
- $topic_id_list = request_var('topic_id_list', array(0));
- $post_id_list = request_var('post_id_list', array(0));
- $topic_id = request_var('t', 0);
+ $forum_id = $forum_info['forum_id'];
+ $start = request_var('start', 0);
+ $topic_id_list = request_var('topic_id_list', array(0));
+ $post_id_list = request_var('post_id_list', array(0));
+ $source_topic_id = request_var('t', 0);
// Resync Topics
if ($action == 'resync')
@@ -216,7 +216,7 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
$topic_row = array_merge($topic_row, array(
'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&f=$forum_id&t={$row['topic_id']}&mode=topic_view"),
- 'S_SELECT_TOPIC' => ($action == 'merge_select' && $row['topic_id'] != $topic_id) ? true : false,
+ 'S_SELECT_TOPIC' => ($action == 'merge_select' && $row['topic_id'] != $source_topic_id) ? true : false,
'U_SELECT_TOPIC' => $url . "&i=$id&mode=topic_view&action=merge&to_topic_id=" . $row['topic_id'] . $selected_ids,
'U_MCP_QUEUE' => $u_mcp_queue,
'U_MCP_REPORT' => ($auth->acl_get('m_report', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&mode=topic_view&t=' . $row['topic_id'] . '&action=reports') : '',
diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php
index 6733a73a7e..0367092726 100644
--- a/phpBB/includes/mcp/mcp_queue.php
+++ b/phpBB/includes/mcp/mcp_queue.php
@@ -64,6 +64,8 @@ class mcp_queue
{
case 'approve_details':
+ $this->tpl_name = 'mcp_post';
+
$user->add_lang('posting');
$post_id = request_var('p', 0);
@@ -167,8 +169,6 @@ class mcp_queue
'POST_ID' => $post_info['post_id'])
);
- $this->tpl_name = 'mcp_post';
-
break;
case 'unapproved_topics':
diff --git a/phpBB/includes/ucp/ucp_groups.php b/phpBB/includes/ucp/ucp_groups.php
index 98d008da2c..418b68e436 100644
--- a/phpBB/includes/ucp/ucp_groups.php
+++ b/phpBB/includes/ucp/ucp_groups.php
@@ -312,7 +312,7 @@ class ucp_groups
// Hide hidden groups unless user is an admin with group privileges
$sql_and = ($auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel')) ? '<> ' . GROUP_SPECIAL : 'NOT IN (' . GROUP_SPECIAL . ', ' . GROUP_HIDDEN . ')';
- $sql = 'SELECT group_id, group_name, group_desc, group_desc_uid, group_desc_bitfield, group_desc_options, group_type
+ $sql = 'SELECT group_id, group_name, group_desc, group_desc_uid, group_desc_bitfield, group_desc_options, group_type, group_founder_manage
FROM ' . GROUPS_TABLE . '
WHERE ' . ((sizeof($group_id_ary)) ? $db->sql_in_set('group_id', $group_id_ary, true) . ' AND ' : '') . "
group_type $sql_and
@@ -392,6 +392,12 @@ class ucp_groups
{
trigger_error($user->lang['NO_GROUP'] . $return_page);
}
+
+ // Check if the user is allowed to manage this group if set to founder only.
+ if ($user->data['user_type'] != USER_FOUNDER && $group_row['group_founder_manage'])
+ {
+ trigger_error($user->lang['NOT_ALLOWED_MANAGE_GROUP'] . $return_page, E_USER_WARNING);
+ }
}
switch ($action)
@@ -403,10 +409,16 @@ class ucp_groups
trigger_error($user->lang['NO_GROUP'] . $return_page);
}
- if (!($row = group_memberships($group_id, $user->data['user_id'])) || !$row[0]['group_leader'])
+ if (!($row = group_memberships($group_id, $user->data['user_id'])))
{
trigger_error($user->lang['NOT_MEMBER_OF_GROUP'] . $return_page);
}
+ list(, $row) = each($row);
+
+ if (!$row['group_leader'])
+ {
+ trigger_error($user->lang['NOT_LEADER_OF_GROUP'] . $return_page);
+ }
$file_uploads = (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on') ? true : false;
$user->add_lang(array('acp/groups', 'acp/common'));
@@ -487,6 +499,34 @@ class ucp_groups
$submit_ary['avatar'] = '';
$submit_ary['avatar_type'] = $submit_ary['avatar_width'] = $submit_ary['avatar_height'] = 0;
}
+ else if ($data['width'] && $data['height'])
+ {
+ // Only update the dimensions?
+ if ($config['avatar_max_width'] || $config['avatar_max_height'])
+ {
+ if ($data['width'] > $config['avatar_max_width'] || $data['height'] > $config['avatar_max_height'])
+ {
+ $error[] = sprintf($user->lang['AVATAR_WRONG_SIZE'], $config['avatar_min_width'], $config['avatar_min_height'], $config['avatar_max_width'], $config['avatar_max_height'], $data['width'], $data['height']);
+ }
+ }
+
+ if (!sizeof($error))
+ {
+ if ($config['avatar_min_width'] || $config['avatar_min_height'])
+ {
+ if ($data['width'] < $config['avatar_min_width'] || $data['height'] < $config['avatar_min_height'])
+ {
+ $error[] = sprintf($user->lang['AVATAR_WRONG_SIZE'], $config['avatar_min_width'], $config['avatar_min_height'], $config['avatar_max_width'], $config['avatar_max_height'], $data['width'], $data['height']);
+ }
+ }
+ }
+
+ if (!sizeof($error))
+ {
+ $submit_ary['avatar_width'] = $data['width'];
+ $submit_ary['avatar_height'] = $data['height'];
+ }
+ }
if ((isset($submit_ary['avatar']) && $submit_ary['avatar'] && (!isset($group_row['group_avatar']) || $group_row['group_avatar'] != $submit_ary['avatar'])) || $delete)
{
@@ -656,29 +696,57 @@ class ucp_groups
trigger_error($user->lang['NO_GROUP'] . $return_page);
}
- if (!($row = group_memberships($group_id, $user->data['user_id'])) || !$row[0]['group_leader'])
+ if (!($row = group_memberships($group_id, $user->data['user_id'])))
{
trigger_error($user->lang['NOT_MEMBER_OF_GROUP'] . $return_page);
}
+ list(, $row) = each($row);
+
+ if (!$row['group_leader'])
+ {
+ trigger_error($user->lang['NOT_LEADER_OF_GROUP'] . $return_page);
+ }
$user->add_lang(array('acp/groups', 'acp/common'));
+ $start = request_var('start', 0);
+
+ // Grab the leaders - always, on every page...
+ $sql = 'SELECT u.user_id, u.username, u.username_clean, u.user_regdate, u.user_posts, u.group_id, ug.group_leader, ug.user_pending
+ FROM ' . USERS_TABLE . ' u, ' . USER_GROUP_TABLE . " ug
+ WHERE ug.group_id = $group_id
+ AND u.user_id = ug.user_id
+ AND ug.group_leader = 1
+ ORDER BY ug.group_leader DESC, ug.user_pending ASC, u.username_clean";
+ $result = $db->sql_query($sql);
+
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $template->assign_block_vars('leader', array(
+ 'USERNAME' => $row['username'],
+ 'U_USER_VIEW' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['user_id']),
+ 'S_GROUP_DEFAULT' => ($row['group_id'] == $group_id) ? true : false,
+ 'JOINED' => ($row['user_regdate']) ? $user->format_date($row['user_regdate']) : ' - ',
+ 'USER_POSTS' => $row['user_posts'],
+ 'USER_ID' => $row['user_id'])
+ );
+ }
+ $db->sql_freeresult($result);
// Total number of group members (non-leaders)
$sql = 'SELECT COUNT(user_id) AS total_members
FROM ' . USER_GROUP_TABLE . "
WHERE group_id = $group_id
- AND group_leader <> 1";
+ AND group_leader = 0";
$result = $db->sql_query($sql);
$total_members = (int) $db->sql_fetchfield('total_members');
$db->sql_freeresult($result);
- $start = request_var('start', 0);
-
// Grab the members
$sql = 'SELECT u.user_id, u.username, u.username_clean, u.user_regdate, u.user_posts, u.group_id, ug.group_leader, ug.user_pending
FROM ' . USERS_TABLE . ' u, ' . USER_GROUP_TABLE . " ug
WHERE ug.group_id = $group_id
AND u.user_id = ug.user_id
+ AND ug.group_leader = 0
ORDER BY ug.group_leader DESC, ug.user_pending ASC, u.username_clean";
$result = $db->sql_query_limit($sql, $config['topics_per_page'], $start);
@@ -695,7 +763,7 @@ class ucp_groups
$pending = true;
}
- $template->assign_block_vars($row['group_leader'] ? 'leader' : 'member', array(
+ $template->assign_block_vars('member', array(
'USERNAME' => $row['username'],
'U_USER_VIEW' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['user_id']),
'S_GROUP_DEFAULT' => ($row['group_id'] == $group_id) ? true : false,
@@ -734,10 +802,16 @@ class ucp_groups
trigger_error($user->lang['NO_GROUP'] . $return_page);
}
- if (!($row = group_memberships($group_id, $user->data['user_id'])) || !$row[0]['group_leader'])
+ if (!($row = group_memberships($group_id, $user->data['user_id'])))
{
trigger_error($user->lang['NOT_MEMBER_OF_GROUP'] . $return_page);
}
+ list(, $row) = each($row);
+
+ if (!$row['group_leader'])
+ {
+ trigger_error($user->lang['NOT_LEADER_OF_GROUP'] . $return_page);
+ }
$user->add_lang('acp/groups');
@@ -755,10 +829,16 @@ class ucp_groups
trigger_error($user->lang['NO_GROUP'] . $return_page);
}
- if (!($row = group_memberships($group_id, $user->data['user_id'])) || !$row[0]['group_leader'])
+ if (!($row = group_memberships($group_id, $user->data['user_id'])))
{
trigger_error($user->lang['NOT_MEMBER_OF_GROUP'] . $return_page);
}
+ list(, $row) = each($row);
+
+ if (!$row['group_leader'])
+ {
+ trigger_error($user->lang['NOT_LEADER_OF_GROUP'] . $return_page);
+ }
if (confirm_box(true))
{
@@ -823,10 +903,16 @@ class ucp_groups
$user->add_lang(array('acp/groups', 'acp/common'));
- if (!($row = group_memberships($group_id, $user->data['user_id'])) || !$row[0]['group_leader'])
+ if (!($row = group_memberships($group_id, $user->data['user_id'])))
{
trigger_error($user->lang['NOT_MEMBER_OF_GROUP'] . $return_page);
}
+ list(, $row) = each($row);
+
+ if (!$row['group_leader'])
+ {
+ trigger_error($user->lang['NOT_LEADER_OF_GROUP'] . $return_page);
+ }
if (confirm_box(true))
{
@@ -873,10 +959,16 @@ class ucp_groups
trigger_error($user->lang['NO_USERS'] . $return_page);
}
- if (!($row = group_memberships($group_id, $user->data['user_id'])) || !$row[0]['group_leader'])
+ if (!($row = group_memberships($group_id, $user->data['user_id'])))
{
trigger_error($user->lang['NOT_MEMBER_OF_GROUP'] . $return_page);
}
+ list(, $row) = each($row);
+
+ if (!$row['group_leader'])
+ {
+ trigger_error($user->lang['NOT_LEADER_OF_GROUP'] . $return_page);
+ }
$name_ary = array_unique(explode("\n", $name_ary));
$group_name = ($group_row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $group_row['group_name']] : $group_row['group_name'];
diff --git a/phpBB/includes/ucp/ucp_pm_compose.php b/phpBB/includes/ucp/ucp_pm_compose.php
index ce6087f424..c228e8daba 100644
--- a/phpBB/includes/ucp/ucp_pm_compose.php
+++ b/phpBB/includes/ucp/ucp_pm_compose.php
@@ -642,7 +642,7 @@ function compose_pm($id, $mode, $action)
$post_id = request_var('p', 0);
if ($config['allow_post_links'])
{
- $message_link = "[url=" . generate_board_url() . "/viewtopic.$phpEx?p={$post_id}#p{$post_id}]{$message_subject}[/url]\n\n";
+ $message_link = "[url=" . generate_board_url() . "/viewtopic.$phpEx?p={$post_id}#p{$post_id}]{$user->lang['SUBJECT']}: {$message_subject}[/url]\n\n";
}
else
{
diff --git a/phpBB/index.php b/phpBB/index.php
index 53b9d4754f..84faea917f 100644
--- a/phpBB/index.php
+++ b/phpBB/index.php
@@ -88,7 +88,7 @@ $template->assign_vars(array(
'TOTAL_POSTS' => sprintf($user->lang[$l_total_post_s], $total_posts),
'TOTAL_TOPICS' => sprintf($user->lang[$l_total_topic_s], $total_topics),
'TOTAL_USERS' => sprintf($user->lang[$l_total_user_s], $total_users),
- 'NEWEST_USER' => sprintf($user->lang['NEWEST_USER'], '', $newest_user, ' '),
+ 'NEWEST_USER' => sprintf($user->lang['NEWEST_USER'], '', $newest_user, ' '),
'LEGEND' => $legend,
'BIRTHDAY_LIST' => $birthday_list,
diff --git a/phpBB/language/en/acp/attachments.php b/phpBB/language/en/acp/attachments.php
index 121069a6f8..f43835c7b0 100644
--- a/phpBB/language/en/acp/attachments.php
+++ b/phpBB/language/en/acp/attachments.php
@@ -115,7 +115,7 @@ $lang = array_merge($lang, array(
'NO_EXT_GROUP_SPECIFIED' => 'No extension group specified.',
'NO_FILE_CAT' => 'None',
'NO_IMAGE' => 'No image',
- 'NO_THUMBNAIL_SUPPORT' => 'Thumbnail support has been disabled because there is no supported GD library available and the imagemagick executable could not be found.',
+ 'NO_THUMBNAIL_SUPPORT' => 'Thumbnail support has been disabled. For proper functionality either the GD extension need to be available or imagemagick being installed. Both were not found.',
'NO_UPLOAD_DIR' => 'The upload directory you specified does not exist.',
'NO_WRITE_UPLOAD' => 'The upload directory you specified cannot be written to. Please alter the permissions to allow the webserver to write to it.',
diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php
index 27e0e7afa3..054101147e 100644
--- a/phpBB/language/en/acp/common.php
+++ b/phpBB/language/en/acp/common.php
@@ -277,7 +277,7 @@ $lang = array_merge($lang, array(
// Logs
$lang = array_merge($lang, array(
'ACP_ADMIN_LOGS_EXPLAIN' => 'This lists all the actions carried out by board administrators. You can sort by username, date, IP or action. If you have appropriate permissions you can also clear individual operations or the log as a whole.',
- 'ACP_CRITICAL_LOGS_EXPLAIN' => 'This lists the actions carried out by the board itself. These log provides you with information you are able to use for solving specific problems, for example non-delivery of emails. You can sort by username, date, IP or action. If you have appropriate permissions you can also clear individual operations or the log as a whole.',
+ 'ACP_CRITICAL_LOGS_EXPLAIN' => 'This lists the actions carried out by the board itself. This log provides you with information you are able to use for solving specific problems, for example non-delivery of emails. You can sort by username, date, IP or action. If you have appropriate permissions you can also clear individual operations or the log as a whole.',
'ACP_MOD_LOGS_EXPLAIN' => 'This lists the actions carried out by board moderators, select a forum from the drop down list. You can sort by username, date, IP or action. If you have appropriate permissions you can also clear individual operations or the log as a whole.',
'ACP_USERS_LOGS_EXPLAIN' => 'This lists all actions carried out by users or on users.',
'ALL_ENTRIES' => 'All entries',
@@ -533,6 +533,7 @@ $lang = array_merge($lang, array(
'LOG_LANGUAGE_PACK_INSTALLED' => 'Installed language pack » %s',
'LOG_LANGUAGE_PACK_UPDATED' => 'Updated language pack details » %s',
'LOG_LANGUAGE_FILE_REPLACED' => 'Replaced language file » %s',
+ 'LOG_LANGUAGE_FILE_SUBMITTED' => 'Submitted language file and placed in store folder » %s',
'LOG_MASS_EMAIL' => 'Sent mass email » %s',
diff --git a/phpBB/language/en/acp/email.php b/phpBB/language/en/acp/email.php
index e57b2a8bea..14ee520b04 100644
--- a/phpBB/language/en/acp/email.php
+++ b/phpBB/language/en/acp/email.php
@@ -32,7 +32,7 @@ if (empty($lang) || !is_array($lang))
// Email settings
$lang = array_merge($lang, array(
- 'ACP_MASS_EMAIL_EXPLAIN' => 'Here you can email a message to either all of your users or all users of a specific group. To do this, an email will be sent out to the administrative email address supplied, with a blind carbon copy sent to all recipients. If you are emailing a large group of people please be patient after submitting and do not stop the page halfway through. It is normal for a mass emailing to take a long time, you will be notified when the script has completed',
+ 'ACP_MASS_EMAIL_EXPLAIN' => 'Here you can email a message to either all of your users or all users of a specific group having the option to receive mass emails enabled . To do this, an email will be sent out to the administrative email address supplied, with a blind carbon copy sent to all recipients. If you are emailing a large group of people please be patient after submitting and do not stop the page halfway through. It is normal for a mass emailing to take a long time, you will be notified when the script has completed',
'ALL_USERS' => 'All users',
'COMPOSE' => 'Compose',
diff --git a/phpBB/language/en/acp/groups.php b/phpBB/language/en/acp/groups.php
index dbe22e2154..f69ac02168 100644
--- a/phpBB/language/en/acp/groups.php
+++ b/phpBB/language/en/acp/groups.php
@@ -60,7 +60,7 @@ $lang = array_merge($lang, array(
'GROUP_EDIT_EXPLAIN' => 'Here you can edit an existing group. You can change its name, description and type (open, closed, etc.). You can also set certain groupwide options such as colouration, rank, etc. Changes made here override users current settings. Please note that group members can alter their avatar unless you set appropriate user permissions.',
'GROUP_ERR_USERS_EXIST' => 'The specified users are already members of this group',
'GROUP_FOUNDER_MANAGE' => 'Founder manage only',
- 'GROUP_FOUNDER_MANAGE_EXPLAIN' => 'Restrict group management for this group for founders only for the administration control panel.',
+ 'GROUP_FOUNDER_MANAGE_EXPLAIN' => 'Restrict group management for this group for founders only. Users having group permissions are still able to see this group as well as this groups members.',
'GROUP_HIDDEN' => 'Hidden',
'GROUP_LANG' => 'Group language',
'GROUP_LEAD' => 'Group leaders',
diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php
index d4fd7bd4af..853df84f85 100644
--- a/phpBB/language/en/common.php
+++ b/phpBB/language/en/common.php
@@ -208,10 +208,9 @@ $lang = array_merge($lang, array(
'GOTO_PAGE' => 'Go to page',
'GROUP' => 'Group',
'GROUPS' => 'Groups',
- 'GROUP_ERR_DESC_LONG' => 'Group description is too long.',
'GROUP_ERR_TYPE' => 'Inappropriate group type specified.',
'GROUP_ERR_USERNAME' => 'No group name specified.',
- 'GROUP_ERR_USER_LONG' => 'Group name is too long.',
+ 'GROUP_ERR_USER_LONG' => 'Group name is too long. A maximum of 60 characters are allowed.',
'GUEST' => 'Guest',
'GUEST_USERS_ONLINE' => 'There are %d guest users online',
'GUEST_USERS_TOTAL' => '%d guests',
@@ -316,7 +315,7 @@ $lang = array_merge($lang, array(
'NEXT' => 'Next',
'NEVER' => 'Never',
'NO' => 'No',
- 'NOT_ALLOWED_MANAGE_GROUP' => 'You are not allowed to manage this group from the “Administration Control Panel”.',
+ 'NOT_ALLOWED_MANAGE_GROUP' => 'You are not allowed to manage this group.',
'NOT_AUTHORIZED' => 'You are not authorised to access this area.',
'NOT_WATCHING_FORUM' => 'You are no longer subscribed to updates on this forum.',
'NOT_WATCHING_TOPIC' => 'You are no longer subscribed to this topic.',
diff --git a/phpBB/language/en/groups.php b/phpBB/language/en/groups.php
index 8e44d32a0d..bd11356684 100644
--- a/phpBB/language/en/groups.php
+++ b/phpBB/language/en/groups.php
@@ -72,7 +72,7 @@ $lang = array_merge($lang, array(
'NO_LEADERS' => 'You are not a leader of any group',
'NOT_LEADER_OF_GROUP' => 'The requested operation cannot be taken because you are not a leader of the selected group.',
- 'NOT_MEMBER_OF_GROUP' => 'The requested operation cannot be taken because you are not a member of the selected group.',
+ 'NOT_MEMBER_OF_GROUP' => 'The requested operation cannot be taken because you are not a member of the selected group or your membership has not been approved yet.',
'NOT_RESIGN_FROM_DEFAULT_GROUP' => 'You are not allowed to resign from your default group.',
'PRIMARY_GROUP' => 'Primary group',
diff --git a/phpBB/language/en/mcp.php b/phpBB/language/en/mcp.php
index 837ae6f9b1..7c5df74d5f 100644
--- a/phpBB/language/en/mcp.php
+++ b/phpBB/language/en/mcp.php
@@ -189,6 +189,8 @@ $lang = array_merge($lang, array(
'MERGE_TOPIC_EXPLAIN' => 'Using the form below you can merge selected posts into another topic. These posts will not be reordered and will appear as if the users posted them to the new topic. Please enter the destination topic id or click on the "Select" button to search for one',
'MERGE_TOPIC_ID' => 'Destination topic identification number',
'MODERATE_FORUM' => 'Moderate forum',
+ 'MODERATE_TOPIC' => 'Moderate topic',
+ 'MODERATE_POST' => 'Moderate post',
'MOD_OPTIONS' => 'Moderator options',
'MORE_INFO' => 'Further information',
'MOST_WARNINGS' => 'Users with most warnings',
diff --git a/phpBB/language/en/posting.php b/phpBB/language/en/posting.php
index 2b486f8b8c..d5e8450699 100644
--- a/phpBB/language/en/posting.php
+++ b/phpBB/language/en/posting.php
@@ -121,7 +121,7 @@ $lang = array_merge($lang, array(
'MESSAGE_DELETED' => 'This message has been deleted successfully',
'MORE_SMILIES' => 'View more smilies',
- 'NOTIFY_REPLY' => 'Send me an email when a reply is posted',
+ 'NOTIFY_REPLY' => 'Notify me when a reply is posted',
'NOT_UPLOADED' => 'File could not be uploaded.',
'NO_DELETE_POLL_OPTIONS' => 'You cannot delete existing poll options',
'NO_PM_ICON' => 'No PM icon',
diff --git a/phpBB/mcp.php b/phpBB/mcp.php
index 9a22289495..d382cdd50e 100644
--- a/phpBB/mcp.php
+++ b/phpBB/mcp.php
@@ -220,6 +220,14 @@ $module->load_active();
// Assign data to the template engine for the list of modules
$module->assign_tpl_vars(append_sid("{$phpbb_root_path}mcp.$phpEx"));
+// Generate urls for letting the moderation control panel being accessed in different modes
+$template->assign_vars(array(
+ 'U_MCP' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main'),
+ 'U_MCP_FORUM' => ($forum_id) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=main&f=$forum_id") : '',
+ 'U_MCP_TOPIC' => ($forum_id && $topic_id) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=main&t=$topic_id") : '',
+ 'U_MCP_POST' => ($forum_id && $topic_id && $post_id) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=main&t=$topic_id&p=$post_id") : '',
+));
+
// Generate the page, do not display/query online list
$module->display($module->get_page_title(), false);
@@ -246,6 +254,11 @@ function _module_ban_url($mode, &$module_row)
return extra_url();
}
+function _module_queue_url($mode, &$module_row)
+{
+ return extra_url();
+}
+
function extra_url()
{
global $forum_id, $topic_id, $post_id, $user_id;
diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php
index 3d8c2bf767..425a710e65 100644
--- a/phpBB/memberlist.php
+++ b/phpBB/memberlist.php
@@ -355,18 +355,9 @@ switch ($mode)
}
// Get user...
- if ($username)
- {
- $sql = 'SELECT *
- FROM ' . USERS_TABLE . "
- WHERE username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'";
- }
- else
- {
- $sql = 'SELECT *
- FROM ' . USERS_TABLE . "
- WHERE user_id = $user_id";
- }
+ $sql = 'SELECT *
+ FROM ' . USERS_TABLE . '
+ WHERE ' . (($username) ? "username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'" : "user_id = $user_id");
// a_user admins and founder are able to view inactive users and bots to be able to
// manage them more easily
@@ -390,8 +381,9 @@ switch ($mode)
$sql = 'SELECT g.group_id, g.group_name, g.group_type
FROM ' . GROUPS_TABLE . ' g, ' . USER_GROUP_TABLE . " ug
WHERE ug.user_id = $user_id
- AND g.group_id = ug.group_id" . ((!$auth->acl_get('a_group')) ? ' AND group_type <> ' . GROUP_HIDDEN : '') . '
- ORDER BY group_type, group_name';
+ AND g.group_id = ug.group_id" . ((!$auth->acl_get('a_group')) ? ' AND g.group_type <> ' . GROUP_HIDDEN : '') . '
+ AND ug.user_pending = 0
+ ORDER BY g.group_type, g.group_name';
$result = $db->sql_query($sql);
$group_options = '';
diff --git a/phpBB/styles/subSilver/template/mcp_header.html b/phpBB/styles/subSilver/template/mcp_header.html
index 817aeff3a1..043be1d089 100644
--- a/phpBB/styles/subSilver/template/mcp_header.html
+++ b/phpBB/styles/subSilver/template/mcp_header.html
@@ -1,19 +1,20 @@
-
-
-
-
+
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php
index 15058f1295..1c05af3d11 100644
--- a/phpBB/viewtopic.php
+++ b/phpBB/viewtopic.php
@@ -1331,8 +1331,8 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i)
if ($topic_data['topic_bumped'] && $row['post_id'] == $topic_data['topic_last_post_id'] && isset($user_cache[$topic_data['topic_bumper']]) )
{
// It is safe to grab the username from the user cache array, we are at the last
- // post and only the topic poster and last poster are allowed to bump. However, a
- // check is still needed incase an admin bumped the topic (but didn't post in the topic)
+ // post and only the topic poster and last poster are allowed to bump.
+ // Admins and mods are bound to the above rules too...
$l_bumped_by = '
' . sprintf($user->lang['BUMPED_BY'], $user_cache[$topic_data['topic_bumper']]['username'], $user->format_date($topic_data['topic_last_post_time']));
}
else
@@ -1382,9 +1382,9 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i)
'BUMPED_MESSAGE' => $l_bumped_by,
'MINI_POST_IMG' => ($post_unread) ? $user->img('icon_post_target_unread', 'NEW_POST') : $user->img('icon_post_target', 'POST'),
- 'POST_ICON_IMG' => (!empty($row['icon_id'])) ? $icons[$row['icon_id']]['img'] : '',
- 'POST_ICON_IMG_WIDTH' => (!empty($row['icon_id'])) ? $icons[$row['icon_id']]['width'] : '',
- 'POST_ICON_IMG_HEIGHT' => (!empty($row['icon_id'])) ? $icons[$row['icon_id']]['height'] : '',
+ 'POST_ICON_IMG' => ($topic_data['enable_icons'] && !empty($row['icon_id'])) ? $icons[$row['icon_id']]['img'] : '',
+ 'POST_ICON_IMG_WIDTH' => ($topic_data['enable_icons'] && !empty($row['icon_id'])) ? $icons[$row['icon_id']]['width'] : '',
+ 'POST_ICON_IMG_HEIGHT' => ($topic_data['enable_icons'] && !empty($row['icon_id'])) ? $icons[$row['icon_id']]['height'] : '',
'ICQ_STATUS_IMG' => $user_cache[$poster_id]['icq_status_img'],
'ONLINE_IMG' => ($poster_id == ANONYMOUS || !$config['load_onlinetrack']) ? '' : (($user_cache[$poster_id]['online']) ? $user->img('icon_user_online', 'ONLINE') : $user->img('icon_user_offline', 'OFFLINE')),
'S_ONLINE' => ($poster_id == ANONYMOUS || !$config['load_onlinetrack']) ? false : (($user_cache[$poster_id]['online']) ? true : false),
From 0350eb9f3ca0f7f239ae868afef4e7765a22833b Mon Sep 17 00:00:00 2001
From: David M
Date: Sun, 18 Feb 2007 21:03:36 +0000
Subject: [PATCH 058/707] - PHP4's mbstring is stupid stupid stupid
git-svn-id: file:///svn/phpbb/trunk@7008 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/includes/utf/utf_tools.php | 24 ++++++++++++++++++++----
1 file changed, 20 insertions(+), 4 deletions(-)
diff --git a/phpBB/includes/utf/utf_tools.php b/phpBB/includes/utf/utf_tools.php
index 9ab31e60e4..4c5b4a8983 100644
--- a/phpBB/includes/utf/utf_tools.php
+++ b/phpBB/includes/utf/utf_tools.php
@@ -728,11 +728,27 @@ function utf8_recode($string, $encoding)
// Try the mb_string extension
if (function_exists('mb_convert_encoding'))
{
- $ret = @mb_convert_encoding($string, 'utf-8', $encoding);
-
- if (!empty($ret))
+ // mbstring is nasty on PHP4, we must make *sure* that we send a good encoding
+ switch ($encoding)
{
- return $ret;
+ case 'iso-8859-1':
+ case 'iso-8859-2':
+ case 'iso-8859-4':
+ case 'iso-8859-7':
+ case 'iso-8859-9':
+ case 'iso-8859-15':
+ case 'windows-1251':
+ case 'windows-1252':
+ case 'shift_jis':
+ case 'euc-kr':
+ case 'big5':
+ case 'gb2312':
+ $ret = @mb_convert_encoding($string, 'utf-8', $encoding);
+
+ if (!empty($ret))
+ {
+ return $ret;
+ }
}
}
From 1d6fd8e1352d9ed4bfe3f91e9f2bf254920eb479 Mon Sep 17 00:00:00 2001
From: David M
Date: Mon, 19 Feb 2007 04:12:13 +0000
Subject: [PATCH 059/707] - clean up mssql and mssql_odbc, mssql now uses a
different method of dealing with IDENTITY - clean up firebird, I will
consider changing it to use fetch array instead of fetch object. it's
identity code already uses this method as of right... now :D - fix a tiny bug
in MySQL's driver (remember to pass the connect id to all DBAL functions) -
add new_link as a new param for sql_connect. This allows you to make
connections that are not dependant on each other. This is done for our
friends mysql, mssql, postgresql and oracle. Now for everybody else.. (I said
this was clever ;) MySQLi and SQLite should always spawn a new connection
when you call it while mssql_odbc and firebird both will create new links if
you give them different params (different creds) than the previous
connection(s). Thus we can always promise new links :D - fixed a bug in the
converter - cleaned up the dbal a little
git-svn-id: file:///svn/phpbb/trunk@7009 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/common.php | 2 +-
phpBB/includes/db/dbal.php | 7 ++-----
phpBB/includes/db/firebird.php | 10 +++++-----
phpBB/includes/db/mssql.php | 14 +++++++-------
phpBB/includes/db/mssql_odbc.php | 8 ++++----
phpBB/includes/db/mysql.php | 6 +++---
phpBB/includes/db/mysqli.php | 2 +-
phpBB/includes/db/oracle.php | 4 ++--
phpBB/includes/db/postgres.php | 4 ++--
phpBB/includes/db/sqlite.php | 2 +-
phpBB/includes/functions_install.php | 2 +-
phpBB/install/install_convert.php | 14 +++++++-------
12 files changed, 36 insertions(+), 39 deletions(-)
diff --git a/phpBB/common.php b/phpBB/common.php
index 2d1d67c3fc..3ee931e95d 100644
--- a/phpBB/common.php
+++ b/phpBB/common.php
@@ -191,7 +191,7 @@ $cache = new cache();
$db = new $sql_db();
// Connect to DB
-$db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false);
+$db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, false);
// We do not need this any longer, unset for safety purposes
unset($dbpasswd);
diff --git a/phpBB/includes/db/dbal.php b/phpBB/includes/db/dbal.php
index da649ed812..77b5b46ffc 100644
--- a/phpBB/includes/db/dbal.php
+++ b/phpBB/includes/db/dbal.php
@@ -103,12 +103,9 @@ class dbal
$this->sql_transaction('commit');
}
- if (sizeof($this->open_queries))
+ foreach ($this->open_queries as $query_id)
{
- foreach ($this->open_queries as $i_query_id => $query_id)
- {
- $this->sql_freeresult($query_id);
- }
+ $this->sql_freeresult($query_id);
}
return $this->_sql_close();
diff --git a/phpBB/includes/db/firebird.php b/phpBB/includes/db/firebird.php
index 5ce4949956..317054d978 100644
--- a/phpBB/includes/db/firebird.php
+++ b/phpBB/includes/db/firebird.php
@@ -31,7 +31,7 @@ class dbal_firebird extends dbal
/**
* Connect to server
*/
- function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false)
+ function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false)
{
$this->persistency = $persistency;
$this->user = $sqluser;
@@ -273,19 +273,19 @@ class dbal_firebird extends dbal
if ($query_id !== false && $this->last_query_text != '')
{
- if ($this->query_result && preg_match('#^INSERT[\t\n ]+INTO[\t\n ]+([a-z0-9\_\-]+)#is', $this->last_query_text, $tablename))
+ if ($this->query_result && preg_match('#^INSERT[\t\n ]+INTO[\t\n ]+([a-z0-9\_\-]+)#i', $this->last_query_text, $tablename))
{
- $sql = "SELECT GEN_ID(" . $tablename[1] . "_gen, 0) AS new_id FROM RDB\$DATABASE";
+ $sql = 'SELECT GEN_ID(' . $tablename[1] . '_gen, 0) AS new_id FROM RDB$DATABASE';
if (!($temp_q_id = @ibase_query($this->db_connect_id, $sql)))
{
return false;
}
- $temp_result = @ibase_fetch_object($temp_q_id);
+ $temp_result = @ibase_fetch_assoc($temp_q_id);
@ibase_free_result($temp_q_id);
- return ($temp_result) ? $temp_result->NEW_ID : false;
+ return ($temp_result) ? $temp_result['NEW_ID'] : false;
}
}
diff --git a/phpBB/includes/db/mssql.php b/phpBB/includes/db/mssql.php
index 6429d4be41..0af6514322 100644
--- a/phpBB/includes/db/mssql.php
+++ b/phpBB/includes/db/mssql.php
@@ -28,7 +28,7 @@ class dbal_mssql extends dbal
/**
* Connect to server
*/
- function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false)
+ function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false)
{
$this->persistency = $persistency;
$this->user = $sqluser;
@@ -37,7 +37,7 @@ class dbal_mssql extends dbal
@ini_set('mssql.charset', 'UTF-8');
- $this->db_connect_id = ($this->persistency) ? @mssql_pconnect($this->server, $this->user, $sqlpassword) : @mssql_connect($this->server, $this->user, $sqlpassword);
+ $this->db_connect_id = ($this->persistency) ? @mssql_pconnect($this->server, $this->user, $sqlpassword, $new_link) : @mssql_connect($this->server, $this->user, $sqlpassword, $new_link);
if ($this->db_connect_id && $this->dbname != '')
{
@@ -86,11 +86,11 @@ class dbal_mssql extends dbal
break;
case 'commit':
- return @mssql_query('commit', $this->db_connect_id);
+ return @mssql_query('COMMIT TRANSACTION', $this->db_connect_id);
break;
case 'rollback':
- return @mssql_query('ROLLBACK', $this->db_connect_id);
+ return @mssql_query('ROLLBACK TRANSACTION', $this->db_connect_id);
break;
}
@@ -258,7 +258,7 @@ class dbal_mssql extends dbal
*/
function sql_nextid()
{
- $result_id = @mssql_query('SELECT @@IDENTITY', $this->db_connect_id);
+ $result_id = @mssql_query('SELECT SCOPE_IDENTITY()', $this->db_connect_id);
if ($result_id)
{
if ($row = @mssql_fetch_assoc($result_id))
@@ -385,7 +385,7 @@ class dbal_mssql extends dbal
if (preg_match('/^SELECT/', $explain_query))
{
$html_table = false;
- @mssql_query("SET SHOWPLAN_TEXT ON;", $this->db_connect_id);
+ @mssql_query('SET SHOWPLAN_TEXT ON;', $this->db_connect_id);
if ($result = @mssql_query($explain_query, $this->db_connect_id))
{
@mssql_next_result($result);
@@ -394,7 +394,7 @@ class dbal_mssql extends dbal
$html_table = $this->sql_report('add_select_row', $query, $html_table, $row);
}
}
- @mssql_query("SET SHOWPLAN_TEXT OFF;", $this->db_connect_id);
+ @mssql_query('SET SHOWPLAN_TEXT OFF;', $this->db_connect_id);
@mssql_free_result($result);
if ($html_table)
diff --git a/phpBB/includes/db/mssql_odbc.php b/phpBB/includes/db/mssql_odbc.php
index 0b8f1e2a95..ab3bd2a164 100644
--- a/phpBB/includes/db/mssql_odbc.php
+++ b/phpBB/includes/db/mssql_odbc.php
@@ -31,7 +31,7 @@ class dbal_mssql_odbc extends dbal
/**
* Connect to server
*/
- function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false)
+ function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false)
{
$this->persistency = $persistency;
$this->user = $sqluser;
@@ -267,7 +267,7 @@ class dbal_mssql_odbc extends dbal
{
if (@odbc_fetch_array($result_id))
{
- $id = @odbc_result($result_id, 1);
+ $id = @odbc_result($result_id, 1);
@odbc_free_result($result_id);
return $id;
}
@@ -363,7 +363,7 @@ class dbal_mssql_odbc extends dbal
if (preg_match('/^SELECT/', $explain_query))
{
$html_table = false;
- @odbc_exec($this->db_connect_id, "SET SHOWPLAN_TEXT ON;");
+ @odbc_exec($this->db_connect_id, 'SET SHOWPLAN_TEXT ON;');
if ($result = @odbc_exec($this->db_connect_id, $explain_query))
{
@odbc_next_result($result);
@@ -372,7 +372,7 @@ class dbal_mssql_odbc extends dbal
$html_table = $this->sql_report('add_select_row', $query, $html_table, $row);
}
}
- @odbc_exec($this->db_connect_id, "SET SHOWPLAN_TEXT OFF;");
+ @odbc_exec($this->db_connect_id, 'SET SHOWPLAN_TEXT OFF;');
@odbc_free_result($result);
if ($html_table)
diff --git a/phpBB/includes/db/mysql.php b/phpBB/includes/db/mysql.php
index b750618ae6..2eb3a561bc 100644
--- a/phpBB/includes/db/mysql.php
+++ b/phpBB/includes/db/mysql.php
@@ -35,7 +35,7 @@ class dbal_mysql extends dbal
* Connect to server
* @access public
*/
- function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false)
+ function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false)
{
$this->persistency = $persistency;
$this->user = $sqluser;
@@ -44,11 +44,11 @@ class dbal_mysql extends dbal
$this->sql_layer = 'mysql4';
- $this->db_connect_id = ($this->persistency) ? @mysql_pconnect($this->server, $this->user, $sqlpassword) : @mysql_connect($this->server, $this->user, $sqlpassword);
+ $this->db_connect_id = ($this->persistency) ? @mysql_pconnect($this->server, $this->user, $sqlpassword, $new_link) : @mysql_connect($this->server, $this->user, $sqlpassword, $new_link);
if ($this->db_connect_id && $this->dbname != '')
{
- if (@mysql_select_db($this->dbname))
+ if (@mysql_select_db($this->dbname, $this->db_connect_id))
{
// Determine what version we are using and if it natively supports UNICODE
$this->mysql_version = mysql_get_server_info($this->db_connect_id);
diff --git a/phpBB/includes/db/mysqli.php b/phpBB/includes/db/mysqli.php
index da6faa3983..3149349411 100644
--- a/phpBB/includes/db/mysqli.php
+++ b/phpBB/includes/db/mysqli.php
@@ -29,7 +29,7 @@ class dbal_mysqli extends dbal
/**
* Connect to server
*/
- function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false)
+ function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false , $new_link = false)
{
$this->persistency = $persistency;
$this->user = $sqluser;
diff --git a/phpBB/includes/db/oracle.php b/phpBB/includes/db/oracle.php
index 4195bcfe52..1920ce8fc1 100644
--- a/phpBB/includes/db/oracle.php
+++ b/phpBB/includes/db/oracle.php
@@ -29,14 +29,14 @@ class dbal_oracle extends dbal
/**
* Connect to server
*/
- function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false)
+ function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false)
{
$this->persistency = $persistency;
$this->user = $sqluser;
$this->server = $sqlserver . (($port) ? ':' . $port : '');
$this->dbname = $database;
- $this->db_connect_id = ($this->persistency) ? @ociplogon($this->user, $sqlpassword, $this->server, 'UTF8') : @ocinlogon($this->user, $sqlpassword, $this->server, 'UTF8');
+ $this->db_connect_id = ($new_link) ? @ocinlogon($this->user, $sqlpassword, $this->server, 'UTF8') : (($this->persistency) ? @ociplogon($this->user, $sqlpassword, $this->server, 'UTF8') : @ocinlogon($this->user, $sqlpassword, $this->server, 'UTF8'));
return ($this->db_connect_id) ? $this->db_connect_id : $this->sql_error('');
}
diff --git a/phpBB/includes/db/postgres.php b/phpBB/includes/db/postgres.php
index f2e96260ba..3f0c97ce00 100644
--- a/phpBB/includes/db/postgres.php
+++ b/phpBB/includes/db/postgres.php
@@ -30,7 +30,7 @@ class dbal_postgres extends dbal
/**
* Connect to server
*/
- function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false)
+ function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false)
{
$connect_string = '';
@@ -70,7 +70,7 @@ class dbal_postgres extends dbal
$this->persistency = $persistency;
- $this->db_connect_id = ($this->persistency) ? @pg_pconnect($connect_string) : @pg_connect($connect_string);
+ $this->db_connect_id = ($this->persistency) ? @pg_pconnect($connect_string, $new_link) : @pg_connect($connect_string, $new_link);
return ($this->db_connect_id) ? $this->db_connect_id : $this->sql_error('');
}
diff --git a/phpBB/includes/db/sqlite.php b/phpBB/includes/db/sqlite.php
index 9f44bd6b35..8a50c546a7 100644
--- a/phpBB/includes/db/sqlite.php
+++ b/phpBB/includes/db/sqlite.php
@@ -28,7 +28,7 @@ class dbal_sqlite extends dbal
/**
* Connect to server
*/
- function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false)
+ function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false)
{
$this->persistency = $persistency;
$this->user = $sqluser;
diff --git a/phpBB/includes/functions_install.php b/phpBB/includes/functions_install.php
index 30d14c985b..0906e5e1b1 100644
--- a/phpBB/includes/functions_install.php
+++ b/phpBB/includes/functions_install.php
@@ -257,7 +257,7 @@ function connect_check_db($error_connect, &$error, $dbms, $table_prefix, $dbhost
}
// Try and connect ...
- if (is_array($db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false)))
+ if (is_array($db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, true)))
{
$db_error = $db->sql_error();
$error[] = $lang['INST_ERR_DB_CONNECT'] . ' ' . (($db_error['message']) ? $db_error['message'] : $lang['INST_ERR_DB_NO_ERROR']);
diff --git a/phpBB/install/install_convert.php b/phpBB/install/install_convert.php
index 9b7e621397..ffbb4e4ef7 100644
--- a/phpBB/install/install_convert.php
+++ b/phpBB/install/install_convert.php
@@ -126,7 +126,7 @@ class install_convert extends module
require($phpbb_root_path . 'includes/functions_convert.' . $phpEx);
$db = new $sql_db();
- $db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false);
+ $db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, true);
unset($dbpasswd);
// We need to fill the config to let internal functions correctly work
@@ -222,7 +222,7 @@ class install_convert extends module
require($phpbb_root_path . 'includes/functions_convert.' . $phpEx);
$db = new $sql_db();
- $db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false);
+ $db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, true);
unset($dbpasswd);
switch ($db->sql_layer)
@@ -331,7 +331,7 @@ class install_convert extends module
require($phpbb_root_path . 'includes/functions_convert.' . $phpEx);
$db = new $sql_db();
- $db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false);
+ $db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, true);
unset($dbpasswd);
$this->page_title = $lang['STAGE_SETTINGS'];
@@ -427,7 +427,7 @@ class install_convert extends module
{
$sql_db = 'dbal_' . $src_dbms;
$src_db = new $sql_db();
- $src_db->sql_connect($src_dbhost, $src_dbuser, $src_dbpasswd, $src_dbname, $src_dbport, false);
+ $src_db->sql_connect($src_dbhost, $src_dbuser, $src_dbpasswd, $src_dbname, $src_dbport, false, true);
$same_db = false;
}
else
@@ -466,7 +466,7 @@ class install_convert extends module
compare_table($tables, $tablename, $prefixes);
}
}
- $src_->sql_freeresult($result);
+ $src_db->sql_freeresult($result);
}
foreach ($prefixes as $prefix => $count)
@@ -591,7 +591,7 @@ class install_convert extends module
require($phpbb_root_path . 'includes/functions_convert.' . $phpEx);
$db = new $sql_db();
- $db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false);
+ $db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, true);
unset($dbpasswd);
$sql = 'SELECT *
@@ -663,7 +663,7 @@ class install_convert extends module
}
$sql_db = 'dbal_' . $convert->src_dbms;
$src_db = new $sql_db();
- $src_db->sql_connect($convert->src_dbhost, $convert->src_dbuser, $convert->src_dbpasswd, $convert->src_dbname, $convert->src_dbport, false);
+ $src_db->sql_connect($convert->src_dbhost, $convert->src_dbuser, $convert->src_dbpasswd, $convert->src_dbname, $convert->src_dbport, false, true);
$same_db = false;
}
else
From 28871e1f7b3ba4d9e26b34b065a9e198a5202044 Mon Sep 17 00:00:00 2001
From: David M
Date: Mon, 19 Feb 2007 04:15:35 +0000
Subject: [PATCH 060/707] - forgot a few places :P
git-svn-id: file:///svn/phpbb/trunk@7010 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/install/database_update.php | 2 +-
phpBB/install/install_install.php | 4 ++--
phpBB/install/install_update.php | 2 +-
phpBB/style.php | 2 +-
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php
index 2d19b46245..201629e7b1 100644
--- a/phpBB/install/database_update.php
+++ b/phpBB/install/database_update.php
@@ -65,7 +65,7 @@ $cache = new cache();
$db = new $sql_db();
// Connect to DB
-$db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false);
+$db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, false);
// We do not need this any longer, unset for safety purposes
unset($dbpasswd);
diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php
index ca91cf6396..faa6844a6e 100755
--- a/phpBB/install/install_install.php
+++ b/phpBB/install/install_install.php
@@ -1092,7 +1092,7 @@ class install_install extends module
// Instantiate the database
$sql_db = 'dbal_' . $available_dbms[$dbms]['DRIVER'];
$db = new $sql_db();
- $db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false);
+ $db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, false);
// NOTE: trigger_error does not work here.
$db->return_on_error = true;
@@ -1373,7 +1373,7 @@ class install_install extends module
// Instantiate the database
$sql_db = 'dbal_' . $available_dbms[$dbms]['DRIVER'];
$db = new $sql_db();
- $db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false);
+ $db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, false);
// NOTE: trigger_error does not work here.
$db->return_on_error = true;
diff --git a/phpBB/install/install_update.php b/phpBB/install/install_update.php
index 3e24cc71ed..a2e2084f28 100644
--- a/phpBB/install/install_update.php
+++ b/phpBB/install/install_update.php
@@ -91,7 +91,7 @@ class install_update extends module
$db = new $sql_db();
// Connect to DB
- $db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false);
+ $db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, false);
// We do not need this any longer, unset for safety purposes
unset($dbpasswd);
diff --git a/phpBB/style.php b/phpBB/style.php
index a9803aa4e5..e238fe63a0 100644
--- a/phpBB/style.php
+++ b/phpBB/style.php
@@ -60,7 +60,7 @@ if ($id && $sid)
$cache = new cache();
// Connect to DB
- if (!@$db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false))
+ if (!@$db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, false))
{
exit;
}
From ec541d417b56c3f21e9fe6097ed6af568781b023 Mon Sep 17 00:00:00 2001
From: David M
Date: Mon, 19 Feb 2007 04:23:50 +0000
Subject: [PATCH 061/707] #8186
git-svn-id: file:///svn/phpbb/trunk@7011 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/includes/functions_admin.php | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php
index 53f6fb926a..fa45c0027f 100644
--- a/phpBB/includes/functions_admin.php
+++ b/phpBB/includes/functions_admin.php
@@ -2516,7 +2516,7 @@ function get_database_size()
case 'mysql':
case 'mysql4':
case 'mysqli':
-
+
$sql = 'SELECT VERSION() AS mysql_version';
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
@@ -2560,6 +2560,16 @@ function get_database_size()
case 'mssql':
case 'mssql_odbc':
+ global $dbhost;
+
+ if (file_exists($dbhost))
+ {
+ $database_size = filesize($dbhost);
+ }
+
+ break;
+
+ case 'sqlite':
$sql = 'SELECT ((SUM(size) * 8.0) * 1024.0) as dbsize
FROM sysfiles';
From 2fccd105d15b51d0a492818ce1160c24e1b46666 Mon Sep 17 00:00:00 2001
From: David M
Date: Mon, 19 Feb 2007 04:34:42 +0000
Subject: [PATCH 062/707] eh? meh.
git-svn-id: file:///svn/phpbb/trunk@7012 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/includes/functions_admin.php | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php
index fa45c0027f..1731d6a3e1 100644
--- a/phpBB/includes/functions_admin.php
+++ b/phpBB/includes/functions_admin.php
@@ -2558,8 +2558,7 @@ function get_database_size()
break;
- case 'mssql':
- case 'mssql_odbc':
+ case 'sqlite':
global $dbhost;
if (file_exists($dbhost))
From bd20743c4c40339bc84b502a1b44981278a26550 Mon Sep 17 00:00:00 2001
From: David M
Date: Mon, 19 Feb 2007 04:36:32 +0000
Subject: [PATCH 063/707] now that was kinda dumb...
git-svn-id: file:///svn/phpbb/trunk@7013 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/includes/functions_admin.php | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php
index 1731d6a3e1..357555b170 100644
--- a/phpBB/includes/functions_admin.php
+++ b/phpBB/includes/functions_admin.php
@@ -2516,7 +2516,6 @@ function get_database_size()
case 'mysql':
case 'mysql4':
case 'mysqli':
-
$sql = 'SELECT VERSION() AS mysql_version';
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
@@ -2555,7 +2554,6 @@ function get_database_size()
$db->sql_freeresult($result);
}
}
-
break;
case 'sqlite':
@@ -2568,18 +2566,16 @@ function get_database_size()
break;
- case 'sqlite':
-
+ case 'mssql':
+ case 'mssql_odbc':
$sql = 'SELECT ((SUM(size) * 8.0) * 1024.0) as dbsize
FROM sysfiles';
$result = $db->sql_query($sql);
$database_size = ($row = $db->sql_fetchrow($result)) ? $row['dbsize'] : false;
$db->sql_freeresult($result);
-
break;
case 'postgres':
-
$sql = "SELECT proname
FROM pg_proc
WHERE proname = 'pg_database_size'";
@@ -2605,7 +2601,6 @@ function get_database_size()
$database_size = $row['size'];
}
-
break;
}
From bf8bea4967c50ba61c6bd897d3611fccdac24bee Mon Sep 17 00:00:00 2001
From: David M
Date: Mon, 19 Feb 2007 16:40:49 +0000
Subject: [PATCH 064/707] PHP4 lives!
git-svn-id: file:///svn/phpbb/trunk@7014 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/install/install_convert.php | 18 ++----------------
1 file changed, 2 insertions(+), 16 deletions(-)
diff --git a/phpBB/install/install_convert.php b/phpBB/install/install_convert.php
index ffbb4e4ef7..0986ef42f9 100644
--- a/phpBB/install/install_convert.php
+++ b/phpBB/install/install_convert.php
@@ -432,14 +432,7 @@ class install_convert extends module
}
else
{
- if (version_compare(PHP_VERSION, '5.0.0-dev', '<'))
- {
- $src_db = &$db;
- }
- else
- {
- $src_db = $db;
- }
+ $src_db = $db;
$same_db = true;
}
@@ -668,14 +661,7 @@ class install_convert extends module
}
else
{
- if (version_compare(PHP_VERSION, '5.0.0-dev', '<'))
- {
- $src_db = &$db;
- }
- else
- {
- $src_db = $db;
- }
+ $src_db = $db;
$same_db = true;
}
From 59fdd2edca9455126c6ce606ba2819aa6450dfda Mon Sep 17 00:00:00 2001
From: David M
Date: Mon, 19 Feb 2007 19:35:52 +0000
Subject: [PATCH 065/707] #8234 - some stupid bugs in restore - centralized the
method of getting tables
git-svn-id: file:///svn/phpbb/trunk@7015 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/includes/functions_convert.php | 2 +-
phpBB/includes/functions_install.php | 131 ++++++++++++++-------------
phpBB/install/install_convert.php | 19 +---
phpBB/language/en/acp/database.php | 1 +
4 files changed, 77 insertions(+), 76 deletions(-)
diff --git a/phpBB/includes/functions_convert.php b/phpBB/includes/functions_convert.php
index e8c57a4db6..914311c2b8 100644
--- a/phpBB/includes/functions_convert.php
+++ b/phpBB/includes/functions_convert.php
@@ -1374,7 +1374,7 @@ function get_path($src_path, $src_url, $test_file)
function compare_table($tables, $tablename, &$prefixes)
{
- for ($i = 0; $i < sizeof($tables); ++$i)
+ for ($i = 0, $table_size = sizeof($tables); $i < $table_size; ++$i)
{
if (preg_match('/(.*)' . $tables[$i] . '$/', $tablename, $m))
{
diff --git a/phpBB/includes/functions_install.php b/phpBB/includes/functions_install.php
index 0906e5e1b1..29eb0d3dc6 100644
--- a/phpBB/includes/functions_install.php
+++ b/phpBB/includes/functions_install.php
@@ -182,6 +182,69 @@ function dbms_select($default = '', $only_20x_options = false)
return $dbms_options;
}
+/**
+* Get tables of a database
+*/
+function get_tables($db)
+{
+ switch ($db->sql_layer)
+ {
+ case 'mysql':
+ case 'mysql4':
+ case 'mysqli':
+ $sql = 'SHOW TABLES';
+ $field = 'Tables_in_' . $db->dbname;
+ break;
+
+ case 'sqlite':
+ $sql = 'SELECT name
+ FROM sqlite_master
+ WHERE type = "table"';
+ $field = 'name';
+ break;
+
+ case 'mssql':
+ case 'mssql_odbc':
+ $sql = "SELECT name
+ FROM sysobjects
+ WHERE type='U'";
+ $field = 'name';
+ break;
+
+ case 'postgres':
+ $sql = 'SELECT relname
+ FROM pg_stat_user_tables';
+ $field = 'relname';
+ break;
+
+ case 'firebird':
+ $sql = 'SELECT rdb$relation_name
+ FROM rdb$relations
+ WHERE rdb$view_source is null
+ AND rdb$system_flag = 0';
+ $field = 'rdb$relation_name';
+ break;
+
+ case 'oracle':
+ $sql = 'SELECT table_name
+ FROM USER_TABLES';
+ $field = 'table_name';
+ break;
+ }
+
+ $result = $db->sql_query($sql);
+
+ $tables = array();
+
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $tables[] = $row[$field];
+ }
+
+ $db->sql_freeresult($result);
+
+ return $tables;
+}
/**
* Used to test whether we are able to connect to the database the user has specified
@@ -264,74 +327,20 @@ function connect_check_db($error_connect, &$error, $dbms, $table_prefix, $dbhost
}
else
{
- switch ($dbms['DRIVER'])
+ // Likely matches for an existing phpBB installation
+ if (!$prefix_may_exist)
{
- case 'mysql':
- case 'mysqli':
- $sql = 'SHOW TABLES';
- $field = "Tables_in_{$dbname}";
- break;
-
- case 'sqlite':
- $sql = 'SELECT name
- FROM sqlite_master
- WHERE type = "table"';
- $field = 'name';
- break;
-
- case 'mssql':
- case 'mssql_odbc':
- $sql = "SELECT name
- FROM sysobjects
- WHERE type='U'";
- $field = 'name';
- break;
-
- case 'postgres':
- $sql = "SELECT relname
- FROM pg_class
- WHERE relkind = 'r'
- AND relname NOT LIKE 'pg\_%'";
- $field = 'relname';
- break;
-
- case 'firebird':
- $sql = 'SELECT rdb$relation_name
- FROM rdb$relations
- WHERE rdb$view_source is null
- AND rdb$system_flag = 0';
- $field = 'rdb$relation_name';
- break;
-
- case 'oracle':
- $sql = 'SELECT table_name
- FROM USER_TABLES';
- $field = 'table_name';
- break;
- }
- $result = $db->sql_query($sql);
-
- if ($row = $db->sql_fetchrow($result))
- {
- // Likely matches for an existing phpBB installation
$temp_prefix = strtolower($table_prefix);
$table_ary = array($temp_prefix . 'attachments', $temp_prefix . 'config', $temp_prefix . 'sessions', $temp_prefix . 'topics', $temp_prefix . 'users');
- do
+ $tables = get_tables($db);
+ $table_intersect = array_intersect($tables, $table_ary);
+
+ if (sizeof($table_intersect))
{
- // All phpBB installations will at least have config else it won't work
- if (in_array(strtolower($row[$field]), $table_ary))
- {
- if (!$prefix_may_exist)
- {
- $error[] = $lang['INST_ERR_PREFIX'];
- }
- break;
- }
+ $error[] = $lang['INST_ERR_PREFIX'];
}
- while ($row = $db->sql_fetchrow($result));
}
- $db->sql_freeresult($result);
// Make sure that the user has selected a sensible DBAL for the DBMS actually installed
switch ($dbms['DRIVER'])
diff --git a/phpBB/install/install_convert.php b/phpBB/install/install_convert.php
index 0986ef42f9..c7432aeb42 100644
--- a/phpBB/install/install_convert.php
+++ b/phpBB/install/install_convert.php
@@ -445,22 +445,13 @@ class install_convert extends module
if (!$result)
{
$prefixes = array();
- // TODO: fixme
- if ($result = $src_db->sql_query('SHOW TABLES'))
+
+ $tables_existing = get_tables($src_db);
+ foreach ($tables_existing as $table_name)
{
- while ($row = $src_db->sql_fetchrow($result))
- {
- if (sizeof($row) > 1)
- {
- compare_table($tables, $row[0], $prefixes);
- }
- else if (list(, $tablename) = @each($row))
- {
- compare_table($tables, $tablename, $prefixes);
- }
- }
- $src_db->sql_freeresult($result);
+ compare_table($tables, $table_name, $prefixes);
}
+ unset($tables_existing);
foreach ($prefixes as $prefix => $count)
{
diff --git a/phpBB/language/en/acp/database.php b/phpBB/language/en/acp/database.php
index a59ebc416f..b8b423d08a 100644
--- a/phpBB/language/en/acp/database.php
+++ b/phpBB/language/en/acp/database.php
@@ -50,6 +50,7 @@ $lang = array_merge($lang, array(
'FILE_TYPE' => 'File type',
'FULL_BACKUP' => 'Full',
+ 'RESTORE_FAILURE' => 'The backup file may be corrupt.',
'RESTORE_OPTIONS' => 'Restore options',
'RESTORE_SUCCESS' => 'The database has been successfully restored. Your board should be back to the state it was when the backup was made.',
From 4805ae65427c9018c8ce9d66fdeef6c2b6a57c42 Mon Sep 17 00:00:00 2001
From: David M
Date: Mon, 19 Feb 2007 20:57:05 +0000
Subject: [PATCH 066/707] forgot to actually commit it :P
git-svn-id: file:///svn/phpbb/trunk@7016 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/includes/acp/acp_database.php | 118 ++++------------------------
1 file changed, 17 insertions(+), 101 deletions(-)
diff --git a/phpBB/includes/acp/acp_database.php b/phpBB/includes/acp/acp_database.php
index 2acbfb63ec..e023e53013 100644
--- a/phpBB/includes/acp/acp_database.php
+++ b/phpBB/includes/acp/acp_database.php
@@ -161,107 +161,18 @@ class acp_database
break;
default:
- $tables = array();
- switch ($db->sql_layer)
+ include($phpbb_root_path . 'includes/functions_install.' . $phpEx);
+ $tables = get_tables($db);
+ foreach ($tables as $table_name)
{
- case 'sqlite':
- $sql = "SELECT name
- FROM sqlite_master
- WHERE type='table'
- ORDER BY name";
- $result = $db->sql_query($sql);
- while ($row = $db->sql_fetchrow($result))
- {
- if (strlen($table_prefix) == 0 || strpos($row['name'], $table_prefix) === 0)
- {
- $tables[] = $row['name'];
- }
- }
- $db->sql_freeresult($result);
- break;
-
- case 'mysqli':
- case 'mysql4':
- case 'mysql':
- $sql = "SHOW TABLES
- LIKE '{$table_prefix}%'";
- $result = $db->sql_query($sql);
- while ($row = $db->sql_fetchrow($result))
- {
- $tables[] = current($row);
- }
- $db->sql_freeresult($result);
- break;
-
- case 'postgres':
- $sql = 'SELECT relname
- FROM pg_stat_user_tables
- ORDER BY relname';
- $result = $db->sql_query($sql);
- while ($row = $db->sql_fetchrow($result))
- {
- if (strlen($table_prefix) == 0 || strpos($row['relname'], $table_prefix) === 0)
- {
- $tables[] = $row['relname'];
- }
- }
- $db->sql_freeresult($result);
- break;
-
- case 'mssql':
- case 'mssql_odbc':
- $sql = "SELECT TABLE_NAME
- FROM INFORMATION_SCHEMA.TABLES
- WHERE TABLE_TYPE = 'BASE TABLE'
- ORDER BY TABLE_NAME";
- $result = $db->sql_query($sql);
- while ($row = $db->sql_fetchrow($result))
- {
- if (strlen($table_prefix) == 0 || strpos($row['TABLE_NAME'], $table_prefix) === 0)
- {
- $tables[] = $row['TABLE_NAME'];
- }
- }
- $db->sql_freeresult($result);
- break;
-
- case 'firebird':
- $sql = 'SELECT RDB$RELATION_NAME as TABLE_NAME
- FROM RDB$RELATIONS
- WHERE RDB$SYSTEM_FLAG=0
- AND RDB$VIEW_BLR IS NULL';
- $result = $db->sql_query($sql);
- while ($row = $db->sql_fetchrow($result))
- {
- if (strlen($table_prefix) == 0 || stripos($row['table_name'], $table_prefix) === 0)
- {
- $tables[] = $row['table_name'];
- }
- }
- $db->sql_freeresult($result);
- break;
-
- case 'oracle':
- $sql = 'SELECT TNAME as table_name
- FROM TAB';
- $result = $db->sql_query($sql);
- while ($row = $db->sql_fetchrow($result))
- {
- if (strlen($table_prefix) == 0 || stripos($row['table_name'], $table_prefix) === 0)
- {
- $tables[] = $row['table_name'];
- }
- }
- $db->sql_freeresult($result);
- break;
- }
-
- foreach ($tables as $table)
- {
- $template->assign_block_vars('tables', array(
- 'TABLE' => $table
- ));
+ if (strlen($table_prefix) === 0 || strpos($table_name, $table_prefix) === 0)
+ {
+ $template->assign_block_vars('tables', array(
+ 'TABLE' => $table_name
+ ));
+ }
}
+ unset($tables);
$template->assign_vars(array(
'U_ACTION' => $this->u_action . '&action=download'
@@ -398,7 +309,7 @@ class acp_database
$delim = ";\n";
while (($sql = $fgetd($fp, $delim, $read, $seek, $eof)) !== false)
{
- $query = trim($fgetd($fp, $delim, $read, $seek, $eof));
+ $query = trim($sql);
if (substr($query, 0, 8) === 'SET TERM')
{
$delim = $query[9] . "\n";
@@ -417,6 +328,10 @@ class acp_database
{
while (($sub = $fgetd($fp, "\n", $read, $seek, $eof)) !== '\.')
{
+ if ($sub === false)
+ {
+ trigger_error($user->lang['RESTORE_FAILURE'] . adm_back_link($this->u_action));
+ }
pg_put_line($db->db_connect_id, $sub . "\n");
}
pg_put_line($db->db_connect_id, "\\.\n");
@@ -612,7 +527,7 @@ class base_extractor
if ($this->download === true)
{
- if ($this->format === 'bzip2' || ($this->format === 'gzip' && !$this->run_comp))
+ if ($this->format === 'bzip2' || $this->format === 'text' || ($this->format === 'gzip' && !$this->run_comp))
{
echo $data;
}
@@ -1367,6 +1282,7 @@ class mssql_extractor extends base_extractor
function write_end()
{
$this->flush("COMMIT\nGO\n");
+ parent::write_end();
}
function write_start($prefix)
From e88e01ec645bc25e5d4a45c6d97bc006d24945df Mon Sep 17 00:00:00 2001
From: David M
Date: Tue, 20 Feb 2007 03:01:17 +0000
Subject: [PATCH 067/707] #8214
git-svn-id: file:///svn/phpbb/trunk@7017 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/install/install_convert.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/phpBB/install/install_convert.php b/phpBB/install/install_convert.php
index c7432aeb42..ac35db14c2 100644
--- a/phpBB/install/install_convert.php
+++ b/phpBB/install/install_convert.php
@@ -90,7 +90,7 @@ class install_convert extends module
function main($mode, $sub)
{
- global $lang, $template, $phpbb_root_path, $phpEx, $cache, $config;
+ global $lang, $template, $phpbb_root_path, $phpEx, $cache, $config, $language;
global $convert;
$this->tpl_name = 'install_convert';
@@ -114,7 +114,7 @@ class install_convert extends module
$template->assign_vars(array(
'S_NOT_INSTALLED' => true,
'TITLE' => $lang['BOARD_NOT_INSTALLED'],
- 'BODY' => sprintf($lang['BOARD_NOT_INSTALLED_EXPLAIN'], append_sid($phpbb_root_path . 'install/index.' . $phpEx, 'mode=install')),
+ 'BODY' => sprintf($lang['BOARD_NOT_INSTALLED_EXPLAIN'], append_sid($phpbb_root_path . 'install/index.' . $phpEx, 'mode=install&language=' . $language)),
));
return;
From bd4e2876d3878f63dcd1150dd7cb80e9f98feeef Mon Sep 17 00:00:00 2001
From: David M
Date: Tue, 20 Feb 2007 03:12:40 +0000
Subject: [PATCH 068/707] #8224
git-svn-id: file:///svn/phpbb/trunk@7018 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/includes/ucp/ucp_groups.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/phpBB/includes/ucp/ucp_groups.php b/phpBB/includes/ucp/ucp_groups.php
index 418b68e436..d6e5a34385 100644
--- a/phpBB/includes/ucp/ucp_groups.php
+++ b/phpBB/includes/ucp/ucp_groups.php
@@ -88,7 +88,7 @@ class ucp_groups
{
group_user_attributes('default', $group_id, $user->data['user_id']);
- add_log('user', $user->data['user_id'], 'LOG_USER_GROUP_CHANGE', sprintf($user->lang['USER_GROUP_CHANGE'], $group_row[$group_id]['group_name'], $group_row[$user->data['group_id']]['group_name']));
+ add_log('user', $user->data['user_id'], 'LOG_USER_GROUP_CHANGE', sprintf($user->lang['USER_GROUP_CHANGE'], $group_row[$user->data['group_id']]['group_name'], $group_row[$group_id]['group_name']));
meta_refresh(3, $this->u_action);
trigger_error($user->lang['CHANGED_DEFAULT_GROUP'] . $return_page);
From e8e47bac0c6cb775b12a6393631f38b9e5962b1d Mon Sep 17 00:00:00 2001
From: David M
Date: Tue, 20 Feb 2007 04:23:56 +0000
Subject: [PATCH 069/707] #8116
git-svn-id: file:///svn/phpbb/trunk@7019 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/includes/acp/acp_groups.php | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/phpBB/includes/acp/acp_groups.php b/phpBB/includes/acp/acp_groups.php
index 2645ac4ce3..9bb0693981 100644
--- a/phpBB/includes/acp/acp_groups.php
+++ b/phpBB/includes/acp/acp_groups.php
@@ -178,7 +178,8 @@ class acp_groups
break;
case 'deleteusers':
- $error = group_user_del($group_id, $mark_ary, false, $group_row['group_name']);
+ $group_name = ($group_row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $group_row['group_name']] : $group_row['group_name'];
+ $error = group_user_del($group_id, $mark_ary, false, $group_name);
break;
}
From 66b18be324deca4d392ee51f8b73a6d65b75eacc Mon Sep 17 00:00:00 2001
From: David M
Date: Tue, 20 Feb 2007 04:46:07 +0000
Subject: [PATCH 070/707] #8148
git-svn-id: file:///svn/phpbb/trunk@7020 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/docs/auth_api.html | 10 +++---
phpBB/docs/coding-guidelines.html | 60 +++++++++++++++----------------
2 files changed, 35 insertions(+), 35 deletions(-)
diff --git a/phpBB/docs/auth_api.html b/phpBB/docs/auth_api.html
index 8e624eae83..7481be50a8 100644
--- a/phpBB/docs/auth_api.html
+++ b/phpBB/docs/auth_api.html
@@ -235,7 +235,7 @@ $auth = new auth();
The acl
method is the initialisation routine for all the acl functions. If you intend calling any acl method you must first call this. The method takes as its one and only required parameter an associative array containing user information as stored in the database. This array must contain at least the following information; user_id, user_permissions and user_type. It is called in the following way:
-$auth->acl(userdata
);
+$auth->acl(userdata
);
Where userdata is the array containing the aforementioned data.
@@ -252,7 +252,7 @@ $auth->acl(userdata
);
This method is the primary way of determining what a user can and cannot do for a given option globally or in a given forum. The method should be called in the following way:
-$result = $auth->acl_get(option
[, forum
]);
+$result = $auth->acl_get(option
[, forum
]);
Where option is a string representing the required option, e.g. 'f_list', 'm_edit', 'a_adduser', etc. By adding a ! in front of the option, e.g. '!f_list' the result of this method will be negated. The optional forum term is the integer forum_id.
@@ -277,7 +277,7 @@ $result = $auth->acl_get(option
[, forum
]);
The method should be called thus:
-$result = $auth->acl_gets(option1
[, option2
, ..., optionN
, forum
]);
+$result = $auth->acl_gets(option1
[, option2
, ..., optionN
, forum
]);
As with the acl_get
method the options are strings representing the required permissions to check. The forum again is an integer representing a given forum_id.
@@ -296,7 +296,7 @@ $result = $auth->acl_gets(option1
[, option2
, ..., This method is used to find out in which forums a user is allowed to carry out an operation or to find out in which forums he is not allowed to carry out an operation. The method should be called in the following way:
-$result = $auth->acl_getf(option
[, clean
]);
+$result = $auth->acl_getf(option
[, clean
]);
Just like in the acl_get
method the option is a string specifying the permission which has to be checked (negation using ! is allowed). The second parameter is a boolean. If it is set to false this method returns all forums with either zero or a positive integer. If it is set to true only those forums with a positive integer as the result will be returned.
@@ -304,7 +304,7 @@ $result = $auth->acl_getf(option
[, clean
]);
The method returns an associative array of the form:
-array(forum_id1 => array(option => integer ), forum_id2 => ...)
+array(forum_id1 => array(option => integer ), forum_id2 => ...)
Where option is the option passed to the method and integer is either zero or a positive integer and the same acl_get(option, forum_id)
would return.
diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html
index 63d83a7c20..7e949d2d90 100644
--- a/phpBB/docs/coding-guidelines.html
+++ b/phpBB/docs/coding-guidelines.html
@@ -598,7 +598,7 @@ if (isset($forum)) ...
if (isset($forum) && $forum == 5)
- The empty()
function is useful if you want to check if a variable is not set or being empty (an empty string, 0 as an integer or string, NULL, false, an empty array or a variable declared, but without a value in a class). Therefore empty should be used in favor of isset($array) && sizeof($array) > 0
- this can be written in a shorter way as !empty($array)
.
+ The empty()
function is useful if you want to check if a variable is not set or being empty (an empty string, 0 as an integer or string, NULL, false, an empty array or a variable declared, but without a value in a class). Therefore empty should be used in favor of isset($array) && sizeof($array) > 0
- this can be written in a shorter way as !empty($array)
.
Switch statements:
Switch/case code blocks can get a bit long sometimes. To have some level of notice and being in-line with the opening/closing brace requirement (where they are on the same line for better readability), this also applies to switch/case code blocks and the breaks. An example:
@@ -769,9 +769,9 @@ $sql = 'SELECT *
$sql_ary = array(
- 'somedata' => $my_string,
- 'otherdata' => $an_int,
- 'moredata' => $another_int
+ 'somedata' => $my_string,
+ 'otherdata' => $an_int,
+ 'moredata' => $another_int
);
$db->sql_query('INSERT INTO ' . SOME_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));
@@ -781,9 +781,9 @@ $db->sql_query('INSERT INTO ' . SOME_TABLE . ' ' . $db->sql_build_array('I
$sql_ary = array(
- 'somedata' => $my_string,
- 'otherdata' => $an_int,
- 'moredata' => $another_int
+ 'somedata' => $my_string,
+ 'otherdata' => $an_int,
+ 'moredata' => $another_int
);
$sql = 'UPDATE ' . SOME_TABLE . '
@@ -850,24 +850,24 @@ SELECT FROM phpbb_forums WHERE forum_id <> 1
$sql_array = array(
- 'SELECT' => 'f.*, ft.mark_time',
+ 'SELECT' => 'f.*, ft.mark_time',
- 'FROM' => array(
- FORUMS_WATCH_TABLE => 'fw',
- FORUMS_TABLE => 'f'
+ 'FROM' => array(
+ FORUMS_WATCH_TABLE => 'fw',
+ FORUMS_TABLE => 'f'
),
- 'LEFT_JOIN' => array(
+ 'LEFT_JOIN' => array(
array(
- 'FROM' => array(FORUMS_TRACK_TABLE => 'ft'),
- 'ON' => 'ft.user_id = ' . $user->data['user_id'] . ' AND ft.forum_id = f.forum_id'
+ 'FROM' => array(FORUMS_TRACK_TABLE => 'ft'),
+ 'ON' => 'ft.user_id = ' . $user->data['user_id'] . ' AND ft.forum_id = f.forum_id'
)
),
- 'WHERE' => 'fw.user_id = ' . $user->data['user_id'] . '
+ 'WHERE' => 'fw.user_id = ' . $user->data['user_id'] . '
AND f.forum_id = fw.forum_id',
- 'ORDER_BY' => 'left_id'
+ 'ORDER_BY' => 'left_id'
);
$sql = $db->sql_build_query('SELECT', $sql_array);
@@ -877,25 +877,25 @@ $sql = $db->sql_build_query('SELECT', $sql_array);
$sql_array = array(
- 'SELECT' => 'f.*',
+ 'SELECT' => 'f.*',
- 'FROM' => array(
- FORUMS_WATCH_TABLE => 'fw',
- FORUMS_TABLE => 'f'
+ 'FROM' => array(
+ FORUMS_WATCH_TABLE => 'fw',
+ FORUMS_TABLE => 'f'
),
- 'WHERE' => 'fw.user_id = ' . $user->data['user_id'] . '
+ 'WHERE' => 'fw.user_id = ' . $user->data['user_id'] . '
AND f.forum_id = fw.forum_id',
- 'ORDER_BY' => 'left_id'
+ 'ORDER_BY' => 'left_id'
);
if ($config['load_db_lastread'])
{
$sql_array['LEFT_JOIN'] = array(
array(
- 'FROM' => array(FORUMS_TRACK_TABLE => 'ft'),
- 'ON' => 'ft.user_id = ' . $user->data['user_id'] . ' AND ft.forum_id = f.forum_id'
+ 'FROM' => array(FORUMS_TRACK_TABLE => 'ft'),
+ 'ON' => 'ft.user_id = ' . $user->data['user_id'] . ' AND ft.forum_id = f.forum_id'
)
);
@@ -984,7 +984,7 @@ $mark_array = request_var('mark', array(0));
// Getting an array, keys are strings, value defaults to 0
-$action_ary = request_var('action', array('' => 0));
+$action_ary = request_var('action', array('' => 0));
Login checks/redirection:
@@ -999,12 +999,12 @@ $action_ary = request_var('action', array('' => 0));
Sessions should be initiated on each page, as near the top as possible using the following code:
-$user->session_begin();
-$auth->acl($user->data);
-$user->setup();
+$user->session_begin();
+$auth->acl($user->data);
+$user->setup();
- The $user->setup()
call can be used to pass on additional language definition and a custom style (used in viewforum).
+ The $user->setup()
call can be used to pass on additional language definition and a custom style (used in viewforum).
Errors and messages:
All messages/errors should be outputed by calling trigger_error()
using the appropriate message type and language string. Example:
@@ -1328,7 +1328,7 @@ div
You are even able to check the number of items within a loop by comparing it with values within the IF condition:
-
+
markup
From af4c99690be6e6d21c096441d2e0a1283d054d06 Mon Sep 17 00:00:00 2001
From: David M
Date: Tue, 20 Feb 2007 13:57:52 +0000
Subject: [PATCH 071/707] #8242 #7976
git-svn-id: file:///svn/phpbb/trunk@7021 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/install/convertors/convert_phpbb20.php | 14 +++++++-------
phpBB/install/convertors/functions_phpbb20.php | 8 ++++----
2 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/phpBB/install/convertors/convert_phpbb20.php b/phpBB/install/convertors/convert_phpbb20.php
index f87bf2f7d6..4e159919ff 100644
--- a/phpBB/install/convertors/convert_phpbb20.php
+++ b/phpBB/install/convertors/convert_phpbb20.php
@@ -165,12 +165,12 @@ if (!$get_info)
// Test to see if the attachment MOD is installed on the source forum
// If it is, we will convert this data as well
- $db->sql_return_on_error(true);
+ $src_db->sql_return_on_error(true);
$sql = "SELECT config_value
FROM {$convert->src_table_prefix}attachments_config
WHERE config_name = 'upload_dir'";
- $result = $db->sql_query($sql);
+ $result = $src_db->sql_query($sql);
if ($result && $row = $db->sql_fetchrow($result))
{
@@ -193,15 +193,15 @@ if (!$get_info)
* Please use constants for this, prefixing them with MOD_
*/
- $db->sql_return_on_error(false);
+ $src_db->sql_return_on_error(false);
// Now let us set a temporary config variable for user id incrementing
$sql = "SELECT user_id
FROM {$convert->src_table_prefix}users
WHERE user_id = 1";
- $result = $db->sql_query($sql);
- $user_id = (int) $db->sql_fetchfield('user_id');
- $db->sql_freeresult($result);
+ $result = $src_db->sql_query($sql);
+ $user_id = (int) $src_db->sql_fetchfield('user_id');
+ $src_db->sql_freeresult($result);
// If there is a user id 1, we need to increment user ids. :/
if ($user_id === 1)
@@ -333,7 +333,7 @@ if (!$get_info)
array('is_orphan', 0, ''),
array('poster_id', 'attachments.user_id_1 AS poster_id', 'phpbb_user_id'),
array('physical_filename', 'attachments_desc.physical_filename', 'import_attachment'),
- array('real_filename', 'attachments_desc.real_filename', ''),
+ array('real_filename', 'attachments_desc.real_filename', 'phpbb_set_encoding'),
array('download_count', 'attachments_desc.download_count', ''),
array('attach_comment', 'attachments_desc.comment', array('function1' => 'phpbb_set_encoding', 'function2' => 'utf8_htmlspecialchars')),
array('extension', 'attachments_desc.extension', ''),
diff --git a/phpBB/install/convertors/functions_phpbb20.php b/phpBB/install/convertors/functions_phpbb20.php
index 0b05f4308d..8f6328a928 100644
--- a/phpBB/install/convertors/functions_phpbb20.php
+++ b/phpBB/install/convertors/functions_phpbb20.php
@@ -89,7 +89,7 @@ function phpbb_insert_forums()
{
$sql_ary = array(
'forum_id' => $max_forum_id,
- 'forum_name' => ($row['cat_title']) ? htmlspecialchars(phpbb_set_encoding($row['cat_title'], false), ENT_COMPAT, 'UTF-8') : $user->lang['CATEGORY'],
+ 'forum_name' => ($row['cat_title']) ? htmlspecialchars(phpbb_set_default_encoding($row['cat_title']), ENT_COMPAT, 'UTF-8') : $user->lang['CATEGORY'],
'parent_id' => 0,
'forum_parents' => '',
'forum_desc' => '',
@@ -200,10 +200,10 @@ function phpbb_insert_forums()
// Define the new forums sql ary
$sql_ary = array(
'forum_id' => (int) $row['forum_id'],
- 'forum_name' => htmlspecialchars(phpbb_set_encoding($row['forum_name'], false), ENT_COMPAT, 'UTF-8'),
+ 'forum_name' => htmlspecialchars(phpbb_set_default_encoding($row['forum_name']), ENT_COMPAT, 'UTF-8'),
'parent_id' => $cats_added[$row['cat_id']],
'forum_parents' => '',
- 'forum_desc' => htmlspecialchars(phpbb_set_encoding($row['forum_desc'], false), ENT_COMPAT, 'UTF-8'),
+ 'forum_desc' => htmlspecialchars(phpbb_set_default_encoding($row['forum_desc']), ENT_COMPAT, 'UTF-8'),
'forum_type' => FORUM_POST,
'forum_status' => is_item_locked($row['forum_status']),
'enable_prune' => $row['prune_enable'],
@@ -1047,7 +1047,7 @@ function phpbb_convert_group_name($group_name)
return 'phpBB2 - ' . $group_name;
}
- return phpbb_set_encoding($group_name, false);
+ return phpbb_set_default_encoding($group_name);
}
/**
From 3e9672a188abf7be27c75ab152d182a6f99e590e Mon Sep 17 00:00:00 2001
From: David M
Date: Tue, 20 Feb 2007 14:55:11 +0000
Subject: [PATCH 072/707] *** empty log message ***
git-svn-id: file:///svn/phpbb/trunk@7022 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/includes/acp/acp_groups.php | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/phpBB/includes/acp/acp_groups.php b/phpBB/includes/acp/acp_groups.php
index 9bb0693981..9c3adeeffc 100644
--- a/phpBB/includes/acp/acp_groups.php
+++ b/phpBB/includes/acp/acp_groups.php
@@ -74,7 +74,8 @@ class acp_groups
}
// Approve, demote or promote
- group_user_attributes($action, $group_id, $mark_ary, false, $group_row['group_name']);
+ $group_name = ($group_row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $group_row['group_name']] : $group_row['group_name'];
+ group_user_attributes($action, $group_id, $mark_ary, false, $group_name);
switch ($action)
{
From 2a0425ffca5d939825ab5389ced9235cbe192e49 Mon Sep 17 00:00:00 2001
From: David M
Date: Tue, 20 Feb 2007 15:04:56 +0000
Subject: [PATCH 073/707] #8232
git-svn-id: file:///svn/phpbb/trunk@7023 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/includes/acp/acp_ban.php | 2 --
1 file changed, 2 deletions(-)
diff --git a/phpBB/includes/acp/acp_ban.php b/phpBB/includes/acp/acp_ban.php
index cf490a4643..7b9eef12ba 100644
--- a/phpBB/includes/acp/acp_ban.php
+++ b/phpBB/includes/acp/acp_ban.php
@@ -130,8 +130,6 @@ class acp_ban
WHERE (b.ban_end >= ' . time() . '
OR b.ban_end = 0)
AND u.user_id = b.ban_userid
- AND b.ban_userid <> 0
- AND u.user_id <> ' . ANONYMOUS . '
ORDER BY u.username_clean ASC';
break;
From 5de69acfe2e6255054532c3b120c6fa629da6118 Mon Sep 17 00:00:00 2001
From: David M
Date: Tue, 20 Feb 2007 15:24:31 +0000
Subject: [PATCH 074/707] #8194
git-svn-id: file:///svn/phpbb/trunk@7024 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/includes/functions_admin.php | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php
index 357555b170..19a7a126c0 100644
--- a/phpBB/includes/functions_admin.php
+++ b/phpBB/includes/functions_admin.php
@@ -2685,14 +2685,14 @@ function tidy_warnings()
$expire_date = time() - ($config['warnings_expire_days'] * 86400);
$warning_list = $user_list = array();
- $sql = 'SELECT * FROM ' . WARNINGS_TABLE . "
- WHERE warning_time < $expire_date";
+ $sql = 'SELECT * FROM ' . WARNINGS_TABLE;/* . "
+ WHERE warning_time < $expire_date";*/
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$warning_list[] = $row['warning_id'];
- $user_list[$row['user_id']] = isset($user_list[$row['user_id']]) ? $user_list[$row['user_id']]++ : 1;
+ $user_list[$row['user_id']] = isset($user_list[$row['user_id']]) ? ++$user_list[$row['user_id']] : 1;
}
$db->sql_freeresult($result);
@@ -2708,6 +2708,7 @@ function tidy_warnings()
{
$sql = 'UPDATE ' . USERS_TABLE . " SET user_warnings = user_warnings - $value
WHERE user_id = $user_id";
+ var_dump($sql);
$db->sql_query($sql);
}
From 1e8b642cf1d2a98d0b25178ad85fb2b5b9e284cd Mon Sep 17 00:00:00 2001
From: David M
Date: Tue, 20 Feb 2007 15:26:08 +0000
Subject: [PATCH 075/707] blah
git-svn-id: file:///svn/phpbb/trunk@7025 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/includes/acp/acp_groups.php | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/phpBB/includes/acp/acp_groups.php b/phpBB/includes/acp/acp_groups.php
index 9c3adeeffc..67c9d4d338 100644
--- a/phpBB/includes/acp/acp_groups.php
+++ b/phpBB/includes/acp/acp_groups.php
@@ -103,6 +103,7 @@ class acp_groups
if (confirm_box(true))
{
+ $group_name = ($group_row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $group_row['group_name']] : $group_row['group_name'];
if (!sizeof($mark_ary))
{
$start = 0;
@@ -124,7 +125,7 @@ class acp_groups
}
while ($row = $db->sql_fetchrow($result));
- group_user_attributes('default', $group_id, $mark_ary, false, $group_row['group_name'], $group_row);
+ group_user_attributes('default', $group_id, $mark_ary, false, $group_name, $group_row);
$start = (sizeof($mark_ary) < 200) ? 0 : $start + 200;
}
@@ -138,7 +139,7 @@ class acp_groups
}
else
{
- group_user_attributes('default', $group_id, $mark_ary, false, $group_row['group_name'], $group_row);
+ group_user_attributes('default', $group_id, $mark_ary, false, $group_name, $group_row);
}
trigger_error($user->lang['GROUP_DEFS_UPDATED'] . adm_back_link($this->u_action . '&action=list&g=' . $group_id));
From d5d0085180bbdfcd6cc6c001d92efa822f9f12cf Mon Sep 17 00:00:00 2001
From: David M
Date: Tue, 20 Feb 2007 15:33:16 +0000
Subject: [PATCH 076/707] i feel special
git-svn-id: file:///svn/phpbb/trunk@7026 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/includes/functions_admin.php | 1 -
1 file changed, 1 deletion(-)
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php
index 19a7a126c0..2eff9c7980 100644
--- a/phpBB/includes/functions_admin.php
+++ b/phpBB/includes/functions_admin.php
@@ -2708,7 +2708,6 @@ function tidy_warnings()
{
$sql = 'UPDATE ' . USERS_TABLE . " SET user_warnings = user_warnings - $value
WHERE user_id = $user_id";
- var_dump($sql);
$db->sql_query($sql);
}
From 02d9c670f5236979cb217eb1c36d5daaef9bfaf0 Mon Sep 17 00:00:00 2001
From: David M
Date: Tue, 20 Feb 2007 19:07:33 +0000
Subject: [PATCH 077/707] remember daivd, nobody else wants your debug code...
git-svn-id: file:///svn/phpbb/trunk@7027 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/includes/functions_admin.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php
index 2eff9c7980..b63669e186 100644
--- a/phpBB/includes/functions_admin.php
+++ b/phpBB/includes/functions_admin.php
@@ -2685,8 +2685,8 @@ function tidy_warnings()
$expire_date = time() - ($config['warnings_expire_days'] * 86400);
$warning_list = $user_list = array();
- $sql = 'SELECT * FROM ' . WARNINGS_TABLE;/* . "
- WHERE warning_time < $expire_date";*/
+ $sql = 'SELECT * FROM ' . WARNINGS_TABLE . "
+ WHERE warning_time < $expire_date";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
From 76b06cf71d1c1b3c8f82c677f282371b483843db Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dominik=20Dr=C3=B6scher?=
Date: Tue, 20 Feb 2007 21:06:46 +0000
Subject: [PATCH 078/707] #8204
Small fix for Safari which apparently didn't understand the onchange value - well, onclick does the trick too. Thanks to kellanved for helping debug this. Now on to the the display errors in Safari!
git-svn-id: file:///svn/phpbb/trunk@7028 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/adm/style/permission_mask.html | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/phpBB/adm/style/permission_mask.html b/phpBB/adm/style/permission_mask.html
index b3a18093bb..a3e4fc57d3 100644
--- a/phpBB/adm/style/permission_mask.html
+++ b/phpBB/adm/style/permission_mask.html
@@ -103,9 +103,9 @@
class="yes">
class="never">
- checked="checked" value="1" />
- checked="checked" value="-1" />
- checked="checked" value="0" />
+ checked="checked" value="1" />
+ checked="checked" value="-1" />
+ checked="checked" value="0" />
From 2602b11894d3e93aa8b059c2a6585241689d9643 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dominik=20Dr=C3=B6scher?=
Date: Tue, 20 Feb 2007 21:29:08 +0000
Subject: [PATCH 079/707] Some more Safari fixes, everything but the tooltips
should display correct now on the permission dialogs
git-svn-id: file:///svn/phpbb/trunk@7029 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/adm/style/permission_mask.html | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/phpBB/adm/style/permission_mask.html b/phpBB/adm/style/permission_mask.html
index a3e4fc57d3..7ef2bc1848 100644
--- a/phpBB/adm/style/permission_mask.html
+++ b/phpBB/adm/style/permission_mask.html
@@ -23,7 +23,7 @@
{p_mask.NAME} [{p_mask.L_ACL_TYPE}]
-
+
@@ -112,6 +112,7 @@
+
{L_APPLY_PERMISSIONS_EXPLAIN}
@@ -120,9 +121,11 @@
+
+
From 213a83b5194bc430578343142e8cde7a3cc96517 Mon Sep 17 00:00:00 2001
From: David M
Date: Wed, 21 Feb 2007 19:43:44 +0000
Subject: [PATCH 080/707] #8254
git-svn-id: file:///svn/phpbb/trunk@7030 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/includes/functions.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index d3638f1941..6d9623245a 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -2132,7 +2132,7 @@ function bump_topic_allowed($forum_id, $topic_bumped, $last_post_time, $topic_po
function get_context($text, $words, $length = 400)
{
// first replace all whitespaces with single spaces
- $text = preg_replace('/\s+/u', ' ', $text);
+ $text = preg_replace('/ +/', ' ', strtr($text, "\t\n\r\x0C ", ' '), $text);
$word_indizes = array();
if (sizeof($words))
From 7752115971b89d79f605ce6d02b8be0b52969594 Mon Sep 17 00:00:00 2001
From: David M
Date: Thu, 22 Feb 2007 15:17:35 +0000
Subject: [PATCH 081/707] #8302
git-svn-id: file:///svn/phpbb/trunk@7031 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/install/index.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/phpBB/install/index.php b/phpBB/install/index.php
index 146f55ddb6..77dc8097d2 100755
--- a/phpBB/install/index.php
+++ b/phpBB/install/index.php
@@ -22,7 +22,7 @@ $phpEx = substr(strrchr(__FILE__, '.'), 1);
error_reporting(E_ALL ^ E_NOTICE);
// @todo Review this test and see if we can find out what it is which prevents PHP 4.2.x from even displaying the page with requirements on it
-if (version_compare(phpversion(), '4.3.0') < 0)
+if (version_compare(phpversion(), '4.3.3') < 0)
{
die('You are running an unsupported PHP version. Please upgrade to PHP 4.3.3 or higher before trying to install phpBB 3.0');
}
From 5cd3efad82796c3aeceb1da8b2707f696b11ee17 Mon Sep 17 00:00:00 2001
From: David M
Date: Thu, 22 Feb 2007 15:18:53 +0000
Subject: [PATCH 082/707] #8298
git-svn-id: file:///svn/phpbb/trunk@7032 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/adm/style/acp_forums.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/phpBB/adm/style/acp_forums.html b/phpBB/adm/style/acp_forums.html
index 5bbd235c04..a3d5d08dab 100644
--- a/phpBB/adm/style/acp_forums.html
+++ b/phpBB/adm/style/acp_forums.html
@@ -147,7 +147,7 @@
{L_FORUM_DESC}: {L_FORUM_DESC_EXPLAIN}
- {FORUM_DESC}
+ {FORUM_DESC}
checked="checked" /> {L_PARSE_BBCODE} checked="checked" /> {L_PARSE_SMILIES} checked="checked" /> {L_PARSE_URLS}
From 87c3b60b179132e8e2d7b0b794b81f566d0558ad Mon Sep 17 00:00:00 2001
From: David M
Date: Thu, 22 Feb 2007 15:21:34 +0000
Subject: [PATCH 083/707] #8296
git-svn-id: file:///svn/phpbb/trunk@7033 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/styles/subSilver/template/ucp_pm_options.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/phpBB/styles/subSilver/template/ucp_pm_options.html b/phpBB/styles/subSilver/template/ucp_pm_options.html
index ab3b6b9a26..c1363f8b4f 100644
--- a/phpBB/styles/subSilver/template/ucp_pm_options.html
+++ b/phpBB/styles/subSilver/template/ucp_pm_options.html
@@ -80,7 +80,7 @@
{rule.CHECK}
{rule.RULE}
{rule.STRING}
- {rule.ACTION} -> {rule.FOLDER}
+ {rule.ACTION} -> {rule.FOLDER}
From 97a8eb40139ddb299754a883508c9250ef544f36 Mon Sep 17 00:00:00 2001
From: Meik Sievertsen
Date: Thu, 22 Feb 2007 16:20:11 +0000
Subject: [PATCH 084/707] trying to fix two conversion issues - anonymous user
not entered correctly or entered with user id 0 (need to be tested) - ips not
converted
git-svn-id: file:///svn/phpbb/trunk@7034 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/includes/functions_convert.php | 6 ++--
phpBB/includes/session.php | 35 +++++++++++++++++++
.../install/convertors/functions_phpbb20.php | 24 +++++++------
phpBB/viewtopic.php | 7 ++++
4 files changed, 59 insertions(+), 13 deletions(-)
diff --git a/phpBB/includes/functions_convert.php b/phpBB/includes/functions_convert.php
index 914311c2b8..5acaae113b 100644
--- a/phpBB/includes/functions_convert.php
+++ b/phpBB/includes/functions_convert.php
@@ -309,10 +309,10 @@ function decode_ip($int_ip)
$hexipbang = explode('.', chunk_split($int_ip, 2, '.'));
- // Any mod changing the way ips are stored? Then we are not able to convert.
- if (sizeof($hexipbang) != 4)
+ // Any mod changing the way ips are stored? Then we are not able to convert...
+ if (sizeof($hexipbang) < 4)
{
- return '';
+ return '127.0.0.1';
}
return hexdec($hexipbang[0]) . '.' . hexdec($hexipbang[1]) . '.' . hexdec($hexipbang[2]) . '.' . hexdec($hexipbang[3]);
diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php
index 71e83fbd11..6033691637 100644
--- a/phpBB/includes/session.php
+++ b/phpBB/includes/session.php
@@ -1023,6 +1023,41 @@ class session
return false;
}
+ /**
+ * Check if URI is blacklisted
+ * This should be called only where absolutly necessary, for example on the submitted website field
+ * This function is not in use at the moment and is only included for testing purposes, it may not work at all!
+ * This means it is untested at the moment and therefore commented out
+ *
+ * @param string $uri URI to check
+ * @return true if uri is on blacklist, else false. Only blacklist is checked (~zero FP), no grey lists
+ function check_uribl($uri)
+ {
+ // Normally parse_url() is not intended to parse uris
+ // We need to get the top-level domain name anyway... change.
+ $uri = parse_url($uri);
+
+ if ($uri === false || empty($uri['host']))
+ {
+ return false;
+ }
+
+ $uri = trim($uri['host']);
+
+ if ($uri)
+ {
+ // One problem here... the return parameter for the "windows" method is different from what
+ // we expect... this may render this check useless...
+ if (phpbb_checkdnsrr($uri . '.multi.uribl.com.', 'A') === true)
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+ */
+
/**
* Set/Update a persistent login key
*
diff --git a/phpBB/install/convertors/functions_phpbb20.php b/phpBB/install/convertors/functions_phpbb20.php
index 8f6328a928..2c53e5ccd1 100644
--- a/phpBB/install/convertors/functions_phpbb20.php
+++ b/phpBB/install/convertors/functions_phpbb20.php
@@ -436,16 +436,6 @@ function phpbb_get_birthday($birthday = '')
*/
function phpbb_user_id($user_id)
{
- if (!$user_id)
- {
- return 0;
- }
-
- if ($user_id == -1)
- {
- return ANONYMOUS;
- }
-
global $config;
// Increment user id if the old forum is having a user with the id 1
@@ -484,6 +474,19 @@ function phpbb_user_id($user_id)
}
}
+ // If the old user id is -1 in 2.0.x it is the anonymous user...
+ if ($user_id == -1)
+ {
+ return ANONYMOUS;
+ }
+
+ // This should never ever happen - 2.0.x is not allowing a user id of 0
+ // But we return the anonymous user to be consistent and not breaking functionality
+ if (!$user_id)
+ {
+ return ANONYMOUS;
+ }
+
if (!empty($config['increment_user_id']))
{
$user_id++;
@@ -1125,6 +1128,7 @@ function phpbb_prepare_message($message)
$message = preg_replace('/\[quote="(.*?)"\]/s', '[quote="\1"]', $message);
}
+ // Already the new user id ;)
$user_id = $convert->row['poster_id'];
$message = str_replace('<', '<', $message);
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php
index 1c05af3d11..2898d56e72 100644
--- a/phpBB/viewtopic.php
+++ b/phpBB/viewtopic.php
@@ -1215,6 +1215,13 @@ $template->assign_vars(array(
$first_unread = $post_unread = false;
for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i)
{
+ // A non-existing rowset only happens if there was no user present for the entered poster_id
+ // This could be a broken posts table.
+ if (!isset($rowset[$post_list[$i]]))
+ {
+ continue;
+ }
+
$row =& $rowset[$post_list[$i]];
$poster_id = $row['user_id'];
From a8f6aafa43bd255ecd56a8bfb1b78a76e966f3f8 Mon Sep 17 00:00:00 2001
From: Meik Sievertsen
Date: Thu, 22 Feb 2007 19:32:00 +0000
Subject: [PATCH 085/707] small bugfix...
git-svn-id: file:///svn/phpbb/trunk@7035 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/includes/functions_jabber.php | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/phpBB/includes/functions_jabber.php b/phpBB/includes/functions_jabber.php
index b0a7e09c08..184a1f89a4 100644
--- a/phpBB/includes/functions_jabber.php
+++ b/phpBB/includes/functions_jabber.php
@@ -20,7 +20,7 @@
* last modified: 24.03.2004 13:01:53
*
* Modified by phpBB Development Team
-* version: v0.4.3a1
+* version: v0.4.3
*
* @package phpBB3
*/
@@ -59,6 +59,9 @@ class jabber
var $connector;
+ var $version;
+ var $show_version;
+
/**
* Constructor
*/
@@ -73,6 +76,9 @@ class jabber
$this->enable_logging = true;
$this->log_array = array();
+ $this->version = '1.0';
+ $this->show_version = false;
+
$this->packet_queue = array();
$this->iq_sleep_timer = $this->delay_disconnect = 1;
@@ -113,7 +119,7 @@ class jabber
if ($this->connector->open_socket($this->server, $this->port))
{
$this->send_packet("\n");
- $this->send_packet("\n");
+ $this->send_packet("show_version) ? " version='{$this->version}'" : '') . ">\n");
sleep(2);
@@ -890,7 +896,7 @@ class jabber
socket_set_blocking($this->connector->active_socket, $meta['blocked']);
$this->send_packet("\n");
- $this->send_packet("\n");
+ $this->send_packet("show_version) ? " version='{$this->version}'" : '') . ">\n");
sleep(2);
if (!$this->_check_connected(true))
From 42f3115763fa2496f552a25305266283152c209b Mon Sep 17 00:00:00 2001
From: David M
Date: Thu, 22 Feb 2007 19:58:05 +0000
Subject: [PATCH 086/707] #8244 - cleaned up the TRUNCATE/DELETE FROM in the
native search backend - fixed an imporoper default value on some upgrades
git-svn-id: file:///svn/phpbb/trunk@7036 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/develop/create_schema_files.php | 2 +-
phpBB/includes/message_parser.php | 8 ++++++++
phpBB/includes/search/fulltext_native.php | 24 ++---------------------
phpBB/install/database_update.php | 13 +++++++++++-
phpBB/install/schemas/firebird_schema.sql | 2 +-
phpBB/install/schemas/mssql_schema.sql | 2 +-
phpBB/install/schemas/mysql_41_schema.sql | 2 +-
phpBB/install/schemas/oracle_schema.sql | 2 +-
phpBB/install/schemas/postgres_schema.sql | 2 +-
phpBB/language/en/posting.php | 2 ++
10 files changed, 30 insertions(+), 29 deletions(-)
diff --git a/phpBB/develop/create_schema_files.php b/phpBB/develop/create_schema_files.php
index 0f9c36bb09..f1a9dd1830 100644
--- a/phpBB/develop/create_schema_files.php
+++ b/phpBB/develop/create_schema_files.php
@@ -1757,7 +1757,7 @@ function get_schema_struct()
'topic_moved_id' => array('UINT', 0),
'topic_bumped' => array('BOOL', 0),
'topic_bumper' => array('UINT', 0),
- 'poll_title' => array('XSTEXT_UNI', ''),
+ 'poll_title' => array('STEXT_UNI', ''),
'poll_start' => array('TIMESTAMP', 0),
'poll_length' => array('TIMESTAMP', 0),
'poll_max_options' => array('TINT:4', 1),
diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php
index e2c0b37fe7..d358ec8f48 100644
--- a/phpBB/includes/message_parser.php
+++ b/phpBB/includes/message_parser.php
@@ -1507,7 +1507,15 @@ class parse_message extends bbcode_firstpass
}
else
{
+ if (utf8_strlen(preg_replace('#\[\/?[a-z\*\+\-]+(=[\S]+)?\]#ius', ' ', $this->message)) > 100)
+ {
+ $this->warn_msg[] = $user->lang['POLL_TITLE_TOO_LONG'];
+ }
$poll['poll_title'] = $this->parse($poll['enable_bbcode'], ($config['allow_post_links']) ? $poll['enable_urls'] : false, $poll['enable_smilies'], $poll['img_status'], false, false, $config['allow_post_links'], false);
+ if (strlen($poll['poll_title']) > 255)
+ {
+ $this->warn_msg[] = $user->lang['POLL_TITLE_COMP_TOO_LONG'];
+ }
}
$this->message = $tmp_message;
diff --git a/phpBB/includes/search/fulltext_native.php b/phpBB/includes/search/fulltext_native.php
index bd197feede..30dc779078 100755
--- a/phpBB/includes/search/fulltext_native.php
+++ b/phpBB/includes/search/fulltext_native.php
@@ -1271,33 +1271,13 @@ class fulltext_native extends search_backend
case 'sqlite':
case 'firebird':
$db->sql_query('DELETE FROM ' . SEARCH_WORDLIST_TABLE);
- break;
-
- default:
- $db->sql_query('TRUNCATE TABLE ' . SEARCH_WORDLIST_TABLE);
- break;
- }
-
- switch ($db->sql_layer)
- {
- case 'sqlite':
- case 'firebird':
$db->sql_query('DELETE FROM ' . SEARCH_WORDMATCH_TABLE);
- break;
-
- default:
- $db->sql_query('TRUNCATE TABLE ' . SEARCH_WORDMATCH_TABLE);
- break;
- }
-
- switch ($db->sql_layer)
- {
- case 'sqlite':
- case 'firebird':
$db->sql_query('DELETE FROM ' . SEARCH_RESULTS_TABLE);
break;
default:
+ $db->sql_query('TRUNCATE TABLE ' . SEARCH_WORDLIST_TABLE);
+ $db->sql_query('TRUNCATE TABLE ' . SEARCH_WORDMATCH_TABLE);
$db->sql_query('TRUNCATE TABLE ' . SEARCH_RESULTS_TABLE);
break;
}
diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php
index 201629e7b1..363a90e5d8 100644
--- a/phpBB/install/database_update.php
+++ b/phpBB/install/database_update.php
@@ -317,7 +317,7 @@ $database_update_info = array(
'seed' => array('UINT:10', 0),
),
SESSIONS_TABLE => array(
- 'session_forwarded_for' => array('VCHAR:255', 0),
+ 'session_forwarded_for' => array('VCHAR:255', ''),
),
),
'change_columns' => array(
@@ -351,6 +351,17 @@ $database_update_info = array(
),
),
),
+ // Changes from 3.0.b5 to the next version
+ '3.0.b5' => array(
+ 'change_columns' => array(
+ TOPICS_TABLE => array(
+ 'poll_title' => array('STEXT_UNI', ''),
+ ),
+ SESSIONS_TABLE => array(
+ 'session_forwarded_for' => array('VCHAR:255', ''),
+ ),
+ ),
+ ),
);
// Determine mapping database type
diff --git a/phpBB/install/schemas/firebird_schema.sql b/phpBB/install/schemas/firebird_schema.sql
index dd3e4af9d2..9ab8594c01 100644
--- a/phpBB/install/schemas/firebird_schema.sql
+++ b/phpBB/install/schemas/firebird_schema.sql
@@ -1284,7 +1284,7 @@ CREATE TABLE phpbb_topics (
topic_moved_id INTEGER DEFAULT 0 NOT NULL,
topic_bumped INTEGER DEFAULT 0 NOT NULL,
topic_bumper INTEGER DEFAULT 0 NOT NULL,
- poll_title VARCHAR(100) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE,
+ poll_title VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE,
poll_start INTEGER DEFAULT 0 NOT NULL,
poll_length INTEGER DEFAULT 0 NOT NULL,
poll_max_options INTEGER DEFAULT 1 NOT NULL,
diff --git a/phpBB/install/schemas/mssql_schema.sql b/phpBB/install/schemas/mssql_schema.sql
index 7f33783072..9d4eb55505 100644
--- a/phpBB/install/schemas/mssql_schema.sql
+++ b/phpBB/install/schemas/mssql_schema.sql
@@ -1481,7 +1481,7 @@ CREATE TABLE [phpbb_topics] (
[topic_moved_id] [int] DEFAULT (0) NOT NULL ,
[topic_bumped] [int] DEFAULT (0) NOT NULL ,
[topic_bumper] [int] DEFAULT (0) NOT NULL ,
- [poll_title] [varchar] (100) DEFAULT ('') NOT NULL ,
+ [poll_title] [varchar] (255) DEFAULT ('') NOT NULL ,
[poll_start] [int] DEFAULT (0) NOT NULL ,
[poll_length] [int] DEFAULT (0) NOT NULL ,
[poll_max_options] [int] DEFAULT (1) NOT NULL ,
diff --git a/phpBB/install/schemas/mysql_41_schema.sql b/phpBB/install/schemas/mysql_41_schema.sql
index 7ade8bd1a4..bf884e1ed4 100644
--- a/phpBB/install/schemas/mysql_41_schema.sql
+++ b/phpBB/install/schemas/mysql_41_schema.sql
@@ -900,7 +900,7 @@ CREATE TABLE phpbb_topics (
topic_moved_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
topic_bumped tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
topic_bumper mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
- poll_title varchar(100) DEFAULT '' NOT NULL,
+ poll_title varchar(255) DEFAULT '' NOT NULL,
poll_start int(11) UNSIGNED DEFAULT '0' NOT NULL,
poll_length int(11) UNSIGNED DEFAULT '0' NOT NULL,
poll_max_options tinyint(4) DEFAULT '1' NOT NULL,
diff --git a/phpBB/install/schemas/oracle_schema.sql b/phpBB/install/schemas/oracle_schema.sql
index 8634dcd1fe..970006a7c8 100644
--- a/phpBB/install/schemas/oracle_schema.sql
+++ b/phpBB/install/schemas/oracle_schema.sql
@@ -1666,7 +1666,7 @@ CREATE TABLE phpbb_topics (
topic_moved_id number(8) DEFAULT '0' NOT NULL,
topic_bumped number(1) DEFAULT '0' NOT NULL,
topic_bumper number(8) DEFAULT '0' NOT NULL,
- poll_title varchar2(300) DEFAULT '' ,
+ poll_title varchar2(765) DEFAULT '' ,
poll_start number(11) DEFAULT '0' NOT NULL,
poll_length number(11) DEFAULT '0' NOT NULL,
poll_max_options number(4) DEFAULT '1' NOT NULL,
diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql
index d0005a16a7..e1dea496cf 100644
--- a/phpBB/install/schemas/postgres_schema.sql
+++ b/phpBB/install/schemas/postgres_schema.sql
@@ -1148,7 +1148,7 @@ CREATE TABLE phpbb_topics (
topic_moved_id INT4 DEFAULT '0' NOT NULL CHECK (topic_moved_id >= 0),
topic_bumped INT2 DEFAULT '0' NOT NULL CHECK (topic_bumped >= 0),
topic_bumper INT4 DEFAULT '0' NOT NULL CHECK (topic_bumper >= 0),
- poll_title varchar(100) DEFAULT '' NOT NULL,
+ poll_title varchar(255) DEFAULT '' NOT NULL,
poll_start INT4 DEFAULT '0' NOT NULL CHECK (poll_start >= 0),
poll_length INT4 DEFAULT '0' NOT NULL CHECK (poll_length >= 0),
poll_max_options INT2 DEFAULT '1' NOT NULL,
diff --git a/phpBB/language/en/posting.php b/phpBB/language/en/posting.php
index d5e8450699..0724918a2e 100644
--- a/phpBB/language/en/posting.php
+++ b/phpBB/language/en/posting.php
@@ -141,6 +141,8 @@ $lang = array_merge($lang, array(
'POLL_OPTIONS' => 'Poll options',
'POLL_OPTIONS_EXPLAIN' => 'Place each option on a new line. You may enter up to %d options',
'POLL_QUESTION' => 'Poll question',
+ 'POLL_TITLE_TOO_LONG' => 'The poll title must contain fewer than 100 characters',
+ 'POLL_TITLE_COMP_TOO_LONG' => 'The parsed size of your poll title is too large, consider removing BBCodes or smilies',
'POLL_VOTE_CHANGE' => 'Allow re-voting',
'POLL_VOTE_CHANGE_EXPLAIN' => 'If enabled users are able to change their vote.',
'POSTED_ATTACHMENTS' => 'Posted attachments',
From df3a0f9a332035833b7f3776e673570473b5c3aa Mon Sep 17 00:00:00 2001
From: David M
Date: Thu, 22 Feb 2007 20:36:00 +0000
Subject: [PATCH 087/707] - found a small flaw, no more errors from cross
conversions :D
git-svn-id: file:///svn/phpbb/trunk@7037 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/install/install_convert.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/phpBB/install/install_convert.php b/phpBB/install/install_convert.php
index ac35db14c2..54b8ee3a3d 100644
--- a/phpBB/install/install_convert.php
+++ b/phpBB/install/install_convert.php
@@ -1287,7 +1287,7 @@ class install_convert extends module
$skip_rows++;
}
- $db->sql_freeresult($___result);
+ $src_db->sql_freeresult($___result);
// We might still have some rows waiting
if (sizeof($waiting_rows))
From 9b9b3be23b6841204922e9523d7537abdc4c76b7 Mon Sep 17 00:00:00 2001
From: David M
Date: Fri, 23 Feb 2007 02:51:44 +0000
Subject: [PATCH 088/707] #8180
git-svn-id: file:///svn/phpbb/trunk@7038 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/viewonline.php | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/phpBB/viewonline.php b/phpBB/viewonline.php
index f202dceb5b..785dce5229 100644
--- a/phpBB/viewonline.php
+++ b/phpBB/viewonline.php
@@ -395,9 +395,9 @@ $template->assign_vars(array(
'PAGINATION' => $pagination,
'PAGE_NUMBER' => on_page($counter, $config['topics_per_page'], $start),
- 'U_SORT_USERNAME' => append_sid("{$phpbb_root_path}viewonline.$phpEx", 'sk=a&sd=' . (($sort_key == 'a' && $sort_dir == 'a') ? 'd' : 'a')),
- 'U_SORT_UPDATED' => append_sid("{$phpbb_root_path}viewonline.$phpEx", 'sk=b&sd=' . (($sort_key == 'b' && $sort_dir == 'a') ? 'd' : 'a')),
- 'U_SORT_LOCATION' => append_sid("{$phpbb_root_path}viewonline.$phpEx", 'sk=c&sd=' . (($sort_key == 'c' && $sort_dir == 'a') ? 'd' : 'a')),
+ 'U_SORT_USERNAME' => append_sid("{$phpbb_root_path}viewonline.$phpEx", 'sk=a&sd=' . (($sort_key == 'a' && $sort_dir == 'a') ? 'd' : 'a') . '&sg=' . ((int) $show_guests)),
+ 'U_SORT_UPDATED' => append_sid("{$phpbb_root_path}viewonline.$phpEx", 'sk=b&sd=' . (($sort_key == 'b' && $sort_dir == 'a') ? 'd' : 'a') . '&sg=' . ((int) $show_guests)),
+ 'U_SORT_LOCATION' => append_sid("{$phpbb_root_path}viewonline.$phpEx", 'sk=c&sd=' . (($sort_key == 'c' && $sort_dir == 'a') ? 'd' : 'a') . '&sg=' . ((int) $show_guests)),
'U_SWITCH_GUEST_DISPLAY' => append_sid("{$phpbb_root_path}viewonline.$phpEx", 'sg=' . ((int) !$show_guests)),
'L_SWITCH_GUEST_DISPLAY' => ($show_guests) ? $user->lang['HIDE_GUESTS'] : $user->lang['DISPLAY_GUESTS'],
From 85a4e318819d4322684e8ee17d030064e8987a6b Mon Sep 17 00:00:00 2001
From: Jonathan Stanley
Date: Fri, 23 Feb 2007 03:54:40 +0000
Subject: [PATCH 089/707] #8050 - Whilst now invalid... reworded as phpBB3 CVS
does now support "cross-database" conversions.
git-svn-id: file:///svn/phpbb/trunk@7039 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/language/en/install.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php
index 4bcc26bccf..5ac27f7ee0 100755
--- a/phpBB/language/en/install.php
+++ b/phpBB/language/en/install.php
@@ -123,7 +123,7 @@ $lang = array_merge($lang, array(
'DB_USERNAME' => 'Database username',
'DB_TEST' => 'Test connection',
'DEFAULT_LANG' => 'Default board language',
- 'DEFAULT_PREFIX_IS' => 'The convertor was not able to find tables with the specified prefix. Please make sure you have the old within the same database as your phpBB 3.0.x installation. The default table prefix for %1$s is %2$s ',
+ 'DEFAULT_PREFIX_IS' => 'The convertor was not able to find tables with the specified prefix. Please make sure you have entered the correct details for the forum you are converting from. The default table prefix for %1$s is %2$s ',
'DEV_NO_TEST_FILE' => 'No value has been specified for the test_file variable in the convertor. If you are a user of this convertor, you should not be seeing this error, please report this message to the convertor author. If you are a convertor author, you must specify the name of a file which exists in the source forum to allow the path to it to be verified.',
'DIRECTORIES_AND_FILES' => 'Directory and file setup',
'DISABLE_KEYS' => 'Disabling keys',
From e855a348e3bb762ed2afd01343123980c26e6d46 Mon Sep 17 00:00:00 2001
From: Meik Sievertsen
Date: Fri, 23 Feb 2007 13:50:27 +0000
Subject: [PATCH 090/707] - fixed some convertor bugs - adjusted forum standard
access (+polls) role to include f_delete (no update, only new installations
will have the change included)
git-svn-id: file:///svn/phpbb/trunk@7040 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/includes/functions_convert.php | 31 +++++--
phpBB/install/convertors/convert_phpbb20.php | 19 +++-
.../install/convertors/functions_phpbb20.php | 91 ++++++++++++-------
phpBB/install/install_convert.php | 22 +++--
phpBB/install/schemas/schema_data.sql | 4 +-
phpBB/language/en/acp/board.php | 2 +-
phpBB/language/en/acp/permissions.php | 2 +-
phpBB/language/en/install.php | 4 +-
8 files changed, 119 insertions(+), 56 deletions(-)
diff --git a/phpBB/includes/functions_convert.php b/phpBB/includes/functions_convert.php
index 5acaae113b..0884ef01e8 100644
--- a/phpBB/includes/functions_convert.php
+++ b/phpBB/includes/functions_convert.php
@@ -822,7 +822,10 @@ function get_avatar_dim($src, $axis, $func = false, $arg1 = false, $arg2 = false
break;
default:
- return $axis ? DEFAULT_AVATAR_Y : DEFAULT_AVATAR_X;
+ $default_x = (defined('DEFAULT_AVATAR_X_CUSTOM')) ? DEFAULT_AVATAR_X_CUSTOM : DEFAULT_AVATAR_X;
+ $default_y = (defined('DEFAULT_AVATAR_Y_CUSTOM')) ? DEFAULT_AVATAR_Y_CUSTOM : DEFAULT_AVATAR_Y;
+
+ return $axis ? $default_y : $default_x;
break;
}
}
@@ -868,7 +871,10 @@ function get_upload_avatar_dim($source, $axis)
if (empty($cachedims) || empty($cachedims[0]) || empty($cachedims[1]))
{
- $cachedims = array(DEFAULT_AVATAR_X, DEFAULT_AVATAR_Y);
+ $default_x = (defined('DEFAULT_AVATAR_X_CUSTOM')) ? DEFAULT_AVATAR_X_CUSTOM : DEFAULT_AVATAR_X;
+ $default_y = (defined('DEFAULT_AVATAR_Y_CUSTOM')) ? DEFAULT_AVATAR_Y_CUSTOM : DEFAULT_AVATAR_Y;
+
+ $cachedims = array($default_x, $default_y);
}
return $cachedims[$axis];
@@ -909,7 +915,10 @@ function get_gallery_avatar_dim($source, $axis)
if (empty($avatar_cache[$orig_source]) || empty($avatar_cache[$orig_source][0]) || empty($avatar_cache[$orig_source][1]))
{
- $avatar_cache[$orig_source] = array(DEFAULT_AVATAR_X, DEFAULT_AVATAR_Y);
+ $default_x = (defined('DEFAULT_AVATAR_X_CUSTOM')) ? DEFAULT_AVATAR_X_CUSTOM : DEFAULT_AVATAR_X;
+ $default_y = (defined('DEFAULT_AVATAR_Y_CUSTOM')) ? DEFAULT_AVATAR_Y_CUSTOM : DEFAULT_AVATAR_Y;
+
+ $avatar_cache[$orig_source] = array($default_x, $default_y);
}
return $avatar_cache[$orig_source][$axis];
@@ -938,7 +947,10 @@ function get_remote_avatar_dim($src,$axis)
if (empty($avatar_cache[$src]) || empty($avatar_cache[$src][0]) || empty($avatar_cache[$src][1]))
{
- $avatar_cache[$src] = array(DEFAULT_AVATAR_X, DEFAULT_AVATAR_Y);
+ $default_x = (defined('DEFAULT_AVATAR_X_CUSTOM')) ? DEFAULT_AVATAR_X_CUSTOM : DEFAULT_AVATAR_X;
+ $default_y = (defined('DEFAULT_AVATAR_Y_CUSTOM')) ? DEFAULT_AVATAR_Y_CUSTOM : DEFAULT_AVATAR_Y;
+
+ $avatar_cache[$src] = array($default_x, $default_y);
}
return $avatar_cache[$src][$axis];
@@ -1805,8 +1817,15 @@ function update_dynamic_config()
// Get latest username
$sql = 'SELECT user_id, username, user_colour
FROM ' . USERS_TABLE . '
- WHERE user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ')
- ORDER BY user_id DESC';
+ WHERE user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ')';
+
+ if (!empty($config['increment_user_id']))
+ {
+ $sql .= ' AND user_id <> ' . $config['increment_user_id'];
+ }
+
+ $sql .= ' ORDER BY user_id DESC';
+
$result = $db->sql_query_limit($sql, 1);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
diff --git a/phpBB/install/convertors/convert_phpbb20.php b/phpBB/install/convertors/convert_phpbb20.php
index 4e159919ff..1cd03d3667 100644
--- a/phpBB/install/convertors/convert_phpbb20.php
+++ b/phpBB/install/convertors/convert_phpbb20.php
@@ -31,7 +31,7 @@ unset($dbpasswd);
*/
$convertor_data = array(
'forum_name' => 'phpBB 2.0.x',
- 'version' => '0.9',
+ 'version' => '0.92',
'phpbb_version' => '3.0.0',
'author' => 'phpBB Group ',
'dbms' => $dbms,
@@ -42,7 +42,7 @@ $convertor_data = array(
'dbname' => $dbname,
'table_prefix' => 'phpbb_',
'forum_path' => '../forums',
- 'author_notes' => 'Avatars may be on a different width/height than with the old forum. This is due to dimensions being stored within phpBB3 but not within phpBB2. The default dimension was set to 80x80 for avatars where dimension settings could not be determined. You might wish to instruct your users to check their profiles after the conversion to ensure that the size is correct.',
+ 'author_notes' => '',
);
/**
@@ -206,13 +206,24 @@ if (!$get_info)
// If there is a user id 1, we need to increment user ids. :/
if ($user_id === 1)
{
- set_config('increment_user_id', 1, true);
+ // Try to get the maximum user id possible...
+ $sql = "SELECT MAX(user_id) AS max_user_id
+ FROM {$convert->src_table_prefix}users";
+ $result = $src_db->sql_query($sql);
+ $user_id = (int) $src_db->sql_fetchfield('max_user_id');
+ $src_db->sql_freeresult($result);
+
+ set_config('increment_user_id', ($user_id + 1), true);
}
else
{
set_config('increment_user_id', 0, true);
}
+ // Overwrite maximum avatar width/height
+ @define('DEFAULT_AVATAR_X_CUSTOM', get_config_value('avatar_max_width'));
+ @define('DEFAULT_AVATAR_Y_CUSTOM', get_config_value('avatar_max_height'));
+
/**
* Description on how to use the convertor framework.
*
@@ -636,7 +647,7 @@ if (!$get_info)
array('enable_smilies', 'privmsgs.privmsgs_enable_smilies AS enable_smilies', ''),
array('enable_magic_url', 1, ''),
array('enable_sig', 'privmsgs.privmsgs_attach_sig', ''),
- array('message_subject', 'privmsgs.privmsgs_subject', array('function1' => 'phpbb_set_encoding', 'function2' => 'utf8_htmlspecialchars')),
+ array('message_subject', 'privmsgs.privmsgs_subject', 'phpbb_set_encoding'), // Already specialchared in 2.0.x
array('message_attachment', ((defined('MOD_ATTACHMENT')) ? 'privmsgs.privmsgs_attachment' : 0), ''),
array('message_edit_reason', '', ''),
array('message_edit_user', 0, ''),
diff --git a/phpBB/install/convertors/functions_phpbb20.php b/phpBB/install/convertors/functions_phpbb20.php
index 2c53e5ccd1..598bb46a9a 100644
--- a/phpBB/install/convertors/functions_phpbb20.php
+++ b/phpBB/install/convertors/functions_phpbb20.php
@@ -456,6 +456,13 @@ function phpbb_user_id($user_id)
$id = (int) $src_db->sql_fetchfield('user_id');
$src_db->sql_freeresult($result);
+ // Try to get the maximum user id possible...
+ $sql = "SELECT MAX(user_id) AS max_user_id
+ FROM {$convert->src_table_prefix}users";
+ $result = $src_db->sql_query($sql);
+ $max_id = (int) $src_db->sql_fetchfield('max_user_id');
+ $src_db->sql_freeresult($result);
+
if ($convert->mysql_convert && $same_db)
{
$src_db->sql_query("SET NAMES 'utf8'");
@@ -464,8 +471,8 @@ function phpbb_user_id($user_id)
// If there is a user id 1, we need to increment user ids. :/
if ($id === 1)
{
- set_config('increment_user_id', 1, true);
- $config['increment_user_id'] = 1;
+ set_config('increment_user_id', ($max_id + 1), true);
+ $config['increment_user_id'] = $max_id + 1;
}
else
{
@@ -487,9 +494,9 @@ function phpbb_user_id($user_id)
return ANONYMOUS;
}
- if (!empty($config['increment_user_id']))
+ if (!empty($config['increment_user_id']) && $user_id == 1)
{
- $user_id++;
+ return $config['increment_user_id'];
}
return $user_id;
@@ -591,8 +598,8 @@ function phpbb_convert_authentication($mode)
// Add Forum Access List
$auth_map = array(
'auth_view' => array('f_', 'f_list'),
- 'auth_read' => 'f_read',
- 'auth_post' => array('f_post', 'f_bbcode', 'f_smilies', 'f_img', 'f_sigs', 'f_search', 'f_postcount'),
+ 'auth_read' => array('f_read', 'f_search'),
+ 'auth_post' => array('f_post', 'f_bbcode', 'f_smilies', 'f_img', 'f_sigs', 'f_postcount', 'f_report', 'f_subscribe', 'f_print', 'f_email'),
'auth_reply' => 'f_reply',
'auth_edit' => 'f_edit',
'auth_delete' => 'f_delete',
@@ -600,7 +607,7 @@ function phpbb_convert_authentication($mode)
'auth_vote' => 'f_vote',
'auth_announce' => 'f_announce',
'auth_sticky' => 'f_sticky',
- 'auth_attachments' => 'f_attach',
+ 'auth_attachments' => array('f_attach', 'f_download'),
'auth_download' => 'f_download',
);
@@ -705,18 +712,33 @@ function phpbb_convert_authentication($mode)
user_group_auth('registered', 'SELECT user_id, {REGISTERED} FROM ' . USERS_TABLE . ' WHERE user_id <> ' . ANONYMOUS, false);
// Selecting from old table
- $auth_sql = 'SELECT ';
- $auth_sql .= (!empty($config['increment_user_id'])) ? 'user_id + 1 as user_id' : 'user_id';
- $auth_sql .= ', {ADMINISTRATORS} FROM ' . $convert->src_table_prefix . 'users WHERE user_level = 1';
+ if (!empty($config['increment_user_id']))
+ {
+ $auth_sql = 'SELECT user_id, {ADMINISTRATORS} FROM ' . $convert->src_table_prefix . 'users WHERE user_level = 1 AND user_id <> 1';
+ user_group_auth('administrators', $auth_sql, true);
- user_group_auth('administrators', $auth_sql, true);
+ $auth_sql = 'SELECT ' . $config['increment_user_id'] . ' as user_id, {ADMINISTRATORS} FROM ' . $convert->src_table_prefix . 'users WHERE user_level = 1 AND user_id = 1';
+ user_group_auth('administrators', $auth_sql, true);
+ }
+ else
+ {
+ $auth_sql = 'SELECT user_id, {ADMINISTRATORS} FROM ' . $convert->src_table_prefix . 'users WHERE user_level = 1';
+ user_group_auth('administrators', $auth_sql, true);
+ }
- // Put administrators into global moderators group too...
- $auth_sql = 'SELECT ';
- $auth_sql .= (!empty($config['increment_user_id'])) ? 'user_id + 1 as user_id' : 'user_id';
- $auth_sql .= ', {GLOBAL_MODERATORS} FROM ' . $convert->src_table_prefix . 'users WHERE user_level = 1';
+ if (!empty($config['increment_user_id']))
+ {
+ $auth_sql = 'SELECT user_id, {GLOBAL_MODERATORS} FROM ' . $convert->src_table_prefix . 'users WHERE user_level = 1 AND user_id <> 1';
+ user_group_auth('global_moderators', $auth_sql, true);
- user_group_auth('global_moderators', $auth_sql, true);
+ $auth_sql = 'SELECT ' . $config['increment_user_id'] . ' as user_id, {GLOBAL_MODERATORS} FROM ' . $convert->src_table_prefix . 'users WHERE user_level = 1 AND user_id = 1';
+ user_group_auth('global_moderators', $auth_sql, true);
+ }
+ else
+ {
+ $auth_sql = 'SELECT user_id, {GLOBAL_MODERATORS} FROM ' . $convert->src_table_prefix . 'users WHERE user_level = 1';
+ user_group_auth('global_moderators', $auth_sql, true);
+ }
}
else if ($mode == 'first')
{
@@ -762,7 +784,7 @@ function phpbb_convert_authentication($mode)
// no break;
case 'registered_hidden':
- mass_auth('group_role', $new_forum_id, 'registered', 'FORUM_LIMITED_POLLS');
+ mass_auth('group_role', $new_forum_id, 'registered', 'FORUM_STANDARD_POLLS');
break;
case 'private':
@@ -980,25 +1002,32 @@ function phpbb_convert_authentication($mode)
if (sizeof($forum_ids))
{
// Now make sure the user is able to read these forums
- $hold_ary = $auth->acl_group_raw_data(get_group_id('guests'), 'f_list', $forum_ids);
+ $hold_ary = $auth->acl_group_raw_data(false, 'f_list', $forum_ids);
- if (!empty($hold_ary))
+ if (empty($hold_ary))
{
- mass_auth('group', $row['forum_id'], 'guests', 'f_list', ACL_YES);
- mass_auth('group', $row['forum_id'], 'registered', 'f_list', ACL_YES);
- mass_auth('group', $row['forum_id'], 'registered_coppa', 'f_list', ACL_YES);
- mass_auth('group', $row['forum_id'], 'bots', 'f_list', ACL_YES);
+ continue;
}
- else
- {
- // Now make sure the user is able to read these forums
- $hold_ary = $auth->acl_group_raw_data(get_group_id('registered'), 'f_list', $forum_ids);
- if (!empty($hold_ary))
+ foreach ($hold_ary as $g_id => $f_id_ary)
+ {
+ $set_group = false;
+
+ foreach ($f_id_ary as $f_id => $auth_ary)
{
- mass_auth('group', $row['forum_id'], 'registered', 'f_list', ACL_YES);
- mass_auth('group', $row['forum_id'], 'registered_coppa', 'f_list', ACL_YES);
- mass_auth('group', $row['forum_id'], 'bots', 'f_list', ACL_YES);
+ foreach ($auth_ary as $auth_option => $setting)
+ {
+ if ($setting == ACL_YES)
+ {
+ $set_group = true;
+ break 2;
+ }
+ }
+ }
+
+ if ($set_group)
+ {
+ mass_auth('group', $row['forum_id'], $g_id, 'f_list', ACL_YES);
}
}
}
diff --git a/phpBB/install/install_convert.php b/phpBB/install/install_convert.php
index 54b8ee3a3d..49ce3689bd 100644
--- a/phpBB/install/install_convert.php
+++ b/phpBB/install/install_convert.php
@@ -141,7 +141,6 @@ class install_convert extends module
}
$db->sql_freeresult($result);
-
// Detect if there is already a conversion in progress at this point and offer to resume
// It's quite possible that the user will get disconnected during a large conversion so they need to be able to resume it
$new_conversion = request_var('new_conv', 0);
@@ -168,13 +167,13 @@ class install_convert extends module
// This information should have already been checked once, but do it again for safety
if (!empty($options) && !empty($options['tag']) &&
- isset($convert->options['dbms']) &&
- isset($convert->options['dbhost']) &&
- isset($convert->options['dbport']) &&
- isset($convert->options['dbuser']) &&
- isset($convert->options['dbpasswd']) &&
- isset($convert->options['dbname']) &&
- isset($convert->options['table_prefix']))
+ isset($options['dbms']) &&
+ isset($options['dbhost']) &&
+ isset($options['dbport']) &&
+ isset($options['dbuser']) &&
+ isset($options['dbpasswd']) &&
+ isset($options['dbname']) &&
+ isset($options['table_prefix']))
{
$this->page_title = $lang['CONTINUE_CONVERT'];
@@ -943,7 +942,12 @@ class install_convert extends module
'dbpasswd' => $convert->src_dbpasswd,
)), true);
- $msg = $user->lang['PRE_CONVERT_COMPLETE'] . '
' . sprintf($user->lang['AUTHOR_NOTES'], $convert->convertor_data['author_notes']);
+ $msg = $user->lang['PRE_CONVERT_COMPLETE'];
+
+ if ($convert->convertor_data['author_notes'])
+ {
+ $msg .= '
' . sprintf($user->lang['AUTHOR_NOTES'], $convert->convertor_data['author_notes']);
+ }
$url = $this->p_master->module_url . "?mode=$mode&sub=in_progress&tag={$convert->convertor_tag}$step";
$template->assign_vars(array(
diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql
index d6703479a7..ef83d68c97 100644
--- a/phpBB/install/schemas/schema_data.sql
+++ b/phpBB/install/schemas/schema_data.sql
@@ -465,7 +465,7 @@ INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 14, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%';
# Standard Access (f_)
-INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 15, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option NOT IN ('f_announce', 'f_delete', 'f_ignoreflood', 'f_poll', 'f_sticky', 'f_user_lock');
+INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 15, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option NOT IN ('f_announce', 'f_ignoreflood', 'f_poll', 'f_sticky', 'f_user_lock');
# No Access (f_)
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 16, auth_option_id, 0 FROM phpbb_acl_options WHERE auth_option = 'f_';
@@ -484,7 +484,7 @@ INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 20, auth_option_id, 0 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option IN ('f_noapprove');
# Standard Access + Polls (f_)
-INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 21, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option NOT IN ('f_announce', 'f_delete', 'f_ignoreflood', 'f_sticky', 'f_user_lock');
+INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 21, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option NOT IN ('f_announce', 'f_ignoreflood', 'f_sticky', 'f_user_lock');
# Limited Access + Polls (f_)
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 22, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option NOT IN ('f_announce', 'f_attach', 'f_bump', 'f_delete', 'f_flash', 'f_icons', 'f_ignoreflood', 'f_sticky', 'f_user_lock', 'f_votechg');
diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php
index 865a68d60b..16fd53ce71 100644
--- a/phpBB/language/en/acp/board.php
+++ b/phpBB/language/en/acp/board.php
@@ -308,7 +308,7 @@ $lang = array_merge($lang, array(
'ENABLE_GZIP' => 'Enable GZip compression',
'FORCE_SERVER_VARS' => 'Force server URL settings',
- 'FORCE_SERVER_VARS_EXPLAIN' => 'If set to yes the server settings defined here will be used in favour of the automatically determined values',
+ 'FORCE_SERVER_VARS_EXPLAIN' => 'If set to yes the server settings defined here will be used in favour of the automatically determined values.',
'ICONS_PATH' => 'Post icons storage path',
'ICONS_PATH_EXPLAIN' => 'Path under your phpBB root directory, e.g. images/icons ',
'PATH_SETTINGS' => 'Path settings',
diff --git a/phpBB/language/en/acp/permissions.php b/phpBB/language/en/acp/permissions.php
index e29067895a..70226c0684 100644
--- a/phpBB/language/en/acp/permissions.php
+++ b/phpBB/language/en/acp/permissions.php
@@ -181,7 +181,7 @@ $lang = array_merge($lang, array(
'ROLE_DESCRIPTION_FORUM_ONQUEUE' => 'Can use most forum features including attachments, but posts and topics need to be approved by a moderator.',
'ROLE_DESCRIPTION_FORUM_POLLS' => 'Like Standard Access but can also create polls.',
'ROLE_DESCRIPTION_FORUM_READONLY' => 'Can read the forum, but cannot create new topics or reply to posts.',
- 'ROLE_DESCRIPTION_FORUM_STANDARD' => 'Can use most forum features including attachments, but cannot lock or delete own topics, and cannot create polls.',
+ 'ROLE_DESCRIPTION_FORUM_STANDARD' => 'Can use most forum features including attachments and deleting own topics, but cannot lock own topics, and cannot create polls.',
'ROLE_DESCRIPTION_MOD_FULL' => 'Can use all moderating features, including banning.',
'ROLE_DESCRIPTION_MOD_QUEUE' => 'Can use the Moderation Queue to validate and edit posts, but nothing else.',
'ROLE_DESCRIPTION_MOD_SIMPLE' => 'Can only use basic topic actions. Cannot send warnings or use moderation queue.',
diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php
index 5ac27f7ee0..1e3f8b0765 100755
--- a/phpBB/language/en/install.php
+++ b/phpBB/language/en/install.php
@@ -74,7 +74,7 @@ $lang = array_merge($lang, array(
'CONVERT_INTRO_BODY' => 'From here, you are able to import data from other (installed) forum systems. The list below shows all the conversion modules currently available. If there is no convertor shown in this list for the forum software you wish to convert from, please check our website where further conversion modules may be available for download.',
'CONVERT_NEW_CONVERSION' => 'New conversion',
'CONVERT_NOT_EXIST' => 'The specified convertor does not exist',
- 'CONVERT_SETTINGS_VERIFIED' => 'The information you entered has been verified. To start the conversion progress, push the button below to begin',
+ 'CONVERT_SETTINGS_VERIFIED' => 'The information you entered has been verified. To start the conversion progress, push the button below to begin.',
'CONV_ERROR_ATTACH_FTP_DIR' => 'FTP upload for attachments is enabled at the old board. Please disable the FTP upload option and make sure a valid upload directory is specified, then copy all attachment files to this new web accessible directory. Once you have done this, restart the convertor.',
'CONV_ERROR_CONFIG_EMPTY' => 'There is no configuration information available for the conversion.',
@@ -257,7 +257,7 @@ $lang = array_merge($lang, array(
'POST_ID' => 'Post ID',
'PREFIX_FOUND' => 'A scan of your tables has shown a valid installation using %s as table prefix.',
'PREPROCESS_STEP' => 'Executing pre-processing functions/queries',
- 'PRE_CONVERT_COMPLETE' => 'All pre-conversion steps have successfully been completed. You may now begin the actual conversion process.',
+ 'PRE_CONVERT_COMPLETE' => 'All pre-conversion steps have successfully been completed. You may now begin the actual conversion process. Please note that you may have to manually adjust several things. After conversion, especially check the permissions assigned, rebuild your search index if necessary and also make sure files got copied correctly, for example avatars and smilies.',
'PROCESS_LAST' => 'Processing last statements',
'REFRESH_PAGE' => 'Refresh page to continue conversion',
From 932e16dfd3d3140e7d6d2cba6f212bcefcfd0b54 Mon Sep 17 00:00:00 2001
From: David M
Date: Fri, 23 Feb 2007 14:52:16 +0000
Subject: [PATCH 091/707] #8074
git-svn-id: file:///svn/phpbb/trunk@7041 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/includes/search/fulltext_native.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/phpBB/includes/search/fulltext_native.php b/phpBB/includes/search/fulltext_native.php
index 30dc779078..5ff0c3c566 100755
--- a/phpBB/includes/search/fulltext_native.php
+++ b/phpBB/includes/search/fulltext_native.php
@@ -321,7 +321,7 @@ class fulltext_native extends search_backend
}
else
{
- $this->common_words[] = $row['word_text'];
+ $this->common_words[] = $word;
}
}
else
From 44d7ab6d1de7e5afc6bcc2901fbc376d244d4ace Mon Sep 17 00:00:00 2001
From: David M
Date: Fri, 23 Feb 2007 16:24:13 +0000
Subject: [PATCH 092/707] #8022
git-svn-id: file:///svn/phpbb/trunk@7042 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/language/en/mcp.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/phpBB/language/en/mcp.php b/phpBB/language/en/mcp.php
index 7c5df74d5f..9f26b41451 100644
--- a/phpBB/language/en/mcp.php
+++ b/phpBB/language/en/mcp.php
@@ -338,7 +338,7 @@ $lang = array_merge($lang, array(
'WARNING_PM_BODY' => 'The following is a warning which has been issued to you by an administrator or moderator of this site.[quote]%s[/quote]',
'WARNING_PM_SUBJECT' => 'Board warning issued',
'WARNING_POST_DEFAULT' => 'This is a warning regarding the following post made by you: %s',
- 'WARNINGS_ZERO_TOTAL' => 'No warnings exists',
+ 'WARNINGS_ZERO_TOTAL' => 'No warnings exist',
'YOU_SELECTED_TOPIC' => 'You selected topic number %d: %s',
From 9655bea71acfac7e2168b21fd9ac3bf6ed9ac693 Mon Sep 17 00:00:00 2001
From: David M
Date: Fri, 23 Feb 2007 16:39:03 +0000
Subject: [PATCH 093/707] #7902
git-svn-id: file:///svn/phpbb/trunk@7043 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/includes/acp/acp_prune.php | 7 ++++++-
phpBB/language/en/acp/prune.php | 1 +
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/phpBB/includes/acp/acp_prune.php b/phpBB/includes/acp/acp_prune.php
index 9e680e4714..484c936be5 100644
--- a/phpBB/includes/acp/acp_prune.php
+++ b/phpBB/includes/acp/acp_prune.php
@@ -301,9 +301,14 @@ class acp_prune
}
add_log('admin', $l_log, implode(', ', $usernames));
+ $msg = $user->lang['USER_' . strtoupper($action) . '_SUCCESS'];
+ }
+ else
+ {
+ $msg = $user->lang['USER_PRUNE_FAILURE'];
}
- trigger_error($user->lang['USER_' . strtoupper($action) . '_SUCCESS'] . adm_back_link($this->u_action));
+ trigger_error($msg . adm_back_link($this->u_action));
}
else
{
diff --git a/phpBB/language/en/acp/prune.php b/phpBB/language/en/acp/prune.php
index aec44a86c9..ad2a998c21 100644
--- a/phpBB/language/en/acp/prune.php
+++ b/phpBB/language/en/acp/prune.php
@@ -48,6 +48,7 @@ $lang = array_merge($lang, array(
'USER_DEACTIVATE_SUCCESS' => 'The selected users have been deactivated successfully.',
'USER_DELETE_SUCCESS' => 'The selected users have been deleted successfully.',
+ 'USER_PRUNE_FAILURE' => 'No users fit the selected criteria.',
'WRONG_ACTIVE_JOINED_DATE' => 'The date entered is wrong, it is expected in YYYY-MM-DD format.',
));
From 4b6560d375f5ed086e4f8546e32f8bc9b90b34b1 Mon Sep 17 00:00:00 2001
From: David M
Date: Fri, 23 Feb 2007 16:45:34 +0000
Subject: [PATCH 094/707] #8206
git-svn-id: file:///svn/phpbb/trunk@7044 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/language/en/acp/board.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php
index 16fd53ce71..38a057b740 100644
--- a/phpBB/language/en/acp/board.php
+++ b/phpBB/language/en/acp/board.php
@@ -406,7 +406,7 @@ $lang = array_merge($lang, array(
// Jabber settings
$lang = array_merge($lang, array(
- 'ACP_JABBER_SETTINGS_EXPLAIN' => 'Here you can enable and control the use Jabber for instant messaging and board notices. Jabber is an opensource protocol and therefore available for use by anyone. Some Jabber servers include gateways or transports which allow you to contact users on other networks. Not all servers offer all transports and changes in protocols can prevent transports from operating. Note that it may take several seconds to update Jabber account details, do not stop the script till completed!',
+ 'ACP_JABBER_SETTINGS_EXPLAIN' => 'Here you can enable and control the use of Jabber for instant messaging and board notifications. Jabber is an open source protocol and therefore available for use by anyone. Some Jabber servers include gateways or transports which allow you to contact users on other networks. Not all servers offer all transports and changes in protocols can prevent transports from operating. Note that it may take several seconds to update Jabber account details, so do not stop the script until it is completed!',
'ERR_JAB_AUTH' => 'Could not authorise on Jabber server.',
'ERR_JAB_CONNECT' => 'Could not connect to Jabber server.',
From 6e2e074c2ce04101eb797dbbe03af0ec34dc8817 Mon Sep 17 00:00:00 2001
From: David M
Date: Fri, 23 Feb 2007 16:50:32 +0000
Subject: [PATCH 095/707] - small language issue
git-svn-id: file:///svn/phpbb/trunk@7045 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/language/en/install.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php
index 1e3f8b0765..e400a1376e 100755
--- a/phpBB/language/en/install.php
+++ b/phpBB/language/en/install.php
@@ -74,7 +74,7 @@ $lang = array_merge($lang, array(
'CONVERT_INTRO_BODY' => 'From here, you are able to import data from other (installed) forum systems. The list below shows all the conversion modules currently available. If there is no convertor shown in this list for the forum software you wish to convert from, please check our website where further conversion modules may be available for download.',
'CONVERT_NEW_CONVERSION' => 'New conversion',
'CONVERT_NOT_EXIST' => 'The specified convertor does not exist',
- 'CONVERT_SETTINGS_VERIFIED' => 'The information you entered has been verified. To start the conversion progress, push the button below to begin.',
+ 'CONVERT_SETTINGS_VERIFIED' => 'The information you entered has been verified. To start the conversion process, push the button below to begin.',
'CONV_ERROR_ATTACH_FTP_DIR' => 'FTP upload for attachments is enabled at the old board. Please disable the FTP upload option and make sure a valid upload directory is specified, then copy all attachment files to this new web accessible directory. Once you have done this, restart the convertor.',
'CONV_ERROR_CONFIG_EMPTY' => 'There is no configuration information available for the conversion.',
From 7ca0e43041b90d5fc0b6c4863b8df8af47290434 Mon Sep 17 00:00:00 2001
From: David M
Date: Fri, 23 Feb 2007 16:59:24 +0000
Subject: [PATCH 096/707] #8266
git-svn-id: file:///svn/phpbb/trunk@7046 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/language/en/common.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php
index 853df84f85..4c9b956695 100644
--- a/phpBB/language/en/common.php
+++ b/phpBB/language/en/common.php
@@ -322,7 +322,7 @@ $lang = array_merge($lang, array(
'NO_ACCESS_ATTACHMENT' => 'You are not allowed to access this file.',
'NO_ACTION' => 'No action specified.',
'NO_ADMINISTRATORS' => 'No administrators assigned at this board.',
- 'NO_AUTH_ADMIN' => 'You do not have admin permissions and therefore not allowed to access the administration control panel.',
+ 'NO_AUTH_ADMIN' => 'You do not have admin permissions and are therefore not allowed to access the administration control panel.',
'NO_AUTH_ADMIN_USER_DIFFER' => 'You are not able to re-authenticate as a different user.',
'NO_AUTH_OPERATION' => 'You do not have the necessary permissions to complete this operation.',
'NO_CONNECT_TO_SMTP_HOST' => 'Could not connect to smtp host : %s : %s',
From 8d9d9d39f3880fff630d43232a52873d489f3ce7 Mon Sep 17 00:00:00 2001
From: David M
Date: Fri, 23 Feb 2007 17:41:44 +0000
Subject: [PATCH 097/707] blip
git-svn-id: file:///svn/phpbb/trunk@7047 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/language/en/common.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php
index 4c9b956695..853df84f85 100644
--- a/phpBB/language/en/common.php
+++ b/phpBB/language/en/common.php
@@ -322,7 +322,7 @@ $lang = array_merge($lang, array(
'NO_ACCESS_ATTACHMENT' => 'You are not allowed to access this file.',
'NO_ACTION' => 'No action specified.',
'NO_ADMINISTRATORS' => 'No administrators assigned at this board.',
- 'NO_AUTH_ADMIN' => 'You do not have admin permissions and are therefore not allowed to access the administration control panel.',
+ 'NO_AUTH_ADMIN' => 'You do not have admin permissions and therefore not allowed to access the administration control panel.',
'NO_AUTH_ADMIN_USER_DIFFER' => 'You are not able to re-authenticate as a different user.',
'NO_AUTH_OPERATION' => 'You do not have the necessary permissions to complete this operation.',
'NO_CONNECT_TO_SMTP_HOST' => 'Could not connect to smtp host : %s : %s',
From 48b41b73d55911f26fb12078d335eaddbc44e45f Mon Sep 17 00:00:00 2001
From: David M
Date: Fri, 23 Feb 2007 20:06:21 +0000
Subject: [PATCH 098/707] #7734
git-svn-id: file:///svn/phpbb/trunk@7048 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/adm/style/acp_language.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/phpBB/adm/style/acp_language.html b/phpBB/adm/style/acp_language.html
index 21f7347d3d..86f32a3ce5 100644
--- a/phpBB/adm/style/acp_language.html
+++ b/phpBB/adm/style/acp_language.html
@@ -125,7 +125,7 @@
width: 450px;
}
- < ![endif]-->
+
From e7c28ec5db93c4e1ebfc0c7105ded07f222e2419 Mon Sep 17 00:00:00 2001
From: David M
Date: Fri, 23 Feb 2007 23:53:49 +0000
Subject: [PATCH 099/707] #8028
git-svn-id: file:///svn/phpbb/trunk@7049 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/includes/acp/acp_ban.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/phpBB/includes/acp/acp_ban.php b/phpBB/includes/acp/acp_ban.php
index 7b9eef12ba..ea0a054d5f 100644
--- a/phpBB/includes/acp/acp_ban.php
+++ b/phpBB/includes/acp/acp_ban.php
@@ -33,7 +33,7 @@ class acp_ban
if ($bansubmit)
{
// Grab the list of entries
- $ban = request_var('ban', '');
+ $ban = request_var('ban', '', true);
$ban_len = request_var('banlength', 0);
$ban_len_other = request_var('banlengthother', '');
$ban_exclude = request_var('banexclude', 0);
From 9b33d4009dc6b12d41ff74bb428847c7e6e101c4 Mon Sep 17 00:00:00 2001
From: Meik Sievertsen
Date: Sat, 24 Feb 2007 10:20:03 +0000
Subject: [PATCH 100/707] adding @package tag which is required for all
classes.
git-svn-id: file:///svn/phpbb/trunk@7050 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/includes/acp/acp_database.php | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/phpBB/includes/acp/acp_database.php b/phpBB/includes/acp/acp_database.php
index e023e53013..1842ecd98f 100644
--- a/phpBB/includes/acp/acp_database.php
+++ b/phpBB/includes/acp/acp_database.php
@@ -409,6 +409,9 @@ class acp_database
}
}
+/**
+* @package acp
+*/
class base_extractor
{
var $fh;
@@ -549,6 +552,9 @@ class base_extractor
}
}
+/**
+* @package acp
+*/
class mysql_extractor extends base_extractor
{
function write_start($table_prefix)
@@ -851,6 +857,9 @@ class mysql_extractor extends base_extractor
}
}
+/**
+* @package acp
+*/
class sqlite_extractor extends base_extractor
{
function write_start($prefix)
@@ -987,6 +996,9 @@ class sqlite_extractor extends base_extractor
}
}
+/**
+* @package acp
+*/
class postgres_extractor extends base_extractor
{
function write_start($prefix)
@@ -1277,6 +1289,9 @@ class postgres_extractor extends base_extractor
}
}
+/**
+* @package acp
+*/
class mssql_extractor extends base_extractor
{
function write_end()
@@ -1612,6 +1627,9 @@ class mssql_extractor extends base_extractor
}
+/**
+* @package acp
+*/
class oracle_extractor extends base_extractor
{
function write_table($table_name)
@@ -1811,6 +1829,9 @@ class oracle_extractor extends base_extractor
}
}
+/**
+* @package acp
+*/
class firebird_extractor extends base_extractor
{
function write_start($prefix)
From ac317f5024289ddbb9135bbf4a9623620a69baca Mon Sep 17 00:00:00 2001
From: Meik Sievertsen
Date: Sat, 24 Feb 2007 10:28:12 +0000
Subject: [PATCH 101/707] Adjustement to the fix for bug #8274
git-svn-id: file:///svn/phpbb/trunk@7051 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/install/convertors/functions_phpbb20.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/phpBB/install/convertors/functions_phpbb20.php b/phpBB/install/convertors/functions_phpbb20.php
index 598bb46a9a..1895fb25fe 100644
--- a/phpBB/install/convertors/functions_phpbb20.php
+++ b/phpBB/install/convertors/functions_phpbb20.php
@@ -784,7 +784,7 @@ function phpbb_convert_authentication($mode)
// no break;
case 'registered_hidden':
- mass_auth('group_role', $new_forum_id, 'registered', 'FORUM_STANDARD_POLLS');
+ mass_auth('group_role', $new_forum_id, 'registered', 'FORUM_POLLS');
break;
case 'private':
From 425c55726848136303479a8be6a8aec9e71ddbac Mon Sep 17 00:00:00 2001
From: Meik Sievertsen
Date: Sat, 24 Feb 2007 11:03:41 +0000
Subject: [PATCH 102/707] do not rely on admin style for E_USER_ERROR messages
git-svn-id: file:///svn/phpbb/trunk@7052 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/includes/functions.php | 30 ++++++++++++++++++------------
1 file changed, 18 insertions(+), 12 deletions(-)
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 6d9623245a..a6826e991f 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -1586,11 +1586,11 @@ function redirect($url, $return = false)
echo '';
echo '';
echo ' ';
- echo ' ';
+ echo ' ';
echo '' . $user->lang['REDIRECT'] . ' ';
echo '';
echo '';
- echo '' . sprintf($user->lang['URL_REDIRECT'], '
', ' ') . '
';
+ echo '' . sprintf($user->lang['URL_REDIRECT'], '
', ' ') . '
';
echo '';
echo '';
@@ -1706,8 +1706,9 @@ function meta_refresh($time, $url)
$url = redirect($url, true);
+ // For XHTML compatibility we change back & to &
$template->assign_vars(array(
- 'META' => ' ')
+ 'META' => ' ')
);
}
@@ -3271,33 +3272,38 @@ function msg_handler($errno, $msg_text, $errfile, $errline)
garbage_collection();
+ // Try to not call the adm page data...
+
echo '';
echo '';
echo '';
echo ' ';
echo '' . $msg_title . ' ';
- echo ' ';
+ echo '';
echo '';
echo '';
echo '';
echo ' ';
- echo '
';
- echo '
';
- echo '
';
- echo '
';
- echo '
General Error ';
+ echo '
';
+ echo '
';
+ echo '
General Error ';
- echo '
' . $msg_text . ' ';
+ echo '
' . $msg_text . ' ';
if (!empty($config['board_contact']))
{
echo '
Please notify the board administrator or webmaster: ' . $config['board_contact'] . '
';
}
- echo '
';
- echo '
';
echo '
';
echo '
';
echo '