Mercurial > defr > drupal > core
diff includes/actions.inc @ 11:589fb7c02327 6.5
Drupal 6.5
author | Franck Deroche <webmaster@defr.org> |
---|---|
date | Tue, 23 Dec 2008 14:32:19 +0100 |
parents | acef7ccb09b5 |
children | 8b6c45761e01 |
line wrap: on
line diff
--- a/includes/actions.inc Tue Dec 23 14:32:08 2008 +0100 +++ b/includes/actions.inc Tue Dec 23 14:32:19 2008 +0100 @@ -1,5 +1,5 @@ <?php -// $Id: actions.inc,v 1.8.2.3 2008/08/12 06:57:31 dries Exp $ +// $Id: actions.inc,v 1.8.2.4 2008/09/05 09:29:22 dries Exp $ /** * @file @@ -54,7 +54,7 @@ $where_values = array(); foreach ($action_ids as $action_id) { if (is_numeric($action_id)) { - $where[] = 'OR aid = %d'; + $where[] = "OR aid = '%s'"; $where_values[] = $action_id; } elseif (isset($available_actions[$action_id])) { @@ -93,7 +93,7 @@ else { // If it's a configurable action, retrieve stored parameters. if (is_numeric($action_ids)) { - $action = db_fetch_object(db_query("SELECT * FROM {actions} WHERE aid = %d", $action_ids)); + $action = db_fetch_object(db_query("SELECT * FROM {actions} WHERE aid = '%s'", $action_ids)); $function = $action->callback; $context = array_merge($context, unserialize($action->parameters)); $result[$action_ids] = $function($object, $context, $a1, $a2); @@ -238,7 +238,7 @@ } // Must be an instance; must check database. - $aid = db_result(db_query("SELECT aid FROM {actions} WHERE MD5(aid) = '%s' AND parameters != ''", $hash)); + $aid = db_result(db_query("SELECT aid FROM {actions} WHERE MD5(aid) = '%s' AND parameters <> ''", $hash)); return $aid; } @@ -325,7 +325,7 @@ function actions_save($function, $type, $params, $desc, $aid = NULL) { $serialized = serialize($params); if ($aid) { - db_query("UPDATE {actions} SET callback = '%s', type = '%s', parameters = '%s', description = '%s' WHERE aid = %d", $function, $type, $serialized, $desc, $aid); + db_query("UPDATE {actions} SET callback = '%s', type = '%s', parameters = '%s', description = '%s' WHERE aid = '%s'", $function, $type, $serialized, $desc, $aid); watchdog('actions', 'Action %action saved.', array('%action' => $desc)); } else { @@ -333,7 +333,7 @@ // separate table for numeric aids. db_query('INSERT INTO {actions_aid} VALUES (default)'); $aid = db_last_insert_id('actions_aid', 'aid'); - db_query("INSERT INTO {actions} (aid, callback, type, parameters, description) VALUES (%d, '%s', '%s', '%s', '%s')", $aid, $function, $type, $serialized, $desc); + db_query("INSERT INTO {actions} (aid, callback, type, parameters, description) VALUES ('%s', '%s', '%s', '%s', '%s')", $aid, $function, $type, $serialized, $desc); watchdog('actions', 'Action %action created.', array('%action' => $desc)); } @@ -350,7 +350,7 @@ * The appropriate action row from the database as an object. */ function actions_load($aid) { - return db_fetch_object(db_query("SELECT * FROM {actions} WHERE aid = %d", $aid)); + return db_fetch_object(db_query("SELECT * FROM {actions} WHERE aid = '%s'", $aid)); } /** @@ -360,6 +360,6 @@ * integer The ID of the action to delete. */ function actions_delete($aid) { - db_query("DELETE FROM {actions} WHERE aid = %d", $aid); + db_query("DELETE FROM {actions} WHERE aid = '%s'", $aid); module_invoke_all('actions_delete', $aid); }