[geeklog-cvs] geeklog: Fixed enabling/disabling weblog directory services from...
geeklog-cvs at lists.geeklog.net
geeklog-cvs at lists.geeklog.net
Sat Feb 20 10:35:47 EST 2010
changeset 7739:48690ec05f7d
url: http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/48690ec05f7d
user: Dirk Haun <dirk at haun-online.de>
date: Sat Feb 20 15:29:13 2010 +0100
description:
Fixed enabling/disabling weblog directory services from the admin list (same issue as with blocks)
diffstat:
public_html/admin/trackback.php | 40 +++++++++++++++++++++++++---------------
system/lib-admin.php | 7 +++++--
2 files changed, 30 insertions(+), 17 deletions(-)
diffs (81 lines):
diff -r 6caa2ad8d56a -r 48690ec05f7d public_html/admin/trackback.php
--- a/public_html/admin/trackback.php Sat Feb 20 15:26:16 2010 +0100
+++ b/public_html/admin/trackback.php Sat Feb 20 15:29:13 2010 +0100
@@ -741,23 +741,29 @@
/**
* Toggle status of a ping service from enabled to disabled and back
*
-* @param int $pid ID of the service
+* @param array $enabledservices array containing ids of enabled services
+* @param array $visibleservices array containing ids of visible services
* @return void
*
*/
-function changeServiceStatus ($pid_arr)
+function changeServiceStatus($enabledservices, $visibleservices)
{
global $_TABLES;
- // first, disable all
- DB_query ("UPDATE {$_TABLES['pingservice']} SET is_enabled = '0'");
- if (isset($pid_arr)) {
- foreach ($pid_arr as $pid) { //enable those listed
- $pid = addslashes (COM_applyFilter ($pid, true));
- if (!empty ($pid)) {
- DB_query ("UPDATE {$_TABLES['pingservice']} SET is_enabled = '1' WHERE pid = '$pid'");
- }
- }
+ $disabled = array_diff($visibleservices, $enabledservices);
+
+ // disable services
+ $in = implode(',', $disabled);
+ if (! empty($in)) {
+ $sql = "UPDATE {$_TABLES['pingservice']} SET is_enabled = 0 WHERE pid IN ($in)";
+ DB_query($sql);
+ }
+
+ // enable services
+ $in = implode(',', $enabledservices);
+ if (! empty($in)) {
+ $sql = "UPDATE {$_TABLES['pingservice']} SET is_enabled = 1 WHERE pid IN ($in)";
+ DB_query($sql);
}
}
@@ -829,11 +835,15 @@
$display = '';
$mode = '';
if ($_CONF['ping_enabled'] && isset($_POST['serviceChanger']) && SEC_checkToken()) {
- $changedservices = array();
- if (isset($_POST['changedservices'])) {
- $changedservices = $_POST['changedservices'];
+ $enabledservices = array();
+ if (isset($_POST['enabledservices'])) {
+ $enabledservices = $_POST['enabledservices'];
}
- changeServiceStatus($changedservices);
+ $visibleservices = array();
+ if (isset($_POST['visibleservices'])) {
+ $visibleservices = $_POST['visibleservices'];
+ }
+ changeServiceStatus($enabledservices, $visibleservices);
}
if (isset ($_POST['mode']) && is_array ($_POST['mode'])) {
diff -r 6caa2ad8d56a -r 48690ec05f7d system/lib-admin.php
--- a/system/lib-admin.php Sat Feb 20 15:26:16 2010 +0100
+++ b/system/lib-admin.php Sat Feb 20 15:29:13 2010 +0100
@@ -1274,8 +1274,11 @@
} else {
$switch = '';
}
- $retval = "<input type=\"checkbox\" name=\"changedservices[]\" "
- . "onclick=\"submit()\" value=\"{$A['pid']}\"$switch" . XHTML . ">";
+ $retval = '<input type="checkbox" name="enabledservices[]" '
+ . 'onclick="submit()" value="' . $A['pid'] . '"'
+ . $switch . XHTML . '>'
+ . '<input type="hidden" name="visibleservices[]" value="'
+ . $A['pid'] . '"' . XHTML . '>';
break;
default:
More information about the geeklog-cvs
mailing list