mirror of
https://github.com/e107inc/e107.git
synced 2025-01-17 12:48:24 +01:00
20882920a0
* `strftime()` has been replaced with a polyfill based on `DateTime`. * Explicit type casts/assertions added where required by PHP 8.1 * `filter_var(…, FILTER_SANITIZE_STRING)` replaced with `strip_tags()` or HTML entity encoding of quotation marks, depending on a guess of what the intended "sanitization" was * `http_build_query()` usage type mismatches fixed * Removed usages of the `FILE_TEXT` constant * To avoid breaking PHP 5.6 compatibility (function return types), `e_session_db` no longer implements `SessionHandlerInterface`. Instead, the alternative non-OOP invocation of `session_set_save_handler()` is used instead to apply the session handler. * The shim for `strptime()` still calls the native function if available but now suppresses the deprecation warning. * `e_db_pdo` explicitly asks for `PDO::ATTR_STRINGIFY_FETCHES` to maintain consistent behavior with past versions of PHP. * `e_db_mysql` explicitly sets `mysqli_report(MYSQLI_REPORT_OFF)` to maintain consistent behavior with past versions of PHP. * Removed pointless random number generator seed from `banner` plugin * Workaround for `COUNT(*)` SQL query in `validatorClass::dbValidateArray()` without a proper API for avoiding SQL injection
77 lines
2.1 KiB
BlitzBasic
77 lines
2.1 KiB
BlitzBasic
// $Id$
|
|
//<?
|
|
|
|
|
|
$class = "bbcode ".e107::getBB()->getClass('link');
|
|
global $pref, $parm;
|
|
|
|
/**
|
|
* e107 BBCodes
|
|
*
|
|
* @package e107
|
|
* @subpackage bbcode
|
|
* @version $Id$;
|
|
*
|
|
* @todo try and avoid URLs with a language in [..]
|
|
*/
|
|
|
|
/**
|
|
[link=$parm $extras]$code_text[/link]
|
|
Correct Usage:
|
|
[link=http://mysite.com external]My text[/link]
|
|
[link=http://mysite.com rel=external]My text[/link]
|
|
[link=external]http://mysite.com[/link]
|
|
[link]http://mysite.com[/link]
|
|
[link=mailto:myemail@email.com]My name[/link]
|
|
Historic usage:
|
|
[link=external=http://mysite.com]My text[/link]
|
|
*/
|
|
|
|
$tp = e107::getParser();
|
|
|
|
$parm = $tp->filter(trim($parm));
|
|
|
|
/* Fix for people using link=external= */
|
|
if(strpos($parm,"external=") !== FALSE)
|
|
{
|
|
list($extras,$parm) = explode("=",$parm,2);
|
|
$parm = $parm." ".$extras;
|
|
}
|
|
|
|
if(strpos($parm, 'mailto') === 0)
|
|
{
|
|
list($pre,$email) = explode(":",$parm);
|
|
list($p1,$p2) = explode("@",$email);
|
|
$p2=rawurlencode($p2); // Primarily to pick up spaces, which are not allowed
|
|
return "<a class='bbcode' rel='external' href='javascript:window.location=\"mai\"+\"lto:\"+\"$p1\"+\"@\"+\"$p2\";self.close();' onmouseover='window.status=\"mai\"+\"lto:\"+\"$p1\"+\"@\"+\"$p2\"; return true;' onmouseout='window.status=\"\";return true;'>".$code_text."</a>";
|
|
}
|
|
|
|
if (substr($code_text,0,1) === ']')
|
|
{ // Special fix for E107 urls including a language (not nice, really)
|
|
$code_text = substr($code_text,1);
|
|
$parm .= ']';
|
|
}
|
|
|
|
list($link,$extras) = array_pad(explode(" ",$parm), 2, null);
|
|
|
|
if(!$parm) $link = $code_text;
|
|
|
|
if($link == "external" && empty($extras))
|
|
{
|
|
$link = $code_text;
|
|
$extras = "rel=external";
|
|
}
|
|
|
|
$extras = (string) $extras;
|
|
if($extras == "external" || strpos($extras,"rel=external")!==FALSE)
|
|
{
|
|
$insert = "rel='external' ";
|
|
}
|
|
else
|
|
{
|
|
$insert = ($pref['links_new_window'] && strpos($link,"{e_")===FALSE && substr($link,0,1) != "#" && substr($link,0,1) != "/" && strpos($extras,"rel=internal")===FALSE) ? "rel='external' " : "";
|
|
}
|
|
if (strtolower(substr($link,0,11)) == 'javascript:') return '';
|
|
return "<a class='{$class}' href='".e107::getParser() -> toAttribute($link)."' ".$insert.">".$code_text."</a>";
|
|
|