Update of /cvsroot/php-blog/serendipity
In directory sc8-pr-cvs1:/tmp/cvs-serv16735
Modified Files:
serendipity_config.inc.php serendipity_db_mysql.inc.php
serendipity_entries.php serendipity_functions.inc.php
serendipity_config_local.tpl
Log Message:
Commited patch as proposed on the mailinglist
(Part 3/5)
Index: serendipity_config.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_config.inc.php,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- serendipity_config.inc.php 7 Sep 2003 22:16:00 -0000 1.32
+++ serendipity_config.inc.php 18 Sep 2003 12:58:14 -0000 1.33
@@ -4,10 +4,10 @@
include_once('compat.php');
ini_set('session.use_trans_sid', 0);
-$serendipity['version'] = '0.3';
+$serendipity['version'] = '0.3';
$serendipity['production'] = 1;
-$serendipity['rewrite'] = true;
-$installed = file_exists($serendipity['serendipityPath'] .'serendipity_config_local.inc.php');
+$serendipity['rewrite'] = true;
+$installed = file_exists((isset($serendipity['serendipityPath']) ? $serendipity['serendipityPath'] : '') . 'serendipity_config_local.inc.php');
/* Load main language file */
@@ -46,12 +46,12 @@
);
// Load Configuration options from the database
-$rows = serendipity_db_query("SELECT name,value
+$rows = serendipity_db_query("SELECT name,value
FROM {$serendipity['dbPrefix']}config");
foreach ($rows as $row) {
/* fixme: temp. workaround */
$serendipity['CONFIG'][$row['name']] = $row['value'];
-
+
/* Convert 'true' and 'false' in to booleans */
if ( isset($translation[$row['value']]) ) {
$row['value'] = $translation[$row['value']];
@@ -72,6 +72,8 @@
$serendipity['indexFile'] = 'index.php';
}
+$serendipity['allowDateManipulation'] = TRUE;
+
// A Set of emoticons to rewrite
$serendipity['smiles'] = array( ":'(" => $serendipity['serendipityHTTPPath'] . 'pixel/cry_smile.gif',
':-)' => $serendipity['serendipityHTTPPath'] . 'pixel/regular_smile.gif',
@@ -131,22 +133,29 @@
$serendipity['POST'] = &$_POST['serendipity'];
$serendipity['COOKIE'] = &$_COOKIE['serendipity'];
+// We want our config vars cached... will save us lots of SQL queries
+$sql = "SELECT * FROM {$serendipity['dbPrefix']}config";
+$rs = serendipity_db_query($sql);
+foreach ($rs as $var) {
+ $serendipity['CONFIG'][$var['name']] = $var['value'];
+}
+
// We don't care who tells us what to do
-if (!$serendipity['GET']['action']) {
- $serendipity['GET']['action'] = $serendipity['POST']['action'];
+if (!isset($serendipity['GET']['action'])) {
+ $serendipity['GET']['action'] = (isset($serendipity['POST']['action']) ? $serendipity['POST']['action'] : '');
}
-if (!$serendipity['GET']['adminAction']) {
- $serendipity['GET']['adminAction'] = $serendipity['POST']['adminAction'];
+if (!isset($serendipity['GET']['adminAction'])) {
+ $serendipity['GET']['adminAction'] = (isset($serendipity['POST']['adminAction']) ? $serendipity['POST']['adminAction'] : '');
}
// Some stuff...
-if (!$_SESSION['serendipityAuthedUser']) {
+if (!isset($_SESSION['serendipityAuthedUser'])) {
$_SESSION['serendipityAuthedUser'] = false;
}
-$serendipity['user'] = $_SESSION['serendipityUser'];
-$serendipity['email'] = $_SESSION['serendipityEmail'];
+$serendipity['user'] = isset($_SESSION['serendipityUser']) ? $_SESSION['serendipityUser'] : '';
+$serendipity['email'] = isset($_SESSION['serendipityEmail']) ? $_SESSION['serendipityEmail'] : '';
/* Signature sent with all mails */
$serendipity['signature'] = sprintf(SIGNATURE, $serendipity['blogTitle']);
Index: serendipity_db_mysql.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_db_mysql.inc.php,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- serendipity_db_mysql.inc.php 1 Sep 2003 12:25:23 -0000 1.13
+++ serendipity_db_mysql.inc.php 18 Sep 2003 12:58:14 -0000 1.14
@@ -22,7 +22,7 @@
if (mysql_error() != '') {
return mysql_error();
}
-
+
if (!$c) {
if (!$serendipity['production']) {
print mysql_error();
@@ -38,7 +38,7 @@
}
$result_type = $type_map[$result_type];
-
+
switch(mysql_num_rows($c)) {
case 0:
if ($single) {
@@ -53,7 +53,7 @@
if ($single) {
return mysql_fetch_array($c, $result_type);
}
-
+
$rows = array();
while (($row = mysql_fetch_array($c, $result_type))) {
$rows[] = $row;
@@ -86,7 +86,7 @@
{
global $serendipity;
- if ($serendipity['dbConn']) {
+ if (isset($serendipity['dbConn'])) {
return;
}
@@ -97,7 +97,7 @@
function serendipity_db_schema_import($query)
{
- static $search = array('{AUTOINCREMENT}', '{PRIMARY}',
+ static $search = array('{AUTOINCREMENT}', '{PRIMARY}',
'{UNSIGNED}', '{FULLTEXT}');
static $replace = array('int(11) not null auto_increment', 'primary key',
'unsigned' , 'FULLTEXT');
@@ -109,21 +109,21 @@
function serendipity_db_probe($hash, &$errs)
{
global $serendipity;
-
+
if (!($c = @mysql_connect($hash['dbHost'], $hash['dbUser'], $hash['dbPass']))) {
$errs[] = 'Could not connect to database; check your settings.';
$errs[] = 'The mySQL error was: ' . mysql_error();
return false;
}
-
+
$serendipity['dbConn'] = $c;
-
+
if (!@mysql_select_db($hash['dbName'])) {
$errs[] = 'The database you specified does not exist.';
$errs[] = 'The mySQL error was: ' . mysql_error();
return false;
}
-
+
return true;
}
Index: serendipity_entries.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_entries.php,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- serendipity_entries.php 10 Aug 2003 17:56:10 -0000 1.15
+++ serendipity_entries.php 18 Sep 2003 12:58:14 -0000 1.16
@@ -40,7 +40,7 @@
<tr id="content" valign="top">
<?php
if ( !serendipity_userLoggedIn() ) {
- serendipity_printLogin();
+ serendipity_printLogin();
} else {
?>
<td class="serendipitySideBar">
@@ -54,7 +54,7 @@
</div>
<div class="serendipitySideBarItem">
- <div class="serendipitySideBarTitle"><?php echo CATEGORIES; ?></div>
+ <div class="serendipitySideBarTitle"><?php echo CATEGORIES; ?>:</div>
<div class="serendipitySideBarContent">
• <a href="?serendipity[adminModule]=category&serendipity[adminAction]=editSelect"><?php echo EDIT_CATEGORIES; ?></a><br />
</div>
@@ -73,7 +73,7 @@
• <a href="<?php echo $serendipity['serendipityHTTPPath']; ?>serendipity_admin.php"><?php echo ADMIN_INTERFACE; ?></a><br />
• <a href="<?php echo $serendipity['serendipityHTTPPath']; ?>" ><?php echo BACK_TO_BLOG; ?></a><br />
• <a href="?serendipity[adminModule]=logout" ><?php echo LOGOUT; ?></a><br />
-
+
<img src="<?php echo $serendipity['baseURL']; ?>templates/default/img/leer.png" height="1" width="130" alt="" />
</div>
</td>
@@ -81,8 +81,8 @@
<td class="serendipity_admin">
<div class="serendipity_admin_title"><?php echo SERENDIPITY_AUTHORING_SUITE; ?></div>
<?php
- if (!$serendipity['GET']['adminModule']) {
- $serendipity['GET']['adminModule'] = $serendipity['POST']['adminModule'];
+ if (!isset($serendipity['GET']['adminModule'])) {
+ $serendipity['GET']['adminModule'] = (isset($serendipity['POST']['adminModule']) ? $serendipity['POST']['adminModule'] : '');
}
switch($serendipity['GET']['adminModule']) {
Index: serendipity_functions.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_functions.inc.php,v
retrieving revision 1.151
retrieving revision 1.152
diff -u -d -r1.151 -r1.152
--- serendipity_functions.inc.php 12 Sep 2003 21:26:07 -0000 1.151
+++ serendipity_functions.inc.php 18 Sep 2003 12:58:14 -0000 1.152
@@ -7,7 +7,7 @@
function serendipity_userLoggedIn() {
global $serendipity;
- if (serendipity_authenticate_author($serendipity['POST']['user'], $serendipity['POST']['pass'])) {
+ if (serendipity_authenticate_author((isset($serendipity['POST']['user']) ? $serendipity['POST']['user'] : ''), (isset($serendipity['POST']['pass']) ? $serendipity['POST']['pass'] : ''))) {
$_SESSION['serendipityAuthedUser'] = true;
return true;
}
@@ -265,7 +265,20 @@
}
// Find out about diary entries
- $querystring = "SELECT timestamp from {$serendipity['dbPrefix']}entries WHERE timestamp >= $ts and timestamp <= $endts";
+ $querystring = "SELECT timestamp from {$serendipity['dbPrefix']}entries WHERE timestamp >= $ts and timestamp <= $endts AND isdraft = 'false'";
+ $add_query = '';
+ $base_query = '';
+ if (isset($serendipity['GET']['category'])) {
+ $_categoryid = explode('_', $serendipity['GET']['category']);
+ $categoryid = serendipity_db_escape_string($_categoryid[0]);
+
+ if (is_numeric($categoryid)) {
+ $querystring .= " AND categoryid = $categoryid";
+ $base_query = 'serendipity[category]=' . $categoryid;
+ $add_query = '&' . $base_query;
+ }
+ }
+
$rows = serendipity_db_query($querystring);
$activeDays = array();
if (is_array($rows)) {
@@ -276,7 +289,7 @@
// Prepare the table
if ($serendipity['rewrite'] == true) {
- $link = $serendipity['serendipityHTTPPath'] . 'archives/' . $year . sprintf('%02d', $month) . '.html';
+ $link = $serendipity['serendipityHTTPPath'] . 'archives/' . $year . sprintf('%02d', $month) . '.html?' . $base_query;
} else {
$link = 'fixme';
}
@@ -288,7 +301,7 @@
// Only allow to scroll to the previous month if the first entry is from the month before
if ($ts > ($minmax[0]['min'] - 2678400)) {
?>
- <a title="<?php echo BACK; ?>" href="<?php echo $serendipity['serendipityHTTPPath'] . $serendipity['indexFile']; ?>?serendipity[calendarZoom]=<?php echo $previousYear . sprintf('%02d',$previousMonth); ?>"><img alt="<?php echo BACK; ?>" src="<?php echo serendipity_getTemplateFile('img/back.png'); ?>" border="0" /></a>
+ <a title="<?php echo BACK; ?>" href="<?php echo $serendipity['serendipityHTTPPath'] . $serendipity['indexFile']; ?>?serendipity[calendarZoom]=<?php echo $previousYear . sprintf('%02d',$previousMonth) . $add_query; ?>"><img alt="<?php echo BACK; ?>" src="<?php echo serendipity_getTemplateFile('img/back.png'); ?>" border="0" /></a>
<?php
}
?>
@@ -303,7 +316,7 @@
// Only allow to scroll to the next month if the last entry is from the month before
if ($endts < ($minmax[0]['max'] + 2678400)) {
?>
- <a title="<?php echo FORWARD; ?>" href="<?php echo $serendipity['serendipityHTTPPath'] . $serendipity['indexFile']; ?>?serendipity[calendarZoom]=<?php echo $nextYear . sprintf('%02d', $nextMonth); ?>"><img alt="<?php echo FORWARD; ?>" src="<?php echo serendipity_getTemplateFile('img/forward.png'); ?>" border="0" /></a>
+ <a title="<?php echo FORWARD; ?>" href="<?php echo $serendipity['serendipityHTTPPath'] . $serendipity['indexFile']; ?>?serendipity[calendarZoom]=<?php echo $nextYear . sprintf('%02d', $nextMonth) . $add_query; ?>"><img alt="<?php echo FORWARD; ?>" src="<?php echo serendipity_getTemplateFile('img/forward.png'); ?>" border="0" /></a>
<?php
}
?>
@@ -349,13 +362,13 @@
if ( ($x > 0 || $y >= $firstDayWeekDay)
&& $currDay <= $nrOfDays) {
- if ($activeDays[$currDay] > 1) {
+ if (isset($activeDays[$currDay]) && $activeDays[$currDay] > 1) {
$cellProp .= 'Active';
}
// Print day
if ($serendipity['rewrite'] == true) {
- $link = $serendipity['serendipityHTTPPath'] . 'archives/' . date('Ymd', mktime(0,0,0, $month, $currDay, $year)) . '.html';
+ $link = $serendipity['serendipityHTTPPath'] . 'archives/' . date('Ymd', mktime(0,0,0, $month, $currDay, $year)) . '.html?' . $base_query;
} else {
$link = 'fixme!';
}
@@ -370,7 +383,7 @@
$att_end = '';
}
- if ($activeDays[$currDay] > 1) {
+ if (isset($activeDays[$currDay]) && $activeDays[$currDay] > 1) {
$lnk_start = '<a href="' . $link . '">'; //?month=".sprintf("%02d",$month)."&year=$year'>");
$lnk_end = '</a>';
} else {
@@ -440,8 +453,25 @@
}
}
+ if (isset($serendipity['GET']['category'])) {
+ $_categoryid = explode('_', $serendipity['GET']['category']);
+ $categoryid = serendipity_db_escape_string($_categoryid[0]);
+
+ if (is_numeric($categoryid)) {
+ if ($and != '') {
+ $and .= " AND e.categoryid = $categoryid";
+ } else {
+ $and = "WHERE e.categoryid = $categoryid";
+ }
+ }
+ }
+
if (!empty($limit)) {
- if ( strtolower($serendipity['dbType']) == 'postgres' ) {
+ if (isset($serendipity['GET']['page']) && $serendipity['GET']['page'] > 1 && !strstr($limit, ',')) {
+ $limit = (($serendipity['GET']['page']-1)*$limit) . ',' . $limit;
+ }
+
+ if (strtolower($serendipity['dbType']) == 'postgres') {
$limit = 'LIMIT ' . join (' OFFSET ', split(',', $limit));
} else {
$limit = 'LIMIT '. $limit;
@@ -481,9 +511,14 @@
$body = ', body, extended';
}
$querystring = "SELECT
- *
+ *,
+ c.category_name,
+ a.username,
+ a.email
FROM
- {$serendipity['dbPrefix']}entries e,
+ {$serendipity['dbPrefix']}entries e
+ LEFT JOIN {$serendipity['dbPrefix']}category c
+ ON e.categoryid = c.categoryid,
{$serendipity['dbPrefix']}authors a
WHERE
a.authorid = e.authorid
@@ -499,11 +534,17 @@
function serendipity_fetchCategories($authorid = null) {
global $serendipity;
- if ($authorid === null) {
- $authorid = $serendipity['authorid'];
+ if (!isset($authorid) || $authorid === null) {
+ $authorid = (isset($serendipity['authorid']) ? $serendipity['authorid'] : 1);
}
- $querystring = "SELECT * FROM {$serendipity['dbPrefix']}category WHERE authorid = $authorid ORDER BY category_name";
+ if ($authorid != 'all') {
+ $where = "WHERE authorid = $authorid";
+ } else {
+ $where = '';
+ }
+
+ $querystring = "SELECT * FROM {$serendipity['dbPrefix']}category $where ORDER BY category_name";
return serendipity_db_query($querystring);
}
@@ -516,18 +557,27 @@
global $serendipity;
$querystring = "SELECT
- id,
- author,
- timestamp,
- comments,
- title,
- body,
- extended,
- trackbacks
+ e.id,
+ e.author,
+ a.username,
+ a.email,
+ e.categoryid,
+ c.category_name,
+ e.timestamp,
+ e.comments,
+ e.title,
+ e.body,
+ e.extended,
+ e.trackbacks,
+ e.exflag
FROM
- {$serendipity['dbPrefix']}entries
+ {$serendipity['dbPrefix']}entries e
+ LEFT JOIN {$serendipity['dbPrefix']}category c
+ ON e.categoryid = c.categoryid,
+ {$serendipity['dbPrefix']}authors a
WHERE
- MATCH (title,body,extended) AGAINST ('".addslashes($term)."')
+ a.authorid = e.authorid
+ AND MATCH (title,body,extended) AGAINST ('".addslashes($term)."')
ORDER BY
timestamp DESC";
@@ -549,6 +599,67 @@
return preg_replace('#[^\w]#', '', $str);
}
+/** Print a footer below the list of entries
+ *
+ **/
+function serendipity_printEntryFooter() {
+global $serendipity;
+
+ // build the query string with variables we want to carry from each page to page
+ $add_query = '';
+ if (is_array($serendipity['GET'])) {
+ $page_get_array = $serendipity['GET'];
+ unset($page_get_array['page']);
+ unset($page_get_array['range']);
+ unset($page_get_array['action']);
+ unset($page_get_array['adminAction']);
+
+ foreach($page_get_array AS $skey => $sval) {
+ $add_query .= '&serendipity[' . urlencode($skey) . ']=' . urlencode($sval);
+ }
+ }
+
+ $querystring = "SELECT count(id) FROM {$serendipity['dbPrefix']}entries WHERE isdraft = 'false'";
+ if (isset($serendipity['GET']['category'])) {
+ $_categoryid = explode('_', $serendipity['GET']['category']);
+ $categoryid = serendipity_db_escape_string($_categoryid[0]);
+
+ if (is_numeric($categoryid)) {
+ $querystring .= " AND categoryid = $categoryid";
+ }
+ }
+
+ $query = serendipity_db_query($querystring);
+ $totalEntries = $query[0][0];
+ $totalPages = ceil($totalEntries / 15);
+
+ if (!isset($serendipity['GET']['page'])) {
+ $serendipity['GET']['page'] = 1;
+ }
+?>
+<div class='serendipity_entryFooter' style="text-align: center">
+<br />
+
+(<?php printf(PAGE_BROWSE, $serendipity['GET']['page'], $totalPages, $totalEntries); ?>)<br />
+
+<?php
+ if ($serendipity['GET']['page'] > 1) {
+?>
+<a href="<?php echo $serendipity['baseURL'] . $serendipity['indexFile'] . '?serendipity[page]=' . ($serendipity['GET']['page'] - 1) . $add_query; ?>">« <?php echo PREVIOUS_PAGE; ?></a> |
+<?php
+ }
+?>
+<?php
+ if ($serendipity['GET']['page'] < $totalPages) {
+?>
+<a href="<?php echo $serendipity['baseURL'] . $serendipity['indexFile'] . '?serendipity[page]=' . ($serendipity['GET']['page'] + 1) . $add_query; ?>"><?php echo NEXT_PAGE; ?> »</a>
+<?php
+ }
+?>
+</div>
+<?php
+}
+
/**
* Prints the entries you fetched with serendipity_fetchEntries/searchEntries in HTML.
**/
@@ -568,7 +679,7 @@
$bydate[$d][] = $entries[$x];
}
- if (!$serendipity['GET']['short']) {
+ if (!isset($serendipity['GET']['short']) || !$serendipity['GET']['short']) {
foreach ($bydate as $date => $ents) {
?>
@@ -653,6 +764,12 @@
</div>
<?php
} // end for-loop (dates)
+
+ if (!isset($serendipity['GET']['id']) &&
+ (!isset($serendipity['GET']['hidefooter']) || $serendipity['GET']['hidefooter'] == false) &&
+ count($entries) <= 15) {
+ serendipity_printEntryFooter();
+ }
} else { // else short mode
$s = &$serendipity['GET']['range'];
?>
@@ -979,7 +1096,7 @@
if ($version == '0.91' || $version == '2.0' && is_array($entries)) {
foreach ($entries as $entry) {
- $guid = serendipity_archiveURL(($entry['entryid'] != '' ? $entry['entryid'] : $entry['id']), $entry['title']);
+ $guid = serendipity_archiveURL((isset($entry['entryid']) && $entry['entryid'] != '' ? $entry['entryid'] : $entry['id']), $entry['title']);
if ($comments == true) {
// Display username as part of the title for easier feed-readability
$entry['title'] = $entry['username'] . ': ' . $entry['title'];
@@ -1186,7 +1303,7 @@
*/
function serendipity_encodeExitsCallback($buffer) {
global $serendipity;
-
+
$entry_id = $serendipity['encodeExitsCallback_entry_id'];
$url = 'http://' . $buffer[3];
@@ -1223,7 +1340,7 @@
// If pregenerate is not set, short circuit all this logic
// and remove nothing.
- if(!$serendipity['pregenerate']) {
+ if(!isset($serendipity['pregenerate'])) {
return;
}
@@ -1562,7 +1679,7 @@
$res = serendipity_db_update('entries', array('id' => $entry['id']), $entry);
$newEntry = 0;
}
-
+
if (is_string($res)) {
return $res;
}
@@ -1772,11 +1889,14 @@
**/
function serendipity_printEntryForm($targetURL, $hiddens = array(), $entry = array(), $errMsg = "") {
global $serendipity;
-
+
$serendipity['EditorBrowsers'] = '(IE|Mozilla)';
$cats = serendipity_fetchCategories();
- if ($entry['isdraft'] == 'true') {
+ $draftD = '';
+ $draftP = '';
+
+ if (isset($entry['isdraft']) && $entry['isdraft'] == 'true') {
$draftD = ' SELECTED';
} else {
$draftP = ' SELECTED';
@@ -1787,7 +1907,7 @@
$cat_list .= ' <option value="0">[' . NO_CATEGORY . ']</option>' . $n;
if (is_array($cats)) {
foreach ($cats as $cat_data) {
- $selected = $cat_data['categoryid'] == $entry['categoryid'] ? ' selected="selected"' : '';
+ $selected = (isset($entry['categoryid']) && $cat_data['categoryid'] == $entry['categoryid'] ? ' selected="selected"' : '');
$cat_list .= ' <option value="' . $cat_data['categoryid'] . '" ' . $selected . '>'
. htmlentities($cat_data['category_name'])
. ' - '
@@ -1801,8 +1921,8 @@
foreach($hiddens as $key => $value) {
$hidden .= ' <input type="hidden" name="' . $key . '" value="' . $value . '" />' . $n;
}
- $hidden .= ' <input type="hidden" name="serendipity[id]" value="' . $entry['id'] . '" />' . $n;
- $hidden .= ' <input type="hidden" name="serendipity[timestamp]" value="' . $entry['timestamp'] . '" />' . $n;
+ $hidden .= ' <input type="hidden" name="serendipity[id]" value="' . (isset($entry['id']) ? $entry['id'] : '') . '" />' . $n;
+ $hidden .= ' <input type="hidden" name="serendipity[timestamp]" value="' . (isset($entry['timestamp']) ? $entry['timestamp'] : '') . '" />' . $n;
$hidden .= ' <input type="hidden" name="serendipity[preview]" value="false" />';
?>
<span style="color: #FF0000;"><?php echo $errMsg; ?></span>
@@ -1813,7 +1933,7 @@
<tr>
<td align="left" <?php echo (!$serendipity['wysiwyg'] ? 'colspan="2"' : ''); ?>>
<div>
- <b><?php echo TITLE?>:</b> <input type="text" name="serendipity[title]" value="<?php echo htmlentities($entry['title']); ?>" size="<?php echo ($serendipity['wysiwyg'] ? '30' : '80'); ?>" />
+ <b><?php echo TITLE?>:</b> <input type="text" name="serendipity[title]" value="<?php echo isset($entry['title']) ? htmlentities($entry['title']) : ''; ?>" size="<?php echo ($serendipity['wysiwyg'] ? '30' : '80'); ?>" />
</div>
</td>
@@ -1825,6 +1945,15 @@
<option value="false" <?php echo $draftP; ?>><?php echo PUBLISH; ?></option>
<option value="true" <?php echo $draftD; ?>><?php echo DRAFT; ?></option>
</select>
+ <?php
+ if (isset($serendipity['allowDateManipulation']) && $serendipity['allowDateManipulation']) {
+ ?>
+ <b><?php echo DATE; ?>:</b>
+ <input type="hidden" name="serendipity[chk_timestamp]" value="<?php echo (isset($entry['timestamp']) && $entry['timestamp'] > 0 ? $entry['timestamp'] : time()); ?>" />
+ <input type="text" name="serendipity[new_timestamp]" value="<?php echo date(DATE_FORMAT_2, (isset($entry['timestamp']) && $entry['timestamp'] > 0 ? $entry['timestamp'] : time())); ?>" />
+ <?php
+ }
+ ?>
</td>
<td align="right"><b><?php echo CATEGORY; ?></b> <?php echo $cat_list ; ?></td>
</tr>
@@ -1862,7 +1991,7 @@
<tr>
<td colspan="2">
- <textarea name="serendipity[body]" id="serendipity[body]" cols="80" rows="20"><?php echo htmlentities($entry['body']); ?></textarea>
+ <textarea name="serendipity[body]" id="serendipity[body]" cols="80" rows="20"><?php echo isset($entry['body']) ? htmlentities($entry['body']) : ''; ?></textarea>
</td>
</tr>
@@ -1879,7 +2008,7 @@
<tr>
<td colspan="2">
- <textarea name="serendipity[extended]" id="serendipity[extended]" cols="80" rows="20"><?php echo htmlentities($entry['extended']); ?></textarea>
+ <textarea name="serendipity[extended]" id="serendipity[extended]" cols="80" rows="20"><?php echo isset($entry['extended']) ? htmlentities($entry['extended']) : ''; ?></textarea>
</td>
</tr>
</table>
@@ -1897,7 +2026,7 @@
function serendipity_authenticate_author($username, $password) {
global $serendipity;
- if( $_SESSION['serendipityAuthedUser'] == true ) {
+ if (isset($_SESSION['serendipityUser']) && isset($_SESSION['serendipityEmail']) && isset($_SESSION['serendipityAuthorid']) && isset($_SESSION['serendipityAuthedUser']) && $_SESSION['serendipityAuthedUser'] == true) {
$serendipity['serendipityUser'] = $_SESSION['serendipityUser'];
$serendipity['serendipityEmail'] = $_SESSION['serendipityEmail'];
$serendipity['authorid'] = $_SESSION['serendipityAuthorid'];
@@ -1932,65 +2061,67 @@
function serendipity_track_referrer($entry = 0) {
global $serendipity;
- if (stristr($_SERVER['HTTP_REFERER'], $serendipity['baseURL']) !== false) {
- return;
- }
-
- if (!is_array($serendipity['_blockReferer'])) {
- // Only generate an array once per call
- $serendipity['_blockReferer'] = array();
- $serendipity['_blockReferer'] = @explode(';', $serendipity['blockReferer']);
- }
+ if (isset($_SERVER['HTTP_REFERER'])) {
+ if (stristr($_SERVER['HTTP_REFERER'], $serendipity['baseURL']) !== false) {
+ return;
+ }
- $url_parts = parse_url($_SERVER['HTTP_REFERER']);
- $host_parts = explode('.', $url_parts['host']);
- if (!$url_parts['host'] ||
- strstr($url_parts['host'], $_SERVER['SERVER_NAME'])) {
- return;
- }
+ if (!isset($serendipity['_blockReferer']) || !is_array($serendipity['_blockReferer'])) {
+ // Only generate an array once per call
+ $serendipity['_blockReferer'] = array();
+ $serendipity['_blockReferer'] = @explode(';', $serendipity['blockReferer']);
+ }
- foreach($serendipity['_blockReferer'] AS $idx => $hostname) {
- if (@strstr($url_parts['host'], $hostname)) {
+ $url_parts = parse_url($_SERVER['HTTP_REFERER']);
+ $host_parts = explode('.', $url_parts['host']);
+ if (!$url_parts['host'] ||
+ strstr($url_parts['host'], $_SERVER['SERVER_NAME'])) {
return;
}
- }
- if (rand(0, 100) < 1) {
- serendipity_track_referrer_gc();
- }
+ foreach($serendipity['_blockReferer'] AS $idx => $hostname) {
+ if (@strstr($url_parts['host'], $hostname)) {
+ return;
+ }
+ }
- $suppressq = "SELECT count(1)
- FROM $serendipity[dbPrefix]suppress
- WHERE ip = '$_SERVER[REMOTE_ADDR]'
- AND scheme = '$url_parts[scheme]'
- AND port = '$url_parts[port]'
- AND host = '$url_parts[host]'
- AND path = '$url_parts[path]'
- AND query = '$url_parts[query]'
- AND last > now() - 900";
+ if (rand(0, 100) < 1) {
+ serendipity_track_referrer_gc();
+ }
- $suppressp = "DELETE FROM $serendipity[dbPrefix]suppress
- WHERE ip = '$_SERVER[REMOTE_ADDR]'
- AND scheme = '$url_parts[scheme]'
- AND host = '$url_parts[host]'
- AND port = '$url_parts[port]'
- AND query = '$url_parts[query]'
- AND path = '$url_parts[path]'";
- $suppressu = "INSERT INTO $serendipity[dbPrefix]suppress
- (ip, last, scheme, host, port, path, query)
- VALUES ('$_SERVER[REMOTE_ADDR]', now(), '$url_parts[scheme]', '$url_parts[host]', '$url_parts[port]', '$url_parts[path]', '$url_parts[query]')";
+ $suppressq = "SELECT count(1)
+ FROM $serendipity[dbPrefix]suppress
+ WHERE ip = '$_SERVER[REMOTE_ADDR]'
+ AND scheme = '$url_parts[scheme]'
+ AND port = '$url_parts[port]'
+ AND host = '$url_parts[host]'
+ AND path = '$url_parts[path]'
+ AND query = '$url_parts[query]'
+ AND last > now() - 900";
- $count = serendipity_db_query($suppressq, true);
+ $suppressp = "DELETE FROM $serendipity[dbPrefix]suppress
+ WHERE ip = '$_SERVER[REMOTE_ADDR]'
+ AND scheme = '$url_parts[scheme]'
+ AND host = '$url_parts[host]'
+ AND port = '$url_parts[port]'
+ AND query = '$url_parts[query]'
+ AND path = '$url_parts[path]'";
+ $suppressu = "INSERT INTO $serendipity[dbPrefix]suppress
+ (ip, last, scheme, host, port, path, query)
+ VALUES ('$_SERVER[REMOTE_ADDR]', now(), '$url_parts[scheme]', '$url_parts[host]', '$url_parts[port]', '$url_parts[path]', '$url_parts[query]')";
- if ($count[0] > 0) {
- serendipity_db_query($suppressu);
- return;
- }
+ $count = serendipity_db_query($suppressq, true);
- serendipity_db_query($suppressp);
- serendipity_db_query($suppressu);
+ if ($count[0] > 0) {
+ serendipity_db_query($suppressu);
+ return;
+ }
- serendipity_track_url('referrers', $_SERVER['HTTP_REFERER'], $entry);
+ serendipity_db_query($suppressp);
+ serendipity_db_query($suppressu);
+
+ serendipity_track_url('referrers', $_SERVER['HTTP_REFERER'], $entry);
+ }
}
function serendipity_track_referrer_gc() {
@@ -2183,7 +2314,7 @@
</tr>
<?php
for($y=1; $y<13; $y++) {
- if ($months[$y]) {
+ if (isset($months[$y]) && $months[$y]) {
?>
<tr>
<td>
Index: serendipity_config_local.tpl
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_config_local.tpl,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- serendipity_config_local.tpl 20 Aug 2003 15:59:06 -0000 1.16
+++ serendipity_config_local.tpl 18 Sep 2003 12:58:14 -0000 1.17
@@ -25,7 +25,7 @@
$serendipity['pass'] = '{Admin password|pass|protected|john}'; // Password for admin login
$serendipity['email'] = '{Admin email|email|string|jo...@ex...}'; // Email for admin login
$serendipity['want_mail'] = '{Send mails to admin?|want_mail|bool|1}'; // Do you want to receive emails when comments are posted to your entries?
-$serendipity['allowSubscriptions'] = '{Allow users to subscribe to entries?|allowSubscriptions|bool|1} // Allow users to subscribe to an entry and thereby receive a mail when new comments are made to that entry
+$serendipity['allowSubscriptions'] = '{Allow users to subscribe to entries?|allowSubscriptions|bool|1}' // Allow users to subscribe to an entry and thereby receive a mail when new comments are made to that entry
$serendipity['blogTitle'] = '{Blog name|blogTitle|string|John Doe's personal blog}'; // The title of your blog
$serendipity['blogDescription'] = '{Blog description|blogDescription|string|Welcome to my blog...}'; // Description of your blog
|