1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-29 10:50:25 +02:00

Plugin/Theme update check moved to admin_shortcodes

This commit is contained in:
Cameron
2017-02-02 11:48:13 -08:00
parent 8843752aa1
commit f7a14d29ae
8 changed files with 170 additions and 204 deletions

View File

@@ -110,7 +110,7 @@ class admin_start
function __construct() function __construct()
{ {
if(!getperms('0') || varset($_GET['mode']) === 'customize') // don't display this tuff to regular admins only main admin. if(e_AJAX_REQUEST || !getperms('0') || varset($_GET['mode']) === 'customize') // don't display this tuff to regular admins only main admin.
{ {
return null; return null;
} }
@@ -189,12 +189,12 @@ class admin_start
e107::getDb()->db_Mark_Time('Check New Install'); e107::getDb()->db_Mark_Time('Check New Install');
$this->checkNewInstall(); $this->checkNewInstall();
e107::getDb()->db_Mark_Time('Check Plugin Update'); /* e107::getDb()->db_Mark_Time('Check Plugin Update');
$this->checkPluginUpdate(); $this->checkPluginUpdate();
e107::getDb()->db_Mark_Time('Check Theme Update'); e107::getDb()->db_Mark_Time('Check Theme Update');
$this->checkThemeUpdate(); $this->checkThemeUpdate();
*/
e107::getDb()->db_Mark_Time('Check Password Encryption'); e107::getDb()->db_Mark_Time('Check Password Encryption');
$this->checkPasswordEncryption(); $this->checkPasswordEncryption();
@@ -287,7 +287,8 @@ class admin_start
} }
/*
* // Moved to admin_shortcodes.php
private function checkPluginUpdate() private function checkPluginUpdate()
{ {
require_once(e_HANDLER.'e_marketplace.php'); require_once(e_HANDLER.'e_marketplace.php');
@@ -322,14 +323,15 @@ class admin_start
e107::getMessage()->addInfo($message); e107::getMessage()->addInfo($message);
e107::getMessage()->addDebug("Local version: ".$version." Remote version: ".$versions[$folder]['version']);
} }
} }
} }*/
/*
* Moved to admin_shortcodes.php
private function checkThemeUpdate() private function checkThemeUpdate()
{ {
require_once(e_HANDLER.'e_marketplace.php'); require_once(e_HANDLER.'e_marketplace.php');
@@ -376,7 +378,7 @@ class admin_start
} }*/
/** /**
* *

View File

@@ -77,7 +77,7 @@ if(ADMIN && e_AJAX_REQUEST && varset($_GET['mode']) == 'core' && ($_GET['type']
if(ADMIN && e_AJAX_REQUEST && varset($_GET['mode']) == 'addons' ) if(ADMIN && (e_AJAX_REQUEST || e_DEBUG_FEEDS===true) && varset($_GET['mode']) == 'addons' )
{ {
$type = ($_GET['type'] == 'plugin') ? 'plugin' : 'theme'; $type = ($_GET['type'] == 'plugin') ? 'plugin' : 'theme';
$tag = 'Infopanel_'.$type; $tag = 'Infopanel_'.$type;

View File

@@ -1319,7 +1319,123 @@ Inverse 10 <span class="badge badge-inverse">10</span>
} }
function sc_admin_addon_updates()
{
if(!getperms('0'))
{
return null;
}
$themes = $this->getUpdateable('theme');
$plugins = $this->getUpdateable('plugin');
$text = $this->renderAddonUpdate($plugins);
$text .= $this->renderAddonUpdate($themes);
if(empty($text))
{
return null;
}
$tp = e107::getParser();
return e107::getRender()->tablerender($tp->toGlyph('fa-arrow-circle-o-down').'Updates Available',$text,'default',true);
}
private function getUpdateable($type)
{
if(empty($type))
{
return false;
}
require_once(e_HANDLER.'e_marketplace.php');
$mp = new e_marketplace(); // autodetect the best method
switch($type)
{
case "theme":
$versions = $mp->getVersionList('theme');
$list = e107::getTheme()->getThemeList('version');
break;
case "plugin":
$versions = $mp->getVersionList('plugin');
$list = e107::getPref('plug_installed');
break;
}
$ret = array();
foreach($list as $folder=>$version)
{
if(!empty($versions[$folder]['version']) && version_compare( $version, $versions[$folder]['version'], '<'))
{
$versions[$folder]['modalDownload'] = $mp->getDownloadModal('theme', $versions[$folder]);
$ret[] = $versions[$folder];
e107::getMessage()->addDebug("Local version: ".$version." Remote version: ".$versions[$folder]['version']);
}
}
return $ret;
}
private function renderAddonUpdate($list)
{
if(empty($list))
{
return null;
}
$tp = e107::getParser();
$text = '<ul class="media-list">';
foreach($list as $row)
{
$caption = LAN_DOWNLOAD.": ".$row['name']." ".$row['version'];
$ls = '<a href="'.$row['modalDownload'].'" class="e-modal alert-link" data-modal-caption="'.$caption .'" title="'.LAN_DOWNLOAD.'">';
$le = '</a>';
$thumb = ($row['icon']) ? $row['icon'] : $row['thumbnail'];
$text .= '
<li class="media">
<div class="media-left">
'.$ls.'
<img class="media-object" src="'.$thumb.'" width="96">
'.$le.'
</div>
<div class="media-body">
<h4 class="media-heading">'.$ls.$row['name'].$le.'</h4>
<p>'.$row['version'].'<br />
<small class="text-muted">Released: '.($row['date']).'</small>
</p>
</div>
</li>
';
}
$text .= "</ul>";
return $text;
}
function sc_admin_update() function sc_admin_update()
{ {

View File

@@ -106,14 +106,20 @@ class e_theme
$tloop = 1; $tloop = 1;
$array = scandir(e_THEME); $cacheTag = self::CACHETAG;
if(!empty($mode))
{
$cacheTag = self::CACHETAG.'_'.$mode;
}
if($force === false && $tmp = e107::getCache()->retrieve(self::CACHETAG, self::CACHETIME, true, true)) if($force === false && $tmp = e107::getCache()->retrieve($cacheTag, self::CACHETIME, true, true))
{ {
return e107::unserialize($tmp); return e107::unserialize($tmp);
} }
$array = scandir(e_THEME);
foreach($array as $file) foreach($array as $file)
{ {
@@ -124,10 +130,15 @@ class e_theme
if($file != "." && $file != ".." && $file != "CVS" && $file != "templates" && is_dir(e_THEME.$file) && is_readable(e_THEME.$file."/theme.php")) if($file != "." && $file != ".." && $file != "CVS" && $file != "templates" && is_dir(e_THEME.$file) && is_readable(e_THEME.$file."/theme.php"))
{ {
if($mode == "id") if($mode === "id")
{ {
$themeArray[$tloop] = $file; $themeArray[$tloop] = $file;
} }
elseif($mode === 'version')
{
$data = self::getThemeInfo($file);
$themeArray[$file] = $data['version'];
}
else else
{ {
$themeArray[$file] = self::getThemeInfo($file); $themeArray[$file] = self::getThemeInfo($file);
@@ -140,7 +151,7 @@ class e_theme
$cacheSet = e107::serialize($themeArray,'json'); $cacheSet = e107::serialize($themeArray,'json');
e107::getCache()->set(self::CACHETAG,$cacheSet,true,true,true); e107::getCache()->set($cacheTag,$cacheSet,true,true,true);
return $themeArray; return $themeArray;
} }

View File

@@ -38,7 +38,7 @@ tr.highlight-even, .table-striped > tbody > tr.highlight-even { background-colo
color: black; color: black;
} }
tr.first a, th a { color: rgb(102, 102, 102); }
.bootstrap-select.btn-group .dropdown-menu .optgroup-div { .bootstrap-select.btn-group .dropdown-menu .optgroup-div {

View File

@@ -142,7 +142,10 @@ table label.checkbox { margin-left: 20px }
#admin-ui-media-manager-search { margin-bottom: 20px } #admin-ui-media-manager-search { margin-bottom: 20px }
/*
.panel-default:hover { transition: color .50s ease-in-out; -moz-transition: color .50s ease-in-out; -webkit-transition: color .50s ease-in-out; color: #fff } .panel-default:hover { transition: color .50s ease-in-out; -moz-transition: color .50s ease-in-out; -webkit-transition: color .50s ease-in-out; color: #fff }
*/
#admin-ui-edit { } #admin-ui-edit { }
#admin-ui-edit-db-language { margin-bottom: -30px; padding-bottom:5px; padding-right:5px } #admin-ui-edit-db-language { margin-bottom: -30px; padding-bottom:5px; padding-right:5px }

View File

@@ -157,54 +157,7 @@ $E_ADMIN_NAVIGATION['end'] = '</ul>';
$inverse = (e107::getPref('admincss') == "admin_light.css") ? "navbar-inverse" : ""; $inverse = (e107::getPref('admincss') == "admin_light.css") ? "navbar-inverse" : "";
/*
$ADMIN_HEADER = '<div class="navbar '.$inverse.' navbar-nav navbar-fixed-top">
<div class="navbar-inner">
<div class="container-fluid">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand " href="'.e_ADMIN_ABS.'admin.php" title="Return to Front Panel"><img class="admin-logo" src="'.e_THEME_ABS.'bootstrap/images/e107_adminlogo.png" alt="e107" /></a>
<div class="nav-collapse collapse">
<div class="dropdown nav">
{ADMIN_NAVIGATION=no-main}
</div>
<div class="dropdown nav pull-right navbar-text ">
<li>{ADMIN_COREUPDATE=icon}</li>
{ADMIN_PM}
{ADMIN_NAVIGATION=home}
{ADMIN_NAVIGATION=language}
{ADMIN_NAVIGATION=logout}
</div>
</div><!--/.nav-collapse -->
</div>
</div>
</div>';
*/
/*
$ADMIN_MODAL = '<div id="uiModal" class="modal hide fade" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-caption">&nbsp;</h4>
</div>
<div class="modal-body">
<p>Loading…</p>
</div>
<div class="modal-footer">
<a href="#" data-dismiss="modal" class="btn btn-primary">Close</a>
</div>
</div>';*/
// TODO - LANs
$ADMIN_MODAL = ' $ADMIN_MODAL = '
<div id="uiModal" class="modal fade"> <div id="uiModal" class="modal fade">
<div id="admin-ui-modal" class="modal-dialog modal-lg"> <div id="admin-ui-modal" class="modal-dialog modal-lg">
@@ -226,7 +179,7 @@ $ADMIN_MODAL = '
</div> </div>
'; ';
// TODO - LANs
$ADMIN_HEADER = $ADMIN_MODAL . ' $ADMIN_HEADER = $ADMIN_MODAL . '
<div class="navbar navbar-default navbar-fixed-top" role="navigation"> <div class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container"> <div class="container">
@@ -268,13 +221,17 @@ if(defset('e_PAGE') == 'admin.php' && $adminstyle == 'flexpanel' && varset($_GET
} }
else else
{ {
// TODO - LANs
$ADMIN_HEADER .= ' $ADMIN_HEADER .= '
<div class="col-md-3 col-lg-2 admin-left-panel"> <div class="col-md-3 col-lg-2 admin-left-panel">
{SETSTYLE=warning}
{ADMIN_ADDON_UPDATES}
{SETSTYLE=site_info}
{ADMIN_PWORD}
{SETSTYLE=admin_menu} {SETSTYLE=admin_menu}
{ADMIN_MENU} {ADMIN_MENU}
{ADMIN_PWORD}
{ADMIN_MENUMANAGER} {ADMIN_MENUMANAGER}
<div class="e-scroll-fixed"> <div class="e-scroll-fixed">
@@ -312,98 +269,11 @@ $ADMIN_FOOTER = '
</div><!--/.fluid-container--> </div><!--/.fluid-container-->
<footer class="center mute"> <footer class="center mute">
Copyright &copy; 2008-2015 e107 Inc (e107.org)<br /> Copyright &copy; 2008-2017 e107 Inc (e107.org)<br />
</footer> </footer>
'; ';
//{FS_ADMIN_ALT_NAV}
/*
$ADMIN_HEADER = "
<div class='admin-wrapper'>
<div class='admin-header'>
<div class='admin-header-content'>
<div class='f-right'><!-- -->{ADMIN_LANG=nobutton&nomenu}</div>
{ADMIN_LOGO}
{ADMIN_LOGGED}
{ADMIN_SEL_LAN}
</div>
<div style='height: 20px;'><!-- --></div>
<div class='admin-navigation'>
<div id='nav'>{ADMIN_NAVIGATION}</div>
<div class='clear'><!-- --></div>
</div>
</div>
<div class='admin-page-body'>
<table class='main-table'>
<tr>
<td class='col-left'>
{SETSTYLE=admin_menu}
{ADMIN_MENU}
{ADMIN_MENUMANAGER}
{ADMIN_PRESET}
{ADMIN_LANG}
{SETSTYLE=none}
{ADMIN_PWORD}
{ADMIN_STATUS=request}
{ADMIN_LATEST=request}
{ADMIN_LOG=request}
{ADMIN_MSG}
{ADMIN_PLUGINS}
{ADMIN_UPDATE}
{SETSTYLE=site_info}
{ADMIN_SITEINFO}
{ADMIN_HELP}
</td>
<td>
<div class='col-main'>
<div class='inner-wrapper'>
{SETSTYLE=admin_content}
";
*/
/*
{SETSTYLE=admin_menu}
<!--
{ADMIN_NAV}
-->
{ADMIN_LANG}
{ADMIN_SITEINFO}
{ADMIN_DOCS}
*/
/*
$ADMIN_FOOTER = "
</div>
</div>
</td>
<!--
<td class='col-right'>
<div class='col-right'>
</div>
</td>
-->
</tr>
</table>
</div>
<div class='admin-footer'>
<!-- -->
</div>
</div>
";
*/
/* NEW ADMIN MENU TEMPLATE /* NEW ADMIN MENU TEMPLATE
* see function e107::getNav()->admin() in e107_admin/header.php * see function e107::getNav()->admin() in e107_admin/header.php
*/ */
@@ -452,53 +322,4 @@ $E_ADMIN_MENU['end'] = '
$E_ADMIN_MENU['divider'] = '<li role="separator" class="divider"></li>'; $E_ADMIN_MENU['divider'] = '<li role="separator" class="divider"></li>';
/* NEW ADMIN SLIDE DOWN MENU TEMPLATE ?>
* see function admin_navigation() in e107_files/shortcodes/admin_navigation.php
* TODO move it together with menu.css/menu.js to the theme templates/e107_files folder (default menu render)
*/
/*
$E_ADMIN_NAVIGATION['start'] = '
<ul id="nav nav-links">
';
$E_ADMIN_NAVIGATION['button'] = '
<li>
<a class="menuButton" href="{LINK_URL}"{ONCLICK}>{LINK_IMAGE}{LINK_TEXT}</a>
{SUB_MENU}
</li>
';
$E_ADMIN_NAVIGATION['button_active'] = '
<li>
<a class="menuButton active" href="{LINK_URL}"{ONCLICK}>{LINK_IMAGE}{LINK_TEXT}</a>
{SUB_MENU}
</li>
';
$E_ADMIN_NAVIGATION['start_sub'] = '
<ul class="menu"{SUB_ID}>
';
$E_ADMIN_NAVIGATION['button_sub'] = '
<li>
<a class="menuItem{SUB_CLASS}" href="{LINK_URL}"{ONCLICK}>{LINK_IMAGE}{LINK_TEXT}</a>
{SUB_MENU}
</li>
';
$E_ADMIN_NAVIGATION['button_active_sub'] = '
<li>
<a class="menuItem{SUB_CLASS}" href="{LINK_URL}"{ONCLICK}>{LINK_IMAGE}{LINK_TEXT}</a>
{SUB_MENU}
</li>
';
$E_ADMIN_NAVIGATION['end_sub'] = '
</ul>
';
$E_ADMIN_NAVIGATION['end'] = '
</ul>
';
*/
?>

View File

@@ -170,6 +170,7 @@ class bootstrap3_admintheme
} }
switch(varset($style, 'admin_content')) switch(varset($style, 'admin_content'))
{ {
@@ -185,7 +186,7 @@ class bootstrap3_admintheme
break; break;
case 'admin_menu': case 'admin_menu':
echo '<div class="panel panel-default"> echo '<div class="panel panel-default" >
<div class="panel-heading"> <div class="panel-heading">
<h3 class="panel-title">' . $caption . '</h3> <h3 class="panel-title">' . $caption . '</h3>
</div> </div>
@@ -196,6 +197,18 @@ class bootstrap3_admintheme
break; break;
case 'warning':
echo '<div class="panel panel-warning">
<div class="panel-heading">
<h3 class="panel-title">' . $caption . '</h3>
</div>
<div class="panel-body">
' . $text . '
</div>
</div>';
break;
case 'core-infopanel': case 'core-infopanel':
case 'site_info': case 'site_info':
echo '<div class="panel ' . $panelType[$style] . '"> echo '<div class="panel ' . $panelType[$style] . '">