common.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. $server = null;
  26. $path = null;
  27. $conffile = null;
  28. GNUsocial::init($server, $path, $conffile);
  29. } catch (NoConfigException $e) {
  30. // XXX: Throw a conniption if database not installed
  31. // XXX: Find a way to use htmlwriter for this instead of handcoded markup
  32. // TRANS: Error message displayed when no configuration file was found for a StatusNet installation.
  33. echo '<p>'. _('No configuration file found.') .'</p>';
  34. // TRANS: Error message displayed when no configuration file was found for a StatusNet installation.
  35. // TRANS: Is followed by a list of directories (separated by HTML breaks).
  36. echo '<p>'. _('I looked for configuration files in the following places:') .'<br /> ';
  37. echo implode('<br />', $e->configFiles);
  38. // TRANS: Error message displayed when no configuration file was found for a StatusNet installation.
  39. echo '<p>'. _('You may wish to run the installer to fix this.') .'</p>';
  40. // @todo FIXME Link should be in a para?
  41. // TRANS: Error message displayed when no configuration file was found for a StatusNet installation.
  42. // TRANS: The text is link text that leads to the installer page.
  43. echo '<a href="install.php">'. _('Go to the installer.') .'</a>';
  44. exit;
  45. }