PMA.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4. * phpMyAdmin main Controller
  5. *
  6. * @package PhpMyAdmin
  7. *
  8. */
  9. if (! defined('PHPMYADMIN')) {
  10. exit;
  11. }
  12. /**
  13. * Database listing.
  14. */
  15. require_once './libraries/List_Database.class.php';
  16. /**
  17. * phpMyAdmin main Controller
  18. *
  19. * @package PhpMyAdmin
  20. */
  21. class PMA
  22. {
  23. /**
  24. * Holds database list
  25. *
  26. * @var PMA_List_Database
  27. */
  28. protected $databases = null;
  29. /**
  30. * DBMS user link
  31. *
  32. * @var resource
  33. */
  34. protected $userlink = null;
  35. /**
  36. * DBMS control link
  37. *
  38. * @var resource
  39. */
  40. protected $controllink = null;
  41. /**
  42. * magic access to protected/inaccessible members/properties
  43. *
  44. * @param string $param parameter name
  45. *
  46. * @return mixed
  47. * @see http://php.net/language.oop5.overloading
  48. */
  49. public function __get($param)
  50. {
  51. switch ($param) {
  52. case 'databases' :
  53. return $this->getDatabaseList();
  54. break;
  55. case 'userlink' :
  56. return $this->userlink;
  57. break;
  58. case 'controllink' :
  59. return $this->controllink;
  60. break;
  61. }
  62. return null;
  63. }
  64. /**
  65. * magic access to protected/inaccessible members/properties
  66. *
  67. * @param string $param parameter name
  68. * @param mixed $value value to set
  69. *
  70. * @return void
  71. * @see http://php.net/language.oop5.overloading
  72. */
  73. public function __set($param, $value)
  74. {
  75. switch ($param) {
  76. case 'userlink' :
  77. $this->userlink = $value;
  78. break;
  79. case 'controllink' :
  80. $this->controllink = $value;
  81. break;
  82. }
  83. }
  84. /**
  85. * Accessor to PMA::$databases
  86. *
  87. * @return PMA_List_Databases
  88. */
  89. public function getDatabaseList()
  90. {
  91. if (null === $this->databases) {
  92. $this->databases = new PMA_List_Database(
  93. $this->userlink,
  94. $this->controllink
  95. );
  96. }
  97. return $this->databases;
  98. }
  99. }
  100. ?>