Index: trunk/extensions/RT/RT.php |
— | — | @@ -20,7 +20,7 @@ |
21 | 21 | |
22 | 22 | $rt_uri = 'http://www.mediawiki.org/wiki/Extension:RT'; |
23 | 23 | |
24 | | -## Default values: Override in LocalSettings.php, not here! |
| 24 | +# Default values: Override in LocalSettings.php, not here! |
25 | 25 | $wgRequestTracker_URL = 'http://rt.example.com/Ticket/Display.html?id'; |
26 | 26 | $wgRequestTracker_DBconn = 'user=rt dbname=rt'; |
27 | 27 | $wgRequestTracker_Formats = array(); |
— | — | @@ -28,13 +28,13 @@ |
29 | 29 | $wgRequestTracker_Useballoons = 1; |
30 | 30 | $wgRequestTracker_Active = 1; |
31 | 31 | |
32 | | -## Time formatting |
33 | | -## Example formats: |
34 | | -## FMHH:MI AM FMMon DD, YYYY => 2:42 PM Jan 23, 2009 |
35 | | -## HH:MI FMMonth DD, YYYY => 14:42 January 23, 2009 |
36 | | -## YYYY/MM/DD => 2009/01/23 |
37 | | -## For a more complete list of possibilities, please visit: |
38 | | -## http://www.postgresql.org/docs/current/interactive/functions-formatting.html |
| 32 | +# Time formatting |
| 33 | +# Example formats: |
| 34 | +# FMHH:MI AM FMMon DD, YYYY => 2:42 PM Jan 23, 2009 |
| 35 | +# HH:MI FMMonth DD, YYYY => 14:42 January 23, 2009 |
| 36 | +# YYYY/MM/DD => 2009/01/23 |
| 37 | +# For a more complete list of possibilities, please visit: |
| 38 | +# http://www.postgresql.org/docs/current/interactive/functions-formatting.html |
39 | 39 | $wgRequestTracker_TIMEFORMAT_LASTUPDATED = 'FMHH:MI AM FMMonth DD, YYYY'; |
40 | 40 | $wgRequestTracker_TIMEFORMAT_LASTUPDATED2 = 'FMMonth DD, YYYY'; |
41 | 41 | $wgRequestTracker_TIMEFORMAT_CREATED = 'FMHH:MI AM FMMonth DD, YYYY'; |
— | — | @@ -80,9 +80,9 @@ |
81 | 81 | return true; |
82 | 82 | } |
83 | 83 | |
84 | | - |
| 84 | + |
85 | 85 | // This is called to process <rt>...</rt> within a page |
86 | | -function rtRender( $input, $args=array(), $parser=null ) { |
| 86 | +function rtRender( $input, $args = array(), $parser = null ) { |
87 | 87 | |
88 | 88 | global $wgRequestTracker_Cachepage, $wgRequestTracker_Active, $wgRequestTracker_DBconn, |
89 | 89 | $wgRequestTracker_TIMEFORMAT_LASTUPDATED, |
— | — | @@ -128,7 +128,7 @@ |
129 | 129 | } |
130 | 130 | } |
131 | 131 | |
132 | | - // If we are not 'active', we leave right away, with minimal output |
| 132 | + // If we are not 'active', we leave right away, with minimal output |
133 | 133 | if ( !$wgRequestTracker_Active ) { |
134 | 134 | if ( $ticketnum ) { |
135 | 135 | return "<span class='rt-ticket-inactive'>RT #$ticketnum</span>"; |
— | — | @@ -164,8 +164,8 @@ |
165 | 165 | |
166 | 166 | // If just a single number, treat it as <rt>#</rt> |
167 | 167 | if ( 1 === count( $args ) ) { |
168 | | - if ( preg_match( '/^\d+$/', key($args) ) ) { |
169 | | - $ticketnum = key($args); |
| 168 | + if ( preg_match( '/^\d+$/', key( $args ) ) ) { |
| 169 | + $ticketnum = key( $args ); |
170 | 170 | } |
171 | 171 | } |
172 | 172 | |
— | — | @@ -221,7 +221,7 @@ |
222 | 222 | if ( array_key_exists( $word, $valid_orderby ) ) { |
223 | 223 | $word = $valid_orderby[$word]; |
224 | 224 | } |
225 | | - else if ( !preg_match ('/^\d+$/', $word ) ) { |
| 225 | + else if ( !preg_match ( '/^\d+$/', $word ) ) { |
226 | 226 | die ( wfMsg ( 'rt-badorderby', $word ) ); |
227 | 227 | } |
228 | 228 | $orderby .= " $word$mod,"; |
— | — | @@ -251,7 +251,7 @@ |
252 | 252 | |
253 | 253 | // See if we are limiting to one or more queues |
254 | 254 | $searchq = ''; |
255 | | - if ( array_key_exists('q', $args ) ) { |
| 255 | + if ( array_key_exists( 'q', $args ) ) { |
256 | 256 | $qargs = trim( strtolower( $args['q'] ) ); |
257 | 257 | $searchq = 'AND LOWER(q.name) IN ('; |
258 | 258 | foreach ( preg_split( '/\s*,\s*/', $qargs ) as $word ) { |
— | — | @@ -266,7 +266,7 @@ |
267 | 267 | |
268 | 268 | // See if we are limiting to one or more owners |
269 | 269 | $searchowner = ''; |
270 | | - if ( array_key_exists('o', $args ) ) { |
| 270 | + if ( array_key_exists( 'o', $args ) ) { |
271 | 271 | $oargs = trim( strtolower( $args['o'] ) ); |
272 | 272 | $searchowner = 'AND LOWER(u.name) IN ('; |
273 | 273 | foreach ( preg_split( '/\s*,\s*/', $oargs ) as $word ) { |
— | — | @@ -298,8 +298,8 @@ |
299 | 299 | |
300 | 300 | // The queue: show by default unless searching a single queue |
301 | 301 | $showqueue = 1; |
302 | | - if ( array_key_exists('noqueue', $args ) |
303 | | - || ($searchq |
| 302 | + if ( array_key_exists( 'noqueue', $args ) |
| 303 | + || ( $searchq |
304 | 304 | && false === strpos( $searchq, ',' ) |
305 | 305 | && !array_key_exists( 'queue', $args ) ) ) { |
306 | 306 | $showqueue = 0; |
— | — | @@ -317,7 +317,7 @@ |
318 | 318 | // The status: show by default unless searching a single status |
319 | 319 | $showstatus = 1; |
320 | 320 | if ( array_key_exists( 'nostatus', $args ) |
321 | | - || ( false === strpos($searchstatus, ',' ) |
| 321 | + || ( false === strpos( $searchstatus, ',' ) |
322 | 322 | && !array_key_exists( 'status', $args ) ) ) { |
323 | 323 | $showstatus = 0; |
324 | 324 | } |
— | — | @@ -337,7 +337,7 @@ |
338 | 338 | $showage = array_key_exists( 'age', $args ); |
339 | 339 | |
340 | 340 | // Unless 'tablerows' has been set, output the table and header tags |
341 | | - if ( !array_key_exists( 'tablerows',$args ) ) { |
| 341 | + if ( !array_key_exists( 'tablerows', $args ) ) { |
342 | 342 | |
343 | 343 | $output = "<table class='rt-table' border='1'><tr>"; |
344 | 344 | |
— | — | @@ -362,12 +362,12 @@ |
363 | 363 | |
364 | 364 | if ( $showticket ) { |
365 | 365 | $id = rtFancyLink( $row, $args, $parser, 1 ); |
366 | | - $output .= "<td style='white-space: nowrap'>$id</td>"; |
| 366 | + $output .= "<td style='white-space: nowrap'>$id</td>"; |
367 | 367 | } |
368 | 368 | if ( $showqueue ) { $output .= '<td>' . htmlspecialchars( $row['queue'] ) . '</td>'; } |
369 | 369 | if ( $showsubject ) { $output .= '<td>' . htmlspecialchars( $row['subject'] ) . '</td>'; } |
370 | 370 | if ( $showstatus ) { $output .= '<td>' . htmlspecialchars( $row['status'] ) . '</td>'; } |
371 | | - if ( $showpriority ) { $output .= '<td>' . htmlspecialchars( $row['priority'] ). '</td>'; } |
| 371 | + if ( $showpriority ) { $output .= '<td>' . htmlspecialchars( $row['priority'] ) . '</td>'; } |
372 | 372 | if ( $showowner ) { $output .= '<td>' . htmlspecialchars( $row['owner'] ) . '</td>'; } |
373 | 373 | if ( $showupdated ) { $output .= '<td>' . $row['lastupdated'] . '</td>'; } |
374 | 374 | if ( $showupdated2 ) { $output .= '<td>' . $row['lastupdated2'] . '</td>'; } |
— | — | @@ -379,7 +379,7 @@ |
380 | 380 | $output .= '<tr>'; |
381 | 381 | } |
382 | 382 | |
383 | | - if ( !array_key_exists( 'tablerows',$args ) ) { |
| 383 | + if ( !array_key_exists( 'tablerows', $args ) ) { |
384 | 384 | $output .= '</table>'; |
385 | 385 | } |
386 | 386 | |
— | — | @@ -394,8 +394,8 @@ |
395 | 395 | $ticketnum = $row['id']; |
396 | 396 | $ret = "[$wgRequestTracker_URL=$ticketnum RT #$ticketnum]"; |
397 | 397 | |
398 | | - ## Check for any custom format args in the rt tag. |
399 | | - ## If any are found, use that and ignore any other args |
| 398 | + # Check for any custom format args in the rt tag. |
| 399 | + # If any are found, use that and ignore any other args |
400 | 400 | $foundformat = 0; |
401 | 401 | foreach ( array_keys( $args ) as $val ) { |
402 | 402 | if ( array_key_exists( $val, $wgRequestTracker_Formats ) ) { |
— | — | @@ -409,7 +409,7 @@ |
410 | 410 | } |
411 | 411 | } |
412 | 412 | |
413 | | - ## Process any column-based args to the rt tag |
| 413 | + # Process any column-based args to the rt tag |
414 | 414 | if ( !$foundformat and !$istable ) { |
415 | 415 | foreach ( array_keys( $args ) as $val ) { |
416 | 416 | if ( array_key_exists( $val, $row ) ) { |
— | — | @@ -437,7 +437,7 @@ |
438 | 438 | $safesub = htmlspecialchars( $safesub ); |
439 | 439 | |
440 | 440 | $safeowner = $row['owner']; |
441 | | - if ($row['owner'] !== $row['username']) { |
| 441 | + if ( $row['owner'] !== $row['username'] ) { |
442 | 442 | $safeowner .= " ($row[username])"; |
443 | 443 | } |
444 | 444 | $safeowner = preg_replace( '/\"/', '\"', $safeowner ); |
— | — | @@ -461,7 +461,7 @@ |
462 | 462 | $text .= "<br />Last updated: <b>$row[lastupdated]</b>"; |
463 | 463 | } |
464 | 464 | |
465 | | - ## Prepare some balloon-tek |
| 465 | + # Prepare some balloon-tek |
466 | 466 | $link = isset( $args['link'] ) ? $args['link'] : ''; |
467 | 467 | $target = isset( $args['target'] ) ? $args['target'] : ''; |
468 | 468 | $sticky = isset( $args['sticky'] ) ? $args['sticky'] : '0'; |
— | — | @@ -471,12 +471,12 @@ |
472 | 472 | $event2 = ''; |
473 | 473 | $event = "$event=\"balloon.showTooltip(event,'${text}',${sticky},${width})\""; |
474 | 474 | |
475 | | - if ( preg_match( '/onclick/',$event ) && $args['hover'] ) { |
| 475 | + if ( preg_match( '/onclick/', $event ) && $args['hover'] ) { |
476 | 476 | $event2 = " onmouseover=\"balloon.showTooltip(event,'" . $args['hover'] . "',0,${width})\""; |
477 | 477 | } |
478 | 478 | |
479 | 479 | $has_style = isset( $args['style'] ) && $args['style']; |
480 | | - $style = "style=\"" . ($has_style ? $args['style'] . ";cursor:pointer\"" : "cursor:pointer\""); |
| 480 | + $style = "style=\"" . ( $has_style ? $args['style'] . ";cursor:pointer\"" : "cursor:pointer\"" ); |
481 | 481 | $target = $target ? "target=${target}" : ''; |
482 | 482 | $output = "<span class='rt-ticket' ${event} ${event2} ${style}>$ret</span>"; |
483 | 483 | |