aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2009-07-14 20:25:41 +0000
committerJoas Schilling <nickvergessen@gmx.de>2009-07-14 20:25:41 +0000
commit0b2979c6bab97297f839937606635fd4cc6b1eae (patch)
tree592bd29d82cda1d1607b0a12ad6f598c32b1213b
parent753b8bb0bb6f6c8398189be451cc5095759c1e3e (diff)
downloadforums-0b2979c6bab97297f839937606635fd4cc6b1eae.tar
forums-0b2979c6bab97297f839937606635fd4cc6b1eae.tar.gz
forums-0b2979c6bab97297f839937606635fd4cc6b1eae.tar.bz2
forums-0b2979c6bab97297f839937606635fd4cc6b1eae.tar.xz
forums-0b2979c6bab97297f839937606635fd4cc6b1eae.zip
Feature Bug #45375 - Add option to disable remote upload avatars
Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9757 89ea8834-ac86-4346-8a33-228a782c2dd0
-rw-r--r--phpBB/adm/style/acp_users_avatar.html4
-rw-r--r--phpBB/docs/CHANGELOG.html1
-rw-r--r--phpBB/includes/acp/acp_board.php1
-rw-r--r--phpBB/includes/acp/acp_users.php9
-rw-r--r--phpBB/includes/ucp/ucp_groups.php14
-rw-r--r--phpBB/includes/ucp/ucp_profile.php10
-rw-r--r--phpBB/install/database_update.php12
-rw-r--r--phpBB/install/schemas/schema_data.sql1
-rw-r--r--phpBB/language/en/acp/board.php2
-rw-r--r--phpBB/styles/prosilver/template/ucp_avatar_options.html12
-rw-r--r--phpBB/styles/subsilver2/template/ucp_groups_manage.html6
11 files changed, 50 insertions, 22 deletions
diff --git a/phpBB/adm/style/acp_users_avatar.html b/phpBB/adm/style/acp_users_avatar.html
index 20b5b60050..deed41e16e 100644
--- a/phpBB/adm/style/acp_users_avatar.html
+++ b/phpBB/adm/style/acp_users_avatar.html
@@ -8,11 +8,13 @@
<dd><label><input type="checkbox" class="radio" name="delete" /> {L_DELETE_AVATAR}</label></dd>
</dl>
<!-- IF not S_IN_AVATAR_GALLERY -->
- <!-- IF S_CAN_UPLOAD -->
+ <!-- IF S_UPLOAD_FILE -->
<dl>
<dt><label for="uploadfile">{L_UPLOAD_AVATAR_FILE}:</label></dt>
<dd><input type="hidden" name="MAX_FILE_SIZE" value="{AVATAR_MAX_FILESIZE}" /><input type="file" id="uploadfile" name="uploadfile" /></dd>
</dl>
+ <!-- ENDIF -->
+ <!-- IF S_REMOTE_UPLOAD -->
<dl>
<dt><label for="uploadurl">{L_UPLOAD_AVATAR_URL}:</label><br /><span>{L_UPLOAD_AVATAR_URL_EXPLAIN}</span></dt>
<dd><input name="uploadurl" type="text" id="uploadurl" value="" /></dd>
diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html
index cc43d4b9cb..7fdbc5ac00 100644
--- a/phpBB/docs/CHANGELOG.html
+++ b/phpBB/docs/CHANGELOG.html
@@ -198,6 +198,7 @@
<li>[Feature] Add bare-bones quick-reply editor to viewtopic.</li>
<li>[Feature] Detect when a post has been altered by someone else while editing. (Patch by bantu)</li>
<li>[Feature] Add unread posts quick search option (Bug #46765 - Patch by rxu)</li>
+ <li>[Feature] Add option to disable remote upload avatars (Bug #45375 - Patch by nickvergessen)</li>
</ul>
<a name="v304"></a><h3>1.ii. Changes since 3.0.4</h3>
diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php
index 008594a319..a4a2572c0f 100644
--- a/phpBB/includes/acp/acp_board.php
+++ b/phpBB/includes/acp/acp_board.php
@@ -117,6 +117,7 @@ class acp_board
'allow_avatar_local' => array('lang' => 'ALLOW_LOCAL', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
'allow_avatar_remote' => array('lang' => 'ALLOW_REMOTE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
'allow_avatar_upload' => array('lang' => 'ALLOW_UPLOAD', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
+ 'allow_avatar_remote_upload'=> array('lang' => 'ALLOW_REMOTE_UPLOAD', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
'avatar_filesize' => array('lang' => 'MAX_FILESIZE', 'validate' => 'int:0', 'type' => 'text:4:10', 'explain' => true, 'append' => ' ' . $user->lang['BYTES']),
'avatar_min' => array('lang' => 'MIN_AVATAR_SIZE', 'validate' => 'int:0', 'type' => 'dimension:3:4', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']),
'avatar_max' => array('lang' => 'MAX_AVATAR_SIZE', 'validate' => 'int:0', 'type' => 'dimension:3:4', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']),
diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php
index c663103e17..1cd7a405d5 100644
--- a/phpBB/includes/acp/acp_users.php
+++ b/phpBB/includes/acp/acp_users.php
@@ -1484,10 +1484,11 @@ class acp_users
$template->assign_vars(array(
'S_AVATAR' => true,
- 'S_CAN_UPLOAD' => ($can_upload && $config['allow_avatar_upload']) ? true : false,
- 'S_ALLOW_REMOTE' => ($config['allow_avatar_remote']) ? true : false,
- 'S_DISPLAY_GALLERY' => ($config['allow_avatar_local'] && !$display_gallery) ? true : false,
- 'S_IN_GALLERY' => ($config['allow_avatar_local'] && $display_gallery) ? true : false,
+ 'S_UPLOAD_FILE' => ($config['allow_avatar'] && $can_upload && $config['allow_avatar_upload']) ? true : false,
+ 'S_REMOTE_UPLOAD' => ($config['allow_avatar'] && $can_upload && $config['allow_avatar_remote_upload']) ? true : false,
+ 'S_ALLOW_REMOTE' => ($config['allow_avatar'] && $config['allow_avatar_remote']) ? true : false,
+ 'S_DISPLAY_GALLERY' => ($config['allow_avatar'] && $config['allow_avatar_local'] && !$display_gallery) ? true : false,
+ 'S_IN_GALLERY' => ($config['allow_avatar'] && $config['allow_avatar_local'] && $display_gallery) ? true : false,
'AVATAR_IMAGE' => $avatar_img,
'AVATAR_MAX_FILESIZE' => $config['avatar_filesize'],
diff --git a/phpBB/includes/ucp/ucp_groups.php b/phpBB/includes/ucp/ucp_groups.php
index 3f27f093ec..8aba34c733 100644
--- a/phpBB/includes/ucp/ucp_groups.php
+++ b/phpBB/includes/ucp/ucp_groups.php
@@ -688,24 +688,28 @@ class ucp_groups
$display_gallery = (isset($_POST['display_gallery'])) ? true : false;
- if ($config['allow_avatar_local'] && $display_gallery)
+ if ($config['allow_avatar'] && $config['allow_avatar_local'] && $display_gallery)
{
avatar_gallery($category, $avatar_select, 4);
}
- $avatars_enabled = ($can_upload || ($config['allow_avatar_local'] || $config['allow_avatar_remote'])) ? true : false;
+ $avatars_enabled = ($config['allow_avatar'] && (($can_upload && ($config['allow_avatar_upload'] || $config['allow_avatar_remote_upload'])) || ($config['allow_avatar_local'] || $config['allow_avatar_remote']))) ? true : false;
$template->assign_vars(array(
'S_EDIT' => true,
'S_INCLUDE_SWATCH' => true,
- 'S_CAN_UPLOAD' => $can_upload,
- 'S_FORM_ENCTYPE' => ($can_upload) ? ' enctype="multipart/form-data"' : '',
+ 'S_FORM_ENCTYPE' => ($config['allow_avatar'] && $can_upload && ($config['allow_avatar_upload'] || $config['allow_avatar_remote_upload'])) ? ' enctype="multipart/form-data"' : '',
'S_ERROR' => (sizeof($error)) ? true : false,
'S_SPECIAL_GROUP' => ($group_type == GROUP_SPECIAL) ? true : false,
'S_AVATARS_ENABLED' => $avatars_enabled,
- 'S_DISPLAY_GALLERY' => ($config['allow_avatar_local'] && !$display_gallery) ? true : false,
+ 'S_DISPLAY_GALLERY' => ($config['allow_avatar'] && $config['allow_avatar_local'] && !$display_gallery) ? true : false,
'S_IN_GALLERY' => ($config['allow_avatar_local'] && $display_gallery) ? true : false,
+ 'S_UPLOAD_AVATAR_FILE' => ($config['allow_avatar'] && $config['allow_avatar_upload'] && $can_upload) ? true : false,
+ 'S_UPLOAD_AVATAR_URL' => ($config['allow_avatar'] && $config['allow_avatar_remote_upload'] && $can_upload) ? true : false,
+ 'S_LINK_AVATAR' => ($config['allow_avatar'] && $config['allow_avatar_remote']) ? true : false,
+ 'S_DISPLAY_GALLERY' => ($config['allow_avatar'] && $config['allow_avatar_local']) ? true : false,
+
'ERROR_MSG' => (sizeof($error)) ? implode('<br />', $error) : '',
'GROUP_RECEIVE_PM' => (isset($group_row['group_receive_pm']) && $group_row['group_receive_pm']) ? ' checked="checked"' : '',
'GROUP_MESSAGE_LIMIT' => (isset($group_row['group_message_limit'])) ? $group_row['group_message_limit'] : 0,
diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php
index d93567c543..a7785e7163 100644
--- a/phpBB/includes/ucp/ucp_profile.php
+++ b/phpBB/includes/ucp/ucp_profile.php
@@ -564,7 +564,7 @@ class ucp_profile
$avatar_select = basename(request_var('avatar_select', ''));
$category = basename(request_var('category', ''));
- $can_upload = ($config['allow_avatar_upload'] && file_exists($phpbb_root_path . $config['avatar_path']) && @is_writable($phpbb_root_path . $config['avatar_path']) && $auth->acl_get('u_chgavatar') && (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on')) ? true : false;
+ $can_upload = (file_exists($phpbb_root_path . $config['avatar_path']) && @is_writable($phpbb_root_path . $config['avatar_path']) && $auth->acl_get('u_chgavatar') && (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on')) ? true : false;
add_form_key('ucp_avatar');
@@ -605,7 +605,7 @@ class ucp_profile
'U_GALLERY' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=profile&amp;mode=avatar&amp;display_gallery=1'),
- 'S_FORM_ENCTYPE' => ($can_upload) ? ' enctype="multipart/form-data"' : '',
+ 'S_FORM_ENCTYPE' => ($can_upload && ($config['allow_avatar_upload'] || $config['allow_avatar_remote_upload'])) ? ' enctype="multipart/form-data"' : '',
'L_AVATAR_EXPLAIN' => sprintf($user->lang['AVATAR_EXPLAIN'], $config['avatar_max_width'], $config['avatar_max_height'], $config['avatar_filesize'] / 1024),
));
@@ -616,15 +616,15 @@ class ucp_profile
}
else if ($config['allow_avatar'])
{
- $avatars_enabled = ($can_upload || ($auth->acl_get('u_chgavatar') && ($config['allow_avatar_local'] || $config['allow_avatar_remote']))) ? true : false;
+ $avatars_enabled = (($can_upload && ($config['allow_avatar_upload'] || $config['allow_avatar_remote_upload'])) || ($auth->acl_get('u_chgavatar') && ($config['allow_avatar_local'] || $config['allow_avatar_remote']))) ? true : false;
$template->assign_vars(array(
'AVATAR_WIDTH' => request_var('width', $user->data['user_avatar_width']),
'AVATAR_HEIGHT' => request_var('height', $user->data['user_avatar_height']),
'S_AVATARS_ENABLED' => $avatars_enabled,
- 'S_UPLOAD_AVATAR_FILE' => $can_upload,
- 'S_UPLOAD_AVATAR_URL' => $can_upload,
+ 'S_UPLOAD_AVATAR_FILE' => ($can_upload && $config['allow_avatar_upload']) ? true : false,
+ 'S_UPLOAD_AVATAR_URL' => ($can_upload && $config['allow_avatar_remote_upload']) ? true : false,
'S_LINK_AVATAR' => ($auth->acl_get('u_chgavatar') && $config['allow_avatar_remote']) ? true : false,
'S_DISPLAY_GALLERY' => ($auth->acl_get('u_chgavatar') && $config['allow_avatar_local']) ? true : false)
);
diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php
index 249b0a8f69..31d7976033 100644
--- a/phpBB/install/database_update.php
+++ b/phpBB/install/database_update.php
@@ -1276,6 +1276,18 @@ function change_database_data(&$no_updates, $version)
}
}
+ if (!isset($config['allow_avatar_remote_upload']))
+ {
+ if ($config['allow_avatar_remote'] && $config['allow_avatar_upload'])
+ {
+ set_config('allow_avatar_remote_upload', '1');
+ }
+ else
+ {
+ set_config('allow_avatar_remote_upload', '0');
+ }
+ }
+
// Minimum number of characters
if (!isset($config['min_post_chars']))
{
diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql
index 86432a3084..0c5b527c9d 100644
--- a/phpBB/install/schemas/schema_data.sql
+++ b/phpBB/install/schemas/schema_data.sql
@@ -12,6 +12,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_avatar', '0'
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_avatar_local', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_avatar_remote', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_avatar_upload', '0');
+INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_avatar_remote_upload', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_bbcode', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_birthdays', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_bookmarks', '1');
diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php
index 0ac7d1fb6b..f09548661f 100644
--- a/phpBB/language/en/acp/board.php
+++ b/phpBB/language/en/acp/board.php
@@ -94,6 +94,8 @@ $lang = array_merge($lang, array(
'ALLOW_LOCAL' => 'Enable gallery avatars',
'ALLOW_REMOTE' => 'Enable remote avatars',
'ALLOW_REMOTE_EXPLAIN' => 'Avatars linked to from another website.',
+ 'ALLOW_REMOTE_UPLOAD' => 'Enable remote avatar uploading',
+ 'ALLOW_REMOTE_UPLOAD_EXPLAIN' => 'Allow uploading of avatars from another website.',
'ALLOW_UPLOAD' => 'Enable avatar uploading',
'AVATAR_GALLERY_PATH' => 'Avatar gallery path',
'AVATAR_GALLERY_PATH_EXPLAIN' => 'Path under your phpBB root directory for pre-loaded images, e.g. <samp>images/avatars/gallery</samp>.',
diff --git a/phpBB/styles/prosilver/template/ucp_avatar_options.html b/phpBB/styles/prosilver/template/ucp_avatar_options.html
index d43e76e584..57aa82ca7b 100644
--- a/phpBB/styles/prosilver/template/ucp_avatar_options.html
+++ b/phpBB/styles/prosilver/template/ucp_avatar_options.html
@@ -13,21 +13,21 @@
<dd><label for="delete"><input type="checkbox" name="delete" id="delete" /> {L_DELETE_AVATAR}</label></dd>
</dl>
- <!-- IF S_UPLOAD_AVATAR_FILE or S_CAN_UPLOAD -->
+ <!-- IF S_UPLOAD_AVATAR_FILE -->
<dl>
<dt><label for="uploadfile">{L_UPLOAD_AVATAR_FILE}:</label></dt>
<dd><input type="hidden" name="MAX_FILE_SIZE" value="{AVATAR_SIZE}" /><input type="file" name="uploadfile" id="uploadfile" class="inputbox autowidth" /></dd>
</dl>
<!-- ENDIF -->
- <!-- IF S_UPLOAD_AVATAR_URL or S_EDIT -->
+ <!-- IF S_UPLOAD_AVATAR_URL -->
<dl>
<dt><label for="uploadurl">{L_UPLOAD_AVATAR_URL}:</label><br /><span>{L_UPLOAD_AVATAR_URL_EXPLAIN}</span></dt>
<dd><input type="text" name="uploadurl" id="uploadurl" value="{AVATAR_URL}" class="inputbox" /></dd>
</dl>
<!-- ENDIF -->
- <!-- IF S_LINK_AVATAR or S_EDIT -->
+ <!-- IF S_LINK_AVATAR -->
<dl>
<dt><label for="remotelink">{L_LINK_REMOTE_AVATAR}:</label><br /><span>{L_LINK_REMOTE_AVATAR_EXPLAIN}</span></dt>
<dd><input type="text" name="remotelink" id="remotelink" value="{AVATAR_REMOTE}" class="inputbox" /></dd>
@@ -41,7 +41,7 @@
</dl>
<!-- ENDIF -->
</fieldset>
-
+
<!-- IF S_IN_AVATAR_GALLERY -->
<span class="corners-bottom"><span></span></span></div>
</div>
@@ -50,7 +50,7 @@
<div class="inner"><span class="corners-top"><span></span></span>
<h3>{L_AVATAR_GALLERY}</h3>
-
+
<fieldset>
<label for="category">{L_AVATAR_CATEGORY}: <select name="category" id="category">{S_CAT_OPTIONS}</select></label>
<input type="submit" value="{L_GO}" name="display_gallery" class="button2" />
@@ -63,7 +63,7 @@
<input type="radio" name="avatar_select" id="av-{avatar_row.S_ROW_COUNT}-{avatar_row.avatar_column.S_ROW_COUNT}" value="{avatar_row.avatar_column.AVATAR_FILE}" /></label>
<!-- END avatar_column --><!-- END avatar_row -->
</div>
-
+
<!-- ENDIF -->
<span class="corners-bottom"><span></span></span></div>
diff --git a/phpBB/styles/subsilver2/template/ucp_groups_manage.html b/phpBB/styles/subsilver2/template/ucp_groups_manage.html
index 4aa2748f71..51e60c8b69 100644
--- a/phpBB/styles/subsilver2/template/ucp_groups_manage.html
+++ b/phpBB/styles/subsilver2/template/ucp_groups_manage.html
@@ -63,16 +63,19 @@
<td class="row2">{AVATAR_IMAGE}<br /><br /><input type="checkbox" class="radio" name="delete" />&nbsp;<span>{L_DELETE_AVATAR}</span></td>
</tr>
<!-- IF not S_IN_AVATAR_GALLERY -->
- <!-- IF S_CAN_UPLOAD -->
+ <!-- IF S_UPLOAD_AVATAR_FILE -->
<tr>
<td class="row1" width="35%"><label for="uploadfile">{L_UPLOAD_AVATAR_FILE}:</label></td>
<td class="row2"><input type="hidden" name="MAX_FILE_SIZE" value="{AVATAR_MAX_FILESIZE}" /><input type="file" id="uploadfile" name="uploadfile" /></td>
</tr>
+ <!-- ENDIF -->
+ <!-- IF S_UPLOAD_AVATAR_URL -->
<tr>
<td class="row1" width="35%"><label for="uploadurl">{L_UPLOAD_AVATAR_URL}:</label><br /><span>{L_UPLOAD_AVATAR_URL_EXPLAIN}</span></td>
<td class="row2"><input name="uploadurl" type="text" id="uploadurl" value="" /></td>
</tr>
<!-- ENDIF -->
+ <!-- IF S_LINK_AVATAR -->
<tr>
<td class="row1" width="35%"><label for="remotelink">{L_LINK_REMOTE_AVATAR}:</label><br /><span>{L_LINK_REMOTE_AVATAR_EXPLAIN}</span></td>
<td class="row2"><input name="remotelink" type="text" id="remotelink" value="" /></td>
@@ -81,6 +84,7 @@
<td class="row1" width="35%"><label for="width">{L_LINK_REMOTE_SIZE}:</label><br /><span>{L_LINK_REMOTE_SIZE_EXPLAIN}</span></td>
<td class="row2"><input name="width" type="text" id="width" size="3" value="{AVATAR_WIDTH}" /> <span>px X </span> <input type="text" name="height" size="3" value="{AVATAR_HEIGHT}" /> <span>px</span></td>
</tr>
+ <!-- ENDIF -->
<!-- IF S_DISPLAY_GALLERY -->
<tr>
<td class="row1" width="35%"><label>{L_AVATAR_GALLERY}:</label></td>