pluginsadminpanel.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. <?php
  2. // This file is part of GNU social - https://www.gnu.org/software/social
  3. //
  4. // GNU social is free software: you can redistribute it and/or modify
  5. // it under the terms of the GNU Affero General Public License as published by
  6. // the Free Software Foundation, either version 3 of the License, or
  7. // (at your option) any later version.
  8. //
  9. // GNU social is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. // GNU Affero General Public License for more details.
  13. //
  14. // You should have received a copy of the GNU Affero General Public License
  15. // along with GNU social. If not, see <http://www.gnu.org/licenses/>.
  16. defined('STATUSNET') || die();
  17. /**
  18. * Plugins settings
  19. *
  20. * @category Admin
  21. * @package GNUsocial
  22. * @author Brion Vibber <brion@status.net>
  23. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  24. * @link http://status.net/
  25. */
  26. class PluginsadminpanelAction extends AdminPanelAction
  27. {
  28. /**
  29. * Returns the page title
  30. *
  31. * @return string page title
  32. * @throws Exception
  33. */
  34. function title()
  35. {
  36. // TRANS: Tab and title for plugins admin panel.
  37. return _m('TITLE', 'Plugins');
  38. }
  39. /**
  40. * Instructions for using this form.
  41. *
  42. * @return string instructions
  43. */
  44. function getInstructions()
  45. {
  46. // TRANS: Instructions at top of plugin admin page.
  47. return _m('Additional plugins can be enabled and configured manually. ' .
  48. 'See the <a href="https://notabug.org/diogo/gnu-social/src/nightly/plugins/README.md">online plugin ' .
  49. 'documentation</a> for more details.');
  50. }
  51. /**
  52. * Show the plugins admin panel form
  53. *
  54. * @return void
  55. */
  56. function showForm()
  57. {
  58. $this->elementStart('form', [
  59. 'enctype' => 'multipart/form-data',
  60. 'method' => 'post',
  61. 'id' => 'form_install_plugin',
  62. 'class' => 'form_settings',
  63. 'action' =>
  64. common_local_url('plugininstall')
  65. ]);
  66. $this->elementStart('fieldset');
  67. // TRANS: Avatar upload page form legend.
  68. $this->element('legend', null, _('Install Plugin'));
  69. $this->hidden('token', common_session_token());
  70. $this->elementStart('ul', 'form_data');
  71. $this->elementStart('li', ['id' => 'settings_attach']);
  72. $this->element('input', [
  73. 'name' => 'MAX_FILE_SIZE',
  74. 'type' => 'hidden',
  75. 'id' => 'MAX_FILE_SIZE',
  76. 'value' => common_config('attachments', 'file_quota')
  77. ]);
  78. $this->element('input', [
  79. 'name' => 'pluginfile',
  80. 'type' => 'file',
  81. 'id' => 'pluginfile'
  82. ]);
  83. $this->elementEnd('li');
  84. $this->elementEnd('ul');
  85. $this->elementStart('ul', 'form_actions');
  86. $this->elementStart('li');
  87. // TRANS: Button on avatar upload page to upload an avatar.
  88. $this->submit('upload', _m('BUTTON', 'Upload'));
  89. $this->elementEnd('li');
  90. $this->elementEnd('ul');
  91. $this->elementEnd('fieldset');
  92. $this->elementEnd('form');
  93. $this->elementStart('fieldset', ['id' => 'settings_plugins_default']);
  94. // TRANS: Admin form section header
  95. $this->element('legend', null, _m('Available Plugins'));
  96. $this->showPlugins();
  97. $this->elementEnd('fieldset');
  98. }
  99. protected function showPlugins()
  100. {
  101. $list = new PluginList($this);
  102. $list->show();
  103. }
  104. function saveSettings()
  105. {
  106. parent::saveSettings();
  107. }
  108. }