本文整理汇总了PHP中Conf::g方法的典型用法代码示例。如果您正苦于以下问题:PHP Conf::g方法的具体用法?PHP Conf::g怎么用?PHP Conf::g使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Conf
的用法示例。
在下文中一共展示了Conf::g方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
static function fail_message($errors)
{
global $Conf, $Me, $Opt;
if (is_string($errors)) {
$errors = array($errors);
}
if (@$Opt["maintenance"]) {
$errors = array("The site is down for maintenance. " . (is_string($Opt["maintenance"]) ? $Opt["maintenance"] : "Please check back later."));
}
if (PHP_SAPI == "cli") {
fwrite(STDERR, join("\n", $errors) . "\n");
exit(1);
} else {
if (@$_REQUEST["ajax"]) {
header("Content-Type: " . (@$_REQUEST["jsontext"] ? "text/plain" : "application/json"));
if (@$Opt["maintenance"]) {
echo "{\"error\":\"maintenance\"}\n";
} else {
echo "{\"error\":\"unconfigured installation\"}\n";
}
} else {
if (!$Conf) {
$Conf = Conf::$g = new Conf(false);
}
if ($Opt["shortName"] == "__invalid__") {
$Opt["shortName"] = "HotCRP";
}
$Me = null;
header("HTTP/1.1 404 Not Found");
$Conf->header("HotCRP Error", "", false);
foreach ($errors as $i => &$e) {
$e = ($i ? "<div class=\"hint\">" : "<p>") . htmlspecialchars($e) . ($i ? "</div>" : "</p>");
}
echo join("", $errors);
$Conf->footer();
}
}
exit;
}
示例2: set_memory_limit
}
}
if (!get($Opt, "loaded") || get($Opt, "missing")) {
Multiconference::fail_bad_options();
}
if (get($Opt, "dbLogQueries")) {
Dbl::log_queries($Opt["dbLogQueries"]);
}
// Allow lots of memory
function set_memory_limit()
{
global $Opt;
if (!get($Opt, "memoryLimit")) {
$suf = array("" => 1, "k" => 1 << 10, "m" => 1 << 20, "g" => 1 << 30);
if (preg_match(',\\A(\\d+)\\s*([kmg]?)\\z,', strtolower(ini_get("memory_limit")), $m) && $m[1] * $suf[$m[2]] < 128 << 20) {
$Opt["memoryLimit"] = "128M";
}
}
if (get($Opt, "memoryLimit")) {
ini_set("memory_limit", $Opt["memoryLimit"]);
}
}
set_memory_limit();
// Create the conference
global $Conf;
if (!$Conf) {
$Conf = Conf::$g = new Conf(Dbl::make_dsn($Opt));
}
if (!$Conf->dblink) {
Multiconference::fail_bad_database();
}
示例3: psets_json_data
Multiconference::fail_bad_options();
}
if (get($Opt, "dbLogQueries")) {
Dbl::log_queries($Opt["dbLogQueries"]);
}
// Allow lots of memory
if (!get($Opt, "memoryLimit") && ini_get_bytes("memory_limit") < 128 << 20) {
$Opt["memoryLimit"] = "128M";
}
if (get($Opt, "memoryLimit")) {
ini_set("memory_limit", $Opt["memoryLimit"]);
}
// Create the conference
global $Conf;
if (!$Conf) {
$Conf = Conf::$g = new Conf($Opt, true);
}
if (!$Conf->dblink) {
Multiconference::fail_bad_database();
}
// Extract problem set information
function psets_json_data($exclude_overrides)
{
global $Conf;
$datamap = array();
$fnames = expand_includes($Conf->opt("psetsConfig"), ["CONFID" => $Conf->opt("confid") ?: $Conf->dbname, "HOSTTYPE" => $Conf->opt("hostType", "")]);
foreach ($fnames as $fname) {
$datamap[$fname] = @file_get_contents($fname);
}
if (!$exclude_overrides && ($override_data = $Conf->setting_data("psets_override"))) {
$datamap["<overrides>"] = $override_data;