header.phtml 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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(htmlspecialchars_decode(Minz_Request::paramString('search'), ENT_QUOTES), 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. <div class="dropdown">
  52. <div id="dropdown-configure" class="dropdown-target"></div>
  53. <a class="btn dropdown-toggle" href="#dropdown-configure"><?= _i('configure') ?></a>
  54. <ul class="dropdown-menu scrollbar-thin">
  55. <li class="dropdown-header-close"><a class="toggle_aside" href="#close"><?= _i('close') ?></a></li>
  56. <li class="item dropdown-section">
  57. <div class="dropdown-section-title">
  58. <?= _t('gen.menu.account') ?>: <?= htmlspecialchars(Minz_User::name() ?? '', ENT_NOQUOTES, 'UTF-8') ?>
  59. </div>
  60. <ul>
  61. <li class="item"><a href="<?= _url('user', 'profile') ?>"><?= _t('gen.menu.user_profile') ?></a></li>
  62. <?php if (FreshRSS_Auth::accessNeedsAction()): ?>
  63. <li class="item"><a class="signout" href="<?= _url('auth', 'logout') ?>"><?= _t('gen.auth.logout'); ?><?= _i('logout') ?></a></li>
  64. <?php else: ?>
  65. <li class="item"><span class="signout">(<?= htmlspecialchars(Minz_User::name() ?? '', ENT_NOQUOTES, 'UTF-8') ?>)</span></li>
  66. <?php endif; ?>
  67. </ul>
  68. </li>
  69. <li class="item dropdown-section">
  70. <div class="dropdown-section-title">
  71. <?= _t('gen.menu.configuration') ?>
  72. </div>
  73. <ul>
  74. <li class="item"><a href="<?= _url('configure', 'display') ?>"><?= _t('gen.menu.display') ?></a></li>
  75. <li class="item"><a href="<?= _url('configure', 'reading') ?>"><?= _t('gen.menu.reading') ?></a></li>
  76. <li class="item"><a href="<?= _url('configure', 'archiving') ?>"><?= _t('gen.menu.archiving') ?></a></li>
  77. <li class="item"><a href="<?= _url('configure', 'integration') ?>"><?= _t('gen.menu.sharing') ?></a></li>
  78. <li class="item"><a href="<?= _url('configure', 'shortcut') ?>"><?= _t('gen.menu.shortcuts') ?></a></li>
  79. <li class="item"><a href="<?= _url('configure', 'queries') ?>"><?= _t('gen.menu.queries') ?></a></li>
  80. <li class="item"><a href="<?= _url('extension', 'index') ?>"><?= _t('gen.menu.extensions') ?></a></li>
  81. <li class="item"><a href="<?= _url('configure', 'privacy') ?>"><?= _t('gen.menu.privacy') ?></a></li>
  82. <?= Minz_ExtensionManager::callHookString('menu_configuration_entry') ?>
  83. </ul>
  84. </li>
  85. <?php if (FreshRSS_Auth::hasAccess('admin')) { ?>
  86. <li class="item dropdown-section">
  87. <div class="dropdown-section-title">
  88. <?= _t('gen.menu.admin') ?>
  89. </div>
  90. <ul>
  91. <li class="item"><a href="<?= _url('configure', 'system') ?>"><?= _t('gen.menu.system') ?></a></li>
  92. <li class="item"><a href="<?= _url('user', 'manage') ?>"><?= _t('gen.menu.user_management') ?></a></li>
  93. <li class="item"><a href="<?= _url('auth', 'index') ?>"><?= _t('gen.menu.authentication') ?></a></li>
  94. <li class="item"><a href="<?= _url('update', 'checkInstall') ?>"><?= _t('gen.menu.check_install') ?></a></li>
  95. <?php if (!FreshRSS_Context::systemConf()->disable_update) { ?>
  96. <li class="item"><a href="<?= _url('update', 'index') ?>"><?= _t('gen.menu.update') ?></a></li>
  97. <?php } ?>
  98. <?= Minz_ExtensionManager::callHookString('menu_admin_entry') ?>
  99. </ul>
  100. </li>
  101. <?php } ?>
  102. <li class="item dropdown-section">
  103. <ul>
  104. <li class="item"><a href="<?= _url('index', 'logs') ?>"><?= _t('gen.menu.logs') ?></a></li>
  105. <li class="item"><a href="<?= _url('index', 'about') ?>"><?= _t('gen.menu.about') ?></a></li>
  106. <?php if (file_exists(TOS_FILENAME)) { ?>
  107. <li class="item">
  108. <a href="<?= _url('index', 'tos') ?>"><?= _t('index.tos.title')?></a>
  109. </li>
  110. <?php } ?>
  111. <?= Minz_ExtensionManager::callHookString('menu_other_entry') ?>
  112. </ul>
  113. </li>
  114. </ul>
  115. <a class="dropdown-close" href="#close">❌</a>
  116. </div>
  117. </nav>
  118. <?php } elseif (FreshRSS_Auth::accessNeedsAction()) { ?>
  119. <div class="item configure">
  120. <a class="signin" href="<?= Minz_Url::display(['c' => 'auth', 'a' => 'login'], 'html', 'root') ?>"><?= _i('login') ?><?= _t('gen.auth.login') ?></a>
  121. </div>
  122. <?php } ?>
  123. </header>