fix version_compare (why did this work for me in the first place?); fix fallback if user still has 'classic' as theme

Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann (d00p) 2013-04-12 10:48:26 +02:00
parent e9f3e617c7
commit 6da6915cac
2 changed files with 24 additions and 2 deletions

View File

@ -72,17 +72,20 @@ function version_compare2($a, $b) {
$x = explode("-", $a[count($a)-1]);
$a[count($a)-1] = $x[0];
if (stripos($x[1], 'rc') !== false) {
$a[] = '0';
$a[] = '2'; // rc > dev > svn
// number of rc
$a[] = substr($x[1], 2);
}
else if (stripos($x[1], 'dev') !== false) {
$a[] = '0';
$a[] = '1'; // svn < dev < rc
// number of dev
$a[] = substr($x[1], 3);
}
// -svn version are deprecated
else if (stripos($x[1], 'svn') !== false) {
$a[] = '0';
$a[] = '0'; // svn < dev < rc
// number of svn
$a[] = substr($x[1], 3);
@ -97,17 +100,20 @@ function version_compare2($a, $b) {
$x = explode("-", $b[count($b)-1]);
$b[count($b)-1] = $x[0];
if (stripos($x[1], 'rc') !== false) {
$b[] = '0';
$b[] = '2'; // rc > dev > svn
// number of rc
$b[] = substr($x[1], 2);
}
else if (stripos($x[1], 'dev') !== false) {
$b[] = '0';
$b[] = '1'; // svn < dev < rc
// number of dev
$b[] = substr($x[1], 3);
}
// -svn version are deprecated
else if (stripos($x[1], 'svn') !== false) {
$b[] = '0';
$b[] = '0'; // svn < dev < rc
// number of svn
$b[] = substr($x[1], 3);
@ -118,6 +124,17 @@ function version_compare2($a, $b) {
}
}
if (count($a) > count($b)) {
if ($a[count($b)-1] == $b[count($b)-1]) {
return -1;
}
}
if (count($b) > count($a)) {
if ($b[count($a)-1] == $a[count($a)-1]) {
return 1;
}
}
foreach ($a as $depth => $aVal) {
// iterate over each piece of A
if (isset($b[$depth])) {

View File

@ -363,11 +363,16 @@ $theme = isset($settings['panel']['default_theme']) ? $settings['panel']['defaul
/**
* overwrite with customer/admin theme if defined
*/
if(isset($userinfo['theme']) && $userinfo['theme'] != $theme)
{
if (isset($userinfo['theme']) && $userinfo['theme'] != $theme) {
$theme = $userinfo['theme'];
}
// check for existence of the theme
if (!file_exists('templates/'.$theme.'/index.tpl')) {
// Fallback
$theme = 'Froxlor';
}
/*
* check for custom header-graphic
*/