majorj0nny
03-05-2008, 07:07 AM
I use this script :
...........................
// Main function (queries, sorts and displays the teamspeak serverinfo). Its code is not
// very readable... well what shall I say about it... it was hard to write so it should
// be hard to read >:)
function displayTeamspeak($serverAddress, $serverUDPPort=8767, $serverQueryPort=51234) {
$serverInfo = $this->queryTeamspeakServer($serverAddress, $serverUDPPort, $serverQueryPort);
print("<tr>\n<td class=\"alt1\">\n<table id=\"teamspeakdisplay\" name=\"teamspeakdisplay\" width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<tr>\n<td>\n");
if ($serverInfo["queryerror"] != 0) {
$popupInfo = "Server address: " . $serverAddress . (($serverUDPPort != 8767) ? (":" . $serverUDPPort): "");
if ($serverInfo["queryerror"] == 1) {
$popupInfo .= ", Error: could not connect to query port";
} else {
$popupInfo .= ", Error: no server running on port " . $serverUDPPort;
}
print("<table><tr><td>");
print("<img src=\"teamspeakdisplay/teamspeak_offline.png\" alt=\"\" title=\"" . $popupInfo . "\">");
print("</td><td class=\"teamspeakserver\" title=\"" . $popupInfo . "\">");
print("Server offline");
print("</td></tr></table>\n");
} else {
$this->sortServerInfo($serverInfo);
// Generate javascript for teamspeak hyperlinks
$jsTeamspeakId = str_replace(".", "_", $serverAddress) . "_" . $serverUDPPort;
print("<script type=\"text/javascript\">\n<!--\n");
print("function enterServer_" . $jsTeamspeakId . "() {\n");
print(" enterSubChannel_" . $jsTeamspeakId . "(null, false, null);\n");
print("}\n");
print("function enterChannel_" . $jsTeamspeakId . "(channelName, channelPassworded) {\n");
print(" enterSubChannel_" . $jsTeamspeakId . "(channelName, channelPassworded, null);\n");
print("}\n");
print("function enterSubChannel_" . $jsTeamspeakId . "(channelName, channelPassworded, subChannelName) {\n");
print(" var serveraddress = 'teamspeak://" . $serverAddress . ":" . $serverUDPPort . "';\n");
print(" var nickname=window.prompt('Enter your nickname');\n");
print(" if (nickname == null) {\n");
print(" return;\n");
print(" } else if (nickname == \"\") {\n");
print(" window.alert('Could not enter the teamspeak server because you did not enter your nickname');\n");
print(" return;\n");
print(" }\n");
print(" serveraddress = serveraddress + \"/nickname=\" + nickname;\n");
if ($serverInfo["serverinfo"]["server_password"] == "1") {
print(" var password=window.prompt('Enter the teamspeak server password for " . $serverInfo["serverinfo"]["server_name"] . "');\n");
print(" if (password == null) {\n");
print(" return;\n");
print(" } else if (password == \"\") {\n");
print(" window.alert('Could not enter the teamspeak server because you did not enter a server password');\n");
print(" return;\n");
print(" }\n");
print(" serveraddress = serveraddress + \"?password=\" + password;\n");
}
print(" if (channelName != null) { serveraddress = serveraddress + \"?channel=\" + channelName; }\n");
print(" if (channelPassworded) {\n");
print(" var channelpassword=window.prompt('Enter the channel password for channel ' + channelName);\n");
print(" if (channelpassword == null) {\n");
print(" return;\n");
print(" } else if (channelpassword == \"\") {\n");
print(" window.alert('Could not enter the teamspeak server because you did not enter a channel password');\n");
print(" return;\n");
print(" }\n");
print(" serveraddress = serveraddress + \"?channelpassword=\" + channelpassword;\n");
print(" }\n");
print(" if (subChannelName != null) { serveraddress = serveraddress + \"?subchannel=\" + subChannelName; }\n");
print(" window.location=serveraddress;\n");
print("}\n");
print("//--></script>\n");
$popupInfo = "Server address: " . $serverAddress . (($serverUDPPort != 8767) ? (":" . $serverUDPPort): "") . ", Max players: " . $serverInfo["serverinfo"]["server_maxusers"] . ", Uptime: " . $this->_formatTime($serverInfo["serverinfo"]["server_uptime"]);
// Print the topmost element of the teamspeak tree
print("<table><tr><td>");
print("<img src=\"teamspeakdisplay/teamspeak_online.png\" alt=\"\" title=\"" . $popupInfo . "\">");
print("</td><td class=\"teamspeakserver\" title=\"" . $popupInfo . "\">");
print("<a class=\"teamspeakserver\" href=\"javascript:enterServer_" . $jsTeamspeakId . "();\">");
print(str_replace(" ", " ", htmlspecialchars($serverInfo["serverinfo"]["server_name"])));
print("</a>");
print("</td></tr></table>\n");
// Count the number of channels to be listed:
$currentchannels = 0;
foreach($serverInfo["channellist"] as $channelInfo) {
if ($channelInfo["parent"] == -1) {
$currentchannels++;
}
}
// Initialize the channelcounter to zero
$counter = 0;
// Loop through all channels:
foreach($serverInfo["channellist"] as $channelInfo) { if ($channelInfo["parent"] == -1) {
// determine number of players in channel
$currentplayers = 0;
foreach($serverInfo["playerlist"] as $playerInfo) {
if($playerInfo[channelid] == $channelInfo["channelid"]) $currentplayers++;
}
// Count the number of channels to be listed:
$currentplayersandsubchannels = $currentplayers;
foreach($serverInfo["channellist"] as $subchannelInfo) {
if ($subchannelInfo["parent"] == $channelInfo["channelid"]) {
$currentplayersandsubchannels++;
}
}
$popupInfo = "Max players: " . $channelInfo["maxplayers"] . ", Codec: " . $this->_getCodecName($channelInfo["codec"]);
if ($channelInfo["topic"] != "") { $popupInfo = $popupInfo . ", Topic: " . $channelInfo["topic"]; }
// Display channel:
print("<table><tr><td>");
print("<img src=\"teamspeakdisplay/treeimage" . ((($counter + 1) == $currentchannels) ? "3" : "2") . ".png\" alt=\"\">");
print("<img src=\"teamspeakdisplay/channel.png\" alt=\"\" title=\"" . $popupInfo . "\">");
print("</td><td class=\"teamspeakchannel\" title=\"" . $popupInfo . "\">");
print("<a class=\"teamspeakchannel\" href=\"javascript:enterChannel_" . $jsTeamspeakId . "('" . $channelInfo["channelname"] . "', " . (($channelInfo["password"]) == "1" ? "true" : "false") . ");\">");
print(str_replace(" ", " ", htmlspecialchars($channelInfo["displayname"])));
print("</a>");
print("</td></tr></table>\n");
// Initialize the playercounter for this channel to zero
$counter_playerandsubchannels = 0;
// Loop through all players in the current channel:
foreach($serverInfo["playerlist"] as $playerInfo) {
// Is the current player in the current channel?
if ($playerInfo[channelid] == $channelInfo[channelid]) {
$popupInfo = "Time online: " . $this->_formatTime($playerInfo["totaltime"]) . ", Time idle: " . $this->_formatTime($playerInfo["idletime"]) . ", Ping: " . $playerInfo["pingtime"] . "ms";
// Display player:
print("<table><tr><td>");
print("<img src=\"teamspeakdisplay/treeimage" . ((($counter + 1) == $currentchannels) ? "4" : "1") . ".png\" alt=\"\">");
print("<img src=\"teamspeakdisplay/treeimage" . ((($counter_playerandsubchannels + 1) == $currentplayersandsubchannels) ? "3" : "2") . ".png\" alt=\"\">");
print("<img src=\"teamspeakdisplay/player_" . $playerInfo["displayimage"] . ".png\" alt=\"" . $playerInfo["displayimage"] . "\" title=\"" . $popupInfo . "\">");
print("</td><td class=\"teamspeakplayer\" title=\"" . $popupInfo . "\">");
print(str_replace(" ", " ", htmlspecialchars($playerInfo["displayname"])));
print("</td></tr></table>\n");
// Increase the player counter:
$counter_playerandsubchannels++;
}
}
// Loop through all channels:
foreach($serverInfo["channellist"] as $subchannelInfo) { if ($subchannelInfo["parent"] == $channelInfo["channelid"]) {
// determine number of players in channel
$currentplayers = 0;
foreach($serverInfo["playerlist"] as $playerInfo) {
if($playerInfo[channelid] == $subchannelInfo["channelid"]) $currentplayers++;
}
$popupInfo = "Max players: " . $subchannelInfo["maxplayers"] . ", Codec: " . $this->_getCodecName($subchannelInfo["codec"]);
if ($subchannelInfo["topic"] != "") { $popupInfo = $popupInfo . ", Topic: " . $subchannelInfo["topic"]; }
// Display channel:
print("<table><tr><td>");
print("<img src=\"teamspeakdisplay/treeimage" . ((($counter + 1) == $currentchannels) ? "4" : "1") . ".png\" alt=\"\">");
print("<img src=\"teamspeakdisplay/treeimage" . ((($counter_playerandsubchannels + 1) == $currentplayersandsubchannels) ? "3" : "2") . ".png\" alt=\"\">");
print("<img src=\"teamspeakdisplay/channel.png\" alt=\"\" title=\"" . $popupInfo . "\">");
print("</td><td class=\"teamspeaksubchannel\" title=\"" . $popupInfo . "\">");
print("<a class=\"teamspeaksubchannel\" href=\"javascript:enterSubChannel_" . $jsTeamspeakId . "('" . $channelInfo["channelname"] . "', " . (($channelInfo["password"]) == "1" ? "true" : "false") . ", '" . $subchannelInfo["channelname"] . "');\">");
print(str_replace(" ", " ", htmlspecialchars($subchannelInfo[channelname])));
print("</a>");
print("</td></tr></table>\n");
// Initialize the playercounter for this channel to zero
$counter_player = 0;
// Loop through all players in the current channel:
foreach($serverInfo["playerlist"] as $playerInfo) {
// Is the current player in the current channel?
if ($playerInfo[channelid] == $subchannelInfo[channelid]) {
$popupInfo = "Time online: " . $this->_formatTime($playerInfo["totaltime"]) . ", Time idle: " . $this->_formatTime($playerInfo["idletime"]) . ", Ping: " . $playerInfo["pingtime"] . "ms";
// Display player:
print("<table><tr><td>");
print("<img src=\"teamspeakdisplay/treeimage" . ((($counter + 1) == $currentchannels) ? "4" : "1") . ".png\" alt=\"\">");
print("<img src=\"teamspeakdisplay/treeimage" . ((($counter_playerandsubchannels + 1) == $currentplayersandsubchannels) ? "4" : "1") . ".png\" alt=\"\">");
print("<img src=\"teamspeakdisplay/treeimage" . ((($counter_player + 1) == $currentplayers) ? "3" : "2") . ".png\" alt=\"\">");
print("<img src=\"teamspeakdisplay/player_" . $playerInfo["displayimage"] . ".png\" alt=\"" . $playerInfo["displayimage"] . "\" title=\"" . $popupInfo . "\">");
print("</td><td class=\"teamspeakplayer\" title=\"" . $popupInfo . "\">");
print(str_replace(" ", " ", htmlspecialchars($playerInfo["displayname"])));
print("</td></tr></table>\n");
// Increase the player counter:
$counter_player++;
}
}
// Increase the channelcounter
$counter_playerandsubchannels++;
} }
// Increase the channelcounter
$counter++;
} }
}
print("</tr></td></table>");
}
}
// Create an instance of the Teamspeak Display Class
$teamspeakDisplay = new teamspeakDisplayClass;
?>
which produces something like this :
http://www.50klicks.com/jon/pics/tsscreen.jpg
since changing the skin - the text in that TS module is really massive and ugly - I cant find how or where its set via the skin itself so was wondering how could I alter the above script to hardcode font settings to each element ? (ie - servername, channel, subchannel, and username.)
any help greatly appreciated!
--------------- Added 1204708210 at 1204708210 ---------------
this it the solution that the designer came up with years ago -
it dont work though...
https://vborg.vbsupport.ru/showthread.php?p=1456805#post1456805
...........................
// Main function (queries, sorts and displays the teamspeak serverinfo). Its code is not
// very readable... well what shall I say about it... it was hard to write so it should
// be hard to read >:)
function displayTeamspeak($serverAddress, $serverUDPPort=8767, $serverQueryPort=51234) {
$serverInfo = $this->queryTeamspeakServer($serverAddress, $serverUDPPort, $serverQueryPort);
print("<tr>\n<td class=\"alt1\">\n<table id=\"teamspeakdisplay\" name=\"teamspeakdisplay\" width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<tr>\n<td>\n");
if ($serverInfo["queryerror"] != 0) {
$popupInfo = "Server address: " . $serverAddress . (($serverUDPPort != 8767) ? (":" . $serverUDPPort): "");
if ($serverInfo["queryerror"] == 1) {
$popupInfo .= ", Error: could not connect to query port";
} else {
$popupInfo .= ", Error: no server running on port " . $serverUDPPort;
}
print("<table><tr><td>");
print("<img src=\"teamspeakdisplay/teamspeak_offline.png\" alt=\"\" title=\"" . $popupInfo . "\">");
print("</td><td class=\"teamspeakserver\" title=\"" . $popupInfo . "\">");
print("Server offline");
print("</td></tr></table>\n");
} else {
$this->sortServerInfo($serverInfo);
// Generate javascript for teamspeak hyperlinks
$jsTeamspeakId = str_replace(".", "_", $serverAddress) . "_" . $serverUDPPort;
print("<script type=\"text/javascript\">\n<!--\n");
print("function enterServer_" . $jsTeamspeakId . "() {\n");
print(" enterSubChannel_" . $jsTeamspeakId . "(null, false, null);\n");
print("}\n");
print("function enterChannel_" . $jsTeamspeakId . "(channelName, channelPassworded) {\n");
print(" enterSubChannel_" . $jsTeamspeakId . "(channelName, channelPassworded, null);\n");
print("}\n");
print("function enterSubChannel_" . $jsTeamspeakId . "(channelName, channelPassworded, subChannelName) {\n");
print(" var serveraddress = 'teamspeak://" . $serverAddress . ":" . $serverUDPPort . "';\n");
print(" var nickname=window.prompt('Enter your nickname');\n");
print(" if (nickname == null) {\n");
print(" return;\n");
print(" } else if (nickname == \"\") {\n");
print(" window.alert('Could not enter the teamspeak server because you did not enter your nickname');\n");
print(" return;\n");
print(" }\n");
print(" serveraddress = serveraddress + \"/nickname=\" + nickname;\n");
if ($serverInfo["serverinfo"]["server_password"] == "1") {
print(" var password=window.prompt('Enter the teamspeak server password for " . $serverInfo["serverinfo"]["server_name"] . "');\n");
print(" if (password == null) {\n");
print(" return;\n");
print(" } else if (password == \"\") {\n");
print(" window.alert('Could not enter the teamspeak server because you did not enter a server password');\n");
print(" return;\n");
print(" }\n");
print(" serveraddress = serveraddress + \"?password=\" + password;\n");
}
print(" if (channelName != null) { serveraddress = serveraddress + \"?channel=\" + channelName; }\n");
print(" if (channelPassworded) {\n");
print(" var channelpassword=window.prompt('Enter the channel password for channel ' + channelName);\n");
print(" if (channelpassword == null) {\n");
print(" return;\n");
print(" } else if (channelpassword == \"\") {\n");
print(" window.alert('Could not enter the teamspeak server because you did not enter a channel password');\n");
print(" return;\n");
print(" }\n");
print(" serveraddress = serveraddress + \"?channelpassword=\" + channelpassword;\n");
print(" }\n");
print(" if (subChannelName != null) { serveraddress = serveraddress + \"?subchannel=\" + subChannelName; }\n");
print(" window.location=serveraddress;\n");
print("}\n");
print("//--></script>\n");
$popupInfo = "Server address: " . $serverAddress . (($serverUDPPort != 8767) ? (":" . $serverUDPPort): "") . ", Max players: " . $serverInfo["serverinfo"]["server_maxusers"] . ", Uptime: " . $this->_formatTime($serverInfo["serverinfo"]["server_uptime"]);
// Print the topmost element of the teamspeak tree
print("<table><tr><td>");
print("<img src=\"teamspeakdisplay/teamspeak_online.png\" alt=\"\" title=\"" . $popupInfo . "\">");
print("</td><td class=\"teamspeakserver\" title=\"" . $popupInfo . "\">");
print("<a class=\"teamspeakserver\" href=\"javascript:enterServer_" . $jsTeamspeakId . "();\">");
print(str_replace(" ", " ", htmlspecialchars($serverInfo["serverinfo"]["server_name"])));
print("</a>");
print("</td></tr></table>\n");
// Count the number of channels to be listed:
$currentchannels = 0;
foreach($serverInfo["channellist"] as $channelInfo) {
if ($channelInfo["parent"] == -1) {
$currentchannels++;
}
}
// Initialize the channelcounter to zero
$counter = 0;
// Loop through all channels:
foreach($serverInfo["channellist"] as $channelInfo) { if ($channelInfo["parent"] == -1) {
// determine number of players in channel
$currentplayers = 0;
foreach($serverInfo["playerlist"] as $playerInfo) {
if($playerInfo[channelid] == $channelInfo["channelid"]) $currentplayers++;
}
// Count the number of channels to be listed:
$currentplayersandsubchannels = $currentplayers;
foreach($serverInfo["channellist"] as $subchannelInfo) {
if ($subchannelInfo["parent"] == $channelInfo["channelid"]) {
$currentplayersandsubchannels++;
}
}
$popupInfo = "Max players: " . $channelInfo["maxplayers"] . ", Codec: " . $this->_getCodecName($channelInfo["codec"]);
if ($channelInfo["topic"] != "") { $popupInfo = $popupInfo . ", Topic: " . $channelInfo["topic"]; }
// Display channel:
print("<table><tr><td>");
print("<img src=\"teamspeakdisplay/treeimage" . ((($counter + 1) == $currentchannels) ? "3" : "2") . ".png\" alt=\"\">");
print("<img src=\"teamspeakdisplay/channel.png\" alt=\"\" title=\"" . $popupInfo . "\">");
print("</td><td class=\"teamspeakchannel\" title=\"" . $popupInfo . "\">");
print("<a class=\"teamspeakchannel\" href=\"javascript:enterChannel_" . $jsTeamspeakId . "('" . $channelInfo["channelname"] . "', " . (($channelInfo["password"]) == "1" ? "true" : "false") . ");\">");
print(str_replace(" ", " ", htmlspecialchars($channelInfo["displayname"])));
print("</a>");
print("</td></tr></table>\n");
// Initialize the playercounter for this channel to zero
$counter_playerandsubchannels = 0;
// Loop through all players in the current channel:
foreach($serverInfo["playerlist"] as $playerInfo) {
// Is the current player in the current channel?
if ($playerInfo[channelid] == $channelInfo[channelid]) {
$popupInfo = "Time online: " . $this->_formatTime($playerInfo["totaltime"]) . ", Time idle: " . $this->_formatTime($playerInfo["idletime"]) . ", Ping: " . $playerInfo["pingtime"] . "ms";
// Display player:
print("<table><tr><td>");
print("<img src=\"teamspeakdisplay/treeimage" . ((($counter + 1) == $currentchannels) ? "4" : "1") . ".png\" alt=\"\">");
print("<img src=\"teamspeakdisplay/treeimage" . ((($counter_playerandsubchannels + 1) == $currentplayersandsubchannels) ? "3" : "2") . ".png\" alt=\"\">");
print("<img src=\"teamspeakdisplay/player_" . $playerInfo["displayimage"] . ".png\" alt=\"" . $playerInfo["displayimage"] . "\" title=\"" . $popupInfo . "\">");
print("</td><td class=\"teamspeakplayer\" title=\"" . $popupInfo . "\">");
print(str_replace(" ", " ", htmlspecialchars($playerInfo["displayname"])));
print("</td></tr></table>\n");
// Increase the player counter:
$counter_playerandsubchannels++;
}
}
// Loop through all channels:
foreach($serverInfo["channellist"] as $subchannelInfo) { if ($subchannelInfo["parent"] == $channelInfo["channelid"]) {
// determine number of players in channel
$currentplayers = 0;
foreach($serverInfo["playerlist"] as $playerInfo) {
if($playerInfo[channelid] == $subchannelInfo["channelid"]) $currentplayers++;
}
$popupInfo = "Max players: " . $subchannelInfo["maxplayers"] . ", Codec: " . $this->_getCodecName($subchannelInfo["codec"]);
if ($subchannelInfo["topic"] != "") { $popupInfo = $popupInfo . ", Topic: " . $subchannelInfo["topic"]; }
// Display channel:
print("<table><tr><td>");
print("<img src=\"teamspeakdisplay/treeimage" . ((($counter + 1) == $currentchannels) ? "4" : "1") . ".png\" alt=\"\">");
print("<img src=\"teamspeakdisplay/treeimage" . ((($counter_playerandsubchannels + 1) == $currentplayersandsubchannels) ? "3" : "2") . ".png\" alt=\"\">");
print("<img src=\"teamspeakdisplay/channel.png\" alt=\"\" title=\"" . $popupInfo . "\">");
print("</td><td class=\"teamspeaksubchannel\" title=\"" . $popupInfo . "\">");
print("<a class=\"teamspeaksubchannel\" href=\"javascript:enterSubChannel_" . $jsTeamspeakId . "('" . $channelInfo["channelname"] . "', " . (($channelInfo["password"]) == "1" ? "true" : "false") . ", '" . $subchannelInfo["channelname"] . "');\">");
print(str_replace(" ", " ", htmlspecialchars($subchannelInfo[channelname])));
print("</a>");
print("</td></tr></table>\n");
// Initialize the playercounter for this channel to zero
$counter_player = 0;
// Loop through all players in the current channel:
foreach($serverInfo["playerlist"] as $playerInfo) {
// Is the current player in the current channel?
if ($playerInfo[channelid] == $subchannelInfo[channelid]) {
$popupInfo = "Time online: " . $this->_formatTime($playerInfo["totaltime"]) . ", Time idle: " . $this->_formatTime($playerInfo["idletime"]) . ", Ping: " . $playerInfo["pingtime"] . "ms";
// Display player:
print("<table><tr><td>");
print("<img src=\"teamspeakdisplay/treeimage" . ((($counter + 1) == $currentchannels) ? "4" : "1") . ".png\" alt=\"\">");
print("<img src=\"teamspeakdisplay/treeimage" . ((($counter_playerandsubchannels + 1) == $currentplayersandsubchannels) ? "4" : "1") . ".png\" alt=\"\">");
print("<img src=\"teamspeakdisplay/treeimage" . ((($counter_player + 1) == $currentplayers) ? "3" : "2") . ".png\" alt=\"\">");
print("<img src=\"teamspeakdisplay/player_" . $playerInfo["displayimage"] . ".png\" alt=\"" . $playerInfo["displayimage"] . "\" title=\"" . $popupInfo . "\">");
print("</td><td class=\"teamspeakplayer\" title=\"" . $popupInfo . "\">");
print(str_replace(" ", " ", htmlspecialchars($playerInfo["displayname"])));
print("</td></tr></table>\n");
// Increase the player counter:
$counter_player++;
}
}
// Increase the channelcounter
$counter_playerandsubchannels++;
} }
// Increase the channelcounter
$counter++;
} }
}
print("</tr></td></table>");
}
}
// Create an instance of the Teamspeak Display Class
$teamspeakDisplay = new teamspeakDisplayClass;
?>
which produces something like this :
http://www.50klicks.com/jon/pics/tsscreen.jpg
since changing the skin - the text in that TS module is really massive and ugly - I cant find how or where its set via the skin itself so was wondering how could I alter the above script to hardcode font settings to each element ? (ie - servername, channel, subchannel, and username.)
any help greatly appreciated!
--------------- Added 1204708210 at 1204708210 ---------------
this it the solution that the designer came up with years ago -
it dont work though...
https://vborg.vbsupport.ru/showthread.php?p=1456805#post1456805