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,28 +12,26 @@
|
||||
namespace IPS\nexus\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\Http\Url;
|
||||
use IPS\Member;
|
||||
use IPS\nexus\Transaction;
|
||||
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 _Transactions
|
||||
class Transactions extends IpAddressesAbstract
|
||||
{
|
||||
/**
|
||||
* 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?
|
||||
*
|
||||
@@ -49,18 +47,18 @@ class _Transactions
|
||||
* 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|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(*)', 'nexus_transactions', array( "t_ip LIKE ?", $ip ) )->first();
|
||||
return Db::i()->select( 'COUNT(*)', 'nexus_transactions', array( "t_ip LIKE ?", $ip ) )->first();
|
||||
}
|
||||
|
||||
$table = \IPS\nexus\Transaction::table( array( array( "t_ip LIKE ?", $ip ) ), $baseUrl );
|
||||
$table = Transaction::table( array( array( "t_ip LIKE ?", $ip ) ), $baseUrl );
|
||||
$table->include[] = 't_ip';
|
||||
|
||||
return (string) $table;
|
||||
@@ -80,11 +78,11 @@ class _Transactions
|
||||
...
|
||||
);
|
||||
* @endcode
|
||||
* @param \IPS\Member $member The member
|
||||
* @return array|NULL
|
||||
* @param Member $member The member
|
||||
* @return array|Select
|
||||
*/
|
||||
public function findByMember( $member )
|
||||
public function findByMember( Member $member ): array|Select
|
||||
{
|
||||
return \IPS\Db::i()->select( "t_ip AS ip, count(*) AS count, MIN(t_date) AS first, MAX(t_date) AS last", 'nexus_transactions', array( "t_member=?", $member->member_id ), NULL, NULL, "t_ip" )->setKeyField( 'ip' );
|
||||
return Db::i()->select( "t_ip AS ip, count(*) AS count, MIN(t_date) AS first, MAX(t_date) AS last", 'nexus_transactions', array( "t_member=?", $member->member_id ), NULL, NULL, "t_ip" )->setKeyField( 'ip' );
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user