<commit_before><?php
$ajaxPage = true;

if($_GET["key"] != $loguser["token"])
	die("Nope!");

$pid = (int)$_GET["id"];

$post = Fetch(Query("SELECT * FROM {posts} WHERE id = {0}", $pid));
if(!$post)
	die("Unknown post");
if($post["user"] == $loguserid)
	die("Nope!");

$thread = Fetch(Query("SELECT * FROM {threads} WHERE id = {0}", $post["thread"]));
if(!$thread)
	die("Unknown thread");

if($thread["closed"])
	die(__("Thread is closed"));

$vote = Fetch(Query("SELECT * FROM {postplusones} WHERE post = {0} AND user = {1}", $pid, $loguserid));
if($vote)
	die(__("You already +1'd this"));

if($loguser["powerlevel"] < 0)
	die(__("You are banned and can't give +1's to posts."));

Query("UPDATE {posts} SET postplusones = postplusones+1 WHERE id = {0} LIMIT 1", $pid);
Query("UPDATE {users} SET postplusones = postplusones+1 WHERE id = {0} LIMIT 1", $post["user"]);
Query("UPDATE {users} SET postplusonesgiven = postplusonesgiven+1 WHERE id = {0} LIMIT 1", $loguserid);
Query("INSERT INTO {postplusones} (user, post) VALUES ({0}, {1})", $loguserid, $pid);
$post["postplusones"]++;

echo formatPlusOnes($post["postplusones"]);


<commit_msg>Allow +1 in closed threads.<commit_after><?php
$ajaxPage = true;

if($_GET["key"] != $loguser["token"])
	die("Nope!");

$pid = (int)$_GET["id"];

$post = Fetch(Query("SELECT * FROM {posts} WHERE id = {0}", $pid));
if(!$post)
	die("Unknown post");
if($post["user"] == $loguserid)
	die("Nope!");

$thread = Fetch(Query("SELECT * FROM {threads} WHERE id = {0}", $post["thread"]));
if(!$thread)
	die("Unknown thread");

//if($thread["closed"])
//	die(__("Thread is closed"));

$vote = Fetch(Query("SELECT * FROM {postplusones} WHERE post = {0} AND user = {1}", $pid, $loguserid));
if($vote)
	die(__("You already +1'd this"));

if($loguser["powerlevel"] < 0)
	die(__("You are banned and can't give +1's to posts."));

Query("UPDATE {posts} SET postplusones = postplusones+1 WHERE id = {0} LIMIT 1", $pid);
Query("UPDATE {users} SET postplusones = postplusones+1 WHERE id = {0} LIMIT 1", $post["user"]);
Query("UPDATE {users} SET postplusonesgiven = postplusonesgiven+1 WHERE id = {0} LIMIT 1", $loguserid);
Query("INSERT INTO {postplusones} (user, post) VALUES ({0}, {1})", $loguserid, $pid);
$post["postplusones"]++;

echo formatPlusOnes($post["postplusones"]);



{'fraction_non_alphanumeric': 0.22849695916594265, 'fraction_numerical': 0.016072980017376195, 'mean_word_length': 6.381410256410256, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3851931', 'n_tokens_mistral': 844, 'n_tokens_neox': 826, 'n_words': 226}