приятно использовать с модом "userfriendly URL-input while posting"
Код: Выделить всё
###############################################
## Hack Title: Post Link
## Hack Version: 1.0.0 beta
## Author: S.R.
## Website: http://sferarazuma.ru
## Description: Add easy link to any post in the forum
## Compatibility: 2.0.0 - 2.0.10
## Usage:
## [url=post_id]Comments[/url]
##
## Demo:
## http://sferarazuma.ru/forum/viewtopic.php?p=834#834
##
## Installation Level: Easy
## Installation Time: 2 - 3 minutes
##
## Files To Edit: 1
## includes/bbcode.php
##
## Included Files: 0
##
## History:
## 1.0.0 Initial release (07 Jan 2007)
##
## Author Notes:
##
## Support:
## Copyright: 2007, S.R.
##
###############################################
#
#-----[ OPEN ]--------------------------------------------
#
includes/bbcode.php
#
#-----[ FIND ]--------------------------------------------
#
$bbcode_tpl['url4'] = str_replace('{URL}', 'http://\\1', $bbcode_tpl['url']);
$bbcode_tpl['url4'] = str_replace('{DESCRIPTION}', '\\3', $bbcode_tpl['url4']);
#
#-----[ AFTER, ADD ]--------------------------------------
#
$bbcode_tpl['urlPost'] = str_replace('{URL}', bbcode_post_links() . '\\1#\\1', $bbcode_tpl['url']);
$bbcode_tpl['urlPost'] = str_replace('{DESCRIPTION}', '\\2', $bbcode_tpl['urlPost']);
#
#-----[ FIND ]--------------------------------------------
#
// [url=xxxx://www.phpbb.com]phpBB[/url] code..
$patterns[] = "#\[url=([\w]+?://[^ \"\n\r\t<]*?)\](.*?)\[/url\]#is";
$replacements[] = $bbcode_tpl['url3'];
#
#-----[ BEFORE, ADD ]-------------------------------------
#
// matches a [url=423]some comments[/url] code..
$patterns[] = "#\[url=(\d+)\](.*?)\[/url\]#is";
$replacements[] = $bbcode_tpl['urlPost'];
#
#-----[ FIND ]--------------------------------------------
#
?>
#
#-----[ BEFORE, ADD ]-------------------------------------
#
function bbcode_post_links()
{
global $board_config;
$script_name = preg_replace('/^\/?(.*?)\/?$/', '\1', trim($board_config['script_path']));
$script_name = ($script_name != '') ? $script_name . '/' : '/';
$server_name = trim($board_config['server_name']) . '/';
$server_protocol = ($board_config['cookie_secure']) ? 'https://' : 'http://';
$server_port = ($board_config['server_port'] <> 80) ? ':' . trim($board_config['server_port']) . '/' : '/';
return $server_protocol . $server_name . $server_port . $script_name . "viewtopic.php?p=";
}
#
#-----[ SAVE & CLOSE ALL FILES ]--------------------------
#