backend.php 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <?php
  2. class Backend extends Handler {
  3. function loading() {
  4. header("Content-type: text/html");
  5. print __("Loading, please wait...") . " " .
  6. "<img src='images/indicator_tiny.gif'>";
  7. }
  8. function digestTest() {
  9. header("Content-type: text/html");
  10. $rv = Digest::prepare_headlines_digest($_SESSION['uid'], 1, 1000);
  11. print "<h1>HTML</h1>";
  12. print $rv[0];
  13. print "<h1>Plain text</h1>";
  14. print "<pre>".$rv[3]."</pre>";
  15. }
  16. private function display_main_help() {
  17. $info = get_hotkeys_info();
  18. $imap = get_hotkeys_map();
  19. $omap = array();
  20. foreach ($imap[1] as $sequence => $action) {
  21. if (!isset($omap[$action])) $omap[$action] = array();
  22. array_push($omap[$action], $sequence);
  23. }
  24. print "<ul class='panel panel-scrollable hotkeys-help' style='height : 300px'>";
  25. print "<h2>" . __("Keyboard Shortcuts") . "</h2>";
  26. foreach ($info as $section => $hotkeys) {
  27. print "<li><hr></li>";
  28. print "<li><h3>" . $section . "</h3></li>";
  29. foreach ($hotkeys as $action => $description) {
  30. if (is_array($omap[$action])) {
  31. foreach ($omap[$action] as $sequence) {
  32. if (strpos($sequence, "|") !== FALSE) {
  33. $sequence = substr($sequence,
  34. strpos($sequence, "|")+1,
  35. strlen($sequence));
  36. } else {
  37. $keys = explode(" ", $sequence);
  38. for ($i = 0; $i < count($keys); $i++) {
  39. if (strlen($keys[$i]) > 1) {
  40. $tmp = '';
  41. foreach (str_split($keys[$i]) as $c) {
  42. switch ($c) {
  43. case '*':
  44. $tmp .= __('Shift') . '+';
  45. break;
  46. case '^':
  47. $tmp .= __('Ctrl') . '+';
  48. break;
  49. default:
  50. $tmp .= $c;
  51. }
  52. }
  53. $keys[$i] = $tmp;
  54. }
  55. }
  56. $sequence = join(" ", $keys);
  57. }
  58. print "<li>";
  59. print "<div class='hk'><code>$sequence</code></div>";
  60. print "<div class='desc'>$description</div>";
  61. print "</li>";
  62. }
  63. }
  64. }
  65. }
  66. print "</ul>";
  67. }
  68. function help() {
  69. $topic = basename(clean($_REQUEST["topic"])); // only one for now
  70. if ($topic == "main") {
  71. $info = get_hotkeys_info();
  72. $imap = get_hotkeys_map();
  73. $omap = array();
  74. foreach ($imap[1] as $sequence => $action) {
  75. if (!isset($omap[$action])) $omap[$action] = array();
  76. array_push($omap[$action], $sequence);
  77. }
  78. print "<ul class='panel panel-scrollable hotkeys-help' style='height : 300px'>";
  79. $cur_section = "";
  80. foreach ($info as $section => $hotkeys) {
  81. if ($cur_section) print "<li>&nbsp;</li>";
  82. print "<li><h3>" . $section . "</h3></li>";
  83. $cur_section = $section;
  84. foreach ($hotkeys as $action => $description) {
  85. if (is_array($omap[$action])) {
  86. foreach ($omap[$action] as $sequence) {
  87. if (strpos($sequence, "|") !== FALSE) {
  88. $sequence = substr($sequence,
  89. strpos($sequence, "|")+1,
  90. strlen($sequence));
  91. } else {
  92. $keys = explode(" ", $sequence);
  93. for ($i = 0; $i < count($keys); $i++) {
  94. if (strlen($keys[$i]) > 1) {
  95. $tmp = '';
  96. foreach (str_split($keys[$i]) as $c) {
  97. switch ($c) {
  98. case '*':
  99. $tmp .= __('Shift') . '+';
  100. break;
  101. case '^':
  102. $tmp .= __('Ctrl') . '+';
  103. break;
  104. default:
  105. $tmp .= $c;
  106. }
  107. }
  108. $keys[$i] = $tmp;
  109. }
  110. }
  111. $sequence = join(" ", $keys);
  112. }
  113. print "<li>";
  114. print "<div class='hk'><code>$sequence</code></div>";
  115. print "<div class='desc'>$description</div>";
  116. print "</li>";
  117. }
  118. }
  119. }
  120. }
  121. print "</ul>";
  122. }
  123. print "<footer>";
  124. print "<button dojoType='dijit.form.Button' style='float : left' class='alt-info' onclick='window.open(\"https://tt-rss.org/wiki/InterfaceTips\")'>
  125. <i class='material-icons'>help</i> ".__("More info...")."</button>";
  126. print "<button dojoType='dijit.form.Button'
  127. onclick=\"return dijit.byId('helpDlg').hide()\">".__('Close this window')."</button>";
  128. print "</footer>";
  129. }
  130. }