aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/includes/bbcode.php48
-rw-r--r--phpBB/includes/functions_user.php2
-rw-r--r--phpBB/includes/message_parser.php2
-rw-r--r--phpBB/includes/ucp/ucp_profile.php95
-rw-r--r--phpBB/viewtopic.php8
5 files changed, 137 insertions, 18 deletions
diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php
index 601150aed8..3564fc04bf 100644
--- a/phpBB/includes/bbcode.php
+++ b/phpBB/includes/bbcode.php
@@ -96,6 +96,8 @@ class bbcode
//
function bbcode_cache_init()
{
+ global $user;
+
$sql = '';
$bbcode_ids = array();
@@ -173,12 +175,23 @@ class bbcode
);
break;
case 4:
- $this->bbcode_cache[$bbcode_id] = array(
- 'preg' => array(
- '#\[img:$uid\](.*?)\[/img:$uid\]#s' => '<img src="\1" border="0" />'
- )
- );
- break;
+ if ($user->data['user_viewimg'])
+ {
+ $this->bbcode_cache[$bbcode_id] = array(
+ 'preg' => array(
+ '#\[img:$uid\](.*?)\[/img:$uid\]#s' => '<img src="\1" border="0" />'
+ )
+ );
+ }
+ else
+ {
+ $this->bbcode_cache[$bbcode_id] = array(
+ 'preg' => array(
+ '#\[img:$uid\](.*?)\[/img:$uid\]#s' => '<a href="\1">[ img ]</a>'
+ )
+ );
+ }
+ break;
case 5:
$this->bbcode_cache[$bbcode_id] = array(
'preg' => array(
@@ -232,12 +245,23 @@ class bbcode
);
break;
case 11:
- $this->bbcode_cache[$bbcode_id] = array(
- 'preg' => array(
- '#\[flash:$uid\](.*?)\[/flash:$uid\]#' => $this->bbcode_tpl('flash')
- )
- );
- break;
+ if ($user->data['user_viewimages'])
+ {
+ $this->bbcode_cache[$bbcode_id] = array(
+ 'preg' => array(
+ '#\[flash:$uid\](.*?)\[/flash:$uid\]#' => $this->bbcode_tpl('flash')
+ )
+ );
+ }
+ else
+ {
+ $this->bbcode_cache[$bbcode_id] = array(
+ 'preg' => array(
+ '#\[flash:$uid\](.*?)\[/flash:$uid\]#s' => '<a href="\1">[ flash ]</a>'
+ )
+ );
+ }
+ break;
default:
if (isset($rowset[$bbcode_id]))
{
diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php
index db518d3918..5806003e5b 100644
--- a/phpBB/includes/functions_user.php
+++ b/phpBB/includes/functions_user.php
@@ -138,7 +138,7 @@ class ucp extends user
case 'string':
// Cleanup data, remove excess spaces, run entites
- $valid_data[$var_name] = htmlentities(strtr(trim(preg_replace('#\s{2,}#s', ' ', (string) $data[$var_name])), array_flip(get_html_translation_table(HTML_ENTITIES))));
+ $valid_data[$var_name] = htmlentities(trim(preg_replace('#\s{2,}#s', ' ', strtr((string) $data[$var_name], array_flip(get_html_translation_table(HTML_ENTITIES))))));
// How should we check this data?
if (!is_array($var_limits))
diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php
index 86547684a8..870aefd870 100644
--- a/phpBB/includes/message_parser.php
+++ b/phpBB/includes/message_parser.php
@@ -553,7 +553,7 @@ echo "<pre><hr>processing <b>$username</b><hr></pre>";
$replace = array();
// relative urls for this board
- $match[] = '#' . $server_protocol . trim($config['server_name']) . $server_port . preg_replace('/^\/?(.*?)(\/)?$/', '\1', trim($config['script_path'])) . '/([^ \t\n\r <"\']+)#i';
+ $match[] = '#(^|[\n ])' . $server_protocol . trim($config['server_name']) . $server_port . preg_replace('/^\/?(.*?)(\/)?$/', '\1', trim($config['script_path'])) . '/([^ \t\n\r <"\']+)#i';
$replace[] = '<!-- l --><a href="\1" target="_blank">\1</a><!-- l -->';
// matches a xxxx://aaaaa.bbb.cccc. ...
diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php
index bfbcf5d076..dfe3e09cf4 100644
--- a/phpBB/includes/ucp/ucp_profile.php
+++ b/phpBB/includes/ucp/ucp_profile.php
@@ -326,9 +326,81 @@ class ucp_profile extends ucp
case 'avatar':
+ $dir = @opendir($config['avatar_gallery_path']);
+
+ $avatar_images = array();
+ while( $file = @readdir($dir) )
+ {
+ if( $file != '.' && $file != '..' && !is_file($config['avatar_gallery_path'] . '/' . $file) && !is_link($config['avatar_gallery_path'] . '/' . $file) )
+ {
+ $sub_dir = @opendir($config['avatar_gallery_path'] . '/' . $file);
+
+ $avatar_row_count = 0;
+ $avatar_col_count = 0;
+ while( $sub_file = @readdir($sub_dir) )
+ {
+ if( preg_match('#(\.gif$|\.png$|\.jpg|\.jpeg)$#i', $sub_file) )
+ {
+ $avatar_images[$file][$avatar_row_count][$avatar_col_count] = $file . '/' . $sub_file;
+ $avatar_name[$file][$avatar_row_count][$avatar_col_count] = ucfirst(str_replace("_", " ", preg_replace('/^(.*)\..*$/', '\1', $sub_file)));
+
+ $avatar_col_count++;
+ if( $avatar_col_count == 4 )
+ {
+ $avatar_row_count++;
+ $avatar_col_count = 0;
+ }
+ }
+ }
+ }
+ }
+
+ @closedir($dir);
+
+ @ksort($avatar_images);
+ @reset($avatar_images);
+
+ $category = (isset($_POST['avatarcat'])) ? htmlspecialchars($_POST['avatarcat']) : '';
+ if( empty($category) )
+ {
+ list($category, ) = each($avatar_images);
+ }
+ @reset($avatar_images);
+
+ $s_categories = '';
+ while( list($key) = each($avatar_images) )
+ {
+ $selected = ( $key == $category ) ? ' selected="selected"' : '';
+ if( count($avatar_images[$key]) )
+ {
+ $s_categories .= '<option value="' . $key . '"' . $selected . '>' . ucfirst($key) . '</option>';
+ }
+ }
+
+ $s_colspan = 0;
+ for($i = 0; $i < count($avatar_images[$category]); $i++)
+ {
+ $template->assign_block_vars('avatar_row', array());
+
+ $s_colspan = max($s_colspan, count($avatar_images[$category][$i]));
+
+ for($j = 0; $j < count($avatar_images[$category][$i]); $j++)
+ {
+ $template->assign_block_vars('avatar_row.avatar_column', array(
+ "AVATAR_IMAGE" => $config['avatar_gallery_path'] . '/' . $avatar_images[$category][$i][$j],
+ "AVATAR_NAME" => $avatar_name[$category][$i][$j])
+ );
+
+ $template->assign_block_vars('avatar_row.avatar_option_column', array(
+ "S_OPTIONS_AVATAR" => $avatar_images[$category][$i][$j])
+ );
+ }
+ }
+
$template->assign_vars(array(
'AVATAR' => '<img src="images/avatars/upload/' . $user->data['user_avatar'] . '" />',
+ 'S_AVATAR_CAT_OPTIONS' => $s_categories,
'S_UPLOAD_AVATAR_FILE' => true,
'S_UPLOAD_AVATAR_URL' => true,
'S_LINK_AVATAR' => true,
@@ -351,6 +423,29 @@ class ucp_profile extends ucp
$this->display($user->lang['UCP_PROFILE'], 'ucp_profile.html');
}
+
+ function check_image_type(&$type)
+ {
+ global $user;
+
+ switch ($type)
+ {
+ case 'jpeg':
+ case 'pjpeg':
+ case 'jpg':
+ return '.jpg';
+ case 'gif':
+ return '.gif';
+ case 'png':
+ return '.png';
+ case 'bmp':
+ return '.bmp';
+ }
+
+ $this->error[] = $user->lang['INVALID_IMAGETYPE'];
+ return false;
+ }
+
}
?> \ No newline at end of file
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php
index 52941fdb9a..3135033c22 100644
--- a/phpBB/viewtopic.php
+++ b/phpBB/viewtopic.php
@@ -712,7 +712,7 @@ do
else
{
$user_sig = '';
- if ($row['enable_sig'] && $row['user_sig'] && $config['allow_sig'])
+ if ($row['enable_sig'] && $row['user_sig'] && $config['allow_sig'] && $user->data['user_allowsigs'])
{
$user_sig = $row['user_sig'];
$bbcode_bitfield |= $row['user_sig_bbcode_bitfield'];
@@ -760,7 +760,7 @@ do
);
- if ($row['user_avatar_type'] && $auth->acl_get('u_setavatar'))
+ if ($row['user_avatar_type'] && $auth->acl_get('u_setavatar') && $user->data['user_allowavatars'])
{
switch ($row['user_avatar_type'])
{
@@ -796,7 +796,7 @@ do
}
}
- if ((!empty($row['user_viewemail']) || $auth->acl_get('m_', $forum_id)) && $config['email_enable'])
+ if ((!empty($row['user_allow_viewemail']) || $auth->acl_get('m_', $forum_id)) && $config['email_enable'])
{
$email_url = ($config['board_email_form']) ? "memberlist.$phpEx$SID&amp;mode=email&amp;u=" . $poster_id : 'mailto:' . $row['user_email'];
$user_cache[$poster_id]['email_img'] = '<a href="' . $email_url . '">' . $user->img('btn_email', $user->lang['SEND_EMAIL']) . '</a>';
@@ -1023,7 +1023,7 @@ foreach ($rowset as $key => $row)
// If we allow users to disable display of emoticons
// we'll need an appropriate check and preg_replace here
- $message = (empty($config['allow_smilies'])) ? preg_replace('#<!\-\- s(.*?) \-\-><img src="\{SMILE_PATH\}\/.*? \/><!\-\- s\1 \-\->#', '\1', $message) : str_replace('<img src="{SMILE_PATH}', '<img src="' . $config['smilies_path'], $message);
+ $message = (empty($config['allow_smilies']) || !$user->data['user_viewsmilies']) ? preg_replace('#<!\-\- s(.*?) \-\-><img src="\{SMILE_PATH\}\/.*? \/><!\-\- s\1 \-\->#', '\1', $message) : str_replace('<img src="{SMILE_PATH}', '<img src="' . $config['smilies_path'], $message);
// Highlight active words (primarily for search)