mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-21 22:03:49 -07:00
r76
bbcode фикс + редирект внешних ссылок git-svn-id: https://torrentpier2.googlecode.com/svn/trunk@76 a8ac35ab-4ca4-ca47-4c2d-a49a94f06293
This commit is contained in:
parent
8da3987f76
commit
f31fc0fd45
5 changed files with 1635 additions and 20 deletions
|
@ -57,7 +57,7 @@ $bb_cfg['css_ver'] = 1;
|
|||
|
||||
// Increase number of revision after update
|
||||
$bb_cfg['tp_version'] = '2.0.2';
|
||||
$bb_cfg['tp_release_state'] = 'TP II r74';
|
||||
$bb_cfg['tp_release_state'] = 'TP II r76';
|
||||
$bb_cfg['tp_release_date'] = '04-07-2011';
|
||||
|
||||
$bb_cfg['board_disabled_msg'] = 'форум временно отключен'; // 'forums temporarily disabled'; // show this msg if board has been disabled via ON/OFF trigger
|
||||
|
|
|
@ -589,24 +589,24 @@ class bbcode
|
|||
$email_exp = '[a-z0-9&\-_.]+?@[\w\-]+\.([\w\-\.]+\.)?[\w]+';
|
||||
|
||||
$this->preg = array(
|
||||
'#\[quote="(.+?)"\]#' => $tpl['quote_username_open'],
|
||||
'#\[spoiler="(.+?)"\]#' => $tpl['spoiler_title_open'],
|
||||
'#\[list=(a|A|i|I|1)\]#' => '<ul type="$1">',
|
||||
'#\[\*=(\d+)\]#' => '<li value="$1">',
|
||||
'#\[pre\](.*?)\[/pre\]#s' => '<pre class="post-pre">$1</pre>',
|
||||
'#\[name=([a-zA-Z0-9_]+?)\]#' => '<a name="$1"></a>',
|
||||
'#\[url=\#([a-zA-Z0-9_]+?)\](.*?)\[/url\]#' => '<a class="postLink-name" href="#$1">$2</a>',
|
||||
'#\[color=([\#0-9a-zA-Z]+)\]#' => '<span style="color: $1;">',
|
||||
'#\[size=([1-2]?[0-9])\]#' => '<span style="font-size: $1px; line-height: normal;">',
|
||||
'#\[align=(left|right|center|justify)\]#' => '<span class="post-align" style="text-align: $1;">',
|
||||
'#\[font="([\w\- \']+)"\]#' => '<span style="font-family: $1;">',
|
||||
"#\[img\]($img_url_exp)\[/img\]#" => $tpl['img'],
|
||||
"#\[img=(left|right)\]($img_url_exp)\[/img\]\s*#" => $tpl['img_aligned'],
|
||||
"#\[email\]($email_exp)\[/email\]#" => '<a href="mailto:$1">$1</a>',
|
||||
"#\[url\](https?://$url_exp)\[/url\]#" => '<a href="$1" class="postLink">$1</a>',
|
||||
"#\[url\](www\.$url_exp)\[/url\]#" => '<a href="http://$1" class="postLink">$1</a>',
|
||||
"#\[url=(https?://$url_exp)\]([^?\n\t].*?)\[/url\]#" => '<a href="$1" class="postLink">$2</a>',
|
||||
"#\[url=(www\.$url_exp)\]([^?\n\t].*?)\[/url\]#" => '<a href="http://$1" class="postLink">$2</a>',
|
||||
'#\[quote="(.+?)"\]#i' => $tpl['quote_username_open'],
|
||||
'#\[spoiler="(.+?)"\]#i' => $tpl['spoiler_title_open'],
|
||||
'#\[list=(a|A|i|I|1)\]#i' => '<ul type="$1">',
|
||||
'#\[\*=(\d+)\]#i' => '<li value="$1">',
|
||||
'#\[pre\](.*?)\[/pre\]#si' => '<pre class="post-pre">$1</pre>',
|
||||
'#\[name=([a-zA-Z0-9_]+?)\]#i' => '<a name="$1"></a>',
|
||||
'#\[url=\#([a-zA-Z0-9_]+?)\](.*?)\[/url\]#i' => '<a class="postLink-name" href="#$1">$2</a>',
|
||||
'#\[color=([\#0-9a-zA-Z]+)\]#' => '<span style="color: $1;">',
|
||||
'#\[size=([1-2]?[0-9])\]#i' => '<span style="font-size: $1px; line-height: normal;">',
|
||||
'#\[align=(left|right|center|justify)\]#i' => '<span class="post-align" style="text-align: $1;">',
|
||||
'#\[font="([\w\- \']+)"\]#i' => '<span style="font-family: $1;">',
|
||||
"#\[img\]($img_url_exp)\[/img\]#i" => $tpl['img'],
|
||||
"#\[img=(left|right)\]($img_url_exp)\[/img\]\s*#i" => $tpl['img_aligned'],
|
||||
"#\[email\]($email_exp)\[/email\]#i" => '<a href="mailto:$1">$1</a>',
|
||||
"#\[url\](https?://$url_exp)\[/url\]#i" => '<a href="$1" class="postLink">$1</a>',
|
||||
"#\[url\](www\.$url_exp)\[/url\]#i" => '<a href="http://$1" class="postLink">$1</a>',
|
||||
"#\[url=(https?://$url_exp)\]([^?\n\t].*?)\[/url\]#i" => '<a href="$1" class="postLink">$2</a>',
|
||||
"#\[url=(www\.$url_exp)\]([^?\n\t].*?)\[/url\]#i" => '<a href="http://$1" class="postLink">$2</a>',
|
||||
);
|
||||
|
||||
$this->str = array(
|
||||
|
@ -825,10 +825,17 @@ class bbcode
|
|||
*/
|
||||
function make_url_clickable_callback ($m)
|
||||
{
|
||||
global $bb_cfg;
|
||||
|
||||
$max_len = 70;
|
||||
$href = $m[1];
|
||||
$name = (strlen($href) > $max_len) ? substr($href, 0, $max_len - 19) .'...'. substr($href, -16) : $href;
|
||||
|
||||
if(!preg_match("#{$bb_cfg['server_name']}#", $href))
|
||||
{
|
||||
require_once(INC_DIR .'class.idna_convert.php');
|
||||
$IDN = new idna_convert();
|
||||
return '<a href="'. make_url('/redirect.php?url=') . base64_encode($IDN->encode($href)) .'" class="postLink" target="_blank">'. $name .'</a>';
|
||||
}
|
||||
return "<a href=\"$href\" class=\"postLink\">$name</a>";
|
||||
}
|
||||
|
||||
|
|
1538
upload/includes/class.idna_convert.php
Normal file
1538
upload/includes/class.idna_convert.php
Normal file
File diff suppressed because it is too large
Load diff
30
upload/redirect.php
Normal file
30
upload/redirect.php
Normal file
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
define('BB_ROOT', './');
|
||||
require(BB_ROOT .'common.php');
|
||||
require(INC_DIR .'class.idna_convert.php');
|
||||
|
||||
$user->session_start();
|
||||
$url = (string) request_var('url', '');
|
||||
$time = 15;
|
||||
|
||||
$url = base64_decode($url);
|
||||
$IDN = new idna_convert();
|
||||
$url = $IDN->decode($url);
|
||||
|
||||
if(!$url)
|
||||
{
|
||||
meta_refresh(BB_ROOT, 0);
|
||||
bb_die ('Неверная ссылка');
|
||||
}
|
||||
|
||||
meta_refresh($url, $time);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'URL' => $url,
|
||||
'URL_TITLE' => str_short($url, 70),
|
||||
'PAGE_TITLE' => 'Переадресация...',
|
||||
'TIME' => $time,
|
||||
));
|
||||
|
||||
print_page('redirect.tpl');
|
40
upload/templates/default/redirect.tpl
Normal file
40
upload/templates/default/redirect.tpl
Normal file
|
@ -0,0 +1,40 @@
|
|||
|
||||
<script language="javascript" type="text/javascript">
|
||||
$(function(){
|
||||
time = {TIME};
|
||||
countdown();
|
||||
});
|
||||
function countdown()
|
||||
{
|
||||
if(time != 0)
|
||||
{
|
||||
$('span#time').text(time);
|
||||
setTimeout('countdown()',1000);
|
||||
time--;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<table cellpadding="2" cellspacing="0" width="100%">
|
||||
<tr>
|
||||
<td width="100%">
|
||||
<h1 class="maintitle">{PAGE_TITLE}</h1>
|
||||
<div id="forums_top_links" class="nav">
|
||||
<a href="{U_INDEX}">{T_INDEX}</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="category">
|
||||
<h3 class="cat_title">{PAGE_TITLE}</h3>
|
||||
<div class="f_tbl_wrap pad_10">
|
||||
<div class="q pad_10">
|
||||
Вы покидаете <b>{SITENAME}</b> и переходите на <a href="{URL}"><i>{URL_TITLE}</i></a>.
|
||||
<div class="spacer_10"></div>
|
||||
Вы будете переадресованы через <span class="bold" id="time">{TIME}</span> секунд.
|
||||
<div class="spacer_10"></div>
|
||||
<span style="color: red;">Внимание! Администрация не несет отвественности за сайт на которой вы переходите.</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue