From 055596868743c48c7bb973c56a167027ec2b184f Mon Sep 17 00:00:00 2001 From: Cameron Date: Fri, 6 Jan 2017 13:27:48 -0800 Subject: [PATCH] Fixes #2251 - Theme Manager theme info fix. --- e107_admin/theme.php | 12 +++--- e107_handlers/theme_handler.php | 67 ++++++++++++++++++++------------- 2 files changed, 47 insertions(+), 32 deletions(-) diff --git a/e107_admin/theme.php b/e107_admin/theme.php index 3e207df9e..9ec2f1ee5 100644 --- a/e107_admin/theme.php +++ b/e107_admin/theme.php @@ -74,11 +74,13 @@ if(!empty($_GET['action'])) */ case 'info': - $string = base64_decode($_GET['src']); - parse_str($string,$p); - $themeInfo = e107::getSession()->get('thememanager/online/'.intval($p['id'])); - echo $themec->renderThemeInfo($themeInfo); - + if(!empty($_GET['src'])) + { + $string = base64_decode($_GET['src']); + parse_str($string,$p); + $themeInfo = e107::getSession()->get('thememanager/online/'.intval($p['id'])); + echo $themec->renderThemeInfo($themeInfo); + } break; case 'preview': diff --git a/e107_handlers/theme_handler.php b/e107_handlers/theme_handler.php index 9ac979a2c..53c93c362 100644 --- a/e107_handlers/theme_handler.php +++ b/e107_handlers/theme_handler.php @@ -18,7 +18,7 @@ if(!defined('e107_INIT')) // new in v.2.1.4 /** - * Retrieve info about themes on the system. - optimized for speed. + * Retrieve info about themes on the system. - optimized for speed. * Class e_theme */ class e_theme @@ -1295,27 +1295,42 @@ class themeHandler function renderThemeInfo($theme) { + if(empty($theme)) + { + return null; + } + + if(!empty($theme['compatibility']) && $theme['compatibility'] == 2) + { + $theme['compatibility'] = '2.0'; + } + + global $pref; - $author = ($theme['email'] ? "".$theme['author']."" : $theme['author']); - $website = ($theme['website'] ? "".$theme['website']."" : ""); + $author = !empty($theme['email']) ? "".$theme['author']."" : $theme['author']; + $website = !empty($theme['website']) ? "".$theme['website']."" : ""; // $preview = "".($theme['preview'] ? "" : "").""; $description = vartrue($theme['description'],''); - $compat = (intval($theme['compatibility']) == 2) ? "".number_format($theme['compatibility'], 1, '.','')." ".TPVLAN_77."": vartrue(number_format($theme['compatibility'], 1, '.',''),'1.0'); + $compat = (version_compare(1.9,$theme['compatibility'],'<')) ? "".$theme['compatibility']." ".TPVLAN_77."": vartrue($theme['compatibility'],'1.0'); $price = (!empty($theme['price'])) ? " ".$theme['price']."" : "".TPVLAN_76.""; - + + $text = ""; - // $text .= ""; - $text .= $author ? "" : ""; - $text .= $website ? "" : ""; - $text .= $theme['date'] ? "" : ""; - $text .= $compat ? "" : ""; + + + // $text .= ""; $text .= ""; - - $text .= $description ? "" : ""; - - + + $text .= ($author) ? "" : ""; + $text .= ($website) ? "" : ""; + $text .= !empty($theme['date']) ? "" : ""; + $text .= $compat ? "" : ""; + + $text .= !empty($description) ? "" : ""; + + // $text .= " // "; - if(vartrue($theme['category'])) + if(!empty($theme['category'])) { $text .= ""; } - + $itext = ''; - - // New in 0.8 WORK IN PROGRESS ---- - if($theme['layouts']) + if(!empty($theme['layouts'])) { $itext .= "

".$theme['name']." ".$theme['version']."

".LAN_AUTHOR.":".$author."
".TPVLAN_5.":".$website."
".TPVLAN_6.":".$theme['date']."
".TPVLAN_57.":".$compat."

".$theme['name']." ".$theme['version']."

".TPVLAN_75.":".$price."
".LAN_DESCRIPTION.":".$description."
".LAN_AUTHOR.":".$author."
".TPVLAN_5.":".$website."
".TPVLAN_6.":".$theme['date']."
".TPVLAN_57.":".$compat."
".LAN_DESCRIPTION.":".$description."
".TPVLAN_49.":XHTML "; // $text .= ($theme['xhtmlcompliant']) ? ADMIN_TRUE_ICON : ADMIN_FALSE_ICON; @@ -1323,25 +1338,23 @@ class themeHandler // $text .= ($theme['csscompliant']) ? ADMIN_TRUE_ICON : ADMIN_FALSE_ICON; // $text .= "
".LAN_CATEGORY."".$theme['category']."
".TPVLAN_50.": "; - $itext .= ($mode == 1) ? "" : ""; + // $itext .= ($mode == 1) ? "" : ""; $itext .= " @@ -1352,7 +1365,7 @@ class themeHandler { $itext .= " "; - if($mode == 1) + /* if($mode == 1) { if(!$pref['sitetheme_deflayout']) { @@ -1363,17 +1376,17 @@ class themeHandler "; - } + }*/ $itext .= " - + "; } @@ -1424,7 +1437,7 @@ class themeHandler if(E107_DEBUG_LEVEL > 0) { - $text .= print_a($theme, true); + // $text .= print_a($theme, true); }
".TPVLAN_55."".TPVLAN_55."".LAN_TITLE." ".TPVLAN_78."
"; - $itext .= ($val['@attributes']['previewFull']) ? "" : ""; + $itext .= !empty($val['@attributes']['previewFull']) ? "" : ""; $itext .= $val['@attributes']['title']; - $itext .= ($val['@attributes']['previewFull']) ? "" : ""; + $itext .= !empty($val['@attributes']['previewFull']) ? "" : ""; $itext .= ($pref['sitetheme_deflayout'] == $key) ? " (default)" : ""; $itext .= "".$val['@attributes']['plugins']." ".varset($val['@attributes']['plugins'])."  "; - $itext .= ($val['menuPresets']) ? ADMIN_TRUE_ICON : " "; + $itext .= !empty($val['menuPresets']) ? ADMIN_TRUE_ICON : " "; $itext .= "