added support for auto sage in index
parent
d93f2e1574
commit
053b709ff0
|
@ -288,8 +288,26 @@ function bot_me($db, $settings)
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the post is a reply, put the original post on top.
|
// If the post is a reply, put the original post on top.
|
||||||
function bump_message($db, $org_id, $sub)
|
function bump_message($db, $org_id, $sub, $settings)
|
||||||
{
|
{
|
||||||
|
if ( $settings['auto_sage'] > 0 ) {
|
||||||
|
|
||||||
|
$statement = $db->prepare("SELECT global_id
|
||||||
|
FROM threads
|
||||||
|
WHERE org_id = '$org_id'
|
||||||
|
AND sub = '$sub'");
|
||||||
|
$result = $statement->execute();
|
||||||
|
|
||||||
|
$counter = 0;
|
||||||
|
|
||||||
|
while ($row = $result->fetchArray(SQLITE3_NUM)) {
|
||||||
|
$counter++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $counter > $settings['auto_sage'] ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$statement = $db->prepare("SELECT text, global_id, text_id
|
$statement = $db->prepare("SELECT text, global_id, text_id
|
||||||
FROM threads
|
FROM threads
|
||||||
|
@ -1769,7 +1787,7 @@ function make_post($db, $sub, $settings, $text, $org_id)
|
||||||
if ( ($org_id != $post_id) &&
|
if ( ($org_id != $post_id) &&
|
||||||
($settings['enable_bumping'] == TRUE) &&
|
($settings['enable_bumping'] == TRUE) &&
|
||||||
(!isset($_POST['sage'])) ){
|
(!isset($_POST['sage'])) ){
|
||||||
bump_message($db, $org_id, $sub);
|
bump_message($db, $org_id, $sub, $settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $post_id;
|
return $post_id;
|
||||||
|
|
Loading…
Reference in New Issue