This commit was manufactured as part of Drupal's Great Git Migration to

create tag 'DRUPAL-4-3-0'.

Sprout from master 2003-10-30 19:16:44 UTC Dries Buytaert <dries@buytaert.net> ''
Cherrypick from DRUPAL-4-3 2003-11-01 22:23:27 UTC Kjartan Mannes <kjartan@2.no-reply.drupal.org> '- Updating release info.':
    CHANGELOG
    database/database.mssql
    database/database.mysql
    database/database.pgsql
    modules/poll.module
    modules/user.module
Delete:
    modules/aggregator.module
    modules/aggregator/aggregator.module
    modules/archive/archive.module
    modules/block/block.module
    modules/blog/blog.module
    modules/book/book.module
    modules/comment/comment.module
    modules/drupal/drupal.module
    modules/forum/forum.module
    modules/help/help.module
    modules/locale/locale.module
    modules/node/node.module
    modules/page/page.module
    modules/path/path.module
    modules/ping/ping.module
    modules/poll/poll.module
    modules/profile/profile.module
    modules/search/search.module
    modules/statistics/statistics.module
    modules/story/story.module
    modules/system/system.module
    modules/taxonomy/taxonomy.module
    modules/throttle/throttle.module
    modules/tracker/tracker.module
    modules/user/user.module
    modules/watchdog/watchdog.module
parent 3c17d392
Drupal x.x.x, xxxx-xx-xx (to be released)
Drupal 4.3.0, 2003-11-01
------------------------
- added support for configurable URLs.
......
......@@ -500,7 +500,7 @@ INSERT INTO system VALUES ('modules/story.module','story','module','',1);
INSERT INTO system VALUES ('modules/taxonomy.module','taxonomy','module','',1);
INSERT INTO system VALUES ('themes/marvin/marvin.theme','marvin','theme','Internet explorer, Netscape, Opera',1);
INSERT INTO variable(name,value) VALUES('update_start', 's:10:"2003-10-22";');
INSERT INTO variable(name,value) VALUES('update_start', 's:10:"2003-10-27";');
INSERT INTO variable(name,value) VALUES('theme_default','s:6:"marvin";');
INSERT INTO users(uid,name,mail,rid) VALUES(0,'','','1');
......
......@@ -590,7 +590,7 @@ INSERT INTO system VALUES ('modules/taxonomy.module','taxonomy','module','',1);
INSERT INTO system VALUES ('themes/marvin/marvin.theme','marvin','theme','Internet explorer, Netscape, Opera',1);
INSERT INTO users (uid, name, mail, rid) VALUES ('0', '', '', '1');
REPLACE variable SET name='update_start', value='s:10:"2003-10-22;"';
REPLACE variable SET name='update_start', value='s:10:"2003-10-27;"';
REPLACE variable SET name='theme_default', value='s:6:"marvin";';
REPLACE blocks SET module = 'user', delta = '0', status = '1';
......
......@@ -590,7 +590,7 @@ INSERT INTO system VALUES ('modules/story.module','story','module','',1);
INSERT INTO system VALUES ('modules/taxonomy.module','taxonomy','module','',1);
INSERT INTO system VALUES ('themes/marvin/marvin.theme','marvin','theme','Internet explorer, Netscape, Opera',1);
INSERT INTO variable(name,value) VALUES('update_start', 's:10:"2003-10-22";');
INSERT INTO variable(name,value) VALUES('update_start', 's:10:"2003-10-27";');
INSERT INTO variable(name,value) VALUES('theme_default','s:6:"marvin";');
INSERT INTO users(uid,name,mail,rid) VALUES(0,'','', '1');
......
This diff is collapsed.
This diff is collapsed.
<?php
// $Id$
function archive_help($section) {
$output = "";
switch ($section) {
case 'admin/system/modules#description':
$output = t("Displays a calendar to navigate old content.");
break;
case 'admin/system/modules/archive':
$output = t("Choose the starting \"day of the week\" for the displayed calendar block.");
break;
}
return $output;
}
function archive_calendar($original = 0) {
global $user;
$edit = $_POST["edit"];
// Extract today's date:
$offset = time() + $user->timezone;
$start_of_today = mktime(0, 0, 0, date("n", $offset), date("d", $offset), date("Y", $offset)) + $user->timezone;
$end_of_today = mktime(23, 59, 59, date("n", $offset), date("d", $offset), date("Y", $offset)) + $user->timezone;
// Extract the requested date:
if ($edit["year"] && $edit["month"] && $edit["day"]) {
$year = $edit["year"];
$month = $edit["month"];
$day = $edit["day"];
$requested = mktime(0, 0, 0, $month, $day, $year) + $user->timezone;
}
else if (arg(0) == "archive" && arg(3)) {
$year = arg(1);
$month = arg(2);
$day = arg(3);
$requested = mktime(0, 0, 0, $month, $day, $year) + $user->timezone;
}
else {
$year = date("Y", time());
$month = date("n", time());
$day = date("d", time());
$requested = $end_of_today + $user->timezone;
}
$start_of_month = mktime(0, 0, 0, $month, 1, $year);
// Extract first day of the month:
$first = date("w", $start_of_month);
// Extract last day of the month:
$last = date("t", $start_of_month);
$end_of_month = mktime(23, 59, 59, $month, $last, $year);
$cache = cache_get("archive:calendar:$start_of_month");
if (!empty($cache)) {
return $cache->data;
}
// Calculate previous and next months dates and check for shorter months (28/30 days)
$prevmonth = mktime(23, 59, 59, $month - 1, 1, $year);
$prev = mktime(23, 59, 59, $month - 1, min(date("t", $prevmonth), $day), $year);
$nextmonth = mktime(23, 59, 59, $month + 1, 1, $year);
$next = mktime(23, 59, 59, $month + 1, min(date("t", $nextmonth), $day), $year);
$result = db_query("SELECT created FROM {node} WHERE status = 1 AND created > $start_of_month AND created < $end_of_month");
$days_with_posts = array();
while ($day_with_post = db_fetch_object($result)) {
$days_with_posts[] = date("j", $day_with_post->created + $user->timezone);
}
$days_with_posts = array_unique($days_with_posts);
// Generate calendar header:
$output .= "\n<!-- calendar -->\n";
$output .= "<div class=\"calendar\">";
$output .= "<table>\n";
$output .= " <tr><td colspan=\"7\" class=\"header-month\">". l("&laquo;", "archive/". date("Y/m/d", $prev)) ." ". date("F Y", $requested) ." ". ($nextmonth <= time() ? l("&raquo;", "archive/". date("Y/m/d", $next)) : "&nbsp;") ."</td></tr>\n";
// First day of week (0 => Sunday, 1 => Monday, ...)
$weekstart = variable_get("default_firstday", 0);
// Last day of week
($weekstart - 1 == -1) ? $lastday = 6 : $lastday = $weekstart - 1;
// Generate the days of the week:
$firstcolumn = mktime(0, 0, 0, 3, 20 + $weekstart, 1994);
$output .= " <tr class=\"header-week\">";
for ($i = 0; $i < 7; $i++) {
$output .= "<td>". t(substr(ucfirst(date("l", $firstcolumn + $i * 86400)), 0, 2)) ."</td>";
}
$output .= "</tr>\n";
// Initialize temporary variables:
$nday = 1;
$sday = $first;
// Loop through all the days of the month:
while ($nday <= $last) {
// Set up blank days for first week of the month:
if ($first != $weekstart) {
$blankdays = ($first - $weekstart + 7) % 7;
$output .= " <tr class=\"row-week\"><td class=\"day-blank\" colspan=\"$blankdays\">&nbsp;</td>\n";
$first = $weekstart;
}
// Start every week on a new line:
if ($sday == $weekstart) {
$output .= " <tr class=\"row-week\">\n";
}
// Print one cell:
$date = mktime(0, 0, 0, $month, $nday, $year) + $user->timezone;
if (in_array($nday, $days_with_posts)) {
$daytext = l($nday, "archive/$year/$month/$nday");
$dayclass = "day-link";
}
else {
$daytext = "<div>$nday</div>";
$dayclass = "day-normal";
}
if ($date == $requested) {
$output .= " <td class=\"day-selected\">$daytext</td>\n";
}
else if ($date == $start_of_today) {
$output .= " <td class=\"day-today\">$daytext</td>\n";
}
else if ($date > $end_of_today) {
$output .= " <td class=\"day-future\">$daytext</td>\n";
}
else {
$output .= " <td class=\"$dayclass\">$daytext</td>\n";
}
// Start every week on a new line:
if ($sday == $lastday) {
$output .= " </tr>\n";
}
// Update temporary variables:
$sday++;
$sday = $sday % 7;
$nday++;
}
// Complete the calendar:
if ($sday != $weekstart) {
$end = (7 - $sday + $weekstart) % 7;
$output .= " <td class=\"day-blank\" colspan=\"$end\">&nbsp;</td>\n </tr>\n";
}
$output .= "</table></div>\n\n";
cache_set("archive:calendar:$start_of_month", $output, 1);
return $output;
}
function archive_block($op = "list", $delta = 0) {
global $date;
if ($op == "list") {
$blocks[0]["info"] = t("Calendar to browse archives");
return $blocks;
}
else if (user_access("access content")) {
switch ($delta) {
case 0:
$block["subject"] = t("Browse archives");
$block["content"] = archive_calendar();
return $block;
}
}
}
function archive_link($type) {
$links = array();
if ($type == "page" && user_access("access content")) {
$links[] = l(t("archives"), "archive", array("title" => t("Read the older content in our archive.")));
}
return $links;
}
function archive_page() {
global $date, $month, $year, $meta, $user;
$op = $_POST["op"];
$edit = $_POST["edit"];
theme("header");
if (user_access("access content")) {
if ($op == t("Show")) {
$year = $edit["year"];
$month = $edit["month"];
$day = $edit["day"];
}
else {
$year = arg(1);
$month = arg(2);
$day = arg(3);
}
$date = mktime(0, 0, 0, $month, $day, $year) - $user->timezone;
/*
** Prepare the values of the form fields:
*/
$years = array(2000 => "2000", 2001 => "2001", 2002 => "2002", 2003 => "2003", 2004 => "2004", 2005 => "2005");
$months = array(1 => t("January"), 2 => t("February"), 3 => t("March"), 4 => t("April"), 5 => t("May"), 6 => t("June"), 7 => t("July"), 8 => t("August"), 9 => t("September"), 10 => t("October"), 11 => t("November"), 12 => t("December"));
for ($i = 1; $i <= 31; $i++) $days[$i] = $i;
$start = "<div class=\"container-inline\">";
$start .= form_select("", "year", ($year ? $year : date("Y")), $years). form_select("", "month", ($month ? $month : date("m")), $months) . form_select("", "day", ($day ? $day : date("d")), $days) . form_submit(t("Show"));
$start .= "</div>";
theme("box", t("Archives"), form($start));
/*
** Fetch nodes for the selected date, or current date if none
** selected.
*/
if ($year && $month && $day) {
$result = db_query_range("SELECT nid FROM {node} WHERE status = '1' AND created > %d ORDER BY created", $date, 0, 20);
while ($nid = db_fetch_object($result)) {
node_view(node_load(array("nid" => $nid->nid)), 1);
}
}
}
else {
message_access();
}
theme("footer");
}
function archive_settings() {
$output .= form_select( t("First day of week"), "default_firstday", variable_get("default_firstday", 0), array(0 => t("Sunday"), 1 => t("Monday"), 2 => t("Tuesday"), 3 => t("Wednesday"), 4 => t("Thursday"), 5 => t("Friday"), 6 => t("Saturday")), t("The first day of the week. By changing this value you choose how the calendar block is rendered."));
return $output;
}
?>
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
<?php
// $Id$
function drupal_help($section = "admin/help#drupal") {
$output = "";
switch ($section) {
case 'admin/help#drupal':
$output .= "<p>The \"Drupal\" module features a capability whereby other drupal sites may <i>call home</i> to report their existence. In turn, this enables a pod of Drupal sites to find, cooperate and advertise each other.</p>";
$output .= "<p>Currently, the main application of this feature is the %drupal-sites. By default, fresh Drupal installations can use %Drupal as their <i>directory server</i> and report their existence. This reporting occurs via scheduled %xml-rpc pings.</p>";
$output .= "<p>Drupal administrators should simply enable this feature to get listed on the %drupal-sites; just set your site's name, e-mail address, slogan and mission statement. Then make sure that the field called <i>Drupal XML-RPC server</i> on the %drupal-settings page is set to http://www.drupal.org/xmlrpc.php, and enable this feature using the dropdown directly below.</p>";
$output .= "<p>The listing of your site will occur shortly after your site's next %cron. Note that cron.php should be called using the domain name which you want to have listed at %Drupal. For example, don't kick off cron by requesting http://127.0.0.1/cron.php. Instead, use a publicly accessible domain name such as http://www.mydomain.org/cron.php.</p>";
$output .= "<p>Also note that your installation need not use drupal.org as its directory server. For example, this feature is perfectly capable of aggregating pings from all of your departmental drupal installations sites within an enterprise.</p>";
$output = t($output, array("%drupal-sites" => "<a href=\"http://www.drupal.org/node/view/3\">". t("Drupal sites page") ."</a>", "%Drupal" => "<a href=\"http://www.drupal.org\">drupal.org</a>", "%xml-rpc" => "<a href=\"http://www.xmlrpc.com/\">XLM-RPC</a>", "%drupal-settings" => l(t("administer") ." &raquo; ". t("configuration") ." &raquo; ". t("modules") ." &raquo; ". t("drupal"), "admin/system/modules/drupal"), "%cron" => l(t("cron run"), "admin/system/help#cron")));
break;
case 'admin/system/modules#description':
$output = t("Lets users log in using a Drupal ID and can notify drupal.org about your site.");
break;
case 'admin/system/modules/drupal':
$output = t("Using this your Drupal site can \"call home\" and add itself to the Drupal directory. If you want it to add itself to a different directory server you can change the %Drupal-setting setting -- but the directory server has to be able to handle Drupal XML. To get a full site listing go to the %general and set:<ul><li>The site name,</li><li>The site E-Mail address,</li><li>The site slogan, and</li><li>The site mission statement.</li></ul>", array("%Drupal-setting" => l(t("Drupal XML-RPC server"), "admin/system/modules/drupal"), "%general" => l(t("site configuration"), "admin/system")));
break;
case 'user/help#drupal':
$site = variable_get("site_name", "this web site");
$output = "<p>%drupal is the name of the software which powers %site. There are Drupal web sites all over the world, and many of them share their registration databases so that users may freely login to any Drupal site using a single <b>Drupal ID</b>.</p>\n";
$output .= "<p>So please feel free to login to your account here at %site with a username from another Drupal site. The format of a Drupal ID is similar to an email address: <b>username</b>@<i>server</i>. An example of valid Drupal ID is <b>mwlily</b>@<i>www.drupal.org</i>.</p>";
$output = t($output, array("%drupal" => "<a href=\"http://www.drupal.org\">Drupal</a>", "%site" => "<i>$site</i>"));
break;
}
return $output;
}
function drupal_settings() {
$output .= form_textfield("Drupal XML-RPC 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 known 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 address, slogan and mission statement. When the \"Drupal XML-RPC server\" field is set to \"http://www.drupal.org/xmlrpc.php\", your web site will get listed on <a href=\"http://www.drupal.org/\">http://www.drupal.org/</a>. Requires crontab.");
return $output;
}
function drupal_cron() {
if (time() - variable_get("drupal_cron_last", 0) > 21600) {
variable_set("drupal_cron_last", time());
/*
** 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 = '%s' OR mail = '%s'", $link, $mail);
db_query("INSERT INTO {directory} (link, name, mail, slogan, mission, timestamp) VALUES ('%s', '%s', '%s', '%s', '%s', %d)", $link, $name, $mail, $slogan, $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"), "drupal.login" => array("function" => "drupal_login"));
}
function drupal_notify($server) {
global $base_url;
$url = parse_url($server);
$client = new xmlrpc_client($url["path"], $url["host"], 80);
$message = new xmlrpcmsg("drupal.site.ping", array(new xmlrpcval($base_url, "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";
if ($field) {
return $info[$field];
}
else {
return $info;
}
}
function drupal_auth($username, $password, $server) {
$message = new xmlrpcmsg("drupal.login", array(new xmlrpcval($username, "string"), new xmlrpcval($password, "string")));
// TODO remove hard coded Port 80
// TODO manage server/path such that HTTP_HOST/xml.rpc.php is not assumed
$client = new xmlrpc_client("/xmlrpc.php", $server, 80);
$result = $client->send($message, 5);
if ($result && !$result->faultCode()) {
$value = $result->value();
$login = $value->scalarval();
}
return $login;
}
function drupal_page() {
theme("header");
theme("box", "Drupal", drupal_help("user/help#drupal"));
theme("footer");
}
function drupal_login($arguments) {
// an XML-RPC method called by external clients (usually other Drupal instances)
$argument = $arguments->getparam(0);
$username = $argument->scalarval();
$argument = $arguments->getparam(1);
$password = $argument->scalarval();
if ($user = user_load(array(name => "$username", "pass" => $password, "status" => 1))) {
return new xmlrpcresp(new xmlrpcval($user->uid, "int"));
}
else {
return new xmlrpcresp(new xmlrpcval(0, "int"));
}
}
function drupal_user($type, $edit, $user) {
$module = "drupal";
$name = module_invoke($module, "info", "name");
switch ($type) {
case "view_private":
$result = user_get_authname($user, $module);
if ($result) {
$output .= form_item(t("$name ID"), $result);
}
else {
// TODO: use a variation of $base_url instead of $HTTP_HOST below
$output .= form_item(t("$name ID"), "$user->name@". $_SERVER["HTTP_HOST"]);
}
return $output;
}
}
?>
This diff is collapsed.
<?php
// $Id$
function help_link($type) {
if ($type == "system" && user_access("access administration pages")) {
menu("admin/help/glossary", t("glossary"), "help_glossary", 8);
menu("admin/help", t("help"), "help_help", 9);
}
}
function help_glossary() {
$output .= "<h3>Glossary</h3><dl>";
$output .= "<dt>Block</dt><dd>A small box containing information or content placed in the left-hand or right-hand sidebar of a web page.</dd>";
$output .= "<dt>Comment</dt><dd>A note attached to a node. Usually intended to clarify, explain, criticize, or express an opinion on the original material.</dd>";
$output .= "<dt>Moderation</dt><dd>The activity of making sure a post to a Drupal site fits in with what is expected for that Drupal site.<dl>";
$output .= "<dt>Approved</dt><dd>A moderated post which has been accepted by the moderators for publication. (See published).</dd>";
$output .= "<dt>Waiting</dt><dd>A moderated post which is still being voted on to be accepted for publication. (See published.)</dd>";
$output .= "<dt>Moderators</dt><dd>The group of Drupal users that reviews posts before they are published. These users have the \"access submission queue\" permission. (See Published).</dd></dl></dd>";
$output .= "<dt>Node</dt><dd>The basic data unit in Drupal. Everything is a node or an extention of a node.</dd>";
$output .= "<dt>Public</dt><dd>See published.</dd>";
$output .= "<dt>Published</dt><dd>A node that is viewable by everyone. (See unpublished.)</dd>";
$output .= "<dt>Role</dt><dd>A classification users are placed into for the purpose of setting users' permissions.</dd>";
$output .= "<dt>Taxonomy</dt><dd>A division of a collection of things into ordered, classified groups. (See %taxonomy.)</dd>";
$output .= "<dt>Unpublished</dt><dd>A node that is only viewable by administrators and moderators.</dd>";
$output .= "<dt>User</dt><dd>A person who has an account at your Drupal site, and is logged in with that account.</dd>";
$output .= "<dt>Visitor</dt><dd>A person who does not have an account at your Drupal site or a person who has an account at your Drupal site but is <u>not</u> logged in with that account. Also termed \"anonymous user\".</dd>";
$output .= "</dl>";
$output = t($output, array("%taxonomy" => l(t("taxonomy help"), "admin/taxonomy/help")));
return $output;
}
function help_help($section = "admin/help#help") {
$output = "";
switch ($section) {
case 'admin/help#help':
foreach (module_list() as $name) {
if ($name == 'help') {
continue;
}
else if (module_hook($name, "help")) {
$temp = module_invoke($name, "help", "admin/help#$name");
if (!empty($temp)) {
$links[] = l($name, "admin/help#$name");
$output .= "<h2><a id=\"$name\">". ucfirst($name) ." module</a></h2>";
$output .= $temp;
}
}
}
$output = "<small>". implode(" &middot; ", $links) ."</small><hr />". $output;
break;
case 'admin/system/modules#description':
$output = t("Manages displaying online help.");
break;
}
return $output;
}
?>
This diff is collapsed.
This diff is collapsed.
<?php
// $Id$
function page_help($section = "admin/help#page") {
$output = "";
switch ($section) {
case 'admin/help#page':
$output .= "<p>The page module is used to create a <i>static page</i>. Unlike a story, a static page is a persistent web page on your site which usually shortcuts the typical lifecycle of user generated content (i.e. submit -&gt; moderate -&gt; post -&gt; comment). A static page is usually linked from the main navigation bar, using whatever text the author wishes. To create a static page without this navigation link, simply skip the link text field.</p>";
$output .= "<p>Site pages, unlike many other forms of Drupal content, may be made of PHP code in addition to HTML and text. All Drupal objects and functions are available to a site administrator.</p>";
$output = t($output);
break;
case 'admin/system/modules#description':
$output = t("Enables the creation of a static pages that can be added to the navigation system.");
break;
}
return $output;
}
function page_perm() {
return array("maintain static pages");
}
function page_node($field) {
$info["name"] = t("static page");
$info["description"] = t("If you just want to add a page with a link in the menu to your site, this would be the best choice. Unlike a story, a static page by-passes the submission queue.");
return $info[$field];
}
function page_access($op, $node) {
if ($op == "view") {
return $node->status;
}
if ($op == "create") {
return user_access("maintain static pages");
}
if ($op == "update") {
return user_access("maintain static pages");
}
if ($op == "delete") {
return user_access("maintain static pages");
}
}
function page_save($op, $node) {
if ($op == "approve") {
return array("status" => 1);
}
if ($op == "decline") {
return array("status" => 0);
}
}
function page_insert($node) {
db_query("INSERT INTO {page} (nid, format, link, description) VALUES (%d, %d, '%s', '%s')", $node->nid, $node->format, $node->link, $node->description);
}
function page_update($node) {
db_query("UPDATE {page} SET format = %d, link = '%s', description = '%s' WHERE nid = %d", $node->format, $node->link, $node->description, $node->nid);
}
function page_delete(&$node) {
db_query("DELETE FROM {page} WHERE nid = %d", $node->nid);
}
function page_load($node) {
$page = db_fetch_object(db_query("SELECT format, link, description FROM {page} WHERE nid = %d", $node->nid));
return $page;
}
function page_link($type) {
$links = array();
if ($type == "page" && user_access("access content")) {
$result = db_query("SELECT n.nid, n.title, p.link, p.description FROM {page} p INNER JOIN {node} n ON p.nid = n.nid WHERE n.status = '1' AND p.link != '' ORDER BY p.link");
while ($page = db_fetch_object($result)) {
$links[] = l($page->link, "node/view/$page->nid", array("title" => $page->description));
}
}
if ($type == "system") {
if (user_access("maintain static pages")) {
menu("node/add/page", t("static page"), "page_page", 0);
}
}
return $links;
}
function page_content($node) {
/*
** Extract the page body. If body is dynamic (using PHP code), the body
** will be generated.
*/
if ($node->format == 0) {
// HTML type
$node->teaser = check_output($node->teaser);
$node->body = check_output($node->body);
}
else {
// PHP type
ob_start();
eval($node->body);
$node->teaser = $node->body = ob_get_contents();
ob_end_clean();
}
return $node;
}
function page_view($node, $main) {
// prepair the node content
$node = page_content($node);
// print the node
theme("node", $node, $main);
}
function page_form(&$node, &$help, &$error) {
if (function_exists("taxonomy_node_form")) {
$output .= implode("", taxonomy_node_form("page", $node));
}
$output .= form_textarea(t("Body"), "body", $node->body, 60, 20);
$output .= form_textfield(t("Link name"), "link", $node->link, 60, 64, t("To make the page show up in the navigation links, enter the name of the link, otherwise leave blank."));
$output .= form_textfield(t("Link description"), "description", $node->description, 60, 64, t("The description displayed when hovering over the page's link. Leave blank when you don't want a description."));
$output .= form_select(t("Type"), "format", $node->format, array(0 => "HTML", 1 => "PHP"));