本文整理汇总了PHP中Basic::update方法的典型用法代码示例。如果您正苦于以下问题:PHP Basic::update方法的具体用法?PHP Basic::update怎么用?PHP Basic::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Basic
的用法示例。
在下文中一共展示了Basic::update方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
* 2. For each stat that was an auto-calculated stat, we need to update the firststat and secondstat IDs
* 3. We can identify the correct $arrSavedStat index by accessing the stat order which is stored in
* $_SESSION[btStatCache][key][firstStat] and $_SESSION[btStatCache][key][secondStat]
*/
if ($countErrors == 0) {
$arrColumns = array("firststat_id", "secondstat_id", "calcop");
foreach ($arrSavedStats as $key => $statInfo) {
if ($statInfo['stattype'] == "calculate") {
$intFirstStatOrder = $_SESSION['btStatCache'][$key]['firstStat'];
$intFirstStatID = $arrSavedStats[$intFirstStatOrder]['gamestats_id'];
$intSecondStatOrder = $_SESSION['btStatCache'][$key]['secondStat'];
$intSecondStatID = $arrSavedStats[$intSecondStatOrder]['gamestats_id'];
$calcOp = $_SESSION['btStatCache'][$key]['calcOperation'];
$arrValues = array($intFirstStatID, $intSecondStatID, $calcOp);
$newStat->select($statInfo['gamestats_id']);
$newStat->update($arrColumns, $arrValues);
}
}
} else {
$showErrorMessage = "<br><br>However, the following stats were unable to be saved:<br><br>" . $dispError;
}
echo "\n\t\t\t<div style='display: none' id='successBox'>\n\t\t\t<p align='center'>\n\t\t\tSuccessfully Added New Game: <b>" . $newGameInfo['name'] . "</b>!" . $showErrorMessage . "\n\t\t\t</p>\n\t\t\t</div>\n\t\t\t\n\t\t\t<script type='text/javascript'>\n\t\t\tpopupDialog('Add New Game', '" . $MAIN_ROOT . "members', 'successBox');\n\t\t\t</script>\n\t\t\t";
} else {
$dispError .= " <b>·</b> Unable to add new game. Please try again.<br>";
$_POST['submit'] = false;
}
} else {
$_POST = filterArray($_POST);
$_POST['submit'] = false;
}
}
示例2: Squad
$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";
} else {
$squadAppObj->update(array("dateaction", "status", "squadmember_id"), array(time(), "2", $memberInfo['member_id']));
$member->select($squadAppInfo['member_id']);
$member->postNotification("Your application to join <b><a href='" . $MAIN_ROOT . "squads/profile.php?sID=" . $squadInfo['squad_id'] . "'>" . $squadInfo['name'] . "</a></b> has been declined. You may now re-apply if you want to.");
echo "\n\t\t\t\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='failedFont'>Squad Applicaion Declined!</span></p>\");\n\t\t\t\t\t\t});\n\t\t\t\t\t</script>\n\t\t\t\n\t\t\t\t";
}
} elseif (count($squadRankList) <= 1 && $_POST['action'] == "accept") {
示例3: Basic
if ($member->authorizeLogin($_SESSION['btPassword']) && $member->hasAccess($consoleObj)) {
$LOGIN_FAIL = false;
$memberInfo = $member->get_info_filtered();
$squadNewsObj = new Basic($mysqli, "squadnews", "squadnews_id");
if ($squadObj->select($_POST['sID']) && $squadObj->memberHasAccess($memberInfo['member_id'], "manageshoutbox") && $squadNewsObj->select($_POST['nID'])) {
if ($_POST['submit']) {
// Check Message
if (trim($_POST['message']) == "") {
$countErrors++;
$dispError .= " <b>·</b> You may not make a blank shoutbox post.<br>";
}
if ($countErrors == 0) {
$time = time();
$arrColumns = array("newspost", "lasteditmember_id", "lasteditdate");
$arrValues = array($_POST['message'], $memberInfo['member_id'], $time);
if ($squadNewsObj->update($arrColumns, $arrValues)) {
$_POST['cancel'] = true;
} else {
$countErrors++;
$dispError .= " <b>·</b> Unable to save information to database! Please contact the website administrator.<br>";
}
}
if ($countErrors > 0) {
$_POST = filterArray($_POST);
$_POST['submit'] = false;
}
}
if (!$_POST['submit'] && !$_POST['cancel']) {
$squadNewsInfo = $squadNewsObj->get_info_filtered();
if ($dispError != "") {
echo "\n\t\t\t\t<div class='errorDiv'>\n\t\t\t\t<strong>Unable to edit shoutbox post because the following errors occurred:</strong><br><br>\n\t\t\t\t{$dispError}\n\t\t\t\t</div>\n\t\t\t\t";
示例4: setMembersOnlyTaggerStatus
$dispMembersOnlyTagger = "\n\t\t\t\t<div id='membersOnlyTagger'>\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t<div id='membersOnlyLoadingSpiral' style='display: none'>\n\t\t\t\t\t\t<p align='center' class='main'>\n\t\t\t\t\t\t\t<img src='" . $MAIN_ROOT . "themes/" . $THEME . "/images/loading-spiral2.gif'><br>Loading\n\t\t\t\t\t\t</p>\n\t\t\t\t\t</div>\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t<div id='membersOnlyTaggerHTML'>\n\t\t\t\t\t\t<p align='center' style='margin: 0px; margin-bottom: 15px'><b>Members Only Tagger: " . $actualPageName . "</b></p>\n\t\t\t\t\t\n\t\t\t\t\t\t<p align='center'>Current Status: " . $pageTagStatus . "<br>Return to <a href='" . $MAIN_ROOT . "members/console.php?cID=" . $taggerCID . "'>Member's Only Pages</a></p>\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t<div class='taggerBottomLeft'><a href='javascript:void(0)' onclick='setMembersOnlyTaggerStatus()'>Turn Off</a></div>\n\t\t\t\t\t\t<div class='taggerBottomRight'><a href='javascript:void(0)' onclick='setMembersOnlyPageStatus()'>" . $dispTagOrUntag . " Page</a></div>\n\t\t\t\t\t</div>\n\t\t\t\t\t\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\t\t\t\n\t\t\t\t\tfunction setMembersOnlyTaggerStatus() {\n\t\t\t\t\t\t\$(document).ready(function() {\n\t\t\t\t\t\t\t\$.post('" . $MAIN_ROOT . "members/include/admin/membersonlypagetagger.php', { setTaggerStatus: '1' }, function(data) {\n\t\t\t\t\t\t\t\t\$('#membersOnlyTagger').fadeOut(250);\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tfunction setMembersOnlyPageStatus() {\n\t\t\t\t\t\n\t\t\t\t\t\t\$(document).ready(function() {\n\t\t\t\t\t\t\t\$('#membersOnlyTaggerHTML').hide();\n\t\t\t\t\t\t\t\$('#membersOnlyLoadingSpiral').show();\n\t\t\t\t\t\t\t\$.post('" . $MAIN_ROOT . "members/include/admin/membersonlypagetagger.php', { setPageStatus: '1', pageName: '" . filterText($actualPageName) . "', tagURL: '" . $pageTaggerURL . "' }, function(data) {\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\$('#membersOnlyTaggerHTML').html(data);\n\t\t\t\t\t\t\t\t\$('#membersOnlyLoadingSpiral').hide();\n\t\t\t\t\t\t\t\t\$('#membersOnlyTaggerHTML').fadeIn(250);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t});\n\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t</script>\n\t\t\t\t\n\t\t\t\t";
}
}
}
}
if (!defined("LOGGED_IN")) {
define("LOGGED_IN", false);
}
if ($taggerObj->select($_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'], false) && constant('LOGGED_IN') == false) {
echo "\n\t\n\t\t<script type='text/javascript'>\n\t\t\n\t\t\twindow.location='" . $MAIN_ROOT . "login.php';\n\t\t\n\t\t</script>\n\t\n\t";
exit;
}
$hitCountObj = new Basic($mysqli, "hitcounter", "hit_id");
$result = $mysqli->query("SELECT * FROM " . $dbprefix . "hitcounter WHERE ipaddress = '" . $IP_ADDRESS . "'");
if ($result->num_rows > 0) {
$hitCountRow = $result->fetch_assoc();
$hitCountObj->select($hitCountRow['hit_id']);
$updateHits = $hitCountObj->get_info("totalhits") + 1;
$updateColumns = array("totalhits", "pagename");
$updateValues = array($updateHits, $PAGE_NAME);
if (time() > $hitCountObj->get_info("dateposted") + 1800) {
$updateColumns[] = "dateposted";
$updateValues[] = time();
}
$hitCountObj->update($updateColumns, $updateValues);
} else {
$hitCountObj->addNew(array("ipaddress", "dateposted", "pagename", "totalhits"), array($IP_ADDRESS, time(), $PAGE_NAME, 1));
}
$blnDisplayNewsTicker = false;
$breadcrumbObj = new BreadCrumb();
$hooksObj->addHook("worldclock-display", "displayDefaultWorldClock");
示例5: Basic
$memberInfo = $member->get_info_filtered();
$pmObj = new Basic($mysqli, "privatemessages", "pm_id");
$arrPMIDS = json_decode($_POST['deletePMs'], true);
foreach ($arrPMIDS as $pmID) {
if (!is_numeric($pmID)) {
$arrMultiMemPM = explode("_", $pmID);
$pmID = $arrMultiMemPM[0];
$pmMID = $arrMultiMemPM[1];
}
$pmObj->select($pmID);
$pmInfo = $pmObj->get_info();
if ($pmInfo['receiver_id'] == 0) {
$multiMemPMObj = new Basic($mysqli, "privatemessage_members", "pmmember_id");
$multiMemPMObj->select($pmMID);
$multiMemPMInfo = $multiMemPMObj->get_info();
if ($multiMemPMInfo['member_id'] == $memberInfo['member_id'] && $multiMemPMInfo['pmfolder_id'] == -2) {
$multiMemPMObj->update(array("deletestatus"), array(1));
} elseif ($multiMemPMInfo['member_id'] == $memberInfo['member_id']) {
$multiMemPMObj->update(array("pmfolder_id"), array(-2));
}
} elseif ($pmInfo['receiver_id'] == $memberInfo['member_id'] && $pmInfo['receiverfolder_id'] == -2) {
$pmObj->update(array("deletereceiver"), array(1));
} elseif ($pmInfo['receiver_id'] == $memberInfo['member_id']) {
$pmObj->update(array("receiverfolder_id"), array(-2));
} elseif ($pmInfo['sender_id'] == $memberInfo['member_id'] && $pmInfo['senderfolder_id'] == -2) {
$pmObj->update(array("deletesender"), array(1));
} elseif ($pmInfo['sender_id'] == $memberInfo['member_id']) {
$pmObj->update(array("senderfolder_id"), array(-2));
}
}
}
示例6: btmysql
<?php
include_once "../../_config.php";
include_once "../../classes/btmysql.php";
include_once "../../classes/member.php";
$mysqli = new btmysql($dbhost, $dbuser, $dbpass, $dbname);
$mysqli->set_tablePrefix($dbprefix);
$member = new Member($mysqli);
$websiteInfoObj = new Basic($mysqli, "websiteinfo", "websiteinfo_id");
$member->select($_POST['user']);
if ($member->authorizeLogin($_POST['pass'], 1) && $member->get_info("rank_id") == "1") {
$memberInfo = $member->get_info_filtered();
$websiteInfoObj->select(1);
$websiteInfoObj->update(array("theme"), array($_POST['themeName']));
echo "\n\t\t\n\t\t\t<script type='text/javascript'>\n\t\t\t\n\t\t\t\t\$.post('../themes/" . $_POST['themeName'] . "/menuimport_default.php');\n\t\t\t\n\t\t\t</script>\n\t\t\n\t\t";
} else {
if (!$member->select($_POST['user'])) {
echo "Unable to select user " . $_POST['user'] . "<br>";
}
if (!$member->authorizeLogin($_POST['pass'], 1)) {
echo "Not Authorized<br>";
}
if (!$member->get_info("rank_id") == "1") {
echo "Not Admin<br>";
}
}
示例7: array
// Check Status
$allowedStatuses = array_keys($arrDiplomacyStatus);
if (!in_array($_POST['status'], $allowedStatuses) || !$diplomacyStatusObj->select($_POST['status'])) {
$dispError .= " <b>·</b> You selected an invalid status.<br>";
$countErrors++;
}
// Check Clan Size
$allowedSizes = array("large", "medium", "small");
if (!in_array($_POST['clansize'], $allowedSizes)) {
$dispError .= " <b>·</b> You selected an invalid clan size.<br>";
$countErrors++;
}
if ($countErrors == 0) {
$arrColumns = array("clanname", "diplomacystatus_id", "website", "clansize", "clantag", "skill", "gamesplayed", "extrainfo", "leaders");
$arrValues = array($_POST['clanname'], $_POST['status'], $_POST['website'], $_POST['clansize'], $_POST['tag'], $_POST['skill'], $_POST['gamesplayed'], $_POST['extrainfo'], $_POST['leaders']);
if ($diplomacyClanObj->update($arrColumns, $arrValues)) {
echo "\n\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 edited " . $diplomacyClanObj->get_info_filtered("clanname") . "'s information!\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('Edit Clan', '" . $MAIN_ROOT . "members/console.php?cID=" . $cID . "', 'successBox');\n\t\t\t\t</script>\n\t\t\t\n\t\t\t";
$member->logAction("Edited " . $_POST['clanname'] . " diplomacy page information. Set status to " . $diplomacyStatusObj->get_info_filtered("name"));
} else {
$countErrors++;
$dispError .= " <b>·</b> Unable to save information to the database. Please contact the website administrator.<br>";
}
}
if ($countErrors > 0) {
$_POST['submit'] = false;
}
}
if (!$_POST['submit']) {
echo "<div class='formDiv'>";
if ($dispError != "") {
echo "\n\t\t<div class='errorDiv'>\n\t\t<strong>Unable to edit clan information because the following errors occurred:</strong><br><br>\n\t\t{$dispError}\n\t\t</div>\n\t\t";
示例8: Basic
$customPageObj = new Basic($mysqli, "custompages", "custompage_id");
if ($member->authorizeLogin($_SESSION['btPassword'])) {
$memberInfo = $member->get_info_filtered();
if ($member->hasAccess($consoleObj) && $customPageObj->select($_POST['cpID'])) {
$countErrors = 0;
// Check Page Name
if (trim($_POST['pagename']) == "") {
$countErrors++;
$dispError .= " <b>·</b> You must enter a page name for your custom page.<br>";
}
if ($countErrors == 0) {
$_POST['wysiwygHTML'] = str_replace("<?", "", $_POST['wysiwygHTML']);
$_POST['wysiwygHTML'] = str_replace("?>", "", $_POST['wysiwygHTML']);
$_POST['wysiwygHTML'] = str_replace("<?", "", $_POST['wysiwygHTML']);
$_POST['wysiwygHTML'] = str_replace("?>", "", $_POST['wysiwygHTML']);
if ($customPageObj->update(array("pagename", "pageinfo"), array($_POST['pagename'], $_POST['wysiwygHTML']))) {
$dispTime = date("l F j, Y g:i:s A");
$customPageInfo = $customPageObj->get_info();
echo "\n\t\t\t\t<script type='text/javascript'>\n\t\t\t\t\t\n\t\t\t\t\t\t\$('#loadingspiral').hide();\n\t\t\t\t\t\t\$('#saveMessage').html(\"<b><span class='successFont'>Custom Page Saved:</span> " . $dispTime . "</b>\");\n\t\t\t\t\t\n\t\t\t\t</script>\n\t\t\t\t";
} else {
$dispError .= " <b>·</b> Unable to edit custom page. Please try again!<br>";
$countErrors++;
}
}
} else {
$dispError .= " <b>·</b> Unable to edit custom page. Invalid Custom Page ID!<br>";
$countErrors++;
}
} else {
$dispError .= " <b>·</b> Unable to edit custom page. You are not authorized to edit custom pages!<br>";
$countErrors++;
示例9: update
public function update($arrColumns, $arrValues)
{
$this->blnRefreshInfo = true;
return parent::update($arrColumns, $arrValues);
}
示例10: Basic
$memberInfo = $member->get_info_filtered();
$iaRequestObj = new Basic($mysqli, "iarequest", "iarequest_id");
$checkRequestID = $iaRequestObj->select($_POST['iaRequestID']);
if ($_POST['action'] == "postmessage" && trim($_POST['message']) != "" && $checkRequestID) {
$iaRequestMessageObj = new Basic($mysqli, "iarequest_messages", "iamessage_id");
$arrColumns = array("iarequest_id", "member_id", "messagedate", "message");
$arrValues = array($iaRequestObj->get_info("iarequest_id"), $memberInfo['member_id'], time(), $_POST['message']);
$iaRequestMessageObj->addNew($arrColumns, $arrValues);
echo dispIAMessages($iaRequestObj->get_info("iarequest_id"));
$requestIACID = $consoleObj->findConsoleIDByName("Inactive Request");
$member->select($iaRequestObj->get_info("member_id"));
$member->postNotification("A new message was posted on your inactive request!<br><br><a href='" . $MAIN_ROOT . "members/console.php?cID=" . $requestIACID . "'>View Messages</a>");
exit;
} elseif (($_POST['action'] == "approve" || $_POST['action'] == "deny") && $checkRequestID) {
$requestStatus = $_POST['action'] == "approve" ? 1 : 2;
$iaRequestObj->update(array("reviewer_id", "reviewdate", "requeststatus"), array($memberInfo['member_id'], time(), $requestStatus));
if ($requestStatus == 1) {
$member->select($iaRequestObj->get_info("member_id"));
$member->update(array("onia", "inactivedate"), array(1, time()));
$member->postNotification("Your inactive request was approved!");
} else {
$member->select($iaRequestObj->get_info("member_id"));
$member->update(array("onia", "inactivedate"), array(0, 0));
$member->postNotification("Your inactive request was denied!");
}
$member->select($memberInfo['member_id']);
} elseif ($_POST['action'] == "delete" && $checkRequestID) {
$member->select($iaRequestObj->get_info("member_id"));
$dispIAMemberName = $member->getMemberLink();
$iaRequestObj->delete();
$member->postNotification("Your inactive request was deleted!");
示例11: Basic
echo "\n\t\t<script type='text/javascript'>\n\t\t\twindow.location = '" . $MAIN_ROOT . "'\n\t\t</script>\n\t";
exit;
}
$ipbanObj = new Basic($mysqli, "ipban", "ipaddress");
if ($ipbanObj->select($IP_ADDRESS, false)) {
$ipbanInfo = $ipbanObj->get_info();
if (time() < $ipbanInfo['exptime'] or $ipbanInfo['exptime'] == 0) {
die("<script type='text/javascript'>window.location = '" . $MAIN_ROOT . "banned.php';</script>");
} else {
$ipbanObj->delete();
}
}
$filterCode = $mysqli->real_escape_string($_GET['code']);
// Start Page
$PAGE_NAME = "Diplomacy Request";
$dispBreadCrumb = "";
include $prevFolder . "themes/" . $THEME . "/_header.php";
$confirmMessage = "E-mail Code Not Found!";
$result = $mysqli->query("SELECT diplomacyrequest_id FROM " . $dbprefix . "diplomacy_request WHERE confirmemail = '" . $filterCode . "'");
if ($result->num_rows > 0) {
$diplomacyRequestObj = new Basic($mysqli, "diplomacy_request", "diplomacyrequest_id");
$row = $result->fetch_assoc();
$diplomacyRequestObj->select($row['diplomacyrequest_id']);
if ($diplomacyRequestObj->update(array("confirmemail"), array("1"))) {
$confirmMessage = "E-mail Address Confirmed!<br><br>Please wait for your application to be reviewed by a diplomacy manager. You will be e-mailed when a decision is made.";
} else {
$confirmMessage = "Unable to save information to the database. Please contact the website administrator.";
}
}
echo "\n\n\t<div id='confirmDialogBox' style='display: none'>\n\t\t<p class='main' align='center'>\n\t\t\t" . $confirmMessage . "\n\t\t</p>\n\t</div>\n\t\n\t<script type='text/javascript'>\n\t\tpopupDialog('Diplomacy Request', '" . $MAIN_ROOT . "', 'confirmDialogBox');\n\t</script>\n\n\n";
include $prevFolder . "themes/" . $THEME . "/_footer.php";
示例12: count
$squadInviteInfo = $squadInviteObj->get_info();
$squadObj->select($squadInviteInfo['squad_id']);
$squadInfo = $squadObj->get_info_filtered();
$squadMemberList = $squadObj->getMemberList();
if ($squadInviteInfo['receiver_id'] == $memberInfo['member_id'] && $squadInviteInfo['status'] == 0 && !in_array($memberInfo['member_id'], $squadMemberList)) {
if ($_POST['action'] == "accept") {
$arrRankList = $squadObj->getRankList();
if (!$squadObj->objSquadRank->select($squadInviteInfo['startingrank_id']) && count($arrRankList) > 1) {
$rankKey = count($arrRankList) - 1;
$squadInviteInfo['startingrank_id'] = $arrRankList[$rankKey];
} elseif (!$squadObj->objSquadRank->select($squadInviteInfo['startingrank_id']) && count($arrRankList) <= 1) {
$member->select($squadInfo['member_id']);
$member->postNotification("There are currently members in your squad, <b><a href='" . $MAIN_ROOT . "squads/profile.php?sID=" . $squadInfo['squad_id'] . "'>" . $squadInfo['name'] . "</a></b> without ranks!");
$member->select($memberInfo['member_id']);
}
$squadInviteObj->update(array("dateaction", "status"), array(time(), "1"));
$arrColumns = array("squad_id", "member_id", "squadrank_id", "datejoined");
$arrValues = array($squadInviteInfo['squad_id'], $memberInfo['member_id'], $squadInviteInfo['startingrank_id'], time());
$squadObj->objSquadMember->addNew($arrColumns, $arrValues);
$intViewSquadsCID = $consoleObj->findConsoleIDByName("View Your Squads");
$member->postNotification("Congratulations! You just joined the squad <b>" . $squadInfo['name'] . "</b>. 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>.");
$member->select($squadInviteInfo['sender_id']);
$member->postNotification("<b>" . $memberLink . "</b> has accepted the invitation to join <b><a href='" . $MAIN_ROOT . "squads/profile.php?sID=" . $squadInfo['squad_id'] . "'>" . $squadInfo['name'] . "</a></b>");
$mysqli->query("DELETE FROM " . $dbprefix . "squadapps WHERE member_id = '" . $memberInfo['member_id'] . "'");
echo "\n\t\t\t\t<script type='text/javascript'>\n\t\t\t\t\t\$(document).ready(function() {\n\t\t\t\t\t\t\$('#actionMessage').html(\"<p class='main' align='center' style='font-weight: bold'><span class='successFont'>Squad Invitation Accepted!</span></p>\");\n\t\t\t\t\t});\n\t\t\t\t</script>\n\t\t\t";
} else {
$squadInviteObj->update(array("dateaction", "status"), array(time(), "2"));
$member->select($squadInviteInfo['sender_id']);
$member->postNotification("<b>" . $memberLink . "</b> has declined the invitation to join <b><a href='" . $MAIN_ROOT . "squads/profile.php?sID=" . $squadInfo['squad_id'] . "'>" . $squadInfo['name'] . "</a></b>");
echo "\n\t\t\t\t\n\t\t\t\t<script type='text/javascript'>\n\t\t\t\t\t\$(document).ready(function() {\n\t\t\t\t\t\t\$('#actionMessage').html(\"<p class='main' align='center' style='font-weight: bold'><span class='failedFont'>Squad Invitation Declined!</span></p>\");\n\t\t\t\t\t});\n\t\t\t\t</script>\n\t\t\t\n\t\t\t";
}
示例13: update
public function update($arrColumns, $arrValues)
{
$returnVal = false;
$arrOriginalInfo = $this->arrObjInfo;
// Do the original stuff
$result = parent::update($arrColumns, $arrValues);
if ($result) {
$returnVal = true;
$arrNewInfo = $this->arrObjInfo;
if ($arrOriginalInfo['maxteams'] > $arrNewInfo['maxteams']) {
// Less teams than originally
$numToRemove = $arrOriginalInfo['maxteams'] - $arrNewInfo['maxteams'];
$arrCurrentTeams = $this->getTeams(true, "ORDER BY seed DESC");
for ($i = 0; $i < $numToRemove; $i++) {
$arrRemovedTeams[] = $arrCurrentTeams[$i];
$this->objTeam->select($arrCurrentTeams[$i]);
$this->objTeam->delete();
$this->MySQL->query("DELETE FROM " . $this->MySQL->get_tablePrefix() . "tournamentplayers WHERE team_id = '" . $arrCurrentTeams[$i] . "'");
}
$this->MySQL->query("DELETE FROM " . $this->MySQL->get_tablePrefix() . "tournamentmatch WHERE tournament_id = '" . $this->intTableKeyValue . "'");
$this->resetMatches();
} elseif ($arrOriginalInfo['maxteams'] < $arrNewInfo['maxteams']) {
// More teams than originally
$numToAdd = $arrNewInfo['maxteams'] - $arrOriginalInfo['maxteams'];
$nextSeed = $arrOriginalInfo['maxteams'] + 1;
for ($i = 0; $i < $numToAdd; $i++) {
$this->objTeam->addNew(array("tournament_id", "seed"), array($this->intTableKeyValue, $nextSeed));
$nextSeed++;
}
$this->MySQL->query("DELETE FROM " . $this->MySQL->get_tablePrefix() . "tournamentmatch WHERE tournament_id = '" . $this->intTableKeyValue . "'");
$this->resetMatches();
}
}
return $returnVal;
}