diff --git a/include/admin/plugins.inc.php b/include/admin/plugins.inc.php
index 2273cd4a..fef620c4 100644
--- a/include/admin/plugins.inc.php
+++ b/include/admin/plugins.inc.php
@@ -10,6 +10,8 @@ if (!serendipity_checkPermission('adminPlugins')) {
return;
}
+$data = array();
+
include_once S9Y_INCLUDE_PATH . 'include/plugin_api.inc.php';
include_once S9Y_INCLUDE_PATH . 'include/plugin_internal.inc.php';
include_once S9Y_INCLUDE_PATH . 'include/functions_entries_admin.inc.php';
@@ -63,7 +65,8 @@ if (isset($_GET['serendipity']['plugin_to_conf'])) {
if (!($plugin->protected === FALSE || $plugin->serendipity_owner == '0' || $plugin->serendipity_owner == $serendipity['authorid'] || serendipity_checkPermission('adminPluginsMaintainOthers'))) {
return;
}
-
+ $data['plugin_to_conf'] = true;
+
$bag = new serendipity_property_bag;
$plugin->introspect($bag);
@@ -120,78 +123,44 @@ if (isset($_GET['serendipity']['plugin_to_conf'])) {
$plugin->cleanup();
}
-?>
- 0 ) { ?>
-
-
; ?>)
- \n";
- echo "
\n";
- foreach($save_errors AS $save_error) {
- echo '- ' . $save_error . "
\n";
+ if ( isset($save_errors) && is_array($save_errors) && count($save_errors) > 0 ) {
+ $data['save_errors'] = $save_errors;
+ } elseif ( isset($_POST['SAVECONF'])) {
+ $data['saveconf'] = true;
+ $data['timestamp'] = serendipity_strftime('%H:%M:%S');
+ }
+ $data['formToken'] = serendipity_setFormToken();
+ $data['name'] = $name;
+ $data['class'] = get_class($plugin);
+ $data['desc'] = $desc;
+ $data['documentation'] = $documentation;
+ $data['plugin'] = $plugin;
+
+ if (@file_exists(dirname($plugin->pluginFile) . '/ChangeLog')) {
+ $data['changelog'] = true;
}
- echo "
\n";
- ?>
-
-
- ; ?>)
-
-
-
-
-
-
-
-
-
- $e_name) {
- echo ERROR . ': ' . $e_name . '
';
- }
+ $data['errorstack'] = $errorstack;
if ($serendipity['GET']['only_group'] == 'UPGRADE') {
serendipity_plugin_api::hook_event('backend_pluginlisting_header_upgrade', $pluggroups);
}
-?>
-
- $groupstack) {
- if (empty($pluggroup)) {
- ?>
-
-
-
-
-
- |
-
-
-
- | Plugin |
- Action |
-
-' . PLUGIN_DOCUMENTATION . '';
- }
-
- if (!empty($plug['local_documentation'])) {
- $pluginInfo[] = '' . PLUGIN_DOCUMENTATION_LOCAL . '';
- }
-
- if (!empty($plug['changelog'])) {
- $pluginInfo[] = '' . PLUGIN_DOCUMENTATION_CHANGELOG . '';
- }
-
- if (!empty($plug['upgrade_version']) && $plug['upgrade_version'] != $plug['version']) {
- $pluginInfo[] = sprintf(UPGRADE_TO_VERSION, $plug['upgrade_version']);
- }
-
- if (!empty($plug['pluginlocation']) && $plug['pluginlocation'] != 'local') {
- $pluginInfo[] = '(' . htmlspecialchars($plug['pluginlocation']) . ')';
- $installimage = serendipity_getTemplateFile('admin/img/install_now_' . strtolower($plug['pluginlocation']) . '.png');
- } else {
- $installimage = serendipity_getTemplateFile('admin/img/install_now.png');
- }
-
- if (!isset($plug['customURI'])) {
- $plug['customURI'] = '';
- }
-
if ( !empty($plug['requirements']['serendipity']) && version_compare($plug['requirements']['serendipity'], serendipity_getCoreVersion($serendipity['version']), '>') ) {
- $notice['requirements_failures'][] = 's9y ' . $plug['requirements']['serendipity'];
+ $requirement_failures[$plug['class_name']] = array("s9y" => true);
}
if ( !empty($plug['requirements']['php']) && version_compare($plug['requirements']['php'], phpversion(), '>') ) {
- $notice['requirements_failures'][] = 'PHP ' . $plug['requirements']['php'];
+ if (isset($requirement_failures[$plug['class_name']])) {
+ $requirement_failures[$plug['class_name']] = array_merge($requirement_failures[$plug['class_name']] , array("php" => true));
+ } else {
+ $requirement_failures[$plug['class_name']] = array("php" => true);
+ }
}
- /* Enable after Smarty 2.6.7 upgrade.
- * TODO: How can we get current Smarty version here? $smarty is not created!
if ( !empty($plug['requirements']['smarty']) && version_compare($plug['requirements']['smarty'], '2.6.7', '>') ) {
- $notice['requirements_failures'][] = 'Smarty: ' . $plug['requirements']['smarty'];
+ if (isset($requirement_failures[$plug['class_name']])) {
+ $requirement_failures[$plug['class_name']] = array_merge($requirement_failures[$plug['class_name']] , array("smarty" => true));
+ } else {
+ $requirement_failures[$plug['class_name']] = array("smarty" => true);
+ }
}
- */
-
- if (count($notice['requirements_failures']) > 0) {
- $plug['requirements_fail'] = true;
- }
-
-?>
-
- >
-
-
- |
-
-
-
-
-
-
-
-
-
-
- |
-
-
- |
-
- 0) { ?>
-
- | () |
-
-
-
- |
-
-
-
- |
-
-
-
-
+ if (isset($_POST['SAVE'])) {
+ $data['save'] = true;
+ $data['timestamp'] = serendipity_strftime('%H:%M:%S');
+ }
-
- ; ?>)
-
-
-
-';
- echo '' . PREFERENCE_USE_JS_WARNING . '
';
+ $data['eyecandy'] = true;
}
- serendipity_plugin_api::hook_event('backend_pluginlisting_header', $serendipity['eyecandy']);
-?>
-
+ serendipity_plugin_api::hook_event("backend_pluginlisting_header" ,$eyecandy);
-
-
-
-
+ ob_start();
+ serendipity_plugin_api::hook_event('backend_plugins_sidebar_header', $serendipity);
+ $data['backend_plugins_sidebar_header'] = ob_get_contents();
+ ob_end_clean();
+ ob_start();
+ show_plugins(false, $sidebars);
+ $data['sidebar_plugins'] = ob_get_contents();
+ ob_end_clean();
-
-
+ ob_start();
+ $data['backend_plugins_event_header'] = ob_get_contents();
+ ob_end_clean();
+ ob_start();
+ show_plugins(true);
+ $data['event_plugins'] = ob_get_contents();
+ ob_end_clean();
-
-
-
-
-
- 0) { ?>
- Memory Usage
-
-
- 0) {
+ $data['$memsnaps'] = $serendipity['memSnaps'];
+ }
+
}
+
+if (!is_object($serendipity['smarty'])) {
+ serendipity_smarty_init();
+}
+
+$serendipity['smarty']->assign($data);
+$tfile = dirname(__FILE__) . "/tpl/plugins.inc.tpl";
+$content = $serendipity['smarty']->fetch('file:'. $tfile);
+echo $content;
/* vim: set sts=4 ts=4 expandtab : */
diff --git a/include/admin/tpl/plugins.inc.tpl b/include/admin/tpl/plugins.inc.tpl
new file mode 100644
index 00000000..156fd06c
--- /dev/null
+++ b/include/admin/tpl/plugins.inc.tpl
@@ -0,0 +1,210 @@
+{if $plugin_to_conf}
+ {if is_array($save_errors)}
+
+

+ {$CONST.ERROR}:
+
+ {foreach $save_errors as $save_error}
+ - $save_error
+ {/foreach}
+
+
+ {elseif $saveconf}
+
+

+ {$CONST.DONE}: {{$CONST.SETTINGS_SAVED_AT}|sprintf:"{$timestamp}"}
+
+ {/if}
+
+
+{elseif $adminAction == "addnew"}
+ {if $type == "event"}
+ {$CONST.EVENT_PLUGINS}
+ {else}
+ {$CONST.SIDEBAR_PLUGINS}
+ {/if}
+
+ {foreach $errorstack as $e_idx => $e_name}
+ {$CONST.ERROR}: {$e_name}
+ {/foreach}
+
+ {foreach $pluggroups AS $pluggroup => $groupstack}
+ {if empty($pluggroup)}
+
+
+
+ {if !empty($only_group)}
+ {continue}
+ {/if}
+ {elseif ! empty($only_group) && $pluggroup != $only_group}
+ {continue}
+ {else}
+
+ | {$groupnames.{$available_group}} |
+
+ {/if}
+
+ | Plugin |
+ Action |
+
+ {foreach $groupstack as $plug}
+
+
+
+
+ | {$plug.name} |
+
+ {if isset($requirements_failures.{$plug.class_name})}
+
+ {$CONST.UNMET_REQUIREMENTS|sprintf:"{if $requirements_failures.{$plug.class_name}.s9y}s9y $plug.requirements..serendipity,{/if} {if $requirements_failures.{$plug.class_name}.php}PHP $plug.requirements.php,{/if} {if $requirements_failures.{$plug.class_name}.smarty}Smarty $plug.requirements.smarty{/if}"}
+
+ {elseif $plug['upgradable'] == true}
+
+
+
+ {elseif $plug.installable == true}
+
+
+
+ {else}
+ {$CONST.ALREADY_INSTALLED}
+ {/if}
+ |
+
+
+ | {$plug.description} |
+
+
+ | ({$plug.class_name})
+ {if ! empty($plug.author)}
+ {$CONST.AUTHOR}: {$plug.author}
+ {/if}
+
+ {if ! empty($plug.version)}
+ {$CONST.VERSION}: {$plug.version}
+ {/if}
+
+ {if ! empty($plug.website)}
+ {$CONST.PLUGIN_DOCUMENTATION}
+ {/if}
+
+ {if ! empty($plug.local_documentation)}
+ {$CONST.PLUGIN_DOCUMENTATION_LOCAL}
+ {/if}
+
+ {if ! empty($plug.changelog)}
+ {$CONST.PLUGIN_DOCUMENTATION_CHANGELOG}
+ {/if}
+
+ {if ! empty({$plug.upgrade_version}) && $plug.upgrade_version != $plug.version}
+ {$CONST.UPGRADE_TO_VERSION|sprintf:"{$plug.upgrade_version}"}
+ {/if}
+
+ {if ! empty($plug.pluginlocation) && $plug.pluginlocation != 'local'}
+ ({$plug.pluginlocation|escape:"html"})
+ {/if}
+
+ |
+
+
+ |
+
+ {/foreach}
+ {/foreach}
+
+ | {$CONST.PLUGIN_AVAILABLE_COUNT|sprintf:"count({$pluginstack})"} |
+
+
+{else}
+ {if $save}
+
+

+ {$CONST.DONE}:{$CONST.SETTINGS_SAVED_AT|sprintf:"$timestamp"}
+ {/if}
+ {$CONST.BELOW_IS_A_LIST_OF_INSTALLED_PLUGINS}
+ {if $eyecandy}
+
+ {$CONST.PREFERENCE_USE_JS_WARNING}
+ {/if}
+
+
+
+ {$CONST.SIDEBAR_PLUGINS}
+
+
+ {$CONST.CLICK_HERE_TO_INSTALL_PLUGIN|sprintf:"{$CONST.SIDEBAR_PLUGIN}"}
+
+ {$backend_plugins_sidebar_header}
+ {$sidebar_plugins}
+
+
+
+ {$CONST.EVENT_PLUGINS}
+
+
+ {{$CONST.CLICK_HERE_TO_INSTALL_PLUGIN}|sprintf:"{$CONST.EVENT_PLUGIN}"}
+
+ {$backend_plugins_event_header}
+ {$event_plugins}
+
+ {if $memsnaps}
+ Memory Usage
+
+ {/if}
+{/if}
+
+
+
+
+
+
\ No newline at end of file
diff --git a/include/serendipity_smarty_class.inc.php b/include/serendipity_smarty_class.inc.php
index 9c7608c1..70ab5311 100644
--- a/include/serendipity_smarty_class.inc.php
+++ b/include/serendipity_smarty_class.inc.php
@@ -10,7 +10,7 @@
class Serendipity_Smarty_Security_Policy extends Smarty_Security
{
// these are the allowed functions only. - default as is
- public $php_functions = array('isset', 'empty', 'count', 'sizeof', 'in_array', 'is_array', 'time', 'nl2br', 'serendipity_categoryURL', 'serendipity_archiveURL');
+ public $php_functions = array('isset', 'empty', 'count', 'sizeof', 'in_array', 'is_array', 'time', 'nl2br', 'serendipity_categoryURL', 'serendipity_archiveURL', 'serendipity_groupname');
// to disable all PHP functions
#public $php_functions = null;