4
0

header.phtml 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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" 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 endif; ?>
  29. <?php if (Minz_Request::paramString('user') !== '') { ?>
  30. <input type="hidden" name="user" value="<?= Minz_User::name() ?>" />
  31. <?php } if (ctype_alnum(Minz_Request::paramString('t'))) { ?>
  32. <input type="hidden" name="t" value="<?= Minz_Request::paramString('t') ?>" />
  33. <?php } if (ctype_lower(Minz_Request::paramString('sort'))) { ?>
  34. <input type="hidden" name="sort" value="<?= FreshRSS_Context::$sort ?>" />
  35. <?php } if (ctype_upper(Minz_Request::paramString('order'))) { ?>
  36. <input type="hidden" name="order" value="<?= FreshRSS_Context::$order ?>" />
  37. <?php } if (ctype_lower(Minz_Request::paramString('f'))) { ?>
  38. <input type="hidden" name="f" value="<?= Minz_Request::paramString('f') ?>" />
  39. <?php } ?>
  40. <div class="stick">
  41. <input type="search" name="search" id="search"
  42. value="<?= htmlspecialchars(FreshRSS_Context::$search->toString(), ENT_COMPAT, 'UTF-8') ?>"
  43. placeholder="<?= _t('gen.menu.search') ?>" />
  44. <button class="btn" type="submit"><?= _i('search') ?></button>
  45. </div>
  46. </form>
  47. <?php } ?>
  48. </div>
  49. <?php if (FreshRSS_Auth::hasAccess()) { ?>
  50. <nav class="item configure">
  51. <form id="post-csrf" method="post">
  52. <input type="hidden" name="_csrf" value="<?= FreshRSS_Auth::csrfToken() ?>" />
  53. </form>
  54. <div class="dropdown">
  55. <div id="dropdown-configure" class="dropdown-target"></div>
  56. <a class="btn dropdown-toggle" href="#dropdown-configure"><?= _i('configure') ?></a>
  57. <ul class="dropdown-menu scrollbar-thin">
  58. <li class="dropdown-header-close"><a class="toggle_aside" href="#close"><?= _i('close') ?></a></li>
  59. <li class="item dropdown-section">
  60. <div class="dropdown-section-title">
  61. <?= _t('gen.menu.account') ?>: <?= htmlspecialchars(Minz_User::name() ?? '', ENT_NOQUOTES, 'UTF-8') ?>
  62. </div>
  63. <ul>
  64. <li class="item"><a href="<?= _url('user', 'profile') ?>"><?= _t('gen.menu.user_profile') ?></a></li>
  65. <?php if (FreshRSS_Auth::accessNeedsAction()): ?>
  66. <li class="item">
  67. <button class="as-link signout" form="post-csrf" formaction="<?= _url('auth', 'logout') ?>"><?= _t('gen.auth.logout'); ?><?= _i('logout') ?></button>
  68. </li>
  69. <?php else: ?>
  70. <li class="item"><span class="signout">(<?= htmlspecialchars(Minz_User::name() ?? '', ENT_NOQUOTES, 'UTF-8') ?>)</span></li>
  71. <?php endif; ?>
  72. </ul>
  73. </li>
  74. <li class="item dropdown-section">
  75. <div class="dropdown-section-title">
  76. <?= _t('gen.menu.configuration') ?>
  77. </div>
  78. <ul>
  79. <li class="item"><a href="<?= _url('configure', 'display') ?>"><?= _t('gen.menu.display') ?></a></li>
  80. <li class="item"><a href="<?= _url('configure', 'reading') ?>"><?= _t('gen.menu.reading') ?></a></li>
  81. <li class="item"><a href="<?= _url('configure', 'archiving') ?>"><?= _t('gen.menu.archiving') ?></a></li>
  82. <li class="item"><a href="<?= _url('configure', 'integration') ?>"><?= _t('gen.menu.sharing') ?></a></li>
  83. <li class="item"><a href="<?= _url('configure', 'shortcut') ?>"><?= _t('gen.menu.shortcuts') ?></a></li>
  84. <li class="item"><a href="<?= _url('configure', 'queries') ?>"><?= _t('gen.menu.queries') ?></a></li>
  85. <li class="item"><a href="<?= _url('extension', 'index') ?>"><?= _t('gen.menu.extensions') ?></a></li>
  86. <li class="item"><a href="<?= _url('configure', 'privacy') ?>"><?= _t('gen.menu.privacy') ?></a></li>
  87. <?= Minz_ExtensionManager::callHookString(Minz_HookType::MenuConfigurationEntry) ?>
  88. </ul>
  89. </li>
  90. <?php if (FreshRSS_Auth::hasAccess('admin')) { ?>
  91. <li class="item dropdown-section">
  92. <div class="dropdown-section-title">
  93. <?= _t('gen.menu.admin') ?>
  94. </div>
  95. <ul>
  96. <li class="item"><a href="<?= _url('configure', 'system') ?>"><?= _t('gen.menu.system') ?></a></li>
  97. <li class="item"><a href="<?= _url('user', 'manage') ?>"><?= _t('gen.menu.user_management') ?></a></li>
  98. <li class="item"><a href="<?= _url('auth', 'index') ?>"><?= _t('gen.menu.authentication') ?></a></li>
  99. <li class="item"><a href="<?= _url('update', 'checkInstall') ?>"><?= _t('gen.menu.check_install') ?></a></li>
  100. <?php if (!FreshRSS_Context::systemConf()->disable_update) { ?>
  101. <li class="item"><a href="<?= _url('update', 'index') ?>"><?= _t('gen.menu.update') ?></a></li>
  102. <?php } ?>
  103. <?= Minz_ExtensionManager::callHookString(Minz_HookType::MenuAdminEntry) ?>
  104. </ul>
  105. </li>
  106. <?php } ?>
  107. <li class="item dropdown-section">
  108. <ul>
  109. <li class="item"><a href="<?= _url('index', 'logs') ?>"><?= _t('gen.menu.logs') ?></a></li>
  110. <li class="item"><a href="<?= _url('index', 'about') ?>"><?= _t('gen.menu.about') ?></a></li>
  111. <?php if (file_exists(TOS_FILENAME)) { ?>
  112. <li class="item">
  113. <a href="<?= _url('index', 'tos') ?>"><?= _t('index.tos.title')?></a>
  114. </li>
  115. <?php } ?>
  116. <?= Minz_ExtensionManager::callHookString(Minz_HookType::MenuOtherEntry) ?>
  117. </ul>
  118. </li>
  119. </ul>
  120. <a class="dropdown-close" href="#close">❌</a>
  121. </div>
  122. </nav>
  123. <?php } elseif (FreshRSS_Auth::accessNeedsAction()) { ?>
  124. <div class="item configure">
  125. <a class="signin" href="<?= Minz_Url::display(['c' => 'auth', 'a' => 'login'], 'html', 'root') ?>"><?= _i('login') ?><?= _t('gen.auth.login') ?></a>
  126. </div>
  127. <?php } ?>
  128. </header>