1
|
|
|
<?php |
2
|
|
|
/************************************************************************** |
3
|
|
|
********** English Wikipedia Account Request Interface ********** |
4
|
|
|
*************************************************************************** |
5
|
|
|
** Wikipedia Account Request Graphic Design by Charles Melbye, ** |
6
|
|
|
** which is licensed under a Creative Commons ** |
7
|
|
|
** Attribution-Noncommercial-Share Alike 3.0 United States License. ** |
8
|
|
|
** ** |
9
|
|
|
** All other code are released under the Public Domain ** |
10
|
|
|
** by the ACC Development Team. ** |
11
|
|
|
** ** |
12
|
|
|
** See CREDITS for the list of developers. ** |
13
|
|
|
***************************************************************************/ |
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* Handles the tool offline messages |
17
|
|
|
*/ |
18
|
|
|
class Offline |
19
|
|
|
{ |
20
|
|
|
/** |
21
|
|
|
* Summary of check |
22
|
|
|
* @param bool $external External interface |
23
|
|
|
* @deprecated Do checking within the entry point. |
24
|
|
|
*/ |
25
|
|
|
public static function check($external) |
26
|
|
|
{ |
27
|
|
|
global $smarty, $dontUseDb, $dontUseDbCulprit, $dontUseDbReason; |
28
|
|
|
|
29
|
|
|
if ($dontUseDb) { |
30
|
|
|
if ($external) { |
31
|
|
|
$smarty->display("offline/external.tpl"); |
32
|
|
|
} |
33
|
|
|
else { |
34
|
|
|
$smarty->assign("dontUseDbCulprit", $dontUseDbCulprit); |
35
|
|
|
$smarty->assign("dontUseDbReason", $dontUseDbReason); |
36
|
|
|
$smarty->assign("alerts", array()); |
37
|
|
|
$smarty->display("offline/internal.tpl"); |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
die(); |
|
|
|
|
41
|
|
|
} |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* Determines if the tool is offline |
46
|
|
|
* @return bool |
47
|
|
|
*/ |
48
|
|
|
public static function isOffline() |
49
|
|
|
{ |
50
|
|
|
global $dontUseDb; |
51
|
|
|
|
52
|
|
|
return (bool)$dontUseDb; |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* Gets the offline message |
57
|
|
|
* @param bool $external |
58
|
|
|
* @return string |
59
|
|
|
*/ |
60
|
|
|
public static function getOfflineMessage($external) |
61
|
|
|
{ |
62
|
|
|
global $smarty, $dontUseDbCulprit, $dontUseDbReason; |
63
|
|
|
|
64
|
|
|
if ($external) { |
65
|
|
|
return $smarty->fetch("offline/external.tpl"); |
66
|
|
|
} |
67
|
|
|
else { |
68
|
|
|
$smarty->assign("dontUseDbCulprit", $dontUseDbCulprit); |
69
|
|
|
$smarty->assign("dontUseDbReason", $dontUseDbReason); |
70
|
|
|
$smarty->assign("alerts", array()); |
71
|
|
|
return $smarty->fetch("offline/internal.tpl"); |
72
|
|
|
} |
73
|
|
|
} |
74
|
|
|
} |
75
|
|
|
|
In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.