http://www.mediawiki.org/wiki/Special:Code/MediaWiki/90783
Revision: 90783 Author: ashley Date: 2011-06-25 19:14:50 +0000 (Sat, 25 Jun 2011) Log Message: ----------- SocialProfile: coding style tweaks + getVal() changed to getInt() because gift ID must be an integer Modified Paths: -------------- trunk/extensions/SocialProfile/UserGifts/SpecialRemoveMasterGift.php Modified: trunk/extensions/SocialProfile/UserGifts/SpecialRemoveMasterGift.php =================================================================== --- trunk/extensions/SocialProfile/UserGifts/SpecialRemoveMasterGift.php 2011-06-25 19:13:40 UTC (rev 90782) +++ trunk/extensions/SocialProfile/UserGifts/SpecialRemoveMasterGift.php 2011-06-25 19:14:50 UTC (rev 90783) @@ -11,8 +11,10 @@ /** * Deletes a gift image from $wgUploadDirectory/awards/ + * * @param $id Integer: internal ID number of the gift whose image we want to delete - * @param $size String: size of the image to delete (s for small, m for medium, ml for medium-large and l for large) + * @param $size String: size of the image to delete (s for small, m for + * medium, ml for medium-large and l for large) */ function deleteImage( $id, $size ) { global $wgUploadDirectory; @@ -25,8 +27,10 @@ /** * Checks if a user is allowed to remove gifts. - * @return false by default or if the user is blocked, true if user has 'delete' permission or - * is a member of giftadmin group + * + * @return Boolean: false by default or if the user is blocked, true if + * user has 'delete' permission or is a member of the + * giftadmin group */ function canUserManage() { global $wgUser; @@ -58,7 +62,7 @@ throw new ErrorPageError( 'error', 'badaccess' ); } - $this->gift_id = $wgRequest->getVal( 'gift_id' ); + $this->gift_id = $wgRequest->getInt( 'gift_id' ); if ( !$this->gift_id || !is_numeric( $this->gift_id ) ) { $wgOut->setPageTitle( wfMsg( 'g-error-title' ) ); @@ -72,8 +76,16 @@ $dbw = wfGetDB( DB_MASTER ); $gift = Gifts::getGift( $this->gift_id ); - $dbw->delete( 'gift', array( 'gift_id' => $this->gift_id ), __METHOD__ ); - $dbw->delete( 'user_gift', array( 'ug_gift_id' => $this->gift_id ), __METHOD__ ); + $dbw->delete( + 'gift', + array( 'gift_id' => $this->gift_id ), + __METHOD__ + ); + $dbw->delete( + 'user_gift', + array( 'ug_gift_id' => $this->gift_id ), + __METHOD__ + ); $this->deleteImage( $this->gift_id, 's' ); $this->deleteImage( $this->gift_id, 'm' ); @@ -85,8 +97,8 @@ $out = '<div class="back-links"> <a href="' . SpecialPage::getTitleFor( 'GiftManager' )->escapeFullURL() . '">' . wfMsg( 'g-viewgiftlist' ) . '</a> </div> - <div class="g-container">' - . wfMsg( 'g-remove-success-message', $gift['gift_name'] ) . + <div class="g-container">' . + wfMsg( 'g-remove-success-message', $gift['gift_name'] ) . '<div class="cleared"></div> </div>'; @@ -99,25 +111,30 @@ /** * Displays the main form for removing a gift permanently - * @return HTML output + * + * @return String: HTML output */ function displayForm() { global $wgOut, $wgUploadPath; $gift = Gifts::getGift( $this->gift_id ); - $gift_image = '<img src="' . $wgUploadPath . '/awards/' . Gifts::getGiftImage( $this->gift_id, 'l' ) . '" border="0" alt="gift" />'; + $gift_image = '<img src="' . $wgUploadPath . '/awards/' . + Gifts::getGiftImage( $this->gift_id, 'l' ) . + '" border="0" alt="gift" />'; - $output = $wgOut->setPageTitle( wfMsg( 'g-remove-title', $gift['gift_name'] ) ); - $output .= '<div class="back-links"> - <a href="' . SpecialPage::getTitleFor( 'GiftManager' )->escapeFullURL() . '">' . wfMsg( 'g-viewgiftlist' ) . '</a> + $wgOut->setPageTitle( wfMsg( 'g-remove-title', $gift['gift_name'] ) ); + + $output = '<div class="back-links"> + <a href="' . SpecialPage::getTitleFor( 'GiftManager' )->escapeFullURL() . '">' . + wfMsg( 'g-viewgiftlist' ) . '</a> </div> <form action="" method="post" enctype="multipart/form-data" name="form1"> - <div class="g-remove-message">' - . wfMsg( 'g-delete-message', $gift['gift_name'] ) . + <div class="g-remove-message">' . + wfMsg( 'g-delete-message', $gift['gift_name'] ) . '</div> - <div class="g-container">' - . $gift_image . + <div class="g-container">' . + $gift_image . '<div class="g-name">' . $gift['gift_name'] . '</div> </div> <div class="cleared"></div> _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs