3 function wfSpecialLockdb()
5 global $wgUser, $wgOut, $action;
7 if ( ! $wgUser->isDeveloper() ) {
8 $wgOut->developerRequired();
11 $fields = array( "wpLockReason" );
12 wfCleanFormFields( $fields );
14 $f = new DBLockForm();
16 if ( "success" == $action ) { $f->showSuccess(); }
17 else if ( "submit" == $action ) { $f->doSubmit(); }
18 else { $f->showForm( "" ); }
23 function showForm( $err )
25 global $wgOut, $wgUser, $wgLang;
26 global $wpLockConfirm;
28 $wgOut->setPagetitle( wfMsg( "lockdb" ) );
29 $wgOut->addWikiText( wfMsg( "lockdbtext" ) );
32 $wgOut->setSubtitle( wfMsg( "formerror" ) );
33 $wgOut->addHTML( "<p><font color='red' size='+1'>{$err}</font>\n" );
35 $lc = wfMsg( "lockconfirm" );
36 $lb = wfMsg( "lockbtn" );
37 $elr = wfMsg( "enterlockreason" );
38 $action = wfLocalUrlE( $wgLang->specialPage( "Lockdb" ),
42 <form id=\"lockdb\" method=\"post\" action=\"{$action}\">
44 <textarea name=\"wpLockReason\" rows=10 cols=60 wrap=virtual>
48 <input type=checkbox name=\"wpLockConfirm\">
50 <td align=left>{$lc}<td>
52 <td> </td><td align=left>
53 <input type=submit name=\"wpLock\" value=\"{$lb}\">
61 global $wgOut, $wgUser, $wgLang;
62 global $wpLockConfirm, $wpLockReason, $wgReadOnlyFile;
64 if ( ! $wpLockConfirm ) {
65 $this->showForm( wfMsg( "locknoconfirm" ) );
68 $fp = fopen( $wgReadOnlyFile, "w" );
70 if ( false === $fp ) {
71 $wgOut->fileNotFoundError( $wgReadOnlyFile );
74 fwrite( $fp, $wpLockReason );
75 fwrite( $fp, "\n<p>(by " . $wgUser->getName() . " at " .
76 $wgLang->timeanddate( wfTimestampNow() ) . ")\n" );
79 $success = wfLocalUrl( $wgLang->specialPage( "Lockdb" ),
81 $wgOut->redirect( $success );
84 function showSuccess()
86 global $wgOut, $wgUser;
89 $wgOut->setPagetitle( wfMsg( "lockdb" ) );
90 $wgOut->setSubtitle( wfMsg( "lockdbsuccesssub" ) );
91 $text = str_replace( "$1", $ip, wfMsg( "lockdbsuccesstext" ) );
92 $wgOut->addWikiText( $text );