~ubuntu-branches/ubuntu/maverick/mediawiki/maverick

« back to all changes in this revision

Viewing changes to includes/specials/SpecialProtectedpages.php

  • Committer: Bazaar Package Importer
  • Author(s): Romain Beauxis
  • Date: 2009-06-19 01:38:50 UTC
  • mfrom: (16.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20090619013850-dsn4lrxvs90ab4rx
Tags: 1:1.15.0-1
* New upstream release. 
* Upstream added support for OASIS documents.
Closes: #530328
* Refreshed quilt patches
* Bumped standards versions to 3.8.2
* Bumped compat to 7
* Pointed to GPL-2 in debian/copyright
* Added php5-sqlite to possible DB backend dependencies.
Closes: #501569
* Proofread README.Debian, upgrade is documented there.
Closes: #520121

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
        public function showList( $msg = '' ) {
17
17
                global $wgOut, $wgRequest;
18
18
 
19
 
                if ( "" != $msg ) {
 
19
                if( "" != $msg ) {
20
20
                        $wgOut->setSubtitle( $msg );
21
21
                }
22
22
 
23
23
                // Purge expired entries on one in every 10 queries
24
 
                if ( !mt_rand( 0, 10 ) ) {
 
24
                if( !mt_rand( 0, 10 ) ) {
25
25
                        Title::purgeExpiredRestrictions();
26
26
                }
27
27
 
37
37
 
38
38
                $wgOut->addHTML( $this->showOptions( $NS, $type, $level, $sizetype, $size, $indefOnly, $cascadeOnly ) );
39
39
 
40
 
                if ( $pager->getNumRows() ) {
 
40
                if( $pager->getNumRows() ) {
41
41
                        $s = $pager->getNavigationBar();
42
42
                        $s .= "<ul>" .
43
43
                                $pager->getBody() .
73
73
 
74
74
                $description_items[] = $protType;
75
75
 
76
 
                if ( $row->pr_cascade ) {
 
76
                if( $row->pr_cascade ) {
77
77
                        $description_items[] = wfMsg( 'protect-summary-cascade' );
78
78
                }
79
79
 
80
80
                $expiry_description = '';
81
81
                $stxt = '';
82
82
 
83
 
                if ( $row->pr_expiry != 'infinity' && strlen($row->pr_expiry) ) {
 
83
                if( $row->pr_expiry != 'infinity' && strlen($row->pr_expiry) ) {
84
84
                        $expiry = Block::decodeExpiry( $row->pr_expiry );
85
85
 
86
 
                        $expiry_description = wfMsg( 'protect-expiring' , $wgLang->timeanddate( $expiry ) , $wgLang->date( $expiry ) , $wgLang->time( $expiry ) );
 
86
                        $expiry_description = wfMsg( 'protect-expiring' , $wgLang->timeanddate( $expiry ) , 
 
87
                                $wgLang->date( $expiry ) , $wgLang->time( $expiry ) );
87
88
 
88
89
                        $description_items[] = $expiry_description;
89
90
                }
90
91
 
91
 
                if (!is_null($size = $row->page_len)) {
 
92
                if(!is_null($size = $row->page_len)) {
92
93
                        $stxt = $wgContLang->getDirMark() . ' ' . $skin->formatRevisionSize( $size );
93
94
                }
94
95
 
95
96
                # Show a link to the change protection form for allowed users otherwise a link to the protection log
96
97
                if( $wgUser->isAllowed( 'protect' ) ) {
97
 
                        $changeProtection = ' (' . $skin->makeKnownLinkObj( $title, wfMsgHtml( 'protect_change' ), 'action=unprotect' ) . ')';
 
98
                        $changeProtection = ' (' . $skin->makeKnownLinkObj( $title, wfMsgHtml( 'protect_change' ),
 
99
                                'action=unprotect' ) . ')';
98
100
                } else {
99
101
                        $ltitle = SpecialPage::getTitleFor( 'Log' );
100
 
                        $changeProtection = ' (' . $skin->makeKnownLinkObj( $ltitle, wfMsgHtml( 'protectlogpage' ), 'type=protect&page=' . $title->getPrefixedUrl() ) . ')';
 
102
                        $changeProtection = ' (' . $skin->makeKnownLinkObj( $ltitle, wfMsgHtml( 'protectlogpage' ), 
 
103
                                'type=protect&page=' . $title->getPrefixedUrl() ) . ')';
101
104
                }
102
105
 
103
106
                wfProfileOut( __METHOD__ );
220
223
 
221
224
                // First pass to load the log names
222
225
                foreach( $wgRestrictionLevels as $type ) {
223
 
                        if ( $type !='' && $type !='*') {
 
226
                        if( $type !='' && $type !='*') {
224
227
                                $text = wfMsg("restriction-level-$type");
225
228
                                $m[$text] = $type;
226
229
                        }
248
251
        public $mForm, $mConds;
249
252
        private $type, $level, $namespace, $sizetype, $size, $indefonly;
250
253
 
251
 
        function __construct( $form, $conds = array(), $type, $level, $namespace, $sizetype='', 
252
 
                                                        $size=0, $indefonly = false, $cascadeonly = false ) {
 
254
        function __construct( $form, $conds = array(), $type, $level, $namespace, $sizetype='', $size=0, 
 
255
                $indefonly = false, $cascadeonly = false )
 
256
        {
253
257
                $this->mForm = $form;
254
258
                $this->mConds = $conds;
255
259
                $this->type = ( $type ) ? $type : 'edit';
263
267
        }
264
268
 
265
269
        function getStartBody() {
266
 
                wfProfileIn( __METHOD__ );
267
270
                # Do a link batch query
268
271
                $lb = new LinkBatch;
269
272
                while( $row = $this->mResult->fetchObject() ) {
270
273
                        $lb->add( $row->page_namespace, $row->page_title );
271
274
                }
272
275
                $lb->execute();
273
 
 
274
 
                wfProfileOut( __METHOD__ );
275
276
                return '';
276
277
        }
277
278
 
281
282
 
282
283
        function getQueryInfo() {
283
284
                $conds = $this->mConds;
284
 
                $conds[] = 'pr_expiry>' . $this->mDb->addQuotes( $this->mDb->timestamp() );
 
285
                $conds[] = '(pr_expiry>' . $this->mDb->addQuotes( $this->mDb->timestamp() ) .
 
286
                                'OR pr_expiry IS NULL)';
285
287
                $conds[] = 'page_id=pr_page';
286
288
                $conds[] = 'pr_type=' . $this->mDb->addQuotes( $this->type );
287
 
 
 
289
                
288
290
                if( $this->sizetype=='min' ) {
289
291
                        $conds[] = 'page_len>=' . $this->size;
290
292
                } else if( $this->sizetype=='max' ) {
294
296
                if( $this->indefonly ) {
295
297
                        $conds[] = "pr_expiry = 'infinity' OR pr_expiry IS NULL";
296
298
                }
297
 
                if ( $this->cascadeonly ) {
 
299
                if( $this->cascadeonly ) {
298
300
                        $conds[] = "pr_cascade = '1'";
299
301
                }
300
302
 
318
320
 * Constructor
319
321
 */
320
322
function wfSpecialProtectedpages() {
321
 
 
322
323
        $ppForm = new ProtectedPagesForm();
323
 
 
324
324
        $ppForm->showList();
325
325
}