mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-12 20:56:40 +02:00
Magic URL updates
git-svn-id: file:///svn/phpbb/trunk@2992 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
@ -36,7 +36,7 @@ class parse_message
|
|||||||
$match = array();
|
$match = array();
|
||||||
$replace = array();
|
$replace = array();
|
||||||
|
|
||||||
$match[] = '#sid=[a-z0-9]+&?#';
|
$match[] = '#sid=[a-z0-9]*?&?#';
|
||||||
$replace[] = '';
|
$replace[] = '';
|
||||||
$match[] = "#([\r\n][\s]+){3,}#";
|
$match[] = "#([\r\n][\s]+){3,}#";
|
||||||
$replace[] = "\n\n";
|
$replace[] = "\n\n";
|
||||||
@ -138,19 +138,19 @@ class parse_message
|
|||||||
|
|
||||||
// relative urls for this board
|
// 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[] = '#' . $server_protocol . trim($config['server_name']) . $server_port . preg_replace('/^\/?(.*?)(\/)?$/', '\1', trim($config['script_path'])) . '/([^\t\n\r <"\']+)#i';
|
||||||
$replace[] = '<a href="\1" target="_blank">\1</a>';
|
$replace[] = '<!-- l --><a href="\1" target="_blank">\1</a><!-- l -->';
|
||||||
|
|
||||||
// matches a xxxx://aaaaa.bbb.cccc. ...
|
// matches a xxxx://aaaaa.bbb.cccc. ...
|
||||||
$match[] = '#([\n ])([\w]+?://.*?)([^\t\n\r <"\'])#ie';
|
$match[] = '#(^|[\n ])([\w]+?://[\w\?&\#,\.\+\-!~\/=%]+)#ie';
|
||||||
$replace[] = "'\\1<!-- m --><a href=\"\\2\" target=\"_blank\">' . ( ( strlen('\\2') > 55 ) ?substr('\\2', 0, 39) . ' ... ' . substr('\\2', -10) : '\\2' ) . '</a><!-- m -->\\3'";
|
$replace[] = "'\\1<!-- m --><a href=\"\\2\" target=\"_blank\">' . ( ( strlen('\\2') > 55 ) ?substr('\\2', 0, 39) . ' ... ' . substr('\\2', -10) : '\\2' ) . '</a><!-- m -->'";
|
||||||
|
|
||||||
// matches a "www.xxxx.yyyy[/zzzz]" kinda lazy URL thing
|
// matches a "www.xxxx.yyyy[/zzzz]" kinda lazy URL thing
|
||||||
$match[] = '#(^|[\n ])(www\.[\w\-]+\.[\w\-.\~]+(?:/[^\t\n\r <"\']*)?)#ie';
|
$match[] = '#(^|[\n ])(www\.[\w\-]+\.[\w\-.\~]+(?:/[^\t\n\r <"\']*)?)#ie';
|
||||||
$replace[] = "'\\1<!-- m --><a href=\"http://\\2\" target=\"_blank\">' . ( ( strlen('\\2') > 55 ) ?substr('\\2', 0, 39) . ' ... ' . substr('\\2', -10) : '\\2' ) . '</a><!-- m -->'";
|
$replace[] = "'\\1<!-- w --><a href=\"http://\\2\" target=\"_blank\">' . ( ( strlen('\\2') > 55 ) ?substr('\\2', 0, 39) . ' ... ' . substr('\\2', -10) : '\\2' ) . '</a><!-- w -->'";
|
||||||
|
|
||||||
// matches an email@domain type address at the start of a line, or after a space.
|
// 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';
|
$match[] = '#(^|[\n ])([a-z0-9\-_.]+?@[\w\-]+\.([\w\-\.]+\.)?[\w]+)#ie';
|
||||||
$replace[] = "'\\1<!-- m --><a href=\"mailto:\\2\">' . ( ( strlen('\\2') > 55 ) ?substr('\\2', 0, 39) . ' ... ' . substr('\\2', -10) : '\\2' ) . '</a><!-- m -->'";
|
$replace[] = "'\\1<!-- e --><a href=\"mailto:\\2\">' . ( ( strlen('\\2') > 55 ) ?substr('\\2', 0, 39) . ' ... ' . substr('\\2', -10) : '\\2' ) . '</a><!-- e -->'";
|
||||||
|
|
||||||
$message = preg_replace($match, $replace, $message);
|
$message = preg_replace($match, $replace, $message);
|
||||||
}
|
}
|
||||||
@ -165,9 +165,7 @@ class parse_message
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parses a given message and updates/maintains
|
// Parses a given message and updates/maintains the fulltext tables
|
||||||
// the fulltext word indexes NOTE this is not complete
|
|
||||||
// nor 'entirely' (!) functional ...
|
|
||||||
class fulltext_search
|
class fulltext_search
|
||||||
{
|
{
|
||||||
function split_words(&$text)
|
function split_words(&$text)
|
||||||
@ -504,8 +502,5 @@ function generate_smilies($mode)
|
|||||||
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
|
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//
|
|
||||||
// END NEW CODE
|
|
||||||
// ---------------------------------------------
|
|
||||||
|
|
||||||
?>
|
?>
|
@ -177,7 +177,7 @@ if (isset($post))
|
|||||||
$enable_html = (!intval($config['allow_html'])) ? 0 : ((!empty($disable_html)) ? 0 : 1);
|
$enable_html = (!intval($config['allow_html'])) ? 0 : ((!empty($disable_html)) ? 0 : 1);
|
||||||
$enable_bbcode = (!intval($config['allow_bbcode'])) ? 0 : ((!empty($disable_bbcode)) ? 0 : 1);
|
$enable_bbcode = (!intval($config['allow_bbcode'])) ? 0 : ((!empty($disable_bbcode)) ? 0 : 1);
|
||||||
$enable_smilies = (!intval($config['allow_smilies'])) ? 0 : ((!empty($disable_smilies)) ? 0 : 1);
|
$enable_smilies = (!intval($config['allow_smilies'])) ? 0 : ((!empty($disable_smilies)) ? 0 : 1);
|
||||||
$enable_urls = (!empty($disable_magic_url)) ? 1 : 0;
|
$enable_urls = (!empty($disable_magic_url)) ? 0 : 1;
|
||||||
$enable_sig = (empty($attach_sig) ) ? 1 : 0;
|
$enable_sig = (empty($attach_sig) ) ? 1 : 0;
|
||||||
|
|
||||||
// Check checksum ... don't re-parse message if the same
|
// Check checksum ... don't re-parse message if the same
|
||||||
@ -461,7 +461,6 @@ if (isset($post))
|
|||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'ERROR_MESSAGE' => $err_msg)
|
'ERROR_MESSAGE' => $err_msg)
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// PROCESS SUBMIT
|
// PROCESS SUBMIT
|
||||||
@ -476,11 +475,16 @@ if (isset($post))
|
|||||||
//
|
//
|
||||||
|
|
||||||
// Remove encoded bbcode, urls, etc.
|
// Remove encoded bbcode, urls, etc.
|
||||||
|
$server_protocol = ($config['cookie_secure']) ? 'https://' : 'http://';
|
||||||
|
$server_port = ($config['server_port'] <> 80) ? ':' . trim($config['server_port']) . '/' : '/';
|
||||||
|
|
||||||
$match = array(
|
$match = array(
|
||||||
'#<!\-\- b \-\-><b>(.*?)</b><!\-\- b \-\->#s',
|
'#<!\-\- b \-\-><b>(.*?)</b><!\-\- b \-\->#s',
|
||||||
'#<!\-\- u \-\-><u>(.*?)</u><!\-\- u \-\->#s',
|
'#<!\-\- u \-\-><u>(.*?)</u><!\-\- u \-\->#s',
|
||||||
'#<!\-\- e \-\-><a href="mailto:(.*?)">.*?</a><!\-\- e \-\->#',
|
'#<!\-\- e \-\-><a href="mailto:(.*?)">.*?</a><!\-\- e \-\->#',
|
||||||
'#<!\-\- m \-\-><a href="(.*?)" target="_blank">.*?</a><!\-\- m \-\->#',
|
'#<!\-\- m \-\-><a href="(.*?)" target="_blank">.*?</a><!\-\- m \-\->#',
|
||||||
|
'#<!\-\- w \-\-><a href="http:\/\/(.*?)" target="_blank">.*?</a><!\-\- w \-\->#',
|
||||||
|
'#<!\-\- l \-\-><a href="(.*?)" target="_blank">.*?</a><!\-\- l \-\->#',
|
||||||
);
|
);
|
||||||
|
|
||||||
$replace = array(
|
$replace = array(
|
||||||
@ -488,6 +492,8 @@ $replace = array(
|
|||||||
'[u]\1[/u]',
|
'[u]\1[/u]',
|
||||||
'\1',
|
'\1',
|
||||||
'\1',
|
'\1',
|
||||||
|
'\1',
|
||||||
|
$server_protocol . trim($config['server_name']) . $server_port . preg_replace('/^\/?(.*?)(\/)?$/', '\1', trim($config['script_path'])) . '/\1',
|
||||||
);
|
);
|
||||||
|
|
||||||
$post_text = preg_replace($match, $replace, $post_text);
|
$post_text = preg_replace($match, $replace, $post_text);
|
||||||
|
Reference in New Issue
Block a user