ftp.inc.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. /**
  3. * FTP account management
  4. *
  5. * @package siteadm
  6. */
  7. class ftp_manager extends db_object_manager
  8. {
  9. static protected $name = "ftp";
  10. }
  11. /**
  12. * FTP account
  13. *
  14. * @package siteadm
  15. */
  16. class ftp extends db_object
  17. {
  18. static protected $_name = "ftp";
  19. static protected $_db_table = "ftp_user";
  20. static public $_f = array
  21. (
  22. "account_id" => array("type"=>"object", "otype"=>"account"),
  23. "actif" => array("type"=>"bool"),
  24. "username" => array("type"=>"string"),
  25. "password" => array("type"=>"string"),
  26. "type" => array("type"=>"select", "list"=>array("public", "private"), "default"=>"public"),
  27. "folder" => array("type"=>"string"),
  28. );
  29. protected $password;
  30. /**
  31. * @see db_object::__toString()
  32. */
  33. public function __toString()
  34. {
  35. return $this->username();
  36. }
  37. public function username()
  38. {
  39. return $this->account()->name."_".$this->username;
  40. }
  41. /**
  42. * Retrieve managing account
  43. *
  44. * @return account
  45. */
  46. public function account()
  47. {
  48. if ($account=account()->get($this->account_id))
  49. return $account;
  50. else
  51. return account_common();
  52. }
  53. }
  54. ?>