Location: PHPKode > projects > ZompLog > admin/functions_display.php
<?php

function handleImages($row,$entryid){
if($row['type'] == 'image/jpeg' || $row['type'] == 'image/pjpeg' || $row['type'] == 'image/gif'){
                                $image = "<p><a href='".ROOT."upload/$row[name]?$row[width],$row[height]'
class='thumbnail' rel='lightbox[$entryid]'><img src='".ROOT."thumbs/$row[name]' alt='image' border='0' class='img' /></a></p>";
                              
}
return $image;
}

function handleFiles($row){
global $override_player;

// plain text, csv, eps, word doc, zip-files, powerpoint, rtf, excel, .tgz, .tar
// these files will all be forced downloaded when a user clicks the link
if($row[type] == 'text/plain' || $row[type] == 'application/postscript' || $row[type] == 'application/msword' || $row[type] == 'application/x-gzip' || $row[type] == 'application/vnd.ms-powerpoint' || $row[type] == 'application/rtf' || $row[type] == 'application/vnd.ms-excel' || $row[type] == 'application/x-tar' || $row[type] == 'application/x-compressed' || $row[type] == 'application/zip' || $row[type] == 'application/pdf'){
$filename=urlencode($row[name]);
// fix to get the real name of the file
$name = substr($row[name],13);
$type=urlencode($row[type]);
$file = " <a href='".ROOT."upload/force_download.php?file=$filename&amp;type=$type'>$name</a><br />";
}

                            
// mp3 embed
if($row[type] == 'audio/mpeg' || $row[type] == 'audio/mp3'){

$filename = $row[name];

if(!$override_player){
if($row[full_url]){
$file = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="209" height="35">
  <param name="movie" value="mp3player.swf?src='. ROOT . 'upload/' . $filename . '">
  <param name="quality" value="high">
  <embed src="mp3player.swf?src=' . ROOT . 'upload/' . $filename . '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="209" height="35"></embed>
</object>';
}
else
{
$file = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="209" height="35">
  <param name="movie" value="mp3player.swf?src='. ROOT . 'upload/' . $filename . '">
  <param name="quality" value="high">
  <embed src="mp3player.swf?src=' . ROOT . 'upload/' . $filename . '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="209" height="35"></embed>
</object>';
}
}
  
}
// quicktime embed
if($row[type] == 'video/quicktime' || $row[type] == 'video/mpeg'  || $row[type] == 'video/mp4'){

$filename = $row[name];

if($row[full_url]){
$file = '<OBJECT CLASSID="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" WIDTH="320" HEIGHT="240"
CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab" BORDER="0"><PARAM NAME="SRC" VALUE="'. ROOT . 'upload/' . $filename . '">
<PARAM NAME="AUTOPLAY" VALUE="FALSE"> <PARAM NAME="CONTROLLER" VALUE="TRUE">
<EMBED SRC="'. ROOT . 'upload/' . $filename . '" WIDTH="320" HEIGHT="240" CONTROLLER="TRUE"
PLUGINSPAGE="http://www.apple.com/quicktime/download/"> </OBJECT>';
}
else
{
$file = '<OBJECT CLASSID="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" WIDTH="320" HEIGHT="240"
CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab" BORDER="0"><PARAM NAME="SRC" VALUE="'. ROOT . 'upload/' . $filename . '">
<PARAM NAME="AUTOPLAY" VALUE="FALSE"> <PARAM NAME="CONTROLLER" VALUE="TRUE">
<EMBED SRC="' . ROOT . 'upload/' .$filename . '" WIDTH="320" HEIGHT="240" CONTROLLER="TRUE"
PLUGINSPAGE="http://www.apple.com/quicktime/download/"> </OBJECT>';
}

}


// RealPlayer embed
if($row[type] == 'audio/x-pn-realaudio'){

$filename = $row[name];

$file = '<embed src="'. ROOT . 'upload/' . $filename . '" width="310" height="240" console="two" controls="ImageWindow" nojava="true" autostart="true"></embed>
 <br>
 <embed src="' . ROOT . 'upload/' . $filename . '" width="310" height="26" console="two" controls="ControlPanel" nojava="true" autostart="true"></embed>';


}
// Windows media embed
if($row[type] == 'video/x-ms-wmv' || $row[type] == 'video/x-ms-wma'){

$filename = $row[name];

if($row[full_url]){
$file = '<embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" autostart="false" height="300" width="320" transparentstart="1" loop="0" controller="true" 
src="' . ROOT . 'upload/' . $filename . '"></embed>';
}
else
{
$file = '<embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" autostart="false" height="300" width="320" transparentstart="1" loop="0" controller="true" 
src="' . ROOT . 'upload/' . $filename . '"></embed>';
}

}


// YouTube embed
if($row[type] == 'video/youtube'){

// because of the way YouTube handles the embed, we need to substract the filename
$video = substr($row[name],31,41);

$file = '<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/'.$video.'"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/'.$video.'" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>';
}

// vimeo, youtube, myspace, etc embed code
if($row[type] == 'embed'){
$file .= $row[full_url];
}


return $file;
}

?>
Return current item: ZompLog