Modified to trap signals properly and not write to the root directory (only working directory)
<?php
/**
* Playlist displayer
*
* Greyhound - real web management for Amarok
* Copyright (C) 2008 Dan Fuhry
*
* This program is Free Software; you can redistribute 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, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
*/
function amarok_playlist($server)
{
global $theme, $playlist, $allowcontrol;
$iphone = ( strpos($_SERVER['HTTP_USER_AGENT'], 'iPhone') ||
strpos($_SERVER['HTTP_USER_AGENT'], 'iPod') ||
strpos($_SERVER['HTTP_USER_AGENT'], 'BlackBerry') ||
isset($_GET['m'])
);
$theme_id = ( $iphone ) ? 'iphone' : $theme;
$smarty = load_theme($theme_id);
$active = dcop_action('playlist', 'getActiveIndex');
$smarty->assign('theme', $theme_id);
$smarty->assign('playlist', $playlist);
$smarty->assign('active', $active);
$smarty->assign('scripts', array(
'ajax.js',
'domutils.js',
'volume.js'
));
$smarty->assign('allow_control', $allowcontrol);
$smarty->display('playlist.tpl');
}