function getOptionsBit($ps_options) { if (is_array($ps_options)) { for ($i = 1; $i < 6; $i++) { if (in_array($i, $ps_options)) { //$thisBit |= 1 << $i; $thisBit = setBit($thisBit, $i); } else { //$thisBit &= ~(1 << $i); $thisBit = clearBit($thisBit, $i); } } } return $thisBit; }
if (!preg_match('#^https?://#i', $url)) { $url = 'http://' . $url; } # Generate bitfield from new options $bitfield = 0; $i = 0; foreach ($CONFIG['options'] as $name => $details) { # Ignore forced if (!empty($details['force'])) { continue; } # Current bit $bit = pow(2, $i); # Set bitfield if (!empty($_POST[$name])) { setBit($bitfield, $bit); } # Increase index ++$i; } # Save new bitfield in session $_SESSION['bitfield'] = $bitfield; # Save valid entry $_SESSION['no_hotlink'] = true; # Redirect to target redirect(proxyURL($url, 'norefer')); break; /************************************************************* * Agree to our SSL warning. **************************************************************/ /*************************************************************
function defineBitfield($options) { if (defined('BITFIELD')) { return BITFIELD; } $bitfield = 0; $i = 0; foreach ($options as $on) { if ($on) { $int = pow(2, $i); setBit($bitfield, $int); } $i++; } define('BITFIELD', $bitfield); return $bitfield; }