aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions_convert.php
diff options
context:
space:
mode:
authorNils Adermann <naderman@naderman.de>2010-03-02 01:05:36 +0100
committerNils Adermann <naderman@naderman.de>2010-03-02 01:05:36 +0100
commit75e7ffc317af7ad5b7a420a53115caaa66d3a942 (patch)
tree643b59585bc706acf1c0260dd262f26e52de06c0 /phpBB/includes/functions_convert.php
parent1ceddd9eeccde56ab307631a16e40b943eac883a (diff)
parente02e530204a31c7723a73cbfcdba0d6132b1a175 (diff)
downloadforums-75e7ffc317af7ad5b7a420a53115caaa66d3a942.tar
forums-75e7ffc317af7ad5b7a420a53115caaa66d3a942.tar.gz
forums-75e7ffc317af7ad5b7a420a53115caaa66d3a942.tar.bz2
forums-75e7ffc317af7ad5b7a420a53115caaa66d3a942.tar.xz
forums-75e7ffc317af7ad5b7a420a53115caaa66d3a942.zip
Merge commit 'release-3.0-RC4'
Diffstat (limited to 'phpBB/includes/functions_convert.php')
-rw-r--r--phpBB/includes/functions_convert.php45
1 files changed, 25 insertions, 20 deletions
diff --git a/phpBB/includes/functions_convert.php b/phpBB/includes/functions_convert.php
index 4037fb4872..159ec387bd 100644
--- a/phpBB/includes/functions_convert.php
+++ b/phpBB/includes/functions_convert.php
@@ -224,13 +224,15 @@ function make_uid($timestamp)
*/
function validate_website($url)
{
- if ($url === 'http://'){
+ if ($url === 'http://')
+ {
return '';
}
else if (strpos(strtolower($url), 'http://') !== 0)
{
return 'http://' . $url;
}
+ return $url;
}
/**
@@ -1479,18 +1481,21 @@ function mass_auth($ug_type, $forum_id, $ug_id, $acl_list, $setting = ACL_NO)
// Role based permissions are the simplest to handle so check for them first
if ($ug_type == 'user_role' || $ug_type == 'group_role')
{
- $sql = 'SELECT role_id
- FROM ' . ACL_ROLES_TABLE . "
- WHERE role_name = 'ROLE_" . $db->sql_escape($acl_list) . "'";
- $result = $db->sql_query_limit($sql, 1);
- $row = $db->sql_fetchrow($result);
- $db->sql_freeresult($result);
-
- // If we have no role id there is something wrong here
- if ($row)
+ if (is_numeric($forum_id))
{
- $sql = "INSERT INTO $table ($id_field, forum_id, auth_role_id) VALUES ($ug_id, $forum_id, " . $row['role_id'] . ')';
- $db->sql_query($sql);
+ $sql = 'SELECT role_id
+ FROM ' . ACL_ROLES_TABLE . "
+ WHERE role_name = 'ROLE_" . $db->sql_escape($acl_list) . "'";
+ $result = $db->sql_query_limit($sql, 1);
+ $row = $db->sql_fetchrow($result);
+ $db->sql_freeresult($result);
+
+ // If we have no role id there is something wrong here
+ if ($row)
+ {
+ $sql = "INSERT INTO $table ($id_field, forum_id, auth_role_id) VALUES ($ug_id, $forum_id, " . $row['role_id'] . ')';
+ $db->sql_query($sql);
+ }
}
return;
@@ -1540,7 +1545,7 @@ function mass_auth($ug_type, $forum_id, $ug_id, $acl_list, $setting = ACL_NO)
$db->sql_freeresult($result);
}
- $sql_forum = 'AND a.forum_id IN (' . implode(', ', array_map('intval', $forum_id)) . ')';
+ $sql_forum = 'AND ' . $db->sql_in_set('a.forum_id', array_map('intval', $forum_id), false, true);
$sql = ($ug_type == 'user') ? 'SELECT o.auth_option_id, o.auth_option, a.forum_id, a.auth_setting FROM ' . ACL_USERS_TABLE . ' a, ' . ACL_OPTIONS_TABLE . " o WHERE a.auth_option_id = o.auth_option_id $sql_forum AND a.user_id = $ug_id" : 'SELECT o.auth_option_id, o.auth_option, a.forum_id, a.auth_setting FROM ' . ACL_GROUPS_TABLE . ' a, ' . ACL_OPTIONS_TABLE . " o WHERE a.auth_option_id = o.auth_option_id $sql_forum AND a.group_id = $ug_id";
$result = $db->sql_query($sql);
@@ -1682,8 +1687,8 @@ function add_default_groups()
);
$sql = 'SELECT *
- FROM ' . GROUPS_TABLE . "
- WHERE group_name IN ('" . implode("', '", array_keys($default_groups)) . "')";
+ FROM ' . GROUPS_TABLE . '
+ WHERE ' . $db->sql_in_set('group_name', array_keys($default_groups));
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
@@ -1702,9 +1707,9 @@ function add_default_groups()
'group_desc_uid' => '',
'group_desc_bitfield' => '',
'group_type' => GROUP_SPECIAL,
- 'group_colour' => $data[0],
- 'group_legend' => $data[1],
- 'group_founder_manage' => $data[2]
+ 'group_colour' => (string) $data[0],
+ 'group_legend' => (int) $data[1],
+ 'group_founder_manage' => (int) $data[2]
);
}
@@ -2060,7 +2065,7 @@ function fix_empty_primary_groups()
if (sizeof($user_ids))
{
$db->sql_query('UPDATE ' . USERS_TABLE . ' SET group_id = ' . get_group_id('administrators') . '
- WHERE group_id = 0 AND user_id IN (' . implode(', ', $user_ids) . ')');
+ WHERE group_id = 0 AND ' . $db->sql_in_set('user_id', $user_ids));
}
$sql = 'SELECT user_id FROM ' . USER_GROUP_TABLE . ' WHERE group_id = ' . get_group_id('global_moderators');
@@ -2075,7 +2080,7 @@ function fix_empty_primary_groups()
if (sizeof($user_ids))
{
$db->sql_query('UPDATE ' . USERS_TABLE . ' SET group_id = ' . get_group_id('global_moderators') . '
- WHERE group_id = 0 AND user_id IN (' . implode(', ', $user_ids) . ')');
+ WHERE group_id = 0 AND ' . $db->sql_in_set('user_id', $user_ids));
}
// Set user colour