]>
Commit | Line | Data |
---|---|---|
ef8be8ea AD |
1 | <?php |
2 | function module_popup_dialog($link) { | |
b4e75b2a AD |
3 | $id = $_REQUEST["id"]; |
4 | $param = db_escape_string($_REQUEST["param"]); | |
ef8be8ea | 5 | |
b6a6e262 AD |
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>"; | |
eef20159 | 35 | require_once "opml_domxml.php"; |
b6a6e262 AD |
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>"; | |
eef20159 | 41 | require_once "opml_domdoc.php"; |
b6a6e262 AD |
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 | ||
f94ba975 AD |
52 | print "<button onclick=\"return opmlImportDone()\">". |
53 | __('Close this window')."</button>"; | |
b6a6e262 AD |
54 | |
55 | print "</div>"; | |
56 | ||
57 | print "<script type=\"text/javascript\">"; | |
c3b7b797 | 58 | print "parent.opmlImportHandler(this)"; |
b6a6e262 AD |
59 | print "</script>"; |
60 | ||
61 | print "</div></div>"; | |
62 | ||
63 | return; | |
64 | } | |
65 | ||
d9084cf2 AD |
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 | |
47179c0e | 80 | WHERE owner_uid = ".$_SESSION["uid"]." ORDER BY title"); |
d9084cf2 AD |
81 | |
82 | print __('Select:')." | |
e69fb880 AD |
83 | <a href=\"#\" onclick=\"selectTableRows('prefFeedCatList', 'all')\">".__('All')."</a>, |
84 | <a href=\"#\" onclick=\"selectTableRows('prefFeedCatList', 'none')\">".__('None')."</a>"; | |
d9084cf2 AD |
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 | |
a998dbef | 96 | onclick='toggleSelectRow(this);' |
d9084cf2 AD |
97 | type=\"checkbox\" id=\"FCCHK-0\"></td>"; |
98 | ||
ac9dbf85 AD |
99 | if (!$_SESSION["profile"]) { |
100 | $is_active = __("(active)"); | |
101 | } else { | |
102 | $is_active = ""; | |
103 | } | |
104 | ||
d9084cf2 | 105 | print "<td><span id=\"FCATT-0\">" . |
ac9dbf85 | 106 | __("Default profile") . " $is_active</span></td>"; |
d9084cf2 AD |
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 | |
a998dbef | 124 | onclick='toggleSelectRow(this);' |
d9084cf2 AD |
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> | |
8ab4da5f AD |
149 | <button onclick=\"return activatePrefProfile()\">". |
150 | __('Activate')."</button> | |
d9084cf2 AD |
151 | </div>"; |
152 | ||
8ab4da5f AD |
153 | print "<button onclick=\"return closeInfoBox()\">". |
154 | __('Close this window')."</button>"; | |
d9084cf2 AD |
155 | |
156 | print "</div></div>"; | |
157 | ||
158 | return; | |
159 | } | |
160 | ||
c8640eda MK |
161 | if ($id == "pubOPMLUrl") { |
162 | ||
163 | print "<div id=\"infoBoxTitle\">".__('Public OPML URL')."</div>"; | |
164 | print "<div class=\"infoBoxContents\">"; | |
f29033f8 | 165 | |
c8640eda MK |
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 | ||
a918f5f9 AD |
179 | print "<button onclick=\"return closeInfoBox()\">". |
180 | __('Close this window')."</button>"; | |
cf9dc032 AD |
181 | |
182 | print "</div></div>"; | |
183 | ||
184 | return; | |
185 | } | |
186 | ||
ef16ae37 AD |
187 | if ($id == "explainError") { |
188 | ||
cc17c205 | 189 | print "<div id=\"infoBoxTitle\">".__('Notice')."</div>"; |
ef16ae37 AD |
190 | print "<div class=\"infoBoxContents\">"; |
191 | ||
73495fd1 AD |
192 | print "<div class=\"errorExplained\">"; |
193 | ||
ef16ae37 | 194 | if ($param == 1) { |
73495fd1 | 195 | 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."); |
f6854e44 | 196 | |
1ea20897 | 197 | $stamp = (int) file_get_contents(LOCK_DIRECTORY . "/update_daemon.stamp"); |
f6854e44 AD |
198 | |
199 | print "<p>" . __("Last update:") . " " . date("Y.m.d, G:i", $stamp); | |
200 | ||
ef16ae37 AD |
201 | } |
202 | ||
d9fa39f1 | 203 | if ($param == 2) { |
73495fd1 | 204 | $msg = check_for_update($link); |
4d1d0a45 AD |
205 | |
206 | if (!$msg) { | |
73495fd1 | 207 | print __("You are running the latest version of Tiny Tiny RSS. The fact that you are seeing this dialog is probably a bug."); |
4d1d0a45 AD |
208 | } else { |
209 | print $msg; | |
210 | } | |
d9fa39f1 AD |
211 | |
212 | } | |
213 | ||
8e00ae9b | 214 | if ($param == 3) { |
73495fd1 | 215 | 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."); |
f6854e44 | 216 | |
1ea20897 | 217 | $stamp = (int) file_get_contents(LOCK_DIRECTORY . "/update_daemon.stamp"); |
f6854e44 AD |
218 | |
219 | print "<p>" . __("Last update:") . " " . date("Y.m.d, G:i", $stamp); | |
220 | ||
8e00ae9b AD |
221 | } |
222 | ||
ef16ae37 | 223 | print "</div>"; |
73495fd1 | 224 | |
ef16ae37 AD |
225 | print "<div align='center'>"; |
226 | ||
a918f5f9 AD |
227 | print "<button onclick=\"return closeInfoBox()\"". |
228 | __('Close this window')."</button>"; | |
ef16ae37 | 229 | |
73495fd1 | 230 | print "</div></div>"; |
ef16ae37 | 231 | |
5e6f933a | 232 | return; |
ef16ae37 AD |
233 | } |
234 | ||
ef8be8ea AD |
235 | if ($id == "quickAddFeed") { |
236 | ||
ecace165 | 237 | print "<div id=\"infoBoxTitle\">".__('Subscribe to Feed')."</div>"; |
ef8be8ea AD |
238 | print "<div class=\"infoBoxContents\">"; |
239 | ||
e6312f6c | 240 | print "<form id='feed_add_form' onsubmit='return false'>"; |
ef8be8ea | 241 | |
a5819bb3 AD |
242 | print "<input type=\"hidden\" name=\"op\" value=\"rpc\">"; |
243 | print "<input type=\"hidden\" name=\"subop\" value=\"addfeed\">"; | |
244 | //print "<input type=\"hidden\" name=\"from\" value=\"tt-rss\">"; | |
ef8be8ea | 245 | |
ecace165 AD |
246 | print "<div class=\"dlgSec\">".__("Feed")."</div>"; |
247 | print "<div class=\"dlgSecCont\">"; | |
248 | ||
249 | print __("URL:") . " "; | |
250 | ||
f88c7814 | 251 | print "<input size=\"40\" |
18ab3d7a | 252 | onkeypress=\"return filterCR(event, subscribeToFeed)\" |
31a53903 | 253 | name=\"feed\" id=\"feed_url\">"; |
ecace165 AD |
254 | |
255 | print "<br/>"; | |
256 | ||
ef8be8ea | 257 | if (get_pref($link, 'ENABLE_FEED_CATS')) { |
ecace165 | 258 | print __('Place in category:') . " "; |
a5819bb3 | 259 | print_feed_cat_select($link, "cat"); |
ef8be8ea AD |
260 | } |
261 | ||
ecace165 AD |
262 | print "</div>"; |
263 | ||
5eeb3874 CW |
264 | print '<div id="fadd_feeds_container" style="display:none"> |
265 | ||
266 | <div class="dlgSec">' . __('Available feeds') . '</div> | |
267 | <div class="dlgSecCont">' | |
268 | ||
269 | . ' <select name="feed" id="faad_feeds_container_select" size="3"></select>' | |
270 | . '</div></div>'; | |
271 | ||
b9073cd9 | 272 | print "<div id='fadd_login_container' style='display:none'> |
ecace165 AD |
273 | |
274 | <div class=\"dlgSec\">".__("Authentication")."</div> | |
275 | <div class=\"dlgSecCont\">". | |
276 | ||
a5819bb3 | 277 | __('Login:') . " <input name='login' size=\"20\" |
ecace165 AD |
278 | onkeypress=\"return filterCR(event, subscribeToFeed)\"> ". |
279 | __('Password:') . "<input type='password' | |
a5819bb3 | 280 | name='pass' size=\"20\" |
ecace165 AD |
281 | onkeypress=\"return filterCR(event, subscribeToFeed)\"> |
282 | </div></div>"; | |
283 | ||
284 | ||
285 | print "<div style=\"clear : both\"> | |
286 | <input type=\"checkbox\" id=\"fadd_login_check\" | |
287 | onclick='checkboxToggleElement(this, \"fadd_login_container\")'> | |
288 | <label for=\"fadd_login_check\">". | |
289 | __('This feed requires authentication.')."</div>"; | |
f27de515 | 290 | |
ef8be8ea AD |
291 | print "</form>"; |
292 | ||
ecace165 | 293 | print "<div class=\"dlgButtons\"> |
f88c7814 AD |
294 | <button class=\"button\" id=\"fadd_submit_btn\" |
295 | onclick=\"return subscribeToFeed()\">".__('Subscribe')."</button> | |
d002edc7 | 296 | <button onclick=\"return displayDlg('feedBrowser')\">".__('More feeds')."</button> |
f88c7814 | 297 | <button onclick=\"return closeInfoBox()\">".__('Cancel')."</button></div>"; |
ecace165 | 298 | |
5e6f933a | 299 | return; |
ef8be8ea AD |
300 | } |
301 | ||
ef88b1cc AD |
302 | if ($id == "feedBrowser") { |
303 | ||
304 | print "<div id=\"infoBoxTitle\">".__('Feed Browser')."</div>"; | |
305 | ||
306 | print "<div class=\"infoBoxContents\">"; | |
307 | ||
308 | $browser_search = db_escape_string($_REQUEST["search"]); | |
309 | ||
310 | print "<form onsubmit='return false;' display='inline' | |
311 | name='feed_browser' id='feed_browser'>"; | |
312 | ||
313 | print "<input type=\"hidden\" name=\"op\" value=\"rpc\">"; | |
314 | print "<input type=\"hidden\" name=\"subop\" value=\"updateFeedBrowser\">"; | |
315 | ||
316 | print " | |
317 | <div style='float : right'> | |
318 | <img style='display : none' | |
883fee8d AD |
319 | id='feed_browser_spinner' src='". |
320 | theme_image($link, 'images/indicator_white.gif')."'> | |
ef88b1cc AD |
321 | <input name=\"search\" size=\"20\" type=\"search\" |
322 | onchange=\"javascript:updateFeedBrowser()\" value=\"$browser_search\"> | |
323 | <button onclick=\"javascript:updateFeedBrowser()\">".__('Search')."</button> | |
324 | </div>"; | |
325 | ||
326 | print " <select name=\"mode\" onchange=\"updateFeedBrowser()\"> | |
327 | <option value='1'>" . __('Popular feeds') . "</option> | |
328 | <option value='2'>" . __('Feed archive') . "</option> | |
329 | </select> "; | |
330 | ||
331 | print __("limit:"); | |
332 | ||
333 | print " <select name=\"limit\" onchange='updateFeedBrowser()'>"; | |
334 | ||
335 | foreach (array(25, 50, 100, 200) as $l) { | |
336 | $issel = ($l == $limit) ? "selected" : ""; | |
337 | print "<option $issel>$l</option>"; | |
338 | } | |
339 | ||
340 | print "</select> "; | |
341 | ||
342 | print "<p>"; | |
343 | ||
344 | $owner_uid = $_SESSION["uid"]; | |
345 | ||
346 | print "<ul class='browseFeedList' id='browseFeedList'>"; | |
347 | print_feed_browser($link, $search, 25); | |
348 | print "</ul>"; | |
349 | ||
350 | print "<div align='center'> | |
351 | <button onclick=\"feedBrowserSubscribe()\">".__('Subscribe')."</button> | |
d9084cf2 | 352 | <button style='display : none' id='feed_archive_remove' onclick=\"feedArchiveRemove()\">".__('Remove')."</button> |
ef88b1cc AD |
353 | <button onclick=\"closeInfoBox()\" >".__('Cancel')."</button></div>"; |
354 | ||
355 | print "</div>"; | |
356 | return; | |
357 | } | |
358 | ||
ef8be8ea AD |
359 | if ($id == "search") { |
360 | ||
cc17c205 | 361 | print "<div id=\"infoBoxTitle\">".__('Search')."</div>"; |
ef8be8ea AD |
362 | print "<div class=\"infoBoxContents\">"; |
363 | ||
e6312f6c | 364 | print "<form id='search_form' onsubmit='return false'>"; |
ef8be8ea | 365 | |
b4e75b2a | 366 | #$active_feed_id = db_escape_string($_REQUEST["param"]); |
ef8be8ea | 367 | |
2d1b7139 | 368 | $params = explode(":", db_escape_string($_REQUEST["param"]), 2); |
ef8be8ea AD |
369 | |
370 | $active_feed_id = sprintf("%d", $params[0]); | |
2d1b7139 | 371 | $is_cat = (bool) $params[1]; |
ef8be8ea | 372 | |
de85cac2 | 373 | print "<div class=\"dlgSec\">".__('Look for')."</div>"; |
5bac8c29 AD |
374 | |
375 | print "<div class=\"dlgSecCont\">"; | |
376 | ||
e4f7f8df | 377 | if (!SPHINX_ENABLE) { |
5bac8c29 | 378 | |
e4f7f8df AD |
379 | print "<input onkeypress=\"return filterCR(event, search)\" |
380 | name=\"query\" size=\"20\" type=\"search\" value=''>"; | |
5bac8c29 | 381 | |
e4f7f8df | 382 | print " " . __('match on')." "; |
5bac8c29 | 383 | |
e4f7f8df AD |
384 | $search_fields = array( |
385 | "title" => __("Title"), | |
386 | "content" => __("Content"), | |
387 | "both" => __("Title or content")); | |
388 | ||
389 | print_select_hash("match_on", 3, $search_fields); | |
390 | } else { | |
391 | print "<input onkeypress=\"return filterCR(event, search)\" | |
392 | name=\"query\" size=\"50\" type=\"search\" value=''>"; | |
393 | } | |
5bac8c29 AD |
394 | |
395 | ||
396 | print "<br/>".__('Limit search to:')." "; | |
ef8be8ea AD |
397 | |
398 | print "<select name=\"search_mode\"> | |
cc17c205 | 399 | <option value=\"all_feeds\">".__('All feeds')."</option>"; |
ef8be8ea AD |
400 | |
401 | $feed_title = getFeedTitle($link, $active_feed_id); | |
402 | ||
403 | if (!$is_cat) { | |
404 | $feed_cat_title = getFeedCatTitle($link, $active_feed_id); | |
405 | } else { | |
406 | $feed_cat_title = getCategoryTitle($link, $active_feed_id); | |
407 | } | |
408 | ||
409 | if ($active_feed_id && !$is_cat) { | |
cc17c205 | 410 | print "<option selected value=\"this_feed\">$feed_title</option>"; |
ef8be8ea | 411 | } else { |
cc17c205 | 412 | print "<option disabled>".__('This feed')."</option>"; |
ef8be8ea AD |
413 | } |
414 | ||
415 | if ($is_cat) { | |
416 | $cat_preselected = "selected"; | |
417 | } | |
418 | ||
419 | if (get_pref($link, 'ENABLE_FEED_CATS') && ($active_feed_id > 0 || $is_cat)) { | |
cc17c205 | 420 | print "<option $cat_preselected value=\"this_cat\">$feed_cat_title</option>"; |
ef8be8ea | 421 | } else { |
c4b0f96c | 422 | //print "<option disabled>".__('This category')."</option>"; |
ef8be8ea AD |
423 | } |
424 | ||
5bac8c29 | 425 | print "</select>"; |
ef8be8ea | 426 | |
5bac8c29 | 427 | print "</div>"; |
ef8be8ea AD |
428 | |
429 | print "</form>"; | |
430 | ||
5bac8c29 | 431 | print "<div class=\"dlgButtons\"> |
d60009cd | 432 | <button onclick=\"javascript:search()\">".__('Search')."</button> |
55132a45 | 433 | <button onclick=\"javascript:closeInfoBox(true)\">".__('Cancel')."</button> |
ad491d75 | 434 | </div>"; |
ef8be8ea AD |
435 | |
436 | print "</div>"; | |
437 | ||
5e6f933a AD |
438 | return; |
439 | ||
ef8be8ea AD |
440 | } |
441 | ||
ef8be8ea AD |
442 | if ($id == "quickAddFilter") { |
443 | ||
b4e75b2a | 444 | $active_feed_id = db_escape_string($_REQUEST["param"]); |
ef8be8ea | 445 | |
ecace165 | 446 | print "<div id=\"infoBoxTitle\">".__('Create Filter')."</div>"; |
ef8be8ea AD |
447 | print "<div class=\"infoBoxContents\">"; |
448 | ||
e6312f6c | 449 | print "<form id=\"filter_add_form\" onsubmit='return false'>"; |
ef8be8ea AD |
450 | |
451 | print "<input type=\"hidden\" name=\"op\" value=\"pref-filters\">"; | |
452 | print "<input type=\"hidden\" name=\"quiet\" value=\"1\">"; | |
453 | print "<input type=\"hidden\" name=\"subop\" value=\"add\">"; | |
ef8be8ea AD |
454 | |
455 | $result = db_query($link, "SELECT id,description | |
456 | FROM ttrss_filter_types ORDER BY description"); | |
457 | ||
458 | $filter_types = array(); | |
459 | ||
460 | while ($line = db_fetch_assoc($result)) { | |
461 | //array_push($filter_types, $line["description"]); | |
89cb787e | 462 | $filter_types[$line["id"]] = __($line["description"]); |
ef8be8ea AD |
463 | } |
464 | ||
10fa6615 AD |
465 | print "<div class=\"dlgSec\">".__("Match")."</div>"; |
466 | ||
467 | print "<div class=\"dlgSecCont\">"; | |
468 | ||
d0da85c2 | 469 | print "<span id=\"filter_dlg_date_mod_box\" style=\"display : none\">"; |
6e278744 | 470 | print __("Date") . " "; |
44d0e774 AD |
471 | |
472 | $filter_params = array( | |
473 | "before" => __("before"), | |
474 | "after" => __("after")); | |
475 | ||
476 | print_select_hash("filter_date_modifier", "before", $filter_params); | |
477 | ||
478 | print " </span>"; | |
d0da85c2 | 479 | |
8df90057 | 480 | print "<input onkeypress=\"return filterCR(event, createFilter)\" |
ad491d75 | 481 | name=\"reg_exp\" size=\"30\" value=\"$reg_exp\">"; |
10fa6615 | 482 | |
6e278744 | 483 | print "<span id=\"filter_dlg_date_chk_box\" style=\"display : none\">"; |
a918f5f9 AD |
484 | print " <button onclick=\"return filterDlgCheckDate()\">". |
485 | __('Check it')."</button>"; | |
d0da85c2 AD |
486 | print "</span>"; |
487 | ||
488 | print "<br/> " . __("on field") . " "; | |
489 | print_select_hash("filter_type", 1, $filter_types, | |
490 | 'onchange="filterDlgCheckType(this)"'); | |
10fa6615 AD |
491 | |
492 | print "<br/>"; | |
493 | ||
494 | print __("in") . " "; | |
495 | print_feed_select($link, "feed_id", $active_feed_id); | |
496 | ||
497 | print "</div>"; | |
498 | ||
ecace165 | 499 | print "<div class=\"dlgSec\">".__("Perform Action")."</div>"; |
10fa6615 AD |
500 | |
501 | print "<div class=\"dlgSecCont\">"; | |
502 | ||
503 | print "<select name=\"action_id\" | |
504 | onchange=\"filterDlgCheckAction(this)\">"; | |
505 | ||
506 | $result = db_query($link, "SELECT id,description FROM ttrss_filter_actions | |
507 | ORDER BY name"); | |
508 | ||
509 | while ($line = db_fetch_assoc($result)) { | |
510 | printf("<option value='%d'>%s</option>", $line["id"], __($line["description"])); | |
511 | } | |
512 | ||
513 | print "</select>"; | |
514 | ||
143a4973 AD |
515 | print "<span id=\"filter_dlg_param_box\" style=\"display : none\">"; |
516 | print " " . __("with parameters:") . " "; | |
517 | print "<input size=\"20\" | |
074bf20c | 518 | onkeypress=\"return filterCR(event, createFilter)\" |
143a4973 | 519 | name=\"action_param\">"; |
6427a306 AD |
520 | |
521 | print_label_select($link, "action_param_label", $action_param); | |
522 | ||
143a4973 | 523 | print "</span>"; |
10fa6615 | 524 | |
143a4973 | 525 | print " "; // tiny layout hack |
10fa6615 AD |
526 | |
527 | print "</div>"; | |
528 | ||
529 | print "<div class=\"dlgSec\">".__("Options")."</div>"; | |
530 | print "<div class=\"dlgSecCont\">"; | |
531 | ||
ecace165 AD |
532 | print "<div style=\"line-height : 100%\">"; |
533 | ||
10fa6615 AD |
534 | print "<input type=\"checkbox\" name=\"enabled\" id=\"enabled\" checked=\"1\"> |
535 | <label for=\"enabled\">".__('Enabled')."</label><br/>"; | |
536 | ||
537 | print "<input type=\"checkbox\" name=\"inverse\" id=\"inverse\"> | |
538 | <label for=\"inverse\">".__('Inverse match')."</label>"; | |
539 | ||
540 | print "</div>"; | |
ecace165 | 541 | print "</div>"; |
10fa6615 | 542 | |
ef8be8ea AD |
543 | print "</form>"; |
544 | ||
10fa6615 | 545 | print "<div class=\"dlgButtons\">"; |
ef8be8ea | 546 | |
ad491d75 AD |
547 | print "<button onclick=\"return createFilter()\">". |
548 | __('Create')."</button> "; | |
ef8be8ea | 549 | |
ad491d75 AD |
550 | print "<button onclick=\"return closeInfoBox()\">".__('Cancel'). |
551 | "</button>"; | |
ef8be8ea AD |
552 | |
553 | print "</div>"; | |
554 | ||
555 | // print "</td></tr></table>"; | |
556 | ||
5e6f933a | 557 | return; |
ef8be8ea AD |
558 | } |
559 | ||
a3656a41 AD |
560 | if ($id == "feedUpdateErrors") { |
561 | ||
cc17c205 | 562 | print "<div id=\"infoBoxTitle\">".__('Update Errors')."</div>"; |
a3656a41 AD |
563 | print "<div class=\"infoBoxContents\">"; |
564 | ||
cc17c205 | 565 | print __("These feeds have not been updated because of errors:"); |
a3656a41 AD |
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 | ||
e8dd519b | 570 | print "<ul class='feedErrorsList'>"; |
a3656a41 AD |
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>"; | |
a3656a41 AD |
578 | |
579 | print "<div align='center'>"; | |
580 | ||
a522a767 AD |
581 | print "<button onclick=\"return closeInfoBox()\">". |
582 | __('Close this window')."</button>"; | |
a3656a41 AD |
583 | |
584 | print "</div>"; | |
585 | ||
aa330b93 | 586 | return; |
a3656a41 AD |
587 | } |
588 | ||
0b126ac2 AD |
589 | if ($id == "editArticleTags") { |
590 | ||
cc17c205 | 591 | print "<div id=\"infoBoxTitle\">".__('Edit Tags')."</div>"; |
0b126ac2 AD |
592 | print "<div class=\"infoBoxContents\">"; |
593 | ||
e6312f6c | 594 | print "<form id=\"tag_edit_form\" onsubmit='return false'>"; |
0b126ac2 | 595 | |
cc17c205 | 596 | print __("Tags for this article (separated by commas):")."<br>"; |
0b126ac2 AD |
597 | |
598 | $tags = get_article_tags($link, $param); | |
599 | ||
600 | $tags_str = join(", ", $tags); | |
601 | ||
d62a3b63 AD |
602 | print "<table width='100%'>"; |
603 | ||
604 | print "<tr><td colspan='2'><input type=\"hidden\" name=\"id\" value=\"$param\"></td></tr>"; | |
605 | ||
05fcdf52 AD |
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>"; | |
d62a3b63 | 611 | |
d62a3b63 | 612 | print "</table>"; |
0b126ac2 AD |
613 | |
614 | print "</form>"; | |
615 | ||
616 | print "<div align='right'>"; | |
617 | ||
2ae69126 AD |
618 | print "<button onclick=\"return editTagsSave()\">".__('Save')."</button> "; |
619 | print "<button onclick=\"return closeInfoBox()\">".__('Cancel')."</button>"; | |
0b126ac2 AD |
620 | |
621 | print "</div>"; | |
622 | ||
5e6f933a | 623 | return; |
0b126ac2 AD |
624 | } |
625 | ||
0979b696 | 626 | if ($id == "printTagCloud") { |
d60009cd | 627 | print "<div id=\"infoBoxTitle\">".__('Tag Cloud')."</div>"; |
0979b696 AD |
628 | print "<div class=\"infoBoxContents\">"; |
629 | ||
dcac082b | 630 | print __("Showing most popular tags ")." (<a |
326469fc | 631 | href='javascript:toggleTags(true)'>".__('more tags')."</a>):<br/>"; |
0979b696 AD |
632 | |
633 | print "<div class=\"tagCloudContainer\">"; | |
634 | ||
635 | printTagCloud($link); | |
636 | ||
637 | print "</div>"; | |
638 | ||
639 | print "<div align='center'>"; | |
d60009cd AD |
640 | print "<button onclick=\"return closeInfoBox()\">". |
641 | __('Close this window')."</button>"; | |
0979b696 AD |
642 | print "</div>"; |
643 | ||
644 | print "</div>"; | |
645 | ||
646 | return; | |
647 | } | |
648 | ||
31a53903 AD |
649 | if ($id == "emailArticle") { |
650 | ||
651 | print "<div id=\"infoBoxTitle\">".__('Forward article by email')."</div>"; | |
87b16a0a AD |
652 | print "<div class=\"infoBoxContents\">"; |
653 | ||
31a53903 | 654 | print "<form id=\"article_email_form\" onsubmit='return false'>"; |
87b16a0a | 655 | |
736e8977 | 656 | $secretkey = sha1(uniqid(rand(), true)); |
87b16a0a | 657 | |
31a53903 | 658 | $_SESSION['email_secretkey'] = $secretkey; |
87b16a0a | 659 | |
31a53903 AD |
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\">"; | |
87b16a0a | 663 | |
73fe13af | 664 | $result = db_query($link, "SELECT email, full_name FROM ttrss_users WHERE |
f72a7b66 AD |
665 | id = " . $_SESSION["uid"]); |
666 | ||
667 | $user_email = htmlspecialchars(db_fetch_result($result, 0, "email")); | |
73fe13af AD |
668 | $user_name = htmlspecialchars(db_fetch_result($result, 0, "full_name")); |
669 | ||
670 | if (!$user_name) $user_name = $_SESSION['name']; | |
f72a7b66 AD |
671 | |
672 | $_SESSION['email_replyto'] = $user_email; | |
673 | $_SESSION['email_fromname'] = $user_name; | |
674 | ||
31a53903 | 675 | require_once "lib/MiniTemplator.class.php"; |
87b16a0a | 676 | |
31a53903 AD |
677 | $tpl = new MiniTemplator; |
678 | $tpl_t = new MiniTemplator; | |
87b16a0a | 679 | |
31a53903 | 680 | $tpl->readTemplateFromFile("templates/email_article_template.txt"); |
6a1cd591 | 681 | |
f72a7b66 AD |
682 | $tpl->setVariable('USER_NAME', $_SESSION["name"]); |
683 | $tpl->setVariable('USER_EMAIL', $user_email); | |
684 | $tpl->setVariable('TTRSS_HOST', $_SERVER["HTTP_HOST"]); | |
31a53903 | 685 | |
f72a7b66 | 686 | // $tpl->addBlock('header'); |
31a53903 | 687 | |
f72a7b66 AD |
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"]); | |
31a53903 | 691 | |
f72a7b66 AD |
692 | if (db_num_rows($result) > 1) { |
693 | $subject = __("[Forwarded]") . " " . __("Multiple articles"); | |
694 | } | |
31a53903 | 695 | |
f72a7b66 | 696 | while ($line = db_fetch_assoc($result)) { |
31a53903 | 697 | |
f72a7b66 AD |
698 | if (!$subject) |
699 | $subject = __("[Forwarded]") . " " . htmlspecialchars($line["title"]); | |
31a53903 | 700 | |
f72a7b66 AD |
701 | $tpl->setVariable('ARTICLE_TITLE', strip_tags($line["title"])); |
702 | $tpl->setVariable('ARTICLE_URL', strip_tags($line["link"])); | |
31a53903 | 703 | |
f72a7b66 AD |
704 | $tpl->addBlock('article'); |
705 | } | |
31a53903 AD |
706 | |
707 | $tpl->addBlock('email'); | |
f72a7b66 | 708 | |
31a53903 AD |
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>"; | |
87b16a0a AD |
749 | |
750 | print "</form>"; | |
751 | ||
31a53903 AD |
752 | print "<div class='dlgButtons'>"; |
753 | ||
754 | print "<button onclick=\"return emailArticleDo()\">".__('Send e-mail')."</button> "; | |
755 | print "<button onclick=\"return closeInfoBox()\">".__('Cancel')."</button>"; | |
87b16a0a AD |
756 | |
757 | print "</div>"; | |
758 | ||
759 | return; | |
31a53903 | 760 | } |
87b16a0a | 761 | |
8801fb01 AD |
762 | if ($id == "generatedFeed") { |
763 | ||
764 | print "<div id=\"infoBoxTitle\">".__('View as RSS')."</div>"; | |
765 | print "<div class=\"infoBoxContents\">"; | |
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 | ||
a918f5f9 AD |
786 | print "<button onclick=\"return closeInfoBox()\">". |
787 | __('Close this window')."</button>"; | |
8801fb01 AD |
788 | |
789 | print "</div></div>"; | |
790 | ||
791 | return; | |
792 | } | |
793 | ||
5e6f933a AD |
794 | print "<div id='infoBoxTitle'>Internal Error</div> |
795 | <div id='infoBoxContents'> | |
796 | <p>Unknown dialog <b>$id</b></p> | |
797 | </div></div>"; | |
798 | ||
ef8be8ea AD |
799 | } |
800 | ?> |