admin.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. /**
  3. * @author Arthur Schiwon <blizzz@owncloud.com>
  4. * @author Frank Karlitschek <frank@owncloud.org>
  5. * @author Jakob Sack <mail@jakobsack.de>
  6. * @author Lukas Reschke <lukas@owncloud.com>
  7. * @author Michael Göhler <somebody.here@gmx.de>
  8. * @author Morris Jobke <hey@morrisjobke.de>
  9. * @author Robin Appelman <icewind@owncloud.com>
  10. * @author Thomas Müller <thomas.mueller@tmit.eu>
  11. *
  12. * @copyright Copyright (c) 2015, ownCloud, Inc.
  13. * @license AGPL-3.0
  14. *
  15. * This code is free software: you can redistribute it and/or modify
  16. * it under the terms of the GNU Affero General Public License, version 3,
  17. * as published by the Free Software Foundation.
  18. *
  19. * This program is distributed in the hope that it will be useful,
  20. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  21. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  22. * GNU Affero General Public License for more details.
  23. *
  24. * You should have received a copy of the GNU Affero General Public License, version 3,
  25. * along with this program. If not, see <http://www.gnu.org/licenses/>
  26. *
  27. */
  28. OCP\User::checkAdminUser();
  29. $htaccessWorking=(getenv('htaccessWorking')=='true');
  30. $upload_max_filesize = OCP\Util::computerFileSize(ini_get('upload_max_filesize'));
  31. $post_max_size = OCP\Util::computerFileSize(ini_get('post_max_size'));
  32. $maxUploadFilesize = OCP\Util::humanFileSize(min($upload_max_filesize, $post_max_size));
  33. if($_POST && OC_Util::isCallRegistered()) {
  34. if(isset($_POST['maxUploadSize'])) {
  35. if(($setMaxSize = OC_Files::setUploadLimit(OCP\Util::computerFileSize($_POST['maxUploadSize']))) !== false) {
  36. $maxUploadFilesize = OCP\Util::humanFileSize($setMaxSize);
  37. }
  38. }
  39. }
  40. $htaccessWritable=is_writable(OC::$SERVERROOT.'/.htaccess');
  41. $tmpl = new OCP\Template( 'files', 'admin' );
  42. $tmpl->assign( 'uploadChangable', $htaccessWorking and $htaccessWritable );
  43. $tmpl->assign( 'uploadMaxFilesize', $maxUploadFilesize);
  44. // max possible makes only sense on a 32 bit system
  45. $tmpl->assign( 'displayMaxPossibleUploadSize', PHP_INT_SIZE===4);
  46. $tmpl->assign( 'maxPossibleUploadSize', OCP\Util::humanFileSize(PHP_INT_MAX));
  47. return $tmpl->fetchPage();