3 namespace Friendica\Module\Admin\Addons;
5 use Friendica\Core\Addon;
6 use Friendica\Core\L10n;
7 use Friendica\Core\Renderer;
8 use Friendica\Module\BaseAdminModule;
10 class Index extends BaseAdminModule
12 public static function content($parameters)
14 parent::content($parameters);
18 // reload active themes
19 if (!empty($_GET['action'])) {
20 parent::checkFormSecurityTokenRedirectOnError('/admin/addons', 'admin_addons', 't');
22 switch ($_GET['action']) {
25 info('Addons reloaded');
29 $addon = $_GET['addon'] ?? '';
30 if (Addon::isEnabled($addon)) {
31 Addon::uninstall($addon);
32 info(L10n::t('Addon %s disabled.', $addon));
33 } elseif (Addon::install($addon)) {
34 info(L10n::t('Addon %s enabled.', $addon));
36 info(L10n::t('Addon %s failed to install.', $addon));
43 $a->internalRedirect('admin/addons');
46 $addons = Addon::getAvailableList();
48 $t = Renderer::getMarkupTemplate('admin/addons/index.tpl');
49 return Renderer::replaceMacros($t, [
50 '$title' => L10n::t('Administration'),
51 '$page' => L10n::t('Addons'),
52 '$submit' => L10n::t('Save Settings'),
53 '$reload' => L10n::t('Reload active addons'),
54 '$baseurl' => $a->getBaseURL(true),
55 '$function' => 'addons',
57 '$pcount' => count($addons),
58 '$noplugshint' => L10n::t('There are currently no addons available on your node. You can find the official addon repository at %1$s and might find other interesting addons in the open addon registry at %2$s', 'https://github.com/friendica/friendica-addons', 'http://addons.friendi.ca'),
59 '$form_security_token' => parent::getFormSecurityToken('admin_addons'),