common.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. // This file is part of GNU social - https://www.gnu.org/software/social
  3. //
  4. // GNU social is free software: you can redistribute it and/or modify
  5. // it under the terms of the GNU Affero General Public License as published by
  6. // the Free Software Foundation, either version 3 of the License, or
  7. // (at your option) any later version.
  8. //
  9. // GNU social is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. // GNU Affero General Public License for more details.
  13. //
  14. // You should have received a copy of the GNU Affero General Public License
  15. // along with GNU social. If not, see <http://www.gnu.org/licenses/>.
  16. defined('GNUSOCIAL') || die();
  17. /* Work internally in UTC */
  18. date_default_timezone_set('UTC');
  19. /* Work internally with UTF-8 */
  20. mb_internal_encoding('UTF-8');
  21. // All the fun stuff to actually initialize GNU social's framework code,
  22. // without loading up a site configuration.
  23. require_once INSTALLDIR . '/lib/util/framework.php';
  24. try {
  25. GNUsocial::init(@$server, @$path, @$conffile);
  26. } catch (NoConfigException $e) {
  27. // XXX: Throw a conniption if database not installed
  28. // XXX: Find a way to use htmlwriter for this instead of handcoded markup
  29. // TRANS: Error message displayed when no configuration file was found for a StatusNet installation.
  30. echo '<p>'. _('No configuration file found.') .'</p>';
  31. // TRANS: Error message displayed when no configuration file was found for a StatusNet installation.
  32. // TRANS: Is followed by a list of directories (separated by HTML breaks).
  33. echo '<p>'. _('I looked for configuration files in the following places:') .'<br /> ';
  34. echo implode('<br />', $e->configFiles);
  35. // TRANS: Error message displayed when no configuration file was found for a StatusNet installation.
  36. echo '<p>'. _('You may wish to run the installer to fix this.') .'</p>';
  37. // @todo FIXME Link should be in a para?
  38. // TRANS: Error message displayed when no configuration file was found for a StatusNet installation.
  39. // TRANS: The text is link text that leads to the installer page.
  40. echo '<a href="install.php">'. _('Go to the installer.') .'</a>';
  41. exit;
  42. }