Browse Source

moved to 5.2-1

tags/v1.1.0^0
Robin Thoni 5 years ago
parent
commit
4fb84d36b6
100 changed files with 4448 additions and 4419 deletions
  1. 7
    0
      README
  2. 3
    8
      phpvirtualbox/Dockerfile
  3. 3
    1
      phpvirtualbox/config.php
  4. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_archlinux.png
  5. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_archlinux_64.png
  6. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_debian.png
  7. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_debian_64.png
  8. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_dos.png
  9. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_fedora.png
  10. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_fedora_64.png
  11. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_freebsd.png
  12. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_freebsd_64.png
  13. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_gentoo.png
  14. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_gentoo_64.png
  15. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_jrockitve.png
  16. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_l4.png
  17. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_linux.png
  18. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_linux22.png
  19. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_linux24.png
  20. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_linux24_64.png
  21. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_linux26.png
  22. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_linux26_64.png
  23. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_macosx.png
  24. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_macosx_64.png
  25. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_mandriva.png
  26. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_mandriva_64.png
  27. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_netbsd.png
  28. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_netbsd_64.png
  29. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_netware.png
  30. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_openbsd.png
  31. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_openbsd_64.png
  32. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_opensuse.png
  33. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_opensuse_64.png
  34. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_oracle.png
  35. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_oracle_64.png
  36. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_oraclesolaris.png
  37. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_oraclesolaris_64.png
  38. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_os2_other.png
  39. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_os2ecs.png
  40. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_os2warp3.png
  41. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_os2warp4.png
  42. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_os2warp45.png
  43. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_other.png
  44. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_other_64.png
  45. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_qnx.png
  46. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_redhat.png
  47. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_redhat_64.png
  48. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_solaris.png
  49. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_solaris_64.png
  50. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_turbolinux.png
  51. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_turbolinux_64.png
  52. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_ubuntu.png
  53. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_ubuntu_64.png
  54. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_win10.png
  55. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_win10_64.png
  56. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_win2k.png
  57. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_win2k12_64.png
  58. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_win2k3.png
  59. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_win2k3_64.png
  60. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_win2k8.png
  61. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_win2k8_64.png
  62. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_win31.png
  63. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_win7.png
  64. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_win7_64.png
  65. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_win8.png
  66. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_win81.png
  67. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_win81_64.png
  68. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_win8_64.png
  69. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_win95.png
  70. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_win98.png
  71. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_win_other.png
  72. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_winme.png
  73. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_winnt4.png
  74. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_winvista.png
  75. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_winvista_64.png
  76. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_winxp.png
  77. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_winxp_64.png
  78. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_xandros.png
  79. BIN
      phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_xandros_64.png
  80. 0
    3
      phpvirtualbox/phpvirtualbox-5.0-5/languages/source/fr.dat
  81. 0
    0
      phpvirtualbox/phpvirtualbox-5.2-1/.dockerignore
  82. 0
    0
      phpvirtualbox/phpvirtualbox-5.2-1/.gitignore
  83. 1460
    1441
      phpvirtualbox/phpvirtualbox-5.2-1/CHANGELOG.txt
  84. 0
    0
      phpvirtualbox/phpvirtualbox-5.2-1/Dockerfile
  85. 620
    620
      phpvirtualbox/phpvirtualbox-5.2-1/GPLv3.txt
  86. 16
    16
      phpvirtualbox/phpvirtualbox-5.2-1/LICENSE.txt
  87. 13
    6
      phpvirtualbox/phpvirtualbox-5.2-1/README.md
  88. 2
    0
      phpvirtualbox/phpvirtualbox-5.2-1/config.php-example
  89. 1189
    1189
      phpvirtualbox/phpvirtualbox-5.2-1/css/jquery-ui.css
  90. 0
    0
      phpvirtualbox/phpvirtualbox-5.2-1/css/jquery.projectPlugins.css
  91. 0
    0
      phpvirtualbox/phpvirtualbox-5.2-1/css/layout.css
  92. 43
    43
      phpvirtualbox/phpvirtualbox-5.2-1/css/tipped.css
  93. 0
    0
      phpvirtualbox/phpvirtualbox-5.2-1/docker-compose.yml
  94. 387
    387
      phpvirtualbox/phpvirtualbox-5.2-1/endpoints/api.php
  95. 0
    0
      phpvirtualbox/phpvirtualbox-5.2-1/endpoints/config.js
  96. 0
    0
      phpvirtualbox/phpvirtualbox-5.2-1/endpoints/index.html
  97. 385
    385
      phpvirtualbox/phpvirtualbox-5.2-1/endpoints/jqueryFileTree.php
  98. 117
    117
      phpvirtualbox/phpvirtualbox-5.2-1/endpoints/language.php
  99. 203
    203
      phpvirtualbox/phpvirtualbox-5.2-1/endpoints/lib/auth/ActiveDirectory.php
  100. 0
    0
      phpvirtualbox/phpvirtualbox-5.2-1/endpoints/lib/auth/Builtin.php

+ 7
- 0
README View File

@@ -21,3 +21,10 @@ chmod 1775 /etc/vbox
21 21
 # for each VM, when not running, in vbox shell (su vbox, not sudo): VBoxManage modifyvm VM_NAME --autostart-enabled on
22 22
 
23 23
 ```
24
+
25
+Install extension pack (as root):
26
+get version in https://download.virtualbox.org/virtualbox/
27
+```
28
+wget ...
29
+vboxmanage extpack install Oracle...vbox-extpack
30
+```

+ 3
- 8
phpvirtualbox/Dockerfile View File

@@ -14,21 +14,16 @@ RUN apt-get update && apt-get -y install\
14 14
 RUN /usr/sbin/a2enmod rewrite &&\
15 15
     rm -rf /var/www/html &&\
16 16
     mkdir -p /var/lock/apache2 /var/run/apache2 /var/log/apache2 /var/www/html &&\
17
-    chown -R www-data:www-data /var/lock/apache2 /var/run/apache2 /var/log/apache2 /var/www/html
18
-
19
-RUN rm -rf /var/log/* &&\
17
+    chown -R www-data:www-data /var/lock/apache2 /var/run/apache2 /var/log/apache2 /var/www/html &&\
18
+    rm -rf /var/log/* &&\
20 19
     mkdir -p /var/log/apache2 &&\
21 20
     ln -s /dev/stderr /var/log/apache2/error.log &&\
22 21
     ln -s /dev/stdout /var/log/apache2/access.log &&\
23 22
     ln -s /dev/stdout /var/log/apache2/other_vhosts_access.log
24 23
 
25
-RUN apt-get update && \
26
-    apt-get install -y curl && \
27
-    apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
28
-
29 24
 COPY apache2.conf /etc/apache2/apache2.conf
30 25
 
31
-COPY ./phpvirtualbox-5.0-5/ /var/www/html/
26
+COPY ./phpvirtualbox-5.2-1/ /var/www/html/
32 27
 
33 28
 COPY ./vars-vars /etc/vars-vars
34 29
 

+ 3
- 1
phpvirtualbox/config.php View File

@@ -23,6 +23,8 @@ var $language = 'en';
23 23
 
24 24
 /* Set the standard VRDE Port Number / Range, e.g. 1010-1020 or 1027 */
25 25
 var $vrdeports = '9000-9100';
26
+/* Set the default VRDE address, e.g. 192.168.1.1 */
27
+#var $vrdeaddress = '192.168.1.1';
26 28
 
27 29
 /*
28 30
  *
@@ -172,7 +174,7 @@ var $nicMax = 4;
172 174
 /* Enable advanced configuration items (normally hidden in the VirtualBox GUI)
173 175
  * Note that some of these items may not be translated to languages other than English. 
174 176
  */
175
-#var $enableAdvancedConfig = true;
177
+var $enableAdvancedConfig = true;
176 178
 
177 179
 /* Enable startup / shutdown configuration.
178 180
  * This only works in linux and you must add the vboxinit file to

BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_archlinux.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_archlinux_64.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_debian.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_debian_64.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_dos.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_fedora.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_fedora_64.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_freebsd.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_freebsd_64.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_gentoo.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_gentoo_64.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_jrockitve.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_l4.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_linux.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_linux22.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_linux24.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_linux24_64.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_linux26.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_linux26_64.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_macosx.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_macosx_64.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_mandriva.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_mandriva_64.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_netbsd.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_netbsd_64.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_netware.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_openbsd.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_openbsd_64.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_opensuse.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_opensuse_64.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_oracle.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_oracle_64.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_oraclesolaris.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_oraclesolaris_64.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_os2_other.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_os2ecs.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_os2warp3.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_os2warp4.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_os2warp45.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_other.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_other_64.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_qnx.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_redhat.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_redhat_64.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_solaris.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_solaris_64.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_turbolinux.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_turbolinux_64.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_ubuntu.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_ubuntu_64.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_win10.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_win10_64.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_win2k.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_win2k12_64.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_win2k3.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_win2k3_64.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_win2k8.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_win2k8_64.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_win31.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_win7.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_win7_64.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_win8.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_win81.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_win81_64.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_win8_64.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_win95.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_win98.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_win_other.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_winme.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_winnt4.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_winvista.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_winvista_64.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_winxp.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_winxp_64.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_xandros.png View File


BIN
phpvirtualbox/phpvirtualbox-5.0-5/images/vbox/os_xandros_64.png View File


+ 0
- 3
phpvirtualbox/phpvirtualbox-5.0-5/languages/source/fr.dat
File diff suppressed because it is too large
View File


phpvirtualbox/phpvirtualbox-5.0-5/.dockerignore → phpvirtualbox/phpvirtualbox-5.2-1/.dockerignore View File


phpvirtualbox/phpvirtualbox-5.0-5/.gitignore → phpvirtualbox/phpvirtualbox-5.2-1/.gitignore View File


phpvirtualbox/phpvirtualbox-5.2-1/CHANGELOG.txt
File diff suppressed because it is too large
View File


phpvirtualbox/phpvirtualbox-5.0-5/Dockerfile → phpvirtualbox/phpvirtualbox-5.2-1/Dockerfile View File


phpvirtualbox/phpvirtualbox-5.2-1/GPLv3.txt
File diff suppressed because it is too large
View File


phpvirtualbox/phpvirtualbox-5.0-5/LICENSE.txt → phpvirtualbox/phpvirtualbox-5.2-1/LICENSE.txt View File

@@ -1,16 +1,16 @@
1
-phpVirtualBox - A web-based front-end to VirtualBox.
2
-Copyright (C) 2011  Ian Moore
3
-
4
-This program is free software; you can redistribute it and/or
5
-modify it under the terms of the GNU General Public License
6
-version 3 as published by the Free Software Foundation.
7
-
8
-This program is distributed in the hope that it will be useful,
9
-but WITHOUT ANY WARRANTY; without even the implied warranty of
10
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
-GNU General Public License for more details.
12
-
13
-You should have received a copy of the GNU General Public License
14
-(GPLv3.txt in this folder) along with this program; if not, write
15
-to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
16
-Floor, Boston, MA  02110-1301, USA.
1
+phpVirtualBox - A web-based front-end to VirtualBox.
2
+Copyright (C) 2011  Ian Moore
3
+
4
+This program is free software; you can redistribute it and/or
5
+modify it under the terms of the GNU General Public License
6
+version 3 as published by the Free Software Foundation.
7
+
8
+This program is distributed in the hope that it will be useful,
9
+but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
+GNU General Public License for more details.
12
+
13
+You should have received a copy of the GNU General Public License
14
+(GPLv3.txt in this folder) along with this program; if not, write
15
+to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
16
+Floor, Boston, MA  02110-1301, USA.

phpvirtualbox/phpvirtualbox-5.0-5/README.md → phpvirtualbox/phpvirtualbox-5.2-1/README.md View File

@@ -1,6 +1,10 @@
1 1
 # About
2 2
 
3
-phpVirtualBox is Copyright (C) 2015 Ian Moore (imoore76 at yahoo dot com)
3
+phpVirtualBox is from 2017 maintained by Smart Guide Pty Ltd (tudor at smartguide dot com dot au)
4
+
5
+with support from various contributors (see https://github.com/phpvirtualbox/phpvirtualbox/graphs/contributors)
6
+
7
+Originally Copyright (C) 2015 Ian Moore (imoore76 at yahoo dot com)
4 8
 
5 9
 FREE, WITHOUT WARRANTY:
6 10
 
@@ -14,17 +18,20 @@ possession.
14 18
 
15 19
 # Installation from Zip file
16 20
 
17
-1) Download zip file from sourceforge project site: https://sourceforge.net/projects/phpvirtualbox/
21
+1) Download zip file from GitHub project site: https://github.com/phpvirtualbox/phpvirtualbox/archive/master.zip
22
+
23
+2) Unzip the zipfile into a folder accessible by your web server
24
+
25
+3) Rename config.php-example to config.php and edit as needed.
18 26
 
19
-2) Rename config.php-example to config.php and edit as needed.
27
+Read the wiki for more information : https://github.com/phpvirtualbox/phpvirtualbox/wiki
20 28
 
21 29
 # Post installation
22 30
 
23 31
 Default login is username: admin password: admin
24 32
 
25
-Please see the wiki located at
26
-http://sourceforge.net/p/phpvirtualbox/wiki/Home/
27
-for detailed installation and configuration instructions.
33
+Please report bugs / feature requests to GitHub
34
+https://github.com/phpvirtualbox/phpvirtualbox/issues
28 35
 
29 36
 # Password Recovery
30 37
 

phpvirtualbox/phpvirtualbox-5.0-5/config.php-example → phpvirtualbox/phpvirtualbox-5.2-1/config.php-example View File

@@ -23,6 +23,8 @@ var $language = 'en';
23 23
 
24 24
 /* Set the standard VRDE Port Number / Range, e.g. 1010-1020 or 1027 */
25 25
 var $vrdeports = '9000-9100';
26
+/* Set the default VRDE address, e.g. 192.168.1.1 */
27
+#var $vrdeaddress = '192.168.1.1';
26 28
 
27 29
 /*
28 30
  *

phpvirtualbox/phpvirtualbox-5.2-1/css/jquery-ui.css
File diff suppressed because it is too large
View File


phpvirtualbox/phpvirtualbox-5.0-5/css/jquery.projectPlugins.css → phpvirtualbox/phpvirtualbox-5.2-1/css/jquery.projectPlugins.css View File


phpvirtualbox/phpvirtualbox-5.0-5/css/layout.css → phpvirtualbox/phpvirtualbox-5.2-1/css/layout.css View File


phpvirtualbox/phpvirtualbox-5.0-5/css/tipped.css → phpvirtualbox/phpvirtualbox-5.2-1/css/tipped.css View File

@@ -1,43 +1,43 @@
1
-#tipped {
2
-	/* position & display are necessary */
3
-	position:absolute;
4
-	display:none;
5
-	
6
-	/* The rest are just to make it look good & can be changed as you want */
7
-	border: 1px solid #404040;
8
-	color: #404040;
9
-	
10
-	border-radius:5px;
11
-	padding:3px;
12
-	z-index: 99999;
13
-	font-size: 0.9em;
14
-	max-width: 50%;
15
-	
16
-	background: #f0f0f0;
17
-	background: -moz-linear-gradient(top, #ffffff 0%, #e0e0e0 100%); /* FF3.6+ */
18
-	background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffffff), color-stop(100%,#e0e0e0)); /* Chrome,Safari4+ */
19
-	background: -webkit-linear-gradient(top, #ffffff 0%,#e0e0e0 100%); /* Chrome10+,Safari5.1+ */
20
-	background: -o-linear-gradient(top, #ffffff 0%,#e0e0e0 100%); /* Opera 11.10+ */
21
-	background: -ms-linear-gradient(top, #ffffff 0%,#e0e0e0 100%); /* IE10+ */
22
-	background: linear-gradient(to bottom, #ffffff 0%,#e0e0e0 100%); /* W3C */
23
-	filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#e0e0e0',GradientType=0 ); /* IE6-9 */
24
-	
25
-	overflow: hidden;
26
-}
27
-
28
-/* The tip content gets inserted into this element */
29
-#tipped-content p, #tipped p { padding: 2px; margin: 0px; padding-bottom:0px; } 
30
-
31
-/* This is the <div> that holds the close button/link.  No styling is required, but you'll likely want some. */
32
-#tipped-closer-wrapper {
33
-	display:none;
34
-	text-align:center;
35
-	margin: 0px;
36
-}
37
-
38
-/* The <span> that is the close button/link.  No styling is required, but you'll likely want some. */
39
-#tipped-closer {
40
-	display:none;
41
-	border:2px outset #999;
42
-	background-color:#CCC;
43
-}
1
+#tipped {
2
+	/* position & display are necessary */
3
+	position:absolute;
4
+	display:none;
5
+	
6
+	/* The rest are just to make it look good & can be changed as you want */
7
+	border: 1px solid #404040;
8
+	color: #404040;
9
+	
10
+	border-radius:5px;
11
+	padding:3px;
12
+	z-index: 99999;
13
+	font-size: 0.9em;
14
+	max-width: 50%;
15
+	
16
+	background: #f0f0f0;
17
+	background: -moz-linear-gradient(top, #ffffff 0%, #e0e0e0 100%); /* FF3.6+ */
18
+	background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffffff), color-stop(100%,#e0e0e0)); /* Chrome,Safari4+ */
19
+	background: -webkit-linear-gradient(top, #ffffff 0%,#e0e0e0 100%); /* Chrome10+,Safari5.1+ */
20
+	background: -o-linear-gradient(top, #ffffff 0%,#e0e0e0 100%); /* Opera 11.10+ */
21
+	background: -ms-linear-gradient(top, #ffffff 0%,#e0e0e0 100%); /* IE10+ */
22
+	background: linear-gradient(to bottom, #ffffff 0%,#e0e0e0 100%); /* W3C */
23
+	filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#e0e0e0',GradientType=0 ); /* IE6-9 */
24
+	
25
+	overflow: hidden;
26
+}
27
+
28
+/* The tip content gets inserted into this element */
29
+#tipped-content p, #tipped p { padding: 2px; margin: 0px; padding-bottom:0px; } 
30
+
31
+/* This is the <div> that holds the close button/link.  No styling is required, but you'll likely want some. */
32
+#tipped-closer-wrapper {
33
+	display:none;
34
+	text-align:center;
35
+	margin: 0px;
36
+}
37
+
38
+/* The <span> that is the close button/link.  No styling is required, but you'll likely want some. */
39
+#tipped-closer {
40
+	display:none;
41
+	border:2px outset #999;
42
+	background-color:#CCC;
43
+}

phpvirtualbox/phpvirtualbox-5.0-5/docker-compose.yml → phpvirtualbox/phpvirtualbox-5.2-1/docker-compose.yml View File


phpvirtualbox/phpvirtualbox-5.0-5/endpoints/api.php → phpvirtualbox/phpvirtualbox-5.2-1/endpoints/api.php View File

@@ -1,387 +1,387 @@
1
-<?php
2
-/**
3
- * Main API interface between JavaScript ajax calls and PHP functions.
4
- * Accepts JSON, POST data or simple GET requests, and returns JSON data.
5
- *
6
- * @author Ian Moore (imoore76 at yahoo dot com)
7
- * @copyright Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
8
- * @version $Id: api.php 596 2015-04-19 11:50:53Z imoore76 $
9
- * @package phpVirtualBox
10
- * @see vboxconnector
11
- * @see vboxAjaxRequest
12
- *
13
- * @global array $GLOBALS['response'] resopnse data sent back via json
14
- * @name $response
15
-*/
16
-
17
-# Turn off PHP errors
18
-error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_WARNING);
19
-
20
-
21
-//Set no caching
22
-header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
23
-header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
24
-header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
25
-header("Pragma: no-cache");
26
-
27
-require_once(dirname(__FILE__).'/lib/config.php');
28
-require_once(dirname(__FILE__).'/lib/utils.php');
29
-require_once(dirname(__FILE__).'/lib/vboxconnector.php');
30
-
31
-// Init session
32
-global $_SESSION;
33
-
34
-/*
35
- * Clean request
36
- */
37
-$request = clean_request();
38
-
39
-
40
-global $response;
41
-$response = array('data'=>array('responseData'=>array()),'errors'=>array(),'persist'=>array(),'messages'=>array());
42
-
43
-/*
44
- * Built-in requests
45
- */
46
-$vbox = null; // May be set during request handling
47
-
48
-/**
49
- * Main try / catch. Logic dictated by incoming 'fn' request
50
- * parameter.
51
- */
52
-try {
53
-
54
-	/* Check for password recovery file */
55
-	if(file_exists(dirname(dirname(__FILE__)).'/recovery.php')) {
56
-		throw new Exception('recovery.php exists in phpVirtualBox\'s folder. This is a security hazard. phpVirtualBox will not run until recovery.php has been renamed to a file name that does not end in .php such as <b>recovery.php-disabled</b>.',vboxconnector::PHPVB_ERRNO_FATAL);
57
-	}
58
-
59
-	/* Check for PHP version */
60
-	if (!version_compare(PHP_VERSION, '5.2.0', '>=')) {
61
-		throw new Exception('phpVirtualBox requires PHP >= 5.2.0, but this server is running version '. PHP_VERSION .'. Please upgrade PHP.');
62
-	}
63
-
64
-	# Only valid function chars
65
-	$request['fn'] = preg_replace('[^a-zA-Z0-9_-]', '', $request['fn']);
66
-
67
-	/* Check for function called */
68
-	switch($request['fn']) {
69
-
70
-		/*
71
-		 * No method called
72
-		 */
73
-	    case '':
74
-	    	throw new Exception('No method called.');
75
-	    	break;
76
-
77
-		/*
78
-		 * Return phpVirtualBox's configuration data
79
-		 */
80
-		case 'getConfig':
81
-
82
-			$settings = new phpVBoxConfigClass();
83
-			$response['data']['responseData'] = get_object_vars($settings);
84
-			$response['data']['responseData']['host'] = parse_url($response['data']['responseData']['location']);
85
-			$response['data']['responseData']['host'] = $response['data']['responseData']['host']['host'];
86
-			$response['data']['responseData']['phpvboxver'] = @constant('PHPVBOX_VER');
87
-
88
-			// Session
89
-			session_init();
90
-
91
-			// Hide credentials
92
-			unset($response['data']['responseData']['username']);
93
-			unset($response['data']['responseData']['password']);
94
-			foreach($response['data']['responseData']['servers'] as $k => $v)
95
-				$response['data']['responseData']['servers'][$k] = array('name'=>$v['name']);
96
-
97
-			// Vbox version
98
-			$vbox = new vboxconnector();
99
-			$response['data']['responseData']['version'] = $vbox->getVersion();
100
-			$response['data']['responseData']['hostOS'] = $vbox->vbox->host->operatingSystem;
101
-			$response['data']['responseData']['DSEP'] = $vbox->getDsep();
102
-			$response['data']['responseData']['groupDefinitionKey'] = ($settings->phpVboxGroups ? vboxconnector::phpVboxGroupKey : 'GUI/GroupDefinitions');
103
-
104
-			$response['data']['success'] = true;
105
-
106
-			break;
107
-
108
-		/*
109
-		 *
110
-		 * USER FUNCTIONS FOLLOW
111
-		 *
112
-		 */
113
-
114
-		/*
115
-		 * Pass login to authentication module.
116
-		 */
117
-		case 'login':
118
-
119
-
120
-			// NOTE: Do not break. Fall through to 'getSession
121
-			if(!$request['params']['u'] || !$request['params']['p']) {
122
-				break;
123
-			}
124
-
125
-			// Session
126
-			session_init(true);
127
-
128
-			$settings = new phpVBoxConfigClass();
129
-
130
-			// Try / catch here to hide login credentials
131
-			try {
132
-				$settings->auth->login($request['params']['u'], $request['params']['p']);
133
-			} catch(Exception $e) {
134
-				throw new Exception($e->getMessage(), $e->getCode());
135
-			}
136
-
137
-			// We're done writing to session
138
-			if(function_exists('session_write_close'))
139
-				@session_write_close();
140
-
141
-
142
-
143
-		/*
144
-		 * Return $_SESSION data
145
-		 */
146
-		case 'getSession':
147
-
148
-			$settings = new phpVBoxConfigClass();
149
-			if(method_exists($settings->auth,'autoLoginHook'))
150
-			{
151
-				// Session
152
-				session_init(true);
153
-
154
-				$settings->auth->autoLoginHook();
155
-
156
-				// We're done writing to session
157
-				if(function_exists('session_write_close'))
158
-					@session_write_close();
159
-
160
-			} else {
161
-
162
-				session_init();
163
-
164
-			}
165
-
166
-
167
-			$response['data']['responseData'] = $_SESSION;
168
-			$response['data']['success'] = true;
169
-			break;
170
-
171
-		/*
172
-		 * Change phpVirtualBox password. Passed to auth module's
173
-		 * changePassword method.
174
-		 */
175
-		case 'changePassword':
176
-
177
-			// Session
178
-			session_init(true);
179
-
180
-			$settings = new phpVBoxConfigClass();
181
-			$response['data']['success'] = $settings->auth->changePassword($request['params']['old'],
182
-					                                                       $request['params']['new']);
183
-
184
-			// We're done writing to session
185
-			if(function_exists('session_write_close'))
186
-				@session_write_close();
187
-
188
-			break;
189
-
190
-		/*
191
-		 * Get a list of phpVirtualBox users. Passed to auth module's
192
-		 * getUsers method.
193
-		 */
194
-		case 'getUsers':
195
-
196
-			// Session
197
-			session_init();
198
-
199
-			// Must be an admin
200
-			if(!$_SESSION['admin']) break;
201
-
202
-			$settings = new phpVBoxConfigClass();
203
-			$response['data']['responseData'] = $settings->auth->listUsers();
204
-			$response['date']['success'] = true;
205
-
206
-			break;
207
-
208
-		/*
209
-		 * Remove a phpVirtualBox user. Passed to auth module's
210
-		 * deleteUser method.
211
-		 */
212
-		case 'delUser':
213
-
214
-			// Session
215
-			session_init();
216
-
217
-			// Must be an admin
218
-			if(!$_SESSION['admin']) break;
219
-
220
-			$settings = new phpVBoxConfigClass();
221
-			$settings->auth->deleteUser($request['params']['u']);
222
-
223
-			$response['data']['success'] = true;
224
-			break;
225
-
226
-		/*
227
-		 * Edit a phpVirtualBox user. Passed to auth module's
228
-		 * updateUser method.
229
-		 */
230
-		case 'editUser':
231
-
232
-			$skipExistCheck = true;
233
-			// Fall to addUser
234
-
235
-		/*
236
-		 * Add a user to phpVirtualBox. Passed to auth module's
237
-		 * updateUser method.
238
-		 */
239
-		case 'addUser':
240
-
241
-			// Session
242
-			session_init();
243
-
244
-			// Must be an admin
245
-			if(!$_SESSION['admin']) break;
246
-
247
-			$settings = new phpVBoxConfigClass();
248
-			$settings->auth->updateUser($request['params'], @$skipExistCheck);
249
-
250
-			$response['data']['success'] = true;
251
-			break;
252
-
253
-		/*
254
-		 * Log out of phpVirtualBox. Passed to auth module's
255
-		 * logout method.
256
-		 */
257
-		case 'logout':
258
-
259
-			// Session
260
-			session_init(true);
261
-
262
-			$vbox = new vboxconnector();
263
-			$vbox->skipSessionCheck = true;
264
-
265
-			$settings = new phpVBoxConfigClass();
266
-			$settings->auth->logout($response);
267
-
268
-			session_destroy();
269
-
270
-			$response['data']['success'] = true;
271
-
272
-			break;
273
-
274
-
275
-		/*
276
-		 * If the above cases did not match, assume it is a request
277
-		 * that should be passed to vboxconnector.
278
-		 */
279
-		default:
280
-
281
-			$vbox = new vboxconnector();
282
-
283
-
284
-			/*
285
-			 * Every 1 minute we'll check that the account has not
286
-			 * been deleted since login, and update admin credentials.
287
-			 */
288
-			if($_SESSION['user'] && ((intval($_SESSION['authCheckHeartbeat'])+60) < time())) {
289
-
290
-				// init session and keep it open
291
-				session_init(true);
292
-				$vbox->settings->auth->heartbeat($vbox);
293
-
294
-				// We're done writing to session
295
-				if(function_exists('session_write_close'))
296
-					@session_write_close();
297
-
298
-			} else {
299
-
300
-				// init session but close it
301
-				session_init();
302
-
303
-			}
304
-
305
-			/*
306
-			 *  Persistent request data
307
-			 */
308
-			if(is_array($request['persist'])) {
309
-				$vbox->persistentRequest = $request['persist'];
310
-			}
311
-
312
-
313
-			/*
314
-			 * Call to vboxconnector
315
-			 */
316
-			$vbox->{$request['fn']}($request['params'],array(&$response));
317
-
318
-
319
-			/*
320
-			 * Send back persistent request in response
321
-			*/
322
-			if(is_array($vbox->persistentRequest) && count($vbox->persistentRequest)) {
323
-				$response['data']['persist'] = $vbox->persistentRequest;
324
-			}
325
-			break;
326
-
327
-	} // </switch()>
328
-
329
-/*
330
- * Catch all exceptions and populate errors in the
331
- * JSON response data.
332
- */
333
-} catch (Exception $e) {
334
-
335
-	// Just append to $vbox->errors and let it get
336
-	// taken care of below
337
-	if(!$vbox || !$vbox->errors) {
338
-		$vbox->errors = array();
339
-	}
340
-	$vbox->errors[] = $e;
341
-}
342
-
343
-
344
-// Add any messages
345
-if($vbox && count($vbox->messages)) {
346
-	foreach($vbox->messages as $m)
347
-		$response['messages'][] = 'vboxconnector('.$request['fn'] .'): ' . $m;
348
-}
349
-// Add other error info
350
-if($vbox && $vbox->errors) {
351
-
352
-	foreach($vbox->errors as $e) { /* @var $e Exception */
353
-
354
-		ob_start();
355
-		print_r($e);
356
-		$d = ob_get_contents();
357
-		ob_end_clean();
358
-
359
-		# Add connection details to connection errors
360
-		if($e->getCode() == vboxconnector::PHPVB_ERRNO_CONNECT && isset($vbox->settings))
361
-			$d .= "\n\nLocation:" . $vbox->settings->location;
362
-
363
-		$response['messages'][] = htmlentities($e->getMessage()).' ' . htmlentities($details);
364
-
365
-		$response['errors'][] = array(
366
-			'error'=> ($e->getCode() & vboxconnector::PHPVB_ERRNO_HTML ? $e->getMessage() : htmlentities($e->getMessage())),
367
-			'details'=>htmlentities($d),
368
-			'errno'=>$e->getCode(),
369
-			// Fatal errors halt all processing
370
-			'fatal'=>($e->getCode() & vboxconnector::PHPVB_ERRNO_FATAL),
371
-			// Connection errors display alternate servers options
372
-			'connection'=>($e->getCode() & vboxconnector::PHPVB_ERRNO_CONNECT)
373
-		);
374
-	}
375
-}
376
-
377
-/*
378
- * Return response as JSON encoded data or use PHP's
379
- * print_r to dump data to browser.
380
- */
381
-if(isset($request['printr'])) {
382
-	print_r($response);
383
-} else {
384
-    header('Content-type: application/json');
385
-	echo(json_encode($response));
386
-}
387
-
1
+<?php
2
+/**
3
+ * Main API interface between JavaScript ajax calls and PHP functions.
4
+ * Accepts JSON, POST data or simple GET requests, and returns JSON data.
5
+ *
6
+ * @author Ian Moore (imoore76 at yahoo dot com)
7
+ * @copyright Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
8
+ * @version $Id: api.php 596 2015-04-19 11:50:53Z imoore76 $
9
+ * @package phpVirtualBox
10
+ * @see vboxconnector
11
+ * @see vboxAjaxRequest
12
+ *
13
+ * @global array $GLOBALS['response'] resopnse data sent back via json
14
+ * @name $response
15
+*/
16
+
17
+# Turn off PHP errors
18
+error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_WARNING);
19
+
20
+
21
+//Set no caching
22
+header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
23
+header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
24
+header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
25
+header("Pragma: no-cache");
26
+
27
+require_once(dirname(__FILE__).'/lib/config.php');
28
+require_once(dirname(__FILE__).'/lib/utils.php');
29
+require_once(dirname(__FILE__).'/lib/vboxconnector.php');
30
+
31
+// Init session
32
+global $_SESSION;
33
+
34
+/*
35
+ * Clean request
36
+ */
37
+$request = clean_request();
38
+
39
+
40
+global $response;
41
+$response = array('data'=>array('responseData'=>array()),'errors'=>array(),'persist'=>array(),'messages'=>array());
42
+
43
+/*
44
+ * Built-in requests
45
+ */
46
+$vbox = null; // May be set during request handling
47
+
48
+/**
49
+ * Main try / catch. Logic dictated by incoming 'fn' request
50
+ * parameter.
51
+ */
52
+try {
53
+
54
+	/* Check for password recovery file */
55
+	if(file_exists(dirname(dirname(__FILE__)).'/recovery.php')) {
56
+		throw new Exception('recovery.php exists in phpVirtualBox\'s folder. This is a security hazard. phpVirtualBox will not run until recovery.php has been renamed to a file name that does not end in .php such as <b>recovery.php-disabled</b>.',vboxconnector::PHPVB_ERRNO_FATAL);
57
+	}
58
+
59
+	/* Check for PHP version */
60
+	if (!version_compare(PHP_VERSION, '5.2.0', '>=')) {
61
+		throw new Exception('phpVirtualBox requires PHP >= 5.2.0, but this server is running version '. PHP_VERSION .'. Please upgrade PHP.');
62
+	}
63
+
64
+	# Only valid function chars
65
+	$request['fn'] = preg_replace('[^a-zA-Z0-9_-]', '', $request['fn']);
66
+
67
+	/* Check for function called */
68
+	switch($request['fn']) {
69
+
70
+		/*
71
+		 * No method called
72
+		 */
73
+	    case '':
74
+	    	throw new Exception('No method called.');
75
+	    	break;
76
+
77
+		/*
78
+		 * Return phpVirtualBox's configuration data
79
+		 */
80
+		case 'getConfig':
81
+
82
+			$settings = new phpVBoxConfigClass();
83
+			$response['data']['responseData'] = get_object_vars($settings);
84
+			$response['data']['responseData']['host'] = parse_url($response['data']['responseData']['location']);
85
+			$response['data']['responseData']['host'] = $response['data']['responseData']['host']['host'];
86
+			$response['data']['responseData']['phpvboxver'] = @constant('PHPVBOX_VER');
87
+
88
+			// Session
89
+			session_init();
90
+
91
+			// Hide credentials
92
+			unset($response['data']['responseData']['username']);
93
+			unset($response['data']['responseData']['password']);
94
+			foreach($response['data']['responseData']['servers'] as $k => $v)
95
+				$response['data']['responseData']['servers'][$k] = array('name'=>$v['name']);
96
+
97
+			// Vbox version
98
+			$vbox = new vboxconnector();
99
+			$response['data']['responseData']['version'] = $vbox->getVersion();
100
+			$response['data']['responseData']['hostOS'] = $vbox->vbox->host->operatingSystem;
101
+			$response['data']['responseData']['DSEP'] = $vbox->getDsep();
102
+			$response['data']['responseData']['groupDefinitionKey'] = ($settings->phpVboxGroups ? vboxconnector::phpVboxGroupKey : 'GUI/GroupDefinitions');
103
+
104
+			$response['data']['success'] = true;
105
+
106
+			break;
107
+
108
+		/*
109
+		 *
110
+		 * USER FUNCTIONS FOLLOW
111
+		 *
112
+		 */
113
+
114
+		/*
115
+		 * Pass login to authentication module.
116
+		 */
117
+		case 'login':
118
+
119
+
120
+			// NOTE: Do not break. Fall through to 'getSession
121
+			if(!$request['params']['u'] || !$request['params']['p']) {
122
+				break;
123
+			}
124
+
125
+			// Session
126
+			session_init(true);
127
+
128
+			$settings = new phpVBoxConfigClass();
129
+
130
+			// Try / catch here to hide login credentials
131
+			try {
132
+				$settings->auth->login($request['params']['u'], $request['params']['p']);
133
+			} catch(Exception $e) {
134
+				throw new Exception($e->getMessage(), $e->getCode());
135
+			}
136
+
137
+			// We're done writing to session
138
+			if(function_exists('session_write_close'))
139
+				@session_write_close();
140
+
141
+
142
+
143
+		/*
144
+		 * Return $_SESSION data
145
+		 */
146
+		case 'getSession':
147
+
148
+			$settings = new phpVBoxConfigClass();
149
+			if(method_exists($settings->auth,'autoLoginHook'))
150
+			{
151
+				// Session
152
+				session_init(true);
153
+
154
+				$settings->auth->autoLoginHook();
155
+
156
+				// We're done writing to session
157
+				if(function_exists('session_write_close'))
158
+					@session_write_close();
159
+
160
+			} else {
161
+
162
+				session_init();
163
+
164
+			}
165
+
166
+
167
+			$response['data']['responseData'] = $_SESSION;
168
+			$response['data']['success'] = true;
169
+			break;
170
+
171
+		/*
172
+		 * Change phpVirtualBox password. Passed to auth module's
173
+		 * changePassword method.
174
+		 */
175
+		case 'changePassword':
176
+
177
+			// Session
178
+			session_init(true);
179
+
180
+			$settings = new phpVBoxConfigClass();
181
+			$response['data']['success'] = $settings->auth->changePassword($request['params']['old'],
182
+					                                                       $request['params']['new']);
183
+
184
+			// We're done writing to session
185
+			if(function_exists('session_write_close'))
186
+				@session_write_close();
187
+
188
+			break;
189
+
190
+		/*
191
+		 * Get a list of phpVirtualBox users. Passed to auth module's
192
+		 * getUsers method.
193
+		 */
194
+		case 'getUsers':
195
+
196
+			// Session
197
+			session_init();
198
+
199
+			// Must be an admin
200
+			if(!$_SESSION['admin']) break;
201
+
202
+			$settings = new phpVBoxConfigClass();
203
+			$response['data']['responseData'] = $settings->auth->listUsers();
204
+			$response['date']['success'] = true;
205
+
206
+			break;
207
+
208
+		/*
209
+		 * Remove a phpVirtualBox user. Passed to auth module's
210
+		 * deleteUser method.
211
+		 */
212
+		case 'delUser':
213
+
214
+			// Session
215
+			session_init();
216
+
217
+			// Must be an admin
218
+			if(!$_SESSION['admin']) break;
219
+
220
+			$settings = new phpVBoxConfigClass();
221
+			$settings->auth->deleteUser($request['params']['u']);
222
+
223
+			$response['data']['success'] = true;
224
+			break;
225
+
226
+		/*
227
+		 * Edit a phpVirtualBox user. Passed to auth module's
228
+		 * updateUser method.
229
+		 */
230
+		case 'editUser':
231
+
232
+			$skipExistCheck = true;
233
+			// Fall to addUser
234
+
235
+		/*
236
+		 * Add a user to phpVirtualBox. Passed to auth module's
237
+		 * updateUser method.
238
+		 */
239
+		case 'addUser':
240
+
241
+			// Session
242
+			session_init();
243
+
244
+			// Must be an admin
245
+			if(!$_SESSION['admin']) break;
246
+
247
+			$settings = new phpVBoxConfigClass();
248
+			$settings->auth->updateUser($request['params'], @$skipExistCheck);
249
+
250
+			$response['data']['success'] = true;
251
+			break;
252
+
253
+		/*
254
+		 * Log out of phpVirtualBox. Passed to auth module's
255
+		 * logout method.
256
+		 */
257
+		case 'logout':
258
+
259
+			// Session
260
+			session_init(true);
261
+
262
+			$vbox = new vboxconnector();
263
+			$vbox->skipSessionCheck = true;
264
+
265
+			$settings = new phpVBoxConfigClass();
266
+			$settings->auth->logout($response);
267
+
268
+			session_destroy();
269
+
270
+			$response['data']['success'] = true;
271
+
272
+			break;
273
+
274
+
275
+		/*
276
+		 * If the above cases did not match, assume it is a request
277
+		 * that should be passed to vboxconnector.
278
+		 */
279
+		default:
280
+
281
+			$vbox = new vboxconnector();
282
+
283
+
284
+			/*
285
+			 * Every 1 minute we'll check that the account has not
286
+			 * been deleted since login, and update admin credentials.
287
+			 */
288
+			if($_SESSION['user'] && ((intval($_SESSION['authCheckHeartbeat'])+60) < time())) {
289
+
290
+				// init session and keep it open
291
+				session_init(true);
292
+				$vbox->settings->auth->heartbeat($vbox);
293
+
294
+				// We're done writing to session
295
+				if(function_exists('session_write_close'))
296
+					@session_write_close();
297
+
298
+			} else {
299
+
300
+				// init session but close it
301
+				session_init();
302
+
303
+			}
304
+
305
+			/*
306
+			 *  Persistent request data
307
+			 */
308
+			if(is_array($request['persist'])) {
309
+				$vbox->persistentRequest = $request['persist'];
310
+			}
311
+
312
+
313
+			/*
314
+			 * Call to vboxconnector
315
+			 */
316
+			$vbox->{$request['fn']}($request['params'],array(&$response));
317
+
318
+
319
+			/*
320
+			 * Send back persistent request in response
321
+			*/
322
+			if(is_array($vbox->persistentRequest) && count($vbox->persistentRequest)) {
323
+				$response['data']['persist'] = $vbox->persistentRequest;
324
+			}
325
+			break;
326
+
327
+	} // </switch()>
328
+
329
+/*
330
+ * Catch all exceptions and populate errors in the
331
+ * JSON response data.
332
+ */
333
+} catch (Exception $e) {
334
+
335
+	// Just append to $vbox->errors and let it get
336
+	// taken care of below
337
+	if(!$vbox || !$vbox->errors) {
338
+		$vbox->errors = array();
339
+	}
340
+	$vbox->errors[] = $e;
341
+}
342
+
343
+
344
+// Add any messages
345
+if($vbox && count($vbox->messages)) {
346
+	foreach($vbox->messages as $m)
347
+		$response['messages'][] = 'vboxconnector('.$request['fn'] .'): ' . $m;
348
+}
349
+// Add other error info
350
+if($vbox && $vbox->errors) {
351
+
352
+	foreach($vbox->errors as $e) { /* @var $e Exception */
353
+
354
+		ob_start();
355
+		print_r($e);
356
+		$d = ob_get_contents();
357
+		ob_end_clean();
358
+
359
+		# Add connection details to connection errors
360
+		if($e->getCode() == vboxconnector::PHPVB_ERRNO_CONNECT && isset($vbox->settings))
361
+			$d .= "\n\nLocation:" . $vbox->settings->location;
362
+
363
+		$response['messages'][] = htmlentities($e->getMessage()).' ' . htmlentities($details);
364
+
365
+		$response['errors'][] = array(
366
+			'error'=> ($e->getCode() & vboxconnector::PHPVB_ERRNO_HTML ? $e->getMessage() : htmlentities($e->getMessage())),
367
+			'details'=>htmlentities($d),
368
+			'errno'=>$e->getCode(),
369
+			// Fatal errors halt all processing
370
+			'fatal'=>($e->getCode() & vboxconnector::PHPVB_ERRNO_FATAL),
371
+			// Connection errors display alternate servers options
372
+			'connection'=>($e->getCode() & vboxconnector::PHPVB_ERRNO_CONNECT)
373
+		);
374
+	}
375
+}
376
+
377
+/*
378
+ * Return response as JSON encoded data or use PHP's
379
+ * print_r to dump data to browser.
380
+ */
381
+if(isset($request['printr'])) {
382
+	print_r($response);
383
+} else {
384
+    header('Content-type: application/json');
385
+	echo(json_encode($response));
386
+}
387
+

phpvirtualbox/phpvirtualbox-5.0-5/endpoints/config.js → phpvirtualbox/phpvirtualbox-5.2-1/endpoints/config.js View File


phpvirtualbox/phpvirtualbox-5.0-5/endpoints/index.html → phpvirtualbox/phpvirtualbox-5.2-1/endpoints/index.html View File


phpvirtualbox/phpvirtualbox-5.0-5/endpoints/jqueryFileTree.php → phpvirtualbox/phpvirtualbox-5.2-1/endpoints/jqueryFileTree.php View File

@@ -1,385 +1,385 @@
1
-<?php
2
-//
3
-// jQuery File Tree PHP Connector
4
-//
5
-// Version 1.01
6
-//
7
-// Cory S.N. LaViska
8
-// A Beautiful Site (http://abeautifulsite.net/)
9
-// 24 March 2008
10
-//
11
-// History:
12
-//
13
-// 1.01 - updated to work with foreign characters in directory/file names (12 April 2008)
14
-// 1.00 - released (24 March 2008)
15
-//
16
-// Output a list of files for jQuery File Tree
17
-//
18
-//	]--- Modified by Ian Moore for phpVirtualBox.
19
-//
20
-// $Id: jqueryFileTree.php 592 2015-04-12 19:53:44Z imoore76 $
21
-//
22
-//
23
-
24
-# Turn off PHP notices
25
-error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_WARNING);
26
-
27
-global $vbox, $localbrowser, $allowed;
28
-
29
-require_once(dirname(__FILE__).'/lib/config.php');
30
-require_once(dirname(__FILE__).'/lib/utils.php');
31
-require_once(dirname(__FILE__).'/lib/vboxconnector.php');
32
-
33
-error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_WARNING);
34
-
35
-session_init();
36
-if(!$_SESSION['valid']) return;
37
-
38
-/*
39
- * Get Settings
40
- */
41
-$settings = new phpVBoxConfigClass();
42
-
43
-
44
-$vbox = new vboxconnector();
45
-$vbox->connect();
46
-
47
-/*
48
- * Clean request
49
- */
50
-global $request;
51
-$request = clean_request();
52
-
53
-/*
54
- * Determine directory separator
55
- */
56
-$localbrowser = @$settings->browserLocal;
57
-if($localbrowser) {
58
-    define('DSEP', DIRECTORY_SEPARATOR);
59
-} else {
60
-    define('DSEP',$vbox->getDsep());
61
-}
62
-
63
-/*
64
- * Compose allowed file types list
65
- */
66
-$allowed_exts = $settings->browserRestrictFiles;
67
-if(is_array($allowed_exts) && count($allowed_exts) > 0) $allowed_exts = array_combine($allowed_exts,$allowed_exts);
68
-else $allowed_exts = array();
69
-
70
-/* Allowed folders list */
71
-$allowed_folders = @$settings->browserRestrictFolders;
72
-if(!is_array($allowed_folders))
73
-	$allowed_folders = array();
74
-
75
-/*
76
- * Get a list of windows drives
77
- */
78
-function get_windows_drives() {
79
-    $checklist = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
80
-    $drives = array();
81
-    for($i = 0; $i < strlen($d); $i++) {
82
-        if(is_dir($checklist[$i].':\\')) {
83
-            $drives[] = $checklist[$i].':\\';
84
-        }
85
-    }
86
-    return $drives;
87
-}
88
-
89
-/*
90
- * Allowed folders in windows if none are set
91
- */
92
-if(stripos($vbox->vbox->host->operatingSystem,'win') === 0 && !count($allowed_folders)) {
93
-
94
-	/*
95
-	 * Assumes web server and vbox host are the same physical machine
96
-	 */
97
-    if($request['fullpath'] && !$settings->forceWindowsAllDriveList && !$settings->noWindowsDriveList && stripos(PHP_OS,'win') === 0) {
98
-
99
-
100
-        $allowed_folders = get_windows_drives();
101
-
102
-    /*
103
-     * Just show all C-Z drive letters if vboxhost is windows and our web server is not...
104
-     */
105
-    } else if($request['fullpath'] && ($settings->forceWindowsAllDriveList || (!$settings->noWindowsDriveList && stripos(PHP_OS,'win') === false))) {
106
-    	$allowed_folders = array();
107
-        for($i = 67; $i < 91; $i++) {
108
-        	$allowed_folders[] = chr($i) .':\\';
109
-        }
110
-    }
111
-    $allowed_folders = array_combine($allowed_folders,$allowed_folders);
112
-
113
-}
114
-
115
-
116
-/* Deterine target DIR requested.
117
- * In some cases, "dir" passed is just a file name
118
- */
119
-if(strpos($request['dir'],DSEP)===false) {
120
-	$request['dir'] = DSEP;
121
-}
122
-
123
-// Eliminate duplicate DSEPs
124
-$request['dir'] = str_replace(DSEP.DSEP,DSEP,$request['dir']);
125
-
126
-
127
-/*
128
- * Check that folder restriction validates if it exists
129
- */
130
-if($request['dir'] != DSEP && count($allowed_folders)) {
131
-	$valid = false;
132
-	foreach($allowed_folders as $f) {
133
-		if(strpos(strtoupper($request['dir']),strtoupper($f)) === 0) {
134
-			$valid = true;
135
-			break;
136
-		}
137
-	}
138
-	if(!$valid) {
139
-		$request['dir'] = DSEP;
140
-	}
141
-}
142
-
143
-/*
144
- * Populate $returnData with directory listing
145
- */
146
-$returnData = array();
147
-
148
-/* Folder Restriction with root '/' requested */
149
-if($request['dir'] == DSEP && count($allowed_folders)) {
150
-
151
-	/* Just return restricted folders */
152
-	foreach($allowed_folders as $f) {
153
-		array_push($returnData, folder_entry($f, true));
154
-
155
-	}
156
-
157
-} else {
158
-
159
-
160
-    /* Full, expanded path to $dir */
161
-    if($request['fullpath']) {
162
-
163
-
164
-    	/* Go through allowed folders if it is set */
165
-    	if(count($allowed_folders)) {
166
-
167
-
168
-    		foreach($allowed_folders as $f) {
169
-
170
-    			/* If this was not exactly the requested folder, but a parent,
171
-    			 * list everything below it.
172
-    			 */
173
-    			if((strtoupper($request['dir']) != strtoupper($f)) && strpos(strtoupper($request['dir']),strtoupper($f)) === 0) {
174
-
175
-    				// List entries in this folder
176
-    				$path = explode(DSEP, substr($request['dir'],strlen($f)));
177
-
178
-    				if($path[0] == '') {
179
-    				    array_shift($path);
180
-    				}
181
-
182
-    			    $folder_entry = folder_entry($f, true);
183
-
184
-    			    $folder_entry['children'] = getdir($f, $request['dirsOnly'], $path);
185
-    			    $folder_entry['expanded'] = true;
186
-
187
-    			    array_push($returnData, $folder_entry);
188
-
189
-    			} else {
190
-    				array_push($returnData, folder_entry($f,true));
191
-    			}
192
-
193
-    		}
194
-
195
-    	/* Just get full path */
196
-    	} else {
197
-
198
-			// List entries in this folder
199
-			$path = explode(DSEP,$request['dir']);
200
-			$root = array_shift($path).DSEP;
201
-
202
-			// Folder entry
203
-			$returnData = getdir($root, $request['dirsOnly'], $path);
204
-
205
-    	}
206
-
207
-
208
-    } else {
209
-
210
-        /* Default action. Return dir requested */
211
-        $returnData = getdir($request['dir'], $request['dirsOnly']);
212
-
213
-    }
214
-
215
-}
216
-
217
-header('Content-type: application/json');
218
-echo(json_encode($returnData));
219
-
220
-
221
-/*
222
- * Get directory entries
223
- */
224
-function getdir($dir, $dirsOnly=false, $recurse=array()) {
225
-
226
-	if(!$dir) $dir = DSEP;
227
-
228
-	$entries = getDirEntries($dir, $dirsOnly);
229
-
230
-    if(!count($entries))
231
-    	return array();
232
-
233
-    $dirents = array();
234
-    foreach($entries as $path => $type) {
235
-
236
-        if($type == 'folder' && count($recurse) && (strcasecmp($recurse[0],vbox_basename($path)) == 0)) {
237
-
238
-        	$entry = folder_entry($path, false, true);
239
-
240
-            $entry['children'] = getdir($dir.DSEP.array_shift($recurse), $dirsOnly, $recurse);
241
-
242
-            array_push($dirents, $entry);
243
-
244
-        } else {
245
-
246
-        	// Push folder on to stack
247
-        	if($type == 'folder') {
248
-
249
-        	   array_push($dirents, folder_entry($path));
250
-
251
-        	// Push file on to stack
252
-        	} else {
253
-
254
-        		$ext = strtolower(preg_replace('/^.*\./', '', $file));
255
-
256
-                if(count($allowed) && !$allowed['.'.$ext]) continue;
257
-
258
-                array_push($dirents, file_entry($path));
259
-        	}
260
-        }
261
-
262
-    }
263
-
264
-    return $dirents;
265
-
266
-}
267
-
268
-function vbox_basename($b) { return substr($b,strrpos($b,DSEP)+1); }
269
-function file_entry($f) {
270
-	$f = str_replace(DSEP.DSEP,DSEP,$f);
271
-    $ext = strtolower(preg_replace('/^.*\./', '', $f));
272
-    return array(
273
-        'ext' => $ext,
274
-        'name' => htmlentities(vbox_basename($f), ENT_QUOTES),
275
-        'path' => htmlentities($f, ENT_QUOTES),
276
-        'type' => 'file'
277
-    );
278
-}
279
-function folder_entry($f,$full=false,$expanded=false) {
280
-	$f = str_replace(DSEP.DSEP,DSEP,$f);
281
-    $selected = (strnatcasecmp(rtrim($f,DSEP),rtrim($GLOBALS['request']['dir'],DSEP)) == 0) && $expanded;
282
-    return array(
283
-        'expanded' => (bool)$expanded,
284
-        'selected' => (bool)$selected,
285
-        'path' => htmlentities($f,ENT_QUOTES),
286
-        'name' => htmlentities(($full ? $f : vbox_basename($f)),ENT_QUOTES),
287
-        'type' => 'folder',
288
-		'children' => array()
289
-    );
290
-}
291
-
292
-
293
-
294
-/**
295
- * Rreturn a list of directory entries
296
- *
297
- * @param String $dir
298
- * @return Array of entries
299
- */
300
-
301
-function getDirEntries($dir, $foldersOnly=false) {
302
-
303
-	global $localbrowser, $allowed_exts, $vbox;
304
-
305
-	// Append trailing slash if it isn't here
306
-	if(substr($dir,-1) != DSEP)
307
-	    $dir .= DSEP;
308
-
309
-
310
-    /*
311
-     * Use local file / folder browser (PHP)
312
-     */
313
-	if($localbrowser) {
314
-
315
-		// If the dir doesn't exist or we can't scan it, just return
316
-		if(!(file_exists($dir) && ($ents = @scandir($dir))))
317
-			return array();
318
-
319
-		$newtypes = array();
320
-		$newents = array();
321
-		for($i = 0; $i < count($ents); $i++) {
322
-
323
-			// Skip . and ..
324
-			if($ents[$i] == '.' || $ents[$i] == '..')
325
-				continue;
326
-
327
-			$fullpath = $dir.$ents[$i];
328
-			$isdir = @is_dir($fullpath);
329
-
330
-			if(!$isdir && $foldersOnly)
331
-				continue;
332
-
333
-			array_push($newtypes, $isdir ? 'folder' : 'file');
334
-			array_push($newents, $fullpath);
335
-		}
336
-		return array_combine($newents, $newtypes);
337
-
338
-	/*
339
-	 * Use remote file / folder browser (vbox)
340
-	 */
341
-	} else {
342
-
343
-		try {
344
-
345
-
346
-		    $appl = $vbox->vbox->createAppliance();
347
-		    $vfs = $appl->createVFSExplorer('file://'.str_replace(DSEP.DSEP,DSEP,$dir));
348
-		    $progress = $vfs->update();
349
-		    $progress->waitForCompletion(-1);
350
-		    $progress->releaseRemote();
351
-		    list($ents,$types) = $vfs->entryList();
352
-		    $vfs->releaseRemote();
353
-		    $appl->releaseRemote();
354
-
355
-		} catch (Exception $e) {
356
-
357
-		    echo($e->getMessage());
358
-
359
-		    return array();
360
-
361
-		}
362
-
363
-		// Convert types to file / folder
364
-		$newtypes = array();
365
-		$newents = array();
366
-		for($i = 0; $i < count($types); $i++) {
367
-
368
-			// Skip . and ..
369
-			if($ents[$i] == '.' || $ents[$i] == '..')
370
-			    continue;
371
-
372
-			$isdir = $types[$i] == 4;
373
-
374
-			if(!$isdir && $foldersOnly)
375
-				continue;
376
-
377
-			array_push($newtypes, $isdir ? 'folder' : 'file');
378
-			array_push($newents, $dir.$ents[$i]);
379
-		}
380
-		return array_combine($newents,$newtypes);
381
-
382
-	}
383
-
384
-
385
-}
1
+<?php
2
+//
3
+// jQuery File Tree PHP Connector
4
+//
5
+// Version 1.01
6
+//
7
+// Cory S.N. LaViska
8
+// A Beautiful Site (http://abeautifulsite.net/)
9
+// 24 March 2008
10
+//
11
+// History:
12
+//
13
+// 1.01 - updated to work with foreign characters in directory/file names (12 April 2008)
14
+// 1.00 - released (24 March 2008)
15
+//
16
+// Output a list of files for jQuery File Tree
17
+//
18
+//	]--- Modified by Ian Moore for phpVirtualBox.
19
+//
20
+// $Id: jqueryFileTree.php 592 2015-04-12 19:53:44Z imoore76 $
21
+//
22
+//
23
+
24
+# Turn off PHP notices
25
+error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_WARNING);
26
+
27
+global $vbox, $localbrowser, $allowed;
28
+
29
+require_once(dirname(__FILE__).'/lib/config.php');
30
+require_once(dirname(__FILE__).'/lib/utils.php');
31
+require_once(dirname(__FILE__).'/lib/vboxconnector.php');
32
+
33
+error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_WARNING);
34
+
35
+session_init();
36
+if(!$_SESSION['valid']) return;
37
+
38
+/*
39
+ * Get Settings
40
+ */
41
+$settings = new phpVBoxConfigClass();
42
+
43
+
44
+$vbox = new vboxconnector();
45
+$vbox->connect();
46
+
47
+/*
48
+ * Clean request
49
+ */
50
+global $request;
51
+$request = clean_request();
52
+
53
+/*
54
+ * Determine directory separator
55
+ */
56
+$localbrowser = @$settings->browserLocal;
57
+if($localbrowser) {
58
+    define('DSEP', DIRECTORY_SEPARATOR);
59
+} else {
60
+    define('DSEP',$vbox->getDsep());
61
+}
62
+
63
+/*
64
+ * Compose allowed file types list
65
+ */
66
+$allowed_exts = $settings->browserRestrictFiles;
67
+if(is_array($allowed_exts) && count($allowed_exts) > 0) $allowed_exts = array_combine($allowed_exts,$allowed_exts);
68
+else $allowed_exts = array();
69
+
70
+/* Allowed folders list */
71
+$allowed_folders = @$settings->browserRestrictFolders;
72
+if(!is_array($allowed_folders))
73
+	$allowed_folders = array();
74
+
75
+/*
76
+ * Get a list of windows drives
77
+ */
78
+function get_windows_drives() {
79
+    $checklist = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
80
+    $drives = array();
81
+    for($i = 0; $i < strlen($d); $i++) {
82
+        if(is_dir($checklist[$i].':\\')) {
83
+            $drives[] = $checklist[$i].':\\';
84
+        }
85
+    }
86
+    return $drives;
87
+}
88
+
89
+/*
90
+ * Allowed folders in windows if none are set
91
+ */
92
+if(stripos($vbox->vbox->host->operatingSystem,'win') === 0 && !count($allowed_folders)) {
93
+
94
+	/*
95
+	 * Assumes web server and vbox host are the same physical machine
96
+	 */
97
+    if($request['fullpath'] && !$settings->forceWindowsAllDriveList && !$settings->noWindowsDriveList && stripos(PHP_OS,'win') === 0) {
98
+
99
+
100
+        $allowed_folders = get_windows_drives();
101
+
102
+    /*
103
+     * Just show all C-Z drive letters if vboxhost is windows and our web server is not...
104
+     */
105
+    } else if($request['fullpath'] && ($settings->forceWindowsAllDriveList || (!$settings->noWindowsDriveList && stripos(PHP_OS,'win') === false))) {
106
+    	$allowed_folders = array();
107
+        for($i = 67; $i < 91; $i++) {
108
+        	$allowed_folders[] = chr($i) .':\\';
109
+        }
110
+    }
111
+    $allowed_folders = array_combine($allowed_folders,$allowed_folders);
112
+
113
+}
114
+
115
+
116
+/* Deterine target DIR requested.
117
+ * In some cases, "dir" passed is just a file name
118
+ */
119
+if(strpos($request['dir'],DSEP)===false) {
120
+	$request['dir'] = DSEP;
121
+}
122
+
123
+// Eliminate duplicate DSEPs
124
+$request['dir'] = str_replace(DSEP.DSEP,DSEP,$request['dir']);
125
+
126
+
127
+/*
128
+ * Check that folder restriction validates if it exists
129
+ */
130
+if($request['dir'] != DSEP && count($allowed_folders)) {
131
+	$valid = false;
132
+	foreach($allowed_folders as $f) {
133
+		if(strpos(strtoupper($request['dir']),strtoupper($f)) === 0) {
134
+			$valid = true;
135
+			break;
136
+		}
137
+	}
138
+	if(!$valid) {
139
+		$request['dir'] = DSEP;
140
+	}
141
+}
142
+
143
+/*
144
+ * Populate $returnData with directory listing
145
+ */
146
+$returnData = array();
147
+
148
+/* Folder Restriction with root '/' requested */
149
+if($request['dir'] == DSEP && count($allowed_folders)) {
150
+
151
+	/* Just return restricted folders */
152
+	foreach($allowed_folders as $f) {
153
+		array_push($returnData, folder_entry($f, true));
154
+
155
+	}
156
+
157
+} else {
158
+
159
+
160
+    /* Full, expanded path to $dir */
161
+    if($request['fullpath']) {
162
+
163
+
164
+    	/* Go through allowed folders if it is set */
165
+    	if(count($allowed_folders)) {
166
+
167
+
168
+    		foreach($allowed_folders as $f) {
169
+
170
+    			/* If this was not exactly the requested folder, but a parent,
171
+    			 * list everything below it.
172
+    			 */
173
+    			if((strtoupper($request['dir']) != strtoupper($f)) && strpos(strtoupper($request['dir']),strtoupper($f)) === 0) {
174
+
175
+    				// List entries in this folder
176
+    				$path = explode(DSEP, substr($request['dir'],strlen($f)));
177
+
178
+    				if($path[0] == '') {
179
+    				    array_shift($path);
180
+    				}
181
+
182
+    			    $folder_entry = folder_entry($f, true);
183
+
184
+    			    $folder_entry['children'] = getdir($f, $request['dirsOnly'], $path);
185
+    			    $folder_entry['expanded'] = true;
186
+
187
+    			    array_push($returnData, $folder_entry);
188
+
189
+    			} else {
190
+    				array_push($returnData, folder_entry($f,true));
191
+    			}
192
+
193
+    		}
194
+
195
+    	/* Just get full path */
196
+    	} else {
197
+
198
+			// List entries in this folder
199
+			$path = explode(DSEP,$request['dir']);
200
+			$root = array_shift($path).DSEP;
201
+
202
+			// Folder entry
203
+			$returnData = getdir($root, $request['dirsOnly'], $path);
204
+
205
+    	}
206
+
207
+
208
+    } else {
209
+
210
+        /* Default action. Return dir requested */
211
+        $returnData = getdir($request['dir'], $request['dirsOnly']);
212
+
213
+    }
214
+
215
+}
216
+
217
+header('Content-type: application/json');
218
+echo(json_encode($returnData));
219
+
220
+
221
+/*
222
+ * Get directory entries
223
+ */
224
+function getdir($dir, $dirsOnly=false, $recurse=array()) {
225
+
226
+	if(!$dir) $dir = DSEP;
227
+
228
+	$entries = getDirEntries($dir, $dirsOnly);
229
+
230
+    if(!count($entries))
231
+    	return array();
232
+
233
+    $dirents = array();
234
+    foreach($entries as $path => $type) {
235
+
236
+        if($type == 'folder' && count($recurse) && (strcasecmp($recurse[0],vbox_basename($path)) == 0)) {
237
+
238
+        	$entry = folder_entry($path, false, true);
239
+
240
+            $entry['children'] = getdir($dir.DSEP.array_shift($recurse), $dirsOnly, $recurse);
241
+
242
+            array_push($dirents, $entry);
243
+
244
+        } else {
245
+
246
+        	// Push folder on to stack
247
+        	if($type == 'folder') {
248
+
249
+        	   array_push($dirents, folder_entry($path));
250
+
251
+        	// Push file on to stack
252
+        	} else {
253
+
254
+        		$ext = strtolower(preg_replace('/^.*\./', '', $file));
255
+
256
+                if(count($allowed) && !$allowed['.'.$ext]) continue;
257
+
258
+                array_push($dirents, file_entry($path));
259
+        	}
260
+        }
261
+
262
+    }
263
+
264
+    return $dirents;
265
+
266
+}
267
+
268
+function vbox_basename($b) { return substr($b,strrpos($b,DSEP)+1); }
269
+function file_entry($f) {
270
+	$f = str_replace(DSEP.DSEP,DSEP,$f);
271
+    $ext = strtolower(preg_replace('/^.*\./', '', $f));
272
+    return array(
273
+        'ext' => $ext,
274
+        'name' => htmlentities(vbox_basename($f), ENT_QUOTES),
275
+        'path' => htmlentities($f, ENT_QUOTES),
276
+        'type' => 'file'
277
+    );
278
+}
279
+function folder_entry($f,$full=false,$expanded=false) {
280
+	$f = str_replace(DSEP.DSEP,DSEP,$f);
281
+    $selected = (strnatcasecmp(rtrim($f,DSEP),rtrim($GLOBALS['request']['dir'],DSEP)) == 0) && $expanded;
282
+    return array(
283
+        'expanded' => (bool)$expanded,
284
+        'selected' => (bool)$selected,
285
+        'path' => htmlentities($f,ENT_QUOTES),
286
+        'name' => htmlentities(($full ? $f : vbox_basename($f)),ENT_QUOTES),
287
+        'type' => 'folder',
288
+		'children' => array()
289
+    );
290
+}
291
+
292
+
293
+
294
+/**
295
+ * Rreturn a list of directory entries
296
+ *
297
+ * @param String $dir
298
+ * @return Array of entries
299
+ */
300
+
301
+function getDirEntries($dir, $foldersOnly=false) {
302
+
303
+	global $localbrowser, $allowed_exts, $vbox;
304
+
305
+	// Append trailing slash if it isn't here
306
+	if(substr($dir,-1) != DSEP)
307
+	    $dir .= DSEP;
308
+
309
+
310
+    /*
311
+     * Use local file / folder browser (PHP)
312
+     */
313
+	if($localbrowser) {
314
+
315
+		// If the dir doesn't exist or we can't scan it, just return
316
+		if(!(file_exists($dir) && ($ents = @scandir($dir))))
317
+			return array();
318
+
319
+		$newtypes = array();
320
+		$newents = array();
321
+		for($i = 0; $i < count($ents); $i++) {
322
+
323
+			// Skip . and ..
324
+			if($ents[$i] == '.' || $ents[$i] == '..')
325
+				continue;
326
+
327
+			$fullpath = $dir.$ents[$i];
328
+			$isdir = @is_dir($fullpath);
329
+
330
+			if(!$isdir && $foldersOnly)
331
+				continue;
332
+
333
+			array_push($newtypes, $isdir ? 'folder' : 'file');
334
+			array_push($newents, $fullpath);
335
+		}
336
+		return array_combine($newents, $newtypes);
337
+
338
+	/*
339
+	 * Use remote file / folder browser (vbox)
340
+	 */
341
+	} else {
342
+
343
+		try {
344
+
345
+
346
+		    $appl = $vbox->vbox->createAppliance();
347
+		    $vfs = $appl->createVFSExplorer('file://'.str_replace(DSEP.DSEP,DSEP,$dir));
348
+		    $progress = $vfs->update();
349
+		    $progress->waitForCompletion(-1);
350
+		    $progress->releaseRemote();
351
+		    list($ents,$types) = $vfs->entryList();
352
+		    $vfs->releaseRemote();
353
+		    $appl->releaseRemote();
354
+
355
+		} catch (Exception $e) {
356
+
357
+		    echo($e->getMessage());
358
+
359
+		    return array();
360
+
361
+		}
362
+
363
+		// Convert types to file / folder
364
+		$newtypes = array();
365
+		$newents = array();
366
+		for($i = 0; $i < count($types); $i++) {
367
+
368
+			// Skip . and ..
369
+			if($ents[$i] == '.' || $ents[$i] == '..')
370
+			    continue;
371
+
372
+			$isdir = $types[$i] == 4;
373
+
374
+			if(!$isdir && $foldersOnly)
375
+				continue;
376
+
377
+			array_push($newtypes, $isdir ? 'folder' : 'file');
378
+			array_push($newents, $dir.$ents[$i]);
379
+		}
380
+		return array_combine($newents,$newtypes);
381
+
382
+	}
383
+
384
+
385
+}

phpvirtualbox/phpvirtualbox-5.0-5/endpoints/language.php → phpvirtualbox/phpvirtualbox-5.2-1/endpoints/language.php View File

@@ -1,117 +1,117 @@
1
-<?php
2
-/*
3
- * Injects language translations into phpVirtualBox as a JavaScript object and
4
- * provides interface translation logic
5
- * Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
6
- *
7
- * $Id: language.php 595 2015-04-17 09:50:36Z imoore76 $
8
- */
9
-
10
-
11
-error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT);
12
-
13
-require_once(dirname(__FILE__).'/lib/language.php');
14
-
15
-if(!is_object($_vbox_language)) $_vbox_language = new __vbox_language();
16
-
17
-
18
-header("Content-type: application/javascript; charset=utf-8", true);
19
-
20
-//Set no caching
21
-header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
22
-header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
23
-header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
24
-header("Pragma: no-cache");
25
-
26
-if(isset($_GET['debug']) && $_GET['debug']) {
27
-	print_r(__vbox_language::$langdata);
28
-	return;
29
-}
30
-
31
-/*
32
- * Dump in JavaScript
33
- */
34
-echo('var __vboxLangData = ' . json_encode(__vbox_language::$langdata) .";\n\nvar __vboxLangName = '".constant('VBOXLANG')."';\n\n");
35
-
36
-
37
-?>
38
-
39
-
40
-// Failsafe wrapper
41
-function trans(s,c,n,h) {
42
-
43
-    if(s && c && c.constructor === Array) {
44
-        o = c.shift();
45
-        n = c.shift();
46
-        h = c.shift();
47
-        c = o;
48
-    }
49
-	if(!c) c = 'VBoxGlobal';
50
-
51
-	var r = transreal(s,c,n,h);
52
-
53
-	if(typeof r != 'string') {
54
-	   // console.log('Could not translate ' + s + ' with ' + c);
55
-	   return s;
56
-	}
57
-
58
-	return r;
59
-}
60
-
61
-function transreal(w,context,number,comment) {
62
-
63
-	try {
64
-
65
-		if(__vboxLangData['contexts'][context]['messages'][w]['translation']) {
66
-
67
-			if(__vboxLangData['contexts'][context]['messages'][w]['translation']['numerusform']) {
68
-
69
-				var t = __vboxLangData['contexts'][context]['messages'][w]['translation']['numerusform'];
70
-
71
-				if(!number) number = 1;
72
-
73
-				if(number <= 1 && t[0]) return t[0];
74
-				if(number > 1 && t[1]) return t[1];
75
-				if(t[0]) return t[0];
76
-				return t[1];
77
-			}
78
-			/*
79
-			if (__vboxLangData['contexts'][context]['messages'][w] && __vboxLangData['contexts'][context]['messages'][w]['translation_attr'] && __vboxLangData['contexts'][context]['messages'][w]['translation_attr']['type'] == 'obsolete') {
80
-			   console.log(w + ' in ' + context + ' is obsolete');
81
-			}
82
-			*/
83
-			return __vboxLangData['contexts'][context]['messages'][w]['translation'];
84
-
85
-		} else if(__vboxLangData['contexts'][context]['messages'][w][0]) {
86
-
87
-			if(comment) {
88
-				for(var i in __vboxLangData['contexts'][context]['messages'][w]) {
89
-					if(__vboxLangData['contexts'][context]['messages'][w][i]['comment'] == comment) {
90
-					    /*
91
-						if (__vboxLangData['contexts'][context]['messages'][w][i]['translation_attr'] && __vboxLangData['contexts'][context]['messages'][w][i]['translation_attr']['type'] == 'obsolete') {
92
-						    console.log(w + ' ' + ' and ' + comment + ' is obsolete');
93
-			             }
94
-			             */
95
-
96
-					    return __vboxLangData['contexts'][context]['messages'][w][i]['translation'];
97
-					}
98
-				}
99
-			}
100
-			/*
101
-			if (__vboxLangData['contexts'][context]['messages'][w][0] && __vboxLangData['contexts'][context]['messages'][w][0]['translation_attr'] && __vboxLangData['contexts'][context]['messages'][w][0]['translation_attr']['type'] == 'obsolete') {
102
-			   console.log(w + ' in ' + context + ' is obsolete');
103
-			}
104
-			*/
105
-
106
-			return __vboxLangData['contexts'][context]['messages'][w][0]['translation'];
107
-
108
-		} else {
109
-			return w;
110
-		}
111
-
112
-	} catch(err) {
113
-		// console.log(w + ' - ' + context + ': ' + err);
114
-		return w;
115
-	}
116
-}
117
-
1
+<?php
2
+/*
3
+ * Injects language translations into phpVirtualBox as a JavaScript object and
4
+ * provides interface translation logic
5
+ * Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
6
+ *
7
+ * $Id: language.php 595 2015-04-17 09:50:36Z imoore76 $
8
+ */
9
+
10
+
11
+error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT);
12
+
13
+require_once(dirname(__FILE__).'/lib/language.php');
14
+
15
+if(!is_object($_vbox_language)) $_vbox_language = new __vbox_language();
16
+
17
+
18
+header("Content-type: application/javascript; charset=utf-8", true);
19
+
20
+//Set no caching
21
+header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
22
+header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
23
+header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
24
+header("Pragma: no-cache");
25
+
26
+if(isset($_GET['debug']) && $_GET['debug']) {
27
+	print_r(__vbox_language::$langdata);
28
+	return;
29
+}
30
+
31
+/*
32
+ * Dump in JavaScript
33
+ */
34
+echo('var __vboxLangData = ' . json_encode(__vbox_language::$langdata) .";\n\nvar __vboxLangName = '".constant('VBOXLANG')."';\n\n");
35
+
36
+
37
+?>
38
+
39
+
40
+// Failsafe wrapper
41
+function trans(s,c,n,h) {
42
+
43
+    if(s && c && c.constructor === Array) {
44
+        o = c.shift();
45
+        n = c.shift();
46
+        h = c.shift();
47
+        c = o;
48
+    }
49
+	if(!c) c = 'VBoxGlobal';
50
+
51
+	var r = transreal(s,c,n,h);
52
+
53
+	if(typeof r != 'string') {
54
+	   // console.log('Could not translate ' + s + ' with ' + c);
55
+	   return s;
56
+	}
57
+
58
+	return r;
59
+}
60
+
61
+function transreal(w,context,number,comment) {
62
+
63
+	try {
64
+
65
+		if(__vboxLangData['contexts'][context]['messages'][w]['translation']) {
66
+
67
+			if(__vboxLangData['contexts'][context]['messages'][w]['translation']['numerusform']) {
68
+
69
+				var t = __vboxLangData['contexts'][context]['messages'][w]['translation']['numerusform'];
70
+
71
+				if(!number) number = 1;
72
+
73
+				if(number <= 1 && t[0]) return t[0];
74
+				if(number > 1 && t[1]) return t[1];
75
+				if(t[0]) return t[0];
76
+				return t[1];
77
+			}
78
+			/*
79
+			if (__vboxLangData['contexts'][context]['messages'][w] && __vboxLangData['contexts'][context]['messages'][w]['translation_attr'] && __vboxLangData['contexts'][context]['messages'][w]['translation_attr']['type'] == 'obsolete') {
80
+			   console.log(w + ' in ' + context + ' is obsolete');
81
+			}
82
+			*/
83
+			return __vboxLangData['contexts'][context]['messages'][w]['translation'];
84
+
85
+		} else if(__vboxLangData['contexts'][context]['messages'][w][0]) {
86
+
87
+			if(comment) {
88
+				for(var i in __vboxLangData['contexts'][context]['messages'][w]) {
89
+					if(__vboxLangData['contexts'][context]['messages'][w][i]['comment'] == comment) {
90
+					    /*
91
+						if (__vboxLangData['contexts'][context]['messages'][w][i]['translation_attr'] && __vboxLangData['contexts'][context]['messages'][w][i]['translation_attr']['type'] == 'obsolete') {
92
+						    console.log(w + ' ' + ' and ' + comment + ' is obsolete');
93
+			             }
94
+			             */
95
+
96
+					    return __vboxLangData['contexts'][context]['messages'][w][i]['translation'];
97
+					}
98
+				}
99
+			}
100
+			/*
101
+			if (__vboxLangData['contexts'][context]['messages'][w][0] && __vboxLangData['contexts'][context]['messages'][w][0]['translation_attr'] && __vboxLangData['contexts'][context]['messages'][w][0]['translation_attr']['type'] == 'obsolete') {
102
+			   console.log(w + ' in ' + context + ' is obsolete');
103
+			}
104
+			*/
105
+
106
+			return __vboxLangData['contexts'][context]['messages'][w][0]['translation'];
107
+
108
+		} else {
109
+			return w;
110
+		}
111
+
112
+	} catch(err) {
113
+		// console.log(w + ' - ' + context + ': ' + err);
114
+		return w;
115
+	}
116
+}
117
+

phpvirtualbox/phpvirtualbox-5.0-5/endpoints/lib/auth/ActiveDirectory.php → phpvirtualbox/phpvirtualbox-5.2-1/endpoints/lib/auth/ActiveDirectory.php View File

@@ -1,203 +1,203 @@
1
-<?php
2
-/*
3
- * $Id: ActiveDirectory.php 501 2013-07-11 17:44:37Z imooreyahoo@gmail.com $
4
-* Experimental!
5
-*/
6
-class phpvbAuthActiveDirectory implements phpvbAuth {
7
-
8
-	var $capabilities = array(
9
-		'canChangePassword' => false,
10
-		'canLogout' => true
11
-	);
12
-
13
-	var $config = array(
14
-		'host' => '127.0.0.1',
15
-		'admin_group' => null,
16
-		'adminUser' => null,
17
-		'user_group' => null,
18
-		'container' => 'CN=Users',
19
-		'domain' =>   'internal.local',
20
-		'filter' => '(&(objectclass=User)(objectCategory=Person))'
21
-	);
22
-
23
-	/**
24
-	 * Constructor
25
-	 * @param array $userConfig - user configuration for this module
26
-	 */
27
-	function phpvbAuthActiveDirectory($userConfig = null) {
28
-		// Merge user config
29
-		if($userConfig) {
30
-			$this->config = array_merge($this->config,$userConfig);
31
-		}		
32
-	}
33
-
34
-	/**
35
-	 * Test log in and set $_SESSION vars
36
-	 * @param string $username
37
-	 * @param string $password
38
-	 * @see phpvbAuth::login()
39
-	 */
40
-	function login($username, $password)
41
-	{
42
-		global $_SESSION;
43
-
44
-
45
-		/*
46
-		 * Check for LDAP functionality and provide some direction
47
-		 */
48
-		if(!function_exists('ldap_connect')) {
49
-
50
-			$ex = 'LDAP support is not enabled in your PHP configuration.';
51
-
52
-			if(strtolower(substr(PHP_OS, 0, 3)) == 'win') {
53
-
54
-				ob_start();
55
-				phpinfo(INFO_GENERAL);
56
-				$phpinfo = ob_get_contents();
57
-				ob_end_clean();
58
-				preg_match('/Loaded Configuration File <\/td><td.*?>(.*?)\s*</', $phpinfo, $phpinfo);
59
-
60
-				$ex .= ' You probably just need to uncomment the line ;extension=php_ldap.dll in php.ini'.
61
-						(count($phpinfo) > 1 ? ' (' .trim($phpinfo[1]).')' : '') . ' by removing the ";" and restart your web server.';
62
-
63
-			} else if(strtolower(substr(PHP_OS, 0, 5)) == 'Linux') {
64
-
65
-				$ex .= ' You probably need to install the php5-ldap (or similar depending on your distribution) package and restart your web server.';
66
-					
67
-			}
68
-			throw new Exception($ex);
69
-		}
70
-
71
-		$_SESSION['valid'] = false;
72
-
73
-		// Connect to server
74
-		if(!($auth = ldap_connect($this->config['host']))) {
75
-			throw new Exception('Active Directory error ('.ldap_errno($auth).') ' . ldap_error($auth));
76
-		}
77
-
78
-		// Set relevant LDAP options
79
-		ldap_set_option($auth,LDAP_OPT_PROTOCOL_VERSION, 3);
80
-		
81
-
82
-		// Main login /bind
83
-		if(!($bind = @ldap_bind($auth, $username . "@" .$this->config['domain'], $password))) {
84
-			if(ldap_errno($auth) == 49) return false;
85
-			throw new Exception('Active Directory error ('.ldap_errno($auth).') ' . ldap_error($auth));
86
-		}
87
-		
88
-		
89
-		// Get user information from AD
90
-		////////////////////////////////////
91
-		
92
-		
93
-		// Set filter and sanitize username before sending it to AD
94
-		$filter = "(sAMAccountName=" .
95
-			str_replace(array(',','=','+','<','>',';','\\','"','#','(',')','*',chr(0)), '', $username) . ")";
96
-		if($this->config['filter'] && false) {
97
-			$filter = '(&'. $this->config['filter'] .' ('. $filter .'))';
98
-		}
99
-		
100
-		$result = @ldap_search($auth,
101
-				$this->config['container'] . ',DC=' . join(',DC=', explode('.', $this->config['domain'])),
102
-				$filter, array("memberof","useraccountcontrol"));
103
-
104
-		if(!result) throw new Exception ("Unable to search Active Directory server: " . ldap_error($auth));
105
-		@list($entries) = @ldap_get_entries($auth, $result);
106
-		@ldap_unbind($auth);
107
-		if(!$entries) {
108
-			throw new Exception("Permission denied");
109
-		}
110
-		
111
-		
112
-		// Check for disabled user
113
-		if((intval($entries['useraccountcontrol'][0]) & 2)) {
114
-			throw new Exception('This account is disabled in Active Directory.');
115
-		}
116
-
117
-		// check for valid admin group
118
-		if($this->config['admin_group']) {
119
-			foreach($entries['memberof'] as $group) {
120
-				list($group) = explode(',', $group);
121
-				if(strtolower($group) == strtolower('cn='.$this->config['admin_group'])) {
122
-					$_SESSION['admin'] = $_SESSION['valid'] = true;
123
-					break;
124
-				}
125
-			}
126
-		}
127
-		
128
-		// Admin user explicitly set?
129
-		if(!$_SESSION['admin'] && $this->config['adminUser']) {
130
-			$_SESSION['admin'] = (strtolower($this->config['adminUser']) == strtolower($username));
131
-			// Admin is ok
132
-			$_SESSION['valid'] = ($_SESSION['admin'] || $_SESSION['valid']);
133
-		}
134
-
135
-		// check for valid user group
136
-		if($this->config['user_group'] && !$_SESSION['valid']) {
137
-			foreach($entries['memberof'] as $group) {
138
-				list($group) = explode(',', $group);
139
-				if(strtolower($group) == strtolower('cn='.$this->config['user_group'])) {
140
-					$_SESSION['valid'] = true;
141
-					break;
142
-				}
143
-			}
144
-		} else {
145
-			$_SESSION['valid'] = true;
146
-		}
147
-		
148
-		if(!$_SESSION['valid'])
149
-			throw new Exception("Permission denied");
150
-
151
-		// Admin user explicitly set?
152
-		if(!$_SESSION['admin'] && $this->config['adminUser']) {
153
-			$_SESSION['admin'] = (strtolower($this->config['adminUser']) == strtolower($username));
154
-		}
155
-
156
-		// No admin information specified makes everyone an admin
157
-		if(!$this->config['adminUser'] && !$this->config['admin_group'])
158
-			$_SESSION['admin'] = true;
159
-		
160
-		// user has permission. establish session variables
161
-		$_SESSION['user'] = $username;
162
-		$_SESSION['authCheckHeartbeat'] = time();
163
-
164
-		
165
-		return true;
166
-		
167
-	}
168
-
169
-	function heartbeat($vbox)
170
-	{
171
-		global $_SESSION;
172
-
173
-		$_SESSION['valid'] = true;
174
-		$_SESSION['authCheckHeartbeat'] = time();
175
-	}
176
-
177
-	function changePassword($old, $new)
178
-	{
179
-	}
180
-
181
-	function logout(&$response)
182
-	{
183
-		global $_SESSION;
184
-		if(function_exists('session_destroy')) session_destroy();
185
-		else unset($_SESSION['valid']);
186
-		$response['data']['result'] = 1;
187
-	}
188
-
189
-	function listUsers()
190
-	{
191
-
192
-	}
193
-
194
-	function updateUser($vboxRequest, $skipExistCheck)
195
-	{
196
-
197
-	}
198
-
199
-	function deleteUser($user)
200
-	{
201
-
202
-	}
203
-}
1
+<?php
2
+/*
3
+ * $Id: ActiveDirectory.php 501 2013-07-11 17:44:37Z imooreyahoo@gmail.com $
4
+* Experimental!
5
+*/
6
+class phpvbAuthActiveDirectory implements phpvbAuth {
7
+
8
+	var $capabilities = array(
9
+		'canChangePassword' => false,
10
+		'canLogout' => true
11
+	);
12
+
13
+	var $config = array(
14
+		'host' => '127.0.0.1',
15
+		'admin_group' => null,
16
+		'adminUser' => null,
17
+		'user_group' => null,
18
+		'container' => 'CN=Users',
19
+		'domain' =>   'internal.local',
20
+		'filter' => '(&(objectclass=User)(objectCategory=Person))'
21
+	);
22
+
23
+	/**
24
+	 * Constructor
25
+	 * @param array $userConfig - user configuration for this module
26
+	 */
27
+	function phpvbAuthActiveDirectory($userConfig = null) {
28
+		// Merge user config
29
+		if($userConfig) {
30
+			$this->config = array_merge($this->config,$userConfig);
31
+		}		
32
+	}
33
+
34
+	/**
35
+	 * Test log in and set $_SESSION vars
36
+	 * @param string $username
37
+	 * @param string $password
38
+	 * @see phpvbAuth::login()
39
+	 */
40
+	function login($username, $password)
41
+	{
42
+		global $_SESSION;
43
+
44
+
45
+		/*
46
+		 * Check for LDAP functionality and provide some direction
47
+		 */
48
+		if(!function_exists('ldap_connect')) {
49
+
50
+			$ex = 'LDAP support is not enabled in your PHP configuration.';
51
+
52
+			if(strtolower(substr(PHP_OS, 0, 3)) == 'win') {
53
+
54
+				ob_start();
55
+				phpinfo(INFO_GENERAL);
56
+				$phpinfo = ob_get_contents();
57
+				ob_end_clean();
58
+				preg_match('/Loaded Configuration File <\/td><td.*?>(.*?)\s*</', $phpinfo, $phpinfo);
59
+
60
+				$ex .= ' You probably just need to uncomment the line ;extension=php_ldap.dll in php.ini'.
61
+						(count($phpinfo) > 1 ? ' (' .trim($phpinfo[1]).')' : '') . ' by removing the ";" and restart your web server.';
62
+
63
+			} else if(strtolower(substr(PHP_OS, 0, 5)) == 'Linux') {
64
+
65
+				$ex .= ' You probably need to install the php5-ldap (or similar depending on your distribution) package and restart your web server.';
66
+					
67
+			}
68
+			throw new Exception($ex);
69
+		}
70
+
71
+		$_SESSION['valid'] = false;
72
+
73
+		// Connect to server
74
+		if(!($auth = ldap_connect($this->config['host']))) {
75
+			throw new Exception('Active Directory error ('.ldap_errno($auth).') ' . ldap_error($auth));
76
+		}
77
+
78
+		// Set relevant LDAP options
79
+		ldap_set_option($auth,LDAP_OPT_PROTOCOL_VERSION, 3);
80
+		
81
+
82
+		// Main login /bind
83
+		if(!($bind = @ldap_bind($auth, $username . "@" .$this->config['domain'], $password))) {
84
+			if(ldap_errno($auth) == 49) return false;
85
+			throw new Exception('Active Directory error ('.ldap_errno($auth).') ' . ldap_error($auth));
86
+		}
87
+		
88
+		
89
+		// Get user information from AD
90
+		////////////////////////////////////
91
+		
92
+		
93
+		// Set filter and sanitize username before sending it to AD
94
+		$filter = "(sAMAccountName=" .
95
+			str_replace(array(',','=','+','<','>',';','\\','"','#','(',')','*',chr(0)), '', $username) . ")";
96
+		if($this->config['filter'] && false) {
97
+			$filter = '(&'. $this->config['filter'] .' ('. $filter .'))';
98
+		}
99
+		
100
+		$result = @ldap_search($auth,
101
+				$this->config['container'] . ',DC=' . join(',DC=', explode('.', $this->config['domain'])),
102
+				$filter, array("memberof","useraccountcontrol"));
103
+
104
+		if(!result) throw new Exception ("Unable to search Active Directory server: " . ldap_error($auth));
105
+		@list($entries) = @ldap_get_entries($auth, $result);
106
+		@ldap_unbind($auth);
107
+		if(!$entries) {
108
+			throw new Exception("Permission denied");
109
+		}
110
+		
111
+		
112
+		// Check for disabled user
113
+		if((intval($entries['useraccountcontrol'][0]) & 2)) {
114
+			throw new Exception('This account is disabled in Active Directory.');
115
+		}
116
+
117
+		// check for valid admin group
118
+		if($this->config['admin_group']) {
119
+			foreach($entries['memberof'] as $group) {
120
+				list($group) = explode(',', $group);
121
+				if(strtolower($group) == strtolower('cn='.$this->config['admin_group'])) {
122
+					$_SESSION['admin'] = $_SESSION['valid'] = true;
123
+					break;
124
+				}
125
+			}
126
+		}
127
+		
128
+		// Admin user explicitly set?
129
+		if(!$_SESSION['admin'] && $this->config['adminUser']) {
130
+			$_SESSION['admin'] = (strtolower($this->config['adminUser']) == strtolower($username));
131
+			// Admin is ok
132
+			$_SESSION['valid'] = ($_SESSION['admin'] || $_SESSION['valid']);
133
+		}
134
+
135
+		// check for valid user group
136
+		if($this->config['user_group'] && !$_SESSION['valid']) {
137
+			foreach($entries['memberof'] as $group) {
138
+				list($group) = explode(',', $group);
139
+				if(strtolower($group) == strtolower('cn='.$this->config['user_group'])) {
140
+					$_SESSION['valid'] = true;
141
+					break;
142
+				}
143
+			}
144
+		} else {
145
+			$_SESSION['valid'] = true;
146
+		}
147
+		
148
+		if(!$_SESSION['valid'])
149
+			throw new Exception("Permission denied");
150
+
151
+		// Admin user explicitly set?
152
+		if(!$_SESSION['admin'] && $this->config['adminUser']) {
153
+			$_SESSION['admin'] = (strtolower($this->config['adminUser']) == strtolower($username));
154
+		}
155
+
156
+		// No admin information specified makes everyone an admin
157
+		if(!$this->config['adminUser'] && !$this->config['admin_group'])
158
+			$_SESSION['admin'] = true;
159
+		
160
+		// user has permission. establish session variables
161
+		$_SESSION['user'] = $username;
162
+		$_SESSION['authCheckHeartbeat'] = time();
163
+
164
+		
165
+		return true;
166
+		
167
+	}
168
+
169
+	function heartbeat($vbox)
170
+	{
171
+		global $_SESSION;
172
+
173
+		$_SESSION['valid'] = true;
174
+		$_SESSION['authCheckHeartbeat'] = time();
175
+	}
176
+
177
+	function changePassword($old, $new)
178
+	{
179
+	}
180
+
181
+	function logout(&$response)
182
+	{
183
+		global $_SESSION;
184
+		if(function_exists('session_destroy')) session_destroy();
185
+		else unset($_SESSION['valid']);
186
+		$response['data']['result'] = 1;
187
+	}
188
+
189
+	function listUsers()
190
+	{
191
+
192
+	}
193
+
194
+	function updateUser($vboxRequest, $skipExistCheck)
195
+	{
196
+
197
+	}
198
+
199
+	function deleteUser($user)
200
+	{
201
+
202
+	}
203
+}

phpvirtualbox/phpvirtualbox-5.0-5/endpoints/lib/auth/Builtin.php → phpvirtualbox/phpvirtualbox-5.2-1/endpoints/lib/auth/Builtin.php View File


Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save