-<?php\r
-\r
-namespace Friendica\Module\Admin\Addons;\r
-\r
-use Friendica\Content\Text\Markdown;\r
-use Friendica\Core\Addon;\r
-use Friendica\Core\Config;\r
-use Friendica\Core\L10n;\r
-use Friendica\Core\Renderer;\r
-use Friendica\Core\System;\r
-use Friendica\Database\DBA;\r
-use Friendica\Module\BaseAdminModule;\r
-\r
-class Index extends BaseAdminModule\r
-{\r
- public static function content()\r
- {\r
- parent::content();\r
-\r
- $a = self::getApp();\r
-\r
- // reload active themes\r
- if (!empty($_GET['action'])) {\r
- parent::checkFormSecurityTokenRedirectOnError('/admin/addons', 'admin_addons', 't');\r
-\r
- switch ($_GET['action']) {\r
- case 'reload':\r
- Addon::reload();\r
- info('Addons reloaded');\r
- break;\r
-\r
- case 'toggle' :\r
- $addon = defaults($_GET, 'addon', '');\r
- if (Addon::isEnabled($addon)) {\r
- Addon::uninstall($addon);\r
- info(L10n::t('Addon %s disabled.', $addon));\r
- } elseif (Addon::install($addon)) {\r
- info(L10n::t('Addon %s enabled.', $addon));\r
- } else {\r
- info(L10n::t('Addon %s failed to install.', $addon));\r
- }\r
-\r
- break;\r
-\r
- }\r
-\r
- $a->internalRedirect('admin/addons');\r
- }\r
-\r
- $addons_admin = [];\r
- $addonsAdminStmt = DBA::select('addon', ['name'], ['plugin_admin' => 1], ['order' => ['name']]);\r
- foreach (DBA::toArray($addonsAdminStmt) as $addon) {\r
- $addons_admin[] = $addon['name'];\r
- }\r
-\r
- $addons = Addon::getAvailableList();\r
-\r
- $t = Renderer::getMarkupTemplate('admin/addons/index.tpl');\r
- return Renderer::replaceMacros($t, [\r
- '$title' => L10n::t('Administration'),\r
- '$page' => L10n::t('Addons'),\r
- '$submit' => L10n::t('Save Settings'),\r
- '$reload' => L10n::t('Reload active addons'),\r
- '$baseurl' => System::baseUrl(true),\r
- '$function' => 'addons',\r
- '$addons' => $addons,\r
- '$pcount' => count($addons),\r
- '$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'),\r
- '$form_security_token' => parent::getFormSecurityToken('admin_addons'),\r
- ]);\r
- }\r
-}
\ No newline at end of file
+<?php
+
+namespace Friendica\Module\Admin\Addons;
+
+use Friendica\Core\Addon;
+use Friendica\Core\L10n;
+use Friendica\Core\Renderer;
+use Friendica\Module\BaseAdminModule;
+
+class Index extends BaseAdminModule
+{
+ public static function content()
+ {
+ parent::content();
+
+ $a = self::getApp();
+
+ // reload active themes
+ if (!empty($_GET['action'])) {
+ parent::checkFormSecurityTokenRedirectOnError('/admin/addons', 'admin_addons', 't');
+
+ switch ($_GET['action']) {
+ case 'reload':
+ Addon::reload();
+ info('Addons reloaded');
+ break;
+
+ case 'toggle' :
+ $addon = defaults($_GET, 'addon', '');
+ if (Addon::isEnabled($addon)) {
+ Addon::uninstall($addon);
+ info(L10n::t('Addon %s disabled.', $addon));
+ } elseif (Addon::install($addon)) {
+ info(L10n::t('Addon %s enabled.', $addon));
+ } else {
+ info(L10n::t('Addon %s failed to install.', $addon));
+ }
+
+ break;
+
+ }
+
+ $a->internalRedirect('admin/addons');
+ }
+
+ $addons = Addon::getAvailableList();
+
+ $t = Renderer::getMarkupTemplate('admin/addons/index.tpl');
+ return Renderer::replaceMacros($t, [
+ '$title' => L10n::t('Administration'),
+ '$page' => L10n::t('Addons'),
+ '$submit' => L10n::t('Save Settings'),
+ '$reload' => L10n::t('Reload active addons'),
+ '$baseurl' => $a->getBaseURL(true),
+ '$function' => 'addons',
+ '$addons' => $addons,
+ '$pcount' => count($addons),
+ '$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'),
+ '$form_security_token' => parent::getFormSecurityToken('admin_addons'),
+ ]);
+ }
+}