summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/cvs.module3
-rw-r--r--modules/drupal.module92
-rw-r--r--modules/drupal/drupal.module92
-rw-r--r--modules/system.module9
-rw-r--r--modules/system/system.module9
-rw-r--r--update.php16
6 files changed, 207 insertions, 14 deletions
diff --git a/modules/cvs.module b/modules/cvs.module
index eb4cde0d5..612a5fdaa 100644
--- a/modules/cvs.module
+++ b/modules/cvs.module
@@ -29,8 +29,9 @@ function cvs_cron() {
function cvs_conf_options() {
$period = array(43200 => format_interval(43200), 86400 => format_interval(86400), 172800 => format_interval(172800), 259200 => format_interval(259200), 604800 => format_interval(604800), 1209600 => format_interval(1209600));
- $output .= form_textfield("Digest recepients", "cvs_mail", variable_get("cvs_mail", "root@localhost"), 30, 55, "The e-mail address to mail the CVS log messages to. Multiple recipients can be specified by putting a comma between each address.");
+ $output .= form_textfield("Digest recepients", "cvs_mail", variable_get("cvs_mail", "root@localhost"), 55, 128, "The e-mail address to mail the CVS log messages to. Multiple recipients can be specified by putting a comma between each address.");
$output .= form_select("Digest interval", "cvs_cron_time" , variable_get("cvs_cron_time", 86400), $period, "The time interval at which batched CVS digests are dispatched. Requires crontab.");
+
return $output;
}
diff --git a/modules/drupal.module b/modules/drupal.module
index d69351083..8867e81b3 100644
--- a/modules/drupal.module
+++ b/modules/drupal.module
@@ -1,5 +1,97 @@
<?php
+function drupal_conf_options() {
+ $output .= form_textfield("Drupal server", "drupal_server", variable_get("drupal_server", "http://www.drupal.org/xmlrpc.php"), 55, 128, "The URL of your root Drupal XML-RPC server.");
+ $output .= form_select("Drupal directory", "drupal_directory", variable_get("drupal_directory", 0), array("Disabled", "Enabled"), "If enabled, your Drupal site will make itself know to the Drupal directory at the specified Drupal XML-RPC server. For this to work properly, you have to set your site's name, e-mail addrress, slogan and mission statement.");
+
+ return $output;
+}
+
+function drupal_cron() {
+
+ /*
+ ** If this site acts as a Drupal XML-RPC server, delete the sites that
+ ** stopped sending "ping" messages.
+ */
+
+ db_query("DELETE FROM directory WHERE timestamp < '". (time() - 259200) ."'");
+
+ /*
+ ** If this site acts as a Drupal XML-RPC client, send a message to the
+ ** Drupal XML-RPC server.
+ */
+
+
+ if (variable_get("drupal_directory", 0) && variable_get("drupal_server", 0)) {
+ drupal_notify(variable_get("drupal_server", ""));
+ }
+}
+
+function drupal_directory_ping($arguments) {
+
+ /*
+ ** Parse our parameters:
+ */
+
+ $argument = $arguments->getparam(0);
+ $link = strip_tags($argument->scalarval());
+ $argument = $arguments->getparam(1);
+ $name = strip_tags($argument->scalarval());
+ $argument = $arguments->getparam(2);
+ $mail = strip_tags($argument->scalarval());
+ $argument = $arguments->getparam(3);
+ $slogan = strip_tags($argument->scalarval());
+ $argument = $arguments->getparam(4);
+ $mission = strip_tags($argument->scalarval());
+
+ /*
+ ** Update the data in our database and send back a reply:
+ */
+
+ if ($link && $name && $mail && $slogan && $mission) {
+ db_query("DELETE FROM directory WHERE link = '". check_query($link) ."'");
+ db_query("INSERT INTO directory (link, name, mail, slogan, mission, timestamp) VALUES ('". check_query($link) ."', '". check_query($name) ."', '". check_query($mail) ."', '". check_query($slogan) ."', '". check_query($mission) ."', '". time() ."')");
+
+ watchdog("message", "directory: ping from '$name' ($link)");
+
+ return new xmlrpcresp(new xmlrpcval(1, "int"));
+ }
+ else {
+ return new xmlrpcresp(new xmlrpcval(0, "int"));
+ }
+
+}
+
+function drupal_directory_page() {
+ $result = db_query("SELECT * FROM directory ORDER BY name");
+
+ while ($site = db_fetch_object($result)) {
+ $output .= "<a href=\"$site->link\">$site->name</a> - $site->slogan<div style=\"padding-left: 20px;\">$site->mission</div><br />";
+ }
+
+ return $output;
+}
+
+function drupal_xmlrpc() {
+ return array("drupal.site.ping" => array("function" => "drupal_directory_ping"));
+}
+
+function drupal_notify($server) {
+
+ $url = parse_url($server);
+
+ $client = new xmlrpc_client($url["path"], $url["host"], 80);
+
+ $message = new xmlrpcmsg("drupal.site.ping", array(new xmlrpcval(path_uri(), "string"), new xmlrpcval(variable_get("site_name", ""), "string"), new xmlrpcval(variable_get("site_mail", ""), "string"), new xmlrpcval(variable_get("site_slogan", ""), "string"), new xmlrpcval(variable_get("site_mission", ""), "string")));
+
+ $result = $client->send($message, 5);
+
+ if (!$result || $result->faultCode()) {
+ watchdog("error", "failed to notify '". $url["host"] ."' at '". $url["path"] ."': ". $result->faultString());
+ }
+
+}
+
function drupal_info($field = 0) {
$info["name"] = "Drupal";
$info["protocol"] = "XML-RPC";
diff --git a/modules/drupal/drupal.module b/modules/drupal/drupal.module
index d69351083..8867e81b3 100644
--- a/modules/drupal/drupal.module
+++ b/modules/drupal/drupal.module
@@ -1,5 +1,97 @@
<?php
+function drupal_conf_options() {
+ $output .= form_textfield("Drupal server", "drupal_server", variable_get("drupal_server", "http://www.drupal.org/xmlrpc.php"), 55, 128, "The URL of your root Drupal XML-RPC server.");
+ $output .= form_select("Drupal directory", "drupal_directory", variable_get("drupal_directory", 0), array("Disabled", "Enabled"), "If enabled, your Drupal site will make itself know to the Drupal directory at the specified Drupal XML-RPC server. For this to work properly, you have to set your site's name, e-mail addrress, slogan and mission statement.");
+
+ return $output;
+}
+
+function drupal_cron() {
+
+ /*
+ ** If this site acts as a Drupal XML-RPC server, delete the sites that
+ ** stopped sending "ping" messages.
+ */
+
+ db_query("DELETE FROM directory WHERE timestamp < '". (time() - 259200) ."'");
+
+ /*
+ ** If this site acts as a Drupal XML-RPC client, send a message to the
+ ** Drupal XML-RPC server.
+ */
+
+
+ if (variable_get("drupal_directory", 0) && variable_get("drupal_server", 0)) {
+ drupal_notify(variable_get("drupal_server", ""));
+ }
+}
+
+function drupal_directory_ping($arguments) {
+
+ /*
+ ** Parse our parameters:
+ */
+
+ $argument = $arguments->getparam(0);
+ $link = strip_tags($argument->scalarval());
+ $argument = $arguments->getparam(1);
+ $name = strip_tags($argument->scalarval());
+ $argument = $arguments->getparam(2);
+ $mail = strip_tags($argument->scalarval());
+ $argument = $arguments->getparam(3);
+ $slogan = strip_tags($argument->scalarval());
+ $argument = $arguments->getparam(4);
+ $mission = strip_tags($argument->scalarval());
+
+ /*
+ ** Update the data in our database and send back a reply:
+ */
+
+ if ($link && $name && $mail && $slogan && $mission) {
+ db_query("DELETE FROM directory WHERE link = '". check_query($link) ."'");
+ db_query("INSERT INTO directory (link, name, mail, slogan, mission, timestamp) VALUES ('". check_query($link) ."', '". check_query($name) ."', '". check_query($mail) ."', '". check_query($slogan) ."', '". check_query($mission) ."', '". time() ."')");
+
+ watchdog("message", "directory: ping from '$name' ($link)");
+
+ return new xmlrpcresp(new xmlrpcval(1, "int"));
+ }
+ else {
+ return new xmlrpcresp(new xmlrpcval(0, "int"));
+ }
+
+}
+
+function drupal_directory_page() {
+ $result = db_query("SELECT * FROM directory ORDER BY name");
+
+ while ($site = db_fetch_object($result)) {
+ $output .= "<a href=\"$site->link\">$site->name</a> - $site->slogan<div style=\"padding-left: 20px;\">$site->mission</div><br />";
+ }
+
+ return $output;
+}
+
+function drupal_xmlrpc() {
+ return array("drupal.site.ping" => array("function" => "drupal_directory_ping"));
+}
+
+function drupal_notify($server) {
+
+ $url = parse_url($server);
+
+ $client = new xmlrpc_client($url["path"], $url["host"], 80);
+
+ $message = new xmlrpcmsg("drupal.site.ping", array(new xmlrpcval(path_uri(), "string"), new xmlrpcval(variable_get("site_name", ""), "string"), new xmlrpcval(variable_get("site_mail", ""), "string"), new xmlrpcval(variable_get("site_slogan", ""), "string"), new xmlrpcval(variable_get("site_mission", ""), "string")));
+
+ $result = $client->send($message, 5);
+
+ if (!$result || $result->faultCode()) {
+ watchdog("error", "failed to notify '". $url["host"] ."' at '". $url["path"] ."': ". $result->faultString());
+ }
+
+}
+
function drupal_info($field = 0) {
$info["name"] = "Drupal";
$info["protocol"] = "XML-RPC";
diff --git a/modules/system.module b/modules/system.module
index 9a86ea9db..d9d5c633c 100644
--- a/modules/system.module
+++ b/modules/system.module
@@ -30,11 +30,12 @@ function system_view_options() {
// general settings:
$output .= "<h3>General settings</h3>\n";
- $output .= form_textfield("Name", "site_name", variable_get("site_name", "drupal"), 30, 55, "The name of this website.");
- $output .= form_textfield("E-mail address", "site_mail", variable_get("site_mail", "root@localhost"), 35, 55, "A valid e-mail address for this website, used by the auto-mailer to create new user accounts.");
+ $output .= form_textfield("Name", "site_name", variable_get("site_name", "drupal"), 55, 55, "The name of this website.");
+ $output .= form_textfield("E-mail address", "site_mail", variable_get("site_mail", "root@localhost"), 55, 128, "A valid e-mail address for this website, used by the auto-mailer to create new user accounts.");
$output .= form_textfield("Slogan", "site_slogan", variable_get("site_slogan", ""), 55, 128, "The slogan of this website");
- $output .= form_textarea("Footer message", "site_footer", variable_get("site_footer", ""), 55, 3, "This text will be displayed at the bottom of each page. Useful for adding a copyright notice to your pages.");
- $output .= form_textfield("Anonymous user", "anonymous", variable_get("anonymous", "Anonymous"), 30, 55, "The name used to indicate anonymous users.");
+ $output .= form_textarea("Mission", "site_mission", variable_get("site_mission", ""), 55, 5, "Your site's mission statement or focus.");
+ $output .= form_textarea("Footer message", "site_footer", variable_get("site_footer", ""), 55, 5, "This text will be displayed at the bottom of each page. Useful for adding a copyright notice to your pages.");
+ $output .= form_textfield("Anonymous user", "anonymous", variable_get("anonymous", "Anonymous"), 55, 55, "The name used to indicate anonymous users.");
foreach (module_list() as $name) { if (module_hook($name, "page")) $pages[$name] = $name; }
$output .= form_select("Default front page", "site_frontpage", variable_get("site_frontpage", "node"), $pages, "The default front page.");
$output .= form_textfield("Extra front page settings", "site_frontpage_extra", variable_get("site_frontpage_extra", ""), 55, 128, "Lets you define additonal variables for the main page in PHP.");
diff --git a/modules/system/system.module b/modules/system/system.module
index 9a86ea9db..d9d5c633c 100644
--- a/modules/system/system.module
+++ b/modules/system/system.module
@@ -30,11 +30,12 @@ function system_view_options() {
// general settings:
$output .= "<h3>General settings</h3>\n";
- $output .= form_textfield("Name", "site_name", variable_get("site_name", "drupal"), 30, 55, "The name of this website.");
- $output .= form_textfield("E-mail address", "site_mail", variable_get("site_mail", "root@localhost"), 35, 55, "A valid e-mail address for this website, used by the auto-mailer to create new user accounts.");
+ $output .= form_textfield("Name", "site_name", variable_get("site_name", "drupal"), 55, 55, "The name of this website.");
+ $output .= form_textfield("E-mail address", "site_mail", variable_get("site_mail", "root@localhost"), 55, 128, "A valid e-mail address for this website, used by the auto-mailer to create new user accounts.");
$output .= form_textfield("Slogan", "site_slogan", variable_get("site_slogan", ""), 55, 128, "The slogan of this website");
- $output .= form_textarea("Footer message", "site_footer", variable_get("site_footer", ""), 55, 3, "This text will be displayed at the bottom of each page. Useful for adding a copyright notice to your pages.");
- $output .= form_textfield("Anonymous user", "anonymous", variable_get("anonymous", "Anonymous"), 30, 55, "The name used to indicate anonymous users.");
+ $output .= form_textarea("Mission", "site_mission", variable_get("site_mission", ""), 55, 5, "Your site's mission statement or focus.");
+ $output .= form_textarea("Footer message", "site_footer", variable_get("site_footer", ""), 55, 5, "This text will be displayed at the bottom of each page. Useful for adding a copyright notice to your pages.");
+ $output .= form_textfield("Anonymous user", "anonymous", variable_get("anonymous", "Anonymous"), 55, 55, "The name used to indicate anonymous users.");
foreach (module_list() as $name) { if (module_hook($name, "page")) $pages[$name] = $name; }
$output .= form_select("Default front page", "site_frontpage", variable_get("site_frontpage", "node"), $pages, "The default front page.");
$output .= form_textfield("Extra front page settings", "site_frontpage_extra", variable_get("site_frontpage_extra", ""), 55, 128, "Lets you define additonal variables for the main page in PHP.");
diff --git a/update.php b/update.php
index e791ff4b9..5325f9354 100644
--- a/update.php
+++ b/update.php
@@ -20,6 +20,7 @@ $mysql_updates = array(
"2001-12-01" => "update_11",
"2001-12-06" => "update_12",
"2001-12-09" => "update_13",
+ "2001-12-16" => "update_14",
);
// Update functions
@@ -248,11 +249,16 @@ function update_12() {
update_sql("ALTER TABLE book ADD format tinyint(2) DEFAULT '0';");
}
-function update_13() {
- update_sql("ALTER TABLE referer RENAME AS referrer;");
- update_sql("DROP TABLE blog;");
- update_sql("DROP TABLE story;");
- update_sql("DROP TABLE forum;");
+function update_14() {
+ update_sql("CREATE TABLE directory (
+ link varchar(255) DEFAULT '' NOT NULL,
+ name varchar(128) DEFAULT '' NOT NULL,
+ mail varchar(128) DEFAULT '' NOT NULL,
+ slogan text NOT NULL,
+ mission text NOT NULL,
+ timestamp int(11) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (link)
+ );");
}
// System functions