1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-01 14:30:32 +02:00

[ticket/9574] Remove conditional PHP<5.2 code

There is a large amount of conditional code for PHP < 5.2 that can be
removed with phpBB 3.1.

PHPBB3-9574
This commit is contained in:
Igor Wiedler
2010-06-25 13:31:31 +02:00
parent 1e59666ee3
commit eda9fbbb63
10 changed files with 33 additions and 137 deletions

View File

@@ -318,14 +318,11 @@ class acp_bbcodes
$utf8 = strpos($bbcode_match, 'INTTEXT') !== false;
// make sure we have utf8 support
// PHP may not be linked with the bundled PCRE lib and instead with an older version
$utf8_pcre_properties = false;
if (version_compare(PHP_VERSION, '5.1.0', '>=') || (version_compare(PHP_VERSION, '5.0.0-dev', '<=') && version_compare(PHP_VERSION, '4.4.0', '>=')))
if (@preg_match('/\p{L}/u', 'a') !== false)
{
// While this is the proper range of PHP versions, PHP may not be linked with the bundled PCRE lib and instead with an older version
if (@preg_match('/\p{L}/u', 'a') !== false)
{
$utf8_pcre_properties = true;
}
$utf8_pcre_properties = true;
}
$fp_match = preg_quote($bbcode_match, '!');

View File

@@ -1007,43 +1007,8 @@ class sqlite_extractor extends base_extractor
function write_data($table_name)
{
global $db;
static $proper;
if (is_null($proper))
{
$proper = version_compare(PHP_VERSION, '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];
}
}
$col_types = sqlite_fetch_column_types($db->db_connect_id, $table_name);
$sql = "SELECT *
FROM $table_name";