Index: trunk/extensions/SocialProfile/UserStatus/UserStatus.i18n.php |
— | — | @@ -12,6 +12,9 @@ |
13 | 13 | * @author Yevhenii Vlasenko |
14 | 14 | */ |
15 | 15 | $messages['en'] = array( |
| 16 | + 'userstatus' => 'Delete status updates', |
| 17 | + 'userstatus-enter-username' => 'Enter username:', |
| 18 | + 'userstatus-find' => 'Find', |
16 | 19 | 'userstatus-edit' => 'Edit', |
17 | 20 | 'userstatus-save' => 'Save', |
18 | 21 | 'userstatus-cancel' => 'Cancel', |
Index: trunk/extensions/SocialProfile/UserStatus/SpecialUserStatus.php |
— | — | @@ -1,26 +1,53 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | | -class SpecialUserStatus extends UnlistedSpecialPage { |
| 4 | +class SpecialUserStatus extends SpecialPage { |
5 | 5 | |
6 | 6 | /** |
7 | | - * Constructor |
| 7 | + * Constructor -- set up the new special page |
8 | 8 | */ |
9 | 9 | public function __construct() { |
10 | | - global $wgOut, $wgScriptPath; |
11 | | - |
12 | | - parent::__construct( 'UserStatus' ); |
13 | | - $wgOut->addScriptFile( $wgScriptPath . '/extensions/SocialProfile/UserStatus/UserStatus.js' ); |
| 10 | + parent::__construct( 'UserStatus', 'delete-status-update' ); |
14 | 11 | } |
15 | 12 | |
| 13 | + /** |
| 14 | + * Show the special page |
| 15 | + * |
| 16 | + * @param $params Mixed: parameter(s) passed to the special page or null |
| 17 | + */ |
16 | 18 | public function execute( $params ) { |
17 | | - global $wgOut,$wgUser; |
18 | | - if ( $wgUser->isAllowed( 'delete-status-update' ) ) { |
19 | | - $output = "Enter username: <input type=\"text\" id=\"us-name-input\"> "; |
20 | | - $output .= "<input type=\"button\" value=\"Find\" onclick=\"javascript:UserStatus.specialGetHistory();\">"; |
21 | | - $output .= "<div id=\"us-special\"> </div>"; |
22 | | - $wgOut->addHTML($output); |
| 19 | + global $wgOut, $wgScriptPath, $wgUser; |
| 20 | + |
| 21 | + // Make sure that the user is allowed to access this special page |
| 22 | + if( !$wgUser->isAllowed( 'delete-status-update' ) ) { |
| 23 | + $wgOut->permissionRequired( 'delete-status-update' ); |
| 24 | + return false; |
23 | 25 | } |
24 | | - return; |
| 26 | + |
| 27 | + // Blocked through Special:Block? No access for you either! |
| 28 | + if( $wgUser->isBlocked() ) { |
| 29 | + $wgOut->blockedPage( false ); |
| 30 | + return false; |
| 31 | + } |
| 32 | + |
| 33 | + // Is the database locked or not? |
| 34 | + if( wfReadOnly() ) { |
| 35 | + $wgOut->readOnlyPage(); |
| 36 | + return false; |
| 37 | + } |
| 38 | + |
| 39 | + // Set the page title and robot policies |
| 40 | + $this->setHeaders(); |
| 41 | + |
| 42 | + // Add required JS file |
| 43 | + $wgOut->addScriptFile( $wgScriptPath . '/extensions/SocialProfile/UserStatus/UserStatus.js' ); |
| 44 | + |
| 45 | + // Build and output the form for deleting users' status updates |
| 46 | + $output = wfMsg( 'userstatus-enter-username' ) . |
| 47 | + ' <input type="text" id="us-name-input" /> '; |
| 48 | + $output .= '<input type="button" value="' . |
| 49 | + wfMsg( 'userstatus-find' ) . '" onclick="javascript:UserStatus.specialGetHistory();" />'; |
| 50 | + $output .= '<div id="us-special"> </div>'; |
| 51 | + $wgOut->addHTML( $output ); |
25 | 52 | } |
26 | | - |
| 53 | + |
27 | 54 | } |