Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Seeking applications ...
Author Message
rave41799
New Member
New Member


Joined: Oct 20, 2005
Posts: 9

PostPosted: Tue Jan 31, 2006 9:55 pm Reply with quote

I'm trying to get a Ventrilo module I have into a block. I've found some Ventrilo blocks but they haven't worked. I finally found a MODULE, but I want to use it as a block on the right side of my page.

Unfortunately I do not have any money to pay for this but really need help converting this. I barely know where to begin ....

To anyone that can help, I GREATLY appreciate it ....

Here's the code:

Code:


<?php
if (!stristr($_SERVER['SCRIPT_NAME'], "modules.php")) {
   die ("You can't acces this file directly...");
}
####################################################################
#  This file is Copyright (c) 2004 Scott Benson                    #
Only registered users can see links on this board! Get registered or login!                                    #
# Code modified to work as page by  BA-cae and Orion               #
# Only registered users can see links on this board! Get registered or login!                                    #
# Only registered users can see links on this board! Get registered or login!                                      #
####################################################################
# Edit server info                                                 #
####################################################################
global $cookie, $prefix, $multilingual, $currentlang, $db;
$row = $db->sql_fetchrow($db->sql_query("SELECT * FROM ".$prefix."_ventrillo"));


$ventip =  $row['ventip'];  // Ventrilo Server hostname/IP.
$ventport = $row['ventport'];  // Port to be statused.
$ventpass = $row['ventpass']; // Status password if necessary.
$servername = $row['servername']; // Name of your vent server no spaces. ie "MY-VENT-SERVER"
// Enable the connect to link//
$enable_link = $row['enablelink'];  // "0" off "1" on//
// Background color option //
$bgcolor = ""; //Color of backgroung around the conect image.ie "#000000". blank for themes colors
$bgcolor2 = ""; //Color of backgroung around the channels. blank for themes colors
$width = "75%"; //width of the channels table
// Text color options //
$servertext = "#00ffff"; // Color of server text.ie "#000000". leave blank for default theme colors
//$chaneltext = "#00e5ee"; // Color of channels text.ie "#000000". leave blank for default theme colors
//$clienttext = "#ffffff"; // Color of user text.ie "#000000" . leave blank for default theme colors
// Image options make sure to complete the path from the root ie. images/ventrilo.png //
$connect_to_image = "images/venthead.gif"; // Path to the image for the the "Connect To" link. no wider than 500px. default is "images/venthead.gif"
$serverimage = "images/ventserver-2.gif"; //Image to be displayed next to server name from root. default is "images/ventserver-2.gif"
$channelimage = "images/ventchannel-2.gif"; // Image to be displayed next to each channel from root. 18x18 suggested. default is "images/ventchannel-2.gif"
$clientimage = "images/ventclient-2.gif"; // Image to be displayed next to all online users from root. 18x18 suggested. default is "images/ventclient-2.gif"
#############################################################################################
#below you can activate or disable the images next to the channels,server name, and clients #
#############################################################################################
$enable_graphics = "1"; /// DO NOT EDIT THIS LINE ///
$graphics['1']['SERVER']= "<img src=\"".$serverimage."\" align=\"middle\" border=\"0\">"; ///['1'] on ['0'] off
$graphics['1']['CLIENT']= "<img src=\"".$clientimage."\" align=\"middle\" border=\"0\">";  ///['1'] on ['0'] off
$graphics['1']['CHANNEL']= "<img src=\"".$channelimage."\" align=\"middle\" border=\"0\">";  ///['1'] on ['0'] off
####################################################################
#Do not edit below unles you know what you are doing               #
####################################################################
//Location of remote script.//
$vent_url = "http://primarytarget.com/ventrilostatus/ventstatus.php?detail=2&ip=".$ventip."&port=".$ventport."&pass=".$ventpass;
// Beginning of Code do not edit below //
$lines = file($vent_url);
$channels[] = 0;
$settings['CHANNEL'][0]['CID'] = "0";
$settings['CHANNEL'][0]['NAME'] = "Main Lobby";
foreach ($lines as $line) {
   if ( $line == "" ) {
      next($line);          # Ignore blankline
   } elseif ( $line == "\n" ) {
      next($line);      # Ignore newline
   } elseif ( $line == " " ) {
      next($line);
//   } elseif ( strstr($line,"#")) {
   //   next($line); # Ignore comments
   } else {
      $line = rtrim($line);  # Get rid of newline characters
      $line = ltrim($line);  # Get rid of any leading spaces
      $value = preg_split("/\s*:\s*/", $line, 2); # split by "=" and removing blank space either side of it.
      if (($value[0] == "CHANNEL") or ($value[0] == "CLIENT")) {
         $vars = preg_split("/\s*,\s*/", $value[1]);
         foreach ($vars as $var) {
            $chanvar = preg_split("/\s*=\s*/", $var);
            if ($value[0] == "CHANNEL") {
               if ($chanvar[0] == "CID") {
                  $channels[] = $chanvar[1];
                  $id = $chanvar[1];
               }
               if ($chanvar[0] == "PID") {
                  $subchans[$id][] = $chanvar[1];
               }
            //   $key = "CID";
            } elseif ($value[0] == "CLIENT") {
               if ($chanvar[0] == "UID") {
                  $clients[] = $chanvar[1];
                  $id = $chanvar[1];
               }
               //$id = "UID";
            }
            $settings[$value[0]][$id][$chanvar[0]] = $chanvar[1];
            $key="";
         }
      } else {
         $settings[$value[0]] = $value[1]; # Create a new array with all the values.
      }
   }
}
$serverpic = $graphics[$enable_graphics][SERVER];
$clientpic = $graphics[$enable_graphics][CLIENT];
$channelpic = $graphics[$enable_graphics][CHANNEL];
#erase next line

echo "<DIV STYLE=\" background-color: ".$bgcolor."; font-size: 10pt; align: center; width: 100%; height: ; padding:0px; margin: 0px;\">";
//Connect to image//
if ($enable_link == "1") {
   echo "<div align=\"center\"><a href=\"ventrilo://".$ventip.":".$ventport."/servername=".$servername."\"><img src=".$connect_to_image." border=\"0\" alt=\"Click to Join\"></a><br>\n";
    echo "<br>";
}
//Server name//
echo "<b><font color=".$servertext.">".$serverpic.$settings[NAME]."</font></b><br>\n";
echo "<br>";
//Begin of display//
echo "<table style=\"margin-left: auto;
margin-right: auto;\" align=\"center\" width=\"".$width."\" border=\"1\" cellpadding=\"0\" bgcolor=\"".$bgcolor2."\">";
//Beginning of channel layout//

foreach ($channels as $channel) {
   $cid = $settings['CHANNEL'][$channel]['CID'];
   $pid = $settings['CHANNEL'][$channel]['PID'];
   $chaname = $settings['CHANNEL'][$channel]['NAME'];
   if ($pid == 0 || $cid == 0) {
       echo "<tr><td>";
       echo  "<b><font color=".$chaneltext.">".$channelpic.$chaname."</font></b><br /></tr></td>\n";
      $listedcid[] = $cid;
   }
$num = $pid;
$num2 = $cid;
   if ($clients && $pid == 0) {
      foreach ($clients as $client) {
         $current = $settings['CLIENT'][$client]['CID'];
         if ($current == $channel) {
            $name = $settings['CLIENT'][$client]['NAME'];
             echo "<tr><td>";
             echo "&nbsp;&nbsp;".$clientpic."<i><font color=".$clienttext.">$name</font></i><br /></tr></td>\n";
         }
      }
   }
foreach ($channels as $channel){
   $cid = $settings['CHANNEL'][$channel]['CID'];
   $pid = $settings['CHANNEL'][$channel]['PID'];
   $chaname = $settings['CHANNEL'][$channel]['NAME'];
   if ($cid != 0 && $pid != 0 && $pid == $num2){
      if (in_array($cid,$listedcid) == false) {
      echo "<tr><td>";
      echo  "&nbsp;&nbsp;&nbsp;&nbsp;<b><font color=".$chaneltext.">".$channelpic.$chaname."</font></b><br /></td></tr>\n";
         
      $listedcid[] = $cid;
         if ($clients) {
         foreach ($clients as $client) {
            $current = $settings['CLIENT'][$client]['CID'];
            if ($current == $channel) {
               $name = $settings['CLIENT'][$client]['NAME'];
               echo "<tr><td>";
               echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".$clientpic."<i><font color=".$clienttext.">$name</font></i><br /></td></tr>\n";
            }
         }
   }
   $num3 = $cid;
   foreach ($channels as $channel){
      $cid = $settings['CHANNEL'][$channel]['CID'];
      $pid = $settings['CHANNEL'][$channel]['PID'];
      $chaname = $settings['CHANNEL'][$channel]['NAME'];
      if ($cid != 0 && $pid != 0 && $pid == $num3){
         if (in_array($cid,$listedcid) == false) {
         echo "<tr><td>";
         echo  "<b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color=".$chaneltext.">".$channelpic.$chaname."</font></b><br /></td></tr>\n";
         $listedcid[] = $cid;
         }
         if ($clients) {
         foreach ($clients as $client) {
            $current = $settings['CLIENT'][$client]['CID'];
            if ($current == $channel) {
               $name = $settings['CLIENT'][$client]['NAME'];
               echo "<tr><td>";
               echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".$clientpic."<i><font color=".$clienttext.">$name</font></i><br /></td></tr>\n";
            }
         }
         }
      }
   }
}
}
}
}
echo "</table></div>";
echo "<br>";
echo "</div>";

?>
 
View user's profile Send private message
kguske
Site Admin


Joined: Jun 04, 2004
Posts: 6383

PostPosted: Tue Jan 31, 2006 10:17 pm Reply with quote

Not sure how big the block would be (though it probably wouldn't be bad as a center block if it's too big for left / right blocks). But the differences between modules and blocks are fairly simple (look at existing blocks for examples):

- change the security code at the beginning that prevents direct access
- instead of echo or print, set whatever HTML you want to display in the $content variable.

For example, instead of:
Code:
echo "Print this first<br>";

echo "Print this second<br/>";

You would use:
Code:
$content = "Print this first<br>";

$content .= "Print this second<br/>";


Note the period before the second (and subsequent) assignments. That adds the HTML, rather than replacing it (which is what would happen if you didn't use the period).

For more info, check the Only registered users can see links on this board! Get registered or login!.

_________________
I google, therefore I exist...
Only registered users can see links on this board! Get registered or login!
 
View user's profile Send private message
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Seeking applications ...

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©