mirror of
https://github.com/e107inc/e107.git
synced 2025-08-01 20:30:39 +02:00
Theme Manager: Online browser now uses admin-ui search/filtering.
This commit is contained in:
@@ -199,7 +199,7 @@ class theme_admin_ui extends e_admin_ui
|
||||
'name' => array('title'=> LAN_TITLE, 'type' => 'text', 'data' => 'str', 'width'=>'5%', 'thclass' => '', 'forced'=> TRUE, 'primary'=>TRUE/*, 'noedit'=>TRUE*/), //Primary ID is not editable
|
||||
'thumbnail' => array('title'=> LAN_IMAGE, 'type' => 'image', 'readParms'=>array('thumb'=>1,'w'=>300,'h'=>169,'crop'=>1, 'link'=>false, 'fallback'=>'{e_IMAGE}admin_images/nopreview.png'), 'data' => 'str', 'width'=>'auto', 'thclass' => '', 'batch' => TRUE, 'filter'=>TRUE),
|
||||
'folder' => array('title'=> 'Folder', 'type' => 'text', 'data' => 'str', 'width' => 'auto', 'thclass' => ''),
|
||||
'category' => array('title'=> LAN_CATEGORY, 'type' => 'text', 'data' => 'str', 'width' => 'auto', 'thclass' => ''),
|
||||
'category' => array('title'=> LAN_CATEGORY, 'type' => 'dropdown', 'data' => 'str', 'filter'=>true, 'width' => 'auto', 'thclass' => '', 'writeParms'=>array()),
|
||||
'version' => array('title'=> 'Version', 'type' => 'text', 'data' => 'str', 'width' => 'auto', 'thclass' => ''),
|
||||
'price' => array('title'=> LAN_AUTHOR, 'type' => 'method', 'data' => 'str', 'width' => 'auto', 'thclass' => 'left'),
|
||||
// 'blank_authorURL' => array('title'=> "Url", 'type' => 'url', 'data' => 'str', 'width' => 'auto', 'thclass' => 'left'),
|
||||
@@ -222,6 +222,8 @@ class theme_admin_ui extends e_admin_ui
|
||||
{
|
||||
require_once(e_HANDLER."theme_handler.php");
|
||||
$this->themeObj = new themeHandler; // handles POSTed data.
|
||||
$this->fields['category']['writeParms']['optArray'] = e107::getTheme()->getCategoryList(); // array('plugin_category_0','plugin_category_1', 'plugin_category_2'); // Example Drop-down array.
|
||||
|
||||
parent::__construct($request,$response,$params);
|
||||
}
|
||||
|
||||
@@ -317,7 +319,9 @@ class theme_admin_ui extends e_admin_ui
|
||||
|
||||
public function OnlineObserver()
|
||||
{
|
||||
$this->ChooseObserver();
|
||||
unset($this->fields['checkboxes']);
|
||||
$this->perPage = 500;
|
||||
|
||||
}
|
||||
|
||||
public function ChooseAjaxObserver()
|
||||
@@ -350,7 +354,7 @@ class theme_admin_ui extends e_admin_ui
|
||||
return $frm->search($name, $searchVal, $submitName, $filterName, $filterArray, $filterVal);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
public function OnlinePageOld()
|
||||
{
|
||||
global $e107SiteUsername, $e107SiteUserpass;
|
||||
@@ -386,7 +390,7 @@ class theme_admin_ui extends e_admin_ui
|
||||
$amount =$limit;
|
||||
|
||||
|
||||
$c = 1;
|
||||
$c = 1;*/
|
||||
|
||||
/* $text = "<form class='form-search' action='".e_SELF."?".e_QUERY."' id='core-plugin-list-form' method='get'>";
|
||||
$text .= '<div id="myCarousel" class="carousel slide" data-interval="false">';
|
||||
@@ -396,7 +400,7 @@ class theme_admin_ui extends e_admin_ui
|
||||
$text .= "{CAROUSEL_INDICATORS}";
|
||||
$text .= "</div>";
|
||||
$text .= '<div id="shop" style="margin-top:10px;min-height:585px" class=" carousel-inner">';*/
|
||||
|
||||
/*
|
||||
if(is_array($xdata['data'] ))
|
||||
{
|
||||
|
||||
@@ -471,7 +475,7 @@ class theme_admin_ui extends e_admin_ui
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
public function InfoPage()
|
||||
{
|
||||
@@ -668,14 +672,99 @@ class theme_admin_ui extends e_admin_ui
|
||||
e107::getMessage()->addWarning(TPVLAN_79);
|
||||
}
|
||||
|
||||
$this->setThemeData();
|
||||
|
||||
return $this->GridPage();
|
||||
}
|
||||
|
||||
public function OnlineAjaxPage()
|
||||
{
|
||||
unset($this->fields['checkboxes']);
|
||||
$this->perPage = 500;
|
||||
$this->setThemeData();
|
||||
return $this->GridAjaxPage();
|
||||
}
|
||||
|
||||
/**
|
||||
* Load data from online
|
||||
* @param bool $force
|
||||
*/
|
||||
function setThemeData($force=false)
|
||||
{
|
||||
$themeList = e107::getTheme()->getList();
|
||||
|
||||
$mes = e107::getMessage();
|
||||
require_once(e_HANDLER.'e_marketplace.php');
|
||||
|
||||
$mp = new e_marketplace(); // autodetect the best method
|
||||
// $from = intval(varset($_GET['frm']));
|
||||
|
||||
$from = $this->getQuery('from', 0);
|
||||
$srch = $this->getQuery('searchquery');
|
||||
|
||||
$cat = '';
|
||||
|
||||
if($filter = $this->getQuery('filter_options'))
|
||||
{
|
||||
list($bla, $cat) = explode("__",$filter);
|
||||
}
|
||||
|
||||
$limit = 96;
|
||||
// $srch = preg_replace('/[^\w]/','', vartrue($_GET['srch']));
|
||||
|
||||
$xdata = $mp->call('getList', array(
|
||||
'type' => 'theme',
|
||||
'params' => array('limit' => 96, 'search' => $srch, 'from' => $from, 'cat'=>$cat)
|
||||
));
|
||||
|
||||
|
||||
$total = $xdata['params']['count'];
|
||||
$tree = $this->getTreeModel();
|
||||
|
||||
$c = 0;
|
||||
if(!empty($xdata['data']) && is_array($xdata['data'] ))
|
||||
{
|
||||
|
||||
foreach($xdata['data'] as $r)
|
||||
{
|
||||
if(E107_DBG_PATH)
|
||||
{
|
||||
$mes->addDebug(print_a($r,true));
|
||||
}
|
||||
|
||||
$v = array(
|
||||
'id' => $r['params']['id'],
|
||||
'type' => 'theme',
|
||||
'mode' => $r['params']['mode'],
|
||||
'name' => stripslashes($r['name']),
|
||||
'category' => $r['category'],
|
||||
'preview' => varset($r['screenshots']['image']),
|
||||
'date' => $r['date'],
|
||||
'version' => $r['version'],
|
||||
'thumbnail' => $r['thumbnail'],
|
||||
'url' => $r['urlView'],
|
||||
'author' => $r['author'],
|
||||
'website' => varset($r['authorUrl']),
|
||||
'compatibility' => $r['compatibility'],
|
||||
'description' => $r['description'],
|
||||
'price' => $r['price'],
|
||||
'livedemo' => $r['livedemo'],
|
||||
);
|
||||
|
||||
|
||||
$c++;
|
||||
$tmp = new e_model($v);
|
||||
$tree->setNode($r['params']['id'],$tmp);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$tree->setTotal($c);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function renderHelp()
|
||||
{
|
||||
@@ -783,85 +872,6 @@ class theme_admin_tree_model extends e_tree_model
|
||||
class theme_admin_online_tree_model extends e_tree_model
|
||||
{
|
||||
|
||||
/**
|
||||
* Load data from theme meta file.
|
||||
* @param bool $force
|
||||
*/
|
||||
function loadBatch($force=false)
|
||||
{
|
||||
$themeList = e107::getTheme()->getList();
|
||||
|
||||
$parms = $this->getParams();
|
||||
|
||||
$mes = e107::getMessage();
|
||||
require_once(e_HANDLER.'e_marketplace.php');
|
||||
|
||||
$mp = new e_marketplace(); // autodetect the best method
|
||||
$from = intval(varset($_GET['frm']));
|
||||
$limit = 96; // FIXME - ajax pages load
|
||||
$srch = preg_replace('/[^\w]/','', vartrue($_GET['srch']));
|
||||
|
||||
// do the request, retrieve and parse data
|
||||
$xdata = $mp->call('getList', array(
|
||||
'type' => 'theme',
|
||||
'params' => array('limit' => $limit, 'search' => $srch, 'from' => $from)
|
||||
));
|
||||
|
||||
$total = $xdata['params']['count'];
|
||||
|
||||
$c = 0;
|
||||
if(is_array($xdata['data'] ))
|
||||
{
|
||||
|
||||
foreach($xdata['data'] as $r)
|
||||
{
|
||||
if(E107_DBG_PATH)
|
||||
{
|
||||
$mes->addDebug(print_a($r,true));
|
||||
}
|
||||
|
||||
$v = array(
|
||||
'id' => $r['params']['id'],
|
||||
'type' => 'theme',
|
||||
'mode' => $r['params']['mode'],
|
||||
'name' => stripslashes($r['name']),
|
||||
'category' => $r['category'],
|
||||
'preview' => varset($r['screenshots']['image']),
|
||||
'date' => $r['date'],
|
||||
'version' => $r['version'],
|
||||
'thumbnail' => $r['thumbnail'],
|
||||
'url' => $r['urlView'],
|
||||
'author' => $r['author'],
|
||||
'website' => varset($r['authorUrl']),
|
||||
'compatibility' => $r['compatibility'],
|
||||
'description' => $r['description'],
|
||||
'price' => $r['price'],
|
||||
'livedemo' => $r['livedemo'],
|
||||
);
|
||||
|
||||
|
||||
$c++;
|
||||
$tmp = new e_model($v);
|
||||
$this->setNode($r['params']['id'],$tmp);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
foreach($themeList as $k=>$v)
|
||||
{
|
||||
|
||||
$v['id'] = $k;
|
||||
|
||||
$v['thumbnail'] = !empty($v['thumbnail']) ? '{e_THEME}'.$v['path'].'/'.$v['thumbnail'] : null;
|
||||
$tmp = new e_model($v);
|
||||
$this->setNode($k,$tmp);
|
||||
|
||||
}*/
|
||||
|
||||
$this->setTotal($c);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -873,6 +883,7 @@ class theme_admin_online_tree_model extends e_tree_model
|
||||
class theme_admin_form_ui extends e_admin_form_ui
|
||||
{
|
||||
|
||||
private $approvedAdminThemes = array('bootstrap3', 'bootstrap5');
|
||||
|
||||
|
||||
function price($curVal)
|
||||
@@ -896,7 +907,7 @@ class theme_admin_form_ui extends e_admin_form_ui
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
function renderFilter($current_query = array(), $location = '', $input_options = array())
|
||||
{
|
||||
if($this->getController()->getAction() == 'choose')
|
||||
@@ -911,7 +922,7 @@ class theme_admin_form_ui extends e_admin_form_ui
|
||||
<div class='col-md-12'>";
|
||||
// $text .= '<div id="myCarousel" class="carousel slide" data-interval="false">';
|
||||
$text .= "<div class='form-inline clearfix row-fluid'>";
|
||||
$text .= $this->search('srch', $_GET['srch'], 'go'/*, $filterName, $filterArray, $filterVal*/);
|
||||
$text .= $this->search('srch', $_GET['srch'], 'go');
|
||||
|
||||
$gets = $this->getController()->getQuery();
|
||||
|
||||
@@ -929,7 +940,7 @@ class theme_admin_form_ui extends e_admin_form_ui
|
||||
</div></fieldset></form>";
|
||||
|
||||
return $text;
|
||||
}
|
||||
}*/
|
||||
|
||||
function options()
|
||||
{
|
||||
@@ -956,10 +967,6 @@ 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');
|
||||
|
||||
|
||||
$disabled = '';
|
||||
$mainTitle = TPVLAN_10;
|
||||
|
||||
@@ -970,15 +977,18 @@ class theme_admin_form_ui extends e_admin_form_ui
|
||||
$mainTitle = defset('TPVLAN_97', "This theme requires a newer version of e107.");
|
||||
}
|
||||
|
||||
// e107::getDebug()->log($theme['path']." - ".$disabled. " (".$compat.")");
|
||||
|
||||
$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>";
|
||||
$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>";
|
||||
$admin_icon = '';
|
||||
|
||||
if(in_array($theme['path'], $this->approvedAdminThemes))
|
||||
{
|
||||
$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>";
|
||||
}
|
||||
|
||||
$preview_icon = "<a class='e-modal btn btn-default btn-secondary btn-sm btn-small btn-inverse' title=' ".TPVLAN_70." ".$theme['name']."' data-modal-caption=\"".$theme['name']." ".$theme['version']."\" rel='external' href='".$previewPath."'>".$tp->toGlyph('fa-search',array('size'=>'2x'))."</a>";
|
||||
|
||||
return $main_icon.$info_icon.$preview_icon;
|
||||
return $main_icon.$admin_icon.$info_icon.$preview_icon;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -25,19 +25,19 @@ class e_theme
|
||||
{
|
||||
|
||||
private static $allowedCategories = array(
|
||||
'generic',
|
||||
'adult',
|
||||
'blog',
|
||||
'clan',
|
||||
'children',
|
||||
'corporate',
|
||||
'forum',
|
||||
'gaming',
|
||||
'gallery',
|
||||
'news',
|
||||
'social',
|
||||
'video',
|
||||
'multimedia'
|
||||
'generic' => 'generic',
|
||||
'adult' => 'adult',
|
||||
'blog' => 'blog',
|
||||
// 'clan' => 'clan',
|
||||
// 'children' => 'children',
|
||||
'corporate' => 'corporate',
|
||||
// 'forum' => 'forum',
|
||||
'gaming' => 'gaming',
|
||||
// 'gallery' => 'gallery',
|
||||
'news' => 'news',
|
||||
// 'social' => 'social',
|
||||
// 'video' => 'video',
|
||||
// 'multimedia' => 'multimedia'
|
||||
);
|
||||
|
||||
private $_data = array();
|
||||
@@ -79,6 +79,11 @@ class e_theme
|
||||
|
||||
}
|
||||
|
||||
function getCategoryList()
|
||||
{
|
||||
return self::$allowedCategories;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load theme layout from html files
|
||||
* Requires theme.html file in the theme root directory.
|
||||
@@ -117,12 +122,12 @@ class e_theme
|
||||
|
||||
if(strpos($LAYOUT['_header_'], '{---HEADER---}')!==false)
|
||||
{
|
||||
$LAYOUT['_header_'] = str_replace('{---HEADER---}', $tp->parseTemplate('{HEADER}', true), $LAYOUT['_header_']);
|
||||
$LAYOUT['_header_'] = str_replace('{---HEADER---}', $tp->parseTemplate('{HEADER}'), $LAYOUT['_header_']);
|
||||
}
|
||||
|
||||
if(strpos($LAYOUT['_footer_'], '{---FOOTER---}')!==false)
|
||||
{
|
||||
$LAYOUT['_footer_'] = str_replace('{---FOOTER---}', $tp->parseTemplate('{FOOTER}', true), $LAYOUT['_footer_']);
|
||||
$LAYOUT['_footer_'] = str_replace('{---FOOTER---}', $tp->parseTemplate('{FOOTER}'), $LAYOUT['_footer_']);
|
||||
}
|
||||
|
||||
$LAYOUT[$key] = file_get_contents(e_THEME.$theme."/layouts/".$key."_layout.html");
|
||||
@@ -589,7 +594,7 @@ class e_theme
|
||||
* @param bool|false xml|false
|
||||
* @param bool|false $force force a refresh ie. ignore cached list.
|
||||
* @return array
|
||||
*/
|
||||
*//*
|
||||
public static function getThemeList($mode = false, $force = false)
|
||||
{
|
||||
trigger_error('<b>'.__METHOD__.' is deprecated.</b> Use getList() instead.', E_USER_DEPRECATED); // NO LAN
|
||||
@@ -647,7 +652,7 @@ class e_theme
|
||||
|
||||
return $themeArray;
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
/**
|
||||
* Internal Use. Heavy CPU usage.
|
||||
@@ -683,7 +688,7 @@ class e_theme
|
||||
{
|
||||
$nonadmin = preg_match('/\* Non-Admin(.*?)\*\//', $cssContents) ? true : false;
|
||||
preg_match('/\* info:(.*?)\*\//', $cssContents, $match);
|
||||
$match[1] = varset($match[1], '');
|
||||
$match[1] = varset($match[1]);
|
||||
$scope = ($nonadmin == true) ? 'front' : '';
|
||||
|
||||
|
||||
@@ -743,19 +748,19 @@ class e_theme
|
||||
|
||||
|
||||
preg_match('/themename(\s*?=\s*?)("|\')(.*?)("|\');/si', $themeContents, $match);
|
||||
$themeArray['name'] = varset($match[3], '');
|
||||
$themeArray['name'] = varset($match[3]);
|
||||
preg_match('/themeversion(\s*?=\s*?)("|\')(.*?)("|\');/si', $themeContents, $match);
|
||||
$themeArray['version'] = varset($match[3], '');
|
||||
$themeArray['version'] = varset($match[3]);
|
||||
preg_match('/themeauthor(\s*?=\s*?)("|\')(.*?)("|\');/si', $themeContents, $match);
|
||||
$themeArray['author'] = varset($match[3], '');
|
||||
$themeArray['author'] = varset($match[3]);
|
||||
preg_match('/themeemail(\s*?=\s*?)("|\')(.*?)("|\');/si', $themeContents, $match);
|
||||
$themeArray['email'] = varset($match[3], '');
|
||||
$themeArray['email'] = varset($match[3]);
|
||||
preg_match('/themewebsite(\s*?=\s*?)("|\')(.*?)("|\');/si', $themeContents, $match);
|
||||
$themeArray['website'] = varset($match[3], '');
|
||||
$themeArray['website'] = varset($match[3]);
|
||||
preg_match('/themedate(\s*?=\s*?)("|\')(.*?)("|\');/si', $themeContents, $match);
|
||||
$themeArray['date'] = varset($match[3], '');
|
||||
$themeArray['date'] = varset($match[3]);
|
||||
preg_match('/themeinfo(\s*?=\s*?)("|\')(.*?)("|\');/si', $themeContents, $match);
|
||||
$themeArray['info'] = varset($match[3], '');
|
||||
$themeArray['info'] = varset($match[3]);
|
||||
preg_match('/xhtmlcompliant(\s*?=\s*?)(\S*?);/si', $themeContents, $match);
|
||||
$xhtml = strtolower($match[2]);
|
||||
$themeArray['xhtmlcompliant'] = ($xhtml == "true" ? "1.1" : false);
|
||||
@@ -1228,9 +1233,9 @@ class themeHandler
|
||||
var $noLog = FALSE;
|
||||
private $curTheme = null;
|
||||
|
||||
private $approvedAdminThemes = array('bootstrap','bootstrap3');
|
||||
// private $approvedAdminThemes = array('bootstrap','bootstrap3', 'bootstrap5');
|
||||
|
||||
public $allowedCategories = array('generic',
|
||||
/* public $allowedCategories = array('generic',
|
||||
'adult',
|
||||
'blog',
|
||||
'clan',
|
||||
@@ -1242,7 +1247,7 @@ class themeHandler
|
||||
'news',
|
||||
'social',
|
||||
'video',
|
||||
'multimedia');
|
||||
'multimedia');*/
|
||||
|
||||
/**
|
||||
* Marketplace handler instance
|
||||
@@ -1250,7 +1255,7 @@ class themeHandler
|
||||
*/
|
||||
protected $mp;
|
||||
|
||||
const RENDER_THUMBNAIL = 0;
|
||||
// const RENDER_THUMBNAIL = 0;
|
||||
const RENDER_SITEPREFS = 1;
|
||||
const RENDER_ADMINPREFS = 2;
|
||||
|
||||
@@ -1263,12 +1268,7 @@ class themeHandler
|
||||
global $e107cache,$pref;
|
||||
$mes = e107::getMessage();
|
||||
|
||||
/*
|
||||
if(deftrue('e_BOOTSTRAP3_ADMIN'))
|
||||
{
|
||||
$this->approvedAdminThemes[] = 'bootstrap3';
|
||||
}
|
||||
*/
|
||||
|
||||
require_once (e_HANDLER."form_handler.php");
|
||||
|
||||
|
||||
@@ -1381,7 +1381,7 @@ class themeHandler
|
||||
$this->SetCustomPages($_POST['custompages']);
|
||||
$this->setStyle();
|
||||
|
||||
e107::getConfig()->save(true);
|
||||
e107::getConfig()->save();
|
||||
|
||||
}
|
||||
|
||||
@@ -1466,6 +1466,7 @@ class themeHandler
|
||||
* @param string [optional] $categoryfromXML
|
||||
* @return string
|
||||
*/
|
||||
/*
|
||||
function getThemeCategory($categoryfromXML = '')
|
||||
{
|
||||
if(!$categoryfromXML)
|
||||
@@ -1492,7 +1493,7 @@ class themeHandler
|
||||
|
||||
}
|
||||
|
||||
|
||||
*/
|
||||
function themeUpload()
|
||||
{
|
||||
if(!$_POST['ac'] == md5(ADMINPWCHANGE))
|
||||
@@ -1648,7 +1649,7 @@ class themeHandler
|
||||
return $this->mp;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
function renderOnline($ajax=false)
|
||||
{
|
||||
global $e107SiteUsername, $e107SiteUserpass;
|
||||
@@ -1677,33 +1678,10 @@ class themeHandler
|
||||
));
|
||||
$total = $xdata['params']['count'];
|
||||
|
||||
// OLD BIT OF CODE ------------------------------->
|
||||
/*$file = "http://e107.org/feed?type=theme&frm=".$from."&srch=".$srch."&limit=".$limit;
|
||||
|
||||
$mes->addDebug("File = ".$file);
|
||||
|
||||
$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'];*/
|
||||
// OLD BIT OF CODE ------------------------------->
|
||||
|
||||
|
||||
$amount =$limit;
|
||||
|
||||
/*
|
||||
if($total > $amount)
|
||||
{
|
||||
//$parms = $total.",".$amount.",".$from.",".e_SELF.'?mode='.$_GET['mode'].'&frm=[FROM]';
|
||||
|
||||
$url = rawurlencode(e_SELF.'?mode='.$_GET['mode'].'&frm=[FROM]');
|
||||
$parms = "total=".$total."&amount=".$amount."¤t=".$from."&url=".$url."&caption=off&tmpl=basic&navcount=4&glyphs=1";
|
||||
|
||||
$text .= "<div class='span5' style='margin-left: 100px;margin-top:10px'>".$tp->parseTemplate("{NEXTPREV=$parms}",TRUE)."</div>";
|
||||
}
|
||||
*/
|
||||
|
||||
// print_a($xdata);
|
||||
|
||||
|
||||
$c = 1;
|
||||
|
||||
$filterName = '';
|
||||
@@ -1763,47 +1741,7 @@ class themeHandler
|
||||
$slides[] = 1;
|
||||
$c = 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
||||
[author] => e107 Inc
|
||||
[summary] => Bootstrap e107 admin theme
|
||||
[category] => generic
|
||||
[keywords] => Array
|
||||
(
|
||||
[word] => Array
|
||||
(
|
||||
[0] => bootstrap
|
||||
[1] => clean
|
||||
)
|
||||
|
||||
)
|
||||
[name] => bootstrap
|
||||
[version] => 1.0
|
||||
[date] => 2012-12-01
|
||||
[compatibility] => 2.0
|
||||
[releaseUrl] =>
|
||||
[email] => e107inc@something.com
|
||||
[website] => http://e107.org
|
||||
[info] => Bootstrap e107 admin theme
|
||||
[compliance] => Array
|
||||
(
|
||||
[@attributes] => Array
|
||||
(
|
||||
[xhtml] =>
|
||||
[css] =>
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
[xhtmlcompliant] =>
|
||||
[csscompliant] =>
|
||||
[path] => bootstrap
|
||||
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1835,9 +1773,9 @@ class themeHandler
|
||||
$ns->tablerender(TPVLAN_26.SEP.TPVLAN_69, $mes->render().$text);
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/*
|
||||
function showThemes($mode = 'main')
|
||||
{
|
||||
global $pref;
|
||||
@@ -1910,11 +1848,11 @@ class themeHandler
|
||||
|
||||
echo "</div>\n";
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
function renderUploadForm()
|
||||
{
|
||||
$mes = e107::getMessage();
|
||||
@@ -1960,7 +1898,7 @@ class themeHandler
|
||||
|
||||
$ns->tablerender(TPVLAN_26.SEP.TPVLAN_38, $mes->render().$text);
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
function renderThemeInfo($theme)
|
||||
{
|
||||
@@ -1990,7 +1928,7 @@ class themeHandler
|
||||
$author = !empty($theme['email']) ? "<a href='mailto:".$theme['email']."' title='".$theme['email']."'>".$theme['author']."</a>" : $theme['author'];
|
||||
$website = !empty($theme['website']) ? "<a href='".$theme['website']."' rel='external'>".$theme['website']."</a>" : "";
|
||||
// $preview = "<a href='".SITEURL."news.php?themepreview.".$theme['id']."' title='".TPVLAN_9."' >".($theme['preview'] ? "<img src='".$theme['preview']."' style='border: 1px solid #000;width:200px' alt='' />" : "<img src='".e_IMAGE_ABS."admin_images/nopreview.png' title='".TPVLAN_12."' alt='' />")."</a>";
|
||||
$description = vartrue($theme['description'],'');
|
||||
$description = vartrue($theme['description']);
|
||||
$compat = (version_compare(1.9,$theme['compatibility'],'<')) ? "<span class='label label-".$compatLabelType."'>".$theme['compatibility']."</span><span class='text-".$compatLabelType."'> ".$compatLabel."</span>": vartrue($theme['compatibility'],'1.0');
|
||||
$price = (!empty($theme['price'])) ? "<span class='label label-primary'><i class='icon-shopping-cart icon-white'></i> ".$theme['price']."</span>" : "<span class='label label-success'>".TPVLAN_76."</span>";
|
||||
|
||||
@@ -2220,7 +2158,7 @@ class themeHandler
|
||||
{
|
||||
if(!empty($val['multilan']) && isset($value[$field][e_LANGUAGE]))
|
||||
{
|
||||
$value[$field] = varset($value[$field][e_LANGUAGE],'');
|
||||
$value[$field] = varset($value[$field][e_LANGUAGE]);
|
||||
}
|
||||
|
||||
$tdClass = !empty($val['writeParms']['post']) ? 'form-inline' : '';
|
||||
@@ -2271,7 +2209,7 @@ class themeHandler
|
||||
$siteThemePref = e107::getConfig()->get('sitetheme_pref');
|
||||
if(!empty($siteThemePref))
|
||||
{
|
||||
e107::getConfig()->set('sitetheme_pref',null)->save(false,true,false); // remove old theme pref
|
||||
e107::getConfig()->set('sitetheme_pref')->save(false,true,false); // remove old theme pref
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2301,16 +2239,17 @@ class themeHandler
|
||||
$frm = e107::getForm();
|
||||
$tp = e107::getParser();
|
||||
|
||||
|
||||
|
||||
$author = ($theme['email'] ? "<a href='mailto:".$theme['email']."' title='".$theme['email']."'>".$theme['author']."</a>" : $theme['author']);
|
||||
$website = ($theme['website'] ? "<a href='".$theme['website']."' rel='external'>".$theme['website']."</a>" : "");
|
||||
// $preview = "<a href='".e_BASE."news.php?themepreview.".$theme['id']."' title='".TPVLAN_9."' >".($theme['preview'] ? "<img src='".$theme['preview']."' style='border: 1px solid #000;width:200px' alt='' />" : "<img src='".e_IMAGE_ABS."admin_images/nopreview.png' title='".TPVLAN_12."' alt='' />")."</a>";
|
||||
$main_icon = ($pref['sitetheme'] != $theme['path']) ? "<button class='btn btn-default btn-secondary btn-small btn-sm btn-inverse' type='submit' name='selectmain[".$theme['id']."]' alt=\"".TPVLAN_10."\" title=\"".TPVLAN_10."\" >".$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 class='btn btn-default btn-secondary btn-small btn-sm btn-inverse' type='submit' name='selectmain[".$theme['id']."]' alt=\"".TPVLAN_10."\" title=\"".TPVLAN_10."\" >".$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 data-toggle='modal' data-bs-toggle='modal' data-target='".e_SELF."' href='#themeInfo_".$theme['id']."' class='e-tip' title='".TPVLAN_7."'><img src='".e_IMAGE_ABS."admin_images/info_32.png' alt='' class='icon S32' /></a>";
|
||||
$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='".e_SELF."?mode=".varset($_GET['mode'])."&id=".$theme['path']."&action=info' title='".TPVLAN_7."'>".$tp->toGlyph('fa-info-circle',array('size'=>'2x'))."</a>";
|
||||
// $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='".e_SELF."?mode=".varset($_GET['mode'])."&id=".$theme['path']."&action=info' title='".TPVLAN_7."'>".$tp->toGlyph('fa-info-circle',array('size'=>'2x'))."</a>";
|
||||
// $preview_icon = "<a title='Preview : ".$theme['name']."' rel='external' class='e-dialog' href='".e_BASE."index.php?themepreview.".$theme['id']."'>".E_32_SEARCH."</a>";
|
||||
$admin_icon = ($pref['admintheme'] != $theme['path'] ) ? "<button class='btn btn-default btn-secondary 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-secondary btn-sm btn-inverse' type='button'>".$tp->toGlyph('fa-check',array('size'=>'2x'))."</button>";
|
||||
// $admin_icon = ($pref['admintheme'] != $theme['path'] ) ? "<button class='btn btn-default btn-secondary 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-secondary btn-sm btn-inverse' type='button'>".$tp->toGlyph('fa-check',array('size'=>'2x'))."</button>";
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$price = '';
|
||||
@@ -2335,132 +2274,20 @@ class themeHandler
|
||||
}
|
||||
|
||||
$thumbnail = "<img class='".$class."' src='".$thumbPath."' style='max-width:100%' alt='' />";
|
||||
|
||||
|
||||
if($_GET['mode'] == 'online')
|
||||
{
|
||||
$srcData = array(
|
||||
'id' => $theme['id'],
|
||||
'url' => $theme['url'],
|
||||
'mode' => $theme['mode'],
|
||||
'price' => $theme['price']
|
||||
);
|
||||
|
||||
|
||||
e107::getSession()->set('thememanager/online/'.$theme['id'], $theme);
|
||||
|
||||
$d = http_build_query($srcData,false,'&');
|
||||
$base64 = base64_encode($d);
|
||||
// e107::getDebug()->log($theme['name'].': '.strlen($base64));
|
||||
$url = e_SELF."?src=".$base64;
|
||||
$id = $frm->name2id($theme['name']);
|
||||
$LAN_DOWNLOAD = ($theme['price'] > 0) ? LAN_PURCHASE."/".LAN_DOWNLOAD : LAN_DOWNLOAD;
|
||||
|
||||
/*
|
||||
if($this->mp->hasAuthKey())
|
||||
{
|
||||
$action = 'download';
|
||||
$caption = "Downloading ".$theme['name']." ".$theme['version'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$action = 'login';
|
||||
$caption = "Please login to your e107.org account to proceed..";
|
||||
}
|
||||
*/
|
||||
|
||||
$downloadUrl = e_SELF.'?mode=download&src='.base64_encode($d);//$url.'&action=download';
|
||||
$infoUrl = $url.'&action=info';
|
||||
|
||||
$viewUrl = $theme['url'];
|
||||
|
||||
//$main_icon = "<a data-src='".$downloadUrl."' href='{$downloadUrl}' data-target='{$id}' data-loading='".e_IMAGE."/generic/loading_32.gif' class='-e-ajax' title='".$LAN_DOWNLOAD."' ><img class='top' src='".e_IMAGE_ABS."icons/download_32.png' alt='' /></a> ";
|
||||
// $main_icon = "<a data-toggle='modal' data-bs-toggle='modal' data-modal-caption=\"".$caption."\" href='{$downloadUrl}' data-cache='false' data-target='#uiModal' title='".$LAN_DOWNLOAD."' >".$tp->toGlyph('download',array('size'=>'2x'))."</a> ";
|
||||
|
||||
$modalCaption = (empty($theme['price'])) ? ' '.LAN_DOWNLOADING.' '.$theme['name']." ".$theme['version'] :' '.LAN_PURCHASE.' '.$theme['name']." ".$theme['version'];
|
||||
$main_icon = "<a class='e-modal btn-default btn-secondary btn btn-sm btn-small btn-inverse' data-modal-caption=\"".$modalCaption."\" rel='external' href='{$downloadUrl}' data-cache='false' title='".$LAN_DOWNLOAD."' >".$tp->toGlyph('fa-download',array('size'=>'2x'))."</a>";
|
||||
|
||||
|
||||
|
||||
// Temporary Pop-up version.
|
||||
// $main_icon = "<a class='e-modal btn btn-small btn-inverse' data-modal-caption=\"".$theme['name']." ".$theme['version']."\" rel='external' href='{$viewUrl}' data-cache='false' title='".$LAN_DOWNLOAD."' >".$tp->toGlyph('download',array('size'=>'2x'))."</a> ";
|
||||
|
||||
|
||||
$info_icon = "<a class='btn btn-default btn-secondary btn-sm btn-small btn-inverse e-modal' data-toggle='modal' data-bs-toggle='modal' data-modal-caption=\"".$theme['name']." ".$theme['version']."\" href='".$infoUrl."' data-cache='false' title='".TPVLAN_7."'>".$tp->toGlyph('fa-info-circle',array('size'=>'2x'))."</a>";
|
||||
|
||||
if($theme['livedemo'])
|
||||
{
|
||||
$previewPath = $theme['livedemo'];
|
||||
}
|
||||
|
||||
$price = (!empty($theme['price'])) ? "<span class='label label-primary pull-right'>".$theme['price']."</span>" : "<span class='label label-success pull-right'>".TPVLAN_76."</span>";
|
||||
|
||||
}
|
||||
|
||||
$preview_icon = "<a class='e-modal btn btn-default btn-secondary btn-sm btn-small btn-inverse' title=' ".TPVLAN_70." ".$theme['name']."' data-modal-caption=\"".$theme['name']." ".$theme['version']."\" rel='external' href='".$previewPath."'>".$tp->toGlyph('fa-search',array('size'=>'2x'))."</a>";
|
||||
|
||||
|
||||
if(!in_array($theme['path'], $this->approvedAdminThemes))
|
||||
{
|
||||
$admin_icon = "";
|
||||
}
|
||||
|
||||
//if($theme['name'] == 'bootstrap')
|
||||
//{
|
||||
// print_a($theme);
|
||||
// }
|
||||
//
|
||||
// $thumbPath = (substr($theme['thumbnail'],0,4) == 'http') ? $theme['thumbnail'] : e_THEME.$theme['path'] ."/".$theme['preview'][0];
|
||||
// $thumbnail = "<a href='".e_BASE."news.php?themepreview.".$theme['id']."' title='".TPVLAN_9."' >";
|
||||
|
||||
|
||||
|
||||
// $thumbnail .= "</a>";
|
||||
|
||||
// Choose a Theme to Install.
|
||||
|
||||
|
||||
|
||||
|
||||
if($mode == self::RENDER_THUMBNAIL)
|
||||
{
|
||||
// styles NEED to be put into style.css
|
||||
/*
|
||||
if($pref['sitetheme'] == $theme['path'])
|
||||
{
|
||||
$borderStyle = "admin-theme-cell-site";
|
||||
}
|
||||
elseif($pref['admintheme'] == $theme['path'])
|
||||
{
|
||||
$borderStyle = "admin-theme-cell-admin";
|
||||
}
|
||||
else
|
||||
{
|
||||
$borderStyle = "admin-theme-cell-default";
|
||||
}
|
||||
*/
|
||||
$borderStyle = 'well';
|
||||
|
||||
|
||||
$text = "
|
||||
<div class='f-left block-text admin-theme-cell ".$borderStyle."'>
|
||||
<div class='well admin-theme-thumb'>".$thumbnail."</div>
|
||||
<div id='".$frm->name2id($theme['name'])."' class='admin-theme-options'>".$main_icon.$admin_icon.$info_icon.$preview_icon."</div>
|
||||
<div class='admin-theme-title'><small>".strip_tags($theme['name'])." ".$theme['version']."</small>
|
||||
".$price."
|
||||
</div>
|
||||
</div>";
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
|
||||
// Choose a Theme to Install.
|
||||
|
||||
$this->id = $theme['path'];
|
||||
|
||||
// load customn theme configuration fields.
|
||||
$this->loadThemeConfig();
|
||||
|
||||
$text = '';
|
||||
// $text .= "<h2 class='caption'>".$theme['name']."</h2>";
|
||||
|
||||
$text .= "
|
||||
|
||||
@@ -2553,7 +2380,7 @@ class themeHandler
|
||||
<col class='col-tm-layout-preset' style='width:20%' />
|
||||
</colgroup>
|
||||
<tr>";
|
||||
$itext .= ($mode == self::RENDER_SITEPREFS) ? "<th class='center top'>".TPVLAN_55."</th>" : "";
|
||||
$itext .= "<th class='center top'>".TPVLAN_55."</th>";
|
||||
$itext .= "
|
||||
<th>".TPVLAN_52."</th>
|
||||
<th>".TPVLAN_56." <a href='#' class='e-tip' title=\"".TPVLAN_96."\">".ADMIN_INFO_ICON."</a></th>
|
||||
@@ -2702,7 +2529,7 @@ class themeHandler
|
||||
}
|
||||
|
||||
|
||||
$text .= varset($itext, '');
|
||||
$text .= varset($itext);
|
||||
|
||||
|
||||
$theme['css'] = $this->filterStylesheets($mode, $theme);
|
||||
@@ -3031,7 +2858,7 @@ class themeHandler
|
||||
*/
|
||||
function setTheme($name = '', $contentCheck = true)
|
||||
{
|
||||
$core = e107::getConfig('core');
|
||||
$core = e107::getConfig();
|
||||
$sql = e107::getDb();
|
||||
$mes = e107::getMessage();
|
||||
|
||||
@@ -3286,7 +3113,7 @@ class themeHandler
|
||||
}
|
||||
|
||||
$config->setPosted('adminstyle', $_POST['adminstyle'])
|
||||
->setPosted('adminpref', varset($_POST['adminpref'], 0))->save(true,true,false);
|
||||
->setPosted('adminpref', varset($_POST['adminpref'], 0))->save(true,true);
|
||||
|
||||
|
||||
e107::redirect(e_REQUEST_URI);
|
||||
@@ -3344,9 +3171,9 @@ class themeHandler
|
||||
}
|
||||
global $pref,$admin_log;
|
||||
// if (!varset($pref['admin_log_log']['admin_banlist'],0)) return;
|
||||
e107::getLog()->add('THEME_'.$msg_num, $woffle, E_LOG_INFORMATIVE, '');
|
||||
e107::getLog()->add('THEME_'.$msg_num, $woffle);
|
||||
}
|
||||
|
||||
/*
|
||||
function parse_theme_php($path)
|
||||
{
|
||||
return e_theme::parse_theme_php($path);
|
||||
@@ -3357,7 +3184,7 @@ class themeHandler
|
||||
return e_theme::parse_theme_xml($path);
|
||||
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user