<?php
if(!defined('IN_FUSION')) {
die;
}
if(!empty($pdp->settings['theme'])) {
include_once(INFUSIONS.'pro_download_panel/themes/'
.$pdp->settings['theme'].'/theme.php');
}
if(!function_exists('pdp_render_cats')) {
function pdp_render_cats($catid, $in_down, &$path, &$cats)
{
global $locale;
echo "<hr width='80%' align='left'/>";
// path
$level = 0;
$bullet = "»";
foreach($path as $data) {
if($data['id']==$catid && !$in_down) {
echo str_repeat(" ", $level*4).$bullet
." <b>".$data['name']."</b><br />\n";
} else {
echo str_repeat(" ", $level*4).$bullet
." <a href='".BASEDIR."lektioner.php?catid=".$data['id']."'>"
.$data['name']."</a><br />\n";
}
++$level;
}
// child cats
foreach($cats as $id => $data) {
$more = array();
if($data['cnt_downs']) {
$more[] = $data['cnt_downs']." ".$locale['pdp_downloads'];
}
if($data['cnt_cats']) {
$more[] = $data['cnt_cats']." ".$locale['PDP222'];
}
echo str_repeat(" ", $level*4).$bullet
." <a href='".BASEDIR."lektioner.php?catid=$id'>".$data['name']."</a>";
if(count($more)) {
echo " (".implode(" - ", $more).")";
}
echo "<br />\n";
}
}
}
if(!function_exists('pdp_render_downs')) {
function pdp_render_downs(&$downs, $rowstart, $per_page, $count, $link)
{
global $locale;
foreach($downs as $data) {
if($data['is_new']) {
$new = " <img src='".INFUSIONS."pro_download_panel/icons/new.gif'"
." alt='".$locale['pdp_new']."' />";
} else {
$new = "";
}
echo "<table border='0' width='80%'>
<tr>
<td width='1%'><img src='".INFUSIONS."pro_download_panel/icons/project.gif' alt='' /></td>
<td><b><a href='".$data['href']."'>".$data['name']."</a></b>$new<br />";
//echo "<a href='".BASEDIR."lektioner.php?did=".$data['id']."'>".$data['name']."</a>";
/*<span class='small2'>".($data['user_id'] ? $locale['PDP214']." <a href='".INFUSIONS."pro_download_panel/profile.php?id=".$data['user_id']."'>".$data['user_name']."</a> " : "")
.showdate("shortdate", $data['mtime'])."</span>*/
echo "</td>
<td align='right' style='white-space:nowrap;'>";
//".$locale['pdp_downloads'].": ".$data['downloads']."<br />
//if $data['comments']!=0 { echo "".$locale['PDP021'].": ".$data['comments']."";}
echo "</td>
</tr>
<tr>
<td colspan='3'>".$data['desc']."</td>
</tr>
</table>";
}
if($count > $per_page) {
echo '
<div style="text-align:center;">'
.makePageNav($rowstart, $per_page, $count, 3, $link).'
</div>';
}
}
}
if(!function_exists('pdp_render_download')) {
function pdp_render_download($id, $data, $links, $files, $images, $old_data)
{
global $locale, $pdp, $sft;
$down_link = '';
if(!$data['can_download']) {
;
} elseif(!empty($old_data['down']) || !empty($old_data['link_extern'])){
$down_link = array(
'did' => $id,
'file' => 0,
);
} elseif(count($files)) {
$latest_download = array_shift($files);
$down_link = array(
'did' => $id,
'file' => $latest_download['id'],
);
$old_ver = $latest_download['ver'];
$old_size = $latest_download['size'];
array_unshift($files, $latest_download);
}
if(is_array($down_link)) {
$down_link = '
<form action="'.INFUSIONS.'pro_download_panel/file.php" method="get">
<input type="hidden" name="did" value="'.$down_link['did'].'" />
<input type="hidden" name="file_id" value="'.$down_link['file'].'" />
<input type="submit" class="button" value="'.$locale['PDP201'].'" />
</form>';
} else {
$down_link = parseubb($pdp->settings['download_restricted']);
if(FUSION_VERSION!='FF') {
$down_link = nl2br($down_link);
}
}
if(!empty($data['pic'])) {
$pic = $data['pic'];
$pic_id = 0;
} elseif(count($images)) {
$first_pic = $images[0];
$pic = $first_pic['url'];
$pic_id = $first_pic['id'];
} else {
$pic = "";
}
//OVERSKRIFT PÅ LEKTIONEN
echo "<br /><br /><br /><font size='+1'><b>".$data['name']."</b></font>\n";
echo "<hr width='80%' align='left'/>
<table border='0' cellspacing='2' width='100%' cellpadding='0'>
<tr>
<td valign='top' colspan='2'>".$data['desc']."</td>
<td valign='top' colspan='2' width='250'>";
/*if ($sft) {*/
foreach($files as $row)
{
$rowid=$row['id'];
$resFile = dbquery("SELECT * FROM ".DB_PDP_FILES." WHERE download_id='$rowid' AND file_type_id='6'");
while($rows = mysql_fetch_array($resFile))
{
echo $rows['file_type_id'] . "<br>\n";
}
echo "<br />";
//if($file_type_id == $sft) {
// mp3 = 6
//if($sft=='6') {
//echo "<a href='downloads/".$row['url']."'>Hent filen: ".$row['url']."</a>";
if (!iMEMBER) { redirect("".INFUSIONS."restricted/index.php"); }
if(!empty($row['desc'])) { echo "<b>".$row['desc']."</b><br />"; }
echo "<OBJECT ID='MediaPlayer' WIDTH='200' HEIGHT='45' CLASSID='CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95'
STANDBY='Henter afspilleren - vent venligst...' TYPE='application/x-oleobject'>
<PARAM NAME='FileName' VALUE='downloads/".$row['url']."'>
<PARAM name='autostart' VALUE='false'>
<PARAM name='ShowControls' VALUE='true'>
<param name='ShowStatusBar' value='false'>
<PARAM name='ShowDisplay' VALUE='false'>
<EMBED TYPE='application/x-mplayer2' SRC='downloads/".$row['url']."' NAME='MediaPlayer'
WIDTH='200' HEIGHT='45' ShowControls='1' ShowStatusBar='0' ShowDisplay='0' autostart='0'> </EMBED>
</OBJECT><br />";
/*
add_to_head("<script type='text/javascript' src='jwplayer/jwplayer.js'></script>");
echo "<video src='downloads/".$row['url']."' height='50' width='400' id='container' poster='/images/video-poster.jpg'></video><script type='text/javascript'>jwplayer('container').setup({flashplayer: 'jwplayer/player.swf'});</script><br />";
*/
if (iADMIN) {
echo "<a href='".INFUSIONS."pro_download_panel/file.php?did=".$id."&file_id=".$row['id']."'"." title='".$row['url']."'>Hent mp3 filen her.</a><br /><br />";
if(!empty($row['desc'])) {
/*echo " (".$row['desc'].")"; */}
/*echo "<br /><hr width='80%' align='left'/><br />";*/
//}
}}
echo"</td>
<td width='150' valign='top' rowspan='2'>
<table class='tbl-border' cellspacing='1' width='100%'>";
//SIDEBOKSEN
// version
if(!empty($old_data['version'])) {
echo "<tr><td class='tbl2' align='center'>".$locale['PDP018'].":<br />".$old_data['version']."</td>";
}
// homepage
if(!empty($data['homepage'])) {
echo "<tr><td class='tbl2' align='center'><a href='".$data['homepage']."'"." target='_blank'>".$locale['PDP020']."</a></td>";
}
/* screenshot
if(!empty($pic)) {
echo "<tr><td align='center' class='tbl2'>"."<a href='".INFUSIONS."pro_download_panel/image.php?did=".$id."&pic_id=$pic_id'>"
.$locale['PDP028']."</td></tr>";
} */
// download count
echo "<tr><td align='center' class='tbl2'>".$locale['pdp_downloads'].":<br />".pdpCore::format_number($data['count'])."</td></tr>";
// FIXME TODO
if(!empty($old_data['size'])) {
echo "<tr><td align='center' class='tbl2'>".$locale['PDP029'].":<br />".$old_data['size']."</td></tr>";
}
if(!empty($data['license'])) {
echo "<tr>
<td align='center' class='tbl2'>".$locale['pdp_license'].': '
.$data['license']."</td></tr>";
}
// who posted and when.
/* echo "<tr><td align='center' class='tbl2'>"
.($data['user_id']
? "<a href='".INFUSIONS."pro_download_panel/profile.php?id=".$data['user_id']."'>"
.$data['user_name']."</a><br />"
: "")
.showdate("shortdate", $data['mtime'])."</td>
</tr>\n";*/
if(!empty($data['copyright'])) {
echo "<tr>
<td class='tbl2' align='center'>".$data['copyright']."</td>
</tr>\n";
}
if($data['allow_notify']) {
if($data['can_subscribe']) {
echo "<tr>
<td class='tbl2' align='center' style='background-color:#D4AAFF'>".($data['is_subscribing']
? "<a href='".INFUSIONS."pro_download_panel/include/do_did.php?did=".$id."&subscibe=0'>Marker Lektionen som afsluttet!</a>"
: "<a href='".INFUSIONS."pro_download_panel/include/do_did.php?did=".$id."&subscibe=1'>Marker Lektionen her, som værende i gang!</a>")
."</td>
</tr>\n";
}
}
//FACEBOOK DEL KNAPPEN
echo "</table>";?>
<center><br /><br /><a onclick="window.open('
http://www.facebook.com/share.php?u=http://<?php echo $_SERVER["HTTP_HOST"].urlencode($_SERVER["REQUEST_URI"]); ?> ','Del siden med dine venner','width=600,height=400");return false;' href='
http://www.facebook.com/share.php?u=http://<?php echo $_SERVER["HTTP_HOST"].urlencode($_SERVER["REQUEST_URI"]); ?> ' target='_blank'><img src='images/knapper/fb.jpg'></a></center></td></tr></table><hr width='80%' align='left'/>
<?php
// screenshot
if(!empty($pic)) {
echo "<table><tr><td align='center' class='tbl2'>"."<a href='".INFUSIONS."pro_download_panel/image.php?did=".$id."&pic_id=$pic_id'>LEKTION BILLEDER</td></tr></table>";
}
// report broken downloads
echo "<div align='right'>";
if(iPDP_BROKEN) {
echo "[ <a href='".INFUSIONS."pro_download_panel/broken.php?did=".$id."'>".$locale['PDP024']."</a> ]<br />";
}
// edit link
if(count($links)) { echo "<b>".$locale['pdp_edit'].":</b> <a href='".INFUSIONS."pro_download_panel/edit_desc.php?did=".$id."'>[Beskrivelse]</a>
<a href='".INFUSIONS."pro_download_panel/edit_files.php?did=".$id."'>[Filer]</a>
<a href='".INFUSIONS."pro_download_panel/edit_admin.php?did=".$id."'>[Moderator]</a>
<a href='".INFUSIONS."pro_download_panel/edit_comments.php?did=".$id."'>[Kommentarer]</a>
<a href='".INFUSIONS."pro_download_panel/edit_misc.php?did=".$id."'>[Slet]</a>"; }
echo "</div>\n";
// filetype icons, 1,2,3,4,5,6
$filetypeIcons = array("pdf", "doc", "mp4", "sib", "tube", "mp3");
// filetype buttons and alt-text in correct order
$knapFile = array("pdf_cat", "video_cat", "scorch_cat", "mp3_cat", "youtube_cat");
$knapID = array("1", "3", "4", "6", "5");
$knapText = array("Hent denne lektion i pdf format. Print den ud eller gem den på din computer",
"Se video lektion",
"Se node til denne lektion. Afspil, juster tempo og toneart efter dine behov",
"Afspil lyd eksempler og Jamtracks tilhørende denne lektion",
"Se og hør Youtube video. Brug det som Jamtrack, eller som inspiration!");
echo "<center>\n";
for ($iKnap=0;$iKnap<5;$iKnap++) {
$resFiles = dbquery("SELECT file_id FROM ".DB_PDP_FILES." WHERE download_id='$id' AND file_type_id='$knapID[$iKnap]'");
if ($data = dbarray($resFiles)) {
echo "<a href='lektioner.php?did=".$id."&sft=".$knapID[$iKnap]."' title='".$knapText[$iKnap]."'><img src='images/lektioner/ikoner/".$knapFile[$iKnap].".gif' alt='".$knapText[$iKnap]."' /></a>\n";
} else {
echo "";
//echo "<img src='images/lektioner/ikoner/".$knapFile[$iKnap]."_no.gif' target='_blank' alt='".$knapText[$iKnap]."' />\n";
}
}
echo "</center>";
//if(count($files)) {
// echo '<strong>'.$locale['PDP200'].":</strong>\n";
//}
// vis filer hvis sft=ShowFileTypes er givet
if ($sft) {
foreach($files as $row) {
// identify file type
$rowid=$row['id'];
$resFileType = dbquery("SELECT * FROM ".DB_PDP_FILES." WHERE file_id='$rowid'");
if ($filedata = dbarray($resFileType)) $file_type_id = $filedata['file_type_id'];
echo "<br />";
if($file_type_id == $sft) {
// scorch / node / sib = 4
if($sft == '4'){
if (!iMEMBER) { redirect("".INFUSIONS."restricted/index.php"); }
echo "<center><object id='ScorchPlugin'
classid='clsid:A8F2B9BD-A6A0-486A-9744-18920D898429' width='604' height='896'
codebase='
http://www.sibelius.com/download/software/win/ActiveXPlugin.cab#6,2,0,88'>
<param name='src' value='downloads/".$row['url']."' />
<param name='type' value='application/x-sibelius-score' />
<param name='scorch_minimum_version' value='5000' />
<param name='scorch_preferred_version' value='5000' />
<param name='scorch_shrink_limit' value='90' />
<embed src='downloads/".$row['url']."'
scorch_minimum_version='5000'
scorch_preferred_version='5000'
scorch_shrink_limit='90'
width='604'
height='896'
type='application/x-sibelius-score'
pluginspage='
http://www.sibelius.com/cgi/plugin.pl'> </embed>
</object>
<br />Hvis du ikke kan se noden, <a href='
http://www.sibelius.com/scorch/'>Hent Sibelius Scorch plugin her</a></center>";
if (iADMIN) {echo "<br /><hr width='10%' align='left'/><a href='".INFUSIONS."pro_download_panel/file.php?did=".$id."&file_id=".$row['id']."'"." title='".$row['url']."'>".trimlink($row['url'], 40)."</a>";
if(!empty($row['desc'])) {echo " (".$row['desc'].")"; }
echo "<br /><hr width='80%' align='left'/><br />";}
}
// youtube = 5
if($sft == '5') {
echo "<center><iframe title='YouTube video player' width='640' height='390' src='
http://www.youtube.com/embed/".$row['url']."' frameborder='0' allowfullscreen></iframe></center>";
}
// video = 3
if($sft=='3') {
if (!iMEMBER) { redirect("".INFUSIONS."restricted/index.php"); }
/* echo "<center><OBJECT ID='MediaPlayer' WIDTH='640' HEIGHT='360' CLASSID='CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95'
STANDBY='Henter afspilleren - vent venligst...' TYPE='application/x-oleobject'>
<PARAM NAME='FileName' VALUE='video/".$row['url']."'>
<PARAM name='autostart' VALUE='false'>
<PARAM name='ShowControls' VALUE='true'>
<param name='ShowStatusBar' value='false'>
<PARAM name='ShowDisplay' VALUE='false'>
<EMBED TYPE='application/x-mplayer2' SRC='video/".$row['url']."' NAME='MediaPlayer'
WIDTH='537' HEIGHT='360' ShowControls='1' ShowStatusBar='0' ShowDisplay='0' autostart='0'> </EMBED>
</OBJECT></center>"; */
if(!empty($row['desc'])) {echo " (".$row['desc'].")"; }
add_to_head("<script type='text/javascript' src='jwplayer/jwplayer.js'></script>");
echo "<center><video src='video/".$row['url']."' height='360' width='640' id='container' poster='images/video-poster.jpg'></video>
<script type='text/javascript'>jwplayer('container').setup({flashplayer: 'jwplayer/player.swf'});</script></center>";
}
// pdf = 1
if($sft=='1') {
//echo "<a href='downloads/".$row['url']."'>Hent filen: ".$row['url']."</a>";
if (iMEMBER) {echo "<a href='".INFUSIONS."pro_download_panel/file.php?did=".$id."&file_id=".$row['id']."'"." title='".$row['url']."'><img src='images/lektioner/ikoner/".$filetypeIcons[$file_type_id-1].".gif' /> ".trimlink($row['url'], 40)."</a>"; }
if (iGUEST) {echo "<a href='".INFUSIONS."restricted/index.php'><img src='images/lektioner/ikoner/".$filetypeIcons[$file_type_id-1].".gif' /> ".trimlink($row['url'], 40)."</a>"; }
if(!empty($row['desc'])) {echo " (".$row['desc'].")"; }
}
}
//DENNE KODE SKAL RETTES TIL!!! VISER LIGE NU ALLE DOC, PDF OG SIB FILER FOR ADMINS.
// vis docs for admins under pdf filerne
if($sft=='1' && iADMIN) {
echo "<a href='".INFUSIONS."pro_download_panel/file.php?did=".$id."&file_id=".$row['id']."'"." title='".$row['url']."'><br /><br /><br /><br /><img src='images/lektioner/ikoner/".$filetypeIcons[$file_type_id-1].".gif' /> ".trimlink($row['url'], 40)."</a>";
if(!empty($row['desc'])) {echo " (".$row['desc'].")"; }
}
}
echo "<br />";
}
}
}
function pdp_menu()
{
global $locale, $pdp, $userdata;
$user_links = array();
$admin_links = array();
$user_links[] = "<a href='".BASEDIR."lektioner.php'>Nyeste lektioner</a>";
//$user_links[] = "<a href='".BASEDIR."lektioner.php?catid=0'>".$locale['PDP820']."</a>";
$user_links[] = "<a href='".INFUSIONS."pro_download_panel/search.php'>".$locale['PDP040']."</a>";
if(iMEMBER || iPDP_ADMIN || iPDP_MOD) {
if(ff_db_count('(*)', DB_PDP_CATS,
groupaccess('cat_upload_access')))
{
$user_links[] = "<a href='".INFUSIONS."pro_download_panel/edit_desc.php'>".$locale['PDP038']."</a>";
}
if(ff_db_count('(*)', DB_PDP_DOWNLOADS,
"user_id='".$userdata['user_id']."'")
|| ff_db_count('(*)', DB_PDP_NOTIFY,
"user_id='".$userdata['user_id']."'"))
{
$user_links[] = "<a href='".INFUSIONS."pro_download_panel/profile.php"."?id=".$userdata['user_id']."'></a>";
}
}
if(iPDP_MOD) {
$admin_links[] = '<a href="'.INFUSIONS.'pro_download_panel/mod.php">'.$locale['pdp_moderator'].'</a>';
}
if(iPDP_ADMIN) {
$admin_links[] = '<a href="'.INFUSIONS.'pro_download_panel/admin/admin.php">'.$locale['PDP016'].'</a>';
}
//$admin_links[] = '<a href="'.INFUSIONS.'pro_download_panel/copyright.php">'.$locale['PDP039'].'</a>';
pdp_render_menu($user_links, $admin_links);
}
if(!function_exists('pdp_render_menu')) {
function pdp_render_menu($user_links, $admin_links)
{
global $locale, $stext;
if(isset($_GET['stext'])) {
$stext = stripinput($_GET['stext']);
} else {
$stext = '';
}
echo '
<div style="float:left; padding-right:5px;">'.implode(' | ', $user_links).'</div>
<div style="float:right; padding-left:5px;">'.implode(' | ', $admin_links).'</div>
<div style="clear:both;"></div>';
/*<form action="'.INFUSIONS.'pro_download_panel/search.php" method="get">
<input type="text" size="20" maxlength="30" name="stext" class="textbox" value="'.$stext.'" />
<input type="submit" value="'.$locale['PDP040'].'" class="button" />
</form>'; */
}
}
?>