Update of /cvsroot/php-blog/serendipity
In directory sc8-pr-cvs1:/tmp/cvs-serv1579
Modified Files:
NEWS db.sql serendipity_admin_entries.inc.php
serendipity_functions.inc.php serendipity_lang_de.inc.php
Log Message:
* Preview for extended entry
* German language fix
* Fixed db.sql to be up-to date.
* Code style
Please, guys - try to stick to our coding guidelines:
- Spaces instead of TABs,
- Single quotes, where possible
- Spacing inside variables/concatenations
and please document any changes to the DB scheme at least in db.sql and in
your changelog message.
BTW: I like the Preview-functionality, works great. :)
Index: NEWS
===================================================================
RCS file: /cvsroot/php-blog/serendipity/NEWS,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- NEWS 30 Aug 2003 15:03:43 -0000 1.18
+++ NEWS 31 Aug 2003 21:41:49 -0000 1.19
@@ -2,6 +2,9 @@
Version 0.3 ()
------------------------------------
+ * Preview now also prints extended body. (garvinhicking)
+ * Added "preview entry" functionality (jhermanns)
+ * Added ability to save draft entries (jhermanns)
* Fixed some links not being formatted for exit-tracking, if the link appeared more than once in an entry (tomsommer)
* Added radio-button and "spacer" configuration directives for the plugins (garvinhicking)
* RSS-feeds and fields can now be customized within the plugin configuration (garvinhicking
Index: db.sql
===================================================================
RCS file: /cvsroot/php-blog/serendipity/db.sql,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- db.sql 16 Aug 2003 11:05:48 -0000 1.21
+++ db.sql 31 Aug 2003 21:41:49 -0000 1.22
@@ -46,7 +46,8 @@
exflag int(1) default null,
author varchar(20) default null,
authorid int(11) default null,
- categoryid int(11) default null
+ categoryid int(11) default null,
+ isdraft enum('true', 'false') not null default 'false'
);
CREATE {FULLTEXT} INDEX entry on {PREFIX}entries (title,body,extended);
Index: serendipity_admin_entries.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_admin_entries.inc.php,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- serendipity_admin_entries.inc.php 31 Aug 2003 17:20:57 -0000 1.10
+++ serendipity_admin_entries.inc.php 31 Aug 2003 21:41:49 -0000 1.11
@@ -32,7 +32,7 @@
$serendipity['GET']['offset'],
$perPage
),
- 'true'
+ 'true'
);
$string_action = ($action == 'delete' ? DELETE_ENTRIES : EDIT_ENTRIES);
@@ -78,7 +78,7 @@
<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.":"?>
+ <?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>
@@ -90,7 +90,7 @@
?>
<?php echo date('d.m.y, H:i', $entries[$x + $half]['timestamp']) . ': '; ?>
<br />
- <?php if ($entries[$x+$half]['isdraft']=='true') echo DRAFT.":"?>
+ <?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>
@@ -145,29 +145,29 @@
} else {
echo ENTRY_SAVED;
}
- }
-
- // Only display the preview
- else {
- if (!is_numeric($entry['timestamp'])) $entry['timestamp'] = time();
- if (!$entry['trackbacks']) $entry['trackbacks'] = 0;
- if (!$entry['comments']) $entry['comments'] = 0;
- if (!$entry['username']) $entry['username'] = $serendipity['serendipityUser'];
+ } else {
+ // Only display the preview
+ if (!is_numeric($entry['timestamp'])) $entry['timestamp'] = time();
+ if (!$entry['trackbacks']) $entry['trackbacks'] = 0;
+ if (!$entry['comments']) $entry['comments'] = 0;
+ if (!$entry['username']) $entry['username'] = $serendipity['serendipityUser'];
- echo "<strong>". PREVIEW ."</strong>";
+ echo '<strong>' . PREVIEW . '</strong>';
echo '<div style="border:1px solid #000000; padding: 15px;">';
- serendipity_printEntries(array($entry));
+ serendipity_printEntries(array($entry), ($entry['extended'] != '' ? 1 : 0));
echo '</div>';
+
serendipity_printEntryForm(
'?',
array(
- 'serendipity[action]' => 'admin',
- 'serendipity[adminModule]' => 'entries',
- 'serendipity[adminAction]' => 'save',
- 'serendipity[timestamp]' => $entry['timestamp']
+ 'serendipity[action]' => 'admin',
+ 'serendipity[adminModule]' => 'entries',
+ 'serendipity[adminAction]' => 'save',
+ 'serendipity[timestamp]' => $entry['timestamp']
),
- $entry
- );
+
+ $entry
+ );
}
break;
Index: serendipity_functions.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_functions.inc.php,v
retrieving revision 1.146
retrieving revision 1.147
diff -u -d -r1.146 -r1.147
--- serendipity_functions.inc.php 30 Aug 2003 17:30:32 -0000 1.146
+++ serendipity_functions.inc.php 31 Aug 2003 21:41:49 -0000 1.147
@@ -403,36 +403,41 @@
* 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 = "", $fetchDrafts = 'false') {
+function serendipity_fetchEntries($range = null, $full = true, $limit = '', $fetchDrafts = 'false') {
global $serendipity;
- if ($full === true)
+ if ($full === true) {
$body = ',body, extended';
+ }
- if ($fetchDrafts == 'false')
- $drafts = "isdraft LIKE 'false'";
+ if ($fetchDrafts == 'false') {
+ $drafts = 'isdraft LIKE "false"';
+ }
- if ( is_numeric($range)) {
+ if (is_numeric($range)) {
$year = (int)substr($range, 0, 4);
$month = (int)substr($range, 4, 2);
$day = (int)substr($range, 6, 2);
$startts = mktime(0, 0, 0, $month, ($day == 0 ? 1 : $day), $year);
- if ( $day == 0 ) {
+
+ if ($day == 0) {
$month++;
} else {
$day++;
}
+
$endts = mktime(0, 0, 0, $month, ($day == 0 ? 1 : $day), $year);
$and = " WHERE timestamp >= $startts AND timestamp <= $endts";
- if ($drafts)
- $and .= "AND $drafts";
-
+ if ($drafts) {
+ $and .= "AND $drafts";
+ }
} else {
$and = "";
- if ($drafts)
- $and .= "WHERE $drafts";
+ if ($drafts) {
+ $and .= "WHERE $drafts";
+ }
}
if (!empty($limit)) {
@@ -518,7 +523,7 @@
title,
body,
extended,
- trackbacks
+ trackbacks
FROM
{$serendipity['dbPrefix']}entries
WHERE
@@ -547,7 +552,7 @@
/**
* Prints the entries you fetched with serendipity_fetchEntries/searchEntries in HTML.
**/
-function serendipity_printEntries($entries, $extended=0) {
+function serendipity_printEntries($entries, $extended = 0) {
global $serendipity;
/* pre-walk the array to collect them keyed by date */
@@ -1673,7 +1678,7 @@
}
$in = $loadfn($infilename);
- if ( is_null($newheight) ) {
+ if (is_null($newheight)) {
$newheight = (imagesy($in) / imagesx($in)) * $newwidth;
}
$out = imagecreatetruecolor($newwidth, $newheight);
@@ -1682,7 +1687,7 @@
$out = null;
$in = null;
- return "OK!";
+ return 'OK!';
}
/**
@@ -1774,8 +1779,11 @@
$serendipity['EditorBrowsers'] = '(IE|Mozilla)';
$cats = serendipity_fetchCategories();
- if ($entry['isdraft'] == 'true') $draftD = " SELECTED";
- else $draftP = " SELECTED";
+ if ($entry['isdraft'] == 'true') {
+ $draftD = ' SELECTED';
+ } else {
+ $draftP = ' SELECTED';
+ }
$n = "\n";
$cat_list = '<select name="serendipity[categoryid]">' . $n;
@@ -1815,10 +1823,10 @@
<?php echo ($serendipity['wysiwyg'] ? '<td>' . CATEGORY . ' ' . $cat_list . '</td>' : ''); ?>
</tr>
<tr>
- <td><b><?php echo TYPE?>:</b>
+ <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>
+ <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>
@@ -1863,7 +1871,7 @@
<tr>
<td colspan="2" align="right">
- <input type="button" value="- <?php echo PREVIEW?> -" style="font-weight: bold;" onClick="document.forms['serendipityEntry'].elements['serendipity[preview]'].value='true'; document.forms['serendipityEntry'].submit();"/>
+ <input type="button" value="- <?php echo PREVIEW; ?> -" style="font-weight: bold;" onClick="document.forms['serendipityEntry'].elements['serendipity[preview]'].value='true'; document.forms['serendipityEntry'].submit();"/>
<input type="submit" value="- <?php echo SAVE; ?> -" style="font-weight: bold;" />
</td>
</tr>
Index: serendipity_lang_de.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_lang_de.inc.php,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- serendipity_lang_de.inc.php 30 Aug 2003 16:57:55 -0000 1.27
+++ serendipity_lang_de.inc.php 31 Aug 2003 21:41:49 -0000 1.28
@@ -92,7 +92,7 @@
define('A_NEW_COMMENT_BLAHBLAH', 'In Ihrem Blog %s wurde ein neuer Kommentar zu Eintrag #%s eingetragen!');
define('NO_CATEGORY', 'Keine Kategorie');
define('ENTRY_BODY', 'Eintrag');
-define('EXTENDED_BODY', 'Erweiteter Eintrag');
+define('EXTENDED_BODY', 'Erweiterter Eintrag');
define('CATEGORY', 'Kategorie:');
define('TEMPLATE_NAME', 'Template Name');
define('CHOOSE_STYLESHEET', 'Bitte ein Stylesheet wählen...');
|