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