function CheckTopicExpired2($id, $goods, $bads, $time) { global $SCORE_RAMP_CONSTANT, $BURY_SCORE, $BURY_SCORE2; // this is only called on LIVE topics. $score = GetScore($goods, $bads); $removetime = 0; $delete = false; $total = $goods + $bads; if ($total == 0) { return; } // no votes, keep forever !:) if ($score < $BURY_SCORE2) { // under score 55, delete after 5 minutes // remove after 5 minutes $removetime = $GLOBALS['BURY_TIME']; if ($score < $BURY_SCORE) { $delete = true; } } else { // "old" after 30 minutes $removetime = $GLOBALS['OLD_TIME']; } if ($total < $SCORE_RAMP_CONSTANT) { // adjust removal time to be longer if total votes are low $removetime = $removetime * ($SCORE_RAMP_CONSTANT / $total) * 3 - $removetime * 2; } if (time() >= $time + $removetime) { // topic expired. if ($delete) { $sql = GetSQL(); $sql->safequery("UPDATE Topics SET state=" . TopicStates::Deleted . " WHERE state=" . TopicStates::Live . " AND id={$id}"); return 1; } else { FinalizeTopic($id); return 2; } } return FALSE; }
$a['id'] = (int) $row['id']; $a['content'] = $row['content']; if ($state == TopicStates::Live) { $a['vote'] = is_null($row['vote']) ? NULL : (bool) $row['vote']; } else { $a['vote'] = null; } if ($state == TopicStates::Old) { $a['goods'] = $row['goods']; $a['bads'] = $row['bads']; } $output[] = $a; } if ($state == TopicStates::Old) { foreach ($output as $key => $value) { $score = GetScore($value['goods'], $value['bads']); if ($score < $GLOBALS['COMMENT_BURY_SCORE']) { // filter out shit scores. unset($output[$key]); } else { // translate goods,bads into final score $output[$key]['score'] = $score; unset($output[$key]['goods']); unset($output[$key]['bads']); } } // sort by score usort($output, "ScoreCmp2"); } else { if ($state == TopicStates::Live) { // filter out downvoted comments
$html .= '</a>'; } return $html; } // Récupération des données $ch = curl_init($url); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $fichier = curl_exec($ch); curl_close($ch); // Tri des infos récupérées $user['gamertile'] = GetGamertile($fichier); $user['gamertag'] = GetGamertag($fichier); $user['sub'] = GetSub($fichier); $user['rep'] = GetRep($fichier); $user['score'] = GetScore($fichier); $user['zone'] = GetZone($fichier); $user['games'] = GetGames($fichier); // Affichage en mode debug if (isset($_GET['debug'])) { echo "<pre>\n"; echo "MODE DEBUG\n\n"; echo 'Gamertile: ' . $user['gamertile']; echo "\n"; echo 'Subscription: ' . $user['sub']; echo "\n"; echo 'Gamertag: ' . $user['gamertag']; echo "\n"; echo 'Rep: ' . $user['rep']; echo "\n"; echo 'Score: ' . $user['score'];
function ShowTopic() { global $g_account, $g_get_page; $page = $g_get_page ? $g_get_page : $g_account->page; echo '<script>'; echo 'matbox.SetPage( ' . $page . ', "none");'; echo '</script>'; if ($page == 0) { ?> <script>matbox.SetPage( 0, "nonew" );</script> <div class="topic nothing" id="topic"> no new matter. </div> <div class="panel"> <div class="button" onclick="matbox.GotoRandom()">archive</div> <div class="button" onclick="matbox.Loader.RefreshContent()">check again</div> </div> <?php return false; } try { $topic = new Topic($page, $g_account); } catch (Exception $e) { ?> <div class="topic nothing clickable" id="topic" onclick="matbox.Loader.RefreshContent()"> something messed up. </div> <?php LogException("readtopic", $e); die; } if (!$topic->valid) { ?> <div class="topic nothing clickable" id="topic" onclick="matbox.Loader.RefreshContent()"> that sample doesn't exist </div> <?php return false; } if ($topic->state == TopicStates::Deleted) { ?> <div class="topic nothing clickable" id="topic" onclick="matbox.Loader.RefreshContent()"> this matter was buried. </div> <?php return false; } if ($topic->state == TopicStates::Composing) { echo '<div class="topic composing" id="topic"> <div class="compose" contenteditable="true" id="composition"></div> </div>'; echo '<div class="submit" onclick="matbox.SubmitComposition()" id="submit">analyze</div>'; ?> <script> $("#composition").keydown( function() { if( matbox.Loader.IsLoading() ) return false; setTimeout( matbox.CompositionKeyPressed, 0 ); }); </script> <?php return true; } $badstring = mt_rand(0, 25) == 0 ? "cancer" : "bad"; echo '<div class="topic" id="topic">'; // replace embed tags $content = ReplaceEmbeds($topic->content); echo $content; if ($topic->state == TopicStates::Live) { echo '<script>matbox.SetPage( ' . $topic->id . ', "live")</script>'; if ($topic->vote === true) { echo '<div class="good" id="goodbutton"><div class="speshul_table"><div><img src="star.png" title="good"></div></div></div>'; echo '<div class="bad" id="badbutton"><div class="speshul_table"><div><img src="notbad.png" title="' . $badstring . '"></div></div></div>'; } else { if ($topic->vote === false) { echo '<div class="good" id="goodbutton"><div class="speshul_table"><div><img src="unstar.png" title="good"></div></div></div>'; echo '<div class="bad" id="badbutton"><div class="speshul_table"><div><img src="bad.png" title="' . $badstring . '"></div></div></div>'; } else { echo '<div class="good clickable" id="goodbutton" ><div class="speshul_table"><div><img src="unstar.png" title="good" onclick="matbox.VoteTopicGood()"></div></div></div>'; echo '<div class="bad clickable" id="badbutton" ><div class="speshul_table"><div><img src="notbad.png" title="' . $badstring . '" onclick="matbox.VoteTopicBad()"></div></div></div>'; } } } else { if ($topic->state == TopicStates::Old) { echo '<script>matbox.SetPage( ' . $topic->id . ',"old" )</script>'; // print score $score = GetScore($topic->goods, $topic->bads); echo '<div class="score ' . ScoreRank($score) . '" id="scorediv" title="' . ScoreRankName($score) . '"><div class="speshul_table"><div>' . $score . '</div></div></div>'; /*echo '<div class="new" id="newbutton" onclick="matbox.CloseOld()"></div>';*/ } } echo '</div>'; echo '<div class="replies" id="replies">'; echo '<div class="replylist" id="replylist">'; echo '</div>'; // replylist if ($topic->state == TopicStates::Live) { echo '<div class="reply" id="replyinputbox"> <div class="replyinput init" id="replyinput" contenteditable="true"></div> </div>'; } else { if ($topic->state == TopicStates::Old) { } } echo '</div>'; // replies echo '<div class="submit" onclick="matbox.SubmitComment()" id="submit">submit</div>'; echo '<div class="padding" id="padding"></div>'; return true; }