Index: branches/usability/acaifix/OptIn/SpecialOptIn.php |
— | — | @@ -66,6 +66,12 @@ |
67 | 67 | |
68 | 68 | $par = $wgRequest->getVal( 'from', $par ); |
69 | 69 | $this->mOriginTitle = Title::newFromText( $par ); |
| 70 | + |
| 71 | + // Verify that $this->mOriginTitle is not Special:Userlogout |
| 72 | + if ( $this->mOriginTitle && $this->mOriginTitle->getNamespace() == NS_SPECIAL && |
| 73 | + SpecialPage::resolveAlias( $this->mOriginTitle->getText() ) == 'Userlogout' ) { |
| 74 | + $this->mOriginTitle = null; |
| 75 | + } |
70 | 76 | if ( $this->mOriginTitle ) { |
71 | 77 | $this->mOrigin = $this->mOriginTitle->getPrefixedDBKey(); |
72 | 78 | $this->mOriginQuery = $wgRequest->getVal( 'fromquery' ); |
— | — | @@ -93,17 +99,17 @@ |
94 | 100 | } |
95 | 101 | else |
96 | 102 | { |
97 | | - if ( $wgRequest->getVal( 'opt' ) == 'in' ) |
98 | | - // Just opted in |
| 103 | + if ( $wgRequest->getVal( 'opt' ) == 'in' && $wgUser->isLoggedIn() ) |
| 104 | + // Will be opted in in this request |
99 | 105 | $wgOut->setPageTitle( wfMsg( 'optin-title-justoptedin' ) ); |
100 | 106 | else |
101 | 107 | // About to opt in |
102 | 108 | $wgOut->setPageTitle( wfMsg( 'optin-title-optedout' ) ); |
103 | 109 | } |
104 | 110 | |
105 | | - if ( $wgRequest->getCheck( 'opt' ) ) { |
| 111 | + if ( $wgRequest->getCheck( 'opt' ) && $wgUser->isLoggedIn() ) { |
106 | 112 | if ( $wgRequest->getVal( 'opt' ) === 'in' ) { |
107 | | - if ( self::checkToken() ) { |
| 113 | + if ( self::checkToken() && !self::isOptedIn( $wgUser ) ) { |
108 | 114 | self::optIn( $wgUser ); |
109 | 115 | $wgOut->addWikiMsg( 'optin-success-in' ); |
110 | 116 | |
— | — | @@ -117,21 +123,28 @@ |
118 | 124 | array( 'type' => $wgJsMimeType ), |
119 | 125 | 'js2AddOnloadHook( function() { $j.post( "' . $url . '", optInGetPOSTData() ); } );' |
120 | 126 | ) ); |
| 127 | + } else if ( self::isOptedIn( $wgUser ) ) { |
| 128 | + // User is already opted in but |
| 129 | + // reloaded the page or tried to opt in |
| 130 | + // again. Fake success |
| 131 | + $wgOut->addWikiMsg( 'optin-success-in' ); |
121 | 132 | } else |
| 133 | + // Token didn't match |
122 | 134 | $this->showForm( self::isOptedIn( $wgUser ) ? |
123 | 135 | 'out' : 'in' ); |
124 | | - } else if ( $wgRequest->getVal( 'opt' ) == 'feedback' ) { |
| 136 | + } else if ( $wgRequest->getVal( 'opt' ) == 'feedback' && self::isOptedIn( $wgUser ) ) { |
125 | 137 | if ( $wgRequest->wasPosted() ) { |
126 | 138 | $this->saveSurvey( $wgOptInFeedBackSurvey, |
127 | 139 | 'feedback' ); |
128 | 140 | $wgOut->addWikiMsg( 'optin-success-feedback' ); |
129 | 141 | } else |
130 | 142 | $this->showForm( 'feedback' ); |
131 | | - } else if ( $wgRequest->getVal( 'opt' ) == 'browser' ) { |
| 143 | + } else if ( $wgRequest->getVal( 'opt' ) == 'browser' && self::isOptedIn( $wgUser ) ) { |
132 | 144 | $this->saveSurvey( $wgOptInBrowserSurvey, 'in' ); |
133 | 145 | $wgOut->disable(); |
134 | 146 | } else { |
135 | | - if ( self::checkToken() ) { |
| 147 | + // Opt out |
| 148 | + if ( self::checkToken() && self::isOptedIn( $wgUser ) ) { |
136 | 149 | self::optOut( $wgUser ); |
137 | 150 | $this->saveSurvey( $wgOptInSurvey, 'out' ); |
138 | 151 | $wgOut->addWikiMsg( 'optin-success-out' ); |
Property changes on: branches/usability/acaifix/OptIn/SpecialOptIn.php |
___________________________________________________________________ |
Modified: svn:mergeinfo |
139 | 152 | Merged /trunk/extensions/UsabilityInitiative/OptIn/SpecialOptIn.php:r59146 |
Property changes on: branches/usability/acaifix/OptIn |
___________________________________________________________________ |
Added: svn:mergeinfo |
140 | 153 | Merged /branches/REL1_15/phase3/extensions/UsabilityInitiative/OptIn:r51646 |
141 | 154 | Merged /trunk/extensions/UsabilityInitiative/OptIn:r56151-57234,58926,58973-58974,59146 |
142 | 155 | Merged /trunk/phase3/extensions/UsabilityInitiative/OptIn:r56213,56215-56216,56218,56325,56334-56336,56338,56340,56343,56345,56347,56350,57154-57447 |
Index: branches/usability/acaifix/ClickTracking/SpecialClickTracking.php |
— | — | @@ -494,12 +494,14 @@ |
495 | 495 | * @param maxTime max day (YYYYMMDD) |
496 | 496 | * NOTE: once some of the constraints have been finalized, this will use more of the Database functions and not raw SQL |
497 | 497 | */ |
498 | | - static function getTimeConstraintsStatement( $minTime, $maxTime ){ |
| 498 | + static function getTimeConstraintsStatement( $minTime, $maxTime ){ |
499 | 499 | if($minTime == 0 || $maxTime == 0){ |
500 | 500 | return ''; |
501 | 501 | } |
502 | 502 | else { |
503 | | - |
| 503 | + //the dates are stored in the DB as MW_TIMESTAMP formats, add the zeroes to fix that |
| 504 | + $minTime .= "000000"; |
| 505 | + $maxTime .= "000000"; |
504 | 506 | return "WHERE `action_time` >= '$minTime' AND `action_time` <= '$maxTime'"; |
505 | 507 | } |
506 | 508 | |
Property changes on: branches/usability/acaifix/ClickTracking |
___________________________________________________________________ |
Added: svn:mergeinfo |
507 | 509 | Merged /branches/REL1_15/phase3/extensions/UsabilityInitiative/ClickTracking:r51646 |
508 | 510 | Merged /trunk/extensions/UsabilityInitiative/ClickTracking:r56151-57234,58926,58973-58974,59048 |
509 | 511 | Merged /trunk/phase3/extensions/UsabilityInitiative/ClickTracking:r56213,56215-56216,56218,56325,56334-56336,56338,56340,56343,56345,56347,56350,57154-57447 |