예제 #1
0
파일: delete.php 프로젝트: kaz6120/Loggix
        }
        // Insert first entry...
        // First Entry Data
        $title = 'Welcome!';
        $comment = '<img src="./theme/images/loggix_icon.png" alt="Loggix" />' . "\n\n" . 'This is the first entry.';
        $excerpt = '';
        $postDate = gmdate('Y-m-d H:i:s', time() + $config['tz'] * 3600);
        $modDate = gmdate('Y-m-d H:i:s', time() + $config['tz'] * 3600);
        $draft = '0';
        // First Entry SQL
        $firstEntrySql = 'INSERT INTO ' . LOG_TABLE . '(' . 'title, ' . 'comment, ' . 'excerpt, ' . 'date, ' . 'mod, ' . 'draft' . ') ' . 'VALUES' . '(' . "'" . $title . "', " . "'" . $comment . "', " . "'" . $excerpt . "', " . "'" . $postDate . "', " . "'" . $modDate . "', " . "'" . $draft . "'" . ')';
        $firstEntryRes = $app->db->query($firstEntrySql);
        // Get the new entry ID.
        $getNewEntryIdSql = 'SELECT MAX(id) FROM ' . LOG_TABLE;
        $getNewEntryIdRes = $app->db->query($getNewEntryIdSql);
        $id = $getNewEntryIdRes->fetchColumn();
        // Add the new entry tag
        $addTagNameSql = 'INSERT INTO ' . LOG_TAG_TABLE . '(tag_name) ' . 'VALUES' . "('Untagged')";
        $addTagNameRes = $app->db->query($addTagNameSql);
        $app->addTag(LOG_TAG_MAP_TABLE, $id);
        // ----------------------------------------------
        $addDownloadsTagNameSql = 'INSERT INTO ' . DOWNLOADS_TAG_TABLE . '(tag_name) ' . 'VALUES' . "('Untagged')";
        $addDownloadsTagNameRes = $app->db->query($addDownloadsTagNameSql);
        $app->addTag(DOWNLOADS_TAG_MAP_TABLE, '0');
        header('Location: ../index.php');
    } else {
        header('Location: ../index.php');
    }
} else {
    header('Location: ../index.php');
}
예제 #2
0
파일: post.php 프로젝트: kaz6120/Loggix
 // Upload Attachiments
 $app->sendAttachments();
 // Insert an new entry
 $app->db->beginTransaction();
 $sql = 'INSERT INTO ' . LOG_TABLE . ' ' . '(' . '`title`, ' . '`comment`, ' . '`excerpt`, ' . '`date`, ' . '`mod`, ' . '`draft`' . ') ' . 'VALUES ' . '(' . ':title, ' . ':comment, ' . ':excerpt, ' . ':date, ' . ':mod, ' . ':draft' . ')';
 $sql = $app->setDelimitedIdentifier($sql);
 $stmt = $app->db->prepare($sql);
 $res = $stmt->execute(array(':title' => $title, ':comment' => $comment, ':excerpt' => $excerpt, ':date' => $postDate, ':mod' => $modDate, ':draft' => $draftStatus));
 // Get the new entry ID.
 //        $id = $app->db->lastInsertId();
 $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;