Index: trunk/extensions/CentralNotice/SpecialCentralNotice.php |
— | — | @@ -64,10 +64,10 @@ |
65 | 65 | |
66 | 66 | // Set locked/unlocked flag accordingly |
67 | 67 | foreach ( $lockedNotices as $notice ) { |
68 | | - $this->updateLock( $notice, '1' ); |
| 68 | + $this->updateLock( $notice, '1' ); |
69 | 69 | } |
70 | 70 | foreach ( $unlockedNotices as $notice ) { |
71 | | - $this->updateLock( $notice, '0' ); |
| 71 | + $this->updateLock( $notice, '0' ); |
72 | 72 | } |
73 | 73 | } |
74 | 74 | } |
— | — | @@ -91,7 +91,7 @@ |
92 | 92 | } |
93 | 93 | } |
94 | 94 | } |
95 | | - |
| 95 | + |
96 | 96 | // Handle setting preferred |
97 | 97 | $preferredNotices = $wgRequest->getArray( 'preferred' ); |
98 | 98 | if ( isset( $preferredNotices ) ) { |
— | — | @@ -112,7 +112,7 @@ |
113 | 113 | CentralNoticeDB::updatePreferred( $notice, '0' ); |
114 | 114 | } |
115 | 115 | } |
116 | | - } |
| 116 | + } |
117 | 117 | |
118 | 118 | $noticeName = $wgRequest->getVal( 'notice' ); |
119 | 119 | |
— | — | @@ -134,7 +134,7 @@ |
135 | 135 | } |
136 | 136 | |
137 | 137 | // Handle updates if no post content came through |
138 | | - if ( !isset( $lockedNotices ) && $method !== 'addNotice' ) { |
| 138 | + if ( !isset( $lockedNotices ) && $method !== 'addNotice' ) { |
139 | 139 | if ( $method == 'listNoticeDetail' ) { |
140 | 140 | $notice = $wgRequest->getVal ( 'notice' ); |
141 | 141 | $this->updateLock( $notice, 0 ); |
— | — | @@ -146,7 +146,7 @@ |
147 | 147 | } |
148 | 148 | } |
149 | 149 | |
150 | | - if ( !isset( $enabledNotices ) && $method !== 'addNotice' ) { |
| 150 | + if ( !isset( $enabledNotices ) && $method !== 'addNotice' ) { |
151 | 151 | if ( $method == 'listNoticeDetail' ) { |
152 | 152 | $notice = $wgRequest->getVal ( 'notice' ); |
153 | 153 | $this->updateEnabled( $notice, 0); |
— | — | @@ -158,7 +158,7 @@ |
159 | 159 | } |
160 | 160 | } |
161 | 161 | |
162 | | - if ( !isset( $preferredNotices ) && $method !== 'addNotice' ) { |
| 162 | + if ( !isset( $preferredNotices ) && $method !== 'addNotice' ) { |
163 | 163 | if ( $method == 'listNoticeDetail' ) { |
164 | 164 | $notice = $wgRequest->getVal ( 'notice' ); |
165 | 165 | CentralNoticeDB::updatePreferred( $notice, 0 ); |
— | — | @@ -195,7 +195,7 @@ |
196 | 196 | |
197 | 197 | // Handle removing |
198 | 198 | if ( $this->editable && $method == 'removeNotice' ) { |
199 | | - $noticeName = $wgRequest->getVal ( 'noticeName' ); |
| 199 | + $noticeName = $wgRequest->getVal ( 'noticeName' ); |
200 | 200 | $this->removeNotice ( $noticeName ); |
201 | 201 | } |
202 | 202 | |
— | — | @@ -229,11 +229,11 @@ |
230 | 230 | |
231 | 231 | // Update the enabled/disabled state of notice |
232 | 232 | private function updateEnabled( $notice, $state ) { |
233 | | - $dbw = wfGetDB( DB_MASTER ); |
234 | | - $dbw->begin(); |
235 | | - $res = $dbw->update( 'cn_notices', |
236 | | - array( 'not_enabled' => $state ), |
237 | | - array( 'not_name' => $notice ) |
| 233 | + $dbw = wfGetDB( DB_MASTER ); |
| 234 | + $dbw->begin(); |
| 235 | + $res = $dbw->update( 'cn_notices', |
| 236 | + array( 'not_enabled' => $state ), |
| 237 | + array( 'not_name' => $notice ) |
238 | 238 | ); |
239 | 239 | $dbw->commit(); |
240 | 240 | } |
— | — | @@ -377,7 +377,7 @@ |
378 | 378 | 'not_start', |
379 | 379 | 'not_end', |
380 | 380 | 'not_enabled', |
381 | | - 'not_preferred', |
| 381 | + 'not_preferred', |
382 | 382 | 'not_project', |
383 | 383 | 'not_language', |
384 | 384 | 'not_locked' |
— | — | @@ -394,7 +394,7 @@ |
395 | 395 | 'not_start', |
396 | 396 | 'not_end', |
397 | 397 | 'not_enabled', |
398 | | - 'not_preferred', |
| 398 | + 'not_preferred', |
399 | 399 | 'not_project', |
400 | 400 | 'not_locked' |
401 | 401 | ), |
— | — | @@ -480,11 +480,12 @@ |
481 | 481 | wfArrayMerge( $readonly, |
482 | 482 | array( 'value' => $row->not_name ) ) ); |
483 | 483 | |
484 | | - // Preferred |
485 | | - $fields[] = |
486 | | - Xml::check( 'preferred[]', ( $row->not_preferred == '1' ), |
487 | | - wfArrayMerge( $readonly, |
488 | | - array( 'value' => $row->not_name ) ) ); |
| 484 | + // Preferred |
| 485 | + $fields[] = |
| 486 | + Xml::check( 'preferred[]', ( $row->not_preferred == '1' ), |
| 487 | + wfArrayMerge( $readonly, |
| 488 | + array( 'value' => $row->not_name ) ) ); |
| 489 | + |
489 | 490 | // Locked |
490 | 491 | $fields[] = |
491 | 492 | Xml::check( 'locked[]', ( $row->not_locked == '1' ), |
— | — | @@ -650,7 +651,7 @@ |
651 | 652 | $htmlOut .= Xml::element( 'p' ); |
652 | 653 | $newPage = SpecialPage::getTitleFor( 'NoticeTemplate', 'add' ); |
653 | 654 | $sk = $wgUser->getSkin(); |
654 | | - $htmlOut .= $sk->makeLinkObj( $newPage, wfMsgHtml( 'centralnotice-add-template' ) ); |
| 655 | + $htmlOut .= $sk->makeLinkObj( $newPage, wfMsgHtml( 'centralnotice-add-template' ) ); |
655 | 656 | $htmlOut .= Xml::element( 'p' ); |
656 | 657 | } elseif ( $output_assigned == '' ) { |
657 | 658 | $htmlOut .= wfMsg( 'centralnotice-no-templates-assigned' ); |
— | — | @@ -690,7 +691,7 @@ |
691 | 692 | 'not_start', |
692 | 693 | 'not_end', |
693 | 694 | 'not_enabled', |
694 | | - 'not_preferred', |
| 695 | + 'not_preferred', |
695 | 696 | 'not_project', |
696 | 697 | 'not_language', |
697 | 698 | 'not_locked' |
— | — | @@ -703,7 +704,7 @@ |
704 | 705 | if ( $row ) { |
705 | 706 | // Build Html |
706 | 707 | $htmlOut = Xml::fieldset( $notice ); |
707 | | - $htmlOut .= Xml::openElement( 'table', array( 'cellpadding' => 9 ) ); |
| 708 | + $htmlOut .= Xml::openElement( 'table', array( 'cellpadding' => 9 ) ); |
708 | 709 | |
709 | 710 | // Rows |
710 | 711 | $table = array( |
— | — | @@ -736,7 +737,7 @@ |
737 | 738 | wfArrayMerge( $readonly, |
738 | 739 | array( 'value' => $row->not_name ) ) ) |
739 | 740 | ), |
740 | | - // Preferred |
| 741 | + // Preferred |
741 | 742 | array( |
742 | 743 | wfMsgHtml( 'centralnotice-preferred' ), |
743 | 744 | Xml::check( 'preferred[]', ( $row->not_preferred == '1' ), |
— | — | @@ -821,7 +822,7 @@ |
822 | 823 | // Rows |
823 | 824 | while ( $row = $dbr->fetchObject( $res ) ) { |
824 | 825 | |
825 | | - $htmlOut .= Xml::openElement( 'tr' ); |
| 826 | + $htmlOut .= Xml::openElement( 'tr' ); |
826 | 827 | |
827 | 828 | if( $this->editable ) { |
828 | 829 | // Remove |
— | — | @@ -909,8 +910,8 @@ |
910 | 911 | $htmlOut .= Xml::element( 'th', array( 'align' => 'left', 'width' => '70%' ), |
911 | 912 | wfMsg ( "centralnotice-templates" ) ); |
912 | 913 | |
913 | | - // Find dups |
914 | | - $templatesAssigned = $this->selectTemplatesAssigned( $notice ); |
| 914 | + // Find dups |
| 915 | + $templatesAssigned = $this->selectTemplatesAssigned( $notice ); |
915 | 916 | |
916 | 917 | // Build rows |
917 | 918 | while ( $row = $dbr->fetchObject( $res ) ) { |
— | — | @@ -1054,13 +1055,13 @@ |
1055 | 1056 | $endTs = wfTimeStamp( TS_MW, "{$end['year']}:{$end['month']}:{$start['day']} {$start['hour']}:00:00" ); |
1056 | 1057 | |
1057 | 1058 | $res = $dbw->insert( 'cn_notices', |
1058 | | - array( 'not_name' => $noticeName, |
1059 | | - 'not_enabled' => $enabled, |
1060 | | - 'not_start' => $dbr->timestamp( $startTs ), |
1061 | | - 'not_end' => $dbr->timestamp( $endTs ), |
1062 | | - 'not_project' => $project_name, |
1063 | | - 'not_language' => $project_language |
1064 | | - ) |
| 1059 | + array( 'not_name' => $noticeName, |
| 1060 | + 'not_enabled' => $enabled, |
| 1061 | + 'not_start' => $dbr->timestamp( $startTs ), |
| 1062 | + 'not_end' => $dbr->timestamp( $endTs ), |
| 1063 | + 'not_project' => $project_name, |
| 1064 | + 'not_language' => $project_language |
| 1065 | + ) |
1065 | 1066 | ); |
1066 | 1067 | $dbw->commit(); |
1067 | 1068 | return; |
— | — | @@ -1084,7 +1085,7 @@ |
1085 | 1086 | return; |
1086 | 1087 | } else { |
1087 | 1088 | $dbw = wfGetDB( DB_MASTER ); |
1088 | | - $dbw->begin(); |
| 1089 | + $dbw->begin(); |
1089 | 1090 | $noticeId = htmlspecialchars( $this->getNoticeId( $noticeName ) ); |
1090 | 1091 | $res = $dbw->delete( 'cn_assignments', array ( 'not_id' => $noticeId ) ); |
1091 | 1092 | $res = $dbw->delete( 'cn_notices', array ( 'not_name' => $noticeName ) ); |
— | — | @@ -1189,7 +1190,7 @@ |
1190 | 1191 | // Overlap over a date within the same project and language |
1191 | 1192 | $startDate = $dbr->timestamp( $start ); |
1192 | 1193 | $endDate = $dbr->timestamp( $end ); |
1193 | | - |
| 1194 | + |
1194 | 1195 | $dbw = wfGetDB( DB_MASTER ); |
1195 | 1196 | $dbw->begin(); |
1196 | 1197 | $res = $dbw->update( 'cn_notices', |