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.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. /**
  3. * @Name minecraft_user
  4. * @Unique Username
  5. */
  6. class MinecraftUser extends Entity
  7. {
  8. /**
  9. * @DB-Column
  10. * @Name ID
  11. * @Type INT
  12. * @Primary
  13. * @AutoIncrement
  14. * @NotNull
  15. */
  16. public $ID;
  17. /**
  18. * @DB-Column
  19. * @Name Username
  20. * @Type VARCHAR(256)
  21. * @NotNull
  22. * @Pattern /^[a-zA-Z0-9_]{3,16}$/
  23. * @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, _' ]
  24. */
  25. public $Username;
  26. /**
  27. * @DB-Relation
  28. * @Field ID
  29. * @FieldName SubscriptionID
  30. * @OneToMany
  31. * @OnUpdate CASCADE
  32. * @OnDelete CASCADE
  33. * @var MinecraftServer[]
  34. */
  35. public $Subscriptions;
  36. /**
  37. * @DB-Relation
  38. * @Field ID
  39. * @FieldName OwnerID
  40. * @ManyToOne
  41. * @OnUpdate CASCADE
  42. * @OnDelete CASCADE
  43. * @var User
  44. */
  45. public $Owner;
  46. public function HasSubscripted( MinecraftServer $server )
  47. {
  48. $f = date( 'Y-m-01' );
  49. $l = date( 'Y-m-t' );
  50. $uid = $this->GetID();
  51. $sid = $server->GetID();
  52. $earlier = MinecraftServerSubscription::GetAll( "SubscriptionDate BETWEEN '$f' AND '$l' AND UnlockedUserID = $uid AND ConcerningServerID = $sid" );
  53. return ! !count( $earlier );
  54. }
  55. }