[gh/113] Update UMIL to 1.0.5
B3P-GH-113
This commit is contained in:
@@ -4,9 +4,8 @@
|
||||
* @author Nathan Guse (EXreaction) http://lithiumstudios.org
|
||||
* @author David Lewis (Highway of Life) highwayoflife@gmail.com
|
||||
* @package umil
|
||||
* @version $Id$
|
||||
* @copyright (c) 2008 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -18,7 +17,7 @@ if (!defined('IN_PHPBB'))
|
||||
exit;
|
||||
}
|
||||
|
||||
define('UMIL_VERSION', '1.0.4');
|
||||
define('UMIL_VERSION', '1.0.5');
|
||||
|
||||
/**
|
||||
* Multicall instructions
|
||||
@@ -199,7 +198,7 @@ class umil
|
||||
|
||||
// Check to see if a newer version is available.
|
||||
$info = $this->version_check('version.phpbb.com', '/umil', ((defined('PHPBB_QA')) ? 'umil_qa.txt' : 'umil.txt'));
|
||||
if (is_array($info) && isset($info[0]) && isset($info[1]))
|
||||
if (is_array($info) && isset($info[0]) && isset($info[1]) && defined('DEBUG'))
|
||||
{
|
||||
if (version_compare(UMIL_VERSION, $info[0], '<'))
|
||||
{
|
||||
@@ -572,7 +571,7 @@ class umil
|
||||
}
|
||||
|
||||
$style_id = (int) $style_id;
|
||||
$type = (string) $type; // Prevent PHP bug.
|
||||
$type = (is_array($type)) ? '' : strval($type); // only pass strings to switch()
|
||||
|
||||
switch ($type)
|
||||
{
|
||||
@@ -1518,6 +1517,12 @@ class umil
|
||||
*/
|
||||
function permission_exists($auth_option, $global = true)
|
||||
{
|
||||
// forum permissions shouldn't be set globally
|
||||
if (strpos($auth_option, 'f_') === 0)
|
||||
{
|
||||
$global = false;
|
||||
}
|
||||
|
||||
if ($global)
|
||||
{
|
||||
$type_sql = ' AND is_global = 1';
|
||||
@@ -1564,6 +1569,12 @@ class umil
|
||||
|
||||
$this->umil_start('PERMISSION_ADD', $auth_option);
|
||||
|
||||
// forum permissions shouldn't be set globally
|
||||
if (strpos($auth_option, 'f_') === 0)
|
||||
{
|
||||
$global = false;
|
||||
}
|
||||
|
||||
if ($this->permission_exists($auth_option, $global))
|
||||
{
|
||||
return $this->umil_end('PERMISSION_ALREADY_EXISTS', $auth_option);
|
||||
@@ -1629,6 +1640,12 @@ class umil
|
||||
|
||||
$this->umil_start('PERMISSION_REMOVE', $auth_option);
|
||||
|
||||
// forum permissions shouldn't be set globally
|
||||
if (strpos($auth_option, 'f_') === 0)
|
||||
{
|
||||
$global = false;
|
||||
}
|
||||
|
||||
if (!$this->permission_exists($auth_option, $global))
|
||||
{
|
||||
return $this->umil_end('PERMISSION_NOT_EXIST', $auth_option);
|
||||
@@ -2552,7 +2569,7 @@ class umil
|
||||
|
||||
// A list of types being unsigned for better reference in some db's
|
||||
$unsigned_types = array('UINT', 'UINT:', 'USINT', 'BOOL', 'TIMESTAMP');
|
||||
$supported_dbms = array('firebird', 'mssql', 'mysql_40', 'mysql_41', 'oracle', 'postgres', 'sqlite');
|
||||
$supported_dbms = array('firebird', 'mssql', 'mssqlnative', 'mysql_40', 'mysql_41', 'oracle', 'postgres', 'sqlite');
|
||||
|
||||
$sql = '';
|
||||
|
||||
@@ -2571,6 +2588,7 @@ class umil
|
||||
break;
|
||||
|
||||
case 'mssql':
|
||||
case 'mssqlnative':
|
||||
$sql .= "CREATE TABLE [{$table_name}] (\n";
|
||||
break;
|
||||
}
|
||||
@@ -2709,6 +2727,7 @@ class umil
|
||||
break;
|
||||
|
||||
case 'mssql':
|
||||
case 'mssqlnative':
|
||||
if ($column_type == '[text]')
|
||||
{
|
||||
$textimage = true;
|
||||
@@ -2788,6 +2807,7 @@ class umil
|
||||
break;
|
||||
|
||||
case 'mssql':
|
||||
case 'mssqlnative':
|
||||
$sql = substr($sql, 0, -2);
|
||||
$sql .= "\n) ON [PRIMARY]" . (($textimage) ? ' TEXTIMAGE_ON [PRIMARY]' : '') . "\n";
|
||||
$sql .= "GO\n\n";
|
||||
@@ -2822,6 +2842,7 @@ class umil
|
||||
break;
|
||||
|
||||
case 'mssql':
|
||||
case 'mssqlnative':
|
||||
$sql .= "ALTER TABLE [{$table_name}] WITH NOCHECK ADD \n";
|
||||
$sql .= "\tCONSTRAINT [PK_{$table_name}] PRIMARY KEY CLUSTERED \n";
|
||||
$sql .= "\t(\n";
|
||||
@@ -2914,6 +2935,7 @@ class umil
|
||||
break;
|
||||
|
||||
case 'mssql':
|
||||
case 'mssqlnative':
|
||||
$sql .= ($key_data[0] == 'INDEX') ? 'CREATE INDEX' : '';
|
||||
$sql .= ($key_data[0] == 'UNIQUE') ? 'CREATE UNIQUE INDEX' : '';
|
||||
$sql .= " [{$key_name}] ON [{$table_name}]([" . implode('], [', $key_data[1]) . "]) ON [PRIMARY]\n";
|
||||
@@ -3029,7 +3051,19 @@ class umil
|
||||
*/
|
||||
if (!preg_match('#^' . preg_quote($table_prefix, '#') . '#', $table_name) || !in_array($table_name, $constants, true))
|
||||
{
|
||||
$table_name = preg_replace('#^phpbb_#i', $table_prefix, $table_name);
|
||||
if ((strpos($table_name, $table_prefix) === 0) && (strlen($table_name) > strlen($table_prefix)))
|
||||
{
|
||||
/**
|
||||
* Do not replace phpbb_ with the prefix, if it is already at the beginning.
|
||||
* Otherwise we would replace the prefix "phpbb_umil" multiple times and
|
||||
* end up with phpbb_umilumilumil_tablename, if the constant is not defined.
|
||||
* See Bug #62646.
|
||||
*/
|
||||
}
|
||||
else
|
||||
{
|
||||
$table_name = preg_replace('#^phpbb_#i', $table_prefix, $table_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user