Commit b87c83b3 authored by Dries's avatar Dries

- Fixed coding style issues.  Patch by Ax.
parent dc19b22f
......@@ -8,7 +8,7 @@ function system_help() {
return $output;
}
function system_system($field){
function system_system($field) {
$system["description"] = t("Configuration system that lets administrators modify the workings of the site.");
return $system[$field];
}
......@@ -69,7 +69,7 @@ function system_view_general() {
global $conf, $cmodes, $corder;
// general settings:
$output .= "<h3>" . t("General settings") . "</h3>\n";
$output .= "<h3>". t("General settings") ."</h3>\n";
$output .= form_textfield(t("Name"), "site_name", variable_get("site_name", "drupal"), 70, 70, t("The name of this website."));
$output .= form_textfield(t("E-mail address"), "site_mail", variable_get("site_mail", ini_get("sendmail_from")), 70, 128, t("A valid e-mail address for this website, used by the auto-mailer during registration, new password requests, notifications, etc."));
$output .= form_textfield(t("Slogan"), "site_slogan", variable_get("site_slogan", ""), 70, 128, t("The slogan of this website. Some themes display a slogan when available."));
......@@ -82,21 +82,21 @@ function system_view_general() {
$output .= "<hr />\n";
// caching:
$output .= "<h3>" . t("Cache settings") . "</h3>\n";
$output .= "<h3>". t("Cache settings") ."</h3>\n";
$period = array(10 => format_interval(10), 20 => format_interval(20), 30 => format_interval(30), 40 => format_interval(40), 50 => format_interval(50), 50 => format_interval(50), 60 => format_interval(60), 90 => format_interval(90), 120 => format_interval(120), 150 => format_interval(150), 180 => format_interval(180), 210 => format_interval(210), 240 => format_interval(240), 270 => format_interval(270), 300 => format_interval(300), 360 => format_interval(360), 420 => format_interval(420), 480 => format_interval(480), 540 => format_interval(540), 600 => format_interval(600), 1800 => format_interval(1800), 3600 => format_interval(3600), 7200 => format_interval(7200));
$output .= form_select(t("Cache support"), "cache", variable_get("cache", 0), array(t("Disabled"), t("Enabled")), t("Enable or disable the caching of pages."));
$output .= form_select(t("Discard cached pages older than"), "cache_clear", variable_get("cache_clear", 120), $period, t("The time cached pages should be kept. Older pages are automatically refreshed."));
$output .= "<hr />\n";
// submission settings:
$output .= "<h3>" . t("Submission settings") . "</h3>\n";
$output .= "<h3>". t("Submission settings") ."</h3>\n";
$rate = array(-10000 => "Disabled", 1 => "Maximum 1 every second", 5 => "Maximum 1 every 5 seconds", 15 => "Maximum 1 every 15 seconds", 30 => "Maximum 1 every 30 seconds", 60 => "Maximum 1 every minute", 300 => "Maximum 1 every 5 minutes", 900 => "Maximum 1 every 15 minutes", 1800 => "Maximum 1 every 30 minutes", 3600 => "Maximum 1 every hour", 21600 => "Maximum 1 every 6 hours", 43200 => "Maximum 1 every 12 hours");
$output .= form_select(t("Maximum node rate"), "max_node_rate", variable_get("max_node_rate", 900), $rate, t("The maximum submission rate for nodes. Its purpose is to stop potential abuse or denial of service attacks."));
$output .= form_select(t("Maximum comment rate"), "max_comment_rate", variable_get("max_comment_rate", 120), $rate, t("The maximum submission rate for comments. Its purpose is to stop potential abuse or denial of service attacks."));
$output .= "<hr />\n";
// date settings:
$output .= "<h3>" . t("Date format settings") . "</h3>\n";
$output .= "<h3>". t("Date format settings") ."</h3>\n";
// date settings: possible date formats
$dateshort = array("m/d/Y - H:i", "d/m/Y - H:i", "Y/m/d - H:i",
......@@ -112,24 +112,24 @@ function system_view_general() {
// date settings: construct choices for user
foreach ($dateshort as $f) {
$dateshortchoices[$f] = format_date(time(),"custom",$f);
$dateshortchoices[$f] = format_date(time(), "custom", $f);
}
foreach ($datemedium as $f) {
$datemediumchoices[$f] = format_date(time(),"custom",$f);
$datemediumchoices[$f] = format_date(time(), "custom", $f);
}
foreach ($datelong as $f) {
$datelongchoices[$f] = format_date(time(),"custom",$f);
$datelongchoices[$f] = format_date(time(), "custom", $f);
}
$output .= form_select(t("Date format (short)"), "date_format_short", variable_get("date_format_short", $dateshort[0]), $dateshortchoices, t("The short format of date display."));
$output .= form_select(t("Date format (medium)"), "date_format_medium", variable_get("date_format_medium", $datemedium[0]), $datemediumchoices,t("The medium sized date display."));
$output .= form_select(t("Date format (medium)"), "date_format_medium", variable_get("date_format_medium", $datemedium[0]), $datemediumchoices, t("The medium sized date display."));
$output .= form_select(t("Date format (long)"), "date_format_long", variable_get("date_format_long", $datelong[0]), $datelongchoices, t("Longer date format used for detailed display."));
return $output;
}
function system_view_module($name) {
if (module_hook($name, "settings")) {
$output .= "<h3><a name=\"$name\">". ucfirst(t("$name")) ." " . t("settings") . "</a></h3>". module_invoke($name, "settings") ."<hr />\n";
$output .= "<h3><a name=\"$name\">". ucfirst(t("$name")) ." ". t("settings") ."</a></h3>". module_invoke($name, "settings") ."<hr />\n";
}
return $output;
}
......@@ -167,8 +167,9 @@ function system_save_settings($edit = array()) {
foreach ($edit["status"] as $filename => $status) {
db_query("UPDATE system SET status = '%d' WHERE filename = '$filename'", $status);
}
if ($edit["type"] == "theme")
if ($edit["type"] == "theme") {
variable_set("theme_default", $edit["theme_default"]);
}
}
else {
foreach ($edit as $name => $value) {
......@@ -198,16 +199,20 @@ function system_view($type, $arg = "") {
$form = system_view_filters();
break;
case "modules":
if ($arg)
if ($arg) {
$form = system_view_module($arg);
else
}
else {
$form = system_listing("module", "modules", $required);
}
break;
case "themes":
if ($arg)
if ($arg) {
$form = system_view_theme($arg);
else
}
else {
$form = system_listing("theme", "themes", $required);
}
break;
default:
$form = system_view_general();
......
......@@ -8,7 +8,7 @@ function system_help() {
return $output;
}
function system_system($field){
function system_system($field) {
$system["description"] = t("Configuration system that lets administrators modify the workings of the site.");
return $system[$field];
}
......@@ -69,7 +69,7 @@ function system_view_general() {
global $conf, $cmodes, $corder;
// general settings:
$output .= "<h3>" . t("General settings") . "</h3>\n";
$output .= "<h3>". t("General settings") ."</h3>\n";
$output .= form_textfield(t("Name"), "site_name", variable_get("site_name", "drupal"), 70, 70, t("The name of this website."));
$output .= form_textfield(t("E-mail address"), "site_mail", variable_get("site_mail", ini_get("sendmail_from")), 70, 128, t("A valid e-mail address for this website, used by the auto-mailer during registration, new password requests, notifications, etc."));
$output .= form_textfield(t("Slogan"), "site_slogan", variable_get("site_slogan", ""), 70, 128, t("The slogan of this website. Some themes display a slogan when available."));
......@@ -82,21 +82,21 @@ function system_view_general() {
$output .= "<hr />\n";
// caching:
$output .= "<h3>" . t("Cache settings") . "</h3>\n";
$output .= "<h3>". t("Cache settings") ."</h3>\n";
$period = array(10 => format_interval(10), 20 => format_interval(20), 30 => format_interval(30), 40 => format_interval(40), 50 => format_interval(50), 50 => format_interval(50), 60 => format_interval(60), 90 => format_interval(90), 120 => format_interval(120), 150 => format_interval(150), 180 => format_interval(180), 210 => format_interval(210), 240 => format_interval(240), 270 => format_interval(270), 300 => format_interval(300), 360 => format_interval(360), 420 => format_interval(420), 480 => format_interval(480), 540 => format_interval(540), 600 => format_interval(600), 1800 => format_interval(1800), 3600 => format_interval(3600), 7200 => format_interval(7200));
$output .= form_select(t("Cache support"), "cache", variable_get("cache", 0), array(t("Disabled"), t("Enabled")), t("Enable or disable the caching of pages."));
$output .= form_select(t("Discard cached pages older than"), "cache_clear", variable_get("cache_clear", 120), $period, t("The time cached pages should be kept. Older pages are automatically refreshed."));
$output .= "<hr />\n";
// submission settings:
$output .= "<h3>" . t("Submission settings") . "</h3>\n";
$output .= "<h3>". t("Submission settings") ."</h3>\n";
$rate = array(-10000 => "Disabled", 1 => "Maximum 1 every second", 5 => "Maximum 1 every 5 seconds", 15 => "Maximum 1 every 15 seconds", 30 => "Maximum 1 every 30 seconds", 60 => "Maximum 1 every minute", 300 => "Maximum 1 every 5 minutes", 900 => "Maximum 1 every 15 minutes", 1800 => "Maximum 1 every 30 minutes", 3600 => "Maximum 1 every hour", 21600 => "Maximum 1 every 6 hours", 43200 => "Maximum 1 every 12 hours");
$output .= form_select(t("Maximum node rate"), "max_node_rate", variable_get("max_node_rate", 900), $rate, t("The maximum submission rate for nodes. Its purpose is to stop potential abuse or denial of service attacks."));
$output .= form_select(t("Maximum comment rate"), "max_comment_rate", variable_get("max_comment_rate", 120), $rate, t("The maximum submission rate for comments. Its purpose is to stop potential abuse or denial of service attacks."));
$output .= "<hr />\n";
// date settings:
$output .= "<h3>" . t("Date format settings") . "</h3>\n";
$output .= "<h3>". t("Date format settings") ."</h3>\n";
// date settings: possible date formats
$dateshort = array("m/d/Y - H:i", "d/m/Y - H:i", "Y/m/d - H:i",
......@@ -112,24 +112,24 @@ function system_view_general() {
// date settings: construct choices for user
foreach ($dateshort as $f) {
$dateshortchoices[$f] = format_date(time(),"custom",$f);
$dateshortchoices[$f] = format_date(time(), "custom", $f);
}
foreach ($datemedium as $f) {
$datemediumchoices[$f] = format_date(time(),"custom",$f);
$datemediumchoices[$f] = format_date(time(), "custom", $f);
}
foreach ($datelong as $f) {
$datelongchoices[$f] = format_date(time(),"custom",$f);
$datelongchoices[$f] = format_date(time(), "custom", $f);
}
$output .= form_select(t("Date format (short)"), "date_format_short", variable_get("date_format_short", $dateshort[0]), $dateshortchoices, t("The short format of date display."));
$output .= form_select(t("Date format (medium)"), "date_format_medium", variable_get("date_format_medium", $datemedium[0]), $datemediumchoices,t("The medium sized date display."));
$output .= form_select(t("Date format (medium)"), "date_format_medium", variable_get("date_format_medium", $datemedium[0]), $datemediumchoices, t("The medium sized date display."));
$output .= form_select(t("Date format (long)"), "date_format_long", variable_get("date_format_long", $datelong[0]), $datelongchoices, t("Longer date format used for detailed display."));
return $output;
}
function system_view_module($name) {
if (module_hook($name, "settings")) {
$output .= "<h3><a name=\"$name\">". ucfirst(t("$name")) ." " . t("settings") . "</a></h3>". module_invoke($name, "settings") ."<hr />\n";
$output .= "<h3><a name=\"$name\">". ucfirst(t("$name")) ." ". t("settings") ."</a></h3>". module_invoke($name, "settings") ."<hr />\n";
}
return $output;
}
......@@ -167,8 +167,9 @@ function system_save_settings($edit = array()) {
foreach ($edit["status"] as $filename => $status) {
db_query("UPDATE system SET status = '%d' WHERE filename = '$filename'", $status);
}
if ($edit["type"] == "theme")
if ($edit["type"] == "theme") {
variable_set("theme_default", $edit["theme_default"]);
}
}
else {
foreach ($edit as $name => $value) {
......@@ -198,16 +199,20 @@ function system_view($type, $arg = "") {
$form = system_view_filters();
break;
case "modules":
if ($arg)
if ($arg) {
$form = system_view_module($arg);
else
}
else {
$form = system_listing("module", "modules", $required);
}
break;
case "themes":
if ($arg)
if ($arg) {
$form = system_view_theme($arg);
else
}
else {
$form = system_listing("theme", "themes", $required);
}
break;
default:
$form = system_view_general();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment