Skip to content

Commit e4e9512

Browse files
authored
News: Add support for minisprites (#2300)
* News: Add support for minisprites * SANITIZE THE HTML.
1 parent 72d1216 commit e4e9512

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

play.pokemonshowdown.com/js/client-mainmenu.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@
132132
options.noMinimize = options.noMinimize || false;
133133

134134
this.$pmBox[options.append ? 'append' : 'prepend']('<div class="pm-window ' + options.cssClass + '" ' + options.attributes + '><h3><button class="closebutton" tabindex="-1" aria-label="Close"><i class="fa fa-times-circle"></i></button>' + (!options.noMinimize ? '<button class="minimizebutton" tabindex="-1" aria-label="Minimize"><i class="fa fa-minus-circle"></i></button>' : '') + options.title + '</h3><div class="pm-log" style="overflow:visible;height:' + (typeof options.height === 'number' ? options.height + 'px' : options.height) + ';' + (parseInt(options.height, 10) ? 'max-height:none' : (options.maxHeight ? 'max-height:' + (typeof options.maxHeight === 'number' ? options.maxHeight + 'px' : options.maxHeight) : '')) + '">' +
135-
options.html +
135+
BattleLog.sanitizeHTML(options.html) +
136136
'</div></div>');
137137
},
138138

pokemonshowdown.com/news/manage.php

+4
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ function saveNews() {
6969
$summary = str_replace("[/url]", '</a>', $summary);
7070
$summary = str_replace("[b]", '<strong>', $summary);
7171
$summary = str_replace("[/b]", '</strong>', $summary);
72+
$summary = preg_replace('/\[psicon (pokemon|item|type|category)="([^\]]+)"\]/', '<psicon $1="$2" />', $summary);
73+
$summary = preg_replace('/\[psicon (pokemon|item|type|category)=([^\]]+)\]/', '<psicon $1="$2" />', $summary);
7274
$summary = '<p>'.$summary.'</p>';
7375

7476
$newsCache[$topic_id]['summary_html'] = $summary;
@@ -88,6 +90,8 @@ function saveNews() {
8890
$details = str_replace("[/url]", '</a>', $details);
8991
$details = str_replace("[b]", '<strong>', $details);
9092
$details = str_replace("[/b]", '</strong>', $details);
93+
$details = preg_replace('/\[psicon (pokemon|item|type|category)="([^\]]+)"\]/', '<psicon $1="$2" />', $details);
94+
$details = preg_replace('/\[psicon (pokemon|item|type|category)=([^\]]+)\]/', '<psicon $1="$2" />', $details);
9195
$details = '<p>'.$details.'</p>';
9296
$newsCache[$topic_id]['details_html'] = $details;
9397
} else {

0 commit comments

Comments
 (0)