<?php
/************************************************************************/
/* PHP-NUKE: Top Music Most Visited Songs */
/* ======================================= */
/* */
/* Copyright (c) 2004-2005 by Sergids */
/* http://www.sergids.com */
/* */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License. */
/************************************************************************/
/*****************/
/* configuration */
/*****************/
//number of songs to show
$tmNumVisitedSongs=10;
//if you have changed the Top Music Module name, reflect it here:
$tmModuleName="topMusic";
/***************************************************************/
//Don't touch this code please
if (eregi("block-TopMusic_Most_Visited_Songs.php",$_SERVER[PHP_SELF])) {
Header("Location: ../index.php");
die();
}
//global $prefix, $db;
require_once("modules/".$tmModuleName."/lib/com/sergids/topmusic/model/SongDAO.php");
global $db,$prefix,$currentlang;
if(!is_object($tm_config)){
require_once("modules/".$tmModuleName."/lib/com/sergids/topmusic/model/ConfigDAO.php");
require_once("modules/".$tmModuleName."/lib/com/sergids/topmusic/model/ConfigO.php");
$configDAO= new ConfigDAO($db,$prefix);
$tm_config=$configDAO->load();
}
//use easy URL? (according to config.php in module directory)
$TMEasyURL=$tm_config->getEasyURL();
//EasyURL type (URL content)
$TMEasyURLType=$tm_config->getEasyURLType();
$songDAO=new SongDAO($db,$prefix);
$songList=$songDAO->getMostVisitedSongs($tmNumVisitedSongs);
$content="<table cellspacing=\"2\" cellpadding=\"0\" border=\"0\">\n";
if(count($songList)>0){
for($i=0;$i<count($songList);$i++){
$song=$songList[$i];
$title=$song->getTitle();
$idsong=$song->getId();
$idartist=$song->getIdartist();
$idalbum=$song->getIdalbum();
if($TMEasyURL){
if(!$TMEasyURLType)
$tm_url="music.php/artist/".urlencode($song->getArtistname())."/album/".urlencode($song->getAlbumname())."/song/".urlencode($title);
elseif($TMEasyURLType==1)
$tm_url="music.php/artist/".$idartist."/album/".$idalbum."/song/".$idsong;
else
$tm_url="song".$idartist."_".$idalbum."_".$idsong."-".urlencode($title).".html";
}else
$tm_url="modules.php?name=".$tmModuleName."&op=song&idartist=".$idartist."&idalbum=".$idalbum."&idsong=".$idsong;
$content.="<tr><td valign=\"top\">".($i+1).".-</td><td><a href=\"".$tm_url."\">".$title."</a></td>";
$content.="<td> (".$song->getCount().") </td>";
$content.="</tr>";
}
} else {
$content.="<tr><td align=\"center\">"._TOPMUSIC_NOSONGSLISTED."</td></tr>";
}
$content.="</table>\n";
?>