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
|
|
|
|
9
|
|
|
function digestTest() { |
|
|
|
|
10
|
|
|
if (isset($_SESSION['uid'])) { |
11
|
|
|
header("Content-type: text/html"); |
12
|
|
|
|
13
|
|
|
$rv = Digest::prepare_headlines_digest($_SESSION['uid'], 1, 1000); |
14
|
|
|
|
15
|
|
|
print "<h1>HTML</h1>"; |
16
|
|
|
print $rv[0]; |
17
|
|
|
print "<h1>Plain text</h1>"; |
18
|
|
|
print "<pre>".$rv[3]."</pre>"; |
19
|
|
|
} else { |
20
|
|
|
print error_json(6); |
21
|
|
|
} |
22
|
|
|
} |
23
|
|
|
|
24
|
|
|
function help() { |
|
|
|
|
25
|
|
|
$topic = clean_filename($_REQUEST["topic"]); // only one for now |
26
|
|
|
|
27
|
|
|
if ($topic == "main") { |
28
|
|
|
$info = get_hotkeys_info(); |
29
|
|
|
$imap = get_hotkeys_map(); |
30
|
|
|
$omap = array(); |
31
|
|
|
|
32
|
|
|
foreach ($imap[1] as $sequence => $action) { |
33
|
|
|
if (!isset($omap[$action])) $omap[$action] = array(); |
34
|
|
|
|
35
|
|
|
array_push($omap[$action], $sequence); |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
print "<ul class='panel panel-scrollable hotkeys-help' style='height : 300px'>"; |
39
|
|
|
|
40
|
|
|
$cur_section = ""; |
41
|
|
|
foreach ($info as $section => $hotkeys) { |
42
|
|
|
|
43
|
|
|
if ($cur_section) print "<li> </li>"; |
44
|
|
|
print "<li><h3>" . $section . "</h3></li>"; |
45
|
|
|
$cur_section = $section; |
46
|
|
|
|
47
|
|
|
foreach ($hotkeys as $action => $description) { |
48
|
|
|
|
49
|
|
|
if (is_array($omap[$action])) { |
50
|
|
|
foreach ($omap[$action] as $sequence) { |
51
|
|
|
if (strpos($sequence, "|") !== FALSE) { |
52
|
|
|
$sequence = substr($sequence, |
53
|
|
|
strpos($sequence, "|")+1, |
54
|
|
|
strlen($sequence)); |
55
|
|
|
} else { |
56
|
|
|
$keys = explode(" ", $sequence); |
57
|
|
|
|
58
|
|
|
for ($i = 0; $i < count($keys); $i++) { |
|
|
|
|
59
|
|
|
if (strlen($keys[$i]) > 1) { |
60
|
|
|
$tmp = ''; |
61
|
|
|
foreach (str_split($keys[$i]) as $c) { |
62
|
|
|
switch ($c) { |
63
|
|
|
case '*': |
64
|
|
|
$tmp .= __('Shift') . '+'; |
65
|
|
|
break; |
66
|
|
|
case '^': |
67
|
|
|
$tmp .= __('Ctrl') . '+'; |
68
|
|
|
break; |
69
|
|
|
default: |
70
|
|
|
$tmp .= $c; |
71
|
|
|
} |
72
|
|
|
} |
73
|
|
|
$keys[$i] = $tmp; |
74
|
|
|
} |
75
|
|
|
} |
76
|
|
|
$sequence = join(" ", $keys); |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
print "<li>"; |
80
|
|
|
print "<div class='hk'><code>$sequence</code></div>"; |
81
|
|
|
print "<div class='desc'>$description</div>"; |
82
|
|
|
print "</li>"; |
83
|
|
|
} |
84
|
|
|
} |
85
|
|
|
} |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
print "</ul>"; |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
print "<footer class='text-center'>"; |
92
|
|
|
print "<button dojoType='dijit.form.Button' |
93
|
|
|
onclick=\"return dijit.byId('helpDlg').hide()\">".__('Close this window')."</button>"; |
94
|
|
|
print "</footer>"; |
95
|
|
|
|
96
|
|
|
} |
97
|
|
|
} |
98
|
|
|
|
Adding explicit visibility (
private
,protected
, orpublic
) is generally recommend to communicate to other developers how, and from where this method is intended to be used.