Update of /cvsroot/php-blog/serendipity
In directory sc8-pr-cvs1:/tmp/cvs-serv13833
Modified Files:
serendipity_admin_entries.inc.php
serendipity_functions.inc.php serendipity_lang_de.inc.php
serendipity_lang_en.inc.php
Log Message:
We now support drafts! Please test.
Index: serendipity_admin_entries.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_admin_entries.inc.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- serendipity_admin_entries.inc.php 5 Aug 2003 14:07:40 -0000 1.6
+++ serendipity_admin_entries.inc.php 30 Aug 2003 09:55:09 -0000 1.7
@@ -16,14 +16,14 @@
// A little helper we don't want in _functions.inc.php
function serendipity_drawList($action) {
global $serendipity;
-
+
// Prepare variables
if (!is_numeric($serendipity['GET']['offset'])) {
$serendipity['GET']['offset'] = 0;
}
-
- $perPage = 30;
-
+
+ $perPage = 12;
+
// Fetch the entries
$entries = serendipity_fetchEntries(
false,
@@ -31,7 +31,8 @@
serendipity_db_limit(
$serendipity['GET']['offset'],
$perPage
- )
+ ),
+ 'true'
);
$string_action = ($action == 'delete' ? DELETE_ENTRIES : EDIT_ENTRIES);
@@ -39,12 +40,12 @@
?>
<div class="serendipity_admin_list">
<div class="serendipity_admin_list_title"><?php echo $string_action; ?>:</div>
-
+
<table width="100%" class="serendipity_admin_list">
<?php
if (is_array($entries)) {
$half = (int) ((count($entries) + 1)/2);
-
+
// Print the browse buttons
?>
<tr>
@@ -77,21 +78,23 @@
<td class="serendipity_admin_list_item">
<?php echo date('d.m.y, H:i', $entries[$x]['timestamp']) . ': '; ?>
<br />
+ <?php if ($entries[$x]['isdraft']=='true') echo DRAFT.":"?>
<a href="?serendipity[action]=admin&serendipity[adminModule]=entries&serendipity[adminAction]=<?php echo $action; ?>&serendipity[id]=<?php echo $entries[$x]['id']; ?>">
<?php echo htmlentities(substr(empty($entries[$x]['title']) ? $entries[$x]['body'] : $entries[$x]['title'], 0, 40)); ?>
</a>
</td>
-
+
<td class="serendipity_admin_list_item">
<?php
if ($x + $half < $count) {
?>
<?php echo date('d.m.y, H:i', $entries[$x + $half]['timestamp']) . ': '; ?>
<br />
+ <?php if ($entries[$x+$half]['isdraft']=='true') echo DRAFT.":"?>
<a href="?serendipity[action]=admin&serendipity[adminModule]=entries&serendipity[adminAction]=<?php echo $action; ?>&serendipity[id]=<?php echo $entries[$x + $half]['id']; ?>">
<?php echo htmlentities(substr($entries[$x + $half]['title'], 0, 40)); ?>
</a>
-<?php
+<?php
}
?>
</td>
@@ -107,7 +110,7 @@
</td>
</tr>
<?php
- }
+ }
?>
</table>
</div>
@@ -122,11 +125,12 @@
'timestamp' => $serendipity['POST']['timestamp'],
'body' => $serendipity['POST']['body'],
'extended' => $serendipity['POST']['extended'],
- 'categoryid' => $serendipity['POST']['categoryid']
+ 'categoryid' => $serendipity['POST']['categoryid'],
+ 'isdraft' => $serendipity['POST']['isdraft']
);
$res = serendipity_updertEntry($entry);
-
+
if (is_string($res)) {
serendipity_printEntryForm(
'?',
Index: serendipity_functions.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_functions.inc.php,v
retrieving revision 1.141
retrieving revision 1.142
diff -u -d -r1.141 -r1.142
--- serendipity_functions.inc.php 19 Aug 2003 16:20:25 -0000 1.141
+++ serendipity_functions.inc.php 30 Aug 2003 09:55:09 -0000 1.142
@@ -11,7 +11,7 @@
$_SESSION['serendipityAuthedUser'] = true;
return true;
}
-
+
if ($_SESSION['serendipityAuthedUser'] === true && file_exists($serendipity['serendipityPath'] . 'serendipity_config_local.inc.php')) {
return true;
} else {
@@ -32,7 +32,7 @@
<input type="submit" name="submit" value=">" />
</form>
</div>
-<?php
+<?php
}
function serendipity_getTemplateFile($file) {
@@ -165,13 +165,13 @@
<td> </td>
<td class="serendipity_commentsLabel">
<input type="checkbox" name="serendipity[remember]" <?php echo $serendipity['COOKIE']['remember'] ; ?> /> <?php echo REMEMBER_INFO; ?>
-<?php
+<?php
if ($serendipity['allowSubscriptions']) {
?>
<br />
<input type="checkbox" name="serendipity[subscribe]" /> <?php echo SUBSCRIBE_TO_THIS_ENTRY; ?>
-<?php
- }
+<?php
+ }
?>
</td>
</tr>
@@ -263,7 +263,7 @@
)
);
}
-
+
// Find out about diary entries
$querystring = "SELECT timestamp from {$serendipity['dbPrefix']}entries WHERE timestamp >= $ts and timestamp <= $endts";
$rows = serendipity_db_query($querystring);
@@ -403,12 +403,15 @@
* Give it a range in YYYYMMDD format to gather the desired entries
* (For february 2002 you would pass 200202 e.g.
**/
-function serendipity_fetchEntries($range = null, $full = true, $limit = "") {
+function serendipity_fetchEntries($range = null, $full = true, $limit = "", $fetchDrafts = 'false') {
global $serendipity;
if ($full === true)
$body = ',body, extended';
+ if ($fetchDrafts == 'false')
+ $drafts = "isdraft LIKE 'false'";
+
if ( is_numeric($range)) {
$year = (int)substr($range, 0, 4);
$month = (int)substr($range, 4, 2);
@@ -422,9 +425,14 @@
}
$endts = mktime(0, 0, 0, $month, ($day == 0 ? 1 : $day), $year);
- $and = " WHERE timestamp >= $startts AND timestamp <= $endts ";
+ $and = " WHERE timestamp >= $startts AND timestamp <= $endts";
+ if ($drafts)
+ $and .= "AND $drafts";
+
} else {
$and = "";
+ if ($drafts)
+ $and .= "WHERE $drafts";
}
if (!empty($limit)) {
@@ -485,7 +493,7 @@
**/
function serendipity_fetchCategories($authorid = null) {
global $serendipity;
-
+
if ($authorid === null) {
$authorid = $serendipity['authorid'];
}
@@ -618,13 +626,13 @@
<br />
<div class="serendipity_commentsTitle"><?php echo COMMENTS; ?></div>
-<?php
+<?php
if (preg_match('@/unsubscribe/(.*)/([0-9]+)@', $_SERVER['REQUEST_URI'], $res)) {
echo '<div align="center" style="color: #FF0000; font-weight: bold;">'. sprintf(UNSUBSCRIBE_OK, urldecode($res[1])) .'</div><br />';
}
- echo serendipity_printComments(serendipity_fetchComments($entry['id']));
+ echo serendipity_printComments(serendipity_fetchComments($entry['id']));
?>
<br />
<div class="serendipity_commentsTitle"><?php echo ADD_COMMENT; ?></div>
@@ -839,13 +847,13 @@
$name = serendipity_db_escape_string($commentInfo['name']);
$url = serendipity_db_escape_string($commentInfo['url']);
$email = serendipity_db_escape_string($commentInfo['email']);
-
+
if (isset($commentInfo['subscribe'])) {
$subscribe = 'true';
} else {
$subscribe = 'false';
}
-
+
$t = time();
$query = "INSERT INTO {$serendipity['dbPrefix']}comments (entry_id, author, email, url, body, type, timestamp, title, subscribed)";
$query .= " VALUES ('$id', '$name', '$email', '$url', '$commentsFixed', '$type', '$t', '$title', '$subscribe')";
@@ -875,26 +883,26 @@
function serendipity_mailSubscribers($entry_id, $poster, $posterMail, $title, $fromEmail = 'no...@ex...') {
global $serendipity;
-
+
$entryURI = serendipity_archiveURL($entry_id, $title);
$subject = '[' . $serendipity['blogTitle'] . '] ' . sprintf(NEW_COMMENT_TO_SUBSCRIBED_ENTRY, $title);
- $sql = "SELECT author, email
- FROM {$serendipity['dbPrefix']}comments
- WHERE entry_id = $entry_id
- AND email <> '$posterMail'
- AND subscribed = 'true'
+ $sql = "SELECT author, email
+ FROM {$serendipity['dbPrefix']}comments
+ WHERE entry_id = $entry_id
+ AND email <> '$posterMail'
+ AND subscribed = 'true'
GROUP BY email";
$subscribers = serendipity_db_query($sql);
-
+
if (!is_array($subscribers)) {
return;
}
-
+
foreach ($subscribers as $subscriber) {
$text = sprintf(
SUBSCRIPTION_MAIL,
-
+
$subscriber['author'],
$serendipity['blogTitle'],
$title,
@@ -902,25 +910,25 @@
$entryURI,
$serendipity['baseURL'] .'unsubscribe/'. urlencode($subscriber['email']) .'/'. $entry_id
);
-
+
mail($subscriber['email'], $subject, $text . $serendipity['signature'], "From: {$serendipity['blogTitle']} <$fromEmail>\r\n". $serendipity['mailheaders']);
}
}
function serendipity_cancelSubscription($email, $entry_id) {
global $serendipity;
- $sql = "UPDATE {$serendipity['dbPrefix']}comments
- SET subscribed = 'false'
- WHERE entry_id = $entry_id
+ $sql = "UPDATE {$serendipity['dbPrefix']}comments
+ SET subscribed = 'false'
+ WHERE entry_id = $entry_id
AND email = '$email'";
serendipity_db_query($sql);
-
+
return serendipity_db_affected_rows();
}
function serendipity_sendComment($to, $fromName, $fromEmail, $fromUrl, $id, $title, $comment, $type = 'NORMAL') {
global $serendipity;
-
+
$entryURI = serendipity_archiveURL($id, $title);
if ($type == 'TRACKBACK') {
@@ -1317,7 +1325,7 @@
if(!preg_match('@trackback:ping(\s*rdf:resource)?\s*=\s*"(http:[^"]+)"@i', $res, $matches)) {
return;
}
-
+
if (preg_match('@dc:identifier\s*=\s*"(http:[^"]+)"@i', $res, $test)) {
if ($loc != $test[1]) {
return;
@@ -1335,7 +1343,7 @@
function serendipity_reference_autodiscover($loc, $url, $author, $title, $text) {
$res = @file_get_contents($loc);
-
+
if ( strlen($res) != 0 ) {
serendipity_trackback_autodiscover($res, $loc, $url, $author, $title, $text);
serendipity_pingback_autodiscover($loc, $res);
@@ -1462,7 +1470,7 @@
if (!preg_match_all('@<a[^>]+?href\s*=\s*["\']?([^\'" >]+?)[ \'"]?>([^<]*)</a>@i', $text, $matches)) {
return;
}
-
+
// remove full matches
array_shift($matches);
@@ -1758,10 +1766,13 @@
**/
function serendipity_printEntryForm($targetURL, $hiddens = array(), $entry = array(), $errMsg = "") {
global $serendipity;
-
+
$serendipity['EditorBrowsers'] = '(IE|Mozilla)';
$cats = serendipity_fetchCategories();
+ if ($entry['isdraft'] == 'true') $draftD = " SELECTED";
+ else $draftP = " SELECTED";
+
$n = "\n";
$cat_list = '<select name="serendipity[categoryid]">' . $n;
$cat_list .= ' <option value="0">[' . NO_CATEGORY . ']</option>' . $n;
@@ -1788,24 +1799,31 @@
<form action="<?php echo $targetURL; ?>" method="post" <?php echo ($serendipity['XHTML11'] ? 'id' : 'name'); ?>="serendipityEntry" style="margin-top: 0px; margin-bottom: 0px; padding-top: 0px; padding-bottom: 0px">
<?php echo $hidden; ?>
- <table class="serendipityEntryEdit">
+ <table class="serendipityEntryEdit" border="0">
<tr>
<td align="left" <?php echo (!$serendipity['wysiwyg'] ? 'colspan="2"' : ''); ?>>
<div>
- <input type="text" name="serendipity[title]" value="<?php echo htmlentities($entry['title']); ?>" size="<?php echo ($serendipity['wysiwyg'] ? '30' : '80'); ?>" />
- <input type="submit" value="- <?php echo SAVE; ?> -" style="font-weight: bold;" />
+ <b><?php echo TITLE?>:</b> <input type="text" name="serendipity[title]" value="<?php echo htmlentities($entry['title']); ?>" size="<?php echo ($serendipity['wysiwyg'] ? '30' : '80'); ?>" />
</div>
</td>
<?php echo ($serendipity['wysiwyg'] ? '<td>' . CATEGORY . ' ' . $cat_list . '</td>' : ''); ?>
</tr>
-
+ <tr>
+ <td><b><?php echo TYPE?>:</b>
+ <select name="serendipity[isdraft]">
+ <option value="false" <?php echo $draftP?>><?php echo PUBLISH?></option>
+ <option value="true" <?php echo $draftD?>><?php echo DRAFT?></option>
+ </select>
+ </td>
+ <td align="right"><b><?php echo CATEGORY; ?></b> <?php echo $cat_list ; ?></td>
+ </tr>
+ <tr>
+ <td><b><?php echo ENTRY_BODY; ?></b></td>
+ <td align="right">
<?php
if (!$serendipity['wysiwyg']) {
?>
- <tr>
- <td><?php echo CATEGORY; ?> <?php echo $cat_list ; ?></td>
- <td align="right">
<div>
<?php
// Since the user has WYSIWYG editor disabled, we want to check if we should use the "better" non-WYSIWYG editor
@@ -1826,13 +1844,10 @@
<input type="button" value="Link" onClick="serendipity_insLink(document.forms['serendipityEntry']['serendipity[body]'])">
<?php } ?>
</div>
- </td>
- </tr>
<?php
}
?>
- <tr>
- <td colspan="2"><?php echo ENTRY_BODY; ?></td>
+ </td>
</tr>
<tr>
@@ -1842,20 +1857,18 @@
</tr>
<tr>
- <td colspan="2"><?php echo EXTENDED_BODY; ?></td>
+ <td colspan="2" align="right">
+ <input type="submit" value="- <?php echo SAVE; ?> -" style="font-weight: bold;" />
+ </td>
</tr>
<tr>
- <td colspan="2">
- <textarea name="serendipity[extended]" id="serendipity[extended]" cols="80" rows="20"><?php echo htmlentities($entry['extended']); ?></textarea>
- </td>
+ <td colspan="2"><b><?php echo EXTENDED_BODY; ?></b></td>
</tr>
<tr>
- <td colspan="2" align="right">
- <div>
- <input type="submit" value="- <?php echo SAVE; ?> -" style="font-weight: bold;" />
- </div>
+ <td colspan="2">
+ <textarea name="serendipity[extended]" id="serendipity[extended]" cols="80" rows="20"><?php echo htmlentities($entry['extended']); ?></textarea>
</td>
</tr>
</table>
@@ -1872,7 +1885,7 @@
function serendipity_authenticate_author($username, $password) {
global $serendipity;
-
+
if( $_SESSION['serendipityAuthedUser'] == true ) {
$serendipity['serendipityUser'] = $_SESSION['serendipityUser'];
$serendipity['serendipityEmail'] = $_SESSION['serendipityEmail'];
@@ -1894,7 +1907,7 @@
if (is_string($row)) {
print $row;
}
-
+
if ($row) {
$_SESSION['serendipityUser'] = $serendipity['serendipityUser'] = $username;
$_SESSION['serendipityEmail'] = $serendipity['serendipityEmail'] = $row['email'];
Index: serendipity_lang_de.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_lang_de.inc.php,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- serendipity_lang_de.inc.php 25 Aug 2003 16:43:27 -0000 1.25
+++ serendipity_lang_de.inc.php 30 Aug 2003 09:55:09 -0000 1.26
@@ -267,6 +267,9 @@
define('SYNDICATION_PLUGIN_TTL', 'Feld "ttl" (time-to-live)');
define('SYNDICATION_PLUGIN_TTL_DESC', 'Anzahl von Minuten, nachdem Ihr Blog von fremden Seiten nicht mehr gecached werden sollte (leer: nicht verwenden) [RSS 2.0]');
define('CONTENT', 'Inhalt');
+define('TYPE', 'Typ');
+define('DRAFT', 'Entwurf');
+define('PUBLISH', 'Veröffentlichung');
define('serendipity_LANG_LOADED', true);
/* vim: set sts=4 ts=4 expandtab : */
Index: serendipity_lang_en.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_lang_en.inc.php,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- serendipity_lang_en.inc.php 25 Aug 2003 16:43:27 -0000 1.35
+++ serendipity_lang_en.inc.php 30 Aug 2003 09:55:09 -0000 1.36
@@ -267,6 +267,9 @@
define('SYNDICATION_PLUGIN_TTL', 'Field "ttl" (time-to-live)');
define('SYNDICATION_PLUGIN_TTL_DESC', 'Amount of minutes after which your blog should not be cached any more by foreign sites/applications (empty: hidden) [RSS 2.0]');
define('CONTENT', 'Content');
+define('TYPE', 'Type');
+define('DRAFT', 'Draft');
+define('PUBLISH', 'Publish');
define('serendipity_LANG_LOADED', true);
/* vim: set sts=4 ts=4 expandtab : */
|