Jump to content

Help with a Ventrilo script


Bloodlvst

Recommended Posts

I posted this in the Ventrilo forums, but they take forever to answer anything, so I'll ask the experts here. I don't quite understand all the functions, but I've modified the script to use DIVs instead of tables. It works great as far as functionality...I'm just running into a formatting issue. The channels listed as sub channels should be indented from the main channels. I tried adding a new <div> echo in different spots but when I added padding thru the external CSS file, it pads ALL the divs. Can anyone tell if there's a way to make only the sub-channels use a certain DIV class, separate from the main channel list?

 

You can view the script at www.aoagaming.com/ventrilo/vent.php

 

Thanks in advance for any help

 

<?php
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Ventrilo Status</title>
<link rel="stylesheet" type="text/css" href="ventrilo.css"/>
</head>';

include "ventrilostatus.php";

$stat = new CVentriloStatus;
$stat->m_cmdprog	= "/home/aoagame/public_html/ventrilo/ventrilo_status";	// Adjust accordingly.
$stat->m_cmdcode	= "2";					// Detail mode.
$stat->m_cmdhost	= "aoagaming.vent.nfoservers.com";			// Assume ventrilo server on same machine.
$stat->m_cmdport	= "33180";				// Port to be statused.
$stat->m_cmdpass	= "";					// Status password if necessary.

/* If there is an error, state failure and notify the user why */
$rc = $stat->Request();
if ( $rc )
{
echo "Unable to fetch Vent status.<br/><strong>Reason:$stat->m_error</strong>";
}

/* Use this if you prefer the first channel name to look more
   like a ventrilo client display where the first entry is the
   server name followed by it's comment.
   
$name = $stat->m_name;
if ( strlen( $stat->m_comment ) )
$name .= " ($stat->m_comment)";
*/
$name = "";

/* Run the VentStatus Function */
echo '<div id="main">';
VentStatus( $stat, $name, 0, 0 );
echo '</div>';

function VentStatus( &$stat, $name, $cid, $bgidx )
{
  $chan = $stat->ChannelFind( $cid );
  
  /* What icon should be displayed for channel type (Public, PW, Lobby) */
  if ($cid == Lobby)
  echo '<img src="../ventrilo/vlogo.png">Ventrilo Server';
  elseif ($chan->m_prot)
  echo "<img src=\"../ventrilo/pwchan.gif\">$name";
  else
  echo "<img src=\"../ventrilo/pubchan.gif\">$name";
  
  echo '      <div class="chanlist">';
  
  // Display Client for this channel.
  
  for ( $i = 0; $i < count( $stat->m_clientlist ); $i++ )
  {
  		$client = $stat->m_clientlist[ $i ];

  		if ( $client->m_cid != $cid )
		continue;
		    
    if ($client->m_cid == Lobby)	
	echo "<img src=\"../ventrilo/user.gif\">$client->m_name";
	else
	echo "<font class=\"user\"><img src=\"../ventrilo/user.gif\">$client->m_name";

/* Uncomment these if you want comments to display */
//		if ( $client->m_comm )
//			echo " ($client->m_comm)";

/* Set any flags (Admin, Phantom) here */			
	$flags = "";

	if ( $client->m_admin )
		$flags .= "A";

	if ( $client->m_phan )
		$flags .= "P";

	if ( strlen( $flags ) )
		echo "\"$flags\"</font><br/>";
  }

  // Display sub-channels for this channel.

  for ( $i = 0; $i < count( $stat->m_channellist ); $i++ )
  {   
  		if ( $stat->m_channellist[ $i ]->m_pid == $cid )
	{ 
		$cn = $stat->m_channellist[ $i ]->m_name;
/* Uncomment these lines to allow sub-channel comments */
//			if ( strlen( $stat->m_channellist[ $i ]->m_comm ) )
//			{
//				$cn .= " (";
//				$cn .= $stat->m_channellist[ $i ]->m_comm;
//				$cn .= ")";
//			}

		VentStatus( $stat, $cn, $stat->m_channellist[ $i ]->m_cid, $bgidx + 1 ); 
	}
  }
  
  echo "      </div>";
}
?>

Link to comment
https://forums.phpfreaks.com/topic/217065-help-with-a-ventrilo-script/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.