diff --git a/e107_admin/admin.php b/e107_admin/admin.php index 0ad7fede6..ed176071e 100644 --- a/e107_admin/admin.php +++ b/e107_admin/admin.php @@ -110,7 +110,7 @@ class admin_start 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; } @@ -189,12 +189,12 @@ class admin_start e107::getDb()->db_Mark_Time('Check New Install'); $this->checkNewInstall(); - e107::getDb()->db_Mark_Time('Check Plugin Update'); + /* e107::getDb()->db_Mark_Time('Check Plugin Update'); $this->checkPluginUpdate(); e107::getDb()->db_Mark_Time('Check Theme Update'); $this->checkThemeUpdate(); - + */ e107::getDb()->db_Mark_Time('Check Password Encryption'); $this->checkPasswordEncryption(); @@ -287,7 +287,8 @@ class admin_start } - +/* + * // Moved to admin_shortcodes.php private function checkPluginUpdate() { require_once(e_HANDLER.'e_marketplace.php'); @@ -322,14 +323,15 @@ class admin_start e107::getMessage()->addInfo($message); - e107::getMessage()->addDebug("Local version: ".$version." Remote version: ".$versions[$folder]['version']); + } } - } - + }*/ +/* + * Moved to admin_shortcodes.php private function checkThemeUpdate() { require_once(e_HANDLER.'e_marketplace.php'); @@ -376,7 +378,7 @@ class admin_start - } + }*/ /** * diff --git a/e107_admin/boot.php b/e107_admin/boot.php index 900be40ce..e760bd231 100644 --- a/e107_admin/boot.php +++ b/e107_admin/boot.php @@ -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'; $tag = 'Infopanel_'.$type; diff --git a/e107_core/shortcodes/batch/admin_shortcodes.php b/e107_core/shortcodes/batch/admin_shortcodes.php index 7dd8fdd42..1ef13e578 100644 --- a/e107_core/shortcodes/batch/admin_shortcodes.php +++ b/e107_core/shortcodes/batch/admin_shortcodes.php @@ -1319,7 +1319,123 @@ Inverse 10 10 } - + 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 = '
'.$row['version'].'
+ Released: '.($row['date']).'
+