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