function doDonateMoney($fromuser, $touser, $amount, $comment, $postid = 0, $more_query = false) { global $vbulletin; $result = true; if (userBanned($fromuser['userid'])) { return fetch_error('error_kbank_banned'); } if ($amount <= 0) { return fetch_error('error_kbank_sendmsomthing'); } if ($fromuser["{$vbulletin->kbank['field']}"] - $amount < 0) { return fetch_error('error_kbank_donthave'); } if ($vbulletin->kbank['maxDonate'] != 0 and !havePerm($fromuser, KBANK_PERM_COMPANY, true) and $amount > $vbulletin->kbank['maxDonate']) { return fetch_error('error_kbank_less_than', $vbulletin->kbank['name'], $vbulletin->kbank['maxDonate']); } if ($vbulletin->kbank['maxDonate24h'] != 0 and !havePerm($fromuser, KBANK_PERM_COMPANY, true) and $fromuser['userid'] > 0) { $points = $vbulletin->db->query_first("SELECT SUM(amount) as inday\n\t\t\tFROM `" . TABLE_PREFIX . "kbank_donations`\n\t\t\tWHERE `from` = " . $fromuser['userid'] . "\n\t\t\t\tAND " . TIMENOW . " - `time` < 24*60*60"); if ($points['inday'] + $amount > $vbulletin->kbank['maxDonate24h']) { return fetch_error('error_kbank_less_than_24h', $vbulletin->kbank['name'], $vbulletin->kbank['maxDonate24h'], $points['inday']); } } if ($touser['userid'] == $fromuser['userid']) { return fetch_error('error_kbank_sendmtonoself'); } if (userBanned($touser['userid'])) { return fetch_error('error_kbank_friend_banned'); } $taxrate = false; if (havePerm($fromuser, KBANK_PERM_COMPANY, true)) { //If user is a Company, apply no tax $taxrate = KBANK_NO_TAX; } $result = transferMoney($fromuser['userid'], $touser['userid'], $amount, $comment, $fromuser["{$vbulletin->kbank['field']}"], true, true, $taxrate, false, $postid, $more_query); return $result; }
} else { print_stop_message('no_results_matched_your_query'); } print_cp_footer(); } // ###################### Ban member ######################## if ($_GET['do'] == "do_ban") { $processed = true; print_cp_header('Ban Member'); $vbulletin->input->clean_array_gpc('r', array('username' => TYPE_NOHTML, 'day' => TYPE_UINT, 'reason' => TYPE_STR)); $reader = $vbulletin->db->query_first("SELECT userid\n\t\tFROM `" . TABLE_PREFIX . "user`\n\t\tWHERE username = '******'username'] . "'"); $userid = $reader['userid']; if ($userid == '') { print_stop_message('setting_validation_error_rpuserid'); } if (userBanned($userid)) { define('CP_REDIRECT', 'kbankadmin.php?do=view_banned'); print_stop_message('kbank_already_ban'); } if ($vbulletin->GPC['day'] < 1) { print_stop_message('kbank_invalid_day'); } if ($vbulletin->GPC['reason'] == '') { print_stop_message('kbank_invalid_reason'); } $vbulletin->db->query_write("INSERT INTO `" . TABLE_PREFIX . "kbank_ban`\n\t\t(userid,`time`,days,reason,adminid)\n\t\tVALUES ({$userid}," . TIMENOW . "," . $vbulletin->GPC['day'] . ",'" . $vbulletin->GPC['reason'] . "'," . $vbulletin->userinfo['userid'] . ")"); logkBankAction('admin_ban', $userid, array('userid' => $userid, 'day' => $vbulletin->GPC['day'])); define('CP_REDIRECT', 'kbankadmin.php?do=view_banned'); print_stop_message('kbank_banned'); } // ###################### Un-Ban member ########################
while ($rec = $db->fetch_array($cache)) { $recs_processed .= showHistoryOne($rec); } $db->free_result($cache); unset($rec); //load latest history - complete! //load granted permission $granted_list = ''; $granteds = array($vbulletin->userinfo['userid'] => array('userid' => $vbulletin->userinfo['userid'], 'username' => $vbulletin->userinfo['username'] . ' (' . $vbphrase['kbank_yourself'] . '!)', 'usergroupid' => $vbulletin->userinfo['usergroupid'], 'membergroupids' => $vbulletin->userinfo['membergroupids'], $vbulletin->kbank['field'] => $vbulletin->userinfo[$vbulletin->kbank['field']])); if (is_array($vbulletin->userinfo['kbank_granted'])) { $granteds = array_merge($granteds, $vbulletin->userinfo['kbank_granted']); } //prepair output foreach ($granteds as $granted) { $permission_detail = array(); if (!userBanned($granted['userid'], true)) { $permission_detail[] = $vbphrase['kbank_user']; } if (havePerm($granted, KBANK_PERM_ADMIN, true)) { $permission_detail[] = $vbphrase['kbank_admin_perm']; } if (havePerm($granted, KBANK_PERM_COMPANY, true)) { $permission_detail[] = $vbphrase['kbank_company']; } $permission_detail = implode('<br/>', $permission_detail); $granted_list .= "\n\t\t\t\t<tr class=\"alt1\" align=\"center\">\n\t\t\t\t\t<td>{$granted['userid']}</td>\n\t\t\t\t\t<td>{$granted['username']}</td>\n\t\t\t\t\t<td>{$permission_detail}</td>\n\t\t\t\t</tr>\n\t\t\t"; } //load granted permission - completed! //load allowed permission $allowed_list = ''; $alloweds = $vbulletin->db->query_read("\n\t\tSELECT \n\t\t\tallowed.grantid AS grantid\n\t\t\t,user.userid AS userid\n\t\t\t,user.username AS username\n\t\tFROM `" . TABLE_PREFIX . "kbank_granted_permission` as allowed\n\t\tINNER JOIN `" . TABLE_PREFIX . "user` AS `user` ON (user.userid = allowed.userid)\n\t\tWHERE allowed.allowid = {$vbulletin->userinfo['userid']}\n\t");