[geeklog-cvs] geeklog: Don't let the user enable plugins when there's no funct...
geeklog-cvs at lists.geeklog.net
geeklog-cvs at lists.geeklog.net
Wed Jan 7 03:53:18 EST 2009
details: http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/8a1973c71aba
changeset: 6652:8a1973c71aba
user: Dirk Haun <dirk at haun-online.de>
date: Sun Jan 04 09:23:47 2009 +0100
description:
Don't let the user enable plugins when there's no functions.inc
diffstat:
2 files changed, 22 insertions(+), 5 deletions(-)
public_html/admin/plugins.php | 7 ++++++-
system/lib-admin.php | 20 ++++++++++++++++----
diffs (59 lines):
diff -r 49679ac7237e -r 8a1973c71aba public_html/admin/plugins.php
--- a/public_html/admin/plugins.php Sat Jan 03 17:55:42 2009 +0100
+++ b/public_html/admin/plugins.php Sun Jan 04 09:23:47 2009 +0100
@@ -144,7 +144,12 @@
if ($A['pi_enabled'] == 1) {
$plg_templates->set_var('enabled_checked', 'checked="checked"');
} else {
- $plg_templates->set_var('enabled_checked', '');
+ if (file_exists($_CONF['path'] . 'plugins/' . $pi_name
+ . '/functions.inc')) {
+ $plg_templates->set_var('enabled_checked', '');
+ } else {
+ $plg_templates->set_var('enabled_checked', 'disabled="disabled"');
+ }
}
$plg_templates->set_var('gltoken', SEC_createToken());
$plg_templates->set_var('gltoken_name', CSRF_TOKEN);
diff -r 49679ac7237e -r 8a1973c71aba system/lib-admin.php
--- a/system/lib-admin.php Sat Jan 03 17:55:42 2009 +0100
+++ b/system/lib-admin.php Sun Jan 04 09:23:47 2009 +0100
@@ -8,7 +8,7 @@
// | |
// | Admin-related functions needed in more than one place. |
// +---------------------------------------------------------------------------+
-// | Copyright (C) 2000-2008 by the following authors: |
+// | Copyright (C) 2000-2009 by the following authors: |
// | |
// | Authors: Tony Bibbs - tony AT tonybibbs DOT com |
// | Mark Limburg - mlimburg AT users DOT sourceforge DOT net |
@@ -985,14 +985,26 @@
}
break;
case 'enabled':
+ $not_present = false;
if ($A['pi_enabled'] == 1) {
$switch = ' checked="checked"';
} else {
$switch = '';
+ if (! file_exists($_CONF['path'] . 'plugins/' . $A['pi_name']
+ . '/functions.inc')) {
+ $not_present = true;
+ }
}
- $retval = "<input type=\"checkbox\" name=\"enabledplugins[{$A['pi_name']}]\" "
- . "onclick=\"submit()\" value=\"1\"$switch" . XHTML . ">";
- $retval .= "<input type=\"hidden\" name=\"".CSRF_TOKEN."\" value=\"{$token}\"".XHTML.">";
+ if ($not_present) {
+ $retval = '<input type="checkbox" name="enabledplugins['
+ . $A['pi_name'] . '] disabled="disabled"' . XHTML . '>';
+ } else {
+ $retval = '<input type="checkbox" name="enabledplugins['
+ . $A['pi_name'] . ']" onclick="submit()" value="1"'
+ . $switch . XHTML . '>';
+ $retval .= '<input type="hidden" name="' . CSRF_TOKEN . '" '
+ . 'value="' . $token . '"' . XHTML . '>';
+ }
break;
default:
$retval = $fieldvalue;
More information about the geeklog-cvs
mailing list