Skip to content

Commit

Permalink
Fixed bugs with syndication in case of PostgreSQL
Browse files Browse the repository at this point in the history
  • Loading branch information
mystralkk committed May 17, 2021
1 parent 91a2baf commit 40f6c55
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
19 changes: 16 additions & 3 deletions public_html/admin/syndication.php
Original file line number Diff line number Diff line change
Expand Up @@ -552,12 +552,25 @@ function savefeed($A)
$A[$name] = DB_escapeString($value);
}

DB_save($_TABLES['syndication'], 'fid,type,topic,header_tid,format,limits,content_length,title,description,feedlogo,filename,charset,language,is_enabled,updated,update_info',
"{$A['fid']},'{$A['type']}','{$A['topic']}','{$A['header_tid']}','{$A['format']}','{$A['limits']}',{$A['content_length']},'{$A['title']}','{$A['description']}','{$A['feedlogo']}','{$A['filename']}','{$A['charset']}','{$A['language']}',{$A['is_enabled']},NULL,NULL");

$timestamp = date('Y-m-d H:i:s');
if ($A['fid'] == 0) {
DB_query(
"INSERT INTO {$_TABLES['syndication']} (type,topic,header_tid,format,limits,content_length,title,description,feedlogo,filename,charset,language,is_enabled,updated,update_info)"
. "VALUES('{$A['type']}','{$A['topic']}','{$A['header_tid']}','{$A['format']}','{$A['limits']}',{$A['content_length']},'{$A['title']}','{$A['description']}','{$A['feedlogo']}','{$A['filename']}','{$A['charset']}','{$A['language']}',{$A['is_enabled']},'{$timestamp}', NULL)"
);
$A['fid'] = DB_insertId();
} else {
DB_query(
"UPDATE {$_TABLES['syndication']} SET type = '{$A['type']}', topic = '{$A['topic']}', "
. "header_tid = '{$A['header_tid']}', format = '{$A['format']}', limits = '{$A['limits']}', "
. "content_length = {$A['content_length']}, title = '{$A['title']}', description = '{$A['description']}', "
. "feedlogo = '{$A['feedlogo']}', filename = '{$A['filename']}', charset = '{$A['charset']}', "
. "language = '{$A['language']}', is_enabled = {$A['is_enabled']}, updated ='{$timestamp}', "
. "update_info = NULL "
. "WHERE fid = {$A['fid']}"
);
}

if ($A['is_enabled'] == 1) {
SYND_updateFeed($A['fid']);
} else {
Expand Down
2 changes: 1 addition & 1 deletion system/lib-comment.php
Original file line number Diff line number Diff line change
Expand Up @@ -3193,7 +3193,7 @@ function plugin_getfeedcontent_comment($feed, &$link, &$update)
. " AND ta.type = 'article' AND ta.id = s.sid "
. " AND c.type = 'article' AND s.sid = c.sid "
. "AND (ta.tid IN({$tid_list}) AND (ta.inherit = 1 OR (ta.inherit = 0 AND ta.tid = '{$S['topic']}'))) "
. "GROUP BY c.cid "
. "GROUP BY c.cid, c.sid, c.title, c.comment, UNIX_TIMESTAMP(c.date), s.title, c.uid, s.uid "
. "ORDER BY modified DESC LIMIT 0, {$S['limits']} ";

$result = DB_query($sql);
Expand Down
2 changes: 1 addition & 1 deletion system/lib-syndication.php
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ function SYND_getFeedContentPerTopic($tid, $limit, &$link, &$update, $contentLen
WHERE draft_flag = 0 AND date <= NOW() AND perm_anon > 0
AND ta.type = 'article' AND ta.id = sid
AND (ta.tid IN({$tid_list}) AND (ta.inherit = 1 OR (ta.inherit = 0 AND ta.tid = '$tid')))
GROUP BY sid
GROUP BY sid, uid, title, introtext, bodytext, postmode, UNIX_TIMESTAMP(date), commentcode, trackbackcode, date
ORDER BY date DESC $limitsql";

$result = DB_query($sql);
Expand Down

0 comments on commit 40f6c55

Please sign in to comment.