Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> General/Other Stuff
Author Message
rave41799
New Member
New Member



Joined: Oct 20, 2005
Posts: 9

PostPosted: Tue Jan 31, 2006 3:44 pm Reply with quote

Trying to create a PHP block to use on my main page from the code below.

Can anyone help!?? I tried using the "how to create a block from a module" in the PHPNuke help but didn't get anywhere.

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                    #
scott@sbhostingsolutions.com                                    #
# Code modified to work as page by  BA-cae and Orion               #
# BA-CAE@clanadmin-exchange.com                                    #
# www.clanadmin-exchange.com                                       #
####################################################################
# 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>";

?>


Last edited by rave41799 on Wed Feb 01, 2006 1:24 pm; edited 1 time in total 
View user's profile Send private message
hitwalker
Sells PC To Pay For Divorce



Joined:
Posts: 5661

PostPosted: Tue Jan 31, 2006 5:32 pm Reply with quote

well this will be a hell of a job turning this into a block...
You would have more chance posting this on a request forum .
http://www.ravenphpscripts.com/forum23.html
and looking at to conversion and the work this can easely turn into a paid job.
 
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 -> General/Other Stuff

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 ©