diff --git a/include/functions_plugins_admin.inc.php b/include/functions_plugins_admin.inc.php
index 4d62520a..ddb627f2 100644
--- a/include/functions_plugins_admin.inc.php
+++ b/include/functions_plugins_admin.inc.php
@@ -101,9 +101,7 @@ function show_plugins($event_only = false, $sidebars = null)
}
$data['serendipity_setFormToken'] = serendipity_setFormToken();
-
- // what is this for???
- $errors = array();
+ $data['serendipity_setFormTokenUrl'] = serendipity_setFormToken('url');
/* Block display the plugins per placement location. */
if ($event_only) {
@@ -112,9 +110,14 @@ function show_plugins($event_only = false, $sidebars = null)
$plugin_placements = $sidebars;
}
$data['plugin_placements'] = $plugin_placements;
- $ownership = array();
- $total = 0;
+ static $users = array();
+ if (empty($users)) {
+ $users = serendipity_fetchUsers('', 'hidden');
+ }
+ $data['users'] = $users;
+
+ $i = 0;
foreach ($plugin_placements as $plugin_placement) {
if (!$event_only && $plugin_placement == 'NONE') {
$is_invisible = true;
@@ -136,7 +139,7 @@ function show_plugins($event_only = false, $sidebars = null)
$sort_idx = 0;
foreach ($plugins as $plugin_data) {
- $total++;
+ $i++;
$plugin =& serendipity_plugin_api::load_plugin($plugin_data['name'], $plugin_data['authorid']);
$key = urlencode($plugin_data['name']);
$css_key = 's9ycid' . str_replace('%', '-', $key);
@@ -166,124 +169,46 @@ function show_plugins($event_only = false, $sidebars = null)
}
}
- if ($event_only) {
- $place = placement_box('serendipity[placement][' . $plugin_data['name'] . ']', $plugin_data['placement'], $is_plugin_editable, true, $opts);
- $event_only_uri = '&serendipity[event_plugin]=true';
- } else {
- $place = placement_box('serendipity[placement][' . $plugin_data['name'] . ']', $plugin_data['placement'], $is_plugin_editable, false, $opts);
- $event_only_uri = '';
+ if ($opts === null) {
+ $opts = array(
+ 'left' => LEFT,
+ 'right' => RIGHT,
+ 'hide' => HIDDEN
+ );
}
- /* Only display UP/DOWN links if there's somewhere for the plugin to go */
- if ($sort_idx == 0) {
- $moveup = ' ';
+ static $event_opts = array(
+ 'event' => PLUGIN_ACTIVE,
+ 'eventh' => PLUGIN_INACTIVE,
+ );
+
+ if ($is_event) {
+ $gopts =& $event_opts;
} else {
- $moveup = '';
+ $gopts =& $opts;
}
- if ($sort_idx == (count($plugins)-1)) {
- $movedown = ' ';
- } else {
- $movedown = ($moveup != '' ? ' ' : '') . '
';
- }
-
- ob_start();
- ownership($plugin_data['authorid'], $plugin_data['name'], $is_plugin_owner);
- $ownership = ob_get_contents();
- ob_end_clean();
-
- $data['placement'][$plugin_placement]['plugin_data'][$total]['sort_idx'] = $sort_idx;
- $data['placement'][$plugin_placement]['plugin_data'][$total]['css_key'] = $css_key;
- $data['placement'][$plugin_placement]['plugin_data'][$total]['is_plugin_editable'] = $is_plugin_editable;
- $data['placement'][$plugin_placement]['plugin_data'][$total]['name'] = $plugin_data['name'];
- $data['placement'][$plugin_placement]['plugin_data'][$total]['can_configure'] = $can_configure;
- $data['placement'][$plugin_placement]['plugin_data'][$total]['key'] = $key;
- $data['placement'][$plugin_placement]['plugin_data'][$total]['title'] = $title;
- $data['placement'][$plugin_placement]['plugin_data'][$total]['desc'] = $desc;
- $data['placement'][$plugin_placement]['plugin_data'][$total]['ownership'] = $ownership;
- $data['placement'][$plugin_placement]['plugin_data'][$total]['place'] = $place;
- $data['placement'][$plugin_placement]['plugin_data'][$total]['moveup'] = $moveup;
- $data['placement'][$plugin_placement]['plugin_data'][$total]['movedown'] = $movedown;
+ $data['placement'][$plugin_placement]['plugin_data'][$i]['sort_idx'] = $sort_idx;
+ $data['placement'][$plugin_placement]['plugin_data'][$i]['css_key'] = $css_key;
+ $data['placement'][$plugin_placement]['plugin_data'][$i]['is_plugin_editable'] = $is_plugin_editable;
+ $data['placement'][$plugin_placement]['plugin_data'][$i]['is_plugin_owner'] = $is_plugin_owner;
+ $data['placement'][$plugin_placement]['plugin_data'][$i]['name'] = $plugin_data['name'];
+ $data['placement'][$plugin_placement]['plugin_data'][$i]['authorid'] = $plugin_data['authorid'];
+ $data['placement'][$plugin_placement]['plugin_data'][$i]['can_configure'] = $can_configure;
+ $data['placement'][$plugin_placement]['plugin_data'][$i]['key'] = $key;
+ $data['placement'][$plugin_placement]['plugin_data'][$i]['title'] = $title;
+ $data['placement'][$plugin_placement]['plugin_data'][$i]['desc'] = $desc;
+ $data['placement'][$plugin_placement]['plugin_data'][$i]['placement'] = $plugin_data['placement'];
+ $data['placement'][$plugin_placement]['plugin_data'][$i]['gopts'] = $gopts;
$sort_idx++;
}
}
- $data['total'] = $total;
+ $data['total'] = $i;
echo serendipity_smarty_show('admin/show_plugins.fnc.tpl', $data);
}
-/**
- * Returns HTML code for the ownership column of the plugin listing
- *
- * Used by the function show_plugins()
- *
- * @access private
- * @see show_plugins()
- * @param int ID of the current user
- * @param string plugin name
- * @param boolean Toggle whether the plugin belongs to the current author
- * @return null
- */
-function ownership($authorid, $name, $is_plugin_owner = false) {
- global $serendipity;
-
- static $users = array();
- if (empty($users)) {
- $users = serendipity_fetchUsers('', 'hidden');
- }
- $data['authorid'] = $authorid;
- $data['users'] = $users;
- $data['is_plugin_owner'] = $is_plugin_owner;
- $data['name'] = $name;
- $data['show_ownership'] = true;
-
- echo serendipity_smarty_show('admin/show_ownership.fnc.tpl', $data);
-}
-
-/**
- * Show a placement box on where to move a sidebar plugin to
- *
- * @access private
- * @see show_plugins()
- * @param string plugin name
- * @param string current position of the plugin
- * @param boolean Toggle whether a plugin is editable (depends on authorid and permissions)
- * @param boolean Toggle whether a plugin is an event plugin
- * @return string HTML code for placement select box
- */
-function placement_box($name, $val, $is_plugin_editable = false, $is_event = false, $opts = null)
-{
- if ($opts === null) {
- $opts = array(
- 'left' => LEFT,
- 'right' => RIGHT,
- 'hide' => HIDDEN
- );
- }
-
- static $event_opts = array(
- 'event' => PLUGIN_ACTIVE,
- 'eventh' => PLUGIN_INACTIVE,
- );
-
- if ($is_event) {
- $gopts =& $event_opts;
- } else {
- $gopts =& $opts;
- }
-
- $x = "\n\n";
-}
-
/**
* Show the plugin configuration
*
@@ -307,10 +232,7 @@ function serendipity_plugin_config(&$plugin, &$bag, &$name, &$desc, &$config_nam
if (empty($config_names)) {
return false;
}
-
- if (!is_object($serendipity['smarty'])) {
- serendipity_smarty_init();
- }
+
$tfile = "/admin/plugin_config_item.tpl";
diff --git a/templates/2k11/admin/show_ownership.fnc.tpl b/templates/2k11/admin/show_ownership.fnc.tpl
deleted file mode 100644
index a53a9f18..00000000
--- a/templates/2k11/admin/show_ownership.fnc.tpl
+++ /dev/null
@@ -1,20 +0,0 @@
-{* functions_plugins_admin.inc.php::function ownership() *}
-
-{if $show_ownership}
- {if $is_plugin_owner}
-
- {else}
- {(empty($realname)) ? $CONST.ALL_AUTHORS : $realname}
- {/if}
-{/if}
diff --git a/templates/2k11/admin/show_plugins.fnc.tpl b/templates/2k11/admin/show_plugins.fnc.tpl
index 36ed6287..83e79eac 100644
--- a/templates/2k11/admin/show_plugins.fnc.tpl
+++ b/templates/2k11/admin/show_plugins.fnc.tpl
@@ -46,10 +46,53 @@