]> git.wh0rd.org - tt-rss.git/blame - modules/popup-dialog.php
enforce length limits in ttrss_entries
[tt-rss.git] / modules / popup-dialog.php
CommitLineData
ef8be8ea
AD
1<?php
2 function module_popup_dialog($link) {
3 $id = $_GET["id"];
0b126ac2 4 $param = db_escape_string($_GET["param"]);
ef8be8ea 5
ef16ae37
AD
6 if ($id == "explainError") {
7
cc17c205 8 print "<div id=\"infoBoxTitle\">".__('Notice')."</div>";
ef16ae37
AD
9 print "<div class=\"infoBoxContents\">";
10
11 if ($param == 1) {
cc17c205 12 print __("Update daemon is enabled in configuration, but daemon
ef16ae37
AD
13 process is not running, which prevents all feeds from updating. Please
14 start the daemon process or contact instance owner.");
15 }
16
d9fa39f1 17 if ($param == 2) {
4d1d0a45
AD
18 $msg = check_for_update($link, false);
19
20 if (!$msg) {
cc17c205 21 print __("You are running the latest version of Tiny Tiny RSS. The
4d1d0a45
AD
22 fact that you are seeing this dialog is probably a bug.");
23 } else {
24 print $msg;
25 }
d9fa39f1
AD
26
27 }
28
ef16ae37
AD
29 print "</div>";
30
31 print "<div align='center'>";
32
33 print "<input class=\"button\"
34 type=\"submit\" onclick=\"return closeInfoBox()\"
cc17c205 35 value=\"".__('Close this window')."\">";
ef16ae37
AD
36
37 print "</div>";
38
5e6f933a 39 return;
ef16ae37
AD
40 }
41
ef8be8ea
AD
42 if ($id == "quickAddFeed") {
43
cc17c205 44 print "<div id=\"infoBoxTitle\">".__('Subscribe to feed')."</div>";
ef8be8ea
AD
45 print "<div class=\"infoBoxContents\">";
46
e6312f6c 47 print "<form id='feed_add_form' onsubmit='return false'>";
ef8be8ea
AD
48
49 print "<input type=\"hidden\" name=\"op\" value=\"pref-feeds\">";
365f95dc 50 /* print "<input type=\"hidden\" name=\"quiet\" value=\"1\">"; */
ef8be8ea 51 print "<input type=\"hidden\" name=\"subop\" value=\"add\">";
442d77f1 52 print "<input type=\"hidden\" name=\"from\" value=\"tt-rss\">";
ef8be8ea
AD
53
54 print "<table width='100%'>
55 <tr><td>Feed URL:</td><td>
56 <input class=\"iedit\" onblur=\"javascript:enableHotkeys()\"
5e6f933a 57 onkeypress=\"return filterCR(event, qaddFeed)\"
ef8be8ea 58 onkeyup=\"toggleSubmitNotEmpty(this, 'fadd_submit_btn')\"
b5015f72 59 onchange=\"toggleSubmitNotEmpty(this, 'fadd_submit_btn')\"
ef8be8ea
AD
60 onfocus=\"javascript:disableHotkeys()\" name=\"feed_url\"></td></tr>";
61
62 if (get_pref($link, 'ENABLE_FEED_CATS')) {
cc17c205 63 print "<tr><td>".__('Category:')."</td><td>";
ef8be8ea
AD
64 print_feed_cat_select($link, "cat_id");
65 print "</td></tr>";
66 }
67
21f4756a
AD
68/* print "<tr><td colspan='2'><div class='insensitive'>";
69
70 print __("Some feeds require authentication. If you subscribe to such
71 feed, you will have to enter your login and password in Feed Editor");
72
73 print "</div></td></tr>"; */
74
ef8be8ea 75 print "</table>";
f27de515
AD
76
77 print "<div id='fadd_login_prompt'><br/>
78 <a href='javascript:showBlockElement(\"fadd_login_container\",
79 \"fadd_login_prompt\")'>Click here if this feed requires authentication.</a></div>";
80
81 print "<div id='fadd_login_container'>
82 <table width='100%'>
83 <tr><td>Login:</td><td><input name='auth_login' class='iedit'></td></tr>
84 <tr><td>Password:</td><td><input type='password'
85 name='auth_pass' class='iedit'></td></tr>
86 </table>
87 </div>";
88
ef8be8ea
AD
89 print "</form>";
90
91 print "<div align='right'>
92 <input class=\"button\"
93 id=\"fadd_submit_btn\" disabled=\"true\"
5e6f933a 94 type=\"submit\" onclick=\"return qaddFeed()\" value=\"".__('Subscribe')."\">
ef8be8ea
AD
95 <input class=\"button\"
96 type=\"submit\" onclick=\"return closeInfoBox()\"
cc17c205 97 value=\"".__('Cancel')."\"></div>";
5e6f933a
AD
98
99 return;
ef8be8ea
AD
100 }
101
102 if ($id == "search") {
103
cc17c205 104 print "<div id=\"infoBoxTitle\">".__('Search')."</div>";
ef8be8ea
AD
105 print "<div class=\"infoBoxContents\">";
106
e6312f6c 107 print "<form id='search_form' onsubmit='return false'>";
ef8be8ea
AD
108
109 #$active_feed_id = db_escape_string($_GET["param"]);
110
111 $params = split(":", db_escape_string($_GET["param"]));
112
113 $active_feed_id = sprintf("%d", $params[0]);
114 $is_cat = $params[1] == "true";
115
cc17c205 116 print "<table width='100%'><tr><td>".__('Search:')."</td><td>";
ef8be8ea
AD
117
118 print "<input name=\"query\" class=\"iedit\"
119 onkeypress=\"return filterCR(event, search)\"
b5015f72 120 onchange=\"toggleSubmitNotEmpty(this, 'search_submit_btn')\"
ef8be8ea
AD
121 onkeyup=\"toggleSubmitNotEmpty(this, 'search_submit_btn')\"
122 value=\"\">
123 </td></tr>";
124
cc17c205 125 print "<tr><td>".__('Where:')."</td><td>";
ef8be8ea
AD
126
127 print "<select name=\"search_mode\">
cc17c205 128 <option value=\"all_feeds\">".__('All feeds')."</option>";
ef8be8ea
AD
129
130 $feed_title = getFeedTitle($link, $active_feed_id);
131
132 if (!$is_cat) {
133 $feed_cat_title = getFeedCatTitle($link, $active_feed_id);
134 } else {
135 $feed_cat_title = getCategoryTitle($link, $active_feed_id);
136 }
137
138 if ($active_feed_id && !$is_cat) {
cc17c205 139 print "<option selected value=\"this_feed\">$feed_title</option>";
ef8be8ea 140 } else {
cc17c205 141 print "<option disabled>".__('This feed')."</option>";
ef8be8ea
AD
142 }
143
144 if ($is_cat) {
145 $cat_preselected = "selected";
146 }
147
148 if (get_pref($link, 'ENABLE_FEED_CATS') && ($active_feed_id > 0 || $is_cat)) {
cc17c205 149 print "<option $cat_preselected value=\"this_cat\">$feed_cat_title</option>";
ef8be8ea 150 } else {
c4b0f96c 151 //print "<option disabled>".__('This category')."</option>";
ef8be8ea
AD
152 }
153
154 print "</select></td></tr>";
155
cc17c205 156 print "<tr><td>".__('Match on:')."</td><td>";
ef8be8ea
AD
157
158 $search_fields = array(
cc17c205
AD
159 "title" => __("Title"),
160 "content" => __("Content"),
161 "both" => __("Title or content"));
ef8be8ea
AD
162
163 print_select_hash("match_on", 3, $search_fields);
164
165 print "</td></tr></table>";
166
167 print "</form>";
168
169 print "<div align=\"right\">
170 <input type=\"submit\"
171 class=\"button\" onclick=\"javascript:search()\"
172 id=\"search_submit_btn\" disabled=\"true\"
cc17c205 173 value=\"".__('Search')."\">
ef8be8ea
AD
174 <input class=\"button\"
175 type=\"submit\" onclick=\"javascript:searchCancel()\"
cc17c205 176 value=\"".__('Cancel')."\"></div>";
ef8be8ea
AD
177
178 print "</div>";
179
5e6f933a
AD
180 return;
181
ef8be8ea
AD
182 }
183
184 if ($id == "quickAddLabel") {
cc17c205 185 print "<div id=\"infoBoxTitle\">".__('Create label')."</div>";
ef8be8ea
AD
186 print "<div class=\"infoBoxContents\">";
187
e6312f6c 188 print "<form id=\"label_edit_form\" onsubmit='return false'>";
ef8be8ea
AD
189
190 print "<input type=\"hidden\" name=\"op\" value=\"pref-labels\">";
191 print "<input type=\"hidden\" name=\"subop\" value=\"add\">";
192
193 print "<table width='100%'>";
194
cc17c205 195 print "<tr><td>".__('Caption:')."</td>
ef8be8ea 196 <td><input onkeypress=\"return filterCR(event, addLabel)\"
b5015f72
AD
197 onkeyup=\"toggleSubmitNotEmpty(this, 'infobox_submit')\"
198 onchange=\"toggleSubmitNotEmpty(this, 'infobox_submit')\"
199 name=\"description\" class=\"iedit\">";
ef8be8ea
AD
200
201 print "</td></tr>";
202
203 print "<tr><td colspan=\"2\">
cc17c205 204 <p>".__('SQL Expression:')."</p>";
ef8be8ea
AD
205
206 print "<textarea onkeyup=\"toggleSubmitNotEmpty(this, 'infobox_submit')\"
207 rows=\"4\" name=\"sql_exp\" class=\"iedit\"></textarea>";
208
209 print "</td></tr></table>";
210
211 print "</form>";
212
213 print "<div style=\"display : none\" id=\"label_test_result\"></div>";
214
215 print "<div align='right'>";
216
cc17c205 217 print "<input type=\"submit\" onclick=\"labelTest()\" value=\"".__('Test')."\">
ef8be8ea
AD
218 ";
219
220 print "<input type=\"submit\"
221 id=\"infobox_submit\"
222 disabled=\"true\"
223 class=\"button\" onclick=\"return addLabel()\"
cc17c205 224 value=\"".__('Create')."\"> ";
ef8be8ea
AD
225
226 print "<input class=\"button\"
227 type=\"submit\" onclick=\"return labelEditCancel()\"
cc17c205 228 value=\"".__('Cancel')."\">";
5e6f933a
AD
229
230 return;
ef8be8ea
AD
231 }
232
233 if ($id == "quickAddFilter") {
234
235 $active_feed_id = db_escape_string($_GET["param"]);
236
cc17c205 237 print "<div id=\"infoBoxTitle\">".__('Create filter')."</div>";
ef8be8ea
AD
238 print "<div class=\"infoBoxContents\">";
239
e6312f6c 240 print "<form id=\"filter_add_form\" onsubmit='return false'>";
ef8be8ea
AD
241
242 print "<input type=\"hidden\" name=\"op\" value=\"pref-filters\">";
243 print "<input type=\"hidden\" name=\"quiet\" value=\"1\">";
244 print "<input type=\"hidden\" name=\"subop\" value=\"add\">";
245
246// print "<div class=\"notice\"><b>Note:</b> filter will only apply to new articles.</div>";
247
248 $result = db_query($link, "SELECT id,description
249 FROM ttrss_filter_types ORDER BY description");
250
251 $filter_types = array();
252
253 while ($line = db_fetch_assoc($result)) {
254 //array_push($filter_types, $line["description"]);
255 $filter_types[$line["id"]] = $line["description"];
256 }
257
258 print "<table width='100%'>";
259
cc17c205 260 print "<tr><td>".__('Match:')."</td>
ef8be8ea 261 <td><input onkeypress=\"return filterCR(event, qaddFilter)\"
b5015f72
AD
262 onkeyup=\"toggleSubmitNotEmpty(this, 'infobox_submit')\"
263 onchange=\"toggleSubmitNotEmpty(this, 'infobox_submit')\"
8011ac36
AD
264 name=\"reg_exp\" class=\"iedit\">";
265
cc17c205 266 print "</td></tr><tr><td>".__('On field:')."</td><td>";
8011ac36
AD
267
268 print_select_hash("filter_type", 1, $filter_types, "class=\"_iedit\"");
ef8be8ea
AD
269
270 print "</td></tr>";
cc17c205 271 print "<tr><td>".__('Feed:')."</td><td colspan='2'>";
ef8be8ea
AD
272
273 print_feed_select($link, "feed_id", $active_feed_id);
274
275 print "</td></tr>";
276
cc17c205 277 print "<tr><td>".__('Action:')."</td>";
ef8be8ea 278
073ca0e6
AD
279 print "<td colspan='2'><select name=\"action_id\"
280 onchange=\"filterDlgCheckAction(this)\">";
ef8be8ea
AD
281
282 $result = db_query($link, "SELECT id,description FROM ttrss_filter_actions
283 ORDER BY name");
284
285 while ($line = db_fetch_assoc($result)) {
286 printf("<option value='%d'>%s</option>", $line["id"], $line["description"]);
287 }
288
289 print "</select>";
290
073ca0e6
AD
291 print "</td></tr>";
292
cc17c205 293 print "<tr><td>".__('Params:')."</td>";
073ca0e6
AD
294
295 print "<td><input disabled class='iedit' name='action_param'></td></tr>";
296
cc17c205 297 print "<tr><td valign='top'>".__('Options:')."</td><td>";
3f2ff803
AD
298
299 print "<input type=\"checkbox\" name=\"inverse\" id=\"inverse\">
cc17c205 300 <label for=\"inverse\">".__('Inverse match')."</label></td></tr>";
3f2ff803 301
073ca0e6 302 print "</table>";
ef8be8ea
AD
303
304 print "</form>";
305
306 print "<div align='right'>";
307
308 print "<input type=\"submit\"
309 id=\"infobox_submit\"
5e6f933a 310 class=\"button\" onclick=\"return addFilter()\"
cc17c205 311 disabled=\"true\" value=\"".__('Create')."\"> ";
ef8be8ea
AD
312
313 print "<input class=\"button\"
314 type=\"submit\" onclick=\"return closeInfoBox()\"
cc17c205 315 value=\"".__('Cancel')."\">";
ef8be8ea
AD
316
317 print "</div>";
318
319// print "</td></tr></table>";
320
5e6f933a 321 return;
ef8be8ea
AD
322 }
323
a3656a41
AD
324 if ($id == "feedUpdateErrors") {
325
cc17c205 326 print "<div id=\"infoBoxTitle\">".__('Update Errors')."</div>";
a3656a41
AD
327 print "<div class=\"infoBoxContents\">";
328
cc17c205 329 print __("These feeds have not been updated because of errors:");
a3656a41
AD
330
331 $result = db_query($link, "SELECT id,title,feed_url,last_error
332 FROM ttrss_feeds WHERE last_error != '' AND owner_uid = ".$_SESSION["uid"]);
333
e8dd519b 334 print "<ul class='feedErrorsList'>";
a3656a41
AD
335
336 while ($line = db_fetch_assoc($result)) {
337 print "<li><b>" . $line["title"] . "</b> (" . $line["feed_url"] . "): " .
338 "<em>" . $line["last_error"] . "</em>";
339 }
340
341 print "</ul>";
342 print "</div>";
343
344 print "<div align='center'>";
345
346 print "<input class=\"button\"
347 type=\"submit\" onclick=\"return closeInfoBox()\"
cc17c205 348 value=\"".__('Close')."\">";
a3656a41
AD
349
350 print "</div>";
351
aa330b93 352 return;
a3656a41
AD
353 }
354
0b126ac2
AD
355 if ($id == "editArticleTags") {
356
cc17c205 357 print "<div id=\"infoBoxTitle\">".__('Edit Tags')."</div>";
0b126ac2
AD
358 print "<div class=\"infoBoxContents\">";
359
e6312f6c 360 print "<form id=\"tag_edit_form\" onsubmit='return false'>";
0b126ac2 361
cc17c205 362 print __("Tags for this article (separated by commas):")."<br>";
0b126ac2
AD
363
364 $tags = get_article_tags($link, $param);
365
366 $tags_str = join(", ", $tags);
367
d62a3b63
AD
368 print "<table width='100%'>";
369
370 print "<tr><td colspan='2'><input type=\"hidden\" name=\"id\" value=\"$param\"></td></tr>";
371
372 print "<tr><td colspan='2'><textarea rows='4' class='iedit' name='tags_str'>$tags_str</textarea></td></tr>";
373
cc17c205 374 print "<tr><td>".__('Add existing tag:')."</td>";
0b126ac2 375
d62a3b63
AD
376 $result = db_query($link, "SELECT DISTINCT tag_name FROM ttrss_tags
377 WHERE owner_uid = '".$_SESSION["uid"]."' ORDER BY tag_name");
378
379 $found_tags = array();
380
381 array_push($found_tags, '');
382
383 while ($line = db_fetch_assoc($result)) {
e4609ea9 384 array_push($found_tags, truncate_string($line["tag_name"], 20));
d62a3b63
AD
385 }
386
387 print "<td align='right'>";
388
389 print_select("found_tags", '', $found_tags, "onchange=\"javascript:editTagsInsert()\"");
390
391 print "</td>";
392
393 print "</tr>";
394
395 print "</table>";
0b126ac2
AD
396
397 print "</form>";
398
399 print "<div align='right'>";
400
401 print "<input class=\"button\"
402 type=\"submit\" onclick=\"return editTagsSave()\"
cc17c205 403 value=\"".__('Save')."\"> ";
0b126ac2
AD
404
405 print "<input class=\"button\"
406 type=\"submit\" onclick=\"return closeInfoBox()\"
cc17c205 407 value=\"".__('Cancel')."\">";
0b126ac2
AD
408
409
410 print "</div>";
411
5e6f933a 412 return;
0b126ac2
AD
413 }
414
0979b696 415 if ($id == "printTagCloud") {
27258a90 416 print "<div id=\"infoBoxTitle\">".__('Tag cloud')."</div>";
0979b696
AD
417 print "<div class=\"infoBoxContents\">";
418
dcac082b 419 print __("Showing most popular tags ")." (<a
27258a90 420 href='javascript:toggleTags(true)'>".__('browse all')."</a>):<br/>";
0979b696
AD
421
422 print "<div class=\"tagCloudContainer\">";
423
424 printTagCloud($link);
425
426 print "</div>";
427
428 print "<div align='center'>";
429 print "<input class=\"button\"
430 type=\"submit\" onclick=\"return closeInfoBox()\"
431 value=\"".__('Close')."\">";
432 print "</div>";
433
434 print "</div>";
435
436 return;
437 }
438
5e6f933a
AD
439 print "<div id='infoBoxTitle'>Internal Error</div>
440 <div id='infoBoxContents'>
441 <p>Unknown dialog <b>$id</b></p>
442 </div></div>";
443
ef8be8ea
AD
444 }
445?>