$query = $db->query("SELECT sv.* FROM {$tablepre}stylevars sv LEFT JOIN {$tablepre}styles s ON s.styleid = sv.styleid AND (s.available=1 OR s.styleid='$defaultstyleid')");
$query = $db->query("SELECT s.*, t.directory AS tpldir FROM {$tablepre}styles s LEFT JOIN {$tablepre}templates t ON s.templateid=t.templateid WHERE s.available=1 OR s.styleid='$defaultstyleid'");
$allowthreadplugin = $threadplugins ? unserialize($db->result_first("SELECT value FROM {$tablepre}settings WHERE variable='allowthreadplugin'")) : array();
$query = $db->query("SELECT * FROM {$tablepre}usergroups u
LEFT JOIN {$tablepre}admingroups a ON u.groupid=a.admingid");
while($data = $db->fetch_array($query)) {
$ratearray = array();
if($data['raterange']) {
foreach(explode("\n", $data['raterange']) as $rating) {