function umc_trivia_new() { global $UMC_USER; $player = $UMC_USER['username']; $args = $UMC_USER['args']; if ($player != 'uncovery') { // umc_error('under maintenance'); } if (isset($args[2]) && is_numeric($args[2]) && $args[2] > 1 && $args[2] <= 20) { $questions = $args[2]; } else { umc_error("{red}You need to specify the amount of questions (2-20) to be asked before someone wins. "); } if (isset($args[3]) && is_numeric($args[3]) && $args[3] >= 10 && $args[3] <= 100) { $price = $args[3]; } else { umc_error("{red}You need to specify the price users pay for each answer (10-100 Uncs)."); } // check if there is a quiz running $quiz_arr = umc_trivia_get_current_quiz(); umc_header("Trivia Quiz"); if (!$quiz_arr) { umc_echo("Starting a new quiz with {$questions} questions and {$price} Uncs per question!"); } else { $master = $quiz_arr['master']; if ($player != $master) { if (!in_array($master, $UMC_USER['online_players'])) { umc_echo("{$master} has been running a quiz, but he is not online anymore, so closing it now..."); umc_trivia_close_quiz($quiz_arr); } else { umc_error("{$master} is running a quiz already, it has to stop first!"); } } else { if ($player == $master) { umc_error("A quiz is already running, use /trivia find"); } } } // create the quiz $sql = "INSERT INTO minecraft_quiz.quizzes (`master`, `start`, `questions`, `price`) VALUES ('{$player}', NOW(),'{$questions}','{$price}');"; umc_mysql_query($sql); $id = umc_mysql_insert_id(); // announce quiz and send first question umc_footer(); umc_ws_cmd("ch qm o &3[Trivia]&f &4Trivia Quiz No {$id} started: &4{$questions} questions, {$price} Uncs&f per given answer&4"); umc_ws_cmd("ch qm o &3[Trivia]&f Quizmaster today is &4{$player}&f!"); umc_ws_cmd("ch qm u &3[Trivia]&f There is a new trivia quiz starting, do &2/ch join o&f to see it!"); umc_trivia_find_question(); umc_log('trivia', 'start', "{$player} started a trivia with {$questions} questions for {$price} uncs"); }
function umc_get_worldguard_id($type, $name, $add = false) { XMPP_ERROR_trace(__FUNCTION__, func_get_args()); $valid_terms = array('world', 'user'); if (!in_array($type, $valid_terms)) { XMPP_ERROR_trigger("Error trying to get a type ID of unknown type: {$type}"); return false; } $name_str = 'name'; if ($type == 'user') { $name = umc_uuid_getone($name, 'uuid'); $name_str = 'uuid'; } $sql = "SELECT id FROM minecraft_worldguard.{$type} WHERE {$name_str} LIKE '{$name}';"; $D = umc_mysql_fetch_all($sql); if (count($D) > 0) { $row = $D[0]; return $row['id']; } else { if ($type == 'user' && $add) { $uuid = umc_uuid_getone($name, 'uuid'); $sql = "INSERT INTO minecraft_worldguard.user (uuid) VALUES ('{$uuid}');"; $rst = umc_mysql_query($sql); $user_id = umc_mysql_insert_id(); umc_mysql_free_result($rst); if (!$user_id) { XMPP_ERROR_trigger("Error with username '{$name}/{$uuid}'. User does not exist and could not create! (umc_get_worldguard_id)"); return false; } return $user_id; // No such world or player. } else { if ($type == 'user' && !$add) { return false; } else { if ($type == 'world') { XMPP_ERROR_trigger("Error with {$type} '{$name}'. {$type} does not exist! (umc_get_worldguard_id)"); return false; } } } } }
function umc_vote_web() { XMPP_ERROR_trace(__FUNCTION__, func_get_args()); global $vote_ranks, $UMC_DOMAIN, $UMC_USER; $lvl_percent = array('a' => 0.3, 'd' => 0.4, 'm' => 0.7, 'e' => 1); $out = umc_vote_stats(); // return "<h1>Sorry, due to technical issues, voting is temporarily suspended</h1>"; if (!$UMC_USER) { $out = "Please <a href=\"{$UMC_DOMAIN}/wp-login.php\">login</a> to vote!"; return $out; } else { $out .= "<h2>Proposals & Votes</h2>"; $username = $UMC_USER['username']; $uuid = $UMC_USER['uuid']; $user_lvl = $UMC_USER['userlevel']; } $user_lvl_id = $vote_ranks[$user_lvl]['lvl']; if ($user_lvl_id < 3) { // start voting only for designers return "Sorry, you need to be Designer or above to vote!"; } // get user numbers for levels $lvl_str_arr = array('a' => "'Architect', 'ArchitectDonator', 'ArchitectDonatorPlus'", 'd' => "'Designer', 'DesignerDonator', 'DesignerDonatorPlus'", 'm' => "'Master', 'MasterDonator', 'MasterDonatorPlus'", 'e' => "'Elder', 'ElderDonator', 'ElderDonatorPlus'"); $lvl_amounts = array('a' => 0, 'd' => 0, 'm' => 0, 'e' => 0); $lvl_min_req = array('a' => 0, 'd' => 0, 'm' => 0, 'e' => 0); foreach ($lvl_str_arr as $lvl_code => $lvl_str) { // This takes all lots where the owners are in one of the user 4 levels that can vote $sql = "SELECT user_id, UUID.UUID as uuid, username FROM `minecraft_worldguard`.`region_players`\r\n LEFT JOIN minecraft_worldguard.user ON region_players.user_id=user.id\r\n LEFT JOIN minecraft_srvr.UUID ON minecraft_worldguard.user.uuid=minecraft_srvr.UUID.UUID\r\n LEFT JOIN minecraft_srvr.permissions_inheritance ON minecraft_srvr.UUID.UUID=minecraft_srvr.permissions_inheritance.child\r\n WHERE parent IN ({$lvl_str}) AND type=1 AND owner=1 GROUP BY user_id;"; $C = umc_mysql_fetch_all($sql); // count all the people in the userlevel to know how many votes are needed $lvl_amounts[$lvl_code] = count($C); } // calc needed votes $full_vote = $lvl_amounts['e'] * $vote_ranks['Elder']['vote']; foreach ($lvl_amounts as $lvl => $lvl_amount) { $lvl_min_req[$lvl] = round($full_vote * $lvl_percent[$lvl]); } // TODO insert here a cleanup process that deletes old votes of non-promoted users $proposed = filter_input(INPUT_POST, 'proposal', FILTER_SANITIZE_STRING); if (isset($proposed) && strlen($proposed) > 1) { $proposed = umc_check_user($proposed); if (!$proposed) { $out .= "Sorry {$username}, but you need to input an existing user to propose!"; } else { $proposed_data = umc_uuid_getboth($proposed, 'username'); $proposed_username = $proposed_data['username']; $proposed_uuid = $proposed_data['uuid']; // what user level is it? $prop_lvl = umc_get_uuid_level($proposed_uuid); $prop_lvl_id = $vote_ranks[$prop_lvl]['lvl']; // check if the user was recently promoted $sql = "SELECT UNIX_TIMESTAMP(`date`) as mysql_ts FROM minecraft_srvr.proposals WHERE `uuid` LIKE '{$proposed_uuid}' ORDER BY `date` DESC;"; $D = umc_mysql_fetch_all($sql); $row = array(); if (count($D) > 0) { $row = $D[0]; // get the first (latest) entry } else { $row['mysql_ts'] = 0; } if (time() - $row['mysql_ts'] < 5270400) { $out .= "<strong>Sorry {$username}, but {$proposed_username} was last proposed for promotion less than 2 months ago!</strong>"; } else { if ($user_lvl_id < 6 && $user_lvl_id < $prop_lvl_id + 1) { $out .= "<strong>Sorry {$username}, but you need to be at a higher level to propose {$proposed_username} for a higher rank!</strong>"; } else { if ($prop_lvl_id > 5) { $out .= "<strong>Sorry {$username}, but {$proposed_username} has reached max level already!</strong>"; } else { if (umc_user_countlots($proposed) < 1) { // is this an active user? $out .= "<strong>Sorry {$username}, but you can only propose users who have a lot!</strong>"; } else { if ($prop_lvl_id < 2) { $out .= "<strong>Sorry {$username}, but you can only propose users who are at least Citizen level!</strong>"; } else { if ($username == $proposed) { $out .= "<strong>Sorry {$username}, but you cannot propose yourself!</strong>"; } else { // ok to be promoted $ins_proposal_sql = "INSERT INTO `minecraft_srvr`.`proposals` (`pr_id`, `uuid`, `proposer_uuid`, `date`, `status`)\r\n VALUES (NULL, '{$proposed_uuid}', '{$uuid}', NOW(), 'voting');"; umc_mysql_query($ins_proposal_sql); $pr_id = umc_mysql_insert_id(); $sql = "INSERT INTO minecraft_srvr.`proposals_votes` (`pr_id`, `voter_uuid`, `date`, `vote`) VALUES ({$pr_id}, '{$uuid}', NOW(), 1);"; umc_mysql_query($sql, true); $out .= "Thanks {$username}, {$proposed_username} as been submitted for voting, and your vote has been set, too!"; if ($prop_lvl_id == 5) { // we propose a Master for promotion, inform all elders $sql = "SELECT user_email, UUID, username FROM minecraft_srvr.`UUID`\r\n LEFT JOIN minecraft.wp_usermeta ON UUID.UUID=meta_value\r\n LEFT JOIN minecraft.wp_users ON user_id=ID\r\n WHERE `userlevel` LIKE 'Elder%' AND lot_count > 0"; $D = umc_mysql_fetch_all($sql); $subject = "{$proposed} proposed for Elder, please vote!"; $content = "Dear Elder, \r\n\r\nthe user {$proposed} has been proposed to be promoted to Elder. Please go to\r\n\r\n{$UMC_DOMAIN}/vote-for-users/\r\n\r\n" . "and vote on this proposal. Please either SUPPORT or VETO the proposal.\r\n" . "Please note that the vote will be closed as 'failed' unless all Elders cast a vote within the coming 2 months.\r\n" . "Thanks a lot for supporting Uncovery Minecraft!\r\n\r\nBest regards,\r\nUncovery"; $headers = 'From:minecraft@uncovery.me' . "\r\nReply-To:minecraft@uncovery.me\r\n" . 'X-Mailer: PHP/' . phpversion(); mail('*****@*****.**', $subject, $content, $headers); foreach ($D as $row) { mail($row['user_email'], '[Uncovery Minecraft] ' . $subject, $content, $headers); umc_mail_send_backend($row['UUID'], 'ab3bc877-4434-45a9-93bd-bab6df41eabf', $content, $subject, 'send'); // send from uncovery's UUID } } } } } } } } } } // propose new person if ($user_lvl_id > 3) { $out .= "<form action=\"\" method=\"post\">\n" . "<span>Propose a person to be upgraded: <input type=\"text\" name=\"proposal\"> " . "<input type=\"submit\" name=\"proposebutton\" value=\"Propose user!\">" . "</span></form>"; } else { $out .= "(Since your level is too low, you cannot propose users yet.)"; } // close old proposals $upd_sql = "UPDATE minecraft_srvr.proposals SET `status`='failed' WHERE status = 'voting' AND date < NOW() - INTERVAL 2 month"; umc_mysql_query($upd_sql, true); // list proposed people $sql = "SELECT UUID.username, status, pr_id, date, proposals.uuid FROM minecraft_srvr.proposals\r\n LEFT JOIN minecraft_srvr.UUID ON proposals.uuid=UUID.UUID\r\n WHERE status IN ('voting','closed') ORDER BY `date` ASC;"; $D = umc_mysql_fetch_all($sql); $header = ''; if ($username == 'uncovery') { $header = '<th>Score</th>'; } $out .= "<br><form action=\"\" method=\"post\">\n<input type=\"hidden\" name=\"uuid\" value=\"{$uuid}\">\n<input type=\"hidden\" name=\"voting\" value=\"true\">\n<table>\n" . "<tr><th>Proposal</th><th>Date</th><th>Current Level</th><th>Your Vote</th><th>Vote date</th>{$header}</tr>\n"; $proposals = 0; $upgraded_users = array(); foreach ($D as $row) { $prop_lvl = umc_get_userlevel($row['username']); $prop_status = $row['status']; $prop_lvl_id = $vote_ranks[$prop_lvl]['lvl']; $proposed = $row['uuid']; $proposed_name = $row['username']; // check if user is allowed to vote for this person if ($user_lvl_id <= $prop_lvl_id) { continue; } $proposals++; $sel_support = $sel_veto = ''; $sel_none = " selected=\"selected\""; $vote_date = "n/a"; $pr_id = $row['pr_id']; // check if vote has been cast right now if (isset($_POST['voting']) && $_POST['uuid'] == $uuid) { if ($prop_status == 'closed' && $username == 'uncovery' && isset($_POST['CL_' . $pr_id]) && $_POST['CL_' . $pr_id] != 'closed') { $new_vote = filter_input(INPUT_POST, 'CL_' . $pr_id, FILTER_SANITIZE_STRING); // var_dump($_POST); $sql = "UPDATE minecraft_srvr.`proposals` SET `status` = '{$new_vote}' WHERE `proposals`.`pr_id`={$pr_id} LIMIT 1;"; umc_mysql_query($sql); // echo $sql; if ($new_vote == 'success') { $cmd = "pex promote {$proposed}"; umc_exec_command($cmd, 'asConsole', false); umc_exec_command($cmd, 'asConsole', false); umc_exec_command($cmd, 'asConsole', false); $upgraded_users[$proposed_name] = $prop_lvl; umc_log('voting', "promotion", "{$proposed_name} ({$proposed}) was promoted from {$prop_lvl} through votes"); } continue; } else { if ($prop_status != 'closed') { $new_vote = filter_input(INPUT_POST, 'PR_' . $pr_id, FILTER_SANITIZE_STRING); $sel_support = $sel_veto = $sel_none = ''; // find existing votes $sql = "SELECT * FROM minecraft_srvr.`proposals_votes` WHERE pr_id={$pr_id} and voter_uuid='{$uuid}';"; $C = umc_mysql_fetch_all($sql); if (count($C) > 0) { $row_check = $C[0]; $vote_id = $row_check['vote_id']; if ($new_vote == 0) { $sql = "DELETE FROM minecraft_srvr.`proposals_votes` WHERE pr_id={$pr_id} and voter_uuid='{$uuid}';"; umc_mysql_query($sql, true); } else { if ($row_check['vote'] != $new_vote) { $sql = "REPLACE INTO minecraft_srvr.`proposals_votes` (`vote_id`, `pr_id`, `voter_uuid`, `date`, `vote`)\r\n\t\t\t VALUES ({$vote_id}, {$pr_id}, '{$uuid}', NOW(), {$new_vote});"; umc_mysql_query($sql, true); } } } else { if ($new_vote != 0) { $sql = "INSERT INTO minecraft_srvr.`proposals_votes` (`pr_id`, `voter_uuid`, `date`, `vote`)\r\n VALUES ({$pr_id}, '{$uuid}', NOW(), {$new_vote});"; umc_mysql_query($sql, true); } } } else { if ($prop_status == 'closed') { // a user tried to vote on a closed vote... what to do? } } } } // load existing votes $total_score = 0; $sql = "SELECT date, voter_uuid, UUID.username, vote, date FROM minecraft_srvr.proposals_votes\r\n LEFT JOIN minecraft_srvr.UUID ON voter_uuid=UUID.UUID\r\n WHERE pr_id={$pr_id} AND vote <> 0 ORDER BY date DESC;"; $R = umc_mysql_fetch_all($sql); $email_close = "{$UMC_DOMAIN}/vote-for-users/\n"; foreach ($R as $row_calc) { $vote_date = $row_calc['date']; $voter_lvl = umc_get_uuid_level($row_calc['voter_uuid']); $voter_weight = $vote_ranks[$voter_lvl]['vote']; $voter_score = $voter_weight * $row_calc['vote']; $total_score = $total_score + $voter_score; if ($username == 'uncovery') { $out .= "<tr><td>Vote:</td><td>{$row_calc['username']}</td><td>{$voter_lvl}</td><td>{$row_calc['vote']}</td><td>{$row_calc['date']}</td><td>{$voter_score}</td></tr>\n"; // prepare email to send if this will be closed } $email_close .= "Vote: {$row_calc['username']} ({$voter_lvl}) on {$row_calc['date']} gave points: {$voter_score}\n"; } // close votes that have enough points $lvl_code = $vote_ranks[$prop_lvl]['code']; $min_req = $lvl_min_req[$lvl_code]; if (abs($total_score) >= $min_req && $prop_status == 'voting') { // close vote $sql = "UPDATE minecraft_srvr.`proposals` SET `status` = 'closed' WHERE `proposals`.`pr_id`={$pr_id} LIMIT 1 "; umc_mysql_query($sql, true); // send email with status report $email_text = $email_close . "Total Score: {$total_score}\n\rRequired: " . abs($lvl_min_req[$lvl_code]); $headers = 'From:minecraft@uncovery.me' . "\r\nReply-To:minecraft@uncovery.me\r\n" . 'X-Mailer: PHP/' . phpversion(); mail('*****@*****.**', "Voting closed for " . $row['username'], $email_text, $headers); $prop_status = 'closed'; } else { if ($prop_status == 'closed' && $total_score < abs($lvl_min_req[$lvl_code])) { //$sql = "UPDATE minecraft_srvr.`proposals` SET `status` = 'voting' WHERE `proposals`.`pr_id`=$pr_id LIMIT 1 "; //mysql_query($sql); } } // show total score if ($username == 'uncovery') { $header = "<td><strong>{$total_score}</strong> (of {$min_req})</td>"; } // load your own score $sql = "SELECT * FROM minecraft_srvr.proposals_votes WHERE voter_uuid = '{$uuid}' AND pr_id={$pr_id}"; $D = umc_mysql_fetch_all($sql); $vote_date = "n/a"; if (count($D) > 0) { $row_votes = $D[0]; $vote_id = $row_votes['vote_id']; $your_vote = $row_votes['vote']; $vote_date = $row_votes['date']; // check if an alternative vote has been cast right now if ($your_vote == 1) { $sel_support = " selected=\"selected\""; } else { if ($your_vote == -1) { $sel_veto = " selected=\"selected\""; } } } // show voting buttons $vote_close = ''; $min_req = $lvl_min_req[$lvl_code]; if ($prop_status == 'closed') { $vote = "Voting closed!<input type=\"hidden\" name=\"PR_{$pr_id}\" value=\"done\">"; if ($username == 'uncovery') { $vote_date = "<select name=\"CL_{$pr_id}\"><option value=\"closed\">Voting closed</option><option value=\"success\">Upgrade</option><option value=\"failed\">Fail</option></select>"; } } else { $vote = "<select name=\"PR_{$pr_id}\"><option value=\"0\" {$sel_none}>Abstain</option><option value=\"1\"{$sel_support}>Supported</option><option value=\"-1\"{$sel_veto}>Vetoed</option></select>"; } $vote_lvl = umc_get_userlevel($row['username']); $out .= "<tr><td><strong><a href=\"{$UMC_DOMAIN}/users-2/?u={$row['username']}\">{$row['username']}</a></strong></td><td>{$row['date']}</td><td>{$prop_lvl}</td><td>{$vote}</td><td>{$vote_date}</td>{$header}</tr>\n"; } if ($proposals == 0) { $out .= "<tr><td colspan=6>There are no proposals that you can vote for at the moment!</td><tr>\n"; } $out .= "</table>\n<input type=\"submit\" name=\"votebutton\" value=\"Submit votes!\">\n</form><br>\n"; // process successful votes, create post to blog if (count($upgraded_users) > 0) { $text = "Please see the latest upgrades from the voting system:<ul>"; $userlist_arr = array(); foreach ($upgraded_users as $upgraded_user => $userlvl) { $nextrank = $vote_ranks[$userlvl]['next']; $text .= "<li>{$upgraded_user} (from {$userlvl} to {$nextrank})</li>"; $userlist_arr[] = $upgraded_user; } $userlist = implode(", ", $userlist_arr); $text .= "</ul>Congratz and thanks to all voters!"; $post = array('comment_status' => 'open', 'ping_status' => 'closed', 'post_author' => 1, 'post_content' => $text, 'post_status' => 'publish', 'post_title' => "Today's upgrades: {$userlist}", 'post_type' => 'post'); wp_insert_post($post); } return $out; }
function umc_mail_send_backend($recipient_uuid, $sender_uuid, $message_raw, $subject_raw, $action, $msg_id = false) { $recipient = umc_mysql_real_escape_string($recipient_uuid); $sender = umc_mysql_real_escape_string($sender_uuid); $message = umc_mysql_real_escape_string($message_raw); $subject = umc_mysql_real_escape_string($subject_raw); $status = 'draft'; if ($action == 'Send') { $status = 'sent'; } if (isset($msg_id)) { $sql = "UPDATE minecraft_srvr.user_mail\r\n SET `sender_uuid`={$sender}, `recipient_uuid`={$recipient}, `title`={$subject}, `message`={$message}, `status`='{$status}', `date_time`=NOW()\r\n WHERE msg_id={$msg_id};"; } else { $sql = "INSERT INTO minecraft_srvr.user_mail (`sender_uuid`, `recipient_uuid`, `title`, `message`, `status`, `date_time`)\r\n VALUES ({$sender},{$recipient},{$subject},{$message},'{$status}', NOW());"; } umc_mysql_query($sql, true); if ($action == 'Send') { $mail_id = umc_mysql_insert_id(); umc_mail_send_alert($mail_id); } }
/** * Create a request * * @global type $UMC_USER * @return type */ function umc_do_request() { global $UMC_USER; $player = $UMC_USER['username']; $uuid = $UMC_USER['uuid']; $args = $UMC_USER['args']; // this returns a item_array already $item_check = umc_sanitize_input($args[2], 'item'); if (!$item_check) { umc_error("{red}Unknown item ({yellow}{$args['2']}{red}). Try using {yellow}/search{red} to find names."); } else { XMPP_ERROR_trace("item_check", $item_check); $item = umc_goods_get_text($item_check['item_name'], $item_check['type']); } $item_name = $item['item_name']; $type = $item['type']; $meta = ''; $meta_txt = ''; $do_check = false; $pos = array_search('check', $args); if ($pos) { $do_check = true; array_splice($args, $pos, 1); } // TODO: This should be checking for the item type instead of assuming 0 //if ($UMC_ITEMS[$type][0]['avail'] == false) { // umc_error("{red}Sorry, this item (ID $type) is unavailable in the game!",true); //} $sql = "SELECT * FROM minecraft_iconomy.request\r\n WHERE item_name='{$item_name}' AND damage='{$type}' AND meta='{$meta}' AND uuid='{$uuid}';"; $sql_data = umc_mysql_fetch_all($sql); if (count($sql_data) == 0) { $row = false; } else { $row = $sql_data[0]; } // buy item at same price, check if exists if (!isset($args[3])) { if ($row) { $price = $row['price']; } else { umc_error("{red}Since you do not have the same item already in the shop you need to specify a price.;"); } } else { $price = umc_sanitize_input($args[3], 'price'); } // check if an argument was given for amount. $amount = umc_sanitize_input($args[4], 'amount'); if ($amount == NULL) { // buying 0 amount available is not possible umc_error("{red}You need to specify an amount, too!;"); } $cost = $price * $amount; // if there is an existing row, recalculate price accordingly if ($row) { // give money back from the original request $refund = $row['amount'] * $row['price']; // calculate how much this one + the old item amount would cost $new_cost = ($amount + $row['amount']) * $price; // do the sum for the balance, can be negative $cost = $new_cost - $refund; } $balance = umc_money_check($uuid); if ($balance < $cost) { umc_error("{red}[!]{gray} Insufficient funds ({white}{$cost}{gray} needed). " . "{purple}[?]{white} Why don't you vote for the server and try again?"); } if ($do_check) { if ($row) { $sum = $amount + $row['amount']; umc_echo("{white}[?]{gray} This would update your existing request to " . "{yellow}{$sum} {$item['full']}{darkgray} @ {cyan}{$price}{gray} each."); } else { umc_echo("{white}[?]{gray} This would create a new request for " . "{yellow}{$amount} {$item['full']}{darkgray} @ {cyan}{$price}{gray} each."); } if ($cost > 0) { umc_echo("{white}[?]{white} Your account would be charged {cyan}{$cost}{gray} Uncs."); } else { umc_echo("{white}[?]{white} Your account would be credited {cyan}" . $cost * -1 . "{gray} Uncs."); } return; } $sum = 0; $posted_id = 0; if ($row) { // Update existing listing $sum = $amount + $row['amount']; umc_echo("{green}[+]{gray} You already requested {yellow}" . "{$row['amount']} {$item['full']}{gray}. Adding another {yellow}{$amount}{gray}."); $sql = "UPDATE minecraft_iconomy.`request` SET `amount` = amount + '{$amount}', price='{$price}' WHERE id={$row['id']};"; $rst = umc_mysql_query($sql); $posted_id = $row['id']; } else { // Create a new listing. $sum = $amount; umc_echo("{green}[+]{gray} You are now requesting {yellow}" . "{$sum} {$item['full']}{gray} in the shop."); $sql = "INSERT INTO minecraft_iconomy.`request` (`id` ,`damage` ,`uuid` ,`item_name` ,`price` ,`amount` ,`meta`)\r\n VALUES (NULL , '{$type}', '{$uuid}', '{$item['item_name']}', '{$price}', '{$amount}', '{$meta}');"; //XMPP_ERROR_trigger($sql); $rst = umc_mysql_query($sql); $posted_id = umc_mysql_insert_id(); } if ($cost > 0) { umc_echo("{yellow}[\$]{white} Your account has been charged {cyan}{$cost}{gray} Uncs."); } else { umc_echo("{green}[\$]{white} Your account has been credited {cyan}" . $cost * -1 . "{gray} Uncs."); } umc_money($player, false, $cost); umc_announce("{gold}{$player}{gray} is {red}requesting to buy {yellow}{$sum}{$meta_txt}{green} " . "{$item['full']}{darkgray} @ {cyan}{$price}{gray} each{darkgray}, shop-id {gray}{$posted_id}"); }