| 1 |
<?php |
<?php |
| 2 |
// $Id: fasttoggle.toggle.inc,v 1.1.2.1 2008/11/08 11:09:20 timcn Exp $ |
// $Id: fasttoggle.toggle.inc,v 1.1.2.2 2008/11/08 11:38:19 timcn Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* Menu callback. Toggle options for a node if the action is confirmed via |
* Menu callback. Toggle options for a node if the action is confirmed via |
| 20 |
// Save the node. |
// Save the node. |
| 21 |
$node->$option = key($options[$option]); |
$node->$option = key($options[$option]); |
| 22 |
node_save($node); |
node_save($node); |
| 23 |
|
|
| 24 |
|
// Let other modules respond. |
| 25 |
|
module_invoke_all('fasttoggle_toggle', 'node', $node, $option); |
| 26 |
|
|
| 27 |
// Output the new status for the updated link text on AJAX changes |
// Output the new status for the updated link text on AJAX changes |
| 28 |
if (isset($_POST['javascript']) && $_POST['javascript']) { |
if (isset($_POST['javascript']) && $_POST['javascript']) { |
| 80 |
if (isset($_POST['confirm']) && $_POST['confirm']) { |
if (isset($_POST['confirm']) && $_POST['confirm']) { |
| 81 |
$array = array($option => !$user->$option); |
$array = array($option => !$user->$option); |
| 82 |
$user = user_save($user, $array); |
$user = user_save($user, $array); |
| 83 |
|
|
| 84 |
|
// Let other modules respond. |
| 85 |
|
module_invoke_all('fasttoggle_toggle', 'user', $user, $option); |
| 86 |
|
|
| 87 |
// Output the new option for the updated link text on AJAX changes |
// Output the new option for the updated link text on AJAX changes |
| 88 |
if (isset($_POST['javascript']) && $_POST['javascript']) { |
if (isset($_POST['javascript']) && $_POST['javascript']) { |
| 138 |
if (isset($_POST['confirm']) && $_POST['confirm']) { |
if (isset($_POST['confirm']) && $_POST['confirm']) { |
| 139 |
$comment->$option = !$comment->$option; |
$comment->$option = !$comment->$option; |
| 140 |
comment_save((array)$comment); |
comment_save((array)$comment); |
| 141 |
|
|
| 142 |
|
// Let other modules respond. |
| 143 |
|
module_invoke_all('fasttoggle_toggle', 'comment', $comment, $option); |
| 144 |
|
|
| 145 |
// Output the new status for the updated link text on AJAX changes |
// Output the new status for the updated link text on AJAX changes |
| 146 |
if (isset($_POST['javascript']) && $_POST['javascript']) { |
if (isset($_POST['javascript']) && $_POST['javascript']) { |