The official, canonical postActiv repository. http://www.postactiv.com

top.php 3.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <?php
  2. /* ============================================================================
  3. * Title: Top
  4. * Redirect to the appropriate top-of-site
  5. *
  6. * postActiv:
  7. * the micro-blogging software
  8. *
  9. * Copyright:
  10. * Copyright (C) 2016-2018, Maiyannah Bishop
  11. *
  12. * Derived from code copyright various sources:
  13. * o GNU Social (C) 2013-2016, Free Software Foundation, Inc
  14. * o StatusNet (C) 2008-2012, StatusNet, Inc
  15. * ----------------------------------------------------------------------------
  16. * License:
  17. * This program is free software: you can redistribute it and/or modify
  18. * it under the terms of the GNU Affero General Public License as published by
  19. * the Free Software Foundation, either version 3 of the License, or
  20. * (at your option) any later version.
  21. *
  22. * This program is distributed in the hope that it will be useful,
  23. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  24. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  25. * GNU Affero General Public License for more details.
  26. *
  27. * You should have received a copy of the GNU Affero General Public License
  28. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  29. *
  30. * <https://www.gnu.org/licenses/agpl.html>
  31. * ----------------------------------------------------------------------------
  32. * About:
  33. * Redirect to the appropriate top-of-site
  34. *
  35. * PHP version:
  36. * Tested with PHP 7.0
  37. * ----------------------------------------------------------------------------
  38. * File Authors:
  39. * o Evan Prodromou
  40. * o Mikael Nordfeldth <mmn@hethane.se>
  41. * o Maiyannah Bishop <maiyannah.bishop@postactiv.com>
  42. *
  43. * Web:
  44. * o postActiv <http://www.postactiv.com>
  45. * o GNU social <https://www.gnu.org/s/social/>
  46. * ============================================================================
  47. */
  48. // This file is formatted so that it provides useful documentation output in
  49. // NaturalDocs. Please be considerate of this before changing formatting.
  50. if (!defined('POSTACTIV')) { exit(1); }
  51. // ============================================================================
  52. // Class: TopAction
  53. // Action class to redirect the user to appropriate top-of-site
  54. class TopAction extends ManagedAction
  55. {
  56. // -------------------------------------------------------------------------
  57. // Function: showPage
  58. // Redirects the user to the appropriate top of page:
  59. // o friends timeline for a single-user instance
  60. // o public timeline for a private instance
  61. // o network timeline for public instance
  62. //
  63. // Returns:
  64. // o void
  65. public function showPage()
  66. {
  67. if (common_config('singleuser', 'enabled')) {
  68. $user = User::singleUser();
  69. common_redirect(common_local_url('showstream', array('nickname' => $user->getNickname())), 303);
  70. } elseif (common_config('public', 'localonly')) {
  71. common_redirect(common_local_url('public'), 303);
  72. } else {
  73. common_redirect(common_local_url('networkpublic'), 303);
  74. }
  75. }
  76. }
  77. // END OF FILE
  78. // ============================================================================
  79. ?>