Commit 2ac7aa42 authored by Dries's avatar Dries

- visual improvements to example.theme, simplified HMTL code (- 20
  lines)
- made node.inc more robust: it should roll-back when something goes
  fubar and it should work in subdirectories
parent a9bb68d9
......@@ -88,18 +88,27 @@ function node_save($node) {
$f2 = implode(", ", $f2);
$v2 = implode(", ", $v2);
db_query("INSERT INTO node ($f1) VALUES ($v1)");
if ($nid = db_insert_id()) {
$lid = db_query("INSERT INTO $node[type] ($f2, nid) VALUES ($v2, $nid)");
if ($lid = db_insert_id()) {
db_query("UPDATE node SET lid = '$lid' WHERE nid = '$nid'");
// insert data, try to roll-back when something goes wrong:
$result = db_query("INSERT INTO node ($f1) VALUES ($v1)");
if ($result && $nid = db_insert_id()) {
$result = db_query("INSERT INTO $node[type] ($f2, nid) VALUES ($v2, $nid)");
if ($result && $lid = db_insert_id()) {
$result = db_query("UPDATE node SET lid = '$lid' WHERE nid = '$nid'");
if ($result) {
watchdog("message", "node: added '$node[title]'");
}
else {
watchdog("warning", "node: added '$node[title]' - failed");
}
}
else {
db_query("DELETE FROM node WHERE nid = '$nid'");
watchdog("warning", "node: added '$node[title]' - failed");
}
}
watchdog("message", "node: added '$node[title]'");
else {
watchdog("warning", "node: added '$node[title]' - failed");
}
}
}
......@@ -137,7 +146,7 @@ function visit(site) {
</SCRIPT>
<?php
$choices = array("/node.php?id=$node->nid" => t("view node"), "/submit.php?mod=$node->type&op=update&id=$node->nid" => t("suggest update"), "/node.php?op=history&id=$node->nid" => t("view history"));
$choices = array("node.php?id=$node->nid" => t("view node"), "/submit.php?mod=$node->type&op=update&id=$node->nid" => t("suggest update"), "node.php?op=history&id=$node->nid" => t("view history"));
$output .= "<FORM METHOD=\"get\" ACTION=\"\">\n";
foreach ($choices as $key => $value) $options .= "<OPTION VALUE=\"$key\"". ($key == $REQUEST_URI ? " SELECTED" : "") .">". check_select($value) ."</OPTION>\n";
......
......@@ -133,9 +133,9 @@ function story_form($edit = array()) {
if (user_access($user, "story")) {
$output .= "<B>". t("Status") .":</B><BR>\n";
$output .= "<INPUT TYPE=\"radio\" NAME=\"edit[status]\" VALUE=\"$status[scheduled]\"". ($edit[status] == $status[scheduled] ? " CHECKED" : "") ."> scheduled for <INPUT TYPE=\"text\" NAME=\"edit[timestamp]\" SIZE=\"30\" VALUE=\"". date("j F Y G:i", ($edit[timetsamp] ? $edit[timestamp] : time())) ."\"><BR>\n";
$output .= "<INPUT TYPE=\"radio\" NAME=\"edit[status]\" VALUE=\"$status[posted]\"". ($edit[status] == $status[posted] ? " CHECKED" : "") ."> posted<BR>\n";
$output .= "<INPUT TYPE=\"radio\" NAME=\"edit[status]\" VALUE=\"$status[queued]\"". ($edit[status] == $status[queued] ? " CHECKED" : "") ."> queued<BR>\n";
$output .= "<INPUT TYPE=\"radio\" NAME=\"edit[status]\" VALUE=\"$status[dumped]\"". ($edit[status] == $status[dumped] ? " CHECKED" : "") ."> dumped<BR>\n";
$output .= "<INPUT TYPE=\"radio\" NAME=\"edit[status]\" VALUE=\"$status[queued]\"". ($edit[status] == $status[queued] ? " CHECKED" : "") ."> queued<BR>\n";
$output .= "<INPUT TYPE=\"radio\" NAME=\"edit[status]\" VALUE=\"$status[posted]\"". ($edit[status] == $status[posted] ? " CHECKED" : "") ."> posted<BR>\n";
$output .= "<SMALL><I>The textfield for scheduled stories expects a string containing an English date format of when you want to have your story automatically published. Example input: '". date("j F Y G:i") ."', '". date("m/d/y H:i") ."', '". date("F j, Y H:i") ."', ...</I></SMALL><P>\n";
$output .= "<INPUT TYPE=\"hidden\" NAME=\"edit[timestamp]\" VALUE=\"$edit[timestamp]\">\n";
......
......@@ -133,9 +133,9 @@ function story_form($edit = array()) {
if (user_access($user, "story")) {
$output .= "<B>". t("Status") .":</B><BR>\n";
$output .= "<INPUT TYPE=\"radio\" NAME=\"edit[status]\" VALUE=\"$status[scheduled]\"". ($edit[status] == $status[scheduled] ? " CHECKED" : "") ."> scheduled for <INPUT TYPE=\"text\" NAME=\"edit[timestamp]\" SIZE=\"30\" VALUE=\"". date("j F Y G:i", ($edit[timetsamp] ? $edit[timestamp] : time())) ."\"><BR>\n";
$output .= "<INPUT TYPE=\"radio\" NAME=\"edit[status]\" VALUE=\"$status[posted]\"". ($edit[status] == $status[posted] ? " CHECKED" : "") ."> posted<BR>\n";
$output .= "<INPUT TYPE=\"radio\" NAME=\"edit[status]\" VALUE=\"$status[queued]\"". ($edit[status] == $status[queued] ? " CHECKED" : "") ."> queued<BR>\n";
$output .= "<INPUT TYPE=\"radio\" NAME=\"edit[status]\" VALUE=\"$status[dumped]\"". ($edit[status] == $status[dumped] ? " CHECKED" : "") ."> dumped<BR>\n";
$output .= "<INPUT TYPE=\"radio\" NAME=\"edit[status]\" VALUE=\"$status[queued]\"". ($edit[status] == $status[queued] ? " CHECKED" : "") ."> queued<BR>\n";
$output .= "<INPUT TYPE=\"radio\" NAME=\"edit[status]\" VALUE=\"$status[posted]\"". ($edit[status] == $status[posted] ? " CHECKED" : "") ."> posted<BR>\n";
$output .= "<SMALL><I>The textfield for scheduled stories expects a string containing an English date format of when you want to have your story automatically published. Example input: '". date("j F Y G:i") ."', '". date("m/d/y H:i") ."', '". date("F j, Y H:i") ."', ...</I></SMALL><P>\n";
$output .= "<INPUT TYPE=\"hidden\" NAME=\"edit[timestamp]\" VALUE=\"$edit[timestamp]\">\n";
......
......@@ -8,11 +8,9 @@ function header() {
?>
<HTML>
<HEAD>
<TITLE><? echo $site_name; ?></TITLE>
</HEAD>
<BODY>
<TABLE BORDER="1">
<TR>
......@@ -36,7 +34,7 @@ function header() {
?>
</TD>
<TD>
<TD VALIGN="top">
<?php
......@@ -154,36 +152,14 @@ function box($subject, $content, $options = "") {
<TABLE>
<TR>
<TD></TD>
<TD></TD>
<TD></TD>
<TD></TD>
<TD></TD>
</TR>
<TR>
<TD></TD>
<TD>
<? echo $subject; ?>
<DIV ALIGN="center"><B><? echo $subject; ?></B></DIV><HR>
</TD>
<TD></TD>
</TR>
<TR>
<TD></TD>
<TD>
<TABLE>
<TR>
<TD>
<?php echo $content; ?>
</TD>
</TR>
</TABLE>
<?php echo $content; ?>
</TD>
<TD></TD>
</TR>
<TR>
<TD></TD>
<TD></TD>
<TD></TD>
</TR>
</TABLE>
<BR>
......
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