Here is an example of the Input XML, with my personal information blocked out.
Code:
<qstat>
<server type="TS3" address="xx.xx.xx.xx:nnnn" status="UP">
<hostname>xx.xx.xx.xx:nnnn</hostname>
<name>Obscure Reference Guild House</name>
<gametype/>
<map>N/A</map>
<numplayers>4</numplayers>
<maxplayers>35</maxplayers>
<numspectators>0</numspectators>
<maxspectators>0</maxspectators>
<ping>74</ping>
<retries>0</retries>
<rules>
<rule name="_queryport">nnnn</rule>
<rule name="hostport">nnnn</rule>
<rule name="virtualserver_port">nnnn</rule>
<rule name="virtualserver_status">online</rule>
</rules>
<players></players>
</server>
</qstat>
This is the main module.php, I don't know much PHP so I hacked it together as well as I could. Improvements from those more knowledgeable would be greatly appreciated!
Code:
<?php
/*
* Project: EQdkp-Plus
* License: Creative Commons - Attribution-Noncommercial-Share Alike 3.0 Unported
* Link: http://creativecommons.org/licenses/by-nc-sa/3.0/
* -----------------------------------------------------------------------
* Began: 2008
* Date: $Date$
* -----------------------------------------------------------------------
* @author $Author$
* @copyright 2006-2008 Corgan - Stefan Knaak | Wallenium & the EQdkp-Plus Developer Team
* @link http://eqdkp-plus.com
* @package eqdkp-plus
* @version $Rev$
*
* $Id$
*/
if ( !defined('EQDKP_INC') ){
header('HTTP/1.0 404 Not Found');exit;
}
// You have to define the Module Information
$portal_module['mumble'] = array( // the same name as the folder!
'name' => 'Mumble-Module', // The name to show
'path' => 'mumble', // Folder name again
'version' => '1.0.2', // Version
'author' => 'HEX', // Author
'contact' => 'http://www.eqdkp-plus.com', // email adress
'description' => 'Show Mumble Server Status', // Detailed Description
'positions' => array('left1', 'left2', 'right', 'middle'), // Which blocks should be usable? left1 (over menu), left2 (under menu), right, middle
'install' => array(
'autoenable' => '0', // 0 = disable on install , 1 = enable on install
'defaultposition' => 'left1',// see blocks above
'defaultnumber' => '0', // default ordering number
'visibility' => '0', // 0 = all users, 1 = guests only, 2 = signed in only
'collapsable' => '1', // Module Collapsable or not? Default == 1
),
);
/* Define the Settings if needed
name: The name of the Database field & Input name
language: The name of the language string in the language file
property: What type of field? (text,checkbox,dropdown,textarea,multiselect)
size: Size of the field if required (optional)
rows: Rows for textarea, only needed there!
help: Shows a "?" Icon after the Settings String wichs show on Mouseover a Help Tooltip with the "Help" String!
options: If dropdown/multiselect: array('value'=>'Name')
codeinput: If true, html code is not striped out of the textarea. only working in textareas until now
There could be unlimited amount of settings
Settings page is created dynamically
*/
$portal_settings['mumble'] = array(
'pk_mumble_headtext' => array(
'name' => 'pk_mumble_headtext',
'language' => 'pk_mumble_headtext',
'property' => 'text',
'size' => '30',
'help' => 'pk_mumble_headhelp',
),
'pk_mumble_servername' => array(
'name' => 'pk_mumble_servername',
'language' => 'pk_mumble_servername',
'property' => 'text',
'size' => '30',
'help' => 'pk_mumble_servernamehelp',
),
'pk_mumble_website' => array(
'name' => 'pk_mumble_website',
'language' => 'pk_mumble_website',
'property' => 'text',
'size' => '30',
'help' => 'pk_mumble_websitehelp',
),
'pk_mumble_setup' => array(
'name' => 'pk_mumble_setup',
'language' => 'pk_mumble_setup',
'property' => 'textarea',
'size' => '60',
'cols' => '1',
'help' => 'pk_mumble_setuphelp',
'codeinput' => false,
),
'pk_mumble_xmlinput' => array(
'name' => 'pk_mumble_xmlinput',
'language' => 'pk_mumble_xmlinput',
'property' => 'textarea',
'size' => '60',
'cols' => '1',
'help' => 'pk_mumble_xmlinputhelp',
'codeinput' => true,
)
);
// The output function
// the name MUST be FOLDERNAME_module, if not an error will occur
if(!function_exists(mumble_module)){
function mumble_module(){
global $eqdkp , $user , $tpl, $db, $plang, $conf_plus, $eqdkp_root_path;
// Set the output: If custom one is entered in the setting output this one
// $conf_plus for config values, $plang for language values
$mumble = ($conf_plus['pk_mumble_xmlinput']) ? html_entity_decode(htmlspecialchars_decode($conf_plus['pk_mumble_xmlinput'])) : $plang['portal_mumble_text'];
$xml = simplexml_load_file($mumble);
if ( $xml->server->rules->rule[3] == "online" ) {
$mumble_status = "<img src='$eqdkp_root_path/portal/mumble/images/network-online.png' title='Server is Online with a ping of " . $xml->server->ping . "ms. Host:Port " . $xml->server->hostname . "'> Online";
} else {
$mumble_status = "<img src='$eqdkp_root_path/portal/mumble/images/network-offline.png' title='Server is Offline.'> Offline";
}
// Start the Output
// DO NOT USE ECHO()!
// You can use HTML if you want.
$DKPInfo = "<table width='100%'' border='0' cellspacing='1' cellpadding='2' class='noborder'>
<tr><th colspan=2 align='center'>" . $xml->server->name . "</th></tr>
<tr><td class=row1 align='center'><a href=mumble://" . $xml->server->hostname . "/?version=1.2.0&title=" . $conf_plus['pk_mumble_servername'] . "&url=" . $conf_plus['pk_mumble_website'] . "><img src='$eqdkp_root_path/portal/mumble/images/internet.png' title='If you have Mumble installed, Click here to Connect. You can Drag and Drop this into the Mumble Server Connect Box to make a Permanent Entry.'> Connect</a></td>
<td class=row1 align='center'>" . $mumble_status . "</td></tr>
<tr><td class=row2 align='center'><img src='$eqdkp_root_path/portal/mumble/images/icons_talking_on.png' title='Connected Users'> " . $xml->server->numplayers . "</td>
<td class=row2 align='center'><img src='$eqdkp_root_path/portal/mumble/images/icons_talking_off.png' title='Maximum Users'> " . $xml->server->maxplayers . "</td></tr>
<tr><td class=row1 align='center'><a href=http://mumble.sourceforge.net target=_blank><img src='$eqdkp_root_path/portal/mumble/images/mumble.png' title='Download and Install Mumble, see the Setup Instructions.'> Get Mumble</a></td>
<td class=row1 align='center'><a href=" . $conf_plus['pk_mumble_setup'] . "><img src='$eqdkp_root_path/portal/mumble/images/setup.png' title='Mumble Voice Chat Setup walkthrough with screenshots.'> Setup Instructions</a></td></tr>
</table>";
// OPTIONAL
// If you want to modify the header, use the following
// JS Script Trick (txt+ID in this case: txtmumble
if($conf_plus['pk_mumble_headtext']){
$DKPInfo .= "<script>document.getElementById('txtmumble').innerHTML = '".addslashes($conf_plus['pk_mumble_headtext'])."'</script>";
}
// return the output for module manager
return $DKPInfo;
}
}
?>
And finally the language\english.php sorry no translations into other languages yet! This could use some cleanup and expansion on the help sections.
Code:
<?php
/*
* Project: EQdkp-Plus
* License: Creative Commons - Attribution-Noncommercial-Share Alike 3.0 Unported
* Link: http://creativecommons.org/licenses/by-nc-sa/3.0/
* -----------------------------------------------------------------------
* Began: 2008
* Date: $Date$
* -----------------------------------------------------------------------
* @author $Author$
* @copyright 2006-2008 Corgan - Stefan Knaak | Wallenium & the EQdkp-Plus Developer Team
* @link http://eqdkp-plus.com
* @package eqdkp-plus
* @version $Rev$
*
* $Id$
*/
if ( !defined('EQDKP_INC') ){
header('HTTP/1.0 404 Not Found');exit;
}
$plang = array_merge($plang, array(
'mumble' => 'Hello World',
'portal_mumble_text' => 'Error: You MUST enter a link to the Mumble XML',
'pk_mumble_xmlinput' => 'Enter the Link to the Mumble XML',
'pk_mumble_xmlinputhelp' => 'A link to the qStat Mumble XML file.',
'pk_mumble_setup' => 'Link to the Mumble Setup help.',
'pk_mumble_setuphelp' => 'A link to the Mumble setup help document. You can use http://mumble.sourceforge.net/Mumbleguide if you do not have your own.',
'pk_mumble_headtext' => 'Custom Title for Block Header.',
'pk_mumble_headhelp' => 'This text should not include any html.',
'pk_mumble_servername' => 'The server name for the Connect link.',
'pk_mumble_servernamehelp' => 'This text should not include any html.',
'pk_mumble_website' => 'The website name for the Connect link.',
'pk_mumble_websitehelp' => 'This text should not include any html.',
));
?>