You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

admin.php 3.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. $tmpl->assign('shareDefaultExpireDateSet', OC_Appconfig::getValue('core', 'shareapi_default_expire_date', 'no'));
  43. $tmpl->assign('shareExpireAfterNDays', OC_Appconfig::getValue('core', 'shareapi_expire_after_n_days', '7'));
  44. $tmpl->assign('shareEnforceExpireDate', OC_Appconfig::getValue('core', 'shareapi_enforce_expire_date', 'no'));
  45. // Check if connected using HTTPS
  46. if (OC_Request::serverProtocol() === 'https') {
  47. $connectedHTTPS = true;
  48. } else {
  49. $connectedHTTPS = false;
  50. }
  51. $tmpl->assign('isConnectedViaHTTPS', $connectedHTTPS);
  52. $tmpl->assign('enforceHTTPSEnabled', OC_Config::getValue( "forcessl", false));
  53. $tmpl->assign('allowLinks', OC_Appconfig::getValue('core', 'shareapi_allow_links', 'yes'));
  54. $tmpl->assign('allowPublicUpload', OC_Appconfig::getValue('core', 'shareapi_allow_public_upload', 'yes'));
  55. $tmpl->assign('allowResharing', OC_Appconfig::getValue('core', 'shareapi_allow_resharing', 'yes'));
  56. $tmpl->assign('allowMailNotification', OC_Appconfig::getValue('core', 'shareapi_allow_mail_notification', 'yes'));
  57. $tmpl->assign('sharePolicy', OC_Appconfig::getValue('core', 'shareapi_share_policy', 'global'));
  58. $tmpl->assign('forms', array());
  59. foreach($forms as $form) {
  60. $tmpl->append('forms', $form);
  61. }
  62. $tmpl->printPage();
  63. /**
  64. * Try to find a programm
  65. *
  66. * @param string $program
  67. * @return null|string
  68. */
  69. function findBinaryPath($program) {
  70. exec('command -v ' . escapeshellarg($program) . ' 2> /dev/null', $output, $returnCode);
  71. if ($returnCode === 0 && count($output) > 0) {
  72. return escapeshellcmd($output[0]);
  73. }
  74. return null;
  75. }