Jack Phoenix has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/226904

Change subject: More work on HTML validation
......................................................................

More work on HTML validation

Change-Id: Idecb9523802427008d7146ecfe56646cebb919db
---
M SiteScout.php
M SiteScoutClass.php
M resources/css/sitescout.css
M resources/js/SiteScout.js
4 files changed, 15 insertions(+), 22 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SiteScout 
refs/changes/04/226904/1

diff --git a/SiteScout.php b/SiteScout.php
index 413e347..21f52e1 100644
--- a/SiteScout.php
+++ b/SiteScout.php
@@ -8,18 +8,10 @@
  * @author David Pean <[email protected]>
  * @author Jack Phoenix <[email protected]>
  * @copyright Copyright © 2007 David Pean
- * @copyright Copyright © 2014 Jack Phoenix
+ * @copyright Copyright © 2014-2015 Jack Phoenix
  * @link https://www.mediawiki.org/wiki/Extension:SiteScout Documentation
  * @license https://www.gnu.org/copyleft/gpl.html GNU General Public License 
2.0 or later
  */
-
-/**
- * Protect against register_globals vulnerabilities.
- * This line must be present before any global variable is referenced.
- */
-if ( !defined( 'MEDIAWIKI' ) ) {
-       die( "This is not a valid entry point.\n" );
-}
 
 // Extension credits that show up on Special:Version
 $wgExtensionCredits['specialpage'][] = array(
diff --git a/SiteScoutClass.php b/SiteScoutClass.php
index a87221c..b95c19e 100644
--- a/SiteScoutClass.php
+++ b/SiteScoutClass.php
@@ -94,7 +94,7 @@
                                                        </tr>
                                                        <tr>
                                                                <td>
-                                                                       <img 
src=\"{$imgPath}voteIcon.gif\" border=\"0\" alt=\"Votes\"/>
+                                                                       <img 
src=\"{$imgPath}voteIcon.gif\" alt=\"Votes\"/>
                                                                </td>
                                                                <td>" . 
wfMessage( 'sitescout-votes' )->plain() . '</td>
                                                                <td>
@@ -116,7 +116,7 @@
                                                        </tr>
                                                        <tr>
                                                                <td>
-                                                                       <img 
src=\"{$imgPath}editIcon.gif\" border=\"0\" alt=\"Edits\"/>
+                                                                       <img 
src=\"{$imgPath}editIcon.gif\" alt=\"Edits\"/>
                                                                </td>
                                                                <td>" . 
wfMessage( 'sitescout-edits' )->plain() . '</td>
                                                                <td>
@@ -139,7 +139,7 @@
 
                                                        <tr>
                                                                <td>
-                                                                       <img 
src=\"{$imgPath}comment.gif\" border=\"0\" alt=\"Comments\"/>
+                                                                       <img 
src=\"{$imgPath}comment.gif\" alt=\"Comments\"/>
                                                                </td>
                                                                <td>" . 
wfMessage( 'sitescout-comments' )->plain() . '</td>
                                                                <td>
@@ -162,7 +162,7 @@
                if ( class_exists( 'UserStatus' ) ) {
                        $output .= "<tr>
                                                                        <td>
-                                                                               
<img src=\"{$imgPath}note.gif\" border=\"0\" alt=\"Network Thoughts\"/>
+                                                                               
<img src=\"{$imgPath}note.gif\" alt=\"Network Thoughts\"/>
                                                                        </td>
                                                                        <td>" . 
wfMessage( 'sitescout-thoughts' )->plain() . '</td>
                                                                        <td>
@@ -170,7 +170,7 @@
                                                                                
        <table>
                                                                                
                <tr>
                                                                                
                        <td>
-                                                                               
                                <table bgcolor="#FFFCA9" height="7" width="' . 
( $networkupdates / $largest_value * 300 ) . "\">
+                                                                               
                                <table style="background-color: #FFFCA9; 
height: 7px; width:' . ( $networkupdates / $largest_value * 300 ) . "px;\">
                                                                                
                                        <tr>
                                                                                
                                                <td></td>
                                                                                
                                        </tr>
@@ -626,7 +626,7 @@
                                $title = Title::makeTitle( $item['namespace'], 
$item['pagetitle'] );
                                $user_title = Title::makeTitle( NS_USER, 
$item['username'] );
                                $output .= '<div id="comment-' . $x . '" 
class="site-scout"><span class="item-info">';
-                               $output .= '<img src="' . $imgPath . 
$this->getTypeIcon( $item['type'] ) . '" border="0" />';
+                               $output .= '<img src="' . $imgPath . 
$this->getTypeIcon( $item['type'] ) . '" alt="" />';
 
                                if ( $item['minor'] == 1 ) {
                                        $output .= '<br /><span 
class="edit-minor">' . wfMessage( 'sitescout-minor' )->plain() . '</span>';
@@ -668,11 +668,11 @@
 
                                $avatar = new wAvatar( $item['userid'], 's' );
                                $commentIcon = $avatar->getAvatarURL();
-                               $talk_page = 
$user_title->getTalkPage()->getFullURL();
+                               $talk_page = htmlspecialchars( 
$user_title->getTalkPage()->getFullURL(), ENT_QUOTES );
                                if ( $wgUserBoard ) {
                                        $talk_page = 
UserBoard::getUserBoardURL( $item['username'] );
                                }
-                               $output .= '<span class="item-user"><a href="' 
. $user_title->getFullURL() . '" class="item-user-link">' . $commentIcon . ' ' 
. $item['username'] . '</a><a href="' . $talk_page . '" 
class="item-user-talk"><img src="' . $wgExtensionAssetsPath . 
'/SiteScout/resources/images/talkPageIcon.png" alt="" border="0" hspace="3" 
align="middle" /></a></span>';
+                               $output .= '<span class="item-user"><a href="' 
. htmlspecialchars( $user_title->getFullURL(), ENT_QUOTES ) . '" 
class="item-user-link">' . $commentIcon . ' ' . $item['username'] . '</a><a 
href="' . $talk_page . '" class="item-user-talk"><img src="' . 
$wgExtensionAssetsPath . '/SiteScout/resources/images/talkPageIcon.png" alt="" 
/></a></span>';
                                $output .= '</div>';
                                $x++;
                        }
diff --git a/resources/css/sitescout.css b/resources/css/sitescout.css
index 1a383f9..afd021d 100644
--- a/resources/css/sitescout.css
+++ b/resources/css/sitescout.css
@@ -31,7 +31,7 @@
        text-decoration: none;
 }
 
-.item-info  {
+.item-info {
        font-size: 85%;
        text-align: center;
        width: 45px;
@@ -59,6 +59,7 @@
 .item-user-talk img {
        vertical-align: middle;
        border: 0px;
+       margin-left: 3px;
 }
 
 .item-comment {
diff --git a/resources/js/SiteScout.js b/resources/js/SiteScout.js
index a973297..e121f48 100644
--- a/resources/js/SiteScout.js
+++ b/resources/js/SiteScout.js
@@ -160,7 +160,7 @@
                }
                text = '<div class="site-scout">';
                text += '<span class="item-info">'
-               +               '<img src="' + mw.config.get( 
'wgExtensionAssetsPath' ) + '/SocialProfile/images/' + item.type_icon + '" 
border="0" alt="" />'
+               +               '<img src="' + mw.config.get( 
'wgExtensionAssetsPath' ) + '/SocialProfile/images/' + item.type_icon + '" 
alt="" />'
                +                       ( ( item.is_new == 1 ) ? '<br /><span 
class="edit-new">' + mw.msg( 'sitescout-new' ) + '</span>' : ( ( item.is_minor 
== 1 ) ? '<br /><span class="edit-minor">' + mw.msg( 'sitescout-minor' ) + 
'</span>' : '' ) )
                +       '</span>'
                +       '<a href="' + item.url + '" class="item-title">'
@@ -172,10 +172,10 @@
                +       '</span>'
                +       '<span class="item-user">'
                +       '<a href="' + item.user_page + '" 
class="item-user-link">'
-               +               '<img src="' + mw.config.get( 'wgUploadPath' ) 
+ '/avatars/' + item.avatar + '" border="0" alt="" /> '
+               +               '<img src="' + mw.config.get( 'wgUploadPath' ) 
+ '/avatars/' + item.avatar + '" alt="" /> '
                +               item.username
                +       '</a>'
-               +       '<a href="' + item.user_talkpage + '" 
class="item-user-talk"><img src="' + mw.config.get( 'wgExtensionAssetsPath' ) + 
'/SiteScout/resources/images/talkPageIcon.png" border="0" hspace="3" 
align="middle" alt="" /></a>'
+               +       '<a href="' + item.user_talkpage + '" 
class="item-user-talk"><img src="' + mw.config.get( 'wgExtensionAssetsPath' ) + 
'/SiteScout/resources/images/talkPageIcon.png" hspace="3" align="middle" alt="" 
/></a>'
                +       '</span>'
                +       '</div>';
                return text;
@@ -214,7 +214,7 @@
                document.getElementById( 'vote_stats' ).innerHTML = 
'<table><tr><td><table style="background-color:#009900; height:7px;" width="' + 
( SiteScout.votes_count / SiteScout.largest_value * 300 ) + 
'"><tr><td></td></tr></table></td><td>' + SiteScout.votes_count + 
'</td></tr></table>';
                document.getElementById( 'comment_stats' ).innerHTML = 
'<table><tr><td><table style="background-color:#990000; height:7px;" width="' + 
( SiteScout.comments_count / SiteScout.largest_value * 300 ) + 
'"><tr><td></td></tr></table></td><td>' + SiteScout.comments_count + 
'</td></tr></table>';
                if ( document.getElementById( 'networkupdates_stats' ) ) {
-                       document.getElementById( 'networkupdates_stats' 
).innerHTML = '<table><tr><td><table style="background-color:#FFFCA9; 
height:7px;" width="' + (SiteScout.networkupdates_count / 
SiteScout.largest_value * 300 ) + '"><tr><td></td></tr></table></td><td>' + 
SiteScout.networkupdates_count + '</td></tr></table>';
+                       document.getElementById( 'networkupdates_stats' 
).innerHTML = '<table><tr><td><table style="background-color:#FFFCA9; 
height:7px;" width="' + ( SiteScout.networkupdates_count / 
SiteScout.largest_value * 300 ) + '"><tr><td></td></tr></table></td><td>' + 
SiteScout.networkupdates_count + '</td></tr></table>';
                }
        }
 };

-- 
To view, visit https://gerrit.wikimedia.org/r/226904
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idecb9523802427008d7146ecfe56646cebb919db
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SiteScout
Gerrit-Branch: master
Gerrit-Owner: Jack Phoenix <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to