Version 5.0.0 beta 1
This commit is contained in:
1 parent
25ddeb65d6
commit
15c7beabc5
6736 files changed
+627902
-497943
No files matched your search
@@ -12,24 +12,33 @@
|
||||
namespace IPS\{app}\extensions\core\IpAddresses;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
use IPS\Db;
|
||||
use IPS\Db\Select;
|
||||
use IPS\Extensions\IpAddressesAbstract;
|
||||
use IPS\Helpers\Table\Db as TableDb;
|
||||
use IPS\Http\Url;
|
||||
use IPS\Member as MemberClass;
|
||||
use function defined;
|
||||
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
header( ( $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* IP Address Lookup extension
|
||||
*/
|
||||
class _{class}
|
||||
class {class} extends IpAddressesAbstract
|
||||
{
|
||||
/**
|
||||
* Removes the logged IP address
|
||||
*
|
||||
* @param int $timestamp
|
||||
* @param int $time
|
||||
* @return void
|
||||
*/
|
||||
public function pruneIpAddresses(int $time)
|
||||
public function pruneIpAddresses( int $time ) : void
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -60,20 +69,20 @@ class _{class}
|
||||
* 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
|
||||
* @param Url|null $baseUrl URL table will be displayed on or NULL to return a count
|
||||
* @return string|int|null
|
||||
*/
|
||||
public function findByIp( $ip, \IPS\Http\Url $baseUrl = NULL )
|
||||
public function findByIp( string $ip, ?Url $baseUrl = NULL ): string|int|null
|
||||
{
|
||||
/* Return count */
|
||||
if ( $baseUrl === NULL )
|
||||
{
|
||||
return \IPS\Db::i()->select( 'COUNT(*)', 'database_table_name', array( "ip_address LIKE ?", $ip ) )->first();
|
||||
return 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 ) );
|
||||
$table = new TableDb( 'database_table_name', $baseUrl, array( "ip_address LIKE ?", $ip ) );
|
||||
|
||||
/* Return */
|
||||
return (string) $table;
|
||||
@@ -93,10 +102,10 @@ class _{class}
|
||||
...
|
||||
);
|
||||
* @endcode
|
||||
* @param \IPS\Member $member The member
|
||||
* @return array|NULL
|
||||
* @param MemberClass $member The member
|
||||
* @return array|Select
|
||||
*/
|
||||
public function findByMember( $member )
|
||||
public function findByMember( MemberClass $member ): array|Select
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user