. * --------------------------------------------------------------------- */ global $PLUGINS_EXCLUDED; // follow download progress of a plugin with a minimal loading of files // So we get a ajax answer in 5ms instead 100ms if (isset($_REQUEST["action"]) && $_REQUEST["action"] == "get_dl_progress") { if (!defined('GLPI_ROOT')) { define('GLPI_ROOT', dirname(__DIR__)); } include_once GLPI_ROOT . '/inc/based_config.php'; Session::setPath(); Session::start(); echo $_SESSION['marketplace_dl_progress'][$_REQUEST['key']] ?? 0; exit; } if ($_REQUEST["action"] == "download_plugin" || $_REQUEST["action"] == "update_plugin") { // Do not load plugin that will be updated, to be able to load its new informations // by redefining its plugin_version_ function after files replacement. $PLUGINS_EXCLUDED = [$_REQUEST['key']]; } // get common marketplace action, load GLPI framework include ("../inc/includes.php"); Session::checkRight("config", UPDATE); use Glpi\Marketplace\Controller as MarketplaceController; use Glpi\Marketplace\View as MarketplaceView; if (isset($_REQUEST['key'])) { $marketplace_ctrl = new MarketplaceController($_REQUEST['key']); if ($_REQUEST["action"] == "download_plugin" || $_REQUEST["action"] == "update_plugin") { $marketplace_ctrl->downloadPlugin(); } if ($_REQUEST["action"] == "clean_plugin") { if ($marketplace_ctrl->cleanPlugin()) { echo "cleaned"; } } if ($_REQUEST["action"] == "install_plugin") { $marketplace_ctrl->installPlugin(); } if ($_REQUEST["action"] == "uninstall_plugin") { $marketplace_ctrl->uninstallPlugin(); } if ($_REQUEST["action"] == "enable_plugin") { $marketplace_ctrl->enablePlugin(); } if ($_REQUEST["action"] == "disable_plugin") { $marketplace_ctrl->disablePlugin(); } echo MarketplaceView::getButtons($_REQUEST['key']); } if ($_REQUEST["action"] == "refresh_plugin_list") { switch ($_REQUEST['tab']) { default: case 'discover': echo MarketplaceView::discover( $_REQUEST['force'] ?? false, true, $_REQUEST['tag'] ?? "", $_REQUEST['filter'] ?? "", $_REQUEST['page'] ?? 1, $_REQUEST['sort'] ?? "sort-alpha-asc" ); break; case 'installed': echo MarketplaceView::installed(true, true, $_REQUEST['filter'] ?? ""); break; } } if ($_REQUEST["action"] == "getPagination") { echo MarketplaceView::getPaginationHtml( $_REQUEST['page'] ?? 1, $_REQUEST['total'] ?? 1, true ); }