Invision Power Services, Inc. * @copyright (c) Invision Power Services, Inc. * @license https://www.invisioncommunity.com/legal/standards/ * @package Invision Community {subpackage} * @since {date} */ namespace IPS\{app}\extensions\core\IpAddresses; /* To prevent PHP errors (extending class does not exist) revealing path */ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) ) { header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' ); exit; } /** * IP Address Lookup extension */ class _{class} { /** * Supported in the ACP IP address lookup tool? * * @return bool * @note If the method does not exist in an extension, the result is presumed to be TRUE */ public function supportedInAcp() { return TRUE; } /** * Supported in the ModCP IP address lookup tool? * * @return bool * @note If the method does not exist in an extension, the result is presumed to be TRUE */ public function supportedInModCp() { return TRUE; } /** * Find Records by IP * * @param string $ip The IP Address * @param \IPS\Http\Url $baseUrl URL table will be displayed on or NULL to return a count * @return \IPS\Helpers\Table|int|null */ public function findByIp( $ip, \IPS\Http\Url $baseUrl = NULL ) { /* Return count */ if ( $baseUrl === NULL ) { return \IPS\Db::i()->select( 'COUNT(*)', 'database_table_name', array( "ip_address LIKE ?", $ip ) )->first(); } /* Init Table */ // Replace database_table_name with the database table $table = new \IPS\Helpers\Table\Db( 'database_table_name', $baseUrl, array( "ip_address LIKE ?", $ip ) ); /* Return */ return (string) $table; } /** * Find IPs by Member * * @code return array( '::1' => array( 'ip' => '::1'// string (IP Address) 'count' => ... // int (number of times this member has used this IP) 'first' => ... // int (timestamp of first use) 'last' => ... // int (timestamp of most recent use) ), ... ); * @endcode * @param \IPS\Member $member The member * @return array|NULL */ public function findByMember( $member ) { return array(); } }