]>
Commit | Line | Data |
---|---|---|
1 | <?php | |
2 | function module_popup_dialog($link) { | |
3 | $id = $_REQUEST["id"]; | |
4 | $param = db_escape_string($_REQUEST["param"]); | |
5 | ||
6 | if ($id == "importOpml") { | |
7 | print "<div id=\"infoBoxTitle\">".__('OPML Import')."</div>"; | |
8 | print "<div class=\"infoBoxContents\">"; | |
9 | ||
10 | print "<div class=\"prefFeedCatHolder\">"; | |
11 | ||
12 | $owner_uid = $_SESSION["uid"]; | |
13 | ||
14 | db_query($link, "BEGIN"); | |
15 | ||
16 | /* create Imported feeds category just in case */ | |
17 | ||
18 | $result = db_query($link, "SELECT id FROM | |
19 | ttrss_feed_categories WHERE title = 'Imported feeds' AND | |
20 | owner_uid = '$owner_uid' LIMIT 1"); | |
21 | ||
22 | if (db_num_rows($result) == 0) { | |
23 | db_query($link, "INSERT INTO ttrss_feed_categories | |
24 | (title,owner_uid) | |
25 | VALUES ('Imported feeds', '$owner_uid')"); | |
26 | } | |
27 | ||
28 | db_query($link, "COMMIT"); | |
29 | ||
30 | /* Handle OPML import by DOMXML/DOMDocument */ | |
31 | ||
32 | if (function_exists('domxml_open_file')) { | |
33 | print "<ul class='nomarks'>"; | |
34 | print "<li>".__("Importing using DOMXML.")."</li>"; | |
35 | require_once "opml_domxml.php"; | |
36 | opml_import_domxml($link, $owner_uid); | |
37 | print "</ul>"; | |
38 | } else if (PHP_VERSION >= 5) { | |
39 | print "<ul class='nomarks'>"; | |
40 | print "<li>".__("Importing using DOMDocument.")."</li>"; | |
41 | require_once "opml_domdoc.php"; | |
42 | opml_import_domdoc($link, $owner_uid); | |
43 | print "</ul>"; | |
44 | } else { | |
45 | print_error(__("DOMXML extension is not found. It is required for PHP versions below 5.")); | |
46 | } | |
47 | ||
48 | print "</div>"; | |
49 | ||
50 | print "<div align='center'>"; | |
51 | ||
52 | print "<button onclick=\"return opmlImportDone()\">". | |
53 | __('Close this window')."</button>"; | |
54 | ||
55 | print "</div>"; | |
56 | ||
57 | print "<script type=\"text/javascript\">"; | |
58 | print "parent.opmlImportHandler(this)"; | |
59 | print "</script>"; | |
60 | ||
61 | print "</div></div>"; | |
62 | ||
63 | return; | |
64 | } | |
65 | ||
66 | if ($id == "editPrefProfiles") { | |
67 | ||
68 | print "<div id=\"infoBoxTitle\">".__('Settings Profiles')."</div>"; | |
69 | print "<div class=\"infoBoxContents\">"; | |
70 | ||
71 | print "<div><input id=\"fadd_profile\" | |
72 | onkeypress=\"return filterCR(event, addPrefProfile)\" | |
73 | size=\"40\"> | |
74 | <button onclick=\"javascript:addPrefProfile()\">". | |
75 | __('Create profile')."</button></div>"; | |
76 | ||
77 | print "<p>"; | |
78 | ||
79 | $result = db_query($link, "SELECT title,id FROM ttrss_settings_profiles | |
80 | WHERE owner_uid = ".$_SESSION["uid"]." ORDER BY title"); | |
81 | ||
82 | print __('Select:')." | |
83 | <a href=\"javascript:selectPrefRows('fcat', true)\">".__('All')."</a>, | |
84 | <a href=\"javascript:selectPrefRows('fcat', false)\">".__('None')."</a>"; | |
85 | ||
86 | print "<div class=\"prefFeedCatHolder\">"; | |
87 | ||
88 | print "<form id=\"profile_edit_form\" onsubmit=\"return false\">"; | |
89 | ||
90 | print "<table width=\"100%\" class=\"prefFeedCatList\" | |
91 | cellspacing=\"0\" id=\"prefFeedCatList\">"; | |
92 | ||
93 | print "<tr class=\"odd\" id=\"FCATR-0\">"; | |
94 | ||
95 | print "<td width='5%' align='center'><input | |
96 | onclick='toggleSelectPrefRow(this, \"fcat\");' | |
97 | type=\"checkbox\" id=\"FCCHK-0\"></td>"; | |
98 | ||
99 | if (!$_SESSION["profile"]) { | |
100 | $is_active = __("(active)"); | |
101 | } else { | |
102 | $is_active = ""; | |
103 | } | |
104 | ||
105 | print "<td><span id=\"FCATT-0\">" . | |
106 | __("Default profile") . " $is_active</span></td>"; | |
107 | ||
108 | print "</tr>"; | |
109 | ||
110 | $lnum = 1; | |
111 | ||
112 | while ($line = db_fetch_assoc($result)) { | |
113 | ||
114 | $class = ($lnum % 2) ? "even" : "odd"; | |
115 | ||
116 | $cat_id = $line["id"]; | |
117 | $this_row_id = "id=\"FCATR-$cat_id\""; | |
118 | ||
119 | print "<tr class=\"$class\" $this_row_id>"; | |
120 | ||
121 | $edit_title = htmlspecialchars($line["title"]); | |
122 | ||
123 | print "<td width='5%' align='center'><input | |
124 | onclick='toggleSelectPrefRow(this, \"fcat\");' | |
125 | type=\"checkbox\" id=\"FCCHK-$cat_id\"></td>"; | |
126 | ||
127 | if ($_SESSION["profile"] == $line["id"]) { | |
128 | $is_active = __("(active)"); | |
129 | } else { | |
130 | $is_active = ""; | |
131 | } | |
132 | ||
133 | print "<td><span id=\"FCATT-$cat_id\">" . | |
134 | $edit_title . "</span> $is_active</td>"; | |
135 | ||
136 | print "</tr>"; | |
137 | ||
138 | ++$lnum; | |
139 | } | |
140 | ||
141 | print "</table>"; | |
142 | print "</form>"; | |
143 | print "</div>"; | |
144 | ||
145 | print "<div class='dlgButtons'> | |
146 | <div style='float : left'> | |
147 | <button onclick=\"return removeSelectedPrefProfiles()\">". | |
148 | __('Remove')."</button> | |
149 | <button onclick=\"return activatePrefProfile()\">". | |
150 | __('Activate')."</button> | |
151 | </div>"; | |
152 | ||
153 | print "<button onclick=\"return closeInfoBox()\">". | |
154 | __('Close this window')."</button>"; | |
155 | ||
156 | print "</div></div>"; | |
157 | ||
158 | return; | |
159 | } | |
160 | ||
161 | if ($id == "pubOPMLUrl") { | |
162 | ||
163 | print "<div id=\"infoBoxTitle\">".__('Public OPML URL')."</div>"; | |
164 | print "<div class=\"infoBoxContents\">"; | |
165 | ||
166 | $url_path = opml_publish_url($link); | |
167 | ||
168 | print __("Your Public OPML URL is:"); | |
169 | ||
170 | print "<div class=\"tagCloudContainer\">"; | |
171 | print "<a id='pub_opml_url' href='$url_path' target='_blank'>$url_path</a>"; | |
172 | print "</div>"; | |
173 | ||
174 | print "<div align='center'>"; | |
175 | ||
176 | print "<button onclick=\"return opmlRegenKey()\">". | |
177 | __('Generate new URL')."</button> "; | |
178 | ||
179 | print "<input class=\"button\" | |
180 | type=\"submit\" onclick=\"return closeInfoBox()\" | |
181 | value=\"".__('Close this window')."\">"; | |
182 | ||
183 | print "</div></div>"; | |
184 | ||
185 | return; | |
186 | } | |
187 | ||
188 | if ($id == "explainError") { | |
189 | ||
190 | print "<div id=\"infoBoxTitle\">".__('Notice')."</div>"; | |
191 | print "<div class=\"infoBoxContents\">"; | |
192 | ||
193 | print "<div class=\"errorExplained\">"; | |
194 | ||
195 | if ($param == 1) { | |
196 | print __("Update daemon is enabled in configuration, but daemon process is not running, which prevents all feeds from updating. Please start the daemon process or contact instance owner."); | |
197 | ||
198 | $stamp = (int) file_get_contents(LOCK_DIRECTORY . "/update_daemon.stamp"); | |
199 | ||
200 | print "<p>" . __("Last update:") . " " . date("Y.m.d, G:i", $stamp); | |
201 | ||
202 | } | |
203 | ||
204 | if ($param == 2) { | |
205 | $msg = check_for_update($link); | |
206 | ||
207 | if (!$msg) { | |
208 | print __("You are running the latest version of Tiny Tiny RSS. The fact that you are seeing this dialog is probably a bug."); | |
209 | } else { | |
210 | print $msg; | |
211 | } | |
212 | ||
213 | } | |
214 | ||
215 | if ($param == 3) { | |
216 | print __("Update daemon is taking too long to perform a feed update. This could indicate a problem like crash or a hang. Please check the daemon process or contact instance owner."); | |
217 | ||
218 | $stamp = (int) file_get_contents(LOCK_DIRECTORY . "/update_daemon.stamp"); | |
219 | ||
220 | print "<p>" . __("Last update:") . " " . date("Y.m.d, G:i", $stamp); | |
221 | ||
222 | } | |
223 | ||
224 | print "</div>"; | |
225 | ||
226 | print "<div align='center'>"; | |
227 | ||
228 | print "<input class=\"button\" | |
229 | type=\"submit\" onclick=\"return closeInfoBox()\" | |
230 | value=\"".__('Close this window')."\">"; | |
231 | ||
232 | print "</div></div>"; | |
233 | ||
234 | return; | |
235 | } | |
236 | ||
237 | if ($id == "quickAddFeed") { | |
238 | ||
239 | print "<div id=\"infoBoxTitle\">".__('Subscribe to Feed')."</div>"; | |
240 | print "<div class=\"infoBoxContents\">"; | |
241 | ||
242 | print "<form id='feed_add_form' onsubmit='return false'>"; | |
243 | ||
244 | print "<input type=\"hidden\" name=\"op\" value=\"rpc\">"; | |
245 | print "<input type=\"hidden\" name=\"subop\" value=\"addfeed\">"; | |
246 | //print "<input type=\"hidden\" name=\"from\" value=\"tt-rss\">"; | |
247 | ||
248 | print "<div class=\"dlgSec\">".__("Feed")."</div>"; | |
249 | print "<div class=\"dlgSecCont\">"; | |
250 | ||
251 | print __("URL:") . " "; | |
252 | ||
253 | print "<input size=\"40\" | |
254 | onkeypress=\"return filterCR(event, subscribeToFeed)\" | |
255 | name=\"feed\" id=\"feed_url\">"; | |
256 | ||
257 | print "<br/>"; | |
258 | ||
259 | if (get_pref($link, 'ENABLE_FEED_CATS')) { | |
260 | print __('Place in category:') . " "; | |
261 | print_feed_cat_select($link, "cat"); | |
262 | } | |
263 | ||
264 | print "</div>"; | |
265 | ||
266 | print "<div id='fadd_login_container' style='display:none'> | |
267 | ||
268 | <div class=\"dlgSec\">".__("Authentication")."</div> | |
269 | <div class=\"dlgSecCont\">". | |
270 | ||
271 | __('Login:') . " <input name='login' size=\"20\" | |
272 | onkeypress=\"return filterCR(event, subscribeToFeed)\"> ". | |
273 | __('Password:') . "<input type='password' | |
274 | name='pass' size=\"20\" | |
275 | onkeypress=\"return filterCR(event, subscribeToFeed)\"> | |
276 | </div></div>"; | |
277 | ||
278 | ||
279 | print "<div style=\"clear : both\"> | |
280 | <input type=\"checkbox\" id=\"fadd_login_check\" | |
281 | onclick='checkboxToggleElement(this, \"fadd_login_container\")'> | |
282 | <label for=\"fadd_login_check\">". | |
283 | __('This feed requires authentication.')."</div>"; | |
284 | ||
285 | print "</form>"; | |
286 | ||
287 | print "<div class=\"dlgButtons\"> | |
288 | <button class=\"button\" id=\"fadd_submit_btn\" | |
289 | onclick=\"return subscribeToFeed()\">".__('Subscribe')."</button> | |
290 | <button onclick=\"return displayDlg('feedBrowser')\">".__('More feeds')."</button> | |
291 | <button onclick=\"return closeInfoBox()\">".__('Cancel')."</button></div>"; | |
292 | ||
293 | return; | |
294 | } | |
295 | ||
296 | if ($id == "feedBrowser") { | |
297 | ||
298 | print "<div id=\"infoBoxTitle\">".__('Feed Browser')."</div>"; | |
299 | ||
300 | print "<div class=\"infoBoxContents\">"; | |
301 | ||
302 | $browser_search = db_escape_string($_REQUEST["search"]); | |
303 | ||
304 | print "<form onsubmit='return false;' display='inline' | |
305 | name='feed_browser' id='feed_browser'>"; | |
306 | ||
307 | print "<input type=\"hidden\" name=\"op\" value=\"rpc\">"; | |
308 | print "<input type=\"hidden\" name=\"subop\" value=\"updateFeedBrowser\">"; | |
309 | ||
310 | print " | |
311 | <div style='float : right'> | |
312 | <img style='display : none' | |
313 | id='feed_browser_spinner' src='". | |
314 | theme_image($link, 'images/indicator_white.gif')."'> | |
315 | <input name=\"search\" size=\"20\" type=\"search\" | |
316 | onchange=\"javascript:updateFeedBrowser()\" value=\"$browser_search\"> | |
317 | <button onclick=\"javascript:updateFeedBrowser()\">".__('Search')."</button> | |
318 | </div>"; | |
319 | ||
320 | print " <select name=\"mode\" onchange=\"updateFeedBrowser()\"> | |
321 | <option value='1'>" . __('Popular feeds') . "</option> | |
322 | <option value='2'>" . __('Feed archive') . "</option> | |
323 | </select> "; | |
324 | ||
325 | print __("limit:"); | |
326 | ||
327 | print " <select name=\"limit\" onchange='updateFeedBrowser()'>"; | |
328 | ||
329 | foreach (array(25, 50, 100, 200) as $l) { | |
330 | $issel = ($l == $limit) ? "selected" : ""; | |
331 | print "<option $issel>$l</option>"; | |
332 | } | |
333 | ||
334 | print "</select> "; | |
335 | ||
336 | print "<p>"; | |
337 | ||
338 | $owner_uid = $_SESSION["uid"]; | |
339 | ||
340 | /* print __('Select:')." | |
341 | <a href=\"javascript:selectPrefRows('fbrowse', true)\">".__('All')."</a>, | |
342 | <a href=\"javascript:selectPrefRows('fbrowse', false)\">".__('None')."</a>"; */ | |
343 | ||
344 | print "<ul class='browseFeedList' id='browseFeedList'>"; | |
345 | print_feed_browser($link, $search, 25); | |
346 | print "</ul>"; | |
347 | ||
348 | print "<div align='center'> | |
349 | <button onclick=\"feedBrowserSubscribe()\">".__('Subscribe')."</button> | |
350 | <button style='display : none' id='feed_archive_remove' onclick=\"feedArchiveRemove()\">".__('Remove')."</button> | |
351 | <button onclick=\"closeInfoBox()\" >".__('Cancel')."</button></div>"; | |
352 | ||
353 | print "</div>"; | |
354 | return; | |
355 | } | |
356 | ||
357 | if ($id == "search") { | |
358 | ||
359 | print "<div id=\"infoBoxTitle\">".__('Search')."</div>"; | |
360 | print "<div class=\"infoBoxContents\">"; | |
361 | ||
362 | print "<form id='search_form' onsubmit='return false'>"; | |
363 | ||
364 | #$active_feed_id = db_escape_string($_REQUEST["param"]); | |
365 | ||
366 | $params = split(":", db_escape_string($_REQUEST["param"])); | |
367 | ||
368 | $active_feed_id = sprintf("%d", $params[0]); | |
369 | $is_cat = $params[1] == "true"; | |
370 | ||
371 | print "<div class=\"dlgSec\">".__('Look for')."</div>"; | |
372 | ||
373 | print "<div class=\"dlgSecCont\">"; | |
374 | ||
375 | print "<input onkeypress=\"return filterCR(event, search)\" | |
376 | name=\"query\" size=\"20\" type=\"search\" value=''>"; | |
377 | ||
378 | print " " . __('match on')." "; | |
379 | ||
380 | $search_fields = array( | |
381 | "title" => __("Title"), | |
382 | "content" => __("Content"), | |
383 | "both" => __("Title or content")); | |
384 | ||
385 | print_select_hash("match_on", 3, $search_fields); | |
386 | ||
387 | ||
388 | print "<br/>".__('Limit search to:')." "; | |
389 | ||
390 | print "<select name=\"search_mode\"> | |
391 | <option value=\"all_feeds\">".__('All feeds')."</option>"; | |
392 | ||
393 | $feed_title = getFeedTitle($link, $active_feed_id); | |
394 | ||
395 | if (!$is_cat) { | |
396 | $feed_cat_title = getFeedCatTitle($link, $active_feed_id); | |
397 | } else { | |
398 | $feed_cat_title = getCategoryTitle($link, $active_feed_id); | |
399 | } | |
400 | ||
401 | if ($active_feed_id && !$is_cat) { | |
402 | print "<option selected value=\"this_feed\">$feed_title</option>"; | |
403 | } else { | |
404 | print "<option disabled>".__('This feed')."</option>"; | |
405 | } | |
406 | ||
407 | if ($is_cat) { | |
408 | $cat_preselected = "selected"; | |
409 | } | |
410 | ||
411 | if (get_pref($link, 'ENABLE_FEED_CATS') && ($active_feed_id > 0 || $is_cat)) { | |
412 | print "<option $cat_preselected value=\"this_cat\">$feed_cat_title</option>"; | |
413 | } else { | |
414 | //print "<option disabled>".__('This category')."</option>"; | |
415 | } | |
416 | ||
417 | print "</select>"; | |
418 | ||
419 | print "</div>"; | |
420 | ||
421 | print "</form>"; | |
422 | ||
423 | print "<div class=\"dlgButtons\"> | |
424 | <button onclick=\"javascript:search()\">".__('Search')."</button> | |
425 | <button onclick=\"javascript:closeInfoBox(true)\">".__('Cancel')."</button> | |
426 | </div>"; | |
427 | ||
428 | print "</div>"; | |
429 | ||
430 | return; | |
431 | ||
432 | } | |
433 | ||
434 | if ($id == "quickAddFilter") { | |
435 | ||
436 | $active_feed_id = db_escape_string($_REQUEST["param"]); | |
437 | ||
438 | print "<div id=\"infoBoxTitle\">".__('Create Filter')."</div>"; | |
439 | print "<div class=\"infoBoxContents\">"; | |
440 | ||
441 | print "<form id=\"filter_add_form\" onsubmit='return false'>"; | |
442 | ||
443 | print "<input type=\"hidden\" name=\"op\" value=\"pref-filters\">"; | |
444 | print "<input type=\"hidden\" name=\"quiet\" value=\"1\">"; | |
445 | print "<input type=\"hidden\" name=\"subop\" value=\"add\">"; | |
446 | ||
447 | $result = db_query($link, "SELECT id,description | |
448 | FROM ttrss_filter_types ORDER BY description"); | |
449 | ||
450 | $filter_types = array(); | |
451 | ||
452 | while ($line = db_fetch_assoc($result)) { | |
453 | //array_push($filter_types, $line["description"]); | |
454 | $filter_types[$line["id"]] = __($line["description"]); | |
455 | } | |
456 | ||
457 | print "<div class=\"dlgSec\">".__("Match")."</div>"; | |
458 | ||
459 | print "<div class=\"dlgSecCont\">"; | |
460 | ||
461 | print "<span id=\"filter_dlg_date_mod_box\" style=\"display : none\">"; | |
462 | print __("Date") . " "; | |
463 | ||
464 | $filter_params = array( | |
465 | "before" => __("before"), | |
466 | "after" => __("after")); | |
467 | ||
468 | print_select_hash("filter_date_modifier", "before", $filter_params); | |
469 | ||
470 | print " </span>"; | |
471 | ||
472 | print "<input onkeypress=\"return filterCR(event, createFilter)\" | |
473 | name=\"reg_exp\" size=\"30\" value=\"$reg_exp\">"; | |
474 | ||
475 | print "<span id=\"filter_dlg_date_chk_box\" style=\"display : none\">"; | |
476 | print " <input class=\"button\" | |
477 | type=\"submit\" onclick=\"return filterDlgCheckDate()\" | |
478 | value=\"".__('Check it')."\">"; | |
479 | print "</span>"; | |
480 | ||
481 | print "<br/> " . __("on field") . " "; | |
482 | print_select_hash("filter_type", 1, $filter_types, | |
483 | 'onchange="filterDlgCheckType(this)"'); | |
484 | ||
485 | print "<br/>"; | |
486 | ||
487 | print __("in") . " "; | |
488 | print_feed_select($link, "feed_id", $active_feed_id); | |
489 | ||
490 | print "</div>"; | |
491 | ||
492 | print "<div class=\"dlgSec\">".__("Perform Action")."</div>"; | |
493 | ||
494 | print "<div class=\"dlgSecCont\">"; | |
495 | ||
496 | print "<select name=\"action_id\" | |
497 | onchange=\"filterDlgCheckAction(this)\">"; | |
498 | ||
499 | $result = db_query($link, "SELECT id,description FROM ttrss_filter_actions | |
500 | ORDER BY name"); | |
501 | ||
502 | while ($line = db_fetch_assoc($result)) { | |
503 | printf("<option value='%d'>%s</option>", $line["id"], __($line["description"])); | |
504 | } | |
505 | ||
506 | print "</select>"; | |
507 | ||
508 | print "<span id=\"filter_dlg_param_box\" style=\"display : none\">"; | |
509 | print " " . __("with parameters:") . " "; | |
510 | print "<input size=\"20\" | |
511 | onkeypress=\"return filterCR(event, createFilter)\" | |
512 | name=\"action_param\">"; | |
513 | ||
514 | print_label_select($link, "action_param_label", $action_param); | |
515 | ||
516 | print "</span>"; | |
517 | ||
518 | print " "; // tiny layout hack | |
519 | ||
520 | print "</div>"; | |
521 | ||
522 | print "<div class=\"dlgSec\">".__("Options")."</div>"; | |
523 | print "<div class=\"dlgSecCont\">"; | |
524 | ||
525 | print "<div style=\"line-height : 100%\">"; | |
526 | ||
527 | print "<input type=\"checkbox\" name=\"enabled\" id=\"enabled\" checked=\"1\"> | |
528 | <label for=\"enabled\">".__('Enabled')."</label><br/>"; | |
529 | ||
530 | print "<input type=\"checkbox\" name=\"inverse\" id=\"inverse\"> | |
531 | <label for=\"inverse\">".__('Inverse match')."</label>"; | |
532 | ||
533 | print "</div>"; | |
534 | print "</div>"; | |
535 | ||
536 | print "</form>"; | |
537 | ||
538 | print "<div class=\"dlgButtons\">"; | |
539 | ||
540 | print "<button onclick=\"return createFilter()\">". | |
541 | __('Create')."</button> "; | |
542 | ||
543 | print "<button onclick=\"return closeInfoBox()\">".__('Cancel'). | |
544 | "</button>"; | |
545 | ||
546 | print "</div>"; | |
547 | ||
548 | // print "</td></tr></table>"; | |
549 | ||
550 | return; | |
551 | } | |
552 | ||
553 | if ($id == "feedUpdateErrors") { | |
554 | ||
555 | print "<div id=\"infoBoxTitle\">".__('Update Errors')."</div>"; | |
556 | print "<div class=\"infoBoxContents\">"; | |
557 | ||
558 | print __("These feeds have not been updated because of errors:"); | |
559 | ||
560 | $result = db_query($link, "SELECT id,title,feed_url,last_error | |
561 | FROM ttrss_feeds WHERE last_error != '' AND owner_uid = ".$_SESSION["uid"]); | |
562 | ||
563 | print "<ul class='feedErrorsList'>"; | |
564 | ||
565 | while ($line = db_fetch_assoc($result)) { | |
566 | print "<li><b>" . $line["title"] . "</b> (" . $line["feed_url"] . "): " . | |
567 | "<em>" . $line["last_error"] . "</em>"; | |
568 | } | |
569 | ||
570 | print "</ul>"; | |
571 | ||
572 | print "<div align='center'>"; | |
573 | ||
574 | print "<button onclick=\"return closeInfoBox()\">". | |
575 | __('Close this window')."</button>"; | |
576 | ||
577 | print "</div>"; | |
578 | ||
579 | return; | |
580 | } | |
581 | ||
582 | if ($id == "editArticleTags") { | |
583 | ||
584 | print "<div id=\"infoBoxTitle\">".__('Edit Tags')."</div>"; | |
585 | print "<div class=\"infoBoxContents\">"; | |
586 | ||
587 | print "<form id=\"tag_edit_form\" onsubmit='return false'>"; | |
588 | ||
589 | print __("Tags for this article (separated by commas):")."<br>"; | |
590 | ||
591 | $tags = get_article_tags($link, $param); | |
592 | ||
593 | $tags_str = join(", ", $tags); | |
594 | ||
595 | print "<table width='100%'>"; | |
596 | ||
597 | print "<tr><td colspan='2'><input type=\"hidden\" name=\"id\" value=\"$param\"></td></tr>"; | |
598 | ||
599 | print "<tr><td colspan='2'><textarea rows='4' class='iedit' id='tags_str' | |
600 | name='tags_str'>$tags_str</textarea> | |
601 | <div class=\"autocomplete\" id=\"tags_choices\" | |
602 | style=\"display:none\"></div> | |
603 | </td></tr>"; | |
604 | ||
605 | print "</table>"; | |
606 | ||
607 | print "</form>"; | |
608 | ||
609 | print "<div align='right'>"; | |
610 | ||
611 | print "<button onclick=\"return editTagsSave()\">".__('Save')."</button> "; | |
612 | print "<button onclick=\"return closeInfoBox()\">".__('Cancel')."</button>"; | |
613 | ||
614 | print "</div>"; | |
615 | ||
616 | return; | |
617 | } | |
618 | ||
619 | if ($id == "printTagCloud") { | |
620 | print "<div id=\"infoBoxTitle\">".__('Tag Cloud')."</div>"; | |
621 | print "<div class=\"infoBoxContents\">"; | |
622 | ||
623 | print __("Showing most popular tags ")." (<a | |
624 | href='javascript:toggleTags(true)'>".__('more tags')."</a>):<br/>"; | |
625 | ||
626 | print "<div class=\"tagCloudContainer\">"; | |
627 | ||
628 | printTagCloud($link); | |
629 | ||
630 | print "</div>"; | |
631 | ||
632 | print "<div align='center'>"; | |
633 | print "<button onclick=\"return closeInfoBox()\">". | |
634 | __('Close this window')."</button>"; | |
635 | print "</div>"; | |
636 | ||
637 | print "</div>"; | |
638 | ||
639 | return; | |
640 | } | |
641 | ||
642 | if ($id == "emailArticle") { | |
643 | ||
644 | print "<div id=\"infoBoxTitle\">".__('Forward article by email')."</div>"; | |
645 | print "<div class=\"infoBoxContents\">"; | |
646 | ||
647 | print "<form id=\"article_email_form\" onsubmit='return false'>"; | |
648 | ||
649 | $secretkey = sha1(uniqid(rand(), true)); | |
650 | ||
651 | $_SESSION['email_secretkey'] = $secretkey; | |
652 | ||
653 | print "<input type=\"hidden\" name=\"secretkey\" value=\"$secretkey\">"; | |
654 | print "<input type=\"hidden\" name=\"op\" value=\"rpc\">"; | |
655 | print "<input type=\"hidden\" name=\"subop\" value=\"sendEmail\">"; | |
656 | ||
657 | $result = db_query($link, "SELECT email, full_name FROM ttrss_users WHERE | |
658 | id = " . $_SESSION["uid"]); | |
659 | ||
660 | $user_email = htmlspecialchars(db_fetch_result($result, 0, "email")); | |
661 | $user_name = htmlspecialchars(db_fetch_result($result, 0, "full_name")); | |
662 | ||
663 | if (!$user_name) $user_name = $_SESSION['name']; | |
664 | ||
665 | $_SESSION['email_replyto'] = $user_email; | |
666 | $_SESSION['email_fromname'] = $user_name; | |
667 | ||
668 | require_once "lib/MiniTemplator.class.php"; | |
669 | ||
670 | $tpl = new MiniTemplator; | |
671 | $tpl_t = new MiniTemplator; | |
672 | ||
673 | $tpl->readTemplateFromFile("templates/email_article_template.txt"); | |
674 | ||
675 | $tpl->setVariable('USER_NAME', $_SESSION["name"]); | |
676 | $tpl->setVariable('USER_EMAIL', $user_email); | |
677 | $tpl->setVariable('TTRSS_HOST', $_SERVER["HTTP_HOST"]); | |
678 | ||
679 | // $tpl->addBlock('header'); | |
680 | ||
681 | $result = db_query($link, "SELECT link, content, title | |
682 | FROM ttrss_user_entries, ttrss_entries WHERE id = ref_id AND | |
683 | id IN ($param) AND owner_uid = " . $_SESSION["uid"]); | |
684 | ||
685 | if (db_num_rows($result) > 1) { | |
686 | $subject = __("[Forwarded]") . " " . __("Multiple articles"); | |
687 | } | |
688 | ||
689 | while ($line = db_fetch_assoc($result)) { | |
690 | ||
691 | if (!$subject) | |
692 | $subject = __("[Forwarded]") . " " . htmlspecialchars($line["title"]); | |
693 | ||
694 | $tpl->setVariable('ARTICLE_TITLE', strip_tags($line["title"])); | |
695 | $tpl->setVariable('ARTICLE_URL', strip_tags($line["link"])); | |
696 | ||
697 | $tpl->addBlock('article'); | |
698 | } | |
699 | ||
700 | $tpl->addBlock('email'); | |
701 | ||
702 | $content = ""; | |
703 | $tpl->generateOutputToString($content); | |
704 | ||
705 | print "<table width='100%'><tr><td>"; | |
706 | ||
707 | print __('From:'); | |
708 | ||
709 | print "</td><td>"; | |
710 | ||
711 | print "<input size=\"40\" disabled | |
712 | onkeypress=\"return filterCR(event, false)\" | |
713 | value=\"$user_name <$user_email>\">"; | |
714 | ||
715 | print "</td></tr><tr><td>"; | |
716 | ||
717 | print __('To:'); | |
718 | ||
719 | print "</td><td>"; | |
720 | ||
721 | print "<input size=\"40\" | |
722 | onkeypress=\"return filterCR(event, false)\" | |
723 | name=\"destination\" id=\"destination\">"; | |
724 | ||
725 | print "<div class=\"autocomplete\" id=\"destination_choices\" | |
726 | style=\"display:none\"></div>"; | |
727 | ||
728 | print "</td></tr><tr><td>"; | |
729 | ||
730 | print __('Subject:'); | |
731 | ||
732 | print "</td><td>"; | |
733 | ||
734 | print "<input size=\"60\" class=\"iedit\" | |
735 | onkeypress=\"return filterCR(event, false)\" | |
736 | name=\"subject\" value=\"$subject\" id=\"subject\">"; | |
737 | ||
738 | print "</td></tr></table>"; | |
739 | ||
740 | print "<textarea rows='10' class='iedit' style='font-size : small' | |
741 | name='content'>$content</textarea>"; | |
742 | ||
743 | print "</form>"; | |
744 | ||
745 | print "<div class='dlgButtons'>"; | |
746 | ||
747 | print "<button onclick=\"return emailArticleDo()\">".__('Send e-mail')."</button> "; | |
748 | print "<button onclick=\"return closeInfoBox()\">".__('Cancel')."</button>"; | |
749 | ||
750 | print "</div>"; | |
751 | ||
752 | return; | |
753 | } | |
754 | ||
755 | if ($id == "generatedFeed") { | |
756 | ||
757 | print "<div id=\"infoBoxTitle\">".__('View as RSS')."</div>"; | |
758 | print "<div class=\"infoBoxContents\">"; | |
759 | ||
760 | $params = explode(":", $param, 3); | |
761 | $feed_id = db_escape_string($params[0]); | |
762 | $is_cat = (bool) $params[1]; | |
763 | ||
764 | $key = get_feed_access_key($link, $feed_id, $is_cat); | |
765 | ||
766 | $url_path = htmlspecialchars($params[2]) . "&key=" . $key; | |
767 | ||
768 | print __("You can view this feed as RSS using the following URL:"); | |
769 | ||
770 | print "<div class=\"tagCloudContainer\">"; | |
771 | print "<a id='gen_feed_url' href='$url_path' target='_blank'>$url_path</a>"; | |
772 | print "</div>"; | |
773 | ||
774 | print "<div align='center'>"; | |
775 | ||
776 | print "<button onclick=\"return genUrlChangeKey('$feed_id', '$is_cat')\">". | |
777 | __('Generate new URL')."</button> "; | |
778 | ||
779 | print "<input class=\"button\" | |
780 | type=\"submit\" onclick=\"return closeInfoBox()\" | |
781 | value=\"".__('Close this window')."\">"; | |
782 | ||
783 | print "</div></div>"; | |
784 | ||
785 | return; | |
786 | } | |
787 | ||
788 | print "<div id='infoBoxTitle'>Internal Error</div> | |
789 | <div id='infoBoxContents'> | |
790 | <p>Unknown dialog <b>$id</b></p> | |
791 | </div></div>"; | |
792 | ||
793 | } | |
794 | ?> |