smartified plugins.nc.php
This commit is contained in:
@@ -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();
|
||||
}
|
||||
?>
|
||||
|
||||
<?php if ( isset($save_errors) && is_array($save_errors) && count($save_errors) > 0 ) { ?>
|
||||
<div class="serendipityAdminMsgError">
|
||||
<img style="width: 22px; height: 22px; border: 0px; padding-right: 4px; vertical-align: middle" src="<?php echo serendipity_getTemplateFile('admin/img/admin_msg_error.png'); ?>" alt="" />
|
||||
<?php
|
||||
echo ERROR . ":<br />\n";
|
||||
echo "<ul>\n";
|
||||
foreach($save_errors AS $save_error) {
|
||||
echo '<li>' . $save_error . "</li>\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 "</ul>\n";
|
||||
?>
|
||||
</div>
|
||||
<?php } elseif ( isset($_POST['SAVECONF'])) { ?>
|
||||
<div class="serendipityAdminMsgSuccess"><img style="width: 22px; height: 22px; border: 0px; padding-right: 4px; vertical-align: middle" src="<?php echo serendipity_getTemplateFile('admin/img/admin_msg_success.png'); ?>" alt="" /><?php echo DONE .': '. sprintf(SETTINGS_SAVED_AT, serendipity_strftime('%H:%M:%S')); ?></div>
|
||||
<?php } ?>
|
||||
|
||||
<form method="post" name="serendipityPluginConfigure">
|
||||
<?php echo serendipity_setFormToken(); ?>
|
||||
<table cellpadding="5" style="border: 1px dashed" width="90%" align="center">
|
||||
<tr>
|
||||
<th width="100"><?php echo NAME; ?></th>
|
||||
<td><?php echo $name; ?> (<em><?php echo get_class($plugin); ?></em>)</td>
|
||||
</tr>
|
||||
if (@file_exists(dirname($plugin->pluginFile) . '/documentation_' . $serendipity['lang'] . '.html')) {
|
||||
$data['documentation_local'] = '/documentation_' . $serendipity['lang'] . '.html';
|
||||
} elseif (@file_exists(dirname($plugin->pluginFile) . '/documentation_en.html')) {
|
||||
$data['documentation_local'] = '/documentation_en.html';
|
||||
} elseif (@file_exists(dirname($plugin->pluginFile) . '/documentation.html')) {
|
||||
$data['documentation_local'] = '/documentation.html';
|
||||
} elseif (@file_exists(dirname($plugin->pluginFile) . '/README')) {
|
||||
$data['documentation_local'] = '/README';
|
||||
}
|
||||
|
||||
<tr>
|
||||
<th style="vertical-align: top"><?php echo DESCRIPTION; ?></th>
|
||||
<td>
|
||||
<?php
|
||||
echo $desc;
|
||||
if (!empty($documentation)) {
|
||||
echo '<br /><a href="' . htmlspecialchars($documentation) . '">' . PLUGIN_DOCUMENTATION . '</a>';
|
||||
}
|
||||
|
||||
if (@file_exists(dirname($plugin->pluginFile) . '/ChangeLog')) {
|
||||
echo '<br /><a href="plugins/' . $plugin->act_pluginPath . '/ChangeLog">' . PLUGIN_DOCUMENTATION_CHANGELOG . '</a>';
|
||||
}
|
||||
|
||||
if (@file_exists(dirname($plugin->pluginFile) . '/documentation_' . $serendipity['lang'] . '.html')) {
|
||||
echo '<br /><a href="plugins/' . $plugin->act_pluginPath . '/documentation_' . $serendipity['lang'] . '.html">' . PLUGIN_DOCUMENTATION_LOCAL . '</a>';
|
||||
} elseif (@file_exists(dirname($plugin->pluginFile) . '/documentation_en.html')) {
|
||||
echo '<br /><a href="plugins/' . $plugin->act_pluginPath . '/documentation_en.html">' . PLUGIN_DOCUMENTATION_LOCAL . '</a>';
|
||||
} elseif (@file_exists(dirname($plugin->pluginFile) . '/documentation.html')) {
|
||||
echo '<br /><a href="plugins/' . $plugin->act_pluginPath . '/documentation.html">' . PLUGIN_DOCUMENTATION_LOCAL . '</a>';
|
||||
} elseif (@file_exists(dirname($plugin->pluginFile) . '/README')) {
|
||||
echo '<br /><a href="plugins/' . $plugin->act_pluginPath . '/README">' . PLUGIN_DOCUMENTATION_LOCAL . '</a>';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
if (!empty($license)) {
|
||||
echo '<tr><th>'.MEDIA_PROPERTY_COPYRIGHT.'</th><td>'.$license.'</td></tr>';
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
<br />
|
||||
|
||||
<?php serendipity_plugin_config($plugin, $bag, $name, $desc, $config_names, true, true, true, true, 'plugin', $config_groups); ?>
|
||||
</form>
|
||||
<?php
|
||||
$data['license'] = $license;
|
||||
ob_start();
|
||||
serendipity_plugin_config($plugin, $bag, $name, $desc, $config_names, true, true, true, true, 'plugin', $config_groups);
|
||||
$data['config'] = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
} elseif ( $serendipity['GET']['adminAction'] == 'addnew' ) {
|
||||
?>
|
||||
<?php if ( $serendipity['GET']['type'] == 'event' ) { ?>
|
||||
<h2><?php echo EVENT_PLUGINS ?></h2>
|
||||
<?php } else { ?>
|
||||
<h2><?php echo SIDEBAR_PLUGINS ?></h2>
|
||||
<?php } ?>
|
||||
<br />
|
||||
<?php
|
||||
$data['adminAction'] = 'addnew';
|
||||
$data['type'] = $serendipity['GET']['type'];
|
||||
|
||||
$foreignPlugins = $pluginstack = $errorstack = array();
|
||||
serendipity_plugin_api::hook_event('backend_plugins_fetchlist', $foreignPlugins);
|
||||
$pluginstack = array_merge((array)$foreignPlugins['pluginstack'], $pluginstack);
|
||||
@@ -276,157 +245,49 @@ if (isset($_GET['serendipity']['plugin_to_conf'])) {
|
||||
}
|
||||
ksort($pluggroups);
|
||||
|
||||
foreach($errorstack as $e_idx => $e_name) {
|
||||
echo ERROR . ': ' . $e_name . '<br />';
|
||||
}
|
||||
$data['errorstack'] = $errorstack;
|
||||
|
||||
if ($serendipity['GET']['only_group'] == 'UPGRADE') {
|
||||
serendipity_plugin_api::hook_event('backend_pluginlisting_header_upgrade', $pluggroups);
|
||||
}
|
||||
?>
|
||||
<table cellspacing="0" cellpadding="0" border="0" width="100%">
|
||||
<?php
|
||||
|
||||
$available_groups = array_keys($pluggroups);
|
||||
$data['available_groups'] = $available_groups;
|
||||
$groupnames = array();
|
||||
foreach($available_groups as $available_group) {
|
||||
$groupnames[$available_name] = serendipity_groupname($available_group);
|
||||
}
|
||||
$data['groupnames'] = $groupnames;
|
||||
$data['pluggroups'] = $pluggroups;
|
||||
$data['formToken'] = $formToken;
|
||||
$data['only_group'] = $serendipity['GET']['only_group'];
|
||||
$requirement_failures = array();
|
||||
|
||||
foreach($pluggroups AS $pluggroup => $groupstack) {
|
||||
if (empty($pluggroup)) {
|
||||
?>
|
||||
<tr>
|
||||
<td colspan="2" class="serendipity_pluginlist_header">
|
||||
<form action="serendipity_admin.php" method="get">
|
||||
<?php echo serendipity_setFormToken(); ?>
|
||||
<input type="hidden" name="serendipity[adminModule]" value="plugins" />
|
||||
<input type="hidden" name="serendipity[adminAction]" value="addnew" />
|
||||
<input type="hidden" name="serendipity[type]" value="<?php echo htmlspecialchars($serendipity['GET']['type']); ?>" />
|
||||
<?php echo FILTERS; ?>: <select name="serendipity[only_group]">
|
||||
<?php foreach((array)$available_groups AS $available_group) {
|
||||
?>
|
||||
<option value="<?php echo $available_group; ?>" <?php echo ($serendipity['GET']['only_group'] == $available_group ? 'selected="selected"' : ''); ?>><?php echo serendipity_groupname($available_group); ?>
|
||||
<?php } ?>
|
||||
<option value="ALL" <?php echo ($serendipity['GET']['only_group'] == 'ALL' ? 'selected="selected"' : ''); ?>><?php echo ALL_CATEGORIES; ?>
|
||||
<option value="UPGRADE" <?php echo ($serendipity['GET']['only_group'] == 'UPGRADE' ? 'selected="selected"' : ''); ?>><?php echo WORD_NEW; ?>
|
||||
</select>
|
||||
<input class="serendipityPrettyButton input_button" type="submit" value="<?php echo GO; ?>" />
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
if (!empty($serendipity['GET']['only_group'])) {
|
||||
continue;
|
||||
}
|
||||
} elseif (!empty($serendipity['GET']['only_group']) && $pluggroup != $serendipity['GET']['only_group']) {
|
||||
continue;
|
||||
} else {
|
||||
?>
|
||||
<tr>
|
||||
<td colspan="2" class="serendipity_pluginlist_section"><strong><?php echo serendipity_groupname($pluggroup); ?></strong></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td><strong>Plugin</strong></td>
|
||||
<td width="100" align="center"><strong>Action</strong></td>
|
||||
</tr>
|
||||
<?php
|
||||
foreach ($groupstack as $plug) {
|
||||
$jsLine = " onmouseout=\"document.getElementById('serendipity_plugin_". $plug['class_name'] ."').className='';\"";
|
||||
$jsLine .= " onmouseover=\"document.getElementById('serendipity_plugin_". $plug['class_name'] ."').className='serendipity_PluginAdminHighlight';\"";
|
||||
|
||||
$pluginInfo = $notice = array();
|
||||
|
||||
if (!empty($plug['author'])) {
|
||||
$pluginInfo[] = AUTHOR . ': ' . $plug['author'];
|
||||
}
|
||||
|
||||
if (!empty($plug['version'])) {
|
||||
$pluginInfo[] = VERSION . ': ' . $plug['version'];
|
||||
}
|
||||
|
||||
if (!empty($plug['website'])) {
|
||||
$pluginInfo[] = '<a href="' . htmlspecialchars($plug['website']) . '">' . PLUGIN_DOCUMENTATION . '</a>';
|
||||
}
|
||||
|
||||
if (!empty($plug['local_documentation'])) {
|
||||
$pluginInfo[] = '<a href="' . htmlspecialchars($plug['local_documentation']) . '">' . PLUGIN_DOCUMENTATION_LOCAL . '</a>';
|
||||
}
|
||||
|
||||
if (!empty($plug['changelog'])) {
|
||||
$pluginInfo[] = '<a href="' . htmlspecialchars($plug['changelog']) . '">' . PLUGIN_DOCUMENTATION_CHANGELOG . '</a>';
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
?>
|
||||
<tr id="serendipity_plugin_<?php echo $plug['class_name']; ?>">
|
||||
<td colspan="2" <?php echo $jsLine ?>>
|
||||
<table width="100%" cellpadding="3" cellspacing="0" border="0">
|
||||
<tr>
|
||||
<td><strong><?php echo $plug['name'] ?></strong></td>
|
||||
<td width="100" align="center" valign="middle" rowspan="3">
|
||||
<?php if ( $plug['requirements_fail'] == true ) { ?>
|
||||
<span style="color: #cccccc"><?php printf(UNMET_REQUIREMENTS, implode(', ', $notice['requirements_failures'])); ?></span>
|
||||
<?php } elseif ( $plug['upgradable'] == true ) { ?>
|
||||
<a href="?serendipity[adminModule]=plugins&serendipity[pluginPath]=<?php echo $plug['pluginPath']; ?>&serendipity[install_plugin]=<?php echo $plug['plugin_class'] . $plug['customURI'] ?>"><img src="<?php echo serendipity_getTemplateFile('admin/img/upgrade_now.png') ?>" title="<?php echo UPGRADE ?>" alt="<?php echo UPGRADE ?>" border="0" /></a>
|
||||
<?php } elseif ($plug['installable'] == true) { ?>
|
||||
<a href="?serendipity[adminModule]=plugins&serendipity[pluginPath]=<?php echo $plug['pluginPath']; ?>&serendipity[install_plugin]=<?php echo $plug['plugin_class'] . $plug['customURI'] ?>"><img src="<?php echo $installimage ?>" title="<?php echo INSTALL ?>" alt="<?php echo INSTALL ?>" border="0" /></a>
|
||||
<?php } else { ?>
|
||||
<span style="color: #cccccc"><?php echo ALREADY_INSTALLED ?></span>
|
||||
<?php } ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding-left: 10px"><?php echo $plug['description'] ?></td>
|
||||
</tr>
|
||||
<?php if (count($pluginInfo) > 0) { ?>
|
||||
<tr>
|
||||
<td style="padding-left: 10px; font-size: x-small">(<?php echo $plug['class_name']; ?>) <?php echo implode('; ', $pluginInfo); ?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td colspan="2" align="right"><?php printf(PLUGIN_AVAILABLE_COUNT, count($pluginstack)); ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<?php
|
||||
$data['requirements_failues'] = $requirement_failures;
|
||||
} else {
|
||||
/* show general plugin list */
|
||||
|
||||
@@ -542,42 +403,46 @@ if (isset($_GET['serendipity']['plugin_to_conf'])) {
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
if (isset($_POST['SAVE'])) {
|
||||
$data['save'] = true;
|
||||
$data['timestamp'] = serendipity_strftime('%H:%M:%S');
|
||||
}
|
||||
|
||||
<?php if (isset($_POST['SAVE'])) { ?>
|
||||
<div class="serendipityAdminMsgSuccess"><img style="width: 22px; height: 22px; border: 0px; padding-right: 4px; vertical-align: middle" src="<?php echo serendipity_getTemplateFile('admin/img/admin_msg_success.png'); ?>" alt="" /><?php echo DONE .': '. sprintf(SETTINGS_SAVED_AT, serendipity_strftime('%H:%M:%S')); ?></div>
|
||||
<?php } ?>
|
||||
|
||||
<div><?php echo BELOW_IS_A_LIST_OF_INSTALLED_PLUGINS ?></div>
|
||||
<?php
|
||||
if (!isset($serendipity['eyecandy']) || serendipity_db_bool($serendipity['eyecandy'])) {
|
||||
echo '<script src="' . serendipity_getTemplateFile('dragdrop.js') . '" type="text/javascript"></script>';
|
||||
echo '<div class="warning js_warning"><em>' . PREFERENCE_USE_JS_WARNING . '</em></div>';
|
||||
$data['eyecandy'] = true;
|
||||
}
|
||||
|
||||
serendipity_plugin_api::hook_event('backend_pluginlisting_header', $serendipity['eyecandy']);
|
||||
?>
|
||||
<br />
|
||||
serendipity_plugin_api::hook_event("backend_pluginlisting_header" ,$eyecandy);
|
||||
|
||||
<h3><?php echo SIDEBAR_PLUGINS ?></h3>
|
||||
<a href="?serendipity[adminModule]=plugins&serendipity[adminAction]=addnew" class="serendipityIconLink"><img src="<?php echo serendipity_getTemplateFile('admin/img/install.png') ?>" style="border: 0px none ; vertical-align: middle; display: inline;" alt="" /><?php echo sprintf(CLICK_HERE_TO_INSTALL_PLUGIN, SIDEBAR_PLUGIN) ?></a>
|
||||
<?php serendipity_plugin_api::hook_event('backend_plugins_sidebar_header', $serendipity); ?>
|
||||
<?php show_plugins(false, $sidebars); ?>
|
||||
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();
|
||||
|
||||
<br />
|
||||
<br />
|
||||
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();
|
||||
|
||||
<h3><?php echo EVENT_PLUGINS ?></h3>
|
||||
<a href="?serendipity[adminModule]=plugins&serendipity[adminAction]=addnew&serendipity[type]=event" class="serendipityIconLink"><img src="<?php echo serendipity_getTemplateFile('admin/img/install.png') ?>" style="border: 0px none ; vertical-align: middle; display: inline;" alt="" /><?php echo sprintf(CLICK_HERE_TO_INSTALL_PLUGIN, EVENT_PLUGIN) ?></a>
|
||||
<?php serendipity_plugin_api::hook_event('backend_plugins_event_header', $serendipity); ?>
|
||||
<?php show_plugins(true); ?>
|
||||
|
||||
<?php if (count($serendipity['memSnaps']) > 0) { ?>
|
||||
<h3>Memory Usage</h3>
|
||||
<div>
|
||||
<pre><?php print_r($serendipity['memSnaps']); ?></pre>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?php
|
||||
if (count($serendipity['memSnaps']) > 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 : */
|
||||
|
||||
Reference in New Issue
Block a user