blog->settings->dcAdvancedCleaner->dcAdvancedCleaner_behavior_active) { return null; } $uninstaller = new dcUninstaller($core); $uninstaller->loadModule($module['root']); $m_callbacks = $uninstaller->getDirectCallbacks($module['id']); $m_actions = $uninstaller->getDirectActions($module['id']); foreach($m_callbacks as $k => $callback) { if (!isset($callback['func']) || !is_callable($callback['func'])) { continue; } call_user_func($callback['func'], $module); $done = true; } foreach($m_actions as $type => $actions) { foreach($actions as $v) { $uninstaller->execute($type, $v['action'], $v['ns']); $done = true; } } if ($done) { http::redirect($redir); } } public static function dcAdvancedCleanerAdminTabs($core) { self::modulesTabs($core, DC_PLUGINS_ROOT, $core->adminurl->get('admin.plugin.dcAdvancedCleaner', ['tab' => 'uninstaller'])); } public static function pluginsToolsTabs($core) { self::modulesTabs($core, DC_PLUGINS_ROOT, $core->adminurl->get('admin.plugins', ['tab' => 'uninstaller'])); } public static function modulesTabs($core, $path, $redir, $title = '') { if (!$core->blog->settings->dcAdvancedCleaner->dcAdvancedCleaner_behavior_active) { return null; } $err = ''; $title = empty($title) ? __('Advanced uninstall') : $title; $uninstaller = new dcUninstaller($core); $uninstaller->loadModules($path); $modules = $uninstaller->getModules(); $props = $uninstaller->getAllowedProperties(); // Execute if (isset($_POST['action']) && $_POST['action'] == 'uninstall' && (!empty($_POST['extras']) || !empty($_POST['actions'])) ) { try { // Extras if (!empty($_POST['extras'])) { foreach($_POST['extras'] as $module_id => $extras) { foreach($extras as $k => $sentence) { $extra = @unserialize(@base64_decode($sentence)); if (!$extra || !is_callable($extra)) { continue; } call_user_func($extra, $modul_id); } } } // Actions if (!empty($_POST['actions'])) { foreach($_POST['actions'] as $module_id => $actions) { foreach($actions as $k => $sentence) { $action = @unserialize(@base64_decode($sentence)); if (!$action || !isset($action['type']) || !isset($action['action']) || !isset($action['ns']) ) { continue; } $uninstaller->execute($action['type'], $action['action'], $action['ns']); } } } dcPage::addSuccessNotice(__('Action successfuly excecuted')); http::redirect($redir); } catch(Exception $e) { $err = $e->getMessage(); } } echo '

' . __($title) . '

'; if($err) { echo '

' . $err . '

'; } if(!count($modules)) { echo '

' . __('There is no module with uninstall features') . '

'; return null; } echo '

' . __('List of modules with advanced uninstall features') . '

' . '
' . '' . ''; foreach($props as $pro_id => $prop) { echo ''; } echo '' . ''; $i = 0; foreach($modules as $module_id => $module) { echo '' . '' . ''; $actions = $uninstaller->getUserActions($module_id); foreach($props as $prop_id => $prop) { echo ''; continue; } $j = 0; foreach($actions[$prop_id] as $action_id => $action) { if (!isset($props[$prop_id][$action['action']])) { continue; } $ret = base64_encode(serialize([ 'type' => $prop_id, 'action'=> $action['action'], 'ns'=> $action['ns'] ])); echo '
'; $j++; } echo ''; } echo ''; } echo '
' . __('module') . '' . __($pro_id) . '' . __('other') . '
' . $module_id . '' . $module['version'] . ''; if (!isset($actions[$prop_id])) { echo '--'; $callbacks = $uninstaller->getUserCallbacks($module_id); if (empty($callbacks)) { echo '--'; } $k = 0; foreach($callbacks as $callback_id => $callback) { $ret = base64_encode(serialize($callback['func'])); echo '
'; } echo '
' . '

' . $core->formNonce() . form::hidden(['redir'], $redir) . form::hidden(['action'], 'uninstall') . ' ' . '

' . '
'; echo ''; } }