Update of /cvsroot/php-blog/serendipity
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18147
Modified Files:
serendipity_admin_plugins.inc.php
Log Message:
Report errors on "invalid" plugins
Index: serendipity_admin_plugins.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_admin_plugins.inc.php,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- serendipity_admin_plugins.inc.php 4 Apr 2004 16:23:29 -0000 1.21
+++ serendipity_admin_plugins.inc.php 7 Apr 2004 06:53:42 -0000 1.22
@@ -33,24 +33,33 @@
<select name="serendipity[plugin_to_add]">
<option value="0">[ <?php echo SELECT_A_PLUGIN_TO_ADD; ?> ]</option>
<?php
+ $errorstack = array();
foreach ($classes as $class_name) {
$plugin =& serendipity_plugin_api::load_plugin($class_name);
+ if (is_object($plugin)) {
+ /* query for its name, description and configuration data */
+ $bag = new serendipity_property_bag;
+ $plugin->introspect($bag);
- /* query for its name, description and configuration data */
- $bag = new serendipity_property_bag;
- $plugin->introspect($bag);
-
- $name = $bag->get('name');
- $desc = $bag->get('description');
+ $name = $bag->get('name');
+ $desc = $bag->get('description');
?>
<option value="<?php echo $class_name; ?>"><?php echo $name . ' - ' . $desc; ?></option>
<?php
+ } else {
+ $errorstack[] = $class_name;
+ }
}
?>
</select>
<input type="checkbox" name="serendipity[all_authors]" value="true" checked="checked" id="all_authors" /><label for="all_authors"><?php echo ALL_AUTHORS; ?></label>
<input name="NEW" value="<?php echo ADD_PLUGIN; ?>" type="submit" />
<br />
+<?php
+foreach($errorstack as $e_idx => $e_name) {
+ echo ERROR . ': ' . $class_name . '<br />';
+}
+?>
<br />
<table border="0" cellpadding="5" cellspacing="0">
@@ -168,19 +177,19 @@
function ownership($authorid, $name, $readonly = false) {
global $serendipity;
-
+
static $users = array();
if (empty($users)) {
$users = serendipity_fetchUsers();
}
-
+
if (!$readonly) {
?>
<select name="serendipity[ownership][<?php echo $name; ?>]">
<option value="0"><?php echo ALL_AUTHORS; ?></option>
<?php
}
-
+
foreach($users AS $user) {
if ($readonly && $user['authorid'] == $authorid) {
$username = htmlentities($user['username']);
@@ -190,7 +199,7 @@
<?php
}
}
-
+
if (!$readonly) {
?>
</select>
@@ -263,7 +272,7 @@
if (!($plugin->protected === FALSE || $plugin->serendipity_owner == '0' || $plugin->serendipity_owner == $serendipity['authorid'] || $serendipity['serendipityUserlevel'] >= USERLEVEL_ADMIN)) {
return;
}
-
+
$bag = new serendipity_property_bag;
$plugin->introspect($bag);
$name = htmlentities($bag->get('name'));
@@ -458,7 +467,7 @@
addslashes($plugin_name),
addslashes($placement)
);
-
+
serendipity_plugin_api::update_plugin_owner(
addslashes($plugin_name),
addslashes($_POST['serendipity']['ownership'][$plugin_name])
@@ -471,7 +480,7 @@
if (isset($_POST['serendipity']['all_authors']) && $_POST['serendipity']['all_authors'] == 'true') {
$authorid = '0';
}
-
+
if (isset($_POST['serendipity']['event_plugin'])) {
$inst = serendipity_plugin_api::create_plugin_instance($_POST['serendipity']['plugin_to_add'], null, 'event', $authorid);
} else {
@@ -483,7 +492,7 @@
if (isset($_POST['REMOVE'])) {
foreach ($_POST['serendipity']['plugin_to_remove'] as $key) {
$plugin =& serendipity_plugin_api::load_plugin($key);
-
+
if ($plugin->serendipity_owner == '0' || $plugin->serendipity_owner == $serendipity['authorid'] || $serendipity['serendipityUserlevel'] >= USERLEVEL_ADMIN) {
serendipity_plugin_api::remove_plugin_instance($key);
}
|