File size: 2.02Kb
<?php
error_reporting(0);
defined('IN_APP') or die('<h1>Yello world!</h1>');
//Add some more queries in the array below, It will be the random search result on the index page
$r = array('taylor swift innocent', 'rihanna', 'akon', 'jay sean', 'delta goodrem');
shuffle($r);
$q = isset($_GET['q']) ? strtolower(strip_tags($_GET['q'])) : $r[0];
$p = isset($_GET['p']) ? (int)$_GET['p'] : 0;
try {
$ex = new Exfm($q, $p);
$data = $ex -> data;
unset($ex);
$title = sprintf('Search results for » %s', ucfirst($q));
ob_start();
printf('<h1>%s</h1>', ucwords($q));
foreach ($data -> songs as $song) :
$artist = empty($song -> artist) ? 'Unknown' : $song -> artist;
$album = empty($song -> album) ? 'Unknown' : $song -> album;
printf('<div class="ribbitWrapper">
<img class="avatar" src="img/mzk.png">
<span class="name">%s</span>
<p><b>Track</b> : %s</p>
<p><b>Artist</b> : %s</p>
<p><b>Album</b> : %s</p>
<p><a class="play" href="#" data-url="%s">Play</a> | <a href="%s" target="_blank" rel="nofollow">Download</a></p>
</div>', $song -> title, $song -> title, $artist, $album, rawurlencode($song -> url), $song -> url);
endforeach;
echo '<div class="ribbitWrapper" style="text-align: center;">' . "\n";
printf('<a href="index.php?q=%s&p=%d" class="anchor-pad">Prev</a>', urlencode($q), ($p-1));
printf('<a href="index.php?q=%s&p=%d" class="anchor-pad">Next</a>', urlencode($q), ($p+1));
echo "</div>\n";
$buffer['search_result'] = ob_get_clean();
} catch (exception $e) {
$title = 'An error has occured';
$buffer['search_result'] = sprintf('
<h1>An error has occured</h1>
<div class="ribbitWrapper">
<img class="avatar" src="img/error.png">
<p>Exception caught from line <b>%d</b> in core file with message <span style="color: red; font-weight: bold;">%s</span></p>
<p>Please try again or contact the site administration.</p></div>', $e -> getLine(), $e -> getMessage());
}
$appInfo = new Appinfo();
$appName = $appInfo -> appName;
$appVersion = $appInfo -> appVersion;
unset($appInfo);