mirror of
https://github.com/phpbb/phpbb.git
synced 2025-04-21 16:22:22 +02:00
Merge branch 'develop' of https://github.com/phpbb/phpbb3 into ticket/10714
* 'develop' of https://github.com/phpbb/phpbb3: [ticket/11329] Moving colors to colours.css [ticket/9492] Fix missing phpbb_container in unit tests [ticket/9492] Fix typo in SQL query [ticket/9492] Ensure to delete the avatar/rank data when we change it [ticket/9492] Ensure to update all avatar values when the avatar is changed [ticket/9492] Fix undefined user_avatar_* values when updating the group avatar [ticket/9492] Add unit tests for custom ranks and avatars [ticket/9492] Retain custom ranks and avatars when setting users default group [ticket/11328] Replace long buttons text with short text [ticket/11328] Add language variables for buttons
This commit is contained in:
commit
d2e395b41f
@ -439,7 +439,7 @@ class acp_groups
|
||||
|
||||
foreach ($test_variables as $test => $type)
|
||||
{
|
||||
if (isset($submit_ary[$test]) && ($action == 'add' || $group_row['group_' . $test] != $submit_ary[$test] || in_array($test, $set_attributes)))
|
||||
if (isset($submit_ary[$test]) && ($action == 'add' || $group_row['group_' . $test] != $submit_ary[$test] || isset($group_attributes['group_avatar']) && strpos($test, 'avatar') === 0 || in_array($test, $set_attributes)))
|
||||
{
|
||||
settype($submit_ary[$test], $type);
|
||||
$group_attributes['group_' . $test] = $group_row['group_' . $test] = $submit_ary[$test];
|
||||
|
@ -2700,12 +2700,12 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if (isset($sql_ary['group_avatar']) && !$sql_ary['group_avatar'])
|
||||
if (isset($sql_ary['group_avatar']))
|
||||
{
|
||||
remove_default_avatar($group_id, $user_ary);
|
||||
}
|
||||
|
||||
if (isset($sql_ary['group_rank']) && !$sql_ary['group_rank'])
|
||||
if (isset($sql_ary['group_rank']))
|
||||
{
|
||||
remove_default_rank($group_id, $user_ary);
|
||||
}
|
||||
@ -3210,8 +3210,8 @@ function remove_default_avatar($group_id, $user_ids)
|
||||
user_avatar_width = 0,
|
||||
user_avatar_height = 0
|
||||
WHERE group_id = " . (int) $group_id . "
|
||||
AND user_avatar = '" . $db->sql_escape($row['group_avatar']) . "'
|
||||
AND " . $db->sql_in_set('user_id', $user_ids);
|
||||
AND user_avatar = '" . $db->sql_escape($row['group_avatar']) . "'
|
||||
AND " . $db->sql_in_set('user_id', $user_ids);
|
||||
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
@ -3248,9 +3248,9 @@ function remove_default_rank($group_id, $user_ids)
|
||||
$sql = 'UPDATE ' . USERS_TABLE . '
|
||||
SET user_rank = 0
|
||||
WHERE group_id = ' . (int)$group_id . '
|
||||
AND user_rank <> 0
|
||||
AND user_rank = ' . (int)$row['group_rank'] . '
|
||||
AND ' . $db->sql_in_set('user_id', $user_ids);
|
||||
AND user_rank <> 0
|
||||
AND user_rank = ' . (int)$row['group_rank'] . '
|
||||
AND ' . $db->sql_in_set('user_id', $user_ids);
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
|
||||
@ -3279,7 +3279,8 @@ function group_user_attributes($action, $group_id, $user_id_ary = false, $userna
|
||||
case 'demote':
|
||||
case 'promote':
|
||||
|
||||
$sql = 'SELECT user_id FROM ' . USER_GROUP_TABLE . "
|
||||
$sql = 'SELECT user_id
|
||||
FROM ' . USER_GROUP_TABLE . "
|
||||
WHERE group_id = $group_id
|
||||
AND user_pending = 1
|
||||
AND " . $db->sql_in_set('user_id', $user_id_ary);
|
||||
@ -3377,7 +3378,8 @@ function group_user_attributes($action, $group_id, $user_id_ary = false, $userna
|
||||
return 'NO_USERS';
|
||||
}
|
||||
|
||||
$sql = 'SELECT user_id, group_id FROM ' . USERS_TABLE . '
|
||||
$sql = 'SELECT user_id, group_id
|
||||
FROM ' . USERS_TABLE . '
|
||||
WHERE ' . $db->sql_in_set('user_id', $user_id_ary, false, true);
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
@ -3511,45 +3513,69 @@ function group_set_user_default($group_id, $user_id_ary, $group_attributes = fal
|
||||
}
|
||||
}
|
||||
|
||||
// Before we update the user attributes, we will make a list of those having now the group avatar assigned
|
||||
$updated_sql_ary = $sql_ary;
|
||||
|
||||
// Before we update the user attributes, we will update the rank for users that don't have a custom rank
|
||||
if (isset($sql_ary['user_rank']))
|
||||
{
|
||||
$sql = 'UPDATE ' . USERS_TABLE . '
|
||||
SET ' . $db->sql_build_array('UPDATE', array('user_rank' => $sql_ary['user_rank'])) . '
|
||||
WHERE user_rank = 0
|
||||
AND ' . $db->sql_in_set('user_id', $user_id_ary);
|
||||
$db->sql_query($sql);
|
||||
unset($sql_ary['user_rank']);
|
||||
}
|
||||
|
||||
// Before we update the user attributes, we will update the avatar for users that don't have a custom avatar
|
||||
$avatar_options = array('user_avatar', 'user_avatar_type', 'user_avatar_height', 'user_avatar_width');
|
||||
|
||||
if (isset($sql_ary['user_avatar']))
|
||||
{
|
||||
// Ok, get the original avatar data from users having an uploaded one (we need to remove these from the filesystem)
|
||||
$sql = 'SELECT user_id, group_id, user_avatar
|
||||
FROM ' . USERS_TABLE . '
|
||||
WHERE ' . $db->sql_in_set('user_id', $user_id_ary) . '
|
||||
AND user_avatar_type = ' . AVATAR_UPLOAD;
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
$avatar_sql_ary = array();
|
||||
foreach ($avatar_options as $avatar_option)
|
||||
{
|
||||
avatar_delete('user', $row);
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
unset($sql_ary['user_avatar_type']);
|
||||
unset($sql_ary['user_avatar_height']);
|
||||
unset($sql_ary['user_avatar_width']);
|
||||
if (isset($sql_ary[$avatar_option]))
|
||||
{
|
||||
$avatar_sql_ary[$avatar_option] = $sql_ary[$avatar_option];
|
||||
}
|
||||
}
|
||||
|
||||
$sql = 'UPDATE ' . USERS_TABLE . '
|
||||
SET ' . $db->sql_build_array('UPDATE', $avatar_sql_ary) . "
|
||||
WHERE user_avatar = ''
|
||||
AND " . $db->sql_in_set('user_id', $user_id_ary);
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
|
||||
$sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
|
||||
WHERE ' . $db->sql_in_set('user_id', $user_id_ary);
|
||||
$db->sql_query($sql);
|
||||
// Remove the avatar options, as we already updated them
|
||||
foreach ($avatar_options as $avatar_option)
|
||||
{
|
||||
unset($sql_ary[$avatar_option]);
|
||||
}
|
||||
|
||||
if (!empty($sql_ary))
|
||||
{
|
||||
$sql = 'UPDATE ' . USERS_TABLE . '
|
||||
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
|
||||
WHERE ' . $db->sql_in_set('user_id', $user_id_ary);
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
|
||||
if (isset($sql_ary['user_colour']))
|
||||
{
|
||||
// Update any cached colour information for these users
|
||||
$sql = 'UPDATE ' . FORUMS_TABLE . " SET forum_last_poster_colour = '" . $db->sql_escape($sql_ary['user_colour']) . "'
|
||||
$sql = 'UPDATE ' . FORUMS_TABLE . "
|
||||
SET forum_last_poster_colour = '" . $db->sql_escape($sql_ary['user_colour']) . "'
|
||||
WHERE " . $db->sql_in_set('forum_last_poster_id', $user_id_ary);
|
||||
$db->sql_query($sql);
|
||||
|
||||
$sql = 'UPDATE ' . TOPICS_TABLE . " SET topic_first_poster_colour = '" . $db->sql_escape($sql_ary['user_colour']) . "'
|
||||
$sql = 'UPDATE ' . TOPICS_TABLE . "
|
||||
SET topic_first_poster_colour = '" . $db->sql_escape($sql_ary['user_colour']) . "'
|
||||
WHERE " . $db->sql_in_set('topic_poster', $user_id_ary);
|
||||
$db->sql_query($sql);
|
||||
|
||||
$sql = 'UPDATE ' . TOPICS_TABLE . " SET topic_last_poster_colour = '" . $db->sql_escape($sql_ary['user_colour']) . "'
|
||||
$sql = 'UPDATE ' . TOPICS_TABLE . "
|
||||
SET topic_last_poster_colour = '" . $db->sql_escape($sql_ary['user_colour']) . "'
|
||||
WHERE " . $db->sql_in_set('topic_last_poster_id', $user_id_ary);
|
||||
$db->sql_query($sql);
|
||||
|
||||
@ -3561,6 +3587,9 @@ function group_set_user_default($group_id, $user_id_ary, $group_attributes = fal
|
||||
}
|
||||
}
|
||||
|
||||
// Make all values available for the event
|
||||
$sql_ary = $updated_sql_ary;
|
||||
|
||||
/**
|
||||
* Event when the default group is set for an array of users
|
||||
*
|
||||
|
@ -618,7 +618,7 @@ class ucp_groups
|
||||
|
||||
foreach ($test_variables as $test => $type)
|
||||
{
|
||||
if (isset($submit_ary[$test]) && ($action == 'add' || $group_row['group_' . $test] != $submit_ary[$test]))
|
||||
if (isset($submit_ary[$test]) && ($action == 'add' || $group_row['group_' . $test] != $submit_ary[$test] || isset($group_attributes['group_avatar']) && strpos($test, 'avatar') === 0))
|
||||
{
|
||||
settype($submit_ary[$test], $type);
|
||||
$group_attributes['group_' . $test] = $group_row['group_' . $test] = $submit_ary[$test];
|
||||
|
@ -119,6 +119,17 @@ $lang = array_merge($lang, array(
|
||||
1 => 'Users browsing this forum: %2$s and %1$d guest',
|
||||
2 => 'Users browsing this forum: %2$s and %1$d guests',
|
||||
),
|
||||
'BUTTON_EDIT' => 'Edit',
|
||||
'BUTTON_FORUM_LOCKED' => 'Locked',
|
||||
'BUTTON_NEW_TOPIC' => 'New Topic',
|
||||
'BUTTON_PM' => 'PM',
|
||||
'BUTTON_PM_FORWARD' => 'Forward',
|
||||
'BUTTON_PM_NEW' => 'New PM',
|
||||
'BUTTON_PM_REPLY' => 'Send Reply',
|
||||
'BUTTON_PM_REPLY_ALL' => 'Reply All',
|
||||
'BUTTON_POST_REPLY' => 'Post Reply',
|
||||
'BUTTON_QUOTE' => 'Quote',
|
||||
'BUTTON_TOPIC_LOCKED' => 'Locked',
|
||||
'BYTES' => 'Bytes',
|
||||
|
||||
'CANCEL' => 'Cancel',
|
||||
|
@ -8,10 +8,10 @@
|
||||
<!-- IF FOLDER_STATUS and FOLDER_MAX_MESSAGES neq 0 --><p>{FOLDER_STATUS}</p><!-- ENDIF -->
|
||||
<!-- IF U_POST_REPLY_PM or U_POST_NEW_TOPIC or U_FORWARD_PM -->
|
||||
<div class="buttons">
|
||||
<!-- IF U_POST_REPLY_PM --><div class="pmreply-icon"><a title="{L_POST_REPLY_PM}" href="{U_POST_REPLY_PM}"><span></span>{L_POST_REPLY_PM}</a></div>
|
||||
<!-- ELSEIF U_POST_NEW_TOPIC --><div class="newpm-icon"><a href="{U_POST_NEW_TOPIC}" accesskey="n" title="{L_UCP_PM_COMPOSE}"><span></span>{L_UCP_PM_COMPOSE}</a></div><!-- ENDIF -->
|
||||
<!-- IF U_FORWARD_PM --><div class="forwardpm-icon"><a title="{L_POST_FORWARD_PM}" href="{U_FORWARD_PM}"><span></span>{L_FORWARD_PM}</a></div><!-- ENDIF -->
|
||||
<!-- IF U_POST_REPLY_PM and S_PM_RECIPIENTS gt 1 --><div class="reply-all"><a title="{L_REPLY_TO_ALL}" href="{U_POST_REPLY_ALL}">{L_REPLY_TO_ALL}</a></div><!-- ENDIF -->
|
||||
<!-- IF U_POST_REPLY_PM --><div class="pmreply-icon"><a title="{L_POST_REPLY_PM}" href="{U_POST_REPLY_PM}"><span></span>{L_BUTTON_PM_REPLY}</a></div>
|
||||
<!-- ELSEIF U_POST_NEW_TOPIC --><div class="newpm-icon"><a href="{U_POST_NEW_TOPIC}" accesskey="n" title="{L_UCP_PM_COMPOSE}"><span></span>{L_BUTTON_PM_NEW}</a></div><!-- ENDIF -->
|
||||
<!-- IF U_FORWARD_PM --><div class="forwardpm-icon"><a title="{L_POST_FORWARD_PM}" href="{U_FORWARD_PM}"><span></span>{L_BUTTON_PM_FORWARD}</a></div><!-- ENDIF -->
|
||||
<!-- IF U_POST_REPLY_PM and S_PM_RECIPIENTS gt 1 --><div class="reply-all"><a title="{L_REPLY_TO_ALL}" href="{U_POST_REPLY_ALL}">{L_BUTTON_PM_REPLY_ALL}</a></div><!-- ENDIF -->
|
||||
</div>
|
||||
<!-- ENDIF -->
|
||||
|
||||
|
@ -39,7 +39,7 @@
|
||||
|
||||
<!-- IF not S_IS_BOT and S_DISPLAY_POST_INFO -->
|
||||
<div class="buttons">
|
||||
<div class="<!-- IF S_IS_LOCKED -->locked-icon<!-- ELSE -->post-icon<!-- ENDIF -->" title="<!-- IF S_IS_LOCKED -->{L_FORUM_LOCKED}<!-- ELSE -->{L_POST_TOPIC}<!-- ENDIF -->"><a href="{U_POST_NEW_TOPIC}"><span></span><!-- IF S_IS_LOCKED -->{L_FORUM_LOCKED}<!-- ELSE -->{L_POST_TOPIC}<!-- ENDIF --></a></div>
|
||||
<div class="<!-- IF S_IS_LOCKED -->locked-icon<!-- ELSE -->post-icon<!-- ENDIF -->" title="<!-- IF S_IS_LOCKED -->{L_FORUM_LOCKED}<!-- ELSE -->{L_POST_TOPIC}<!-- ENDIF -->"><a href="{U_POST_NEW_TOPIC}"><span></span><!-- IF S_IS_LOCKED -->{L_BUTTON_FORUM_LOCKED}<!-- ELSE -->{L_BUTTON_NEW_TOPIC}<!-- ENDIF --></a></div>
|
||||
</div>
|
||||
<!-- ENDIF -->
|
||||
|
||||
@ -205,7 +205,7 @@
|
||||
<div class="topic-actions">
|
||||
<!-- IF not S_IS_BOT and S_DISPLAY_POST_INFO -->
|
||||
<div class="buttons">
|
||||
<div class="<!-- IF S_IS_LOCKED -->locked-icon<!-- ELSE -->post-icon<!-- ENDIF -->" title="<!-- IF S_IS_LOCKED -->{L_FORUM_LOCKED}<!-- ELSE -->{L_POST_TOPIC}<!-- ENDIF -->"><a href="{U_POST_NEW_TOPIC}"><span></span><!-- IF S_IS_LOCKED -->{L_FORUM_LOCKED}<!-- ELSE -->{L_POST_TOPIC}<!-- ENDIF --></a></div>
|
||||
<div class="<!-- IF S_IS_LOCKED -->locked-icon<!-- ELSE -->post-icon<!-- ENDIF -->" title="<!-- IF S_IS_LOCKED -->{L_FORUM_LOCKED}<!-- ELSE -->{L_POST_TOPIC}<!-- ENDIF -->"><a href="{U_POST_NEW_TOPIC}"><span></span><!-- IF S_IS_LOCKED -->{L_BUTTON_FORUM_LOCKED}<!-- ELSE -->{L_BUTTON_NEW_TOPIC}<!-- ENDIF --></a></div>
|
||||
</div>
|
||||
<!-- ENDIF -->
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
<div class="buttons">
|
||||
<!-- IF not S_IS_BOT and S_DISPLAY_REPLY_INFO -->
|
||||
<div class="<!-- IF S_IS_LOCKED -->locked-icon<!-- ELSE -->reply-icon<!-- ENDIF -->"><a href="{U_POST_REPLY_TOPIC}" title="<!-- IF S_IS_LOCKED -->{L_TOPIC_LOCKED}<!-- ELSE -->{L_POST_REPLY}<!-- ENDIF -->"><span></span><!-- IF S_IS_LOCKED -->{L_TOPIC_LOCKED_SHORT}<!-- ELSE -->{L_POST_REPLY}<!-- ENDIF --></a></div>
|
||||
<div class="<!-- IF S_IS_LOCKED -->locked-icon<!-- ELSE -->reply-icon<!-- ENDIF -->"><a href="{U_POST_REPLY_TOPIC}" title="<!-- IF S_IS_LOCKED -->{L_TOPIC_LOCKED}<!-- ELSE -->{L_POST_REPLY}<!-- ENDIF -->"><span></span><!-- IF S_IS_LOCKED -->{L_BUTTON_TOPIC_LOCKED}<!-- ELSE -->{L_BUTTON_POST_REPLY}<!-- ENDIF --></a></div>
|
||||
<!-- ENDIF -->
|
||||
</div>
|
||||
|
||||
@ -263,7 +263,7 @@
|
||||
<div class="topic-actions">
|
||||
<div class="buttons">
|
||||
<!-- IF not S_IS_BOT and S_DISPLAY_REPLY_INFO -->
|
||||
<div class="<!-- IF S_IS_LOCKED -->locked-icon<!-- ELSE -->reply-icon<!-- ENDIF -->"><a href="{U_POST_REPLY_TOPIC}" title="<!-- IF S_IS_LOCKED -->{L_TOPIC_LOCKED}<!-- ELSE -->{L_POST_REPLY}<!-- ENDIF -->"><span></span><!-- IF S_IS_LOCKED -->{L_TOPIC_LOCKED_SHORT}<!-- ELSE -->{L_POST_REPLY}<!-- ENDIF --></a></div>
|
||||
<div class="<!-- IF S_IS_LOCKED -->locked-icon<!-- ELSE -->reply-icon<!-- ENDIF -->"><a href="{U_POST_REPLY_TOPIC}" title="<!-- IF S_IS_LOCKED -->{L_TOPIC_LOCKED}<!-- ELSE -->{L_POST_REPLY}<!-- ENDIF -->"><span></span><!-- IF S_IS_LOCKED -->{L_BUTTON_TOPIC_LOCKED}<!-- ELSE -->{L_BUTTON_POST_REPLY}<!-- ENDIF --></a></div>
|
||||
<!-- ENDIF -->
|
||||
</div>
|
||||
|
||||
|
@ -23,19 +23,11 @@
|
||||
height: 18px;
|
||||
font-size: 13px;
|
||||
white-space: nowrap;
|
||||
border: 1px solid #c7c3bf;
|
||||
border: 1px solid transparent;
|
||||
border-radius: 4px;
|
||||
background: #fff none 0 0 repeat-x;
|
||||
background-image: -moz-linear-gradient(top, #fff, #e9e9e9);
|
||||
background-image: -webkit-linear-gradient(top, #fff, #e9e9e9);
|
||||
background-image: -o-linear-gradient(top, #fff, #e9e9e9);
|
||||
background-image: linear-gradient(to bottom, #fff, #e9e9e9);
|
||||
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorStr='#ffffff', EndColorStr='#e9e9e9')";
|
||||
box-shadow: 0 0 0 1px #fff inset;
|
||||
-webkit-box-shadow: 0 0 0 1px #fff inset;
|
||||
background: transparent none 0 0 repeat-x;
|
||||
padding: 2px 22px 2px 8px;
|
||||
font-family: Verdana, Arial, Helvetica;
|
||||
color: #bc2a4d !important;
|
||||
position: relative;
|
||||
text-decoration: none !important;
|
||||
outline-style: none !important;
|
||||
@ -45,16 +37,6 @@
|
||||
|
||||
.buttons div span { display: none; }
|
||||
|
||||
.buttons div a:hover {
|
||||
border-color: #0a8ed0;
|
||||
background-image: -moz-linear-gradient(top, #e9e9e9, #fff);
|
||||
background-image: -webkit-linear-gradient(top, #e9e9e9, #fff);
|
||||
background-image: -o-linear-gradient(top, #e9e9e9, #fff);
|
||||
background-image: linear-gradient(to bottom, #e9e9e9, #fff);
|
||||
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorStr='#e9e9e9', EndColorStr='#ffffff')";
|
||||
text-shadow: 1px 1px 0 #fff, -1px -1px 0 #fff, -1px -1px 0 rgba(188, 42, 77, 0.2);
|
||||
}
|
||||
|
||||
.buttons div a:after {
|
||||
content: '';
|
||||
display: block;
|
||||
@ -64,12 +46,13 @@
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
margin-top: -6px;
|
||||
background: url("images/buttons.png") 0px 0 no-repeat;
|
||||
background: transparent 0 0 no-repeat;
|
||||
}
|
||||
|
||||
.buttons div a:hover:after {
|
||||
background-position: 0 -20px;
|
||||
}
|
||||
|
||||
/* Big button images */
|
||||
.buttons div.reply-icon a:after, .buttons div.pmreply-icon a:after { background-position: -20px 0; }
|
||||
.buttons div.reply-icon a:hover:after, .buttons div.pmreply-icon a:hover:after { background-position: -20px -20px; }
|
||||
|
@ -657,6 +657,33 @@ a.sendemail {
|
||||
background-image: url("./images/icon_sendemail.gif");
|
||||
}
|
||||
|
||||
.buttons div a {
|
||||
border-color: #C7C3BF;
|
||||
background-color: #FFFFFF;
|
||||
background-image: -moz-linear-gradient(top, #FFFFFF, #E9E9E9);
|
||||
background-image: -webkit-linear-gradient(top, #FFFFFF, #E9E9E9);
|
||||
background-image: -o-linear-gradient(top, #FFFFFF, #E9E9E9);
|
||||
background-image: linear-gradient(to bottom, #FFFFFF, #E9E9E9);
|
||||
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorStr='#FFFFFF', EndColorStr='#E9E9E9')";
|
||||
box-shadow: 0 0 0 1px #FFFFFF inset;
|
||||
-webkit-box-shadow: 0 0 0 1px #FFFFFF inset;
|
||||
color: #BC2A4D !important;
|
||||
}
|
||||
|
||||
.buttons div a:hover {
|
||||
border-color: #0a8ed0;
|
||||
background-image: -moz-linear-gradient(top, #E9E9E9, #FFFFFF);
|
||||
background-image: -webkit-linear-gradient(top, #E9E9E9, #FFFFFF);
|
||||
background-image: -o-linear-gradient(top, #E9E9E9, #FFFFFF);
|
||||
background-image: linear-gradient(to bottom, #E9E9E9, #FFFFFF);
|
||||
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorStr='#E9E9E9', EndColorStr='#FFFFFF')";
|
||||
text-shadow: 1px 1px 0 #FFFFFF, -1px -1px 0 #FFFFFF, -1px -1px 0 rgba(188, 42, 77, 0.2);
|
||||
}
|
||||
|
||||
.buttons div a:after {
|
||||
background-image: url("images/buttons.png");
|
||||
}
|
||||
|
||||
/* Icon images
|
||||
---------------------------------------- */
|
||||
.sitehome { background-image: url("./images/icon_home.gif"); }
|
||||
|
121
tests/functions_user/fixtures/group_user_attributes.xml
Normal file
121
tests/functions_user/fixtures/group_user_attributes.xml
Normal file
@ -0,0 +1,121 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<dataset>
|
||||
<table name="phpbb_groups">
|
||||
<column>group_id</column>
|
||||
<column>group_avatar</column>
|
||||
<column>group_rank</column>
|
||||
<column>group_desc</column>
|
||||
<row>
|
||||
<value>1</value>
|
||||
<value>default</value>
|
||||
<value>1</value>
|
||||
<value></value>
|
||||
</row>
|
||||
<row>
|
||||
<value>2</value>
|
||||
<value></value>
|
||||
<value>0</value>
|
||||
<value></value>
|
||||
</row>
|
||||
<row>
|
||||
<value>3</value>
|
||||
<value>default2</value>
|
||||
<value>3</value>
|
||||
<value></value>
|
||||
</row>
|
||||
</table>
|
||||
<table name="phpbb_users">
|
||||
<column>user_id</column>
|
||||
<column>group_id</column>
|
||||
<column>user_avatar</column>
|
||||
<column>user_rank</column>
|
||||
<column>username_clean</column>
|
||||
<column>user_permissions</column>
|
||||
<column>user_sig</column>
|
||||
<column>user_occ</column>
|
||||
<column>user_interests</column>
|
||||
<row>
|
||||
<value>1</value>
|
||||
<value>1</value>
|
||||
<value></value>
|
||||
<value>0</value>
|
||||
<value>barfoo</value>
|
||||
<value></value>
|
||||
<value></value>
|
||||
<value></value>
|
||||
<value></value>
|
||||
</row>
|
||||
<row>
|
||||
<value>2</value>
|
||||
<value>1</value>
|
||||
<value>default</value>
|
||||
<value>1</value>
|
||||
<value>foobar</value>
|
||||
<value></value>
|
||||
<value></value>
|
||||
<value></value>
|
||||
<value></value>
|
||||
</row>
|
||||
<row>
|
||||
<value>3</value>
|
||||
<value>1</value>
|
||||
<value>custom</value>
|
||||
<value>2</value>
|
||||
<value>bertie</value>
|
||||
<value></value>
|
||||
<value></value>
|
||||
<value></value>
|
||||
<value></value>
|
||||
</row>
|
||||
</table>
|
||||
<table name="phpbb_user_group">
|
||||
<column>user_id</column>
|
||||
<column>group_id</column>
|
||||
<column>user_pending</column>
|
||||
<row>
|
||||
<value>1</value>
|
||||
<value>1</value>
|
||||
<value>0</value>
|
||||
</row>
|
||||
<row>
|
||||
<value>1</value>
|
||||
<value>2</value>
|
||||
<value>0</value>
|
||||
</row>
|
||||
<row>
|
||||
<value>1</value>
|
||||
<value>3</value>
|
||||
<value>0</value>
|
||||
</row>
|
||||
<row>
|
||||
<value>2</value>
|
||||
<value>1</value>
|
||||
<value>0</value>
|
||||
</row>
|
||||
<row>
|
||||
<value>2</value>
|
||||
<value>2</value>
|
||||
<value>0</value>
|
||||
</row>
|
||||
<row>
|
||||
<value>2</value>
|
||||
<value>3</value>
|
||||
<value>0</value>
|
||||
</row>
|
||||
<row>
|
||||
<value>3</value>
|
||||
<value>1</value>
|
||||
<value>0</value>
|
||||
</row>
|
||||
<row>
|
||||
<value>3</value>
|
||||
<value>2</value>
|
||||
<value>0</value>
|
||||
</row>
|
||||
<row>
|
||||
<value>3</value>
|
||||
<value>3</value>
|
||||
<value>0</value>
|
||||
</row>
|
||||
</table>
|
||||
</dataset>
|
156
tests/functions_user/group_user_attributes_test.php
Normal file
156
tests/functions_user/group_user_attributes_test.php
Normal file
@ -0,0 +1,156 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package testing
|
||||
* @copyright (c) 2008 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
|
||||
require_once dirname(__FILE__) . '/../../phpBB/includes/functions_user.php';
|
||||
require_once dirname(__FILE__) . '/../../phpBB/includes/utf/utf_tools.php';
|
||||
|
||||
class phpbb_functions_user_group_user_attributes_test extends phpbb_database_test_case
|
||||
{
|
||||
public function getDataSet()
|
||||
{
|
||||
return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/group_user_attributes.xml');
|
||||
}
|
||||
|
||||
public function group_user_attributes_data()
|
||||
{
|
||||
return array(
|
||||
array(
|
||||
'Setting new default group without settings for user with no settings - no change',
|
||||
1,
|
||||
2,
|
||||
array(
|
||||
'group_avatar' => '',
|
||||
'group_avatar_type' => 0,
|
||||
'group_avatar_height' => 0,
|
||||
'group_avatar_width' => 0,
|
||||
'group_rank' => 0,
|
||||
),
|
||||
array(
|
||||
'user_avatar' => '',
|
||||
'user_rank' => 0,
|
||||
),
|
||||
),
|
||||
array(
|
||||
'Setting new default group without settings for user with default settings - user settings overwritten',
|
||||
2,
|
||||
2,
|
||||
array(
|
||||
'group_avatar' => '',
|
||||
'group_avatar_type' => 0,
|
||||
'group_avatar_height' => 0,
|
||||
'group_avatar_width' => 0,
|
||||
'group_rank' => 0,
|
||||
),
|
||||
array(
|
||||
'user_avatar' => '',
|
||||
'user_rank' => 0,
|
||||
),
|
||||
),
|
||||
array(
|
||||
'Setting new default group without settings for user with custom settings - no change',
|
||||
3,
|
||||
2,
|
||||
array(
|
||||
'group_avatar' => '',
|
||||
'group_avatar_type' => 0,
|
||||
'group_avatar_height' => 0,
|
||||
'group_avatar_width' => 0,
|
||||
'group_rank' => 0,
|
||||
),
|
||||
array(
|
||||
'user_avatar' => 'custom',
|
||||
'user_rank' => 2,
|
||||
),
|
||||
),
|
||||
array(
|
||||
'Setting new default group with settings for user with no settings - user settings overwritten',
|
||||
1,
|
||||
3,
|
||||
array(
|
||||
'group_avatar' => 'default2',
|
||||
'group_avatar_type' => 1,
|
||||
'group_avatar_height' => 1,
|
||||
'group_avatar_width' => 1,
|
||||
'group_rank' => 3,
|
||||
),
|
||||
array(
|
||||
'user_avatar' => 'default2',
|
||||
'user_rank' => 3,
|
||||
),
|
||||
),
|
||||
array(
|
||||
'Setting new default group with settings for user with default settings - user settings overwritten',
|
||||
2,
|
||||
3,
|
||||
array(
|
||||
'group_avatar' => 'default2',
|
||||
'group_avatar_type' => 1,
|
||||
'group_avatar_height' => 1,
|
||||
'group_avatar_width' => 1,
|
||||
'group_rank' => 3,
|
||||
),
|
||||
array(
|
||||
'user_avatar' => 'default2',
|
||||
'user_rank' => 3,
|
||||
),
|
||||
),
|
||||
array(
|
||||
'Setting new default group with settings for user with custom settings - no change',
|
||||
3,
|
||||
3,
|
||||
array(
|
||||
'group_avatar' => 'default2',
|
||||
'group_avatar_type' => 1,
|
||||
'group_avatar_height' => 1,
|
||||
'group_avatar_width' => 1,
|
||||
'group_rank' => 3,
|
||||
),
|
||||
array(
|
||||
'user_avatar' => 'custom',
|
||||
'user_rank' => 2,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider group_user_attributes_data
|
||||
*/
|
||||
public function test_group_user_attributes($description, $user_id, $group_id, $group_row, $expected)
|
||||
{
|
||||
global $auth, $cache, $db, $phpbb_dispatcher, $user, $phpbb_container;
|
||||
|
||||
$user->ip = '';
|
||||
$cache = new phpbb_mock_cache;
|
||||
$db = $this->new_dbal();
|
||||
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
|
||||
$auth = $this->getMock('phpbb_auth');
|
||||
$auth->expects($this->any())
|
||||
->method('acl_clear_prefetch');
|
||||
$cache_driver = new phpbb_cache_driver_null();
|
||||
$phpbb_container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
|
||||
$phpbb_container
|
||||
->expects($this->any())
|
||||
->method('get')
|
||||
->with('cache.driver')
|
||||
->will($this->returnValue($cache_driver));
|
||||
|
||||
group_user_attributes('default', $group_id, array($user_id), false, 'group_name', $group_row);
|
||||
|
||||
$sql = 'SELECT user_avatar, user_rank
|
||||
FROM ' . USERS_TABLE . '
|
||||
WHERE user_id = ' . $user_id;
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$this->assertEquals(array($expected), $db->sql_fetchrowset($result));
|
||||
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user