r96374 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r96373‎ | r96374 | r96375 >
Date:21:25, 6 September 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
salt survey deletion token w/ ids
Modified paths:
  • /trunk/extensions/Survey/api/ApiDeleteSurvey.php (modified) (history)
  • /trunk/extensions/Survey/api/ApiEditSurvey.php (modified) (history)
  • /trunk/extensions/Survey/includes/SurveyQuestion.php (modified) (history)
  • /trunk/extensions/Survey/specials/SpecialSurveys.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Survey/specials/SpecialSurveys.php
@@ -156,7 +156,7 @@
157157 'href' => '#',
158158 'class' => 'survey-delete',
159159 'data-survey-id' => $survey->getId(),
160 - 'data-survey-token' => $GLOBALS['wgUser']->editToken( 'deletesurvey' )
 160+ 'data-survey-token' => $GLOBALS['wgUser']->editToken( 'deletesurvey' . $survey->getId() )
161161 ),
162162 wfMsg( 'surveys-special-delete' )
163163 ) .
Index: trunk/extensions/Survey/includes/SurveyQuestion.php
@@ -19,6 +19,24 @@
2020 public static $TYPE_RADIO = 3;
2121
2222 /**
 23+ * @see SurveyDBClass::getDBTable()
 24+ */
 25+ protected static function getDBTable() {
 26+ return 'survey_questions';
 27+ }
 28+
 29+ /**
 30+ * Gets the db field prefix.
 31+ *
 32+ * @since 0.1
 33+ *
 34+ * @return string
 35+ */
 36+ protected static function getFieldPrefix() {
 37+ return 'question_';
 38+ }
 39+
 40+ /**
2341 * Returns an array with the fields and their types this object contains.
2442 * This corresponds directly to the fields in the database, without prefix.
2543 *
@@ -109,15 +127,4 @@
110128 return self::select( null, $conditions );
111129 }
112130
113 - /**
114 - * @see SurveyDBClass::getDBTable()
115 - */
116 - protected static function getDBTable() {
117 - return 'survey_questions';
118 - }
119 -
120 - protected static function getFieldPrefix() {
121 - return 'question_';
122 - }
123 -
124131 }
Index: trunk/extensions/Survey/api/ApiDeleteSurvey.php
@@ -46,7 +46,8 @@
4747 }
4848
4949 public function getTokenSalt() {
50 - return 'deletesurvey';
 50+ $params = $this->extractRequestParams();
 51+ return 'deletesurvey' . implode( '|', $params['ids'] );
5152 }
5253
5354 public function mustBePosted() {
Index: trunk/extensions/Survey/api/ApiEditSurvey.php
@@ -23,7 +23,7 @@
2424
2525 if ( !$wgUser->isAllowed( 'surveyadmin' ) || $wgUser->isBlocked() ) {
2626 $this->dieUsageMsg( array( 'badaccess-groups' ) );
27 - }
 27+ }
2828
2929 $params = $this->extractRequestParams();
3030

Status & tagging log