[geeklog-cvs] geeklog: Initialize comment expiry time to avoid an SQL error wh...
geeklog-cvs at lists.geeklog.net
geeklog-cvs at lists.geeklog.net
Wed Jul 29 15:01:49 EDT 2009
details: http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/0308e8b20873
changeset: 7199:0308e8b20873
user: Dirk Haun <dirk at haun-online.de>
date: Wed Jul 29 20:36:02 2009 +0200
description:
Initialize comment expiry time to avoid an SQL error when story submission queue is disabled (reported by Dieter Thomas)
diffstat:
system/classes/story.class.php | 40 +++++++++++++++++++++++++++++++---------
1 files changed, 31 insertions(+), 9 deletions(-)
diffs (101 lines):
diff -r c2b3f7805eff -r 0308e8b20873 system/classes/story.class.php
--- a/system/classes/story.class.php Mon Jul 27 21:39:26 2009 +0200
+++ b/system/classes/story.class.php Wed Jul 29 20:36:02 2009 +0200
@@ -449,7 +449,11 @@
$this->_show_topic_icon = 1;
}
- $this->_uid = $_USER['uid'];
+ if (COM_isAnonUser()) {
+ $this->_uid = 1;
+ } else {
+ $this->_uid = $_USER['uid'];
+ }
$this->_date = time();
$this->_expire = time();
$this->_commentcode = $_CONF['comment_code'];
@@ -479,7 +483,11 @@
$this->_statuscode = 0;
$this->_featured = 0;
- $this->_owner_id = $_USER['uid'];
+ if (COM_isAnonUser()) {
+ $this->_owner_id = 1;
+ } else {
+ $this->_owner_id = $_USER['uid'];
+ }
if (isset($_GROUPS['Story Admin'])) {
$this->_group_id = $_GROUPS['Story Admin'];
@@ -792,10 +800,10 @@
{
global $_USER, $_CONF, $_TABLES;
- if (isset($_USER['uid']) && ($_USER['uid'] > 1)) {
+ if (COM_isAnonUser()) {
+ $this->_uid = 1;
+ } else {
$this->_uid = $_USER['uid'];
- } else {
- $this->_uid = 1;
}
$this->_postmode = $_CONF['postmode'];
@@ -845,6 +853,9 @@
$this->_postmode = COM_applyFilter($array['postmode']);
$this->_sid = COM_applyFilter($array['sid']);
$this->_uid = COM_applyFilter($array['uid'], true);
+ if ($this->_uid < 1) {
+ $this->_uid = 1;
+ }
$this->_unixdate = COM_applyFilter($array['date'], true);
if (!isset($array['bodytext'])) {
@@ -895,10 +906,10 @@
global $_USER, $_CONF, $_TABLES;
$this->_sid = COM_makeSid();
- if (isset($_USER['uid']) && ($_USER['uid'] > 1)) {
+ if (COM_isAnonUser()) {
+ $this->_uid = 1;
+ } else {
$this->_uid = $_USER['uid'];
- } else {
- $this->_uid = 1;
}
$tmptid = addslashes(COM_sanitizeID($this->_tid));
@@ -949,7 +960,11 @@
$this->_trackbackcode = $_CONF['trackback_code'];
$this->_statuscode = 0;
$this->_show_topic_icon = $_CONF['show_topic_icon'];
- $this->_owner_id = $_USER['uid'];
+ if (COM_isAnonUser()) {
+ $this->_owner_id = 1;
+ } else {
+ $this->_owner_id = $_USER['uid'];
+ }
$this->_group_id = $T['group_id'];
$this->_perm_owner = $T['perm_owner'];
$this->_perm_group = $T['perm_group'];
@@ -1942,6 +1957,8 @@
*/
function _sanitizeData()
{
+ global $_CONF;
+
if (empty($this->_hits)) {
$this->_hits = 0;
}
@@ -1969,6 +1986,11 @@
} elseif ($this->_show_topic_icon != 1) {
$this->_show_topic_icon = 0;
}
+
+ if (empty($this->_comment_expire)) {
+ $this->_comment_expire = $this->_date
+ + ($_CONF['article_comment_close_days'] * 86400);
+ }
}
// End Private Methods.
More information about the geeklog-cvs
mailing list