mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-22 22:33:55 -07:00
Merge d67390571a
into 931858e211
This commit is contained in:
commit
06a3b619ac
3 changed files with 31 additions and 12 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -33,3 +33,5 @@ $RECYCLE.BIN/
|
||||||
.Trashes
|
.Trashes
|
||||||
*.orig
|
*.orig
|
||||||
*.rej
|
*.rej
|
||||||
|
|
||||||
|
/vendor/
|
||||||
|
|
7
composer.json
Normal file
7
composer.json
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"name": "diolektor/torrentpier",
|
||||||
|
"description": "Fork TorrentPier. Web torrent tracker.",
|
||||||
|
"type": "project",
|
||||||
|
"minimum-stability": "dev",
|
||||||
|
"require": {}
|
||||||
|
}
|
|
@ -699,21 +699,31 @@ class bbcode
|
||||||
{
|
{
|
||||||
global $bb_cfg;
|
global $bb_cfg;
|
||||||
|
|
||||||
$url = trim($m[1]);
|
//TODO: Refactoring. When will use DI.
|
||||||
$url_name = (isset($m[2])) ? trim($m[2]) : $url;
|
$uri = new \Zend\Uri\Uri(trim($m[1]));
|
||||||
|
|
||||||
if (!preg_match("#^https?://#isu", $url) && !preg_match("/^#/", $url)) $url = 'http://' . $url;
|
if ($uri->isValid()) {
|
||||||
|
|
||||||
if (in_array(parse_url($url, PHP_URL_HOST), $bb_cfg['nofollow']['allowed_url']) || $bb_cfg['nofollow']['disabled'])
|
$title = isset($m[2]) && !empty(trim($m[2])) ? $m[2] : $uri->toString();
|
||||||
{
|
|
||||||
$link = "<a href=\"$url\" class=\"postLink\">$url_name</a>";
|
$attributes = [
|
||||||
}
|
'class' => 'postLink',
|
||||||
else
|
'href' => $uri->toString(),
|
||||||
{
|
'title' => $uri->toString()
|
||||||
$link = "<a href=\"$url\" class=\"postLink\" rel=\"nofollow\">$url_name</a>";
|
];
|
||||||
|
|
||||||
|
if (in_array($uri->getHost(), $bb_cfg['nofollow']['allowed_url']) || $bb_cfg['nofollow']['disabled']) {
|
||||||
|
$attributes['rel'] = 'nofollow';
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($attributes as $key => $value) {
|
||||||
|
$attributes[$key] = $key . "=\"" . $value . "\"";
|
||||||
|
}
|
||||||
|
|
||||||
|
return '<a '.join(' ', $attributes).'>'.$title.'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $link;
|
return $m[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue