$selectMaxSql = 'SELECT MAX(id) FROM ' . LOG_TABLE; $id = $app->db->query($selectMaxSql)->fetchColumn(); // Plugin action $app->plugin->doAction('after-new-entry-posted', $id); // Add tags $app->addTag(LOG_TAG_MAP_TABLE, $id); // echo var_dump($res); if (!empty($res)) { $app->db->commit(); if ($draftStatus == '1') { // If the entry is draft, move to draft page. header('Location: ./drafts.php'); exit; } else { // If the entry status is public, move to published page. if (class_exists('Loggix_Module_Trackback')) { $tb = new Loggix_Module_Trackback(); $tb->sendTrackback($id); } header('Location: ../index.php?id=' . urlencode($id)); exit; } } else { echo 'Insert Error'; } } else { header('Location: ./write.php'); } } else { header('Location: ../index.php'); }
} $app->db->beginTransaction(); $sql = 'UPDATE ' . LOG_TABLE . ' ' . 'SET ' . '`title` = :title, ' . '`comment` = :comment, ' . '`text_mode` = :text_mode, ' . '`excerpt` = :excerpt, ' . '`date` = :date, ' . '`mod` = :mod, ' . '`draft` = :draft, ' . '`allow_comments` = :allow_comments, ' . '`allow_pings` = :allow_pings ' . 'WHERE ' . 'id = :id'; $sql = $app->setDelimitedIdentifier($sql); $stmt = $app->db->prepare($sql); $res = $stmt->execute(array(':title' => $title, ':comment' => $comment, ':text_mode' => $textMode, ':excerpt' => $excerpt, ':date' => $postDate, ':mod' => $modDate, ':draft' => $draft, ':allow_comments' => $allowComments, ':allow_pings' => $allowPings, ':id' => $id)); // Add Tag $app->addTag(LOG_TAG_MAP_TABLE, $id); if ($res) { $app->db->commit(); $sql = 'SELECT ' . 'draft ' . 'FROM ' . LOG_TABLE . ' ' . 'WHERE ' . 'id = :id'; $stmt = $app->db->prepare($sql); $stmt->execute(array('id' => $id)); $item = $stmt->fetch(); if ($item['draft'] == '1') { header('Location: ./drafts.php'); } else { // Send Trackback if ($draft == '0' && class_exists('Loggix_Module_Trackback')) { $aTrackback = new Loggix_Module_Trackback(); $pingStatus = $aTrackback->sendTrackback($id); } header('Location: ' . $pathToIndex . '/index.php?id=' . $id); } } } else { header('Location: ./write.php'); } } else { header('Location: ../index.php'); }