/*
-----------------------------------------------------------------------
     JohnCMS 4..
      users/profile.php
-----------------------------------------------------------------------
*/
    if ($set_karma['on']) {
        $karma = $user['karma_plus'] - $user['karma_minus'];
        if ($karma > 0) {
            $images = ($user['karma_minus'] ? ceil($user['karma_plus'] / $user['karma_minus']) : $user['karma_plus']) > 10 ? '2' : '1';
            echo '<div class="gmenu">';
        } else if ($karma < 0) {
            $images = ($user['karma_plus'] ? ceil($user['karma_minus'] / $user['karma_plus']) : $user['karma_minus']) > 10 ? '-2' : '-1';
            echo '<div class="rmenu">';
        } else {
            $images = 0;
            echo '<div class="menu">';
        }
////////////////////////////////////////////////////////////////
	    $plus = ($user['karma_minus']+ $user['karma_plus']) ? round(100 / ($user['karma_minus'] + $user['karma_plus']) * $user['karma_plus']) : 50;
		$minus = ($user['karma_minus']+ $user['karma_plus']) ? round(100 / ($user['karma_minus'] + $user['karma_plus']) * $user['karma_minus']) : 50;
        echo '<table  width="100%"><tr><td width="22" valign="top"><img src="' . $set['homeurl'] . '/images/k_' . $images . '.gif"/></td><td>';
		    if ($plus > 0)
		echo '<img src="plus.php?img=' . $plus . '" alt="' . $lng['karma'] . ': +' . $plus  . '%" /><br />';
		    if ($minus > 0)
		echo '<img src="minus.php?img=' . $minus . '" alt="' . $lng['karma'] . ': -' . $minus  . '%" /><br />';		
/////////////////////////////////////////////////////////////////////////////////
            echo '<b>' . $lng['karma'] . ' (' . $karma . ')</b>' .
            '<div class="sub">' .
            '<span class="green"><a href="profile.php?act=karma&amp;user=' . $user['id'] . '&amp;type=1">' . $lng['vote_for'] . ' (' . $user['karma_plus'] . ')</a></span> | ' .
            '<span class="red"><a href="profile.php?act=karma&amp;user=' . $user['id'] . '">' . $lng['vote_against'] . ' (' . $user['karma_minus'] . ')</a></span>';
        if ($user['id'] != $user_id) {
            if (!$datauser['karma_off'] && (!$user['rights'] || ($user['rights'] && !$set_karma['adm'])) && $user['ip'] != $datauser['ip']) {
                $sum = mysql_result(mysql_query("SELECT SUM(`points`) FROM `karma_users` WHERE `user_id` = '$user_id' AND `time` >= '" . $datauser['karma_time'] . "'"), 0);
                $count = mysql_result(mysql_query("SELECT COUNT(*) FROM `karma_users` WHERE `user_id` = '$user_id' AND `karma_user` = '" . $user['id'] . "' AND `time` > '" . ($realtime - 86400) . "'"), 0);
                if (!$ban && $datauser['postforum'] >= $set_karma['forum'] && $datauser['total_on_site'] >= $set_karma['karma_time'] && ($set_karma['karma_points'] - $sum) > 0 && !$count) {
                    echo '<br /><a href="profile.php?act=karma&amp;mod=vote&amp;user=' . $user['id'] . '">' . $lng['vote'] . '</a>';
                }
            }
        } else {
            $total_karma = mysql_result(mysql_query("SELECT COUNT(*) FROM `karma_users` WHERE `karma_user` = '$user_id' AND `time` > " . ($realtime - 86400)), 0);
            if ($total_karma > 0)
                echo '<br /><a href="profile.php?act=karma&amp;mod=new">' . $lng['responses_new'] . '</a> (' . $total_karma . ')';
        }
        echo '</div></td></tr></table></div>';
    }
/*
-----------------------------------------------------------------------
     JohnCMS 4..
-----------------------------------------------------------------------
*/



///////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////



/*
-----------------------------------------------------------------------
     JohnCMS 3.2.2
      str/anketa.php
-----------------------------------------------------------------------
*/
if ($set_karma['on']) {
echo '<div class="list2">';
$exp = explode('|', $user['plus_minus']);
if ($exp[0] > $exp[1]) {
$karma = $exp[1] ? ceil($exp[0] / $exp[1]) : $exp[0];
$images = $karma > 10 ? '2' : '1';
} else if ($exp[1] > $exp[0]) {
$karma = $exp[0] ? ceil($exp[1] / $exp[0]) : $exp[1];
$images = $karma > 10 ? '-2' : '-1';
} else {
$images = 0;
}
////////////////////////////////////////////////////////////////
$plus = ($exp[1]+ $exp[0]) ? round(100 / ($exp[1] + $exp[0]) * $exp[0]) : 50; 
$minus = ($exp[1]+ $exp[0]) ? round(100 / ($exp[1] + $exp[0]) * $exp[1]) : 50; 
echo '<table width="100%"><tr><td width="22" valign="top"><img src="../images/k_' . $images . '.gif"/></td><td>';
 if ($plus > 0)
echo '<img src="plus.php?img=' . $plus . '" alt=": +' . $plus . '%" /><br />';
  if ($minus > 0)
echo '<img src="minus.php?img=' . $minus . '" alt=": -' . $minus . '%" /><br />';
 /////////////////////////////////////////////////////////////////////////////////
echo '<b> (' . $user['karma'] . ')</b><div class="sub">
<span class="green"><a href="karma.php?id=' . $id . '&amp;type=1"> (' . $exp[0] . ')</a></span> | <span class="red"><a href="karma.php?id=' . $id . '&amp;type=2"> (' . $exp[1] . ')</a></span>';
if ($id) {
if (!$datauser['karma_off'] && (!$user['rights'] || ($user['rights'] && !$set_karma['adm'])) && $user['ip'] != $datauser['ip']) {
$sum = mysql_result(mysql_query("SELECT SUM(`points`) FROM `karma_users` WHERE `user_id` = '$user_id' AND `time` >= '" . $datauser['karma_time'] . "'"), 0);
$count = mysql_result(mysql_query("SELECT COUNT(*) FROM `karma_users` WHERE `user_id` = '$user_id' AND `karma_user` = '$id' AND `time` > '" . ($realtime - 86400) . "'"), 0);
if ($datauser['postforum'] >= $set_karma['forum'] && $datauser['total_on_site'] >= $set_karma['karma_time'] && ($set_karma['karma_points'] - $sum) > 0 && !$count) {
echo '<br /><a href="karma.php?act=user&amp;id=' . $id . '"> </a>';
}
}
} else {
$total_karma = mysql_result(mysql_query("SELECT COUNT(*) FROM `karma_users` WHERE `karma_user` = '$user_id' AND `time` > " . ($realtime - 86400)), 0);
if ($total_karma > 0)
echo '<br /><a href="karma.php?act=new"> </a> (' . $total_karma . ')';
}
echo '</div></td></tr></table></div>';
}
/*
-----------------------------------------------------------------------
     JohnCMS 3.2.2
-----------------------------------------------------------------------
*/