header.phtml 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <?php
  2. declare(strict_types=1);
  3. /** @var FreshRSS_View $this */
  4. ?>
  5. <header class="header">
  6. <div class="item title">
  7. <a href="<?= Minz_Url::display(['c' => 'index', 'a' => 'index'], 'html', 'root') ?>">
  8. <?php if (FreshRSS_Context::systemConf()->logo_html == '') { ?>
  9. <img class="logo" src="<?= _i('FreshRSS-logo', FreshRSS_Themes::ICON_URL) ?>" alt="FreshRSS" width="160" height="32" loading="lazy" />
  10. <?php
  11. } else {
  12. echo FreshRSS_Context::systemConf()->logo_html;
  13. }
  14. ?>
  15. </a>
  16. </div>
  17. <div class="item search">
  18. <?php if (FreshRSS_Auth::hasAccess() || FreshRSS_Context::systemConf()->allow_anonymous) { ?>
  19. <form action="<?= $this->html_url ?>" method="get">
  20. <?php if (Minz_Request::controllerName() === 'index'): ?>
  21. <?php if (in_array(Minz_Request::actionName(), ['normal', 'global', 'reader'], true)) { ?>
  22. <input type="hidden" name="a" value="<?= Minz_Request::actionName() ?>" />
  23. <?php } if (Minz_Request::paramString('get') !== '') { ?>
  24. <input type="hidden" name="get" value="<?= FreshRSS_Context::currentGet() ?>" />
  25. <?php } if (Minz_Request::paramInt('state') !== 0) { ?>
  26. <input type="hidden" name="state" value="<?= Minz_Request::paramInt('state') ?>" />
  27. <?php } ?>
  28. <?php elseif (Minz_Request::controllerName() === 'subscription'): ?>
  29. <input type="hidden" name="c" value="index" />
  30. <input type="hidden" name="a" value="global" />
  31. <?php endif; ?>
  32. <?php if (Minz_Request::paramString('user') !== '') { ?>
  33. <input type="hidden" name="user" value="<?= Minz_User::name() ?>" />
  34. <?php } if (ctype_alnum(Minz_Request::paramString('t'))) { ?>
  35. <input type="hidden" name="t" value="<?= Minz_Request::paramString('t') ?>" />
  36. <?php } if (ctype_lower(Minz_Request::paramString('sort'))) { ?>
  37. <input type="hidden" name="sort" value="<?= FreshRSS_Context::$sort ?>" />
  38. <?php } if (ctype_upper(Minz_Request::paramString('order'))) { ?>
  39. <input type="hidden" name="order" value="<?= FreshRSS_Context::$order ?>" />
  40. <?php } if (ctype_lower(Minz_Request::paramString('f'))) { ?>
  41. <input type="hidden" name="f" value="<?= Minz_Request::paramString('f') ?>" />
  42. <?php } ?>
  43. <div class="stick">
  44. <input type="search" name="search" id="search"
  45. value="<?= htmlspecialchars(FreshRSS_Context::$search->toString(), ENT_COMPAT, 'UTF-8') ?>"
  46. placeholder="<?= _t('gen.menu.search') ?>" />
  47. <button class="btn" type="submit"><?= _i('search') ?></button>
  48. </div>
  49. </form>
  50. <?php } ?>
  51. </div>
  52. <?php if (FreshRSS_Auth::hasAccess()) { ?>
  53. <nav class="item configure">
  54. <form id="post-csrf" method="post">
  55. <input type="hidden" name="_csrf" value="<?= FreshRSS_Auth::csrfToken() ?>" />
  56. </form>
  57. <div class="dropdown">
  58. <div id="dropdown-configure" class="dropdown-target"></div>
  59. <a class="btn dropdown-toggle" href="#dropdown-configure"><?= _i('configure') ?></a>
  60. <ul class="dropdown-menu scrollbar-thin">
  61. <li class="dropdown-header-close"><a class="toggle_aside" href="#close"><?= _i('close') ?></a></li>
  62. <li class="item dropdown-section">
  63. <div class="dropdown-section-title">
  64. <?= _t('gen.menu.account') ?>: <?= htmlspecialchars(Minz_User::name() ?? '', ENT_NOQUOTES, 'UTF-8') ?>
  65. </div>
  66. <ul>
  67. <li class="item"><a href="<?= _url('user', 'profile') ?>"><?= _t('gen.menu.user_profile') ?></a></li>
  68. <?php if (FreshRSS_Auth::accessNeedsAction()): ?>
  69. <li class="item">
  70. <button class="as-link signout" form="post-csrf" formaction="<?= _url('auth', 'logout') ?>"><?= _t('gen.auth.logout'); ?><?= _i('logout') ?></button>
  71. </li>
  72. <?php else: ?>
  73. <li class="item"><span class="signout">(<?= htmlspecialchars(Minz_User::name() ?? '', ENT_NOQUOTES, 'UTF-8') ?>)</span></li>
  74. <?php endif; ?>
  75. </ul>
  76. </li>
  77. <li class="item dropdown-section">
  78. <div class="dropdown-section-title">
  79. <?= _t('gen.menu.configuration') ?>
  80. </div>
  81. <ul>
  82. <li class="item"><a href="<?= _url('configure', 'display') ?>"><?= _t('gen.menu.display') ?></a></li>
  83. <li class="item"><a href="<?= _url('configure', 'reading') ?>"><?= _t('gen.menu.reading') ?></a></li>
  84. <li class="item"><a href="<?= _url('configure', 'archiving') ?>"><?= _t('gen.menu.archiving') ?></a></li>
  85. <li class="item"><a href="<?= _url('configure', 'integration') ?>"><?= _t('gen.menu.sharing') ?></a></li>
  86. <li class="item"><a href="<?= _url('configure', 'shortcut') ?>"><?= _t('gen.menu.shortcuts') ?></a></li>
  87. <li class="item"><a href="<?= _url('configure', 'queries') ?>"><?= _t('gen.menu.queries') ?></a></li>
  88. <li class="item"><a href="<?= _url('extension', 'index') ?>"><?= _t('gen.menu.extensions') ?></a></li>
  89. <li class="item"><a href="<?= _url('configure', 'privacy') ?>"><?= _t('gen.menu.privacy') ?></a></li>
  90. <?= Minz_ExtensionManager::callHookString(Minz_HookType::MenuConfigurationEntry) ?>
  91. </ul>
  92. </li>
  93. <?php if (FreshRSS_Auth::hasAccess('admin')) { ?>
  94. <li class="item dropdown-section">
  95. <div class="dropdown-section-title">
  96. <?= _t('gen.menu.admin') ?>
  97. </div>
  98. <ul>
  99. <li class="item"><a href="<?= _url('configure', 'system') ?>"><?= _t('gen.menu.system') ?></a></li>
  100. <li class="item"><a href="<?= _url('user', 'manage') ?>"><?= _t('gen.menu.user_management') ?></a></li>
  101. <li class="item"><a href="<?= _url('auth', 'index') ?>"><?= _t('gen.menu.authentication') ?></a></li>
  102. <li class="item"><a href="<?= _url('update', 'checkInstall') ?>"><?= _t('gen.menu.check_install') ?></a></li>
  103. <?php if (!FreshRSS_Context::systemConf()->disable_update) { ?>
  104. <li class="item"><a href="<?= _url('update', 'index') ?>"><?= _t('gen.menu.update') ?></a></li>
  105. <?php } ?>
  106. <?= Minz_ExtensionManager::callHookString(Minz_HookType::MenuAdminEntry) ?>
  107. </ul>
  108. </li>
  109. <?php } ?>
  110. <li class="item dropdown-section">
  111. <ul>
  112. <li class="item"><a href="<?= _url('index', 'logs') ?>"><?= _t('gen.menu.logs') ?></a></li>
  113. <li class="item"><a href="<?= _url('index', 'about') ?>"><?= _t('gen.menu.about') ?></a></li>
  114. <?php if (file_exists(TOS_FILENAME)) { ?>
  115. <li class="item">
  116. <a href="<?= _url('index', 'tos') ?>"><?= _t('index.tos.title')?></a>
  117. </li>
  118. <?php } ?>
  119. <?= Minz_ExtensionManager::callHookString(Minz_HookType::MenuOtherEntry) ?>
  120. </ul>
  121. </li>
  122. </ul>
  123. <a class="dropdown-close" href="#close">❌</a>
  124. </div>
  125. </nav>
  126. <?php } elseif (FreshRSS_Auth::accessNeedsAction()) { ?>
  127. <div class="item configure">
  128. <a class="signin" href="<?= Minz_Url::display(['c' => 'auth', 'a' => 'login'], 'html', 'root') ?>"><?= _i('login') ?><?= _t('gen.auth.login') ?></a>
  129. </div>
  130. <?php } ?>
  131. </header>