diff options
author | Andrew Dolgov <[email protected]> | 2012-07-09 20:24:05 +0400 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2012-07-09 20:26:03 +0400 |
commit | d3d69daa3cb4d5a2839bd20d48a939e0351264a6 (patch) | |
tree | 32464dc0cf88cef2787274996cc0c13b81108b5c /include/functions.php | |
parent | 2ea9bbfd075fc03acceb608746c3989613f768e3 (diff) |
implement showing related articles in 3panel mode when ngram stuff is enabled
Diffstat (limited to 'include/functions.php')
-rw-r--r-- | include/functions.php | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/include/functions.php b/include/functions.php index b14515bdd..5b3cc6741 100644 --- a/include/functions.php +++ b/include/functions.php @@ -3302,7 +3302,7 @@ </head><body>"; } - $rv['title'] = $line['title']; + $title_escaped = db_escape_string($line['title']); $rv['content'] .= "<div id=\"PTITLE-$id\" style=\"display : none\">" . truncate_string(strip_tags($line['title']), 15) . "</div>"; @@ -3434,6 +3434,31 @@ $rv['content'] .= "<div class=\"postContent\">"; + // N-grams + + if (DB_TYPE == "pgsql" and defined('_NGRAM_TITLE_DUPLICATE_THRESHOLD')) { + + $ngram_result = db_query($link, "SELECT id,title FROM + ttrss_entries,ttrss_user_entries + WHERE ref_id = id AND updated >= NOW() - INTERVAL '7 day' + AND similarity(title, '$title_escaped') >= "._NGRAM_TITLE_DUPLICATE_THRESHOLD." + AND title != '$title_escaped' + AND owner_uid = $owner_uid"); + + if (db_num_rows($ngram_result) > 0) { + $rv['content'] .= "<div dojoType=\"dijit.form.DropDownButton\">". + "<span>" . __('Related')."</span>"; + $rv['content'] .= "<div dojoType=\"dijit.Menu\" style=\"display: none;\">"; + + while ($nline = db_fetch_assoc($ngram_result)) { + $rv['content'] .= "<div onclick=\"hlOpenInNewTab(null,".$nline['id'].")\" + dojoType=\"dijit.MenuItem\">".$nline['title']."</div>"; + + } + $rv['content'] .= "</div></div><br/"; + } + } + $article_content = sanitize($link, $line["content"], false, $owner_uid, $feed_site_url); |