当前位置: 首页>>代码示例>>PHP>>正文


PHP wfUtils::getWPVersion方法代码示例

本文整理汇总了PHP中wfUtils::getWPVersion方法的典型用法代码示例。如果您正苦于以下问题:PHP wfUtils::getWPVersion方法的具体用法?PHP wfUtils::getWPVersion怎么用?PHP wfUtils::getWPVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在wfUtils的用法示例。


在下文中一共展示了wfUtils::getWPVersion方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 public function __construct()
 {
     $this->startTime = time();
     $this->maxExecTime = self::getMaxExecutionTime();
     $this->i = new wfIssues();
     $this->cycleStartTime = time();
     $this->wp_version = wfUtils::getWPVersion();
     $this->apiKey = wfConfig::get('apiKey');
     $this->api = new wfAPI($this->apiKey, $this->wp_version);
     include 'wfDict.php';
     //$dictWords
     $this->dictWords = $dictWords;
     $this->jobList[] = 'publicSite';
     $this->jobList[] = 'checkSpamvertized';
     $this->jobList[] = 'checkSpamIP';
     $this->jobList[] = 'heartbleed';
     $this->jobList[] = 'knownFiles_init';
     $this->jobList[] = 'knownFiles_main';
     $this->jobList[] = 'knownFiles_finish';
     foreach (array('knownFiles', 'fileContents', 'database', 'posts', 'comments', 'passwds', 'dns', 'diskSpace', 'oldVersions') as $scanType) {
         if (wfConfig::get('scansEnabled_' . $scanType)) {
             if (method_exists($this, 'scan_' . $scanType . '_init')) {
                 foreach (array('init', 'main', 'finish') as $op) {
                     $this->jobList[] = $scanType . '_' . $op;
                 }
             } else {
                 if (method_exists($this, 'scan_' . $scanType)) {
                     $this->jobList[] = $scanType;
                 }
             }
         }
     }
 }
开发者ID:rinodung,项目名称:myfreetheme,代码行数:33,代码来源:wfScanEngine.php

示例2: verifyCrawlerPTR

 public static function verifyCrawlerPTR($hostPattern, $IP)
 {
     global $wpdb;
     $table = $wpdb->base_prefix . 'wfCrawlers';
     $db = new wfDB();
     $IPn = wfUtils::inet_aton($IP);
     $status = $db->querySingle("select status from {$table} where IP=%s and patternSig=UNHEX(MD5('%s')) and lastUpdate > unix_timestamp() - %d", $IPn, $hostPattern, WORDFENCE_CRAWLER_VERIFY_CACHE_TIME);
     if ($status) {
         if ($status == 'verified') {
             return true;
         } else {
             return false;
         }
     }
     $wfLog = new wfLog(wfConfig::get('apiKey'), wfUtils::getWPVersion());
     $host = wfUtils::reverseLookup($IP);
     if (!$host) {
         $db->queryWrite("insert into {$table} (IP, patternSig, status, lastUpdate, PTR) values (%s, UNHEX(MD5('%s')), '%s', unix_timestamp(), '%s') ON DUPLICATE KEY UPDATE status='%s', lastUpdate=unix_timestamp(), PTR='%s'", $IPn, $hostPattern, 'noPTR', '', 'noPTR', '');
         return false;
     }
     if (preg_match($hostPattern, $host)) {
         $resultIPs = gethostbynamel($host);
         $addrsMatch = false;
         foreach ($resultIPs as $resultIP) {
             if ($resultIP == $IP) {
                 $addrsMatch = true;
                 break;
             }
         }
         if ($addrsMatch) {
             $db->queryWrite("insert into {$table} (IP, patternSig, status, lastUpdate, PTR) values (%s, UNHEX(MD5('%s')), '%s', unix_timestamp(), '%s') ON DUPLICATE KEY UPDATE status='%s', lastUpdate=unix_timestamp(), PTR='%s'", $IPn, $hostPattern, 'verified', $host, 'verified', $host);
             return true;
         } else {
             $db->queryWrite("insert into {$table} (IP, patternSig, status, lastUpdate, PTR) values (%s, UNHEX(MD5('%s')), '%s', unix_timestamp(), '%s') ON DUPLICATE KEY UPDATE status='%s', lastUpdate=unix_timestamp(), PTR='%s'", $IPn, $hostPattern, 'fwdFail', $host, 'fwdFail', $host);
             return false;
         }
     } else {
         $db->queryWrite("insert into {$table} (IP, patternSig, status, lastUpdate, PTR) values (%s, UNHEX(MD5('%s')), '%s', unix_timestamp(), '%s') ON DUPLICATE KEY UPDATE status='%s', lastUpdate=unix_timestamp(), PTR='%s'", $IPn, $hostPattern, 'badPTR', $host, 'badPTR', $host);
         return false;
     }
 }
开发者ID:HandsomeDogStudio,项目名称:peanutbutterplan,代码行数:41,代码来源:wfCrawl.php

示例3: downgrade_license

 public function downgrade_license()
 {
     $api = new wfAPI('', wfUtils::getWPVersion());
     $return = array();
     try {
         $keyData = $api->call('get_anon_api_key');
         if ($keyData['ok'] && $keyData['apiKey']) {
             wfConfig::set('apiKey', $keyData['apiKey']);
             wfConfig::set('isPaid', 0);
             $return['apiKey'] = $keyData['apiKey'];
             $return['isPaid'] = 0;
             //When downgrading we must disable all two factor authentication because it can lock an admin out if we don't.
             wfConfig::set_ser('twoFactorUsers', array());
         } else {
             throw new Exception('Could not understand the response we received from the Wordfence servers when applying for a free API key.');
         }
     } catch (Exception $e) {
         $return['errorMsg'] = 'Could not fetch free API key from Wordfence: ' . htmlentities($e->getMessage());
         return $return;
     }
     $return['ok'] = 1;
     return $return;
 }
开发者ID:jexmex,项目名称:mainwp-child,代码行数:23,代码来源:class-mainwp-child-wordfence.php

示例4: getIPsGeo

 public static function getIPsGeo($IPs)
 {
     //works with int or dotted. Outputs same format it receives.
     $IPs = array_unique($IPs);
     $toResolve = array();
     $db = new wfDB();
     global $wpdb;
     $locsTable = $wpdb->base_prefix . 'wfLocs';
     $IPLocs = array();
     foreach ($IPs as $IP) {
         $isBinaryIP = !self::isValidIP($IP);
         if ($isBinaryIP) {
             $ip_printable = wfUtils::inet_ntop($IP);
             $ip_bin = $IP;
         } else {
             $ip_printable = $IP;
             $ip_bin = wfUtils::inet_pton($IP);
         }
         $row = $db->querySingleRec("select IP, ctime, failed, city, region, countryName, countryCode, lat, lon, unix_timestamp() - ctime as age from " . $locsTable . " where IP=%s", $ip_bin);
         if ($row) {
             if ($row['age'] > WORDFENCE_MAX_IPLOC_AGE) {
                 $db->queryWrite("delete from " . $locsTable . " where IP=%s", $row['IP']);
             } else {
                 if ($row['failed'] == 1) {
                     $IPLocs[$ip_printable] = false;
                 } else {
                     $row['IP'] = self::inet_ntop($row['IP']);
                     $IPLocs[$ip_printable] = $row;
                 }
             }
         }
         if (!isset($IPLocs[$ip_printable])) {
             $toResolve[] = $ip_printable;
         }
     }
     if (sizeof($toResolve) > 0) {
         $api = new wfAPI(wfConfig::get('apiKey'), wfUtils::getWPVersion());
         try {
             $freshIPs = $api->call('resolve_ips', array(), array('ips' => implode(',', $toResolve)));
             if (is_array($freshIPs)) {
                 foreach ($freshIPs as $IP => $value) {
                     $IP_bin = wfUtils::inet_pton($IP);
                     if ($value == 'failed') {
                         $db->queryWrite("insert IGNORE into " . $locsTable . " (IP, ctime, failed) values (%s, unix_timestamp(), 1)", $IP_bin);
                         $IPLocs[$IP] = false;
                     } else {
                         if (is_array($value)) {
                             for ($i = 0; $i <= 5; $i++) {
                                 //Prevent warnings in debug mode about uninitialized values
                                 if (!isset($value[$i])) {
                                     $value[$i] = '';
                                 }
                             }
                             $db->queryWrite("insert IGNORE into " . $locsTable . " (IP, ctime, failed, city, region, countryName, countryCode, lat, lon) values (%s, unix_timestamp(), 0, '%s', '%s', '%s', '%s', %s, %s)", $IP_bin, $value[3], $value[2], $value[1], $value[0], $value[4], $value[5]);
                             $IPLocs[$IP] = array('IP' => $IP, 'city' => $value[3], 'region' => $value[2], 'countryName' => $value[1], 'countryCode' => $value[0], 'lat' => $value[4], 'lon' => $value[5]);
                         }
                     }
                 }
             }
         } catch (Exception $e) {
             wordfence::status(2, 'error', "Call to Wordfence API to resolve IPs failed: " . $e->getMessage());
             return array();
         }
     }
     return $IPLocs;
 }
开发者ID:VizualAbstract,项目名称:Marilyn,代码行数:66,代码来源:wfUtils.php

示例5: ajax_permanentlyBlockAllIPs_callback

    /**
     * Permanently blocks all temporarily locked out IPs.
     */
    public static function ajax_permanentlyBlockAllIPs_callback()
    {
        /** @var wpdb $wpdb */
        global $wpdb;
        $IPs = array();
        $type = !empty($_REQUEST['type']) ? $_REQUEST['type'] : null;
        $reason = !empty($_REQUEST['reason']) ? $_REQUEST['reason'] : 'Manual block by administrator';
        switch ($type) {
            case 'throttled':
                $IPs = $wpdb->get_col('SELECT DISTINCT IP FROM ' . $wpdb->base_prefix . 'wfThrottleLog');
                break;
            case 'lockedOut':
                $lockoutSecs = wfConfig::get('loginSec_lockoutMins') * 60;
                $IPs = $wpdb->get_col($wpdb->prepare('SELECT DISTINCT IP FROM ' . $wpdb->base_prefix . 'wfLockedOut
				WHERE blockedTime + %d > UNIX_TIMESTAMP()', $lockoutSecs));
                break;
            case 'blocked':
                $blockedTime = wfConfig::get('blockedTime');
                $IPs = $wpdb->get_col($wpdb->prepare('SELECT DISTINCT IP FROM ' . $wpdb->base_prefix . 'wfBlocks
				WHERE wfsn = 0
				AND permanent = 0
				AND blockedTime + %d > UNIX_TIMESTAMP()', $blockedTime));
                break;
        }
        $log = new wfLog(wfConfig::get('apiKey'), wfUtils::getWPVersion());
        if ($IPs && is_array($IPs)) {
            foreach ($IPs as $IP) {
                $log->blockIP(wfUtils::inet_ntop($IP), $reason, false, true);
            }
        }
        switch ($type) {
            case 'lockedOut':
                if ($IPs) {
                    foreach ($IPs as &$IP) {
                        $IP = $wpdb->prepare('%s', $IP);
                    }
                    $wpdb->query('DELETE FROM ' . $wpdb->base_prefix . 'wfLockedOut WHERE IP IN (' . join(', ', $IPs) . ')');
                }
                break;
        }
        return array('ok' => 1);
    }
开发者ID:ashenkar,项目名称:sanga,代码行数:45,代码来源:wordfenceClass.php

示例6: __construct

 public function __construct()
 {
     $this->api = new wfAPI(wfConfig::get('apiKey'), wfUtils::getWPVersion());
 }
开发者ID:adamplabarge,项目名称:bermstyle,代码行数:4,代码来源:wfUpdateCheck.php

示例7: updateBlockedIPs

 /**
  * @param $action
  * @return bool|string|void
  */
 public static function updateBlockedIPs($action)
 {
     //'add' or 'remove'
     if (wfConfig::get('cacheType') != 'falcon') {
         return;
     }
     $htaccessPath = self::getHtaccessPath();
     if (!$htaccessPath) {
         return "Wordfence could not find your .htaccess file.";
     }
     if ($action == 'remove') {
         $fh = @fopen($htaccessPath, 'r+');
         if (!$fh) {
             $err = error_get_last();
             return $err['message'];
         }
         flock($fh, LOCK_EX);
         fseek($fh, 0, SEEK_SET);
         //start of file
         clearstatcache();
         $contents = @fread($fh, filesize($htaccessPath));
         if (!$contents) {
             fclose($fh);
             return "Could not read from {$htaccessPath}";
         }
         $contents = preg_replace('/#WFIPBLOCKS.*WFIPBLOCKS[r\\s\\n\\t]*/s', '', $contents);
         ftruncate($fh, 0);
         fseek($fh, 0, SEEK_SET);
         @fwrite($fh, $contents);
         flock($fh, LOCK_UN);
         fclose($fh);
         return false;
     } else {
         if ($action == 'add') {
             $fh = @fopen($htaccessPath, 'r+');
             if (!$fh) {
                 $err = error_get_last();
                 return $err['message'];
             }
             $lines = array();
             $wfLog = new wfLog(wfConfig::get('apiKey'), wfUtils::getWPVersion());
             $IPs = $wfLog->getBlockedIPsAddrOnly();
             if (sizeof($IPs) > 0) {
                 foreach ($IPs as $IP) {
                     $lines[] = "Deny from {$IP}\n";
                 }
             }
             $ranges = $wfLog->getRangesBasic();
             $browserAdded = false;
             $browserLines = array();
             if ($ranges) {
                 foreach ($ranges as $r) {
                     $arr = explode('|', $r);
                     $range = isset($arr[0]) ? $arr[0] : false;
                     $browser = isset($arr[1]) ? $arr[1] : false;
                     $referer = isset($arr[2]) ? $arr[2] : false;
                     if ($range) {
                         if ($browser || $referer) {
                             continue;
                         }
                         //We don't allow combos in falcon
                         list($start_range, $end_range) = explode('-', $range);
                         if (preg_match('/[\\.:]/', $start_range)) {
                             $start_range = wfUtils::inet_pton($start_range);
                             $end_range = wfUtils::inet_pton($end_range);
                         } else {
                             $start_range = wfUtils::inet_pton(long2ip($start_range));
                             $end_range = wfUtils::inet_pton(long2ip($end_range));
                         }
                         $cidrs = wfUtils::rangeToCIDRs($start_range, $end_range);
                         $hIPs = wfUtils::inet_ntop($start_range) . ' - ' . wfUtils::inet_ntop($end_range);
                         if (sizeof($cidrs) > 0) {
                             $lines[] = '#Start of blocking code for IP range: ' . $hIPs . "\n";
                             foreach ($cidrs as $c) {
                                 $lines[] = "Deny from {$c}\n";
                             }
                             $lines[] = '#End of blocking code for IP range: ' . $hIPs . "\n";
                         }
                     } else {
                         if ($browser) {
                             if ($range || $referer) {
                                 continue;
                             }
                             $browserLines[] = "\t#Blocking code for browser pattern: {$browser}\n";
                             $browser = preg_replace('/([\\-\\_\\.\\+\\!\\@\\#\\$\\%\\^\\&\\(\\)\\[\\]\\{\\}\\/])/', "\\\\\$1", $browser);
                             $browser = preg_replace('/\\*/', '.*', $browser);
                             $browserLines[] = "\tSetEnvIf User-Agent " . $browser . " WordfenceBadBrowser=1\n";
                             $browserAdded = true;
                         } else {
                             if ($referer) {
                                 if ($browser || $range) {
                                     continue;
                                 }
                                 $browserLines[] = "\t#Blocking code for referer pattern: {$referer}\n";
                                 $referer = preg_replace('/([\\-\\_\\.\\+\\!\\@\\#\\$\\%\\^\\&\\(\\)\\[\\]\\{\\}\\/])/', "\\\\\$1", $referer);
                                 $referer = preg_replace('/\\*/', '.*', $referer);
//.........这里部分代码省略.........
开发者ID:rebekahford,项目名称:testgcu,代码行数:101,代码来源:wfCache.php

示例8: getLog

 public static function getLog()
 {
     if (!self::$wfLog) {
         $wfLog = new wfLog(wfConfig::get('apiKey'), wfUtils::getWPVersion());
         self::$wfLog = $wfLog;
     }
     return self::$wfLog;
 }
开发者ID:rinodung,项目名称:myfreetheme,代码行数:8,代码来源:wordfenceClass.php

示例9: processGetHitsResults

 /**
  * @param string $type
  * @param array $results
  * @throws Exception
  */
 public function processGetHitsResults($type, &$results)
 {
     $serverTime = $this->getDB()->querySingle("select unix_timestamp()");
     $this->resolveIPs($results);
     $ourURL = parse_url(site_url());
     $ourHost = strtolower($ourURL['host']);
     $ourHost = preg_replace('/^www\\./i', '', $ourHost);
     $browscap = new wfBrowscap();
     $advanced_blocking_results = $this->getDB()->querySelect('SELECT * FROM ' . $this->ipRangesTable);
     $advanced_blocking = array();
     foreach ($advanced_blocking_results as $advanced_blocking_row) {
         list($blocked_range) = explode('|', $advanced_blocking_row['blockString']);
         $blocked_range = explode('-', $blocked_range);
         if (count($blocked_range) == 2) {
             // Still using v5 32 bit int style format.
             if (!preg_match('/[\\.:]/', $blocked_range[0])) {
                 $blocked_range[0] = long2ip($blocked_range[0]);
                 $blocked_range[1] = long2ip($blocked_range[1]);
             }
             $advanced_blocking[] = array(wfUtils::inet_pton($blocked_range[0]), wfUtils::inet_pton($blocked_range[1]), $advanced_blocking_row['id']);
         }
     }
     foreach ($results as &$res) {
         $res['type'] = $type;
         $res['timeAgo'] = wfUtils::makeTimeAgo($serverTime - $res['ctime']);
         $res['blocked'] = $this->getDB()->querySingle("select blockedTime from " . $this->blocksTable . " where IP=%s and (permanent = 1 OR (blockedTime + %s > unix_timestamp()))", $res['IP'], wfConfig::get('blockedTime'));
         $res['rangeBlocked'] = false;
         $res['ipRangeID'] = -1;
         foreach ($advanced_blocking as $advanced_blocking_row) {
             if (strcmp($res['IP'], $advanced_blocking_row[0]) >= 0 && strcmp($res['IP'], $advanced_blocking_row[1]) <= 0) {
                 $res['rangeBlocked'] = true;
                 $res['ipRangeID'] = $advanced_blocking_row[2];
                 break;
             }
         }
         $res['IP'] = wfUtils::inet_ntop($res['IP']);
         $res['extReferer'] = false;
         if (isset($res['referer']) && $res['referer']) {
             if (wfUtils::hasXSS($res['referer'])) {
                 //filtering out XSS
                 $res['referer'] = '';
             }
         }
         if (isset($res['referer']) && $res['referer']) {
             $refURL = parse_url($res['referer']);
             if (is_array($refURL) && isset($refURL['host']) && $refURL['host']) {
                 $refHost = strtolower(preg_replace('/^www\\./i', '', $refURL['host']));
                 if ($refHost != $ourHost) {
                     $res['extReferer'] = true;
                     //now extract search terms
                     $q = false;
                     if (preg_match('/(?:google|bing|alltheweb|aol|ask)\\./i', $refURL['host'])) {
                         $q = 'q';
                     } else {
                         if (stristr($refURL['host'], 'yahoo.')) {
                             $q = 'p';
                         } else {
                             if (stristr($refURL['host'], 'baidu.')) {
                                 $q = 'wd';
                             }
                         }
                     }
                     if ($q) {
                         $queryVars = array();
                         if (isset($refURL['query'])) {
                             parse_str($refURL['query'], $queryVars);
                             if (isset($queryVars[$q])) {
                                 $res['searchTerms'] = urlencode($queryVars[$q]);
                             }
                         }
                     }
                 }
             }
             if ($res['extReferer']) {
                 if (isset($referringPage) && stristr($referringPage['host'], 'google.')) {
                     parse_str($referringPage['query'], $queryVars);
                     // echo $queryVars['q']; // This is the search term used
                 }
             }
         }
         $res['browser'] = false;
         if ($res['UA']) {
             $b = $browscap->getBrowser($res['UA']);
             if ($b && $b['Parent'] != 'DefaultProperties') {
                 $res['browser'] = array('browser' => !empty($b['Browser']) ? $b['Browser'] : "", 'version' => !empty($b['Version']) ? $b['Version'] : "", 'platform' => !empty($b['Platform']) ? $b['Platform'] : "", 'isMobile' => !empty($b['isMobileDevice']) ? $b['isMobileDevice'] : "", 'isCrawler' => !empty($b['Crawler']) ? $b['Crawler'] : "");
             } else {
                 $log = new wfLog(wfConfig::get('apiKey'), wfUtils::getWPVersion());
                 $IP = wfUtils::getIP();
                 $res['browser'] = array('isCrawler' => !(isset($_COOKIE['wordfence_verifiedHuman']) && $log->validateVerifiedHumanCookie($_COOKIE['wordfence_verifiedHuman'], $res['UA'], $IP)) ? 'true' : '');
             }
         }
         if ($res['userID']) {
             $ud = get_userdata($res['userID']);
             if ($ud) {
                 $res['user'] = array('editLink' => wfUtils::editUserLink($res['userID']), 'display_name' => $res['display_name'], 'ID' => $res['userID']);
//.........这里部分代码省略.........
开发者ID:AmerisFCI,项目名称:AmerisWordpress,代码行数:101,代码来源:wfLog.php

示例10: foreach

    ?>
<p>Critical Problems:</p>

<?php 
    foreach ($issues as $i) {
        if ($i['severity'] == 1) {
            ?>
<p>* <?php 
            echo htmlspecialchars($i['shortMsg']);
            ?>
</p>
<?php 
            if (!empty($i['tmplData']['badURL'])) {
                ?>
<p><img src="<?php 
                echo sprintf("http://noc1.wordfence.com/v2.14/?v=%s&s=%s&k=%s&action=image&txt=%s", rawurlencode(wfUtils::getWPVersion()), rawurlencode(home_url()), rawurlencode(wfConfig::get('apiKey')), rawurlencode(base64_encode($i['tmplData']['badURL'])));
                ?>
" alt="" /></p>
<?php 
            }
            ?>

<?php 
        }
    }
}
?>

<?php 
if ($level == 2 && $totalWarningIssues > 0) {
    ?>
开发者ID:pcuervo,项目名称:wp-carnival,代码行数:31,代码来源:email_newIssues.php

示例11: http_build_query

            if (isset($i['tmplData']['wpURL'])) {
                ?>
<p><?php 
                if ($i['tmplData']['vulnerabilityPatched']) {
                    ?>
<strong>Update includes security-related fixes.</strong> <?php 
                }
                echo $i['tmplData']['wpURL'];
                ?>
/changelog</p>
<?php 
            }
            if (!empty($i['tmplData']['badURL'])) {
                ?>
<p><img src="<?php 
                echo WORDFENCE_API_URL_BASE_NONSEC . "?" . http_build_query(array('v' => wfUtils::getWPVersion(), 's' => home_url(), 'k' => wfConfig::get('apiKey'), 'action' => 'image', 'txt' => base64_encode($i['tmplData']['badURL'])), '', '&');
                ?>
" alt="" /></p>
<?php 
            }
            ?>

<?php 
        }
    }
}
?>

<?php 
if ($level == 2 && $totalWarningIssues > 0) {
    ?>
开发者ID:GafaMX,项目名称:operaciondespierta.org,代码行数:31,代码来源:email_newIssues.php

示例12: verifyGooglebotViaNOC1

 /**
  * @param string|null $ip
  * @return bool
  */
 public static function verifyGooglebotViaNOC1($ip = null)
 {
     global $wpdb;
     $table = $wpdb->base_prefix . 'wfCrawlers';
     if ($ip === null) {
         $ip = wfUtils::getIP();
     }
     $db = new wfDB();
     $IPn = wfUtils::inet_pton($ip);
     $patternSig = 'googlenoc1';
     $status = $db->querySingle("select status from {$table}\n\t\t\t\twhere IP=%s\n\t\t\t\tand patternSig=UNHEX(MD5('%s'))\n\t\t\t\tand lastUpdate > unix_timestamp() - %d", $IPn, $patternSig, WORDFENCE_CRAWLER_VERIFY_CACHE_TIME);
     if ($status === 'verified') {
         return true;
     } else {
         if ($status === 'fakeBot') {
             return false;
         }
     }
     $api = new wfAPI(wfConfig::get('apiKey'), wfUtils::getWPVersion());
     try {
         $data = $api->call('verify_googlebot', array('ip' => $ip));
         if (is_array($data) && !empty($data['verified'])) {
             // Cache results
             $db->queryWrite("insert into {$table} (IP, patternSig, status, lastUpdate)\nvalues (%s, UNHEX(MD5('%s')), '%s', unix_timestamp())\nON DUPLICATE KEY UPDATE status='%3\$s', lastUpdate=unix_timestamp()", $IPn, $patternSig, 'verified');
             return true;
         } else {
             $db->queryWrite("insert into {$table} (IP, patternSig, status, lastUpdate)\nvalues (%s, UNHEX(MD5('%s')), '%s', unix_timestamp())\nON DUPLICATE KEY UPDATE status='%3\$s', lastUpdate=unix_timestamp()", $IPn, $patternSig, 'fakeBot');
         }
     } catch (Exception $e) {
         // Do nothing, bail
     }
     return false;
 }
开发者ID:arobbins,项目名称:davis,代码行数:37,代码来源:wfCrawl.php

示例13: synchronizeConfigSettings

 public static function synchronizeConfigSettings()
 {
     if (!class_exists('wfConfig')) {
         // Ensure this is only called when WordPress and the plugin are fully loaded
         return;
     }
     static $isSynchronizing = false;
     if ($isSynchronizing) {
         return;
     }
     $isSynchronizing = true;
     global $wpdb;
     $db = new wfDB();
     // Pattern Blocks
     $r1 = $db->querySelect("SELECT id, blockType, blockString FROM {$wpdb->base_prefix}wfBlocksAdv");
     $patternBlocks = array();
     foreach ($r1 as $blockRec) {
         if ($blockRec['blockType'] == 'IU') {
             $bDat = explode('|', $blockRec['blockString']);
             $ipRange = isset($bDat[0]) ? $bDat[0] : '';
             $uaPattern = isset($bDat[1]) ? $bDat[1] : '';
             $refPattern = isset($bDat[2]) ? $bDat[2] : '';
             $hostnamePattern = isset($bDat[3]) ? $bDat[3] : '';
             $patternBlocks[] = array('id' => $blockRec['id'], 'ipRange' => $ipRange, 'hostnamePattern' => $hostnamePattern, 'uaPattern' => $uaPattern, 'refPattern' => $refPattern);
         }
     }
     // Country Blocks
     $wfLog = new wfLog(wfConfig::get('apiKey'), wfUtils::getWPVersion());
     $cblCookie = $wfLog->getCBLCookieVal();
     //Ensure we have the bypass cookie option set
     $countryBlocks = array();
     $countryBlocks['action'] = wfConfig::get('cbl_action', false);
     $countryBlocks['loggedInBlocked'] = wfConfig::get('cbl_loggedInBlocked', false);
     $countryBlocks['loginFormBlocked'] = wfConfig::get('cbl_loginFormBlocked', false);
     $countryBlocks['restOfSiteBlocked'] = wfConfig::get('cbl_restOfSiteBlocked', false);
     $countryBlocks['bypassRedirURL'] = wfConfig::get('cbl_bypassRedirURL', '');
     $countryBlocks['bypassRedirDest'] = wfConfig::get('cbl_bypassRedirDest', '');
     $countryBlocks['bypassViewURL'] = wfConfig::get('cbl_bypassViewURL', '');
     $countryBlocks['redirURL'] = wfConfig::get('cbl_redirURL', '');
     $countryBlocks['countries'] = explode(',', wfConfig::get('cbl_countries', ''));
     $countryBlocks['cookieVal'] = $cblCookie;
     //Other Blocks
     $otherBlocks = array('blockedTime' => wfConfig::get('blockedTime', 0));
     $otherBlockEntries = $db->querySelect("SELECT IP, blockedTime, reason, permanent, wfsn FROM {$wpdb->base_prefix}wfBlocks WHERE permanent = 1 OR (blockedTime + %d > unix_timestamp())", $otherBlocks['blockedTime']);
     $otherBlocks['blocks'] = is_array($otherBlockEntries) ? $otherBlockEntries : array();
     foreach ($otherBlocks['blocks'] as &$b) {
         $b['IP'] = base64_encode($b['IP']);
     }
     // Save it
     try {
         $patternBlocksJSON = wfWAFUtils::json_encode($patternBlocks);
         wfWAF::getInstance()->getStorageEngine()->setConfig('patternBlocks', $patternBlocksJSON);
         $countryBlocksJSON = wfWAFUtils::json_encode($countryBlocks);
         wfWAF::getInstance()->getStorageEngine()->setConfig('countryBlocks', $countryBlocksJSON);
         $otherBlocksJSON = wfWAFUtils::json_encode($otherBlocks);
         wfWAF::getInstance()->getStorageEngine()->setConfig('otherBlocks', $otherBlocksJSON);
         wfWAF::getInstance()->getStorageEngine()->setConfig('advancedBlockingEnabled', wfConfig::get('firewallEnabled'));
         wfWAF::getInstance()->getStorageEngine()->setConfig('disableWAFIPBlocking', wfConfig::get('disableWAFIPBlocking'));
     } catch (Exception $e) {
         // Do nothing
     }
     $isSynchronizing = false;
 }
开发者ID:Jerram-Marketing,项目名称:Gummer-Co,代码行数:63,代码来源:wfWAFIPBlocksController.php


注:本文中的wfUtils::getWPVersion方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。