[Pushed] ModCP Ban bug
#1
Hi,
in modcp.php?action=banuser I find a bug.
if We only one banned group MyBB use <input type="hidden" for banned group but value of it is last gid! 

for fix:
in modcp.php
find:

	$bangroup_option = $bangroups = '';
	$numgroups = 0;
	$groupscache = $cache->read("usergroups");

	foreach($groupscache as $key => $group)
	{
		if($group['isbannedgroup'])
		{
			$selected = "";
			if(isset($banned['gid']) && $banned['gid'] == $group['gid'])
			{
				$selected = " selected=\"selected\"";
			}

			$group['title'] = htmlspecialchars_uni($group['title']);
			eval("\$bangroup_option .= \"".$templates->get("modcp_banuser_bangroups_group")."\";");
			++$numgroups;
		}
	}

	if($numgroups > 1)
	{
		eval("\$bangroups = \"".$templates->get("modcp_banuser_bangroups")."\";");
	}
	else
	{
		eval("\$bangroups = \"".$templates->get("modcp_banuser_bangroups_hidden")."\";");
	}
replace to:

	$bangroup_option = $bangroups = '';
	$numgroups = 0;
	$groupscache = $cache->read("usergroups");
	$banned_group = 0;

	foreach($groupscache as $key => $group)
	{
		if($group['isbannedgroup'])
		{
			$selected = "";
			if(isset($banned['gid']) && $banned['gid'] == $group['gid'])
			{
				$selected = " selected=\"selected\"";
			}

			$group['title'] = htmlspecialchars_uni($group['title']);
			eval("\$bangroup_option .= \"".$templates->get("modcp_banuser_bangroups_group")."\";");
			$banned_group = $group['gid'];
			++$numgroups;
		}
	}

	if($numgroups > 1)
	{
		eval("\$bangroups = \"".$templates->get("modcp_banuser_bangroups")."\";");
	}
	else
	{
		eval("\$bangroups = \"".$templates->get("modcp_banuser_bangroups_hidden")."\";");
	}

and in install/resources/mybb_theme.xml
find:
<template name="modcp_banuser_bangroups_hidden" version="1800"><![CDATA[<input type="hidden" name="usergroup" value="{$group['gid']}" />]]></template>
Replace to:
<template name="modcp_banuser_bangroups_hidden" version="1801"><![CDATA[<input type="hidden" name="usergroup" value="{$banned_group}" />]]></template>
Reply
#2
Hi,

Thank you for your report. We have pushed this issue to our Github repository for further analysis where you can track our commits and progress with fixing this bug. Discussions regarding this bug may also take place there too.

Follow this link to visit the issue on Github: https://github.com/mybb/mybb/issues/1406

Thanks for contributing to MyBB!

Regards,
The MyBB Group
Reply
#3
Do you want to submit those changes as a Pull Request please? Smile
Reply
#4
(2014-09-09, 06:13 PM)JordanMussi Wrote: Do you want to submit those changes as a Pull Request please? Smile
https://github.com/mybb/mybb/issues/1408
Reply
#5
but the error existing even after the changes.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)