stderr("Err", "wtf are you trying to do "); } $invites = isset($_POST["invites"]) ? 0 + $_POST["invites"] : 0; if ($invites == 0 && ($do == "add" || $do == "remove")) { stderr("Err", "You can't remove/add 0"); } $sendpm = isset($_POST["pm"]) && $_POST["pm"] == "yes" ? true : false; $pms = array(); $users = array(); //select the users $q = mysql_query("SELECT id,invites FROM users " . ($all ? "" : "WHERE class in (" . join(",", $classes) . ")") . " ORDER BY id desc ") or sqlerr(__FILE__, __LINE__); if (mysql_num_rows($q) == 0) { stderr("Sorry", "There are no users in the class(es) you selected"); } while ($a = mysql_fetch_assoc($q)) { $users[] = "(" . $a["id"] . ", " . ($do == "remove_all" ? 0 : ($do == "add" ? $a["invites"] + $invites : mkpositive($a["invites"] - $invites))) . ")"; if ($sendpm) { $subject = sqlesc($do == "remove_all" && $do == "remove" ? "Invites removed" : "Invites added"); $body = sqlesc("Hey,\n we have decided to " . ($do == "remove_all" ? "remove all invites from your group class" : ($do == "add" ? "add {$invites} invite" . ($invites > 1 ? "s" : "") . " to your group class" : "remove {$invites} invite" . ($invites > 1 ? "s" : "") . " from your group class")) . " !\n " . $SITENAME . " staff"); $pms[] = "(0," . $a["id"] . "," . sqlesc(get_date_time()) . ",{$subject},{$body})"; } } if (sizeof($users) > 0) { $r = mysql_query("INSERT INTO users(id,invites) VALUES " . join(",", $users) . " ON DUPLICATE key UPDATE invites=values(invites) ") or sqlerr(__FILE__, __LINE__); } if (sizeof($pms) > 0) { $r1 = mysql_query("INSERT INTO messages (sender, receiver, added, subject, msg) VALUES " . join(",", $pms) . " ") or sqlerr(__FILE__, __LINE__); } if ($r && ($sendpm ? $r1 : true)) { header("Refresh: 2; url=" . $_SERVER["PHP_SELF"]); stderr("Success", "Operation done!");
stderr($lang['inviteadd_error'], sprintf($lang['inviteadd_aunknown'], str_replace('_', ' ', join(',', $a_do)))); } $invites = isset($_POST["invites"]) ? 0 + $_POST["invites"] : 0; if ($invites == 0 && ($do == "add" || $do == "remove")) { stderr($lang['inviteadd_error'], $lang['inviteadd_error2']); } $sendpm = isset($_POST["pm"]) && $_POST["pm"] == "yes" ? true : false; $pms = array(); $users = array(); //select the users $q1 = sql_query("SELECT id,invites,username FROM users " . ($all ? "" : "WHERE class in (" . join(",", $classes) . ")") . " ORDER BY id desc ") or sqlerr(__FILE__, __LINE__); if (mysql_num_rows($q1) == 0) { stderr($lang['inviteadd_error'], ""); } while ($a = mysql_fetch_assoc($q1)) { $invictus = $do == "remove_all" ? 0 : ($do == "add" ? $a["invites"] + $invites : mkpositive($a["invites"] - $invites)); $mc1->begin_transaction('MyUser_' . $a['id']); $mc1->update_row(false, array('invites' => $invictus)); $mc1->commit_transaction(900); // 15 mins $mc1->begin_transaction('user' . $a['id']); $mc1->update_row(false, array('invites' => $invictus)); $mc1->commit_transaction(900); // 15 mins // end $users[] = "(" . $a["id"] . ", " . $invictus . ")"; if ($sendpm) { $subject = sqlesc($do == "remove_all" || $do == "remove" ? $lang['inviteadd_subject_r'] : $lang['inviteadd_subject_a']); switch ($do) { case 'remove_all': $body = sprintf($lang['inviteadd_body_removeall'], $a['username'], $INSTALLER09['site_name']);
stderr("Err", "wtf are you trying to do "); } $seedbonus = isset($_POST["seedbonus"]) ? 0 + $_POST["seedbonus"] : 0; if ($seedbonus == 0 && ($do == "add" || $do == "remove")) { stderr("Err", "You can't remove/add 0"); } $sendpm = isset($_POST["pm"]) && $_POST["pm"] == "yes" ? true : false; $pms = array(); $users = array(); //== Select the users $q1 = sql_query("SELECT id,seedbonus FROM users " . ($all ? "" : "WHERE class in (" . join(",", $classes) . ")") . " ORDER BY id desc ") or sqlerr(__FILE__, __LINE__); if (mysql_num_rows($q1) == 0) { stderr("Sorry", "There are no users in the class(es) you selected"); } while ($a = mysql_fetch_assoc($q1)) { $bonus = $do == "remove_all" ? 0 : ($do == "add" ? $a["seedbonus"] + $seedbonus : mkpositive($a["seedbonus"] - $seedbonus)); $mc1->begin_transaction('user' . $a['id']); $mc1->update_row(false, array('seedbonus' => $bonus)); $mc1->commit_transaction(900); // 15 mins $mc1->begin_transaction('MyUser_' . $a['id']); $mc1->update_row(false, array('seedbonus' => $bonus)); $mc1->commit_transaction(900); // 15 mins // end $users[] = "(" . $a["id"] . ", " . $bonus . ")"; if ($sendpm) { $subject = sqlesc($do == "remove_all" && $do == "remove" ? "seedbonus removed" : "seedbonus added"); $body = sqlesc("Hey,\n we have decided to " . ($do == "remove_all" ? "remove all seedbonus from your group class" : ($do == "add" ? "add {$seedbonus} Karma point" . ($seedbonus > 1 ? "s" : "") . " to your group class" : "remove {$seedbonus} freeslot" . ($seedbonus > 1 ? "s" : "") . " from your group class")) . " !\n " . $INSTALLER09['site_name'] . " staff"); $pms[] = "(0," . $a["id"] . "," . sqlesc(time()) . ",{$subject},{$body})"; }
stderr("Err", "wtf are you trying to do "); } $freeslots = isset($_POST["freeslots"]) ? 0 + $_POST["freeslots"] : 0; if ($freeslots == 0 && ($do == "add" || $do == "remove")) { stderr("Err", "You can't remove/add 0"); } $sendpm = isset($_POST["pm"]) && $_POST["pm"] == "yes" ? true : false; $pms = array(); $users = array(); //== Select the users $q1 = mysql_query("SELECT id,freeslots FROM users " . ($all ? "" : "WHERE class in (" . join(",", $classes) . ")") . " ORDER BY id desc ") or sqlerr(__FILE__, __LINE__); if (mysql_num_rows($q1) == 0) { stderr("Sorry", "There are no users in the class(es) you selected"); } while ($a = mysql_fetch_assoc($q1)) { $users[] = "(" . $a["id"] . ", " . ($do == "remove_all" ? 0 : ($do == "add" ? $a["freeslots"] + $freeslots : mkpositive($a["freeslots"] - $freeslots))) . ")"; if ($sendpm) { $subject = sqlesc($do == "remove_all" && $do == "remove" ? "freeslots removed" : "freeslots added"); $body = sqlesc("Hey,\n we have decided to " . ($do == "remove_all" ? "remove all freeslots from your group class" : ($do == "add" ? "add {$freeslots} freeslot" . ($freeslots > 1 ? "s" : "") . " to your group class" : "remove {$freeslots} freeslot" . ($freeslots > 1 ? "s" : "") . " from your group class")) . " !\n " . $TBDEV['site_name'] . " staff"); $pms[] = "(0," . $a["id"] . "," . sqlesc(time()) . ",{$subject},{$body})"; } } if (sizeof($users) > 0) { $r = mysql_query("INSERT INTO users(id,freeslots) VALUES " . join(",", $users) . " ON DUPLICATE key UPDATE freeslots=values(freeslots) ") or sqlerr(__FILE__, __LINE__); } if (sizeof($pms) > 0) { $r1 = mysql_query("INSERT INTO messages (sender, receiver, added, subject, msg) VALUES " . join(",", $pms) . " ") or sqlerr(__FILE__, __LINE__); } if ($r && ($sendpm ? $r1 : true)) { header("Refresh: 2; url=admin.php?action=slotmanage"); stderr("Success", "Operation done!");
stderr("Err", "wtf are you trying to do "); } $freeslots = isset($_POST["freeslots"]) ? 0 + $_POST["freeslots"] : 0; if ($freeslots == 0 && ($do == "add" || $do == "remove")) { stderr("Err", "You can't remove/add 0"); } $sendpm = isset($_POST["pm"]) && $_POST["pm"] == "yes" ? true : false; $pms = array(); $users = array(); //== Select the users $q1 = sql_query("SELECT id,freeslots FROM users " . ($all ? "" : "WHERE class in (" . join(",", $classes) . ")") . " ORDER BY id desc ") or sqlerr(__FILE__, __LINE__); if (mysql_num_rows($q1) == 0) { stderr("Sorry", "There are no users in the class(es) you selected"); } while ($a = mysql_fetch_assoc($q1)) { $slots = $do == "remove_all" ? 0 : ($do == "add" ? $a["freeslots"] + $freeslots : mkpositive($a["freeslots"] - $freeslots)); $mc1->begin_transaction('MyUser_' . $a['id']); $mc1->update_row(false, array('freeslots' => $slots)); $mc1->commit_transaction(900); // 15 mins $mc1->begin_transaction('user' . $a['id']); $mc1->update_row(false, array('freeslots' => $slots)); $mc1->commit_transaction(900); // 15 mins // end $users[] = "(" . $a["id"] . ", " . $slots . ")"; if ($sendpm) { $subject = sqlesc($do == "remove_all" && $do == "remove" ? "freeslots removed" : "freeslots added"); $body = sqlesc("Hey,\n we have decided to " . ($do == "remove_all" ? "remove all freeslots from your group class" : ($do == "add" ? "add {$freeslots} freeslot" . ($freeslots > 1 ? "s" : "") . " to your group class" : "remove {$freeslots} freeslot" . ($freeslots > 1 ? "s" : "") . " from your group class")) . " !\n " . $INSTALLER09['site_name'] . " staff"); $pms[] = "(0," . $a["id"] . "," . sqlesc(time()) . ",{$subject},{$body})"; }