diff --git a/SocialProfile.php b/SocialProfile.php index ec7c78e..4ad1801 100644 --- a/SocialProfile.php +++ b/SocialProfile.php @@ -56,6 +56,9 @@ $wgAutoloadClasses['MigrateOldUserFieldPrivacyUserColumnToActor'] = __DIR__ . '/ $wgAutoloadClasses['ApiUserProfilePrivacy'] = __DIR__ . '/UserProfile/includes/api/ApiUserProfilePrivacy.php'; $wgAPIModules['smpuserprivacy'] = 'ApiUserProfilePrivacy'; +$wgAutoloadClasses['ApiUserProfileType'] = __DIR__ . '/UserProfile/includes/api/ApiUserProfileType.php'; +$wgAPIModules['smpuserprofiletype'] = 'ApiUserProfileType'; + $wgDefaultUserOptions['echo-subscriptions-web-social-rel'] = true; $wgDefaultUserOptions['echo-subscriptions-email-social-rel'] = false; diff --git a/SystemGifts/i18n/en.json b/SystemGifts/i18n/en.json index dacbed3..7c1f751 100644 --- a/SystemGifts/i18n/en.json +++ b/SystemGifts/i18n/en.json @@ -47,6 +47,7 @@ "ga-remove-success-title": "You have successfully removed the gift \"$1\"", "ga-remove-success-message": "The gift \"$1\" has been removed.", "ga-user-got-awards": "$1 got $2", + "ga-awards-populate-confirm": "Are you sure you want to populate awards?", "ga-awards-given-out": "{{PLURAL:$1|One award|$1 awards}} were given out", "topawards": "Top Awards", "topawards-edit-title": "Top Awards - Edit Milestones", diff --git a/SystemGifts/i18n/qqq.json b/SystemGifts/i18n/qqq.json index 7614fe8..e6be33d 100644 --- a/SystemGifts/i18n/qqq.json +++ b/SystemGifts/i18n/qqq.json @@ -29,6 +29,7 @@ "ga-small": "{{Identical|Small}}", "ga-remove": "{{Identical|Remove}}", "ga-remove-success-title": "Parameters:\n* $1 is a gift name.", + "ga-awards-populate-confirm": "Confirmation message shown on Special:PopulateAwards", "topawards-edits": "{{Identical|Edit}}", "topawards-votes": "{{Identical|Vote}}", "topawards-comments": "{{Identical|Comment}}", diff --git a/SystemGifts/includes/specials/SpecialPopulateAwards.php b/SystemGifts/includes/specials/SpecialPopulateAwards.php index 77eb05b..c21f315 100644 --- a/SystemGifts/includes/specials/SpecialPopulateAwards.php +++ b/SystemGifts/includes/specials/SpecialPopulateAwards.php @@ -22,6 +22,7 @@ class PopulateAwards extends UnlistedSpecialPage { global $wgUserLevels; $out = $this->getOutput(); + $request = $this->getRequest(); $user = $this->getUser(); // make sure user has the correct permissions @@ -39,9 +40,33 @@ class PopulateAwards extends UnlistedSpecialPage { $out->setArticleRelated( false ); $out->setRobotPolicy( 'noindex,nofollow' ); - $wgUserLevels = ''; + if ( $request->wasPosted() && $user->matchEditToken( $request->getVal( 'wpEditToken' ) ) ) { + $wgUserLevels = ''; - $g = new SystemGifts(); - $g->updateSystemGifts(); + $g = new SystemGifts(); + $g->updateSystemGifts(); + } else { + $out->addHTML( $this->displayForm() ); + } } + + /** + * Render the confirmation form + * + * @return string HTML + */ + private function displayForm() { + $form = '
'; + return $form; + } + } diff --git a/SystemGifts/includes/specials/SpecialRemoveMasterSystemGift.php b/SystemGifts/includes/specials/SpecialRemoveMasterSystemGift.php index ef1539c..ecda16e 100644 --- a/SystemGifts/includes/specials/SpecialRemoveMasterSystemGift.php +++ b/SystemGifts/includes/specials/SpecialRemoveMasterSystemGift.php @@ -76,7 +76,11 @@ class RemoveMasterSystemGift extends UnlistedSpecialPage { return false; } - if ( $request->wasPosted() && $_SESSION['alreadysubmitted'] == false ) { + if ( + $request->wasPosted() && + $user->matchEditToken( $request->getVal( 'wpEditToken' ) ) && + $_SESSION['alreadysubmitted'] == false + ) { $_SESSION['alreadysubmitted'] = true; $dbw = wfGetDB( DB_MASTER ); @@ -146,6 +150,7 @@ class RemoveMasterSystemGift extends UnlistedSpecialPage { + '; return $output; diff --git a/SystemGifts/includes/specials/SpecialSystemGiftManager.php b/SystemGifts/includes/specials/SpecialSystemGiftManager.php index 655ddaa..9b320c2 100644 --- a/SystemGifts/includes/specials/SpecialSystemGiftManager.php +++ b/SystemGifts/includes/specials/SpecialSystemGiftManager.php @@ -45,7 +45,7 @@ class SystemGiftManager extends SpecialPage { // Add CSS $out->addModuleStyles( 'ext.socialprofile.special.systemgiftmanager.css' ); - if ( $request->wasPosted() ) { + if ( $request->wasPosted() && $user->matchEditToken( $request->getVal( 'wpEditToken' ) ) ) { $g = new SystemGifts(); if ( !$request->getInt( 'id' ) ) { @@ -192,6 +192,7 @@ class SystemGiftManager extends SpecialPage { $form .= '