diff --git a/e107_admin/boot.php b/e107_admin/boot.php index 1163d7b02..24a5fdd66 100644 --- a/e107_admin/boot.php +++ b/e107_admin/boot.php @@ -35,7 +35,7 @@ if(ADMIN && defset('e_ADMIN_UI') && varset($_POST['mode']) == 'sef' && !empty($_ exit; } -if(ADMIN && e_AJAX_REQUEST && varset($_GET['mode']) == 'core' && ($_GET['type'] == 'update')) +if(getperms('0') && e_AJAX_REQUEST && varset($_GET['mode']) == 'core' && ($_GET['type'] == 'update')) { require_once(e_ADMIN.'update_routines.php'); @@ -52,6 +52,38 @@ if(ADMIN && e_AJAX_REQUEST && varset($_GET['mode']) == 'core' && ($_GET['type'] } +if(getperms('0') && e_AJAX_REQUEST && varset($_GET['mode']) == 'addons' && ($_GET['type'] == 'update')) +{ + e107::getSession()->set('addons-update-checked',true); + + $sc = e107::getScBatch('admin'); + + $themes = $sc->getUpdateable('theme'); + $plugins = $sc->getUpdateable('plugin'); + + $text = $sc->renderAddonUpdate($plugins); + $text .= $sc->renderAddonUpdate($themes); + + if(empty($text)) + { + exit; + } + + $ns = e107::getRender(); + + $tp = e107::getParser(); + $ns->setUniqueId('e-addon-updates'); + $ns->setStyle('warning'); + $ret = $ns->tablerender($tp->toGlyph('fa-arrow-circle-o-down').LAN_UPDATE_AVAILABLE,$text,'default', true); + + echo $ret; + + e107::getSession()->set('addons-update-status',$ret); + + exit; + +} + if(ADMIN && e_AJAX_REQUEST && varset($_GET['mode']) == 'core' && ($_GET['type'] == 'feed')) { diff --git a/e107_admin/includes/infopanel.php b/e107_admin/includes/infopanel.php index 79b345b9f..8ab5a3d3b 100755 --- a/e107_admin/includes/infopanel.php +++ b/e107_admin/includes/infopanel.php @@ -31,12 +31,13 @@ class adminstyle_infopanel { $coreUpdateCheck = ''; + $addonUpdateCheck = ''; if( e107::getSession()->get('core-update-status') !== true) { $coreUpdateCheck = " - $('#e-admin-core-update').html(''); + $('#e-admin-core-update').html(''); $.get('".e_ADMIN."admin.php?mode=core&type=update', function( data ) { var res = $.parseJSON(data); @@ -63,7 +64,13 @@ class adminstyle_infopanel } + if( e107::getSession()->get('addons-update-checked') !== true) + { + $addonUpdateCheck = " + $('#e-admin-addons-update').load('".e_ADMIN."admin.php?mode=addons&type=update'); + "; + } @@ -74,6 +81,7 @@ class adminstyle_infopanel $('#e-adminfeed-theme').load('".e_ADMIN."admin.php?mode=addons&type=theme'); ".$coreUpdateCheck." + ".$addonUpdateCheck." }); "; diff --git a/e107_core/shortcodes/batch/admin_shortcodes.php b/e107_core/shortcodes/batch/admin_shortcodes.php index 5b6669e2e..8cd9de348 100644 --- a/e107_core/shortcodes/batch/admin_shortcodes.php +++ b/e107_core/shortcodes/batch/admin_shortcodes.php @@ -1393,6 +1393,17 @@ Inverse 10 10 return null; } + $res = e107::getSession()->get('addons-update-status'); + + if($res !== null) + { + return $res; + } + + return "
"; + +/* + e107::getDb()->db_mark_time("sc_admin_addon_updates() // start"); $themes = $this->getUpdateable('theme'); @@ -1413,13 +1424,16 @@ Inverse 10 10 e107::getDb()->db_mark_time("sc_admin_addon_updates() // end"); - return $ns->tablerender($tp->toGlyph('fa-arrow-circle-o-down').LAN_UPDATE_AVAILABLE,$text,'default',true); + + + + return $ns->tablerender($tp->toGlyph('fa-arrow-circle-o-down').LAN_UPDATE_AVAILABLE,$text,'default',true);*/ } - private function getUpdateable($type) + public function getUpdateable($type) { if(empty($type)) @@ -1463,7 +1477,7 @@ Inverse 10 10 - private function renderAddonUpdate($list) + public function renderAddonUpdate($list) { if(empty($list)) diff --git a/e107_languages/English/admin/lan_admin.php b/e107_languages/English/admin/lan_admin.php index 3ba153244..60bad7ed6 100644 --- a/e107_languages/English/admin/lan_admin.php +++ b/e107_languages/English/admin/lan_admin.php @@ -542,4 +542,5 @@ define("LAN_ERROR_CONNECTION","Unable to connect for updates. Please check firew define("LAN_UI_X_CANT_EQUAL_Y", "[x] cannot be the same as [y]"); define("LAN_UI_VIEW_GRID_LABEL", "Grid view"); define("LAN_UI_VIEW_LIST_LABEL", "List view"); +define("LAN_CHECKING_FOR_UPDATES", "Checking for updates");