diff --git a/e107_admin/theme.php b/e107_admin/theme.php index 29fc22c46..71fd11f3d 100644 --- a/e107_admin/theme.php +++ b/e107_admin/theme.php @@ -102,7 +102,7 @@ else { -$mode = (e_QUERY) ? e_QUERY :"main" ; +$mode = varset($_GET['mode'],'main'); // (e_QUERY) ? e_QUERY :"main" ; if(vartrue($_POST['selectadmin'])) { @@ -129,30 +129,31 @@ require_once("footer.php"); function theme_adminmenu() { - global $mode; - $mode = e_QUERY; + //global $mode; - $e107 = &e107::getInstance(); + $mode = varset($_GET['mode'],'main'); + + // $e107 = &e107::getInstance(); $var['main']['text'] = TPVLAN_33; $var['main']['link'] = e_SELF; $var['admin']['text'] = TPVLAN_34; - $var['admin']['link'] = e_SELF."?admin"; + $var['admin']['link'] = e_SELF."?mode=admin"; $var['choose']['text'] = TPVLAN_51; - $var['choose']['link'] = e_SELF."?choose"; + $var['choose']['link'] = e_SELF."?mode=choose"; $var['online']['text'] = "Find Themes"; - $var['online']['link'] = e_SELF."?online"; + $var['online']['link'] = e_SELF."?mode=online"; $var['upload']['text'] = TPVLAN_38; - $var['upload']['link'] = e_SELF."?upload"; + $var['upload']['link'] = e_SELF."?mode=upload"; - $selected = (e_QUERY) ? e_QUERY : "main"; + // $selected = (e_QUERY) ? e_QUERY : "main"; - e107::getNav()->admin(TPVLAN_26, $selected, $var); + e107::getNav()->admin(TPVLAN_26, $mode, $var); } diff --git a/e107_handlers/theme_handler.php b/e107_handlers/theme_handler.php index d19ffc6e0..4736c5b35 100644 --- a/e107_handlers/theme_handler.php +++ b/e107_handlers/theme_handler.php @@ -417,6 +417,7 @@ class themeHandler global $pref; $mes = e107::getMessage(); $ns = e107::getRender(); + $tp = e107::getParser(); echo "
\n"; @@ -484,9 +485,9 @@ class themeHandler // $file = SITEURLBASE.e_PLUGIN_ABS."release/release.php"; // temporary testing $file = "http://e107.org/feed?type=theme&frm=".$from; - $xml->setOptArrayTags('theme'); // make sure 'theme' tag always returns an array - $xdata = $xml->loadXMLfile($file,'advanced'); - + $xml->setOptArrayTags('theme,screenshots/image'); // make sure 'theme' tag always returns an array + // $xdata = $xml->loadXMLfile($file,'advanced',true); + $xdata = $xml->loadXMLfile($file,true,false); $total = $xdata['@attributes']['total']; @@ -501,11 +502,13 @@ class themeHandler $mes->addDebug(print_a($r,true)); $theme = array( - 'name' => $r['@attributes']['name'], - 'summary' => $r['description'][0], - 'preview' => array($r['@attributes']['screenshot']), - 'date' => $r['@attributes']['date'], - 'version' => $r['@attributes']['version'] + 'name' => $r['@attributes']['name'], + 'summary' => $r['description'][0], + 'preview' => $r['screenshots']['image'], + 'date' => $r['@attributes']['date'], + 'version' => $r['@attributes']['version'], + 'thumbnail' => $r['@attributes']['thumbnail'], + 'description' => varset($r['description']) ); $text .= $this->renderTheme(FALSE, $theme); @@ -550,6 +553,16 @@ class themeHandler } $text .= "
 
"; + + $amount = 10; + + + if($total > $amount) + { + $parms = $total.",".$amount.",".$from.",".e_SELF.'?mode='.$_GET['mode'].'&frm=[FROM]'; + $text .= "
".$tp->parseTemplate("{NEXTPREV=$parms}",TRUE)."
"; + } + $ns->tablerender(TPVLAN_26." :: Available for Download", $mes->render().$text); @@ -622,14 +635,14 @@ class themeHandler { global $pref; - $author = ($theme['email'] ? "".$theme['author']."" : $theme['author']); - $website = ($theme['website'] ? "".$theme['website']."" : ""); - $preview = "".($theme['preview'] ? "" : "").""; + $author = ($theme['email'] ? "".$theme['author']."" : $theme['author']); + $website = ($theme['website'] ? "".$theme['website']."" : ""); + $preview = "".($theme['preview'] ? "" : "").""; - $text = "
".TPVLAN_7."
- - "; + $text = "
".TPVLAN_7."
+
".$theme['name']."
+ "; $text .= $author ? "" : ""; $text .= $website ? "" : ""; @@ -763,48 +776,60 @@ class themeHandler } } + /** + mode = 0 :: normal + mode = 1 :: selected site theme + mode = 2 :: selected admin theme + */ function renderTheme($mode = FALSE, $theme) { $ns = e107::getRender(); $pref = e107::getPref(); $frm = e107::getForm(); - /* - mode = 0 :: normal - mode = 1 :: selected site theme - mode = 2 :: selected admin theme - */ - // global $ns,$pref,$frm; - - $author = ($theme['email'] ? "".$theme['author']."" : $theme['author']); - $website = ($theme['website'] ? "".$theme['website']."" : ""); - $preview = "".($theme['preview'] ? "" : "").""; - - $previewbutton = (!$mode ? " " : ""); - - $main_icon = ($pref['sitetheme'] != $theme['path']) ? "" : E_32_TRUE; - // $info_icon = ""; - - $info_icon = "".E_32_CAT_ABOUT.""; - - $preview_icon = "".E_32_SEARCH.""; - - - $admin_icon = ($pref['admintheme'] != $theme['path'] ) ? "\n" : E_32_TRUE; + $author = ($theme['email'] ? "".$theme['author']."" : $theme['author']); + $website = ($theme['website'] ? "".$theme['website']."" : ""); + $preview = "".($theme['preview'] ? "" : "").""; + $main_icon = ($pref['sitetheme'] != $theme['path']) ? "" : E_32_TRUE; + // $info_icon = ""; + $info_icon = "".E_32_CAT_ABOUT.""; + $preview_icon = "".E_32_SEARCH.""; + $admin_icon = ($pref['admintheme'] != $theme['path'] ) ? "\n" : E_32_TRUE; if(!in_array($theme['path'], $this->approvedAdminThemes)) { $admin_icon = ""; } - if($theme['path'] == 'bootstrap') + if($theme['name'] == 'bootstrap') { - // print_a($theme); + // print_a($theme); } // - $previewPath = (substr($theme['preview'][0],0,4) == 'http') ? $theme['preview'][0] : e_THEME.$theme['path'] ."/".$theme['preview'][0]; - $newpreview = "".(vartrue($theme['preview'][0]) ? "" : "").""; + // $thumbPath = (substr($theme['thumbnail'],0,4) == 'http') ? $theme['thumbnail'] : e_THEME.$theme['path'] ."/".$theme['preview'][0]; + // $thumbnail = ""; + + if(substr($theme['thumbnail'],0,4) == 'http') + { + $thumbPath = $theme['thumbnail']; + $previewPath = $theme['preview'][0]; + } + elseif(vartrue($theme['preview'][0])) + { + $thumbPath = e_THEME.$theme['path'] ."/".$theme['preview'][0]; + $previewPath = e_THEME.$theme['path'] ."/".$theme['preview'][0]; + } + else + { + $thumbPath = e_IMAGE_ABS."admin_images/nopreview.png"; + $previewPath = e_BASE."index.php?themepreview.".$theme['id']; + } + + $thumbnail = ""; + $preview_icon = "".E_32_SEARCH.""; + + // $thumbnail .= ""; // Choose a Theme to Install. if(!$mode) @@ -826,7 +851,7 @@ class themeHandler $text = "
-
".$newpreview."
+
".$thumbnail."
".$main_icon.$admin_icon.$info_icon.$preview_icon."
".$theme['name']." ".$theme['version']."
"; @@ -860,7 +885,7 @@ class themeHandler - + "; $text .= ""; @@ -1472,11 +1497,13 @@ class themeHandler if(file_exists(e_THEME.$path."/preview.jpg")) { $themeArray['preview'] = array("preview.jpg"); + $themeArray['thumbnail'] = "preview.jpg"; } if(file_exists(e_THEME.$path."/preview.png")) { $themeArray['preview'] = array("preview.png"); + $themeArray['thumbnail'] = "preview.png"; } // echo "

".$themeArray['name']."

"; // print_a($lays); @@ -1497,21 +1524,22 @@ class themeHandler $vars = $xml->loadXMLfile(e_THEME.$path.'/theme.xml', true, true); - $vars['name'] = varset($vars['@attributes']['name']); - $vars['version'] = varset($vars['@attributes']['version']); - $vars['date'] = varset($vars['@attributes']['date']); - $vars['compatibility'] = varset($vars['@attributes']['compatibility']); - $vars['releaseUrl'] = varset($vars['@attributes']['releaseUrl']); - $vars['email'] = varset($vars['author']['@attributes']['email']); - $vars['website'] = varset($vars['author']['@attributes']['url']); - $vars['author'] = varset($vars['author']['@attributes']['name']); - $vars['info'] = varset($vars['description']); - $vars['category'] = $this->getThemeCategory(varset($vars['category'])); + $vars['name'] = varset($vars['@attributes']['name']); + $vars['version'] = varset($vars['@attributes']['version']); + $vars['date'] = varset($vars['@attributes']['date']); + $vars['compatibility'] = varset($vars['@attributes']['compatibility']); + $vars['releaseUrl'] = varset($vars['@attributes']['releaseUrl']); + $vars['email'] = varset($vars['author']['@attributes']['email']); + $vars['website'] = varset($vars['author']['@attributes']['url']); + $vars['author'] = varset($vars['author']['@attributes']['name']); + $vars['info'] = varset($vars['description']); + $vars['category'] = $this->getThemeCategory(varset($vars['category'])); $vars['xhtmlcompliant'] = varset($vars['compliance']['@attributes']['xhtml']); - $vars['csscompliant'] = varset($vars['compliance']['@attributes']['css']); - $vars['path'] = $path; + $vars['csscompliant'] = varset($vars['compliance']['@attributes']['css']); + $vars['path'] = $path; $vars['@attributes']['default'] = (varset($vars['@attributes']['default']) && strtolower($vars['@attributes']['default']) == 'true') ? 1 : 0; - $vars['preview'] = varset($vars['screenshots']['image']); + $vars['preview'] = varset($vars['screenshots']['image']); + $vars['thumbnail'] = $vars['preview'][0]; unset($vars['authorEmail'], $vars['authorUrl'], $vars['xhtmlCompliant'], $vars['cssCompliant'], $vars['description'],$vars['screenshots']); @@ -1542,9 +1570,9 @@ class themeHandler $vars['layouts'] = $lays; $vars['path'] = $path; $vars['custompages'] = $custom; - /* + $mes = e107::getMessage(); // DEBUG - + /* if($path == "bootstrap" || $path == "e107v4a") { $mes->addDebug("

".$path."

");
".$theme['name']."
".TPVLAN_4.":".$author."
".TPVLAN_5.":".$website."
".TPVLAN_11." ".$theme['version']."".$newpreview."".$thumbnail."
".TPVLAN_4.":".$author."