forked from halo-battle/game
Ajout d'une étape de linting dans DroneCi (#3)
Corrige un doublons laissé par le rebase semi-manuel Ajout d'une étape de linting dans DroneCi Fix linting Co-authored-by: Nigel Sheldon <nigelsheldon@live.fr> Reviewed-on: https://gitea.nemunai.re/halo-battle/game/pulls/3
This commit is contained in:
parent
5b17a7dbd7
commit
dd61d3b66b
263 changed files with 45327 additions and 42695 deletions
|
|
@ -70,8 +70,9 @@ function smarty_function_mailto($params, &$smarty)
|
|||
case 'cc':
|
||||
case 'bcc':
|
||||
case 'followupto':
|
||||
if (!empty($value))
|
||||
$mail_parms[] = $var.'='.str_replace($search,$replace,rawurlencode($value));
|
||||
if (!empty($value)) {
|
||||
$mail_parms[] = $var.'='.str_replace($search, $replace, rawurlencode($value));
|
||||
}
|
||||
break;
|
||||
|
||||
case 'subject':
|
||||
|
|
@ -83,6 +84,7 @@ function smarty_function_mailto($params, &$smarty)
|
|||
case 'text':
|
||||
$$var = $value;
|
||||
|
||||
// no break
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
|
@ -95,12 +97,12 @@ function smarty_function_mailto($params, &$smarty)
|
|||
$address .= $mail_parm_vals;
|
||||
|
||||
$encode = (empty($params['encode'])) ? 'none' : $params['encode'];
|
||||
if (!in_array($encode,array('javascript','javascript_charcode','hex','none')) ) {
|
||||
if (!in_array($encode, array('javascript','javascript_charcode','hex','none'))) {
|
||||
$smarty->trigger_error("mailto: 'encode' parameter must be none, javascript or hex");
|
||||
return;
|
||||
}
|
||||
|
||||
if ($encode == 'javascript' ) {
|
||||
if ($encode == 'javascript') {
|
||||
$string = 'document.write(\'<a href="mailto:'.$address.'" '.$extra.'>'.$text.'</a>\');';
|
||||
|
||||
$js_encode = '';
|
||||
|
|
@ -109,36 +111,32 @@ function smarty_function_mailto($params, &$smarty)
|
|||
}
|
||||
|
||||
return '<script type="text/javascript">eval(unescape(\''.$js_encode.'\'))</script>';
|
||||
|
||||
} elseif ($encode == 'javascript_charcode' ) {
|
||||
} elseif ($encode == 'javascript_charcode') {
|
||||
$string = '<a href="mailto:'.$address.'" '.$extra.'>'.$text.'</a>';
|
||||
|
||||
for($x = 0, $y = strlen($string); $x < $y; $x++ ) {
|
||||
$ord[] = ord($string[$x]);
|
||||
for ($x = 0, $y = strlen($string); $x < $y; $x++) {
|
||||
$ord[] = ord($string[$x]);
|
||||
}
|
||||
|
||||
$_ret = "<script type=\"text/javascript\" language=\"javascript\">\n";
|
||||
$_ret .= "<!--\n";
|
||||
$_ret .= "{document.write(String.fromCharCode(";
|
||||
$_ret .= implode(',',$ord);
|
||||
$_ret .= implode(',', $ord);
|
||||
$_ret .= "))";
|
||||
$_ret .= "}\n";
|
||||
$_ret .= "//-->\n";
|
||||
$_ret .= "</script>\n";
|
||||
|
||||
return $_ret;
|
||||
|
||||
|
||||
} elseif ($encode == 'hex') {
|
||||
|
||||
preg_match('!^(.*)(\?.*)$!',$address,$match);
|
||||
if(!empty($match[2])) {
|
||||
preg_match('!^(.*)(\?.*)$!', $address, $match);
|
||||
if (!empty($match[2])) {
|
||||
$smarty->trigger_error("mailto: hex encoding does not work with extra attributes. Try javascript.");
|
||||
return;
|
||||
}
|
||||
$address_encode = '';
|
||||
for ($x=0; $x < strlen($address); $x++) {
|
||||
if(preg_match('!\w!',$address[$x])) {
|
||||
if (preg_match('!\w!', $address[$x])) {
|
||||
$address_encode .= '%' . bin2hex($address[$x]);
|
||||
} else {
|
||||
$address_encode .= $address[$x];
|
||||
|
|
@ -151,15 +149,10 @@ function smarty_function_mailto($params, &$smarty)
|
|||
|
||||
$mailto = "mailto:";
|
||||
return '<a href="'.$mailto.$address_encode.'" '.$extra.'>'.$text_encode.'</a>';
|
||||
|
||||
} else {
|
||||
// no encoding
|
||||
return '<a href="mailto:'.$address.'" '.$extra.'>'.$text.'</a>';
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* vim: set expandtab: */
|
||||
|
||||
?>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue