Voting on Polls and Muted Words

This commit is contained in:
Daisuke
2020-04-22 20:25:00 -05:00
parent 64f540dce5
commit f1a4636a5a
16 changed files with 195 additions and 60 deletions

View File

@ -149,6 +149,13 @@ if ((!isset($thread[0]['id']) && !empty($thread)) || !is_array($thread)) {
$post['replyto'] = "<span>" . ($elem['in_reply_to_id'] ? " <a class='fontello link preview ldr' target='_blank' id='" . $elem['in_reply_to_id'] . "' href='?thread=" . $elem['in_reply_to_id'] . "'>&#xf112;</a>" : "") . "</span>";
}
/* We skip the post if it contains any of the muted words */
foreach($user_settings['mtwords'] as $word){
if(contains($elem['content'],$word)){
continue 2;
}
}
/* if the poster ID was flagged as NSFW by the user, the post is flagged
as sensitive by default */
if (in_array($elem["account"]['id'], $user_settings['nsfw'])) {
@ -208,17 +215,11 @@ if ((!isset($thread[0]['id']) && !empty($thread)) || !is_array($thread)) {
$post['text'] = processText($elem);
if (!empty($elem['poll'])){
$post['text'] .= "<br>";
$votes = $elem['poll']['votes_count'];
$post['text'] .= "<div class='poll'><b>Votes: $votes</b><br>";
foreach ($elem['poll']['options'] as $option){
$post['text'] .= "<div class='polloption'>".$option['title']."</div>";
}
$post['text'] .= "<div class='poll' id='".$elem['poll']['id']."' ".($elem['poll']['multiple'] ? "multiple" : "").">";
$post['text'] .= renderPoll($elem);
$post['text'] .= "</div>";
}
$post['spoiler'] = (empty($elem['spoiler_text']) ? "" : "<span style='font-weight:bold;font-size:20px;'>" . $elem['spoiler_text'] . "</span><br>");
$post['media'] = "";
@ -244,9 +245,9 @@ if ((!isset($thread[0]['id']) && !empty($thread)) || !is_array($thread)) {
$ext = explode(".", $file['url']);
$ext = end($ext);
$ext = explode("?", $ext) [0];
if (in_array($ext,array('webm','mp4'))) {
if (in_array($ext,array('webm','mp4','ogv'))) {
$post['media'] .= "<div style='overflow:hidden; float:left; margin:2px;' $class><video preload='metadata' style='text-align:center; max-width:100%; max-height:100%;' controls ".($user_settings['videoloop'] == "on" ? "loop" : "").">
<source src='" . $file['url'] . "' type='video/$ext'>
<source src='" . $file['url'] . "' type='video/".($ext == "ogv" ? "ogg" : $ext)."'>
</video></div>
";
}