/** * Call functions based on user actions in Plugin Management */ public function adminPlugins($h) { $pfolder = $h->cage->get->testAlnumLines('plugin'); $h->plugin->folder = $pfolder; // assign this plugin to Hotaru $action = $h->cage->get->testAlnumLines('action'); $order = $h->cage->get->testAlnumLines('order'); $ajax = $h->cage->get->testAlnumLines('ajax') ? true : false; $clearCache = $ajax ? false : true; $plugman = new PluginManagement(); switch ($action) { case "orderAjax": $sort = $h->cage->post->testAlnumLines('sort'); $plugman->pluginReorder($h, $sort); //echo 1; die; case "activate": $plugman->activateDeactivate($h, 1, $clearCache); if ($ajax) { echo json_encode(1); die; } break; case "reactivateAjax": $plugman->uninstall($h, 0, $clearCache); $result2 = $plugman->install($h, 0, $clearCache); $result = $result2 ? 1 : 0; echo json_encode($result); die; case "activateAjax": $result = $plugman->activateDeactivate($h, 1, true); echo json_encode($result); die; case "deactivate": $plugman->activateDeactivate($h, 0); break; case "deactivateAjax": $result = $plugman->activateDeactivate($h, 0, true); echo json_encode($result); die; case "activate_all": $plugman->activateDeactivateAll($h, 1); break; case "deactivate_all": $plugman->activateDeactivateAll($h, 0); break; case "uninstall_all": $plugman->uninstallAll($h); break; case "install": $plugman->install($h, 0, $clearCache); if ($ajax) { echo json_encode(1); die; } break; case "uninstall": $plugman->uninstall($h); break; case "orderup": $plugman->pluginOrder($h, $order, "up"); break; case "orderdown": $plugman->pluginOrder($h, $order, "down"); break; case "update": $plugman->activateDeactivate($h, 0); $plugman->update($h); $plugman->activateDeactivate($h, 1); break; case "version_check": $plugman->versionCheck($h); break; default: // nothing to do here... break; } $plugman->refreshPluginDetails($h); // get and sort all the plugins ready for display: $allplugins = $plugman->getPlugins($h); // get plugins $installed_plugins = array_filter($allplugins, array($plugman, 'getInstalledPlugins')); $h->vars['installed_plugins'] = sksort($installed_plugins, "order", "int", true); $uninstalled_plugins = array_filter($allplugins, array($plugman, 'getUninstalledPlugins')); $h->vars['uninstalled_plugins'] = sksort($uninstalled_plugins, 'name', 'char', true); return true; }
/** * Call functions based on user actions in Plugin Management */ public function adminPlugins($h) { $pfolder = $h->cage->get->testAlnumLines('plugin'); $h->plugin->folder = $pfolder; // assign this plugin to Hotaru $action = $h->cage->get->testAlnumLines('action'); $order = $h->cage->get->testAlnumLines('order'); require_once LIBS . 'PluginManagement.php'; $plugman = new PluginManagement(); switch ($action) { case "activate": $plugman->activateDeactivate($h, 1); break; case "deactivate": $plugman->activateDeactivate($h, 0); break; case "activate_all": $plugman->activateDeactivateAll($h, 1); break; case "deactivate_all": $plugman->activateDeactivateAll($h, 0); break; case "uninstall_all": $plugman->uninstallAll($h); break; case "install": $plugman->install($h); break; case "uninstall": $plugman->uninstall($h); break; case "orderup": $plugman->pluginOrder($h, $order, "up"); break; case "orderdown": $plugman->pluginOrder($h, $order, "down"); break; default: // nothing to do here... break; } // get and sort all the plugins ready for display: $allplugins = $plugman->getPlugins($h); // get plugins $installed_plugins = array_filter($allplugins, array($plugman, 'getInstalledPlugins')); $h->vars['installed_plugins'] = sksort($installed_plugins, "order", "int", true); $uninstalled_plugins = array_filter($allplugins, array($plugman, 'getUninstalledPlugins')); $h->vars['uninstalled_plugins'] = sksort($uninstalled_plugins, 'name', 'char', true); return true; }