It looks like you only need to adjust the Database query.
That file was supposed to be called from within another file.
The actual code seems fine (i.e. compatible even with PHP8.1 released last week) from a first look and should work with all the links and data inside (the tables for SAM have not changed since SAM4, I think even SAM3 didn't change much about the data structure)
There's only 3 sections you need to change and then you can place the file in the "web" folder of the "modern" SAM templates. (the one with favicon.ico, playing.php, playlist.php, ...)
At the top of the file (ideally the line after <?php) add this:
Code:
require_once('../config/config.php');
Then find this part:
Code:
$db->open("SELECT requestlist.*,songlist.artist,songlist.title,songlist.duration FROM requestlist LEFT JOIN songlist ON requestlist.songid=songlist.id $where ORDER BY requestlist.id DESC",$limit,$start);
$reqlst = $db->rows();
reset($reqlst);
This needs to be rewritten and you need to first initialize the Database. For both I suggest taking a look at the getComingSongs function in class.song.php:
Code:
$db = Database::getInstance();
// Return tracks in the queuelist table
$select = $db->select()
->from(array('s' => 'songlist'),
array('*'))
->join(array('q' => 'queuelist'),
'q.songID = s.ID',
array('requestID'))
->where('s.songtype = ?', 'S') //Only return song of type S
->order('q.sortID ASC')
->limit(COMING_UP_COUNT);
$songs = array();
try {
$songs = $db->fetchAll($select);
} catch (Zend_Db_Adapter_Exception $ex) {
echo "Please verify database settings.<br />";
exit;
}
Change $songs to $reqlst (for some reason Festerhead always loses some letters in his variable names - This is supposed to be the request list) and if you want to see ALL requests, remove the ->limit part (make sure to move the semicolon to wherever the end of the query is)
To make life easier, you can skip converting the string query from festerhead into separate function calls and just supply it as the single argument to fetchAll (instead of $select).
One caveat: The old db system had optional parameters for pagination, if you want to keep those, you need to add them to the end of the SQL query like so:
Code:
LIMIT $start, $limit
Last but not least:
Code:
while (list($key, $value) = each($reqlst)) {[code]
becomes:
[code]foreach ($reqlst as $key => $value) {
It's pretty straightforward. If you need me to rewrite the full script for you, please send 25 EUR to
https://paypal.me/mastacheata and I'll get back to you within a couple days with the converted file. (This is not gonna take me a couple days, but I'm not sure when I'll have the time to check it)