Update to db query execute cmd
This commit is contained in:
@@ -120,12 +120,12 @@ function pvd(params) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function addLogLevelCommand(command, params, client) {
|
function addLogLevelCommand(command, params, client) {
|
||||||
if(areParamsEmpty(params)) {
|
if (areParamsEmpty(params)) {
|
||||||
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(toLowerCase(params)) {
|
switch (toLowerCase(params)) {
|
||||||
case "debug":
|
case "debug":
|
||||||
logLevel = logLevel | LOG_DEBUG;
|
logLevel = logLevel | LOG_DEBUG;
|
||||||
break;
|
break;
|
||||||
@@ -162,23 +162,23 @@ function addLogLevelCommand(command, params, client) {
|
|||||||
function getLogLevelCommand(command, params, client) {
|
function getLogLevelCommand(command, params, client) {
|
||||||
let logLevels = [];
|
let logLevels = [];
|
||||||
|
|
||||||
if(hasBitFlag(logLevel, LOG_DEBUG)) {
|
if (hasBitFlag(logLevel, LOG_DEBUG)) {
|
||||||
logLevels.push("debug");
|
logLevels.push("debug");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(hasBitFlag(logLevel, LOG_WARN)) {
|
if (hasBitFlag(logLevel, LOG_WARN)) {
|
||||||
logLevels.push("warn");
|
logLevels.push("warn");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(hasBitFlag(logLevel, LOG_ERROR)) {
|
if (hasBitFlag(logLevel, LOG_ERROR)) {
|
||||||
logLevels.push("error");
|
logLevels.push("error");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(hasBitFlag(logLevel, LOG_INFO)) {
|
if (hasBitFlag(logLevel, LOG_INFO)) {
|
||||||
logLevels.push("info");
|
logLevels.push("info");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(hasBitFlag(logLevel, LOG_VERBOSE)) {
|
if (hasBitFlag(logLevel, LOG_VERBOSE)) {
|
||||||
logLevels.push("verbose");
|
logLevels.push("verbose");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -190,12 +190,12 @@ function getLogLevelCommand(command, params, client) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function removeLogLevelCommand(command, params, client) {
|
function removeLogLevelCommand(command, params, client) {
|
||||||
if(areParamsEmpty(params)) {
|
if (areParamsEmpty(params)) {
|
||||||
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(toLowerCase(params)) {
|
switch (toLowerCase(params)) {
|
||||||
case "debug":
|
case "debug":
|
||||||
logLevel = logLevel & ~LOG_DEBUG;
|
logLevel = logLevel & ~LOG_DEBUG;
|
||||||
break;
|
break;
|
||||||
@@ -230,19 +230,19 @@ function removeLogLevelCommand(command, params, client) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function simulateCommandForPlayerCommand(command, params, client) {
|
function simulateCommandForPlayerCommand(command, params, client) {
|
||||||
if(getCommand(command).requireLogin) {
|
if (getCommand(command).requireLogin) {
|
||||||
if(!isPlayerLoggedIn(client)) {
|
if (!isPlayerLoggedIn(client)) {
|
||||||
messagePlayerError(client, "You must be logged in to use this command!");
|
messagePlayerError(client, "You must be logged in to use this command!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!doesPlayerHaveStaffPermission(client, getCommandRequiredPermissions(command))) {
|
if (!doesPlayerHaveStaffPermission(client, getCommandRequiredPermissions(command))) {
|
||||||
messagePlayerError(client, "You do not have permission to use this command!");
|
messagePlayerError(client, "You do not have permission to use this command!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(areParamsEmpty(params) || !areThereEnoughParams(params, 2)) {
|
if (areParamsEmpty(params) || !areThereEnoughParams(params, 2)) {
|
||||||
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -252,12 +252,12 @@ function simulateCommandForPlayerCommand(command, params, client) {
|
|||||||
tempCommand.replace("/", "");
|
tempCommand.replace("/", "");
|
||||||
let tempParams = splitParams.slice(2).join(" ");
|
let tempParams = splitParams.slice(2).join(" ");
|
||||||
|
|
||||||
if(!targetClient) {
|
if (!targetClient) {
|
||||||
messagePlayerError(client, "Invalid player name or ID");
|
messagePlayerError(client, "Invalid player name or ID");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!getCommand(tempCommand)) {
|
if (!getCommand(tempCommand)) {
|
||||||
messagePlayerError(client, `The command {ALTCOLOUR}/${command} {MAINCOLOUR}does not exist! Use /help for commands and information.`);
|
messagePlayerError(client, `The command {ALTCOLOUR}/${command} {MAINCOLOUR}does not exist! Use /help for commands and information.`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -270,19 +270,19 @@ function simulateCommandForPlayerCommand(command, params, client) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function simulateCommandForAllPlayersCommand(command, params, client) {
|
function simulateCommandForAllPlayersCommand(command, params, client) {
|
||||||
if(getCommand(command).requireLogin) {
|
if (getCommand(command).requireLogin) {
|
||||||
if(!isPlayerLoggedIn(client)) {
|
if (!isPlayerLoggedIn(client)) {
|
||||||
messagePlayerError(client, "You must be logged in to use this command!");
|
messagePlayerError(client, "You must be logged in to use this command!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!doesPlayerHaveStaffPermission(client, getCommandRequiredPermissions(command))) {
|
if (!doesPlayerHaveStaffPermission(client, getCommandRequiredPermissions(command))) {
|
||||||
messagePlayerError(client, "You do not have permission to use this command!");
|
messagePlayerError(client, "You do not have permission to use this command!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(areParamsEmpty(params) || !areThereEnoughParams(params, 2)) {
|
if (areParamsEmpty(params) || !areThereEnoughParams(params, 2)) {
|
||||||
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -291,14 +291,14 @@ function simulateCommandForAllPlayersCommand(command, params, client) {
|
|||||||
tempCommand.replace("/", "");
|
tempCommand.replace("/", "");
|
||||||
let tempParams = splitParams.slice(1).join(" ");
|
let tempParams = splitParams.slice(1).join(" ");
|
||||||
|
|
||||||
if(!getCommand(tempCommand)) {
|
if (!getCommand(tempCommand)) {
|
||||||
messagePlayerError(client, `The command {ALTCOLOUR}/${command} {MAINCOLOUR}does not exist! Use /help for commands and information.`);
|
messagePlayerError(client, `The command {ALTCOLOUR}/${command} {MAINCOLOUR}does not exist! Use /help for commands and information.`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
let clients = getClients();
|
let clients = getClients();
|
||||||
for(let i in clients) {
|
for (let i in clients) {
|
||||||
if(!clients[i].console) {
|
if (!clients[i].console) {
|
||||||
getCommand(toLowerCase(tempCommand)).handlerFunction(tempCommand, tempParams, clients[i]);
|
getCommand(toLowerCase(tempCommand)).handlerFunction(tempCommand, tempParams, clients[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -309,7 +309,7 @@ function simulateCommandForAllPlayersCommand(command, params, client) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function executeServerCodeCommand(command, params, client) {
|
function executeServerCodeCommand(command, params, client) {
|
||||||
if(areParamsEmpty(params)) {
|
if (areParamsEmpty(params)) {
|
||||||
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -317,7 +317,7 @@ function executeServerCodeCommand(command, params, client) {
|
|||||||
let returnValue = "Nothing";
|
let returnValue = "Nothing";
|
||||||
try {
|
try {
|
||||||
returnValue = eval("(" + params + ")");
|
returnValue = eval("(" + params + ")");
|
||||||
} catch(error) {
|
} catch (error) {
|
||||||
messagePlayerError(client, "The code could not be executed!");
|
messagePlayerError(client, "The code could not be executed!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -332,7 +332,7 @@ function executeServerCodeCommand(command, params, client) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function executeClientCodeCommand(command, params, client) {
|
function executeClientCodeCommand(command, params, client) {
|
||||||
if(areParamsEmpty(params)) {
|
if (areParamsEmpty(params)) {
|
||||||
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -341,12 +341,12 @@ function executeClientCodeCommand(command, params, client) {
|
|||||||
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
||||||
let targetCode = splitParams.slice(1).join(" ");
|
let targetCode = splitParams.slice(1).join(" ");
|
||||||
|
|
||||||
if(!targetClient) {
|
if (!targetClient) {
|
||||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(targetCode == "") {
|
if (targetCode == "") {
|
||||||
messagePlayerError(client, "You didn't enter any code!");
|
messagePlayerError(client, "You didn't enter any code!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -361,19 +361,19 @@ function executeClientCodeCommand(command, params, client) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setPlayerTesterStatusCommand(command, params, client) {
|
function setPlayerTesterStatusCommand(command, params, client) {
|
||||||
if(areParamsEmpty(params)) {
|
if (areParamsEmpty(params)) {
|
||||||
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
let targetClient = getPlayerFromParams(params);
|
let targetClient = getPlayerFromParams(params);
|
||||||
|
|
||||||
if(!targetClient) {
|
if (!targetClient) {
|
||||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!hasBitFlag(getPlayerData(targetClient).accountData.flags.moderation, getModerationFlagValue("IsTester"))) {
|
if (!hasBitFlag(getPlayerData(targetClient).accountData.flags.moderation, getModerationFlagValue("IsTester"))) {
|
||||||
getPlayerData(targetClient).accountData.flags.moderation = addBitFlag(getPlayerData(targetClient).accountData.flags.moderation, getModerationFlagValue("IsTester"));
|
getPlayerData(targetClient).accountData.flags.moderation = addBitFlag(getPlayerData(targetClient).accountData.flags.moderation, getModerationFlagValue("IsTester"));
|
||||||
} else {
|
} else {
|
||||||
getPlayerData(targetClient).accountData.flags.moderation = removeBitFlag(getPlayerData(targetClient).accountData.flags.moderation, getModerationFlagValue("IsTester"));
|
getPlayerData(targetClient).accountData.flags.moderation = removeBitFlag(getPlayerData(targetClient).accountData.flags.moderation, getModerationFlagValue("IsTester"));
|
||||||
@@ -388,14 +388,14 @@ function setPlayerTesterStatusCommand(command, params, client) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function testPromptGUICommand(command, params, client) {
|
function testPromptGUICommand(command, params, client) {
|
||||||
if(areParamsEmpty(params)) {
|
if (areParamsEmpty(params)) {
|
||||||
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
let targetClient = getPlayerFromParams(params);
|
let targetClient = getPlayerFromParams(params);
|
||||||
|
|
||||||
if(!targetClient) {
|
if (!targetClient) {
|
||||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -407,14 +407,14 @@ function testPromptGUICommand(command, params, client) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function testInfoGUICommand(command, params, client) {
|
function testInfoGUICommand(command, params, client) {
|
||||||
if(areParamsEmpty(params)) {
|
if (areParamsEmpty(params)) {
|
||||||
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
let targetClient = getPlayerFromParams(params);
|
let targetClient = getPlayerFromParams(params);
|
||||||
|
|
||||||
if(!targetClient) {
|
if (!targetClient) {
|
||||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -426,14 +426,14 @@ function testInfoGUICommand(command, params, client) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function testErrorGUICommand(command, params, client) {
|
function testErrorGUICommand(command, params, client) {
|
||||||
if(areParamsEmpty(params)) {
|
if (areParamsEmpty(params)) {
|
||||||
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
let targetClient = getPlayerFromParams(params);
|
let targetClient = getPlayerFromParams(params);
|
||||||
|
|
||||||
if(!targetClient) {
|
if (!targetClient) {
|
||||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -457,7 +457,7 @@ function testEmailCommand(command, params, client) {
|
|||||||
try {
|
try {
|
||||||
messagePlayerAlert(client, `Sending test email to ${params}`);
|
messagePlayerAlert(client, `Sending test email to ${params}`);
|
||||||
sendEmail(params, "Player", "Test email", "Just testing the SMTP module for the server!");
|
sendEmail(params, "Player", "Test email", "Just testing the SMTP module for the server!");
|
||||||
} catch(error) {
|
} catch (error) {
|
||||||
messagePlayerError(client, "The email could not be sent! Error: ${error}");
|
messagePlayerError(client, "The email could not be sent! Error: ${error}");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -477,7 +477,7 @@ function restartGameModeCommand(command, params, client) {
|
|||||||
|
|
||||||
function clientRunCodeFail(client, returnTo, error) {
|
function clientRunCodeFail(client, returnTo, error) {
|
||||||
let returnClient = getClientFromIndex(returnTo);
|
let returnClient = getClientFromIndex(returnTo);
|
||||||
if(!returnClient) {
|
if (!returnClient) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -488,7 +488,7 @@ function clientRunCodeFail(client, returnTo, error) {
|
|||||||
|
|
||||||
function clientRunCodeSuccess(client, returnTo, returnVal) {
|
function clientRunCodeSuccess(client, returnTo, returnVal) {
|
||||||
let returnClient = getClientFromIndex(returnTo);
|
let returnClient = getClientFromIndex(returnTo);
|
||||||
if(!returnClient) {
|
if (!returnClient) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -505,14 +505,14 @@ function submitIdea(client, ideaText) {
|
|||||||
let session = 0;
|
let session = 0;
|
||||||
let databaseId = 0;
|
let databaseId = 0;
|
||||||
|
|
||||||
if(isConsole(client)) {
|
if (isConsole(client)) {
|
||||||
databaseId = -1;
|
databaseId = -1;
|
||||||
} else {
|
} else {
|
||||||
databaseId = getPlayerData(client).accountData.databaseId;
|
databaseId = getPlayerData(client).accountData.databaseId;
|
||||||
}
|
}
|
||||||
|
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
if(dbConnection) {
|
if (dbConnection) {
|
||||||
let safeIdeaMessage = escapeDatabaseString(dbConnection, ideaText);
|
let safeIdeaMessage = escapeDatabaseString(dbConnection, ideaText);
|
||||||
queryDatabase(dbConnection, `INSERT INTO idea_main (idea_server, idea_script_ver, idea_who_added, idea_when_added, idea_message, idea_pos_x, idea_pos_y, idea_pos_z, idea_rot_z, idea_svr_start, idea_session) VALUES (${getServerId()}, '${scriptVersion}', ${databaseId}, NOW(), '${safeIdeaMessage}',${position.x}, ${position.y}, ${position.z}, ${heading}, ${serverStartTime}, ${session})`);
|
queryDatabase(dbConnection, `INSERT INTO idea_main (idea_server, idea_script_ver, idea_who_added, idea_when_added, idea_message, idea_pos_x, idea_pos_y, idea_pos_z, idea_rot_z, idea_svr_start, idea_session) VALUES (${getServerId()}, '${scriptVersion}', ${databaseId}, NOW(), '${safeIdeaMessage}',${position.x}, ${position.y}, ${position.z}, ${heading}, ${serverStartTime}, ${session})`);
|
||||||
}
|
}
|
||||||
@@ -526,14 +526,14 @@ function submitBugReport(client, bugText) {
|
|||||||
let session = 0;
|
let session = 0;
|
||||||
let databaseId = 0;
|
let databaseId = 0;
|
||||||
|
|
||||||
if(isConsole(client)) {
|
if (isConsole(client)) {
|
||||||
databaseId = -1;
|
databaseId = -1;
|
||||||
} else {
|
} else {
|
||||||
databaseId = getPlayerData(client).accountData.databaseId;
|
databaseId = getPlayerData(client).accountData.databaseId;
|
||||||
}
|
}
|
||||||
|
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
if(dbConnection) {
|
if (dbConnection) {
|
||||||
let safeBugMessage = escapeDatabaseString(dbConnection, bugText);
|
let safeBugMessage = escapeDatabaseString(dbConnection, bugText);
|
||||||
queryDatabase(dbConnection, `INSERT INTO bug_main (bug_server, bug_script_ver, bug_who_added, bug_when_added, bug_message, bug_pos_x, bug_pos_y, bug_pos_z, bug_rot_z, bug_svr_start, bug_session) VALUES (${getServerId()}, '${scriptVersion}', ${databaseId}, NOW(), '${safeBugMessage}', ${position.x}, ${position.y}, ${position.z}, ${heading}, ${serverStartTime}, ${session})`);
|
queryDatabase(dbConnection, `INSERT INTO bug_main (bug_server, bug_script_ver, bug_who_added, bug_when_added, bug_message, bug_pos_x, bug_pos_y, bug_pos_z, bug_rot_z, bug_svr_start, bug_session) VALUES (${getServerId()}, '${scriptVersion}', ${databaseId}, NOW(), '${safeBugMessage}', ${position.x}, ${position.y}, ${position.z}, ${heading}, ${serverStartTime}, ${session})`);
|
||||||
}
|
}
|
||||||
@@ -551,14 +551,14 @@ function migrateSubAccountsToPerServerData() {
|
|||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
let dbQuery = false;
|
let dbQuery = false;
|
||||||
let dbAssoc = false;
|
let dbAssoc = false;
|
||||||
if(dbConnection) {
|
if (dbConnection) {
|
||||||
dbQuery = queryDatabase(dbConnection, `SELECT * FROM sacct_main`);
|
dbQuery = queryDatabase(dbConnection, `SELECT * FROM sacct_main`);
|
||||||
if(dbQuery) {
|
if (dbQuery) {
|
||||||
while(dbAssoc = fetchQueryAssoc(dbQuery)) {
|
while (dbAssoc = fetchQueryAssoc(dbQuery)) {
|
||||||
createDefaultSubAccountServerData(dbAssoc["sacct_id"]);
|
createDefaultSubAccountServerData(dbAssoc["sacct_id"]);
|
||||||
|
|
||||||
let dbQuery2 = queryDatabase(dbConnection, `UPDATE sacct_svr SET sacct_svr_skin = ${dbAssoc["sacct_skin"]}, sacct_svr_job = ${dbAssoc["sacct_job"]} WHERE sacct_svr_sacct=${dbAssoc["sacct_id"]} AND sacct_svr_server=${dbAssoc["sacct_server"]}`);
|
let dbQuery2 = queryDatabase(dbConnection, `UPDATE sacct_svr SET sacct_svr_skin = ${dbAssoc["sacct_skin"]}, sacct_svr_job = ${dbAssoc["sacct_job"]} WHERE sacct_svr_sacct=${dbAssoc["sacct_id"]} AND sacct_svr_server=${dbAssoc["sacct_server"]}`);
|
||||||
if(dbQuery2) {
|
if (dbQuery2) {
|
||||||
freeDatabaseQuery(dbQuery2);
|
freeDatabaseQuery(dbQuery2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -573,10 +573,10 @@ function resetAllAccountsHotkeysToDefault() {
|
|||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
let dbQuery = false;
|
let dbQuery = false;
|
||||||
let dbAssoc = false;
|
let dbAssoc = false;
|
||||||
if(dbConnection) {
|
if (dbConnection) {
|
||||||
dbQuery = queryDatabase(dbConnection, `SELECT acct_id FROM acct_main`);
|
dbQuery = queryDatabase(dbConnection, `SELECT acct_id FROM acct_main`);
|
||||||
if(dbQuery) {
|
if (dbQuery) {
|
||||||
while(dbAssoc = fetchQueryAssoc(dbQuery)) {
|
while (dbAssoc = fetchQueryAssoc(dbQuery)) {
|
||||||
createDefaultKeybindsForAccount(dbAssoc["acct_id"]);
|
createDefaultKeybindsForAccount(dbAssoc["acct_id"]);
|
||||||
}
|
}
|
||||||
freeDatabaseQuery(dbQuery);
|
freeDatabaseQuery(dbQuery);
|
||||||
@@ -595,9 +595,9 @@ function togglePauseSavingToDatabaseCommand(command, params, client) {
|
|||||||
function createAccountDataForNewServer(serverId) {
|
function createAccountDataForNewServer(serverId) {
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
let dbQuery = false;
|
let dbQuery = false;
|
||||||
if(dbConnection) {
|
if (dbConnection) {
|
||||||
dbQuery = queryDatabase(dbConnection, `SELECT * FROM acct_main`);
|
dbQuery = queryDatabase(dbConnection, `SELECT * FROM acct_main`);
|
||||||
if(dbQuery) {
|
if (dbQuery) {
|
||||||
let dbQueryString = `INSERT INTO acct_svr (acct_svr_acct, acct_svr_svr) VALUES (${accountDatabaseId}, ${serverId})`;
|
let dbQueryString = `INSERT INTO acct_svr (acct_svr_acct, acct_svr_svr) VALUES (${accountDatabaseId}, ${serverId})`;
|
||||||
quickDatabaseQuery(dbQueryString);
|
quickDatabaseQuery(dbQueryString);
|
||||||
}
|
}
|
||||||
@@ -607,7 +607,7 @@ function createAccountDataForNewServer(serverId) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function streamAudioURLToAllPlayersCommand(command, params, client) {
|
function streamAudioURLToAllPlayersCommand(command, params, client) {
|
||||||
if(areParamsEmpty(params)) {
|
if (areParamsEmpty(params)) {
|
||||||
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -621,7 +621,7 @@ function streamAudioURLToAllPlayersCommand(command, params, client) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function streamAudioNameToAllPlayersCommand(command, params, client) {
|
function streamAudioNameToAllPlayersCommand(command, params, client) {
|
||||||
if(areParamsEmpty(params)) {
|
if (areParamsEmpty(params)) {
|
||||||
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -685,28 +685,28 @@ function showLocalePickerTestCommand(command, params, client) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function executeDatabaseQueryCommand(command, params, client) {
|
function executeDatabaseQueryCommand(command, params, client) {
|
||||||
if(areParamsEmpty(params)) {
|
if (areParamsEmpty(params)) {
|
||||||
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!targetClient) {
|
if (!targetClient) {
|
||||||
messagePlayerError(client, "That player was not found!");
|
messagePlayerError(client, "That player was not found!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(targetCode == "") {
|
if (targetCode == "") {
|
||||||
messagePlayerError(client, "You didn't enter any code!");
|
messagePlayerError(client, "You didn't enter any code!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
let success = quickDatabaseQuery(params);
|
let results = quickDatabaseQueryWithResults(params);
|
||||||
|
|
||||||
if(!success) {
|
if (results == false || results == null || results == undefined) {
|
||||||
messagePlayerAlert(client, `Database query failed to execute: {ALTCOLOUR}${query}`);
|
messagePlayerAlert(client, `Database query failed to execute: {ALTCOLOUR}${query}`);
|
||||||
} else if(typeof success != "boolean") {
|
} else if (typeof results == "boolean") {
|
||||||
messagePlayeSuccess(client, `Database query successful: {ALTCOLOUR}${query}`);
|
messagePlayerSuccess(client, `Database query successful: {ALTCOLOUR}${query}`);
|
||||||
messagePlayerInfo(client, `Returns: ${success}`);
|
messagePlayerInfo(client, `Returns: ${getTrueFalseFromBool(results)}`);
|
||||||
} else {
|
} else {
|
||||||
messagePlayerSuccess(client, `Database query successful: {ALTCOLOUR}${query}`);
|
messagePlayerSuccess(client, `Database query successful: {ALTCOLOUR}${query}`);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user