Enhanced skin oddities

Geffy

Verified User
Joined
Aug 24, 2004
Messages
82
I am trying to get DirectAdmin to run with php 5.1.2. Most of it seems to be working, but the Enhanced skin is having problems. (I havent tried the other skins yet, but I would imagine they have the same problem)

The problem is that for areas like the bandwidth and quota bars I just get a load of '?' characters. The exact number is 1130 according to wc -c.
The subject area seems to be generated by a CLI PHP script. I have looked and its doing something along the lines of
Code:
|$/usr/local/bin/php
<?php

show_bar("<b>Bandwidth</b><br>", "14.933", "100.00", "bandwidth_bar");
show_bar("<b>Disk Space</b><br>", "784.79", "30000", "quota_bar");

function show_bar($text, $used, $limit, $id)
{
		if($limit==0) return;

		$left=round(($used/$limit)*100);
		$right=100-$left;

		switch(TRUE)
		{
			case ($left > 90)	: $color = "RED";		break;
			case ($left > 70)	: $color = "ORANGE";	break;
			case ($left > 50)	: $color = "YELLOW";	break;
			default				: $color = "GREEN";		break;
		}

		$bg="/IMG_SKIN_BAR_BG_".$color;
		$leftImg="/IMG_SKIN_BAR_LEFT_".$color;
		$rightImg="/IMG_SKIN_BAR_RIGHT_".$color;

		if($left >= 100)
		{
		   $overBg="/IMG_SKIN_BAR_BG_".$color;
		} else {
		   $overBg="/IMG_SKIN_BAR_BG_BLUE";
		}

		$overBg="/IMG_SKIN_BAR_BG_BLUE";

		echo $text;

		?>
			<table border="0" width="170" cellspacing="0" cellpadding="0" background="<?php echo $overBg;?>">
				<tr>
					<td width=3 align=left><img border="0" src="<?php echo $leftImg;?>" width="3" height="17"></td>
					<td width="1%" id=<?=$id?> background="<?php echo $bg;?>"></td>
					<td width=1 align=left><img border="0" src="<?php echo $rightImg;?>" width="1" height="17"></td>
					<td width=100%></td>
					<td width=1 align=right><img src="/IMG_SKIN_BAR_RIGHT_BLUE" width="1" height="17"></td>
				</tr>
			</table>

					<script language="Javascript">
					<!--

					<?php echo $id?>_top=<?php echo $left>100?100:$left;?>;
					<?php echo $id?>_current=0;

					function <?php echo $id?>_scroll()
					{
						again = true;
						<?php echo $id?>_current += 10;
						if (<?php echo $id?>_current >= <?php echo $id?>_top)
						{
							<?php echo $id?>_current = <?php echo $id?>_top;
							again=false;
						}

						if (document.getElementById)
						{
							my_style = document.getElementById("<?php echo $id?>").style;
						}
						else if (document.all)
						{
							my_style = document.all["<?php echo $id?>"].style;
						}
						else if (document.layers)
						{
							my_style = document.layers["<?php echo $id?>"];
						}

						my_style.width=<?php echo $id?>_current+"%";

						if (again)
							setTimeout("<?php echo $id?>_scroll();", 50);
					}

					setTimeout("<?php echo $id?>_scroll();", 1000);

					//-->
					</script>

<?php
}
?>

DONE|
I have extracted this portion of the script from the file and tried running it through the php cli. It works if I store it in a file and use
Code:
/usr/local/bin/php skin.segment.php
and the correct code is generated. If I copy it and paste it as standard output into the command line interpreter I get the following error

Parse error: syntax error, unexpected '}' in - on line 85

line 85 is
Code:
					</script>

if I try to run something like this
Code:
<?php
echo "hello\n";
?>
though the interpreter I get the following
Code:
server# /usr/local/bin/php
<?php
echo "hello\n";
?>
?>
server#

the same goes for a server with php 4.4.0 on it, however the php4 server doesnt have this problem.
The only other difference between the two servers is that the one running php 5.1.2 is FreeBSD6 and the one running php 4.4.0 is FreeBSD 4.8

We are wanting to replace the 4.8 server with the 6.0 server but this particular problem is pretty much a show-stopper at the moment.

Also for reference the number of characters which should be output is 2786 and the number of characters in the php script is 2251 so there doesnt seem to be a correlation there.
 
Last edited:
I resolved this by building a cut down php4 binary with a prefix of /usr/local/directadmin/php
then changing the paths which the template used for accessing the php binary
 
Back
Top