function loadActiveAddons() { $suiteDetails = unserialize(getOption('suiteDetails')); if (empty($suiteDetails) and !is_array($suiteDetails)) { $addonSuiteMiniActivity = ''; } else { $addonSuiteMiniActivity = $suiteDetails['addonSuiteMiniActivity']; } if (panelRequestManager::checkIsAddonSuiteMiniLimitExceeded('addonSuiteLimitExceededIllegally') && panelRequestManager::getAddonSuiteMiniActivity() == 'installed') { Reg::set('addonSuiteLimitExceededIllegally', 1); Reg::set('addonSuiteLimitExceededAttemp', 1); } else { Reg::set('addonSuiteLimitExceededIllegally', 0); Reg::set('addonSuiteLimitExceededAttemp', 0); } $activeAddons = DB::getArray("?:addons", "slug, status, addon", "1"); if (userStatus() != 'admin') { userAddonsAccess($activeAddons); } $installedAddons = @unserialize(getOption('updateAddonsAvailable')); $newAddons = getNewAddonsAvailable(); $purchasedAddons = array(); if (!empty($installedAddons)) { $purchasedAddons = array_merge($purchasedAddons, array_keys($installedAddons)); } if (!empty($newAddons)) { $purchasedAddons = array_merge($purchasedAddons, array_keys($newAddons)); } Reg::set('purchasedAddons', $purchasedAddons); $uninstallAddons = $uninstall = $activeLoadedAddonsSlugs = $allPurchasedAddonsNameAndSlug = array(); foreach ($activeAddons as $key => $addon) { if (!in_array($addon['slug'], $purchasedAddons)) { $uninstall[] = $addon['slug']; $uninstallAddons[]['slug'] = $addon['slug']; } if ($addon['status'] == 'active') { $allPurchasedAddonsNameAndSlug[$addon['slug']] = $addon['addon']; if (Reg::get('addonSuiteLimitExceededIllegally') && Reg::get('addonSuiteLimitExceededAttemp')) { $activeLoadedAddonsSlugs[$addon['slug']] = array('slug' => $addon['slug']); } else { //if(file_exists(APP_ROOT.'/addons/'.$addon['slug'].'/addon.'.$addon['slug'].'.php')){ @(include_once APP_ROOT . '/addons/' . $addon['slug'] . '/addon.' . $addon['slug'] . '.php'); if (method_exists('addon' . ucfirst($addon['slug']), 'init')) { call_user_func(array('addon' . ucfirst($addon['slug']), 'init')); $activeLoadedAddonsSlugs[$addon['slug']] = array('slug' => $addon['slug']); } else { //file not found deactivate the addon unset($activeAddons[$key]); //DB::delete("?:addons", "slug='".$addon['slug']."'"); //addNotification($type='E', $title='Addon file missing', $message='The "'.$addon['addon'].'" addon has been removed, since a file is missing.', $state='U', $callbackOnClose='', $callbackReference=''); } } } } if (!empty($uninstallAddons) && $addonSuiteMiniActivity != 'cancelled') { addNotification($type = 'E', $title = 'Addon error', $message = 'Addon(s) are not legitimate.', $state = 'U', $callbackOnClose = '', $callbackReference = ''); uninstallAddons($uninstallAddons); } regSetInstalledAddonsDetails($activeLoadedAddonsSlugs); Reg::set('allPurchasedAddonsNameAndSlug', $allPurchasedAddonsNameAndSlug); //Reg::set('activeAddons', $activeLoadedAddonsSlugs); }
public function getAddonSuiteMiniActivity() { $suiteDetails = unserialize(getOption('suiteDetails')); if (empty($suiteDetails) and !is_array($suiteDetails)) { return ''; } $addonSuiteMiniActivity = $suiteDetails['addonSuiteMiniActivity']; $cancelMessageFlag = $suiteDetails['cancelMessageFlag']; if ($addonSuiteMiniActivity == 'cancelled' && $cancelMessageFlag != 'shown') { uninstallAddons($suiteDetails['addonSuiteMiniAddons'], 0); } return $addonSuiteMiniActivity; }