function getFeedEntry($blogid, $group = 0, $feed = 0, $entry = 0, $unreadOnly = false, $starredOnly = false, $searchKeyword = null, $position = 'current', $markAsRead = 'read') { // if failed, return false or null. check both! global $database; $setting = getReaderSetting($blogid); $searchKeyword = escapeSearchString($searchKeyword); if ($entry == 0 || $position != 'current') { if ($starredOnly !== false) { $condition = 'AND s.item IS NOT NULL'; } else { if ($searchKeyword !== null) { $condition = "AND (i.title LIKE '%{$searchKeyword}%' OR i.description LIKE '%{$searchKeyword}%')"; } else { $condition = ''; } } $condition .= $group == 0 ? '' : " AND g.id = {$group}"; $condition .= $feed == 0 ? '' : " AND f.id = {$feed}"; $sql = "SELECT\n\t\t\t\t\t\ti.id, i.title AS entry_title, i.description, f.title AS blog_title, i.author, i.written, i.tags, i.permalink, rd.item AS wasread, f.language, enclosure\n\t\t\t\t\tFROM\n\t\t\t\t\t\t{$database['prefix']}FeedGroups g,\n\t\t\t\t\t\t{$database['prefix']}FeedGroupRelations r,\n\t\t\t\t\t\t{$database['prefix']}Feeds f,\n\t\t\t\t\t\t{$database['prefix']}FeedItems i\n\t\t\t\t\tLEFT JOIN\n\t\t\t\t\t\t{$database['prefix']}FeedStarred s\n\t\t\t\t\tON\n\t\t\t\t\t\ts.blogid = {$blogid} AND\n\t\t\t\t\t\ti.id = s.item\n\t\t\t\t\tLEFT JOIN\n\t\t\t\t\t\t{$database['prefix']}FeedReads rd\n\t\t\t\t\tON\n\t\t\t\t\t\trd.blogid = {$blogid} AND\n\t\t\t\t\t\ti.id = rd.item\n\t\t\t\t\tWHERE\n\t\t\t\t\t\tr.blogid = {$blogid} AND\n\t\t\t\t\t\tr.blogid = g.blogid AND\n\t\t\t\t\t\tg.id = r.groupid AND\n\t\t\t\t\t\tr.feed = f.id AND\n\t\t\t\t\t\tf.id = i.feed\n\t\t\t\t\t\t{$condition}\n\t\t\t\t\tGROUP BY i.id, entry_title, i.description, blog_title, i.author, i.written, i.tags, i.permalink, wasread, f.language, enclosure\n\t\t\t\t\tORDER BY i.written DESC, i.id DESC"; if ($position == 'current') { if ($row = POD::queryRow("{$sql} LIMIT 1")) { $row['description'] = adjustRelativePathImage($row['description'], $row['permalink']); $row['description'] = filterJavaScript($row['description'], $setting['allowscript'] == 1 ? false : true); } return $row; } else { $result = POD::queryAll($sql); $prevRow = null; while ($row = array_shift($result)) { if ($row['id'] == $entry) { if ($position == 'before') { while ($row = array_shift($result)) { if ($unreadOnly == false || !$row['wasread']) { break; } } if ($markAsRead == 'read') { POD::query("REPLACE INTO {$database['prefix']}FeedReads VALUES({$blogid}, {$row['id']})"); } if ($row) { $row['description'] = adjustRelativePathImage($row['description'], $row['permalink']); $row['description'] = filterJavaScript($row['description'], $setting['allowscript'] == 1 ? false : true); } return $row; } else { if ($position == 'after') { if ($markAsRead == 'read') { POD::query("REPLACE INTO {$database['prefix']}FeedReads VALUES({$blogid}, {$prevRow['id']})"); } if ($prevRow) { $prevRow['description'] = adjustRelativePathImage($prevRow['description'], $row['permalink']); $prevRow['description'] = filterJavaScript($prevRow['description'], $setting['allowscript'] == 1 ? false : true); } return $prevRow; } } } if ($unreadOnly == false || !$row['wasread']) { $prevRow = $row; } } return null; } } else { POD::query("REPLACE INTO {$database['prefix']}FeedReads VALUES({$blogid}, {$entry})"); $sql = "SELECT\n\t\t\t\t\t\ti.id, i.title AS entry_title, i.description, f.title AS blog_title, i.author, i.written, i.tags, i.permalink, f.language, enclosure\n\t\t\t\t\tFROM\n\t\t\t\t\t\t{$database['prefix']}FeedGroups g,\n\t\t\t\t\t\t{$database['prefix']}FeedGroupRelations r,\n\t\t\t\t\t\t{$database['prefix']}Feeds f,\n\t\t\t\t\t\t{$database['prefix']}FeedItems i\n\t\t\t\t\tWHERE\n\t\t\t\t\t\tr.blogid = {$blogid} AND\n\t\t\t\t\t\tr.blogid = g.blogid AND\n\t\t\t\t\t\tr.feed = f.id AND\n\t\t\t\t\t\tr.groupid = g.id AND\n\t\t\t\t\t\ti.id = {$entry} AND\n\t\t\t\t\t\tf.id = i.feed"; if ($row = POD::queryRow($sql)) { $row['description'] = adjustRelativePathImage($row['description'], $row['permalink']); $row['description'] = filterJavaScript($row['description'], $setting['allowscript'] == 1 ? false : true); } return $row; } }
<?php /// Copyright (c) 2004-2016, Needlworks / Tatter Network Foundation /// All rights reserved. Licensed under the GPL. /// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT) define('__TEXTCUBE_ADMINPANEL__', true); $IV = array('GET' => array('requestURI' => array('url', 'mandatory' => false))); require ROOT . '/library/preprocessor.php'; global $openid_session; global $openid_session_id; $context = Model_Context::getInstance(); if (empty($_GET['requestURI'])) { $requestURI = $context->getProperty('uri.blog'); } else { $requestURI = filterJavaScript($_GET['requestURI']); if (Acl::getIdentity('openid')) { header("Location: {$requestURI}"); exit; } } list($openid_help_link, $openid_signup_link) = fireEvent('OpenIDAffiliateLinks', $requestURI); $img_url = $context->getProperty('uri.host') . $context->getProperty('service.path') . "/plugins/" . basename(dirname(__FILE__)) . "/login-bg.gif"; if (!empty($_COOKIE['openid'])) { $openid_remember_check = "checked"; $cookie_openid = $_COOKIE['openid']; } else { $openid_remember_check = ""; $cookie_openid = ''; } ?> <!DOCTYPE html>