mirror of
https://github.com/e107inc/e107.git
synced 2025-01-17 04:38:27 +01:00
Theme manager now using e107::isCompatible() method.
This commit is contained in:
parent
b457c8168e
commit
8b73cfee5c
@ -956,15 +956,15 @@ class theme_admin_form_ui extends e_admin_form_ui
|
||||
$infoPath = e_SELF."?mode=".$_GET['mode']."&id=".$theme['path']."&action=info&iframe=1";
|
||||
$previewPath = $tp->replaceConstants($theme['thumbnail'],'abs');
|
||||
|
||||
$version = $tp->filter(e_VERSION,'version');
|
||||
$compat = $tp->filter($theme['compatibility'], 'version');
|
||||
|
||||
// $version = $tp->filter(e_VERSION,'version');
|
||||
// $compat = $tp->filter($theme['compatibility'], 'version');
|
||||
|
||||
|
||||
$disabled = '';
|
||||
$mainTitle = TPVLAN_10;
|
||||
|
||||
if(version_compare($compat,$version, '<=') === false)
|
||||
// if(version_compare($compat,$version, '<=') === false)
|
||||
if(!e107::isCompatible($theme['compatibility']))
|
||||
{
|
||||
$disabled = 'disabled';
|
||||
$mainTitle = defset('TPVLAN_97', "This theme requires a newer version of e107.");
|
||||
@ -972,7 +972,7 @@ class theme_admin_form_ui extends e_admin_form_ui
|
||||
|
||||
// e107::getDebug()->log($theme['path']." - ".$disabled. " (".$compat.")");
|
||||
|
||||
$main_icon = ($pref['sitetheme'] != $theme['path']) ? "<button class='btn btn-default btn-secondary btn-small btn-sm btn-inverse' type='submit' ".$disabled." name='selectmain[".$theme['path']."]' alt=\"".$mainTitle."\" title=\"".$mainTitle."\" >".$tp->toGlyph('fa-home',array('size'=>'2x'))."</button>" : "<button class='btn btn-small btn-default btn-secondary btn-sm btn-inverse' type='button'>".$tp->toGlyph('fa-check',array('size'=>'2x'))."</button>";
|
||||
$main_icon = ($pref['sitetheme'] != $theme['path']) ? "<button ".$disabled." class='btn btn-default btn-secondary btn-small btn-sm btn-inverse' type='submit' name='selectmain[".$theme['path']."]' alt=\"".$mainTitle."\" title=\"".$mainTitle."\" >".$tp->toGlyph('fa-home',array('size'=>'2x'))."</button>" : "<button class='btn btn-small btn-default btn-secondary btn-sm btn-inverse' type='button'>".$tp->toGlyph('fa-check',array('size'=>'2x'))."</button>";
|
||||
$info_icon = "<a class='btn btn-default btn-secondary btn-small btn-sm btn-inverse e-modal' data-modal-caption=\"".$theme['name']." ".$theme['version']."\" href='".$infoPath."' title='".TPVLAN_7."'>".$tp->toGlyph('fa-info-circle',array('size'=>'2x'))."</a>";
|
||||
// $admin_icon = ($pref['admintheme'] != $theme['path'] ) ? "<button class='btn btn-default btn-small btn-sm btn-inverse' type='submit' name='selectadmin[".$theme['id']."]' alt=\"".TPVLAN_32."\" title=\"".TPVLAN_32."\" >".$tp->toGlyph('fa-gears',array('size'=>'2x'))."</button>" : "<button class='btn btn-small btn-default btn-sm btn-inverse' type='button'>".$tp->toGlyph('fa-check',array('size'=>'2x'))."</button>";
|
||||
|
||||
|
@ -5464,25 +5464,12 @@ class e107
|
||||
$e107 = $tp->filter($e107info['e107_version'], 'version');
|
||||
$version = $tp->filter($version, 'version');
|
||||
|
||||
$tmp = explode('.', $version);
|
||||
|
||||
if((int) $tmp[0] === 1) // version 1, assumed to be incompatible.
|
||||
if((int) $version === 1) // version 1, assumed to be incompatible.
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if(isset($tmp[2])) // ie. 2.3.1
|
||||
{
|
||||
return version_compare($e107 ,$version, '>=');
|
||||
}
|
||||
elseif(isset($tmp[1]))
|
||||
{
|
||||
return ((float) $e107 >= $version);
|
||||
}
|
||||
|
||||
return ((int) $e107 >= (int) $version);
|
||||
|
||||
|
||||
return version_compare($e107 ,$version, '>=');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1631,6 +1631,8 @@ class e107Test extends \Codeception\Test\Unit
|
||||
// version => expected
|
||||
$tests = array (
|
||||
'1' => false, // assumed incompatible.
|
||||
'1.2.3' => false,
|
||||
'1.2' => false,
|
||||
'2' => true, // assumed to work with all versions from 2+
|
||||
'2.0' => true, // assumed to work with all versions from 2+
|
||||
'2.3' => true, // assumed to work with all versions from 2.3 onward.
|
||||
@ -1642,7 +1644,6 @@ class e107Test extends \Codeception\Test\Unit
|
||||
'2.9' => false,
|
||||
'2.9.2' => false,
|
||||
'3' => false,
|
||||
|
||||
);
|
||||
|
||||
$e107 = $this->e107;
|
||||
|
Loading…
x
Reference in New Issue
Block a user