Serving a payment option for my minecraft server so I don't have to pay for it all alone
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

MinecraftUser.class.php 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. /**
  3. * @Name minecraft_user
  4. * @Unique Username
  5. */
  6. class MinecraftUser extends Entity {
  7. /**
  8. * @DB-Column
  9. * @Name ID
  10. * @Type INT
  11. * @Primary
  12. * @AutoIncrement
  13. * @NotNull
  14. */
  15. public $ID;
  16. /**
  17. * @DB-Column
  18. * @Name Username
  19. * @Type VARCHAR(256)
  20. * @NotNull
  21. * @Pattern /^[a-zA-Z0-9_]{3,16}$/
  22. * @Pattern-Missmatch-Comment [ 'de' => 'Der Benutzername ist nur 3-16 Zeichen lang und enth&auml;lt a-z, A-Z, 0-9, _', 'en' => 'The Username is only 3-16 chars long and contains only a-z, A-Z, 0-9, _' ]
  23. */
  24. public $Username;
  25. /**
  26. * @DB-Relation
  27. * @Field ID
  28. * @FieldName SubscriptionID
  29. * @OneToMany
  30. * @OnUpdate CASCADE
  31. * @OnDelete CASCADE
  32. * @var MinecraftServer[]
  33. */
  34. public $Subscriptions;
  35. /**
  36. * @DB-Relation
  37. * @Field ID
  38. * @FieldName OwnerID
  39. * @ManyToOne
  40. * @OnUpdate CASCADE
  41. * @OnDelete CASCADE
  42. * @var User
  43. */
  44. public $Owner;
  45. public function HasSubscripted( MinecraftServer $server ) {
  46. $f = date( 'Y-m-01' ); $l = date( 'Y-m-t' );
  47. $uid = $this->GetID();
  48. $sid = $server->GetID();
  49. $earlier = MinecraftServerSubscription::GetAll( "SubscriptionDate BETWEEN '$f' AND '$l' AND UnlockedUserID = $uid AND ConcerningServerID = $sid" );
  50. return !!count( $earlier );
  51. }
  52. }