Changing comments layout preparing for generated documentation with Phpdocumentor
[lhc/web/wiklou.git] / includes / SpecialUnlockdb.php
1 <?php
2 /**
3 *
4 */
5
6 /**
7 *
8 */
9 function wfSpecialUnlockdb() {
10 global $wgUser, $wgOut, $wgRequest;
11
12 if ( ! $wgUser->isDeveloper() ) {
13 $wgOut->developerRequired();
14 return;
15 }
16 $action = $wgRequest->getText( 'action' );
17 $f = new DBUnlockForm();
18
19 if ( "success" == $action ) { $f->showSuccess(); }
20 else if ( "submit" == $action ) { $f->doSubmit(); }
21 else { $f->showForm( "" ); }
22 }
23
24 /**
25 *
26 */
27 class DBUnlockForm {
28 function showForm( $err )
29 {
30 global $wgOut, $wgUser, $wgLang;
31
32 $wgOut->setPagetitle( wfMsg( "unlockdb" ) );
33 $wgOut->addWikiText( wfMsg( "unlockdbtext" ) );
34
35 if ( "" != $err ) {
36 $wgOut->setSubtitle( wfMsg( "formerror" ) );
37 $wgOut->addHTML( "<p><font color='red' size='+1'>{$err}</font>\n" );
38 }
39 $lc = wfMsg( "unlockconfirm" );
40 $lb = wfMsg( "unlockbtn" );
41 $titleObj = Title::makeTitle( NS_SPECIAL, "Unlockdb" );
42 $action = $titleObj->escapeLocalURL( "action=submit" );
43
44 $wgOut->addHTML( "<p>
45 <form id=\"unlockdb\" method=\"post\" action=\"{$action}\">
46 <table border=0><tr>
47 <td align=right>
48 <input type=checkbox name=\"wpLockConfirm\">
49 </td>
50 <td align=\"left\">{$lc}<td>
51 </tr><tr>
52 <td>&nbsp;</td><td align=left>
53 <input type=submit name=\"wpLock\" value=\"{$lb}\">
54 </td></tr></table>
55 </form>\n" );
56
57 }
58
59 function doSubmit() {
60 global $wgOut, $wgUser, $wgLang;
61 global $wgRequest, $wgReadOnlyFile;
62
63 $wpLockConfirm = $wgRequest->getCheck( 'wpLockConfirm' );
64 if ( ! $wpLockConfirm ) {
65 $this->showForm( wfMsg( "locknoconfirm" ) );
66 return;
67 }
68 if ( ! unlink( $wgReadOnlyFile ) ) {
69 $wgOut->fileDeleteError( $wgReadOnlyFile );
70 return;
71 }
72 $titleObj = Title::makeTitle( NS_SPECIAL, "Unlockdb" );
73 $success = $titleObj->getFullURL( "action=success" );
74 $wgOut->redirect( $success );
75 }
76
77 function showSuccess() {
78 global $wgOut, $wgUser;
79 global $ip;
80
81 $wgOut->setPagetitle( wfMsg( "unlockdb" ) );
82 $wgOut->setSubtitle( wfMsg( "unlockdbsuccesssub" ) );
83 $wgOut->addWikiText( wfMsg( "unlockdbsuccesstext", $ip ) );
84 }
85 }
86
87 ?>