From 2ac7aa425ba6ddfa2e3d2dc228f9b61c0dcfd0b9 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sat, 31 Mar 2001 11:00:04 +0000 Subject: - 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 --- includes/node.inc | 25 +++++++++++++++++-------- modules/story.module | 4 ++-- modules/story/story.module | 4 ++-- themes/example/example.theme | 30 +++--------------------------- 4 files changed, 24 insertions(+), 39 deletions(-) diff --git a/includes/node.inc b/includes/node.inc index b58609d04..5cde16949 100644 --- a/includes/node.inc +++ b/includes/node.inc @@ -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 node_info($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 .= "
\n"; foreach ($choices as $key => $value) $options .= "\n"; diff --git a/modules/story.module b/modules/story.module index f47a93e0b..81f46be78 100644 --- a/modules/story.module +++ b/modules/story.module @@ -133,9 +133,9 @@ function story_form($edit = array()) { if (user_access($user, "story")) { $output .= "". t("Status") .":
\n"; $output .= " scheduled for
\n"; - $output .= " posted
\n"; - $output .= " queued
\n"; $output .= " dumped
\n"; + $output .= " queued
\n"; + $output .= " posted
\n"; $output .= "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") ."', ...

\n"; $output .= "\n"; diff --git a/modules/story/story.module b/modules/story/story.module index f47a93e0b..81f46be78 100644 --- a/modules/story/story.module +++ b/modules/story/story.module @@ -133,9 +133,9 @@ function story_form($edit = array()) { if (user_access($user, "story")) { $output .= "". t("Status") .":
\n"; $output .= " scheduled for
\n"; - $output .= " posted
\n"; - $output .= " queued
\n"; $output .= " dumped
\n"; + $output .= " queued
\n"; + $output .= " posted
\n"; $output .= "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") ."', ...

\n"; $output .= "\n"; diff --git a/themes/example/example.theme b/themes/example/example.theme index b3fe9de7f..640eaed55 100644 --- a/themes/example/example.theme +++ b/themes/example/example.theme @@ -8,11 +8,9 @@ ?> - <? echo $site_name; ?> - @@ -36,7 +34,7 @@ ?> - - - - - - - - - - - - - - - - -
+
- +

- - - - -
- -
+

-- cgit v1.2.3