mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-06 08:47:45 +02:00
my attempt to fix custom profile fields
- added the load settings for custom profile fields - re-added our famous make_clickable function - removed group_by clauses (due to the lang id selection the group by clause is no more needed) I hope that i have not just created new bugs. ;) git-svn-id: file:///svn/phpbb/trunk@5712 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
@@ -165,7 +165,12 @@ class acp_board
|
||||
'load_moderators' => array('lang' => 'YES_MODERATORS', 'type' => 'radio:yes_no', 'explain' => false),
|
||||
'load_jumpbox' => array('lang' => 'YES_JUMPBOX', 'type' => 'radio:yes_no', 'explain' => false),
|
||||
'load_user_activity' => array('lang' => 'LOAD_USER_ACTIVITY','type' => 'radio:yes_no', 'explain' => true),
|
||||
'load_tplcompile' => array('lang' => 'RECOMPILE_TEMPLATES', 'type' => 'radio:yes_no', 'explain' => true)
|
||||
'load_tplcompile' => array('lang' => 'RECOMPILE_TEMPLATES', 'type' => 'radio:yes_no', 'explain' => true),
|
||||
|
||||
'legend3' => 'CUSTOM_PROFILE_FIELDS',
|
||||
'load_cpf_memberlist' => array('lang' => 'LOAD_CPF_MEMBERLIST', 'type' => 'radio:yes_no', 'explain' => false),
|
||||
'load_cpf_viewprofile' => array('lang' => 'LOAD_CPF_VIEWPROFILE', 'type' => 'radio:yes_no', 'explain' => false),
|
||||
'load_cpf_viewtopic' => array('lang' => 'LOAD_CPF_VIEWTOPIC', 'type' => 'radio:yes_no', 'explain' => false),
|
||||
)
|
||||
);
|
||||
break;
|
||||
|
@@ -314,7 +314,7 @@ class acp_profile
|
||||
}
|
||||
|
||||
$cp->vars['field_ident'] = request_var('field_ident', $field_row['field_ident']);
|
||||
$cp->vars['lang_name'] = request_var('field_ident', $field_row['lang_name']);
|
||||
$cp->vars['lang_name'] = request_var('lang_name', $field_row['lang_name']);
|
||||
$cp->vars['lang_explain'] = request_var('lang_explain', $field_row['lang_explain']);
|
||||
$cp->vars['lang_default_value'] = request_var('lang_default_value', $field_row['lang_default_value']);
|
||||
|
||||
@@ -450,7 +450,7 @@ class acp_profile
|
||||
|
||||
foreach ($exclude[3] as $key)
|
||||
{
|
||||
$cp->vars[$key] = request_var($key, '');
|
||||
$cp->vars[$key] = request_var($key, array(0 => ''));
|
||||
|
||||
if (!$cp->vars[$key] && $action == 'edit')
|
||||
{
|
||||
|
@@ -8,6 +8,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
// Common global functions
|
||||
|
||||
/**
|
||||
* set_var
|
||||
@@ -144,69 +145,6 @@ function unique_id($extra = 0, $prefix = false)
|
||||
return uniqid(($prefix === false) ? mt_rand() : $prefix, true);
|
||||
}
|
||||
|
||||
if (!function_exists('array_combine'))
|
||||
{
|
||||
/**
|
||||
* A wrapper for the PHP5 function array_combine()
|
||||
* @param array $keys contains keys for the resulting array
|
||||
* @param array $values contains values for the resulting array
|
||||
*
|
||||
* @return Returns an array by using the values from the keys array as keys and the
|
||||
* values from the values array as the corresponding values. Returns false if the
|
||||
* number of elements for each array isn't equal or if the arrays are empty.
|
||||
*/
|
||||
function array_combine($keys, $values)
|
||||
{
|
||||
$keys = array_values($keys);
|
||||
$values = array_values($values);
|
||||
|
||||
$n = sizeof($keys);
|
||||
$m = sizeof($values);
|
||||
if (!$n || !$m || ($n != $m))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$combined = array();
|
||||
for ($i = 0; $i < $n; $i++)
|
||||
{
|
||||
$combined[$keys[$i]] = $values[$i];
|
||||
}
|
||||
return $combined;
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('str_split'))
|
||||
{
|
||||
/**
|
||||
* A wrapper for the PHP5 function str_split()
|
||||
* @param array $string contains the string to be converted
|
||||
* @param array $split_length contains the length of each chunk
|
||||
*
|
||||
* @return Converts a string to an array. If the optional split_length parameter is specified,
|
||||
* the returned array will be broken down into chunks with each being split_length in length,
|
||||
* otherwise each chunk will be one character in length. FALSE is returned if split_length is
|
||||
* less than 1. If the split_length length exceeds the length of string, the entire string is
|
||||
* returned as the first (and only) array element.
|
||||
*/
|
||||
function str_split($string, $split_length = 1)
|
||||
{
|
||||
if ($split_length < 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if ($split_length >= strlen($string))
|
||||
{
|
||||
return array($string);
|
||||
}
|
||||
else
|
||||
{
|
||||
preg_match_all('#.{1,' . $split_length . '}#s', $string, $matches);
|
||||
return $matches[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get userdata
|
||||
* @param mixed $user user id or username
|
||||
@@ -358,6 +296,74 @@ function make_jumpbox($action, $forum_id = false, $select_all = false, $acl_list
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Compatibility functions
|
||||
|
||||
if (!function_exists('array_combine'))
|
||||
{
|
||||
/**
|
||||
* A wrapper for the PHP5 function array_combine()
|
||||
* @param array $keys contains keys for the resulting array
|
||||
* @param array $values contains values for the resulting array
|
||||
*
|
||||
* @return Returns an array by using the values from the keys array as keys and the
|
||||
* values from the values array as the corresponding values. Returns false if the
|
||||
* number of elements for each array isn't equal or if the arrays are empty.
|
||||
*/
|
||||
function array_combine($keys, $values)
|
||||
{
|
||||
$keys = array_values($keys);
|
||||
$values = array_values($values);
|
||||
|
||||
$n = sizeof($keys);
|
||||
$m = sizeof($values);
|
||||
if (!$n || !$m || ($n != $m))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$combined = array();
|
||||
for ($i = 0; $i < $n; $i++)
|
||||
{
|
||||
$combined[$keys[$i]] = $values[$i];
|
||||
}
|
||||
return $combined;
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('str_split'))
|
||||
{
|
||||
/**
|
||||
* A wrapper for the PHP5 function str_split()
|
||||
* @param array $string contains the string to be converted
|
||||
* @param array $split_length contains the length of each chunk
|
||||
*
|
||||
* @return Converts a string to an array. If the optional split_length parameter is specified,
|
||||
* the returned array will be broken down into chunks with each being split_length in length,
|
||||
* otherwise each chunk will be one character in length. FALSE is returned if split_length is
|
||||
* less than 1. If the split_length length exceeds the length of string, the entire string is
|
||||
* returned as the first (and only) array element.
|
||||
*/
|
||||
function str_split($string, $split_length = 1)
|
||||
{
|
||||
if ($split_length < 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if ($split_length >= strlen($string))
|
||||
{
|
||||
return array($string);
|
||||
}
|
||||
else
|
||||
{
|
||||
preg_match_all('#.{1,' . $split_length . '}#s', $string, $matches);
|
||||
return $matches[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// functions used for building option fields
|
||||
|
||||
/**
|
||||
* Pick a language, any language ...
|
||||
*/
|
||||
@@ -426,6 +432,8 @@ function tz_select($default = '')
|
||||
return $tz_select;
|
||||
}
|
||||
|
||||
// Functions handling topic/post tracking/marking
|
||||
|
||||
/**
|
||||
* Topic and forum watching common code
|
||||
*/
|
||||
@@ -999,6 +1007,8 @@ function get_complete_topic_tracking($forum_id, $topic_ids, $global_announce_lis
|
||||
return $last_read;
|
||||
}
|
||||
|
||||
// Pagination functions
|
||||
|
||||
/**
|
||||
* Pagination routine, generates page number sequence
|
||||
* tpl_prefix is for using different pagination blocks at one page
|
||||
@@ -1094,6 +1104,8 @@ function on_page($num_items, $per_page, $start)
|
||||
return sprintf($user->lang['PAGE_OF'], $on_page, max(ceil($num_items / $per_page), 1));
|
||||
}
|
||||
|
||||
// Server functions (building urls, redirecting...)
|
||||
|
||||
/**
|
||||
* Generate board url (example: http://www.foo.bar/phpBB)
|
||||
* @param bool $without_script_path if set to true the script path gets not appended (example: http://www.foo.bar)
|
||||
@@ -1228,6 +1240,8 @@ function meta_refresh($time, $url)
|
||||
);
|
||||
}
|
||||
|
||||
// Message/Login boxes
|
||||
|
||||
/**
|
||||
* Build Confirm box
|
||||
* @param boolean $check True for checking if confirmed (without any additional parameters) and false for displaying the confirm box
|
||||
@@ -1549,6 +1563,8 @@ function login_forum_box(&$forum_data)
|
||||
page_footer();
|
||||
}
|
||||
|
||||
// Content related functions
|
||||
|
||||
/**
|
||||
* Bump Topic Check - used by posting and viewtopic
|
||||
*/
|
||||
@@ -1730,6 +1746,47 @@ function generate_text_for_edit($text, $uid, $bitfield)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* make_clickable function
|
||||
*
|
||||
* Replace magic urls of form http://xxx.xxx., www.xxx. and xxx@xxx.xxx.
|
||||
* Cuts down displayed size of link if over 50 chars, turns absolute links
|
||||
* into relative versions when the server/script path matches the link
|
||||
*/
|
||||
function make_clickable($text, $server_url = false)
|
||||
{
|
||||
if ($server_url === false)
|
||||
{
|
||||
$server_url = generate_board_url();
|
||||
}
|
||||
|
||||
static $magic_url_match;
|
||||
static $magic_url_replace;
|
||||
|
||||
if (!is_array($magic_url_match))
|
||||
{
|
||||
$magic_url_match = $magic_url_replace = array();
|
||||
// Be sure to not let the matches cross over. ;)
|
||||
|
||||
// relative urls for this board
|
||||
$magic_url_match[] = '#(^|[\n ]|\()(' . preg_quote($server_url, '#') . ')/([^ \t\n\r<"\'\)&]+|&(?!lt;))*#i';
|
||||
$magic_url_replace[] = '$1<!-- l --><a href="$2/$3">$3</a><!-- l -->';
|
||||
|
||||
// matches a xxxx://aaaaa.bbb.cccc. ...
|
||||
$magic_url_match[] = '#(^|[\n ]|\()([\w]+:/{2}.*?([^ \t\n\r<"\'\)&]+|&(?!lt;))*)#ie';
|
||||
$magic_url_replace[] = "'\$1<!-- m --><a href=\"\$2\" target=\"_blank\">' . ((strlen('\$2') > 55) ? substr(str_replace('&', '&', '\$2'), 0, 39) . ' ... ' . substr(str_replace('&', '&', '\$2'), -10) : '\$2') . '</a><!-- m -->'";
|
||||
|
||||
// matches a "www.xxxx.yyyy[/zzzz]" kinda lazy URL thing
|
||||
$magic_url_match[] = '#(^|[\n ]|\()(w{3}\.[\w\-]+\.[\w\-.\~]+(?:[^ \t\n\r<"\'\)&]+|&(?!lt;))*)#ie';
|
||||
$magic_url_replace[] = "'\$1<!-- w --><a href=\"http://\$2\" target=\"_blank\">' . ((strlen('\$2') > 55) ? substr(str_replace('&', '&', '\$2'), 0, 39) . ' ... ' . substr(str_replace('&', '&', '\$2'), -10) : '\$2') . '</a><!-- w -->'";
|
||||
|
||||
// matches an email@domain type address at the start of a line, or after a space.
|
||||
$magic_url_match[] = '#(^|[\n ]|\()([a-z0-9&\-_.]+?@[\w\-]+\.(?:[\w\-\.]+\.)?[\w]+)#ie';
|
||||
$magic_url_replace[] = "'\$1<!-- e --><a href=\"mailto:\$2\">' . ((strlen('\$2') > 55) ? substr('\$2', 0, 39) . ' ... ' . substr('\$2', -10) : '\$2') . '</a><!-- e -->'";
|
||||
}
|
||||
|
||||
return preg_replace($magic_url_match, $magic_url_replace, $text);
|
||||
}
|
||||
|
||||
/**
|
||||
* Censoring
|
||||
@@ -1837,6 +1894,8 @@ function extension_allowed($forum_id, $extension, &$extensions)
|
||||
return ($forum_id == 0) ? false : true;
|
||||
}
|
||||
|
||||
// Little helpers
|
||||
|
||||
/**
|
||||
* Build simple hidden fields from array
|
||||
*/
|
||||
@@ -1968,6 +2027,83 @@ function add_log()
|
||||
return $db->sql_nextid();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a nicely formatted backtrace (parts from the php manual by diz at ysagoon dot com)
|
||||
*/
|
||||
function get_backtrace()
|
||||
{
|
||||
global $phpbb_root_path;
|
||||
|
||||
$output = '<div style="font-family: monospace;">';
|
||||
$backtrace = debug_backtrace();
|
||||
$path = realpath($phpbb_root_path);
|
||||
|
||||
foreach ($backtrace as $number => $trace)
|
||||
{
|
||||
// We skip the first one, because it only shows this file/function
|
||||
if ($number == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Strip the current directory from path
|
||||
$trace['file'] = str_replace(array($path, '\\'), array('', '/'), $trace['file']);
|
||||
$trace['file'] = substr($trace['file'], 1);
|
||||
|
||||
$args = array();
|
||||
foreach ($trace['args'] as $argument)
|
||||
{
|
||||
switch (gettype($argument))
|
||||
{
|
||||
case 'integer':
|
||||
case 'double':
|
||||
$args[] = $argument;
|
||||
break;
|
||||
|
||||
case 'string':
|
||||
$argument = htmlspecialchars(substr($argument, 0, 64)) . ((strlen($argument) > 64) ? '...' : '');
|
||||
$args[] = "'{$argument}'";
|
||||
break;
|
||||
|
||||
case 'array':
|
||||
$args[] = 'Array(' . sizeof($argument) . ')';
|
||||
break;
|
||||
|
||||
case 'object':
|
||||
$args[] = 'Object(' . get_class($argument) . ')';
|
||||
break;
|
||||
|
||||
case 'resource':
|
||||
$args[] = 'Resource(' . strstr($argument, '#') . ')';
|
||||
break;
|
||||
|
||||
case 'boolean':
|
||||
$args[] = ($argument) ? 'true' : 'false';
|
||||
break;
|
||||
|
||||
case 'NULL':
|
||||
$args[] = 'NULL';
|
||||
break;
|
||||
|
||||
default:
|
||||
$args[] = 'Unknown';
|
||||
}
|
||||
}
|
||||
|
||||
$trace['class'] = (!isset($trace['class'])) ? '' : $trace['class'];
|
||||
$trace['type'] = (!isset($trace['type'])) ? '' : $trace['type'];
|
||||
|
||||
$output .= '<br />';
|
||||
$output .= '<b>FILE:</b> ' . htmlspecialchars($trace['file']) . '<br />';
|
||||
$output .= '<b>LINE:</b> ' . $trace['line'] . '<br />';
|
||||
$output .= '<b>CALL:</b> ' . htmlspecialchars($trace['class'] . $trace['type'] . $trace['function']) . '(' . ((sizeof($args)) ? implode(', ', $args) : '') . ')<br />';
|
||||
}
|
||||
$output .= '</div>';
|
||||
return $output;
|
||||
}
|
||||
|
||||
// Handler, header and footer
|
||||
|
||||
/**
|
||||
* Error and message handler, call with trigger_error if reqd
|
||||
*/
|
||||
@@ -2514,79 +2650,4 @@ function page_footer()
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a nicely formatted backtrace (parts from the php manual by diz at ysagoon dot com)
|
||||
*/
|
||||
function get_backtrace()
|
||||
{
|
||||
global $phpbb_root_path;
|
||||
|
||||
$output = '<div style="font-family: monospace;">';
|
||||
$backtrace = debug_backtrace();
|
||||
$path = realpath($phpbb_root_path);
|
||||
|
||||
foreach ($backtrace as $number => $trace)
|
||||
{
|
||||
// We skip the first one, because it only shows this file/function
|
||||
if ($number == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Strip the current directory from path
|
||||
$trace['file'] = str_replace(array($path, '\\'), array('', '/'), $trace['file']);
|
||||
$trace['file'] = substr($trace['file'], 1);
|
||||
|
||||
$args = array();
|
||||
foreach ($trace['args'] as $argument)
|
||||
{
|
||||
switch (gettype($argument))
|
||||
{
|
||||
case 'integer':
|
||||
case 'double':
|
||||
$args[] = $argument;
|
||||
break;
|
||||
|
||||
case 'string':
|
||||
$argument = htmlspecialchars(substr($argument, 0, 64)) . ((strlen($argument) > 64) ? '...' : '');
|
||||
$args[] = "'{$argument}'";
|
||||
break;
|
||||
|
||||
case 'array':
|
||||
$args[] = 'Array(' . sizeof($argument) . ')';
|
||||
break;
|
||||
|
||||
case 'object':
|
||||
$args[] = 'Object(' . get_class($argument) . ')';
|
||||
break;
|
||||
|
||||
case 'resource':
|
||||
$args[] = 'Resource(' . strstr($argument, '#') . ')';
|
||||
break;
|
||||
|
||||
case 'boolean':
|
||||
$args[] = ($argument) ? 'true' : 'false';
|
||||
break;
|
||||
|
||||
case 'NULL':
|
||||
$args[] = 'NULL';
|
||||
break;
|
||||
|
||||
default:
|
||||
$args[] = 'Unknown';
|
||||
}
|
||||
}
|
||||
|
||||
$trace['class'] = (!isset($trace['class'])) ? '' : $trace['class'];
|
||||
$trace['type'] = (!isset($trace['type'])) ? '' : $trace['type'];
|
||||
|
||||
$output .= '<br />';
|
||||
$output .= '<b>FILE:</b> ' . htmlspecialchars($trace['file']) . '<br />';
|
||||
$output .= '<b>LINE:</b> ' . $trace['line'] . '<br />';
|
||||
$output .= '<b>CALL:</b> ' . htmlspecialchars($trace['class'] . $trace['type'] . $trace['function']) . '(' . ((sizeof($args)) ? implode(', ', $args) : '') . ')<br />';
|
||||
}
|
||||
$output .= '</div>';
|
||||
return $output;
|
||||
}
|
||||
|
||||
?>
|
@@ -34,7 +34,6 @@ class custom_profile
|
||||
AND f.field_active = 1 ' .
|
||||
((!$auth->acl_gets('a_', 'm_')) ? ' AND f.field_hide = 0 AND f.field_no_view = 0 ' : '') . '
|
||||
AND l.field_id = f.field_id
|
||||
GROUP BY f.field_id
|
||||
ORDER BY f.field_order';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
@@ -93,7 +92,6 @@ class custom_profile
|
||||
" . (($mode == 'register') ? ' AND f.field_show_on_reg = 1' : '') .
|
||||
(($auth->acl_gets('a_', 'm_') && $mode == 'profile') ? '' : ' AND f.field_hide = 0') . '
|
||||
AND l.field_id = f.field_id
|
||||
GROUP BY f.field_id
|
||||
ORDER BY f.field_order';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
@@ -105,14 +103,15 @@ class custom_profile
|
||||
if (is_array($cp_data[$row['field_ident']]))
|
||||
{
|
||||
// Contains the original text without bbcode processing etc
|
||||
$check_value = $cp_data[$row['field_ident']]['submitted'];
|
||||
// $check_value = $cp_data[$row['field_ident']]['submitted'];
|
||||
|
||||
foreach ($cp_data[$row['field_ident']] as $key => $value)
|
||||
{
|
||||
if ($key != 'submitted')
|
||||
$cp_data[$key] = $value;
|
||||
/* if ($key != 'submitted')
|
||||
{
|
||||
$cp_data[$key] = $value;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -237,14 +236,14 @@ class custom_profile
|
||||
$user_fields[$row['user_id']][$ident]['value'] = $value;
|
||||
$user_fields[$row['user_id']][$ident]['data'] = $this->profile_cache[$ident];
|
||||
}
|
||||
else if ($i = strpos($ident, '_bbcode'))
|
||||
/* else if ($i = strpos($ident, '_bbcode'))
|
||||
{
|
||||
// Add extra data (bbcode_uid and bbcode_bitfield) to the data for this profile field.
|
||||
// TODO: Maybe we should try to make this a bit more generic (not limited to bbcode)?
|
||||
$field = substr($ident, 0, $i);
|
||||
$subfield = substr($ident, $i+1);
|
||||
$user_fields[$row['user_id']][$field]['data'][$subfield] = $value;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
while ($row = $db->sql_fetchrow($result));
|
||||
@@ -392,11 +391,16 @@ class custom_profile
|
||||
break;
|
||||
|
||||
case 'string':
|
||||
return str_replace("\n", '<br />', $value);
|
||||
$value = make_clickable($value);
|
||||
$value = censor_text($value);
|
||||
$value = str_replace("\n", '<br />', $value);
|
||||
return $value;
|
||||
break;
|
||||
|
||||
case 'text':
|
||||
// Prepare further, censor_text, smilies, bbcode, whatever
|
||||
/*
|
||||
@todo Prepare further, censor_text, smilies, bbcode, whatever
|
||||
|
||||
if ($ident_ary['data']['bbcode_bitfield'])
|
||||
{
|
||||
$bbcode = new bbcode($ident_ary['data']['bbcode_bitfield']);
|
||||
@@ -404,7 +408,13 @@ class custom_profile
|
||||
$value = smiley_text($value);
|
||||
$value = censor_text($value);
|
||||
}
|
||||
return str_replace("\n", '<br />', $value);
|
||||
return str_replace("\n", '<br />', $value);*/
|
||||
|
||||
$value = make_clickable($value);
|
||||
$value = censor_text($value);
|
||||
$value = str_replace("\n", '<br />', $value);
|
||||
return $value;
|
||||
|
||||
break;
|
||||
|
||||
case 'date':
|
||||
@@ -567,10 +577,10 @@ class custom_profile
|
||||
|
||||
$value = $this->get_var('', $profile_row, $profile_row['lang_default_value'], $preview);
|
||||
|
||||
if ($preview == false)
|
||||
/* if ($preview == false)
|
||||
{
|
||||
decode_message($value, $user->profile_fields[str_replace('pf_', '', $profile_row['field_ident']) . '_bbcode_uid']);
|
||||
}
|
||||
}*/
|
||||
|
||||
$field_length = explode('|', $profile_row['field_length']);
|
||||
$profile_row['field_rows'] = $field_length[0];
|
||||
@@ -637,8 +647,7 @@ class custom_profile
|
||||
AND f.field_active = 1
|
||||
AND f.field_show_on_reg = 0
|
||||
' . (($auth->acl_gets('a_', 'm_')) ? '' : ' AND f.field_hide = 0') . '
|
||||
AND l.field_id = f.field_id
|
||||
GROUP BY f.field_id';
|
||||
AND l.field_id = f.field_id';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
@@ -685,15 +694,15 @@ class custom_profile
|
||||
$var = sprintf('%2d-%2d-%4d', $day, $month, $year);
|
||||
break;
|
||||
|
||||
/**
|
||||
case FIELD_TEXT:
|
||||
include_once($phpbb_root_path . 'includes/message_parser.' . $phpEx);
|
||||
|
||||
$message_parser = new parse_message(request_var($var_name, ''));
|
||||
|
||||
/**
|
||||
* Get the allowed settings from the global settings. Magic URLs are always set to true.
|
||||
* @todo It might be nice to make this a per field setting.
|
||||
*/
|
||||
|
||||
$message_parser->parse($config['allow_bbcode'], true, $config['allow_smilies']);
|
||||
|
||||
$var = array(
|
||||
@@ -703,6 +712,7 @@ class custom_profile
|
||||
'submitted' => request_var($var_name, '')
|
||||
);
|
||||
break;
|
||||
*/
|
||||
|
||||
default:
|
||||
$var = request_var($var_name, $profile_row['field_default_value']);
|
||||
|
@@ -894,32 +894,8 @@ class parse_message extends bbcode_firstpass
|
||||
// into relative versions when the server/script path matches the link
|
||||
function magic_url($server_url)
|
||||
{
|
||||
static $match;
|
||||
static $replace;
|
||||
|
||||
if (!is_array($match))
|
||||
{
|
||||
$match = $replace = array();
|
||||
// Be sure to not let the matches cross over. ;)
|
||||
|
||||
// relative urls for this board
|
||||
$match[] = '#(^|[\n ]|\()(' . preg_quote($server_url, '#') . ')/([^ \t\n\r<"\'\)&]+|&(?!lt;))*#i';
|
||||
$replace[] = '$1<!-- l --><a href="$2/$3">$3</a><!-- l -->';
|
||||
|
||||
// matches a xxxx://aaaaa.bbb.cccc. ...
|
||||
$match[] = '#(^|[\n ]|\()([\w]+:/{2}.*?([^ \t\n\r<"\'\)&]+|&(?!lt;))*)#ie';
|
||||
$replace[] = "'\$1<!-- m --><a href=\"\$2\" target=\"_blank\">' . ((strlen('\$2') > 55) ? substr(str_replace('&', '&', '\$2'), 0, 39) . ' ... ' . substr(str_replace('&', '&', '\$2'), -10) : '\$2') . '</a><!-- m -->'";
|
||||
|
||||
// matches a "www.xxxx.yyyy[/zzzz]" kinda lazy URL thing
|
||||
$match[] = '#(^|[\n ]|\()(w{3}\.[\w\-]+\.[\w\-.\~]+(?:[^ \t\n\r<"\'\)&]+|&(?!lt;))*)#ie';
|
||||
$replace[] = "'\$1<!-- w --><a href=\"http://\$2\" target=\"_blank\">' . ((strlen('\$2') > 55) ? substr(str_replace('&', '&', '\$2'), 0, 39) . ' ... ' . substr(str_replace('&', '&', '\$2'), -10) : '\$2') . '</a><!-- w -->'";
|
||||
|
||||
// matches an email@domain type address at the start of a line, or after a space.
|
||||
$match[] = '#(^|[\n ]|\()([a-z0-9&\-_.]+?@[\w\-]+\.(?:[\w\-\.]+\.)?[\w]+)#ie';
|
||||
$replace[] = "'\$1<!-- e --><a href=\"mailto:\$2\">' . ((strlen('\$2') > 55) ? substr('\$2', 0, 39) . ' ... ' . substr('\$2', -10) : '\$2') . '</a><!-- e -->'";
|
||||
}
|
||||
|
||||
$this->message = preg_replace($match, $replace, $this->message);
|
||||
// We use the global make_clickable function
|
||||
$this->message = make_clickable($this->message, $server_url);
|
||||
}
|
||||
|
||||
// Parse Smilies
|
||||
|
Reference in New Issue
Block a user