function protected_node_password_nids in Protected Node 6
Transforms the $_GET['protected_pages'] in a valid list of $nids. Anything that is not valid we ignore. If there isn't at least 1 then the function generates an access denied error and exits.
Return value
The array of nids.
3 calls to protected_node_password_nids()
- protected_node_enter_any_password in ./
protected_node.fork.inc - Create the form asking the end users for the node password.
- protected_node_enter_any_password_submit in ./
protected_node.fork.inc - Allow the user to see this node.
- protected_node_enter_any_password_validate in ./
protected_node.fork.inc - Verify that the user entered the correct password.
File
- ./
protected_node.fork.inc, line 16 - Redirected page callback file for the protected_node module. This version supports any number of pages instead of a destination.
Code
function protected_node_password_nids() {
$nids = array();
$nids_list = explode(',', $_GET['protected_pages']);
foreach ($nids_list as $nid) {
$nid = trim($nid);
if (is_numeric($nid)) {
$nids[] = $nid;
}
}
// make sure we have at least one destination otherwise there is no password to check
if (count($nids) == 0) {
// Illegal call
watchdog('protected_node', 'Illegal call to /protected-node', array(), WATCHDOG_WARNING);
drupal_access_denied();
exit;
}
return $nids;
}