Index: trunk/phase3/includes/GlobalFunctions.php |
— | — | @@ -296,7 +296,7 @@ |
297 | 297 | static $needle; |
298 | 298 | if ( is_null( $s ) ) { |
299 | 299 | $needle = null; |
300 | | - return; |
| 300 | + return ''; |
301 | 301 | } |
302 | 302 | |
303 | 303 | if ( is_null( $needle ) ) { |
— | — | @@ -537,6 +537,7 @@ |
538 | 538 | * Like wfUrlProtocols(), but excludes '//' from the protocol list. Use this if |
539 | 539 | * you need a regex that matches all URL protocols but does not match protocol- |
540 | 540 | * relative URLs |
| 541 | + * @return String |
541 | 542 | */ |
542 | 543 | function wfUrlProtocolsWithoutProtRel() { |
543 | 544 | return wfUrlProtocols( false ); |
— | — | @@ -960,6 +961,9 @@ |
961 | 962 | return (bool)$wgReadOnly; |
962 | 963 | } |
963 | 964 | |
| 965 | +/** |
| 966 | + * @return bool |
| 967 | + */ |
964 | 968 | function wfReadOnlyReason() { |
965 | 969 | global $wgReadOnly; |
966 | 970 | wfReadOnly(); |
— | — | @@ -2888,6 +2892,7 @@ |
2889 | 2893 | * |
2890 | 2894 | * @deprecated since 1.19 |
2891 | 2895 | * @see DeferredUpdates::doUpdate() |
| 2896 | + * @param $commit string |
2892 | 2897 | */ |
2893 | 2898 | function wfDoUpdates( $commit = '' ) { |
2894 | 2899 | DeferredUpdates::doUpdates( $commit ); |
— | — | @@ -2985,6 +2990,7 @@ |
2986 | 2991 | * |
2987 | 2992 | * @param $name String |
2988 | 2993 | * @param $p Array: parameters |
| 2994 | + * @return object |
2989 | 2995 | * @deprecated since 1.18, warnings in 1.18, removal in 1.20 |
2990 | 2996 | */ |
2991 | 2997 | function wfCreateObject( $name, $p ) { |
— | — | @@ -2992,6 +2998,9 @@ |
2993 | 2999 | return MWFunction::newObj( $name, $p ); |
2994 | 3000 | } |
2995 | 3001 | |
| 3002 | +/** |
| 3003 | + * @return bool |
| 3004 | + */ |
2996 | 3005 | function wfHttpOnlySafe() { |
2997 | 3006 | global $wgHttpOnlyBlacklist; |
2998 | 3007 | |
— | — | @@ -3122,7 +3131,6 @@ |
3123 | 3132 | * Split a wiki ID into DB name and table prefix |
3124 | 3133 | * |
3125 | 3134 | * @param $wiki String |
3126 | | - * @param $bits String |
3127 | 3135 | * |
3128 | 3136 | * @return array |
3129 | 3137 | */ |
— | — | @@ -3382,7 +3390,6 @@ |
3383 | 3391 | * |
3384 | 3392 | * @param $maxLag Integer (deprecated) |
3385 | 3393 | * @param $wiki mixed Wiki identifier accepted by wfGetLB |
3386 | | - * @return null |
3387 | 3394 | */ |
3388 | 3395 | function wfWaitForSlaves( $maxLag = false, $wiki = false ) { |
3389 | 3396 | $lb = wfGetLB( $wiki ); |
— | — | @@ -3414,6 +3421,7 @@ |
3415 | 3422 | * Count down from $n to zero on the terminal, with a one-second pause |
3416 | 3423 | * between showing each number. For use in command-line scripts. |
3417 | 3424 | * @codeCoverageIgnore |
| 3425 | + * @param $n int |
3418 | 3426 | */ |
3419 | 3427 | function wfCountDown( $n ) { |
3420 | 3428 | for ( $i = $n; $i >= 0; $i-- ) { |
— | — | @@ -3522,7 +3530,7 @@ |
3523 | 3531 | * See unit test for examples. |
3524 | 3532 | * |
3525 | 3533 | * @param $code String: The language code. |
3526 | | - * @return $langCode String: The language code which complying with BCP 47 standards. |
| 3534 | + * @return String: The language code which complying with BCP 47 standards. |
3527 | 3535 | */ |
3528 | 3536 | function wfBCP47( $code ) { |
3529 | 3537 | $codeSegment = explode( '-', $code ); |
Index: trunk/phase3/includes/WikiPage.php |
— | — | @@ -15,7 +15,6 @@ |
16 | 16 | class WikiPage extends Page { |
17 | 17 | /** |
18 | 18 | * @var Title |
19 | | - * @protected |
20 | 19 | */ |
21 | 20 | public $mTitle = null; |
22 | 21 | |
Index: trunk/phase3/includes/specials/SpecialBrokenRedirects.php |
— | — | @@ -22,7 +22,7 @@ |
23 | 23 | */ |
24 | 24 | |
25 | 25 | /** |
26 | | - * A special page listing redirects tonon existent page. Those should be |
| 26 | + * A special page listing redirects to non existent page. Those should be |
27 | 27 | * fixed to point to an existing page. |
28 | 28 | * |
29 | 29 | * @ingroup SpecialPage |
Index: trunk/phase3/trackback.php |
— | — | @@ -26,6 +26,9 @@ |
27 | 27 | exit; |
28 | 28 | } |
29 | 29 | |
| 30 | + /** |
| 31 | + * @param $err string |
| 32 | + */ |
30 | 33 | private function XMLerror( $err = "Invalid request." ) { |
31 | 34 | header( "HTTP/1.0 400 Bad Request" ); |
32 | 35 | header( "Content-Type: application/xml; charset=utf-8" ); |
Index: trunk/phase3/img_auth.php |
— | — | @@ -50,8 +50,7 @@ |
51 | 51 | if ( $dotPos !== false ) { |
52 | 52 | $whitelist[] = substr( $path, $dotPos + 1 ); |
53 | 53 | } |
54 | | -if ( !$wgRequest->checkUrlExtension( $whitelist ) ) |
55 | | -{ |
| 54 | +if ( !$wgRequest->checkUrlExtension( $whitelist ) ) { |
56 | 55 | return; |
57 | 56 | } |
58 | 57 | |
— | — | @@ -59,38 +58,44 @@ |
60 | 59 | $realUpload = realpath( $wgUploadDirectory ); |
61 | 60 | |
62 | 61 | // Basic directory traversal check |
63 | | -if( substr( $filename, 0, strlen( $realUpload ) ) != $realUpload ) |
| 62 | +if( substr( $filename, 0, strlen( $realUpload ) ) != $realUpload ) { |
64 | 63 | wfForbidden('img-auth-accessdenied','img-auth-notindir'); |
| 64 | +} |
65 | 65 | |
66 | 66 | // Extract the file name and chop off the size specifier |
67 | 67 | // (e.g. 120px-Foo.png => Foo.png) |
68 | 68 | $name = wfBaseName( $path ); |
69 | | -if( preg_match( '!\d+px-(.*)!i', $name, $m ) ) |
| 69 | +if( preg_match( '!\d+px-(.*)!i', $name, $m ) ) { |
70 | 70 | $name = $m[1]; |
| 71 | +} |
71 | 72 | |
72 | 73 | // Check to see if the file exists |
73 | | -if( !file_exists( $filename ) ) |
| 74 | +if( !file_exists( $filename ) ) { |
74 | 75 | wfForbidden('img-auth-accessdenied','img-auth-nofile',$filename); |
| 76 | +} |
75 | 77 | |
76 | 78 | // Check to see if tried to access a directory |
77 | | -if( is_dir( $filename ) ) |
| 79 | +if( is_dir( $filename ) ) { |
78 | 80 | wfForbidden('img-auth-accessdenied','img-auth-isdir',$filename); |
| 81 | +} |
79 | 82 | |
80 | | - |
81 | 83 | $title = Title::makeTitleSafe( NS_FILE, $name ); |
82 | 84 | |
83 | 85 | // See if could create the title object |
84 | | -if( !$title instanceof Title ) |
| 86 | +if( !$title instanceof Title ) { |
85 | 87 | wfForbidden('img-auth-accessdenied','img-auth-badtitle',$name); |
| 88 | +} |
86 | 89 | |
87 | 90 | // Run hook |
88 | | -if (!wfRunHooks( 'ImgAuthBeforeStream', array( &$title, &$path, &$name, &$result ) ) ) |
| 91 | +if (!wfRunHooks( 'ImgAuthBeforeStream', array( &$title, &$path, &$name, &$result ) ) ) { |
89 | 92 | wfForbidden($result[0],$result[1],array_slice($result,2)); |
| 93 | +} |
90 | 94 | |
91 | 95 | // Check user authorization for this title |
92 | 96 | // UserCanRead Checks Whitelist too |
93 | | -if( !$title->userCanRead() ) |
| 97 | +if( !$title->userCanRead() ) { |
94 | 98 | wfForbidden('img-auth-accessdenied','img-auth-noread',$name); |
| 99 | +} |
95 | 100 | |
96 | 101 | // Stream the requested file |
97 | 102 | wfDebugLog( 'img_auth', "Streaming `".$filename."`." ); |
— | — | @@ -101,16 +106,18 @@ |
102 | 107 | * Issue a standard HTTP 403 Forbidden header ($msg1-a message index, not a message) and an |
103 | 108 | * error message ($msg2, also a message index), (both required) then end the script |
104 | 109 | * subsequent arguments to $msg2 will be passed as parameters only for replacing in $msg2 |
| 110 | + * @param $msg1 |
| 111 | + * @param $msg2 |
105 | 112 | */ |
106 | | -function wfForbidden($msg1,$msg2) { |
| 113 | +function wfForbidden( $msg1, $msg2 ) { |
107 | 114 | global $wgImgAuthDetails; |
108 | 115 | $args = func_get_args(); |
109 | 116 | array_shift( $args ); |
110 | 117 | array_shift( $args ); |
111 | | - $MsgHdr = htmlspecialchars(wfMsg($msg1)); |
112 | | - $detailMsg = (htmlspecialchars(wfMsg(($wgImgAuthDetails ? $msg2 : 'badaccess-group0'),$args))); |
113 | | - wfDebugLog('img_auth', "wfForbidden Hdr:".wfMsgExt( $msg1, array('language' => 'en'))." Msg: ". |
114 | | - wfMsgExt($msg2,array('language' => 'en'),$args)); |
| 118 | + $MsgHdr = htmlspecialchars( wfMsg( $msg1 ) ); |
| 119 | + $detailMsg = ( htmlspecialchars( wfMsg( ( $wgImgAuthDetails ? $msg2 : 'badaccess-group0' ), $args ) ) ); |
| 120 | + wfDebugLog('img_auth', "wfForbidden Hdr:".wfMsgExt( $msg1, array( 'language' => 'en' ) )." Msg: ". |
| 121 | + wfMsgExt( $msg2, array('language' => 'en' ), $args ) ); |
115 | 122 | header( 'HTTP/1.0 403 Forbidden' ); |
116 | 123 | header( 'Cache-Control: no-cache' ); |
117 | 124 | header( 'Content-Type: text/html; charset=utf-8' ); |
Index: trunk/phase3/thumb.php |
— | — | @@ -75,7 +75,7 @@ |
76 | 76 | // Check permissions if there are read restrictions |
77 | 77 | if ( !in_array( 'read', User::getGroupPermissions( array( '*' ) ), true ) ) { |
78 | 78 | if ( !$img->getTitle()->userCanRead() ) { |
79 | | - wfThumbError( 403, 'Access denied. You do not have permission to access ' . |
| 79 | + wfThumbError( 403, 'Access denied. You do not have permission to access ' . |
80 | 80 | 'the source file.' ); |
81 | 81 | wfProfileOut( __METHOD__ ); |
82 | 82 | return; |
— | — | @@ -162,6 +162,10 @@ |
163 | 163 | wfProfileOut( __METHOD__ ); |
164 | 164 | } |
165 | 165 | |
| 166 | +/** |
| 167 | + * @param $status |
| 168 | + * @param $msg |
| 169 | + */ |
166 | 170 | function wfThumbError( $status, $msg ) { |
167 | 171 | global $wgShowHostnames; |
168 | 172 | header( 'Cache-Control: no-cache' ); |