55use FormatJson ;
66use Html ;
77use Inbox \Models \Email ;
8- use Sanitizer ;
98use SpecialPage ;
109
1110class SpecialInbox extends SpecialPage {
@@ -24,22 +23,26 @@ public function execute( $par ) {
2423 } else {
2524 $ this ->showAllEmails ( $ this ->getUser ()->getEmail () );
2625 }
27-
2826 }
2927
28+ /**
29+ * @param string $emailAddress
30+ * @param string $emailId
31+ */
3032 private function showEmail ( $ emailAddress , $ emailId ) {
3133 $ out = $ this ->getOutput ();
3234 $ email = Email::get ( $ emailAddress , $ emailId );
3335 if ( $ email ) {
3436 $ out ->setArticleBodyOnly ( true );
37+ // @phan-suppress-next-line SecurityCheck-XSS
3538 $ out ->addHTML ( $ email ->email_subject );
3639 $ out ->addHTML ( '<hr /> ' );
3740 $ headers = array_change_key_case ( FormatJson::decode ( $ email ->email_headers , true ) );
3841 if ( strpos ( $ headers [ 'content-type ' ], 'multipart ' ) !== false ) {
3942 preg_match ( '/boundary=\"(.*?)\"/ ' , $ headers [ 'content-type ' ], $ m );
4043 $ boundary = $ m [1 ];
4144 $ parts = explode ( '-- ' . $ boundary , $ email ->email_body );
42- $ this ->showEmailcontent ( $ parts [1 ], true );
45+ $ this ->showEmailcontent ( $ parts [1 ], true );
4346 $ out ->addHTML ( '<hr /> ' );
4447 $ this ->showEmailcontent ( $ parts [2 ] );
4548 } elseif ( strpos ( $ headers [ 'content-type ' ], 'text/plain ' ) >= 0 ) {
@@ -55,6 +58,10 @@ private function showEmail( $emailAddress, $emailId ) {
5558 }
5659 }
5760
61+ /**
62+ * @param string $content
63+ * @param bool $plainText
64+ */
5865 private function showEmailcontent ( $ content , $ plainText = false ) {
5966 $ this ->getOutput ()->addHTML ( Html::rawElement (
6067 $ plainText ? 'pre ' : 'div ' ,
@@ -63,11 +70,15 @@ private function showEmailcontent( $content, $plainText = false ) {
6370 ) );
6471 }
6572
73+ /**
74+ * @param string $emailAddress
75+ */
6676 private function showAllEmails ( $ emailAddress ) {
6777 parent ::execute ( null );
6878 $ emails = Email::getAll ( $ emailAddress );
6979 if ( $ emails ) {
7080 $ this ->getOutput ()->addModuleStyles ( 'inbox.style ' );
81+ // @phan-suppress-next-line SecurityCheck-XSS
7182 $ this ->getOutput ()->addHTML ( Html::rawElement (
7283 'div ' ,
7384 [ 'class ' => 'email-all ' ],
0 commit comments