Esempio n. 1
0
 /**
  * Black or whitelist or remove from both an IP address from commenting
  *
  * @param  array    $comment    The comment array from the database
  * @return null
  */
 public static function moderateIp($ipAddress, $blackOrWhiteList)
 {
     if ($blackOrWhiteList === 'whitelist') {
         \Kanso\Comments\Spam\SpamProtector::appendToDictionary($ipAddress, 'whitelist_ip');
         \Kanso\Comments\Spam\SpamProtector::removeFromDictionary($ipAddress, 'blacklist_ip');
     } else {
         if ($blackOrWhiteList === 'blacklist') {
             \Kanso\Comments\Spam\SpamProtector::appendToDictionary($ipAddress, 'blacklist_ip');
             \Kanso\Comments\Spam\SpamProtector::removeFromDictionary($ipAddress, 'whitelist_ip');
         } else {
             if ($blackOrWhiteList === 'nolist') {
                 \Kanso\Comments\Spam\SpamProtector::removeFromDictionary($ipAddress, 'blacklist_ip');
                 \Kanso\Comments\Spam\SpamProtector::removeFromDictionary($ipAddress, 'whitelist_ip');
             }
         }
     }
 }