function newpoints_shop_admin_stats() { global $form, $db, $lang, $mybb; newpoints_lang_load("newpoints_shop"); echo "<br />"; // table $table = new Table(); $table->construct_header($lang->newpoints_shop_item, array('width' => '30%')); $table->construct_header($lang->newpoints_shop_username, array('width' => '30%')); $table->construct_header($lang->newpoints_shop_price, array('width' => '20%', 'class' => 'align_center')); $table->construct_header($lang->newpoints_shop_date, array('width' => '20%', 'class' => 'align_center')); $query = $db->simple_select('newpoints_log', '*', 'action=\'shop_purchase\'', array('order_by' => 'date', 'order_dir' => 'DESC', 'limit' => intval($mybb->settings['newpoints_shop_lastpurchases']))); while ($stats = $db->fetch_array($query)) { $data = explode('-', $stats['data']); $item = newpoints_shop_get_item($data[0]); $table->construct_cell(htmlspecialchars_uni($item['name'])); $link = build_profile_link(htmlspecialchars_uni($stats['username']), intval($stats['uid'])); $table->construct_cell($link); $table->construct_cell(newpoints_format_points($data[1]), array('class' => 'align_center')); $table->construct_cell(my_date($mybb->settings['dateformat'], intval($stats['date']), '', false) . ", " . my_date($mybb->settings['timeformat'], intval($stats['date'])), array('class' => 'align_center')); $table->construct_row(); } if ($table->num_rows() == 0) { $table->construct_cell($lang->newpoints_error_gathering, array('colspan' => 4)); $table->construct_row(); } $table->output($lang->newpoints_stats_lastpurchases); }
function newpoints_blockpost() { global $mybb, $lang, $fid; if ($mybb->settings['newpoints_main_enabled'] != 1) { return; } $forumrules = newpoints_getrules('forum', $fid); if ($forumrules['pointspost'] > $mybb->user['newpoints']) { $lang->load("newpoints"); error($lang->sprintf($lang->newpoints_not_enough_points, newpoints_format_points($forumrules['pointspost']))); } }
error($lang->newpoints_cant_donate_self); } $amount = round(floatval($mybb->input['amount']), (int) $mybb->settings['newpoints_main_decimal']); // do we have enough points? if ($amount <= 0 || $amount > $mybb->user['newpoints']) { error($lang->newpoints_invalid_amount); } // make sure we're sending points to a valid user $touser = newpoints_getuser_byname($username, 'uid,username'); if (!$touser) { error($lang->newpoints_invalid_user); } // remove points from us newpoints_addpoints($mybb->user['uid'], -$amount); // give points to user newpoints_addpoints($username, $amount, 1, 1, true); // send pm to the user if the "Send PM on donate" setting is set to Yes if ($mybb->settings['newpoints_main_donationspm'] != 0) { if ($mybb->input['reason'] != '') { newpoints_send_pm(array('subject' => $lang->newpoints_donate_subject, 'message' => $lang->sprintf($lang->newpoints_donate_message_reason, newpoints_format_points($amount), htmlspecialchars_uni($mybb->input['reason'])), 'receivepms' => 1, 'touid' => $touser['uid'])); } else { newpoints_send_pm(array('subject' => $lang->newpoints_donate_subject, 'message' => $lang->sprintf($lang->newpoints_donate_message, newpoints_format_points($amount)), 'receivepms' => 1, 'touid' => $touser['uid'])); } } // log donation newpoints_log('donation', $lang->sprintf($lang->newpoints_donate_log, $touser['username'], $touser['uid'], $amount)); $plugins->run_hooks("newpoints_do_donate_end"); redirect($mybb->settings['bburl'] . "/newpoints.php", $lang->sprintf($lang->newpoints_donated, newpoints_format_points($amount))); } $plugins->run_hooks("newpoints_terminate"); exit;
$table->construct_cell($lang->newpoints_error_gathering, array('colspan' => 4)); $table->construct_row(); } $table->output($lang->newpoints_stats_richest_users); echo "<br />"; // table $table = new Table(); $table->construct_header($lang->newpoints_stats_to, array('width' => '30%')); $table->construct_header($lang->newpoints_stats_from, array('width' => '30%')); $table->construct_header($lang->newpoints_stats_amount, array('width' => '20%', 'class' => 'align_center')); $table->construct_header($lang->newpoints_stats_date, array('width' => '20%', 'class' => 'align_center')); $query = $db->simple_select('newpoints_log', '*', 'action=\'donation\'', array('order_by' => 'date', 'order_dir' => 'DESC', 'limit' => intval($mybb->settings['newpoints_main_stats_lastdonations']))); while ($stats = $db->fetch_array($query)) { $data = explode('-', $stats['data']); $link = build_profile_link(htmlspecialchars_uni($data[0]), intval($data[1])); $table->construct_cell($link); $link = build_profile_link(htmlspecialchars_uni($stats['username']), intval($stats['uid'])); $table->construct_cell($link); $table->construct_cell(newpoints_format_points($data[2]), array('class' => 'align_center')); $table->construct_cell(my_date($mybb->settings['dateformat'], intval($stats['date']), '', false) . ", " . my_date($mybb->settings['timeformat'], intval($stats['date'])), array('class' => 'align_center')); $table->construct_row(); } if ($table->num_rows() == 0) { $table->construct_cell($lang->newpoints_error_gathering, array('colspan' => 4)); $table->construct_row(); } $table->output($lang->newpoints_stats_lastdonations); $plugins->run_hooks("newpoints_admin_stats_noaction_end"); } $plugins->run_hooks("newpoints_admin_stats_terminate"); $page->output_footer();