<commit_before><?php
//  AcmlmBoard XD Plugin - User badges management tool
//  Access: administrators only
//  Based on ipbans.php

$title = __("User Badges Manager");

assertForbidden("editUserBadges");

if($loguser['powerlevel'] < 3)
	kill(__("You're not an administrator. There is nothing for you here."));

makeCrumbs(array(__("Admin") => actionLink("admin"), __("User Badges Manager") => actionLink("userbadges")), "");

if($_POST['action'] == __("Add"))
{
	if($_POST['color'] == -1 || empty($_POST['userid']) || empty($_POST['name']))
	{
		kill(__("Please review your settings before adding a user badge."));
	}
	else
	{
		query("insert into {badges} values ({0}, {1}, {2})",
		(int)$_POST['userid'], $_POST['name'], (int)$_POST['color']);

		alert(__("Added."), __("Notice"));
	}<commit_msg>Fixed breadcrumbs in badge manager. (The plugin still seems broken though)<commit_after><?php
//  AcmlmBoard XD Plugin - User badges management tool
//  Access: administrators only
//  Based on ipbans.php

$title = __("User Badges Manager");

assertForbidden("editUserBadges");

if($loguser['powerlevel'] < 3)
	kill(__("You're not an administrator. There is nothing for you here."));


$crumbs = new PipeMenu();
$crumbs->add(new PipeMenuLinkEntry(__("Admin"), "admin"));
$crumbs->add(new PipeMenuLinkEntry(__("User Badges Manager"), "userbadges"));
makeBreadcrumbs($crumbs);

if($_POST['action'] == __("Add"))
{
	if($_POST['color'] == -1 || empty($_POST['userid']) || empty($_POST['name']))
	{
		kill(__("Please review your settings before adding a user badge."));
	}
	else
	{
		query("insert into {badges} values ({0}, {1}, {2})",
		(int)$_POST['userid'], $_POST['name'], (int)$_POST['color']);

		alert(__("Added."), __("Notice"));
	}
{'fraction_non_alphanumeric': 0.2138328530259366, 'fraction_numerical': 0.005763688760806916, 'mean_word_length': 5.754863813229572, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '360475', 'n_tokens_mistral': 595, 'n_tokens_neox': 577, 'n_words': 146}