admin.php 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?php
  2. /**
  3. * Copyright (c) 2011, Robin Appelman <icewind1991@gmail.com>
  4. * This file is licensed under the Affero General Public License version 3 or later.
  5. * See the COPYING-README file.
  6. */
  7. OC_Util::checkAdminUser();
  8. OC_Util::addStyle( "settings", "settings" );
  9. OC_Util::addScript( "settings", "admin" );
  10. OC_Util::addScript( "settings", "log" );
  11. OC_App::setActiveNavigationEntry( "admin" );
  12. $tmpl = new OC_Template( 'settings', 'admin', 'user');
  13. $forms=OC_App::getForms('admin');
  14. $htaccessworking=OC_Util::isHtAccessWorking();
  15. $entries=OC_Log_Owncloud::getEntries(3);
  16. $entriesremain = count(OC_Log_Owncloud::getEntries(4)) > 3;
  17. // Should we display sendmail as an option?
  18. $tmpl->assign('sendmail_is_available', (bool) findBinaryPath('sendmailsendmail'));
  19. $tmpl->assign('loglevel', OC_Config::getValue( "loglevel", 2 ));
  20. $tmpl->assign('mail_domain', OC_Config::getValue( "mail_domain", '' ));
  21. $tmpl->assign('mail_from_address', OC_Config::getValue( "mail_from_address", '' ));
  22. $tmpl->assign('mail_smtpmode', OC_Config::getValue( "mail_smtpmode", '' ));
  23. $tmpl->assign('mail_smtpsecure', OC_Config::getValue( "mail_smtpsecure", '' ));
  24. $tmpl->assign('mail_smtphost', OC_Config::getValue( "mail_smtphost", '' ));
  25. $tmpl->assign('mail_smtpport', OC_Config::getValue( "mail_smtpport", '' ));
  26. $tmpl->assign('mail_smtpauthtype', OC_Config::getValue( "mail_smtpauthtype", '' ));
  27. $tmpl->assign('mail_smtpauth', OC_Config::getValue( "mail_smtpauth", false ));
  28. $tmpl->assign('mail_smtpname', OC_Config::getValue( "mail_smtpname", '' ));
  29. $tmpl->assign('mail_smtppassword', OC_Config::getValue( "mail_smtppassword", '' ));
  30. $tmpl->assign('entries', $entries);
  31. $tmpl->assign('entriesremain', $entriesremain);
  32. $tmpl->assign('htaccessworking', $htaccessworking);
  33. $tmpl->assign('internetconnectionworking', OC_Util::isInternetConnectionEnabled() ? OC_Util::isInternetConnectionWorking() : false);
  34. $tmpl->assign('isLocaleWorking', OC_Util::isSetLocaleWorking());
  35. $tmpl->assign('isWebDavWorking', OC_Util::isWebDAVWorking());
  36. $tmpl->assign('has_fileinfo', OC_Util::fileInfoLoaded());
  37. $tmpl->assign('old_php', OC_Util::isPHPoutdated());
  38. $tmpl->assign('backgroundjobs_mode', OC_Appconfig::getValue('core', 'backgroundjobs_mode', 'ajax'));
  39. $tmpl->assign('cron_log', OC_Config::getValue('cron_log', true));
  40. $tmpl->assign('lastcron', OC_Appconfig::getValue('core', 'lastcron', false));
  41. $tmpl->assign('shareAPIEnabled', OC_Appconfig::getValue('core', 'shareapi_enabled', 'yes'));
  42. // Check if connected using HTTPS
  43. if (OC_Request::serverProtocol() === 'https') {
  44. $connectedHTTPS = true;
  45. } else {
  46. $connectedHTTPS = false;
  47. }
  48. $tmpl->assign('isConnectedViaHTTPS', $connectedHTTPS);
  49. $tmpl->assign('enforceHTTPSEnabled', OC_Config::getValue( "forcessl", false));
  50. $tmpl->assign('allowLinks', OC_Appconfig::getValue('core', 'shareapi_allow_links', 'yes'));
  51. $tmpl->assign('allowPublicUpload', OC_Appconfig::getValue('core', 'shareapi_allow_public_upload', 'yes'));
  52. $tmpl->assign('allowResharing', OC_Appconfig::getValue('core', 'shareapi_allow_resharing', 'yes'));
  53. $tmpl->assign('allowMailNotification', OC_Appconfig::getValue('core', 'shareapi_allow_mail_notification', 'yes'));
  54. $tmpl->assign('sharePolicy', OC_Appconfig::getValue('core', 'shareapi_share_policy', 'global'));
  55. $tmpl->assign('forms', array());
  56. foreach($forms as $form) {
  57. $tmpl->append('forms', $form);
  58. }
  59. $tmpl->printPage();
  60. /**
  61. * Try to find a programm
  62. *
  63. * @param string $program
  64. * @return null|string
  65. */
  66. function findBinaryPath($program) {
  67. exec('command -v ' . escapeshellarg($program) . ' 2> /dev/null', $output, $returnCode);
  68. if ($returnCode === 0 && count($output) > 0) {
  69. return escapeshellcmd($output[0]);
  70. }
  71. return null;
  72. }