summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2010-03-17 08:55:16 -0700
committerBrion Vibber <brion@pobox.com>2010-03-17 08:55:16 -0700
commitb9fc4c24b44ba8a83448f3ea8e0698c689d74d19 (patch)
tree69e68638340693f5dbe0e8a05d1dd8328193b90e /lib
parent88f66131a1b11de81d1aece68683ef3396ccf98b (diff)
Pulling the stub plugin panel back out; we'll flesh it out more for 1.0.x and see if we can make it easier to disable through the config file for now.
Revert "Stub plugins administration panel, allows for disabling/re-enabling plugins from the default plugins list." This reverts commit d9a9fd3779c592e3f4e0a8aea8e385ee2183c0b3.
Diffstat (limited to 'lib')
-rw-r--r--lib/adminpanelaction.php8
-rw-r--r--lib/default.php3
-rw-r--r--lib/plugindisableform.php93
-rw-r--r--lib/pluginenableform.php114
-rw-r--r--lib/pluginlist.php213
-rw-r--r--lib/router.php7
-rw-r--r--lib/statusnet.php5
7 files changed, 1 insertions, 442 deletions
diff --git a/lib/adminpanelaction.php b/lib/adminpanelaction.php
index d87981b6a..a927e2333 100644
--- a/lib/adminpanelaction.php
+++ b/lib/adminpanelaction.php
@@ -407,14 +407,6 @@ class AdminPanelNav extends Widget
$menu_title, $action_name == 'snapshotadminpanel', 'nav_snapshot_admin_panel');
}
- if (AdminPanelAction::canAdmin('plugins')) {
- // TRANS: Menu item title/tooltip
- $menu_title = _('Plugins configuration');
- // TRANS: Menu item for site administration
- $this->out->menuItem(common_local_url('pluginsadminpanel'), _('Plugins'),
- $menu_title, $action_name == 'pluginsadminpanel', 'nav_design_admin_panel');
- }
-
Event::handle('EndAdminPanelNav', array($this));
}
$this->action->elementEnd('ul');
diff --git a/lib/default.php b/lib/default.php
index eb0cb0b64..10f3f1a97 100644
--- a/lib/default.php
+++ b/lib/default.php
@@ -285,9 +285,8 @@ $default =
'RSSCloud' => null,
'OpenID' => null),
),
- 'pluginlist' => array(),
'admin' =>
- array('panels' => array('design', 'site', 'user', 'paths', 'access', 'sessions', 'sitenotice', 'plugins')),
+ array('panels' => array('design', 'site', 'user', 'paths', 'access', 'sessions', 'sitenotice')),
'singleuser' =>
array('enabled' => false,
'nickname' => null),
diff --git a/lib/plugindisableform.php b/lib/plugindisableform.php
deleted file mode 100644
index 3cbabdb2c..000000000
--- a/lib/plugindisableform.php
+++ /dev/null
@@ -1,93 +0,0 @@
-<?php
-/**
- * StatusNet, the distributed open-source microblogging tool
- *
- * Form for enabling/disabling plugins
- *
- * PHP version 5
- *
- * LICENCE: This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- * @category Form
- * @package StatusNet
- * @copyright 2010 StatusNet, Inc.
- * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link http://status.net/
- */
-
-if (!defined('STATUSNET') && !defined('LACONICA')) {
- exit(1);
-}
-
-/**
- * Form for joining a group
- *
- * @category Form
- * @package StatusNet
- * @author Brion Vibber <brion@status.net>
- * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link http://status.net/
- *
- * @see PluginEnableForm
- */
-
-class PluginDisableForm extends PluginEnableForm
-{
- /**
- * ID of the form
- *
- * @return string ID of the form
- */
-
- function id()
- {
- return 'plugin-disable-' . $this->plugin;
- }
-
- /**
- * class of the form
- *
- * @return string of the form class
- */
-
- function formClass()
- {
- return 'form_plugin_disable';
- }
-
- /**
- * Action of the form
- *
- * @return string URL of the action
- */
-
- function action()
- {
- return common_local_url('plugindisable',
- array('plugin' => $this->plugin));
- }
-
- /**
- * Action elements
- *
- * @return void
- */
-
- function formActions()
- {
- // TRANS: Plugin admin panel controls
- $this->out->submit('submit', _m('plugin', 'Disable'));
- }
-
-}
diff --git a/lib/pluginenableform.php b/lib/pluginenableform.php
deleted file mode 100644
index 8683ffd0b..000000000
--- a/lib/pluginenableform.php
+++ /dev/null
@@ -1,114 +0,0 @@
-<?php
-/**
- * StatusNet, the distributed open-source microblogging tool
- *
- * Form for enabling/disabling plugins
- *
- * PHP version 5
- *
- * LICENCE: This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- * @category Form
- * @package StatusNet
- * @copyright 2010 StatusNet, Inc.
- * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link http://status.net/
- */
-
-if (!defined('STATUSNET') && !defined('LACONICA')) {
- exit(1);
-}
-
-require_once INSTALLDIR.'/lib/form.php';
-
-/**
- * Form for joining a group
- *
- * @category Form
- * @package StatusNet
- * @author Brion Vibber <brion@status.net>
- * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link http://status.net/
- *
- * @see PluginDisableForm
- */
-
-class PluginEnableForm extends Form
-{
- /**
- * Plugin to enable/disable
- */
-
- var $plugin = null;
-
- /**
- * Constructor
- *
- * @param HTMLOutputter $out output channel
- * @param string $plugin plugin to enable/disable
- */
-
- function __construct($out=null, $plugin=null)
- {
- parent::__construct($out);
-
- $this->plugin = $plugin;
- }
-
- /**
- * ID of the form
- *
- * @return string ID of the form
- */
-
- function id()
- {
- return 'plugin-enable-' . $this->plugin;
- }
-
- /**
- * class of the form
- *
- * @return string of the form class
- */
-
- function formClass()
- {
- return 'form_plugin_enable';
- }
-
- /**
- * Action of the form
- *
- * @return string URL of the action
- */
-
- function action()
- {
- return common_local_url('pluginenable',
- array('plugin' => $this->plugin));
- }
-
- /**
- * Action elements
- *
- * @return void
- */
-
- function formActions()
- {
- // TRANS: Plugin admin panel controls
- $this->out->submit('submit', _m('plugin', 'Enable'));
- }
-}
diff --git a/lib/pluginlist.php b/lib/pluginlist.php
deleted file mode 100644
index 07a17ba39..000000000
--- a/lib/pluginlist.php
+++ /dev/null
@@ -1,213 +0,0 @@
-<?php
-/**
- * StatusNet, the distributed open-source microblogging tool
- *
- * Plugins administration panel
- *
- * PHP version 5
- *
- * LICENCE: This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- * @category Settings
- * @package StatusNet
- * @author Brion Vibber <brion@status.net>
- * @copyright 2010 StatusNet, Inc.
- * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link http://status.net/
- */
-
-if (!defined('STATUSNET')) {
- exit(1);
-}
-
-require INSTALLDIR . "/lib/pluginenableform.php";
-require INSTALLDIR . "/lib/plugindisableform.php";
-
-/**
- * Plugin list
- *
- * @category Admin
- * @package StatusNet
- * @author Brion Vibber <brion@status.net>
- * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link http://status.net/
- */
-
-class PluginList extends Widget
-{
- var $plugins = array();
-
- function __construct($plugins, $out)
- {
- parent::__construct($out);
- $this->plugins = $plugins;
- }
-
- function show()
- {
- $this->startList();
- $this->showPlugins();
- $this->endList();
- }
-
- function startList()
- {
- $this->out->elementStart('table', 'plugin_list');
- }
-
- function endList()
- {
- $this->out->elementEnd('table');
- }
-
- function showPlugins()
- {
- foreach ($this->plugins as $plugin) {
- $pli = $this->newListItem($plugin);
- $pli->show();
- }
- }
-
- function newListItem($plugin)
- {
- return new PluginListItem($plugin, $this->out);
- }
-}
-
-class PluginListItem extends Widget
-{
- /** Current plugin. */
- var $plugin = null;
-
- /** Local cache for plugin version info */
- protected static $versions = false;
-
- function __construct($plugin, $out)
- {
- parent::__construct($out);
- $this->plugin = $plugin;
- }
-
- function show()
- {
- $meta = $this->metaInfo();
-
- $this->out->elementStart('tr', array('id' => 'plugin-' . $this->plugin));
-
- // Name and controls
- $this->out->elementStart('td');
- $this->out->elementStart('div');
- if (!empty($meta['homepage'])) {
- $this->out->elementStart('a', array('href' => $meta['homepage']));
- }
- $this->out->text($this->plugin);
- if (!empty($meta['homepage'])) {
- $this->out->elementEnd('a');
- }
- $this->out->elementEnd('div');
-
- $form = $this->getControlForm();
- $form->show();
-
- $this->out->elementEnd('td');
-
- // Version and authors
- $this->out->elementStart('td');
- if (!empty($meta['version'])) {
- $this->out->elementStart('div');
- $this->out->text($meta['version']);
- $this->out->elementEnd('div');
- }
- if (!empty($meta['author'])) {
- $this->out->elementStart('div');
- $this->out->text($meta['author']);
- $this->out->elementEnd('div');
- }
- $this->out->elementEnd('td');
-
- // Description
- $this->out->elementStart('td');
- if (!empty($meta['rawdescription'])) {
- $this->out->raw($meta['rawdescription']);
- }
- $this->out->elementEnd('td');
-
- $this->out->elementEnd('tr');
- }
-
- /**
- * Pull up the appropriate control form for this plugin, depending
- * on its current state.
- *
- * @return Form
- */
- protected function getControlForm()
- {
- $key = 'disable-' . $this->plugin;
- if (common_config('plugins', $key)) {
- return new PluginEnableForm($this->out, $this->plugin);
- } else {
- return new PluginDisableForm($this->out, $this->plugin);
- }
- }
-
- /**
- * Grab metadata about this plugin...
- * Warning: horribly inefficient and may explode!
- * Doesn't work for disabled plugins either.
- *
- * @fixme pull structured data from plugin source
- */
- function metaInfo()
- {
- $versions = self::getPluginVersions();
- $found = false;
-
- foreach ($versions as $info) {
- // hack for URL shorteners... "LilUrl (ur1.ca)" etc
- list($name, ) = explode(' ', $info['name']);
-
- if ($name == $this->plugin) {
- if ($found) {
- // hack for URL shorteners...
- $found['rawdescription'] .= "<br />\n" . $info['rawdescription'];
- } else {
- $found = $info;
- }
- }
- }
-
- if ($found) {
- return $found;
- } else {
- return array('name' => $this->plugin,
- 'rawdescription' => _m('plugin-description',
- '(Plugin descriptions unavailable when disabled.)'));
- }
- }
-
- /**
- * Lazy-load the set of active plugin version info
- * @return array
- */
- protected static function getPluginVersions()
- {
- if (!is_array(self::$versions)) {
- $versions = array();
- Event::handle('PluginVersion', array(&$versions));
- self::$versions = $versions;
- }
- return self::$versions;
- }
-}
diff --git a/lib/router.php b/lib/router.php
index 3d1c0e290..706120e0b 100644
--- a/lib/router.php
+++ b/lib/router.php
@@ -652,13 +652,6 @@ class Router
$m->connect('admin/sessions', array('action' => 'sessionsadminpanel'));
$m->connect('admin/sitenotice', array('action' => 'sitenoticeadminpanel'));
$m->connect('admin/snapshot', array('action' => 'snapshotadminpanel'));
- $m->connect('admin/plugins', array('action' => 'pluginsadminpanel'));
- $m->connect('admin/plugins/enable/:plugin',
- array('action' => 'pluginenable'),
- array('plugin' => '[A-Za-z0-9_]+'));
- $m->connect('admin/plugins/disable/:plugin',
- array('action' => 'plugindisable'),
- array('plugin' => '[A-Za-z0-9_]+'));
$m->connect('getfile/:filename',
array('action' => 'getfile'),
diff --git a/lib/statusnet.php b/lib/statusnet.php
index fe93680b0..eba9ab9b8 100644
--- a/lib/statusnet.php
+++ b/lib/statusnet.php
@@ -163,11 +163,6 @@ class StatusNet
{
// Load default plugins
foreach (common_config('plugins', 'default') as $name => $params) {
- $key = 'disable-' . $name;
- if (common_config('plugins', $key)) {
- continue;
- }
-
if (is_null($params)) {
addPlugin($name);
} else if (is_array($params)) {