Kód:
###############################################
## Hack Title: Per-User Avatar Options - Addition in ACP
## Hack Version: 1.0.0
## Author: JKeats
##
## Description: Adds an additional option to the user management screen in the ACP allowing the admin to allow or
## disallow the use of the various avatar selection options on a per-user basis.
##
## Compatibility: 2.0.6 (2.0.0 - 2.0.4 - untested)
##
## Installation Level: Moderate
## Installation Time: 10 Minutes
##
## Files To Edit: 4
## /admin/admin_users.php
## /includes/usercp_register.php
## /language/lang_english/lang_admin.php
## /templates/XXXXXX/admin/user_edit_body.tpl
##
## Included Files: 0
## None
##
## History:
## None
##
## Author Notes:
## The SQL below should be altered to meet your needs. By default, the 3 DB additions will
## be set to NO (0). However, you can change any of the 3 0's to 1's instead if you want
## the default for that option to be YES (1) instead.
##
## Support: http://www.phpbbhacks.com/forums
## Copyright: ©2003 Per-User Avatar Options - Addition in ACP 1.0.0 - JKeats
##
###############################################
## You downloaded this hack from phpBBHacks.com, the #1 source for phpBB related downloads.
## Please visit http://www.phpbbhacks.com/forums for support.
###############################################
##
###############################################
## This hack is released under the GPL License.
## This hack can be freely used, but not distributed, without permission.
## Intellectual Property is retained by the hack author(s) listed above.
###############################################
##
###############################################
## Before adding this hack to your forum you should back up all related files.
###############################################
#
#-----[ SQL ]------------------------------------------
#
ALTER TABLE phpbb_users ADD `user_allowAVgallery` tinyint(1) NOT NULL default '0';
ALTER TABLE phpbb_users ADD `user_allowAVremote` tinyint(1) NOT NULL default '0';
ALTER TABLE phpbb_users ADD `user_allowAVupload` tinyint(1) NOT NULL default '0';
#
#-----[ OPEN ]------------------------------------------
#
/admin/admin_users.php
#
#-----[ FIND ]------------------------------------------
#
$user_allowavatar = ( !empty($HTTP_POST_VARS['user_allowavatar']) ) ? intval( $HTTP_POST_VARS['user_allowavatar'] ) : 0;
#
#-----[ AFTER, ADD ]------------------------------------------
#
$user_allowAVgallery = ( !empty($HTTP_POST_VARS['user_allowAVgallery']) ) ? intval( $HTTP_POST_VARS['user_allowAVgallery'] ) : 0;
$user_allowAVremote = ( !empty($HTTP_POST_VARS['user_allowAVremote']) ) ? intval( $HTTP_POST_VARS['user_allowAVremote'] ) : 0;
$user_allowAVupload = ( !empty($HTTP_POST_VARS['user_allowAVupload']) ) ? intval( $HTTP_POST_VARS['user_allowAVupload'] ) : 0;
#
#-----[ FIND ]------------------------------------------
#
, user_allowavatar = $user_allowavatar
#
#-----[ INLINE AFTER, ADD ]------------------------------------------
#
, user_allowAVgallery = $user_allowAVgallery, user_allowAVremote = $user_allowAVremote, user_allowAVupload = $user_allowAVupload
#
#-----[ FIND ]------------------------------------------
#
$user_allowpm = $this_userdata['user_allow_pm'];
#
#-----[ AFTER, ADD ]------------------------------------------
#
$user_allowAVgallery = $this_userdata['user_allowAVgallery'];
$user_allowAVremote = $this_userdata['user_allowAVremote'];
$user_allowAVupload = $this_userdata['user_allowAVupload'];
#
#-----[ FIND ]------------------------------------------
#
$s_hidden_fields .= '<input type="hidden" name="user_rank" value="' . $user_rank . '" />';
#
#-----[ AFTER, ADD ]------------------------------------------
#
$s_hidden_fields .= '<input type="hidden" name="user_allowAVgallery" value="' . $user_allowAVgallery . '" />';
$s_hidden_fields .= '<input type="hidden" name="user_allowAVremote" value="' . $user_allowAVremote . '" />';
$s_hidden_fields .= '<input type="hidden" name="user_allowAVupload" value="' . $user_allowAVupload . '" />';
#
#-----[ FIND ]------------------------------------------
#
'ALLOW_AVATAR_YES' => ($user_allowavatar) ? 'checked="checked"' : '',
'ALLOW_AVATAR_NO' => (!$user_allowavatar) ? 'checked="checked"' : '',
#
#-----[ AFTER, ADD ]------------------------------------------
#
'ALLOW_AVGALLERY_YES' => ($user_allowAVgallery) ? 'checked="checked"' : '',
'ALLOW_AVGALLERY_NO' => (!$user_allowAVgallery) ? 'checked="checked"' : '',
'ALLOW_AVREMOTE_YES' => ($user_allowAVremote) ? 'checked="checked"' : '',
'ALLOW_AVREMOTE_NO' => (!$user_allowAVremote) ? 'checked="checked"' : '',
'ALLOW_AVUPLOAD_YES' => ($user_allowAVupload) ? 'checked="checked"' : '',
'ALLOW_AVUPLOAD_NO' => (!$user_allowAVupload) ? 'checked="checked"' : '',
#
#-----[ FIND ]------------------------------------------
#
'L_ALLOW_AVATAR' => $lang['User_allowavatar'],
#
#-----[ AFTER, ADD ]------------------------------------------
#
'L_ALLOW_AVGALLERY' => $lang['User_allowAVgallery'],
'L_ALLOW_AVREMOTE' => $lang['User_allowAVremote'],
'L_ALLOW_AVUPLOAD' => $lang['User_allowAVupload'],
#
#-----[ OPEN ]------------------------------------------
#
/includes/usercp_register.php
#
#-----[ FIND ]------------------------------------------
#
if ( $mode != 'register' )
{
if ( $userdata['user_allowavatar'] && ( $board_config['allow_avatar_upload'] || $board_config['allow_avatar_local'] || $board_config['allow_avatar_remote'] ) )
{
$template->assign_block_vars('switch_avatar_block', array() );
if ( $board_config['allow_avatar_upload'] && file_exists(@phpbb_realpath('./' . $board_config['avatar_path'])) )
{
if ( $form_enctype != '' )
{
$template->assign_block_vars('switch_avatar_block.switch_avatar_local_upload', array() );
}
$template->assign_block_vars('switch_avatar_block.switch_avatar_remote_upload', array() );
}
if ( $board_config['allow_avatar_remote'] )
{
$template->assign_block_vars('switch_avatar_block.switch_avatar_remote_link', array() );
}
if ( $board_config['allow_avatar_local'] && file_exists(@phpbb_realpath('./' . $board_config['avatar_gallery_path'])) )
{
$template->assign_block_vars('switch_avatar_block.switch_avatar_local_gallery', array() );
}
}
}
#
#-----[ REPLACE WITH ]------------------------------------------
#
if ( $mode != 'register' )
{
if ( $userdata['user_allowavatar'] && ( $board_config['allow_avatar_upload'] || $board_config['allow_avatar_local'] || $board_config['allow_avatar_remote'] ) )
{
$template->assign_block_vars('switch_avatar_block', array() );
if ( $board_config['allow_avatar_upload'] && $userdata['user_allowAVupload'] && file_exists(@phpbb_realpath('./' . $board_config['avatar_path'])) )
{
if ( $form_enctype != '' )
{
$template->assign_block_vars('switch_avatar_block.switch_avatar_local_upload', array() );
}
$template->assign_block_vars('switch_avatar_block.switch_avatar_remote_upload', array() );
}
if ( $board_config['allow_avatar_remote'] && $userdata['user_allowAVremote'] )
{
$template->assign_block_vars('switch_avatar_block.switch_avatar_remote_link', array() );
}
if ( $board_config['allow_avatar_local'] && $userdata['user_allowAVgallery'] && file_exists(@phpbb_realpath('./' . $board_config['avatar_gallery_path'])) )
{
$template->assign_block_vars('switch_avatar_block.switch_avatar_local_gallery', array() );
}
}
}
#
#-----[ OPEN ]------------------------------------------
#
/language/lang_english/lang_admin.php
#
#-----[ FIND ]------------------------------------------
#
$lang['User_allowavatar'] = 'Can display avatar';
#
#-----[ AFTER, ADD ]------------------------------------------
#
$lang['User_allowAVgallery'] = 'Can select gallery avatar';
$lang['User_allowAVremote'] = 'Can remote link an avatar';
$lang['User_allowAVupload'] = 'Can upload an avatar';
#
#-----[ OPEN ]------------------------------------------
#
/templates/XXXXXX/admin/user_edit_body.tpl
#
#-----[ FIND ]------------------------------------------
#
<tr>
<td class="row1"><span class="gen">{L_ALLOW_AVATAR}</span></td>
<td class="row2">
<input type="radio" name="user_allowavatar" value="1" {ALLOW_AVATAR_YES} />
<span class="gen">{L_YES}</span>
<input type="radio" name="user_allowavatar" value="0" {ALLOW_AVATAR_NO} />
<span class="gen">{L_NO}</span></td>
</tr>
#
#-----[ AFTER, ADD ]------------------------------------------
#
<tr>
<td class="row1"><span class="gen">{L_ALLOW_AVGALLERY}</span></td>
<td class="row2">
<input type="radio" name="user_allowAVgallery" value="1" {ALLOW_AVGALLERY_YES} />
<span class="gen">{L_YES}</span>
<input type="radio" name="user_allowAVgallery" value="0" {ALLOW_AVGALLERY_NO} />
<span class="gen">{L_NO}</span></td>
</tr>
<tr>
<td class="row1"><span class="gen">{L_ALLOW_AVREMOTE}</span></td>
<td class="row2">
<input type="radio" name="user_allowAVremote" value="1" {ALLOW_AVREMOTE_YES} />
<span class="gen">{L_YES}</span>
<input type="radio" name="user_allowAVremote" value="0" {ALLOW_AVREMOTE_NO} />
<span class="gen">{L_NO}</span></td>
</tr>
<tr>
<td class="row1"><span class="gen">{L_ALLOW_AVUPLOAD}</span></td>
<td class="row2">
<input type="radio" name="user_allowAVupload" value="1" {ALLOW_AVUPLOAD_YES} />
<span class="gen">{L_YES}</span>
<input type="radio" name="user_allowAVupload" value="0" {ALLOW_AVUPLOAD_NO} />
<span class="gen">{L_NO}</span></td>
</tr>
#
#-----[ SAVE & CLOSE ALL FILES ]------------------------------------------
#
#End