mirror of
https://github.com/Xkeeper0/jul.git
synced 2025-05-18 16:20:22 -07:00
meta descriptions optionally use the linked post
[closes #60] if a post is linked to directly (e.g. ?pid=xxxx) it will now use that post, rather than using the first post of the thread like before. (the first post of the thread is still used for threads/page links)
This commit is contained in:
parent
ef2cac19d2
commit
274a70e66f
@ -45,6 +45,7 @@
|
|||||||
|
|
||||||
$ppp = filter_int($_GET['ppp']) ? $_GET['ppp'] : ($log ? $loguser['postsperpage'] : 20);
|
$ppp = filter_int($_GET['ppp']) ? $_GET['ppp'] : ($log ? $loguser['postsperpage'] : 20);
|
||||||
$ppp = max(min($ppp, 500), 1);
|
$ppp = max(min($ppp, 500), 1);
|
||||||
|
$pid = null;
|
||||||
|
|
||||||
if (filter_int($_GET['pid'])) {
|
if (filter_int($_GET['pid'])) {
|
||||||
$pid = $_GET['pid'];
|
$pid = $_GET['pid'];
|
||||||
@ -151,7 +152,12 @@
|
|||||||
$tlinks = implode(' | ', $tlinks);
|
$tlinks = implode(' | ', $tlinks);
|
||||||
|
|
||||||
// Description for bots
|
// Description for bots
|
||||||
$text = $sql->resultq("SELECT text FROM posts_text pt LEFT JOIN posts p ON (pt.pid = p.id) WHERE p.thread=$id ORDER BY pt.pid ASC LIMIT 1");
|
if ($pid !== null) {
|
||||||
|
// $pid is explicitly null or filter_int'd
|
||||||
|
$text = $sql->resultq("SELECT text FROM posts_text pt LEFT JOIN posts p ON (pt.pid = p.id) WHERE p.thread=$id AND p.id = '$pid' ORDER BY pt.pid ASC LIMIT 1");
|
||||||
|
} else {
|
||||||
|
$text = $sql->resultq("SELECT text FROM posts_text pt LEFT JOIN posts p ON (pt.pid = p.id) WHERE p.thread=$id ORDER BY pt.pid ASC LIMIT 1");
|
||||||
|
}
|
||||||
$text = strip_tags(str_replace(array("[", "]", "\r\n"), array("<", ">", " "), $text));
|
$text = strip_tags(str_replace(array("[", "]", "\r\n"), array("<", ">", " "), $text));
|
||||||
$text = ((strlen($text) > 160) ? substr($text, 0, 157) . "..." : $text);
|
$text = ((strlen($text) > 160) ? substr($text, 0, 157) . "..." : $text);
|
||||||
$text = str_replace("\"", """, $text);
|
$text = str_replace("\"", """, $text);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user