mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-26 05:48:41 +00:00
fix(web/problem): not escape problem title
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
274baec200
commit
aeb6628314
@ -302,14 +302,29 @@ class HTML {
|
|||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function link(?string $uri, $text, $cfg = ['location' => 'main']) {
|
public static function link(?string $uri, $text, $cfg = []) {
|
||||||
|
$cfg += ['location' => 'main', 'escape' => true];
|
||||||
|
|
||||||
|
if ($cfg['escape']) {
|
||||||
|
$text = HTML::escape($text);
|
||||||
|
}
|
||||||
|
|
||||||
if ($uri === null) {
|
if ($uri === null) {
|
||||||
return '<a>' . HTML::escape($text) . '</a>';
|
return HTML::tag('a', [], $text);
|
||||||
}
|
}
|
||||||
return '<a class="text-decoration-none" href="' . HTML::url($uri, $cfg) . '">' . HTML::escape($text) . '</a>';
|
|
||||||
|
return HTML::tag('a', ['href' => HTML::url($uri, $cfg)], $text);
|
||||||
}
|
}
|
||||||
public static function autolink(string $url, array $attr = []) {
|
|
||||||
return '<a class="text-decoration-none" href="' . $url . '"' . HTML::attr($attr) . '>' . $url . '</a>';
|
public static function autolink(string $url, array $attr = [], $cfg = []) {
|
||||||
|
$cfg += ['escape' => true];
|
||||||
|
$text = $url;
|
||||||
|
|
||||||
|
if ($cfg['escape']) {
|
||||||
|
$text = HTML::escape($text);
|
||||||
|
}
|
||||||
|
|
||||||
|
return '<a href="' . $url . '"' . HTML::attr($attr) . '>' . $text . '</a>';
|
||||||
}
|
}
|
||||||
public static function js_src(string $uri, array $cfg = []) {
|
public static function js_src(string $uri, array $cfg = []) {
|
||||||
$cfg += [
|
$cfg += [
|
||||||
|
@ -83,7 +83,7 @@ class UOJProblem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function getLink(array $cfg = []) {
|
public function getLink(array $cfg = []) {
|
||||||
return HTML::link($this->getUri(), $this->getTitle($cfg));
|
return HTML::link($this->getUri(), $this->getTitle($cfg), ['escape' => false]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getAttachmentUri() {
|
public function getAttachmentUri() {
|
||||||
|
Loading…
Reference in New Issue
Block a user