Exemple #1
0
$consoleObj = new ConsoleOption($mysqli);
$cID = $consoleObj->findConsoleIDByName("View Your Squads");
$consoleObj->select($cID);
$consoleInfo = $consoleObj->get_info_filtered();
$member = new Member($mysqli);
$member->select($_SESSION['btUsername']);
$arrSquadPrivileges = $squadObj->arrSquadPrivileges;
$squadObj = new Squad($mysqli);
$squadAppObj = new Basic($mysqli, "squadapps", "squadapp_id");
// Check Login
$LOGIN_FAIL = true;
if ($member->authorizeLogin($_SESSION['btPassword']) && $member->hasAccess($consoleObj)) {
    $LOGIN_FAIL = false;
    $memberInfo = $member->get_info_filtered();
    if ($squadObj->select($_POST['sID']) && $squadObj->memberHasAccess($memberInfo['member_id'], "acceptapps") && $squadAppObj->select($_POST['saID'])) {
        $squadInfo = $squadObj->get_info_filtered();
        $squadAppInfo = $squadAppObj->get_info();
        $squadRankList = $squadObj->getRankList();
        if ($squadAppInfo['squad_id'] == $_POST['sID'] && $squadAppInfo['status'] == 0 && count($squadRankList) > 1) {
            if ($_POST['action'] == "accept") {
                $squadRankKey = count($squadRankList) - 1;
                $newMemberSquadRank = $squadRankList[$squadRankKey];
                $squadAppObj->update(array("dateaction", "status", "squadmember_id"), array(time(), "1", $memberInfo['member_id']));
                $arrColumns = array("squad_id", "member_id", "squadrank_id", "datejoined");
                $arrValues = array($squadAppInfo['squad_id'], $squadAppInfo['member_id'], $newMemberSquadRank, time());
                $squadObj->objSquadMember->addNew($arrColumns, $arrValues);
                $intViewSquadsCID = $consoleObj->findConsoleIDByName("View Your Squads");
                $member->select($squadAppInfo['member_id']);
                $member->postNotification("Congratulations!  Your application for the squad <b>" . $squadInfo['name'] . "</b> has been approved.  View the Squads section of <a href='" . $MAIN_ROOT . "members'>My Account</a> to <a href='" . $MAIN_ROOT . "members/console.php?cID=" . $intViewSquadsCID . "'>View Your Squads</a>.");
                $mysqli->query("DELETE FROM " . $dbprefix . "squadinvites WHERE receiver_id = '" . $squadAppInfo['member_id'] . "'");
                echo "\n\t\t\t\t\t<script type='text/javascript'>\n\t\t\t\t\t\t\$(document).ready(function() {\n\t\t\t\t\t\t\t\$('#actionMessage').html(\"<p class='main' align='center' style='font-weight: bold'><span class='successFont'>Squad Application Approved!</span></p>\");\n\t\t\t\t\t\t});\n\t\t\t\t\t</script>\n\t\t\t\t";
include_once "../../../classes/member.php";
include_once "../../../classes/rank.php";
include_once "../../../classes/tournament.php";
include_once "../../../classes/squad.php";
$consoleObj = new ConsoleOption($mysqli);
$cID = $consoleObj->findConsoleIDByName("Manage Tournaments");
$consoleObj->select($cID);
$member = new Member($mysqli);
$member->select($_SESSION['btUsername']);
$countErrors = 0;
$dispError = "";
$tournamentObj = new Tournament($mysqli);
$squadObj = new Squad($mysqli);
if ($member->authorizeLogin($_SESSION['btPassword']) && $squadObj->select($_POST['squadID']) && $tournamentObj->objTeam->select($_POST['teamID']) && $member->hasAccess($consoleObj)) {
    $memberInfo = $member->get_info_filtered();
    $teamInfo = $tournamentObj->objTeam->get_info_filtered();
    $tournamentObj->select($teamInfo['tournament_id']);
    $tournamentInfo = $tournamentObj->get_info();
    if ($tournamentInfo['member_id'] == $memberInfo['member_id'] || $memberInfo['rank_id'] == 1 || $tournamentObj->isManager($memberInfo['member_id'])) {
        $arrSquadMembers = $squadObj->getMemberListSorted();
        echo "\n\t\t\t<input type='hidden' value='" . $squadObj->get_info_filtered("name") . "' id='squadName'>\n\t\t\t<div id='squadMemberList' style='max-height: 200px; overflow-y: auto'>\n\t\t\t<table class='formTable' style='width: 95%'>\n\t\t\t\t<tr>\n\t\t\t\t\t<td></td>\n\t\t\t\t\t<td class='main' align='center'>\n\t\t\t\t\t\t<a href='javascript:void(0)' id='checkAllLink'>Check All</a>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t";
        foreach ($arrSquadMembers as $value) {
            if ($member->select($value)) {
                $tempMemberInfo = $member->get_info_filtered();
                echo "\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class='formLabel'>" . $tempMemberInfo['username'] . "</td>\n\t\t\t\t\t\t<td class='main' align='center'><input type='checkbox' value='" . $tempMemberInfo['member_id'] . "'></td>\n\t\t\t\t\t</tr>\n\t\t\t\t";
            }
        }
        $member->select($memberInfo['member_id']);
        echo "\n\t\t\t</table>\n\t\t\t</div>\n\t\t\t\n\t\t\t<script type='text/javascript'>\n\t\t\t\n\t\t\t\tvar intCheckAll = 1;\n\t\t\t\n\t\t\t\t\$(document).ready(function() {\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\$('#checkAllLink').click(function() {\n\t\t\t\t\t\n\t\t\t\t\t\t\$('#squadMemberList input[type=checkbox]').each(function() {\n\t\t\t\t\t\t\tif(intCheckAll == 1) {\n\t\t\t\t\t\t\t\t\$(this).attr('checked', true);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\$(this).attr('checked', false);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t\t\n\t\t\t\t\t\tif(intCheckAll == 1) {\n\t\t\t\t\t\t\tintCheckAll = 0;\n\t\t\t\t\t\t\t\$('#checkAllLink').html('Uncheck All');\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tintCheckAll = 1;\n\t\t\t\t\t\t\t\$('#checkAllLink').html('Check All');\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t});\n\t\t\t\t\n\t\t\t\t});\n\t\t\t\n\t\t\t</script>\n\t\t\t\n\t\t";
    }
}
Exemple #3
0
 $multiMemPMInfo = $multiMemPMObj->get_info();
 if ($multiMemPMInfo['grouptype'] != "" && !in_array($multiMemPMInfo['group_id'], $arrGroups[$multiMemPMInfo['grouptype']])) {
     $arrGroups[$multiMemPMInfo['grouptype']][] = $multiMemPMInfo['group_id'];
     switch ($multiMemPMInfo['grouptype']) {
         case "rankcategory":
             $dispName = $rankCatObj->select($multiMemPMInfo['group_id']) ? $rankCatObj->get_info_filtered("name") . " - Category" : "";
             $_SESSION['btComposeList'][$pmSessionID]['rankcategory'][] = $multiMemPMInfo['group_id'];
             $composeListJS .= "\$('#composeTextBox').before(\"<div class='pmComposeSelection' data-composeid = 'rankcategory_" . $multiMemPMInfo['group_id'] . "'><div style='float: left'>" . $dispName . "</div><div class='pmComposeSelectionDelete' data-deleteid = 'rankcategory_" . $multiMemPMInfo['group_id'] . "'>&times;</div></div>\");\n\t\t\t\t\t\t\t\t\t";
             break;
         case "rank":
             $dispName = $member->objRank->select($multiMemPMInfo['group_id']) ? $member->objRank->get_info_filtered("name") . " - Rank" : "";
             $_SESSION['btComposeList'][$pmSessionID]['rank'][] = $multiMemPMInfo['group_id'];
             $composeListJS .= "\$('#composeTextBox').before(\"<div class='pmComposeSelection' data-composeid = 'rank_" . $multiMemPMInfo['group_id'] . "'><div style='float: left'>" . $dispName . "</div><div class='pmComposeSelectionDelete' data-deleteid = 'rank_" . $multiMemPMInfo['group_id'] . "'>&times;</div></div>\");\n\t\t\t\t\t\t\t\t\t";
             break;
         case "squad":
             $dispName = $squadObj->select($multiMemPMInfo['group_id']) ? $squadObj->get_info_filtered("name") . " Members" : "";
             $_SESSION['btComposeList'][$pmSessionID]['squad'][] = $multiMemPMInfo['group_id'];
             $composeListJS .= "\$('#composeTextBox').before(\"<div class='pmComposeSelection' data-composeid = 'squad_" . $multiMemPMInfo['group_id'] . "'><div style='float: left'>" . $dispName . "</div><div class='pmComposeSelectionDelete' data-deleteid = 'squad_" . $multiMemPMInfo['group_id'] . "'>&times;</div></div>\");\n\t\t\t\t\t\t\t\t\t";
             break;
         case "tournament":
             $dispName = $tournamentObj->select($multiMemPMInfo['group_id']) ? $tournamentObj->get_info_filtered("name") . " Players" : "";
             $_SESSION['btComposeList'][$pmSessionID]['tournament'][] = $multiMemPMInfo['group_id'];
             $composeListJS .= "\$('#composeTextBox').before(\"<div class='pmComposeSelection' data-composeid = 'tournament_" . $multiMemPMInfo['group_id'] . "'><div style='float: left'>" . $dispName . "</div><div class='pmComposeSelectionDelete' data-deleteid = 'tournament_" . $multiMemPMInfo['group_id'] . "'>&times;</div></div>\");\n\t\t\t\t\t\t\t\t\t";
             break;
     }
 } elseif ($multiMemPMInfo['grouptype'] == "") {
     $member->select($multiMemPMInfo['member_id']);
     $member->objRank->select($multiMemPMInfo['rank_id']);
     $_SESSION['btComposeList'][$pmSessionID]['member'][] = $multiMemPMInfo['member_id'];
     $dispName = $member->objRank->get_info_filtered("name") . " " . $member->get_info_filtered("name");
     $composeListJS .= "\$('#composeTextBox').before(\"<div class='pmComposeSelection' data-composeid = 'member_" . $multiMemPMInfo['group_id'] . "'><div style='float: left'>" . $dispName . "</div><div class='pmComposeSelectionDelete' data-deleteid = 'member_" . $multiMemPMInfo['group_id'] . "'>&times;</div></div>\");\n\t\t\t\t\t\t\t";
Exemple #4
0
 } else {
     $logoImageURL = $_POST['logourl'];
 }
 if ($countErrors == 0) {
     $newSquadObj = new Squad($mysqli);
     if ($_POST['recruiting'] != 0) {
         $_POST['recruiting'] = 1;
     }
     if ($_POST['shoutbox'] != 0) {
         $_POST['shoutbox'] = 1;
     }
     $time = time();
     $arrColumns = array("member_id", "name", "description", "logourl", "recruitingstatus", "datecreated", "privateshoutbox", "website");
     $arrValues = array($memberInfo['member_id'], $_POST['squadname'], $_POST['squaddesc'], $logoImageURL, $_POST['recruiting'], $time, $_POST['shoutbox'], $_POST['squadsite']);
     if ($newSquadObj->addNew($arrColumns, $arrValues)) {
         $newSquadInfo = $newSquadObj->get_info_filtered();
         $arrColumns = array("squad_id", "name", "sortnum", "postnews", "managenews", "postshoutbox", "manageshoutbox", "addrank", "manageranks", "editprofile", "sendinvites", "acceptapps", "setrank", "removemember");
         $arrValues = array($newSquadInfo['squad_id'], "Founder", 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);
         $checkAddRank = $newSquadObj->objSquadRank->addNew($arrColumns, $arrValues);
         $squadRankInfo = $newSquadObj->objSquadRank->get_info();
         $checkAddMember = $newSquadObj->objSquadMember->addNew(array("squad_id", "member_id", "squadrank_id", "datejoined"), array($newSquadInfo['squad_id'], $memberInfo['member_id'], $squadRankInfo['squadrank_id'], $time));
         if ($checkAddRank && $checkAddMember) {
             echo "\n\t\t\t\t\n\t\t\t\t<div style='display: none' id='successBox'>\n\t\t\t\t\t<p align='center'>\n\t\t\t\t\t\tSuccessfully Created New Squad: <b>" . $newSquadInfo['name'] . "</b>!\n\t\t\t\t\t</p>\n\t\t\t\t</div>\n\t\t\t\t\n\t\t\t\t<script type='text/javascript'>\n\t\t\t\t\tpopupDialog('Create a Squad', '" . $MAIN_ROOT . "members', 'successBox');\n\t\t\t\t</script>\n\t\t\t\t\n\t\t\t\t";
         } else {
             $countErrors++;
             $dispError .= "&nbsp;&nbsp;&nbsp;<b>&middot;</b> Unable to save information to the database.  Please contact the website administrator.<br>";
         }
     } else {
         $countErrors++;
         $dispError .= "&nbsp;&nbsp;&nbsp;<b>&middot;</b> Unable to save information to the database.  Please contact the website administrator.<br>";
     }