_cfm = new classFileManagement(); /* XML */ require_once( IPS_KERNEL_PATH . 'classXML.php' ); $this->_xml = new classXML('utf-8'); } /** * Set a frequency * * @access public * @param int * @return void */ public function setFrequency( $f ) { $this->_minF = $f; } /** * Check to see if IP address is blacklisted * * @access public * @param string IP Address * @return boolean TRUE = blacklisted, FALSE = clean */ public function checkForIpAddress( $ip ) { $result = $this->_cfm->getFileContents( "http://www.stopforumspam.com/api?ip=" . $ip ); /* We're only interested in this, currently */ if ( $result ) { $this->_xml->loadXML( $result ); foreach( $this->_xml->fetchElements( 'response' ) as $_el ) { $data = $this->_xml->fetchElementsFromRecord( $_el ); if ( $data['appears'] AND intval( $data['frequency'] ) > $this->_minF ) { return TRUE; } } } return FALSE; } /** * Check to see if email address is blacklisted * * @access public * @param string Email address * @return boolean TRUE = blacklisted, FALSE = clean */ public function checkForEmailAddress( $email ) { $result = $this->_cfm->getFileContents( "http://www.stopforumspam.com/api?email=" . $email ); /* We're only interested in this, currently */ if ( $result ) { $this->_xml->loadXML( $result ); foreach( $this->_xml->fetchElements( 'response' ) as $_el ) { $data = $this->_xml->fetchElementsFromRecord( $_el ); if ( $data['appears'] AND intval( $data['frequency'] ) > $this->_minF ) { return TRUE; } } } return FALSE; } }