[MOD] Icon-uri la legenda

Locked
User avatar
GoKuSaN
Membru
Membru
Posts: 137
Joined: 6 years ago
Has thanked: 0
Been thanked: 0
Status: Offline

6 years ago

Descriere: Acest tutorial va poate ajuta sa va puneti icon-uri la legenda.

Fisiere de editat:

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
index.php,
viewonline.php,
adm/style/acp_groups.html,
includes/cache.php,
includes/functions_content.php,
includes/functions_display.php,
includes/functions_user.php,
includes/acp/acp_board.php,
includes/acp/acp_groups.php,
includes/ucp/ucp_groups.php,
language/en/common.php,
language/en/acp/common.php,
styles/prosilver/template/ucp_groups_manage.html,
styles/subsilver2/template/ucp_groups_manage.html
Fisiere de urcat:

?
1
2
root/images/group_icons/
Urcati in Images.
Inserati in SQL:

?
1
2
3
INSERT INTO phpbb_config (config_name, config_value) VALUES ('group_icons_path', 'images/group_icons');
ALTER TABLE phpbb_users ADD user_icon varchar(255) DEFAULT '' NOT NULL;
ALTER TABLE phpbb_groups ADD group_icon varchar(255) DEFAULT '' NOT NULL;
Deschideti index.php si cautati:

?
1
$sql = 'SELECT group_id, group_name, group_colour, group_type
Dupa group_name, adaugati group_icon,

Cautati:

?
1
$sql = 'SELECT g.group_id, g.group_name, g.group_colour, g.group_type
Dupa g.group_name, adaugati g.group_icon,

Cautati:

?
1
$group_name = ($row<'group_type'> == GROUP_SPECIAL) ? $user->lang<'G_' . $row<'group_name'>> : $row<'group_name'>;
Dupa adaugati:

?
1
$group_icon = (!empty($row<'group_icon'>)) ? '<img style="vertical-align: middle;" src="' . $phpbb_root_path . $config<'group_icons_path'> . '/' . $row<'group_icon'> . '" alt="' . $group_name . '" title="' . $group_name . '" /> ' : '';
Cautati:

?
1
$legend<> = '<span' . $colour_text . '>' . $group_name . '</span>';
Dupa $legend<> = adaugati $group_icon.

Cautati:

?
1
$legend<> = '<a' . $colour_text . ' href="' . append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&g=' . $row<'group_id'>) . '">' . $group_name . '</a>';
Dupa $legend<> = adaugati $group_icon.

Deschideti viewonline.php si cautati:

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Grab group details for legend display
if ($auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel'))
{
$sql = 'SELECT group_id, group_name, group_colour, group_type
FROM ' . GROUPS_TABLE . '
WHERE group_legend = 1
ORDER BY group_name ASC';
}
else
{
$sql = 'SELECT g.group_id, g.group_name, g.group_colour, g.group_type
FROM ' . GROUPS_TABLE . ' g
LEFT JOIN ' . USER_GROUP_TABLE . ' ug
ON (
g.group_id = ug.group_id
AND ug.user_id = ' . $user->data<'user_id'> . '
AND ug.user_pending = 0
)
WHERE g.group_legend = 1
AND (g.group_type <> ' . GROUP_HIDDEN . ' OR ug.user_id = ' . $user->data<'user_id'> . ')
ORDER BY g.group_name ASC';
}
$result = $db->sql_query($sql);

$legend = '';
while ($row = $db->sql_fetchrow($result))
{
if ($row<'group_name'> == 'BOTS')
{
$legend .= (($legend != '') ? ', ' : '') . '<span style="color:#' . $row<'group_colour'> . '">' . $user->lang<'G_BOTS'> . '</span>';
}
else
{
$legend .= (($legend != '') ? ', ' : '') . '<a style="color:#' . $row<'group_colour'> . '" href="' . append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&g=' . $row<'group_id'>) . '">' . (($row<'group_type'> == GROUP_SPECIAL) ? $user->lang<'G_' . $row<'group_name'>> : $row<'group_name'>) . '</a>';
}
}
$db->sql_freeresult($result);
Inlocuiti cu:

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Grab group details for legend display
if ($auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel'))
{
$sql = 'SELECT group_id, group_name, group_icon, group_colour, group_type
FROM ' . GROUPS_TABLE . '
WHERE group_legend = 1
ORDER BY group_name ASC';
}
else
{
$sql = 'SELECT g.group_id, g.group_name, g.group_icon, g.group_colour, g.group_type
FROM ' . GROUPS_TABLE . ' g
LEFT JOIN ' . USER_GROUP_TABLE . ' ug
ON (
g.group_id = ug.group_id
AND ug.user_id = ' . $user->data<'user_id'> . '
AND ug.user_pending = 0
)
WHERE g.group_legend = 1
AND (g.group_type <> ' . GROUP_HIDDEN . ' OR ug.user_id = ' . $user->data<'user_id'> . ')
ORDER BY g.group_name ASC';
}
$result = $db->sql_query($sql);

$legend = array();
while ($row = $db->sql_fetchrow($result))
{
$colour_text = ($row<'group_colour'>) ? ' style="color:#' . $row<'group_colour'> . '"' : '';
$group_name = ($row<'group_type'> == GROUP_SPECIAL) ? $user->lang<'G_' . $row<'group_name'>> : $row<'group_name'>;
$group_icon = (!empty($row<'group_icon'>)) ? '<img style="vertical-align: middle;" src="' . $phpbb_root_path . $config<'group_icons_path'> . '/' . $row<'group_icon'> . '" alt="' . $group_name . '" title="' . $group_name . '" /> ' : '';

if ($row<'group_name'> == 'BOTS' || ($user->data<'user_id'> != ANONYMOUS && !$auth->acl_get('u_viewprofile')))
{
$legend<> = $group_icon . '<span' . $colour_text . '>' . $group_name . '</span>';
}
else
{
$legend<> = $group_icon . '<a' . $colour_text . ' href="' . append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&g=' . $row<'group_id'>) . '">' . $group_name . '</a>';
}
}
$db->sql_freeresult($result);

$legend = implode(', ', $legend);
Deschideti adm/style/acp_groups.html si cautati:

?
1
<!-- IF S_EDIT -->
Dupa adaugati:

?
1
2
3
4
5
6
7
<script type="text/javascript">
// <!<CDATA<
function update_group_icon(newicon)
{
document.getElementById('icon_group').src = (newicon) ? "{GROUP_ICONS_PATH}/" + enpreURI(newicon) : "./images/spacer.gif";
}
// >>></script>
Cautati:

?
1
2
3
4
<dl>
<dt><label for="group_rank">{L_GROUP_RANK}:</label></dt>
<dd><select name="group_rank" id="group_rank">{S_RANK_OPTIONS}</select></dd>
</dl>
Inainte adaugati:

?
1
2
3
4
<dl>
<dt><label for="group_icon">{L_GROUP_ICON}:</label></dt>
<dd><select name="group_icon" id="group_icon" onchange="update_group_icon(this.options<selectedIndex>.value);">{S_FILENAME_LIST}</select> <img style="vertical-align: middle;" src="{GROUP_ICON}" id="icon_group" alt="" title="" /></dd>
</dl>
Deschideti includes/cache.php si cautati:

?
1
2
3
4
/**
* Obtain ranks
*/
function obtain_ranks()
Inainte adaugam:

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/**
* Obtain group icons
*/
function obtain_group_icons()
{
if (($group_icons = $this->get('_group_icons')) === false)
{
global $db, $user;

$sql = 'SELECT g.group_id, g.group_name, g.group_icon, g.group_type, u.user_id
FROM ' . GROUPS_TABLE . ' g
LEFT JOIN ' . USERS_TABLE . ' u
ON (g.group_id = u.group_id)';
$result = $db->sql_query($sql);

$group_icons = array();
while ($row = $db->sql_fetchrow($result))
{
if (!empty($row<'group_icon'>)){
$group_icons<$row<'user_id'>> = array(
'empty' => false,
'name' => $row<'group_name'>,
'icon' => $row<'group_icon'>
);
}else{
$group_icons<$row<'user_id'>> = array(
'empty' => true
);
}
}
$db->sql_freeresult($result);

$this->put('_group_icons', $group_icons);
}

return $group_icons;
}
Deschideti includes/functions_content.php si cautati:

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
function get_username_string($mode, $user_id, $username, $username_colour = '', $guest_username = false, $custom_profile_url = false)
{
static $_profile_cache;

// We cache some common variables we need within this function
if (empty($_profile_cache))
{
global $phpbb_root_path, $phpEx;

$_profile_cache<'base_url'> = append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u={USER_ID}');
$_profile_cache<'tpl_noprofile'> = '{USERNAME}';
$_profile_cache<'tpl_noprofile_colour'> = '<span style="color: {USERNAME_COLOUR};" class="username-coloured">{USERNAME}</span>';
$_profile_cache<'tpl_profile'> = '<a href="{PROFILE_URL}">{USERNAME}</a>';
$_profile_cache<'tpl_profile_colour'> = '<a href="{PROFILE_URL}" style="color: {USERNAME_COLOUR};" class="username-coloured">{USERNAME}</a>';
}

global $user, $auth;
Stergeti ; de la $auth; iar dupa adaugam , $config, $group_icons, $phpbb_root_path,

Cautati:

?
1
2
// Build correct username colour
$username_colour = ($username_colour) ? '#' . $username_colour : '';
Inainte adaugam:

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Get the group icon if available
if (empty($group_icons))
{
global $cache;
$group_icons = $cache->obtain_group_icons();
}

// Display the group icon with group name as legend
if (isset($group_icons<$user_id>))
{
if(!$group_icons<$user_id><'empty'>){
$group_name = (!empty($user->lang<'G_' . $group_icons<$user_id><'name'>>)) ? $user->lang<'G_' . $group_icons<$user_id><'name'>> : $group_icons<$user_id><'name'>;
$group_icon = $group_icons<$user_id><'icon'>;
$group_info = '<img style="vertical-align: middle;" src="' . $phpbb_root_path . $config<'group_icons_path'> . '/' . $group_icon . '" title="' . $group_name . '" /> ';//'" alt="' . $group_name .
}else $group_info='';

}else{
global $cache;
$cache->destroy('_group_icons');
$group_icons = $cache->obtain_group_icons();
$group_info='';
}
Cautati:

?
1
return str_replace(array('{USERNAME_COLOUR}', '{USERNAME}'), array($username_colour, $username), (!$username_colour) ? $_profile_cache<'tpl_noprofile'> : $_profile_cache<'tpl_noprofile_colour'>);
Inainte de str_replace adaugati $group_info.

Cautati:

?
1
return str_replace(array('{PROFILE_URL}', '{USERNAME_COLOUR}', '{USERNAME}'), array($profile_url, $username_colour, $username), (!$username_colour) ? $_profile_cache<'tpl_profile'> : $_profile_cache<'tpl_profile_colour'>);
Inainte de str_replace adaugati $group_info.

Deschideti includes/functions_display.php si cautati:

?
1
'SELECT' => 'm.*, u.user_colour, g.group_colour, g.group_type',
Dupa g.group_type’, adaugati g.group_icon,

Cautati:

?
1
$group_name = (($row<'group_type'> == GROUP_SPECIAL) ? $user->lang<'G_' . $row<'group_name'>> : $row<'group_name'>);
Dupa adaugati:

?
1
$group_icon = (!empty($row<'group_icon'>)) ? '<img style="vertical-align: middle;" src="' . $phpbb_root_path . $config<'group_icons_path'> . '/' . $row<'group_icon'> . '" alt="' . $group_name . '" title="' . $group_name . '" /> ' : '';
Cautati:

?
1
$forum_moderators<$f_id><> = '<span' . (($row<'group_colour'>) ? ' style="color:#' . $row<'group_colour'> . ';"' : '') . '>' . $group_name . '</span>';
Dupa $forum_moderators<$f_id><> = adaugam $group_icon.

Cautati:

?
1
$forum_moderators<$f_id><> = '<a' . (($row<'group_colour'>) ? ' style="color:#' . $row<'group_colour'> . ';"' : '') . ' href="' . append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&g=' . $row<'group_id'>) . '">' . $group_name . '</a>';
Dupa $forum_moderators<$f_id><> = adaugati $group_icon.

Deschideti includes/functions_user.php si cautati:

?
1
'group_rank' => 'int',
Inainte adaugati:

?
1
'group_icon' => 'string',
Cautati:

?
1
$user_attribute_ary = array(
Inlocuiti cu:

?
1
$user_attribute_ary = array('group_icon',
Deschideti includes/acp/acp_board.php si cautati:

?
1
'ranks_path' => array('lang' => 'RANKS_PATH', 'validate' => 'rpath', 'type' => 'text:20:255', 'explain' => true),
Dupa adaugati:

?
1
'group_icons_path' => array('lang' => 'GROUP_ICONS_PATH', 'validate' => 'rpath', 'type' => 'text:20:255', 'explain' => true),
Deschideti includes/acp/acp_groups.php si cautati:

?
1
'rank' => request_var('group_rank', 0),
Inainte adaugati:

?
1
'icon' => request_var('group_icon', ''),
Cautati:

?
1
2
3
4
5
6
7
if ((isset($submit_ary<'avatar'>) && $submit_ary<'avatar'> && (!isset($group_row<'group_avatar'>))) || $delete)
{
if (isset($group_row<'group_avatar'>) && $group_row<'group_avatar'>)
{
avatar_delete('group', $group_row, true);
}
}
Dupa adaugati:

?
1
2
3
4
if (isset($submit_ary<'icon'>) && $submit_ary<'icon'> != $group_row<'group_icon'>)
{
$cache->destroy('_group_icons');
}
Cautati:

?
1
$test_variables = array(
Dupa adaugati:

?
1
'icon' => 'string',
Cautati:

?
1
$group_rank = $submit_ary<'rank'>;
Inainte adaugati:

?
1
$group_icon = $submit_ary<'icon'>;
Cautati:

?
1
$group_rank = 0;
Inainte adaugati:

?
1
$group_icon = '';
Cautati:

?
1
$group_rank = $group_row<'group_rank'>;
Inainte adaugati:

?
1
$group_icon = $group_row<'group_icon'>;
Cautati:

?
1
2
3
4
5
$sql = 'SELECT *
FROM ' . RANKS_TABLE . '
WHERE rank_special = 1
ORDER BY rank_title';
$result = $db->sql_query($sql);
Inainte adaugati:

?
1
2
3
4
5
6
7
8
9
10
11
12
if (strlen($img) > 255)
{
continue;
}

$filename_list .= '<option value="' . htmlspecialchars($img) . '"' . $selected . '>' . $img . '</option>';
}
}
}

$filename_list = '<option value=""' . (($edit_img == '') ? ' selected="selected"' : '') . '>' . $user->lang<'SELECT_GROUP_ICON'> . '</option>' . $filename_list;
unset($existing_imgs, $imglist);
Cautati:

?
1
'S_RANK_OPTIONS' => $rank_options,
Inainte adaugati:

?
1
2
3
'GROUP_ICONS_PATH' => $phpbb_root_path . $config<'group_icons_path'>,
'GROUP_ICON' => ($edit_img) ? $phpbb_root_path . $config<'group_icons_path'> . '/' . $edit_img : $phpbb_admin_path . 'images/spacer.gif',
'S_FILENAME_LIST' => $filename_list,
Deschideti includes/ucp/ucp_groups.php si cautati:

?
1
'rank' => request_var('group_rank', 0),
Inainte adaugati:

?
1
'icon' => request_var('group_icon', ''),
Cautati:

?
1
2
3
4
5
6
7
if ((isset($submit_ary<'avatar'>) && $submit_ary<'avatar'> && (!isset($group_row<'group_avatar'>))) || $delete)
{
if (isset($group_row<'group_avatar'>) && $group_row<'group_avatar'>)
{
avatar_delete('group', $group_row, true);
}
}
Dupa adaugati:

?
1
2
3
4
if (isset($submit_ary<'icon'>) && $submit_ary<'icon'> != $group_row<'group_icon'>)
{
$cache->destroy('_group_icons');
}
Cautati:

?
1
$test_variables = array(
Dupa adaugam:

?
1
'icon' => 'string',
Cautati:

?
1
$group_rank = $submit_ary<'rank'>;
Inainte adaugam:

?
1
$group_icon = $submit_ary<'icon'>;
Cautati:

?
1
$group_rank = 0;
Inainte adaugati:

?
1
$group_icon = '';
Cautati:

?
1
$group_rank = $group_row<'group_rank'>;
Inainte adaugati:

?
1
$group_icon = $group_row<'group_icon'>;
Cautati:

?
1
2
3
4
5
$sql = 'SELECT *
FROM ' . RANKS_TABLE . '
WHERE rank_special = 1
ORDER BY rank_title';
$result = $db->sql_query($sql);
Inainte adaugati:

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// Select a group icon
include_once($phpbb_root_path . 'includes/functions_admin.' . $phpEx);

$icons = $existing_imgs = array();

$sql = 'SELECT *
FROM ' . GROUPS_TABLE . '
ORDER BY group_icon';
$result = $db->sql_query($sql);

while ($row = $db->sql_fetchrow($result))
{
$existing_imgs<> = $row<'group_icon'>;

if ($action == 'edit' && $group_id == $row<'group_id'>)
{
$icons = $row;
}
}
$db->sql_freeresult($result);

$imglist = filelist($phpbb_root_path . $config<'group_icons_path'>, '');
$edit_img = $filename_list = '';

foreach ($imglist as $path => $img_ary)
{
sort($img_ary);

foreach ($img_ary as $img)
{
$img = $path . $img;

// Do use the same icon for groups
if (!in_array($img, $existing_imgs) || $img == $group_icon)
{
if ($icons && $img == $icons<'group_icon'>)
{
$selected = ' selected="selected"';
$edit_img = $img;
}
else
{
$selected = '';
}

if (strlen($img) > 255)
{
continue;
}

$filename_list .= '<option value="' . htmlspecialchars($img) . '"' . $selected . '>' . $img . '</option>';
}
}
}

$filename_list = '<option value=""' . (($edit_img == '') ? ' selected="selected"' : '') . '>' . $user->lang<'SELECT_GROUP_ICON'> . '</option>' . $filename_list;
unset($existing_imgs, $imglist);
Cautati:

?
1
'S_RANK_OPTIONS' => $rank_options,
Inainte adaugati:

?
1
2
3
'GROUP_ICONS_PATH' => $phpbb_root_path . $config<'group_icons_path'>,
'GROUP_ICON' => ($edit_img) ? $phpbb_root_path . $config<'group_icons_path'> . '/' . $edit_img : $phpbb_root_path . 'images/spacer.gif',
'S_FILENAME_LIST' => $filename_list,
Deschideti language/en/common.php si cautati:

?
1
?>
Inainte adaugati:

?
1
2
3
4
5
// Group Icon
$lang = array_merge($lang, array(
'GROUP_ICON' => 'Group icon',
'SELECT_GROUP_ICON' => 'Select a group icon',
));
Deschideti language/en/acp/common.php si cautati:

?
1
?>
Inainte adaugati:

?
1
2
3
4
5
// Group Icons
$lang = array_merge($lang, array(
'GROUP_ICONS_PATH' => 'Group icons storage path',
'GROUP_ICONS_PATH_EXPLAIN' => 'Path under your phpBB root directory, e.g. <samp>images/group_icons</samp>.',
));
Deschideti styles/prosilver/template/ucp_groups_manage.html si cautati:

?
1
<!-- INCLUDE ucp_header.html -->
Dupa adaugati:

?
1
2
3
4
5
6
7
<script type="text/javascript">
// <!<CDATA<
function update_group_icon(newicon)
{
document.getElementById('icon_group').src = (newicon) ? "{GROUP_ICONS_PATH}/" + enpreURI(newicon) : "./images/spacer.gif";
}
// >>></script>
Cautati:

?
1
2
3
4
<dl>
<dt><label for="group_rank">{L_GROUP_RANK}:</label></dt>
<dd><select name="group_rank" id="group_rank">{S_RANK_OPTIONS}</select></dd>
</dl>
Inainte adaugati:

?
1
2
3
4
<dl>
<dt><label for="group_icon">{L_GROUP_ICON}:</label></dt>
<dd><select name="group_icon" id="group_icon" onchange="update_group_icon(this.options<selectedIndex>.value);">{S_FILENAME_LIST}</select> <img style="vertical-align: middle;" src="{GROUP_ICON}" id="icon_group" alt="" title="" /></dd>
</dl>
Deschideti styles/subsilver2/template/ucp_groups_manage.html si cautati:

?
1
<!-- INCLUDE ucp_header.html -->
Dupa adaugati:

?
1
2
3
4
5
6
7
<script type="text/javascript">
// <!<CDATA<
function update_group_icon(newicon)
{
document.getElementById('icon_group').src = (newicon) ? "{GROUP_ICONS_PATH}/" + enpreURI(newicon) : "./images/spacer.gif";
}
// >>></script>
Cautati:

?
1
2
3
4
<tr>
<td class="row1" width="35%"><label for="group_rank">{L_GROUP_RANK}:</label></td>
<td class="row2"><select name="group_rank" id="group_rank">{S_RANK_OPTIONS}</select></td>
</tr>
Inainte adaugati:

?
1
2
3
4
<tr>
<td class="row1" width="35%"><label for="group_icon">{L_GROUP_ICON}:</label></td>
<td class="row2"><select name="group_icon" id="group_icon" onchange="update_group_icon(this.options<selectedIndex>.value);">{S_FILENAME_LIST}</select> <img style="vertical-align: middle;" src="{GROUP_ICON}" id="icon_group" alt="" title="" /></td>
</tr>
Sterge-ti cache !
Refresh Template ( Sabloane ) !

Download: [downlink][Please login or register to view this link][/downlink]

Fiind un mod foarte mare recomand instalarea lui cu automod phpbb3.

Recomandam, pe aceeasi tema
Locked

Return to “Mod-uri”