コード例 #1
0
ファイル: nm-privacy.php プロジェクト: popovdenis/kmst
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;
}
コード例 #2
0
     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.
      **************************************************************/
 /*************************************************************
コード例 #3
0
ファイル: init.php プロジェクト: hw-1/webproxy
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;
}