]>
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 | ||
8e00ae9b | 220 | if ($param == 3) { |
73495fd1 | 221 | 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 | 222 | |
1ea20897 | 223 | $stamp = (int) file_get_contents(LOCK_DIRECTORY . "/update_daemon.stamp"); |
f6854e44 AD |
224 | |
225 | print "<p>" . __("Last update:") . " " . date("Y.m.d, G:i", $stamp); | |
226 | ||
8e00ae9b AD |
227 | } |
228 | ||
ef16ae37 | 229 | print "</div>"; |
73495fd1 | 230 | |
ef16ae37 AD |
231 | print "<div align='center'>"; |
232 | ||
63855db1 | 233 | print "<button onclick=\"return closeInfoBox()\">". |
a918f5f9 | 234 | __('Close this window')."</button>"; |
ef16ae37 | 235 | |
951906dc AD |
236 | print "</div>"; |
237 | print "]]></content>"; | |
ef16ae37 | 238 | |
951906dc | 239 | //return; |
ef16ae37 AD |
240 | } |
241 | ||
ef8be8ea AD |
242 | if ($id == "quickAddFeed") { |
243 | ||
11b9d0be AD |
244 | print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"rpc\">"; |
245 | print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"subop\" value=\"addfeed\">"; | |
ef8be8ea | 246 | |
ecace165 AD |
247 | print "<div class=\"dlgSec\">".__("Feed")."</div>"; |
248 | print "<div class=\"dlgSecCont\">"; | |
249 | ||
11b9d0be AD |
250 | print "<input style=\"font-size : 16px; width : 20em;\" |
251 | placeHolder=\"".__("Feed URL")."\" | |
252 | dojoType=\"dijit.form.ValidationTextBox\" required=\"1\" name=\"feed\" id=\"feedDlg_feedUrl\">"; | |
ecace165 | 253 | |
bcf5ed46 | 254 | print "<hr/>"; |
ecace165 | 255 | |
ef8be8ea | 256 | if (get_pref($link, 'ENABLE_FEED_CATS')) { |
ecace165 | 257 | print __('Place in category:') . " "; |
11b9d0be | 258 | print_feed_cat_select($link, "cat", false, 'dojoType="dijit.form.Select"'); |
ef8be8ea AD |
259 | } |
260 | ||
ecace165 AD |
261 | print "</div>"; |
262 | ||
11b9d0be | 263 | print '<div id="feedDlg_feedsContainer" style="display : none"> |
5eeb3874 CW |
264 | |
265 | <div class="dlgSec">' . __('Available feeds') . '</div> | |
11b9d0be AD |
266 | <div class="dlgSecCont">'. |
267 | '<select id="feedDlg_feedContainerSelect" | |
268 | dojoType="dijit.form.Select" size="3"> | |
269 | <script type="dojo/method" event="onChange" args="value"> | |
270 | dijit.byId("feedDlg_feedUrl").attr("value", value); | |
271 | </script> | |
272 | </select>'. | |
273 | '</div></div>'; | |
274 | ||
275 | print "<div id='feedDlg_loginContainer' style='display : none'> | |
ecace165 AD |
276 | |
277 | <div class=\"dlgSec\">".__("Authentication")."</div> | |
278 | <div class=\"dlgSecCont\">". | |
279 | ||
11b9d0be AD |
280 | " <input dojoType=\"dijit.form.TextBox\" name='login'\" |
281 | placeHolder=\"".__("Login")."\" | |
282 | style=\"width : 10em;\"> ". | |
283 | " <input | |
284 | placeHolder=\"".__("Password")."\" | |
285 | dojoType=\"dijit.form.TextBox\" type='password' | |
286 | style=\"width : 10em;\" name='pass'\"> | |
ecace165 AD |
287 | </div></div>"; |
288 | ||
289 | ||
11b9d0be AD |
290 | print "<div style=\"clear : both\"> |
291 | <input type=\"checkbox\" dojoType=\"dijit.form.CheckBox\" id=\"feedDlg_loginCheck\" | |
292 | onclick='checkboxToggleElement(this, \"feedDlg_loginContainer\")'> | |
293 | <label for=\"feedDlg_loginCheck\">". | |
ecace165 | 294 | __('This feed requires authentication.')."</div>"; |
f27de515 | 295 | |
ef8be8ea AD |
296 | print "</form>"; |
297 | ||
ecace165 | 298 | print "<div class=\"dlgButtons\"> |
11b9d0be AD |
299 | <button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('feedAddDlg').execute()\">".__('Subscribe')."</button> |
300 | <button dojoType=\"dijit.form.Button\" onclick=\"return feedBrowser()\">".__('More feeds')."</button> | |
301 | <button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('feedAddDlg').hide()\">".__('Cancel')."</button> | |
302 | </div>"; | |
951906dc AD |
303 | |
304 | //return; | |
ef8be8ea AD |
305 | } |
306 | ||
ef88b1cc AD |
307 | if ($id == "feedBrowser") { |
308 | ||
ef88b1cc AD |
309 | $browser_search = db_escape_string($_REQUEST["search"]); |
310 | ||
11b9d0be AD |
311 | # print "<form onsubmit='return false;' display='inline' |
312 | # name='feed_browser' id='feed_browser'>"; | |
ef88b1cc | 313 | |
11b9d0be AD |
314 | print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"rpc\">"; |
315 | print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"subop\" value=\"updateFeedBrowser\">"; | |
ef88b1cc | 316 | |
a8328019 | 317 | print "<div dojoType=\"dijit.Toolbar\"> |
ef88b1cc AD |
318 | <div style='float : right'> |
319 | <img style='display : none' | |
883fee8d AD |
320 | id='feed_browser_spinner' src='". |
321 | theme_image($link, 'images/indicator_white.gif')."'> | |
11b9d0be AD |
322 | <input name=\"search\" dojoType=\"dijit.form.TextBox\" size=\"20\" type=\"search\" |
323 | onchange=\"dijit.byId('feedBrowserDlg').update()\" value=\"$browser_search\"> | |
324 | <button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('feedBrowserDlg').update()\">".__('Search')."</button> | |
ef88b1cc AD |
325 | </div>"; |
326 | ||
11b9d0be | 327 | print " <select name=\"mode\" dojoType=\"dijit.form.Select\" onchange=\"dijit.byId('feedBrowserDlg').update()\"> |
ef88b1cc AD |
328 | <option value='1'>" . __('Popular feeds') . "</option> |
329 | <option value='2'>" . __('Feed archive') . "</option> | |
330 | </select> "; | |
331 | ||
332 | print __("limit:"); | |
333 | ||
11b9d0be | 334 | print " <select dojoType=\"dijit.form.Select\" name=\"limit\" onchange=\"dijit.byId('feedBrowserDlg').update()\">"; |
ef88b1cc AD |
335 | |
336 | foreach (array(25, 50, 100, 200) as $l) { | |
11b9d0be AD |
337 | $issel = ($l == $limit) ? "selected=\"1\"" : ""; |
338 | print "<option $issel value=\"$l\">$l</option>"; | |
ef88b1cc AD |
339 | } |
340 | ||
341 | print "</select> "; | |
342 | ||
a8328019 | 343 | print "</div>"; |
ef88b1cc AD |
344 | |
345 | $owner_uid = $_SESSION["uid"]; | |
346 | ||
347 | print "<ul class='browseFeedList' id='browseFeedList'>"; | |
348 | print_feed_browser($link, $search, 25); | |
349 | print "</ul>"; | |
350 | ||
351 | print "<div align='center'> | |
11b9d0be AD |
352 | <button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('feedBrowserDlg').execute()\">".__('Subscribe')."</button> |
353 | <button dojoType=\"dijit.form.Button\" style='display : none' id='feed_archive_remove' onclick=\"dijit.byId('feedBrowserDlg').removeFromArchive()\">".__('Remove')."</button> | |
354 | <button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('feedBrowserDlg').hide()\" >".__('Cancel')."</button></div>"; | |
ef88b1cc | 355 | |
ef88b1cc AD |
356 | } |
357 | ||
ef8be8ea AD |
358 | if ($id == "search") { |
359 | ||
2d1b7139 | 360 | $params = explode(":", db_escape_string($_REQUEST["param"]), 2); |
ef8be8ea AD |
361 | |
362 | $active_feed_id = sprintf("%d", $params[0]); | |
2d1b7139 | 363 | $is_cat = (bool) $params[1]; |
ef8be8ea | 364 | |
de85cac2 | 365 | print "<div class=\"dlgSec\">".__('Look for')."</div>"; |
5bac8c29 AD |
366 | |
367 | print "<div class=\"dlgSecCont\">"; | |
368 | ||
e4f7f8df | 369 | if (!SPHINX_ENABLE) { |
5bac8c29 | 370 | |
a3042404 AD |
371 | print "<input dojoType=\"dijit.form.ValidationTextBox\" |
372 | style=\"font-size : 16px; width : 12em;\" | |
373 | required=\"1\" name=\"query\" type=\"search\" value=''>"; | |
5bac8c29 | 374 | |
e4f7f8df | 375 | print " " . __('match on')." "; |
5bac8c29 | 376 | |
e4f7f8df AD |
377 | $search_fields = array( |
378 | "title" => __("Title"), | |
379 | "content" => __("Content"), | |
380 | "both" => __("Title or content")); | |
381 | ||
a3042404 AD |
382 | print_select_hash("match_on", 3, $search_fields, |
383 | 'dojoType="dijit.form.Select"'); | |
e4f7f8df | 384 | } else { |
973fe3c6 AD |
385 | print "<input dojoType=\"dijit.form.ValidationTextBox\" |
386 | style=\"font-size : 16px; width : 20em;\" | |
387 | required=\"1\" name=\"query\" type=\"search\" value=''>"; | |
e4f7f8df | 388 | } |
5bac8c29 AD |
389 | |
390 | ||
bcf5ed46 | 391 | print "<hr/>".__('Limit search to:')." "; |
ef8be8ea | 392 | |
973fe3c6 | 393 | print "<select name=\"search_mode\" dojoType=\"dijit.form.Select\"> |
cc17c205 | 394 | <option value=\"all_feeds\">".__('All feeds')."</option>"; |
ef8be8ea AD |
395 | |
396 | $feed_title = getFeedTitle($link, $active_feed_id); | |
397 | ||
398 | if (!$is_cat) { | |
399 | $feed_cat_title = getFeedCatTitle($link, $active_feed_id); | |
400 | } else { | |
401 | $feed_cat_title = getCategoryTitle($link, $active_feed_id); | |
402 | } | |
403 | ||
404 | if ($active_feed_id && !$is_cat) { | |
973fe3c6 | 405 | print "<option selected=\"1\" value=\"this_feed\">$feed_title</option>"; |
ef8be8ea | 406 | } else { |
973fe3c6 | 407 | print "<option disabled=\"1\" value=\"false\">".__('This feed')."</option>"; |
ef8be8ea AD |
408 | } |
409 | ||
410 | if ($is_cat) { | |
973fe3c6 | 411 | $cat_preselected = "selected=\"1\""; |
ef8be8ea AD |
412 | } |
413 | ||
414 | if (get_pref($link, 'ENABLE_FEED_CATS') && ($active_feed_id > 0 || $is_cat)) { | |
cc17c205 | 415 | print "<option $cat_preselected value=\"this_cat\">$feed_cat_title</option>"; |
ef8be8ea | 416 | } else { |
c4b0f96c | 417 | //print "<option disabled>".__('This category')."</option>"; |
ef8be8ea AD |
418 | } |
419 | ||
5bac8c29 | 420 | print "</select>"; |
ef8be8ea | 421 | |
5bac8c29 | 422 | print "</div>"; |
ef8be8ea | 423 | |
5bac8c29 | 424 | print "<div class=\"dlgButtons\"> |
973fe3c6 AD |
425 | <button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('searchDlg').execute()\">".__('Search')."</button> |
426 | <button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('searchDlg').hide()\">".__('Cancel')."</button> | |
ad491d75 | 427 | </div>"; |
ef8be8ea AD |
428 | } |
429 | ||
ef8be8ea AD |
430 | if ($id == "quickAddFilter") { |
431 | ||
b4e75b2a | 432 | $active_feed_id = db_escape_string($_REQUEST["param"]); |
ef8be8ea | 433 | |
d90868d7 AD |
434 | print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pref-filters\">"; |
435 | print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"quiet\" value=\"1\">"; | |
436 | print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"subop\" value=\"add\">"; | |
ef8be8ea AD |
437 | |
438 | $result = db_query($link, "SELECT id,description | |
439 | FROM ttrss_filter_types ORDER BY description"); | |
440 | ||
441 | $filter_types = array(); | |
442 | ||
443 | while ($line = db_fetch_assoc($result)) { | |
444 | //array_push($filter_types, $line["description"]); | |
89cb787e | 445 | $filter_types[$line["id"]] = __($line["description"]); |
ef8be8ea AD |
446 | } |
447 | ||
10fa6615 AD |
448 | print "<div class=\"dlgSec\">".__("Match")."</div>"; |
449 | ||
450 | print "<div class=\"dlgSecCont\">"; | |
451 | ||
d90868d7 | 452 | print "<span id=\"filterDlg_dateModBox\" style=\"display : none\">"; |
44d0e774 AD |
453 | |
454 | $filter_params = array( | |
455 | "before" => __("before"), | |
456 | "after" => __("after")); | |
457 | ||
d90868d7 AD |
458 | print_select_hash("filter_date_modifier", "before", |
459 | $filter_params, 'dojoType="dijit.form.Select"'); | |
44d0e774 AD |
460 | |
461 | print " </span>"; | |
d0da85c2 | 462 | |
d90868d7 AD |
463 | print "<input dojoType=\"dijit.form.ValidationTextBox\" |
464 | required=\"true\" id=\"filterDlg_regExp\" | |
465 | style=\"font-size : 16px\" | |
466 | name=\"reg_exp\" value=\"$reg_exp\"/>"; | |
10fa6615 | 467 | |
d90868d7 | 468 | print "<span id=\"filterDlg_dateChkBox\" style=\"display : none\">"; |
a918f5f9 AD |
469 | print " <button onclick=\"return filterDlgCheckDate()\">". |
470 | __('Check it')."</button>"; | |
d0da85c2 AD |
471 | print "</span>"; |
472 | ||
bcf5ed46 | 473 | print "<hr/>" . __("on field") . " "; |
d0da85c2 | 474 | print_select_hash("filter_type", 1, $filter_types, |
d90868d7 | 475 | 'onchange="filterDlgCheckType(this)" dojoType="dijit.form.Select"'); |
10fa6615 | 476 | |
bcf5ed46 | 477 | print "<hr/>"; |
10fa6615 AD |
478 | |
479 | print __("in") . " "; | |
d90868d7 AD |
480 | print_feed_select($link, "feed_id", $active_feed_id, |
481 | 'dojoType="dijit.form.FilteringSelect"'); | |
10fa6615 AD |
482 | |
483 | print "</div>"; | |
484 | ||
ecace165 | 485 | print "<div class=\"dlgSec\">".__("Perform Action")."</div>"; |
10fa6615 AD |
486 | |
487 | print "<div class=\"dlgSecCont\">"; | |
488 | ||
d90868d7 | 489 | print "<select name=\"action_id\" dojoType=\"dijit.form.Select\" |
10fa6615 AD |
490 | onchange=\"filterDlgCheckAction(this)\">"; |
491 | ||
492 | $result = db_query($link, "SELECT id,description FROM ttrss_filter_actions | |
493 | ORDER BY name"); | |
494 | ||
495 | while ($line = db_fetch_assoc($result)) { | |
496 | printf("<option value='%d'>%s</option>", $line["id"], __($line["description"])); | |
497 | } | |
498 | ||
499 | print "</select>"; | |
500 | ||
d90868d7 | 501 | print "<span id=\"filterDlg_paramBox\" style=\"display : none\">"; |
143a4973 | 502 | print " " . __("with parameters:") . " "; |
d90868d7 AD |
503 | print "<input dojoType=\"dijit.form.TextBox\" |
504 | id=\"filterDlg_actionParam\" | |
505 | name=\"action_param\">"; | |
6427a306 | 506 | |
d90868d7 AD |
507 | print_label_select($link, "action_param_label", $action_param, |
508 | 'id="filterDlg_actionParamLabel" dojoType="dijit.form.Select"'); | |
6427a306 | 509 | |
143a4973 | 510 | print "</span>"; |
10fa6615 | 511 | |
143a4973 | 512 | print " "; // tiny layout hack |
10fa6615 AD |
513 | |
514 | print "</div>"; | |
515 | ||
516 | print "<div class=\"dlgSec\">".__("Options")."</div>"; | |
517 | print "<div class=\"dlgSecCont\">"; | |
518 | ||
d90868d7 | 519 | print "<input dojoType=\"dijit.form.CheckBox\" type=\"checkbox\" name=\"enabled\" id=\"enabled\" checked=\"1\"> |
bcf5ed46 | 520 | <label for=\"enabled\">".__('Enabled')."</label><hr/>"; |
10fa6615 | 521 | |
d90868d7 | 522 | print "<input dojoType=\"dijit.form.CheckBox\" type=\"checkbox\" name=\"inverse\" id=\"inverse\"> |
10fa6615 AD |
523 | <label for=\"inverse\">".__('Inverse match')."</label>"; |
524 | ||
525 | print "</div>"; | |
ef8be8ea | 526 | |
10fa6615 | 527 | print "<div class=\"dlgButtons\">"; |
ef8be8ea | 528 | |
c33f56f3 | 529 | print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('filterEditDlg').execute()\">". |
ad491d75 | 530 | __('Create')."</button> "; |
ef8be8ea | 531 | |
c33f56f3 | 532 | print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('filterEditDlg').hide()\">". |
d90868d7 | 533 | __('Cancel')."</button>"; |
ef8be8ea | 534 | |
d90868d7 | 535 | print "</div>"; |
ef8be8ea | 536 | |
951906dc | 537 | //return; |
ef8be8ea AD |
538 | } |
539 | ||
a3656a41 AD |
540 | if ($id == "feedUpdateErrors") { |
541 | ||
f81b6815 | 542 | print "<title>".__('Feeds with update errors')."</title>"; |
951906dc | 543 | print "<content><![CDATA["; |
a3656a41 | 544 | |
cc17c205 | 545 | print __("These feeds have not been updated because of errors:"); |
a3656a41 AD |
546 | |
547 | $result = db_query($link, "SELECT id,title,feed_url,last_error | |
548 | FROM ttrss_feeds WHERE last_error != '' AND owner_uid = ".$_SESSION["uid"]); | |
549 | ||
e8dd519b | 550 | print "<ul class='feedErrorsList'>"; |
a3656a41 AD |
551 | |
552 | while ($line = db_fetch_assoc($result)) { | |
553 | print "<li><b>" . $line["title"] . "</b> (" . $line["feed_url"] . "): " . | |
554 | "<em>" . $line["last_error"] . "</em>"; | |
555 | } | |
556 | ||
557 | print "</ul>"; | |
a3656a41 AD |
558 | |
559 | print "<div align='center'>"; | |
560 | ||
f81b6815 AD |
561 | print "<button dojoType=\"dijit.form.Button\" |
562 | onclick=\"return closeInfoBox()\">". | |
a522a767 | 563 | __('Close this window')."</button>"; |
a3656a41 | 564 | |
951906dc | 565 | print "]]></content>"; |
a3656a41 | 566 | |
951906dc | 567 | //return; |
a3656a41 AD |
568 | } |
569 | ||
0b126ac2 AD |
570 | if ($id == "editArticleTags") { |
571 | ||
951906dc AD |
572 | print "<title>".__('Edit Tags')."</title>"; |
573 | print "<content><![CDATA["; | |
0b126ac2 | 574 | |
e6312f6c | 575 | print "<form id=\"tag_edit_form\" onsubmit='return false'>"; |
0b126ac2 | 576 | |
cc17c205 | 577 | print __("Tags for this article (separated by commas):")."<br>"; |
0b126ac2 AD |
578 | |
579 | $tags = get_article_tags($link, $param); | |
580 | ||
581 | $tags_str = join(", ", $tags); | |
582 | ||
d62a3b63 AD |
583 | print "<table width='100%'>"; |
584 | ||
585 | print "<tr><td colspan='2'><input type=\"hidden\" name=\"id\" value=\"$param\"></td></tr>"; | |
586 | ||
05fcdf52 AD |
587 | print "<tr><td colspan='2'><textarea rows='4' class='iedit' id='tags_str' |
588 | name='tags_str'>$tags_str</textarea> | |
589 | <div class=\"autocomplete\" id=\"tags_choices\" | |
590 | style=\"display:none\"></div> | |
591 | </td></tr>"; | |
d62a3b63 | 592 | |
d62a3b63 | 593 | print "</table>"; |
0b126ac2 AD |
594 | |
595 | print "</form>"; | |
596 | ||
597 | print "<div align='right'>"; | |
598 | ||
2ae69126 AD |
599 | print "<button onclick=\"return editTagsSave()\">".__('Save')."</button> "; |
600 | print "<button onclick=\"return closeInfoBox()\">".__('Cancel')."</button>"; | |
0b126ac2 | 601 | |
951906dc | 602 | print "]]></content>"; |
0b126ac2 | 603 | |
951906dc | 604 | //return; |
0b126ac2 AD |
605 | } |
606 | ||
0979b696 | 607 | if ($id == "printTagCloud") { |
951906dc AD |
608 | print "<title>".__('Tag Cloud')."</title>"; |
609 | print "<content><![CDATA["; | |
0979b696 | 610 | |
9c99281f AD |
611 | # print __("Showing most popular tags ")." (<a |
612 | # href='javascript:toggleTags(true)'>".__('more tags')."</a>):<br/>"; | |
0979b696 AD |
613 | |
614 | print "<div class=\"tagCloudContainer\">"; | |
615 | ||
616 | printTagCloud($link); | |
617 | ||
618 | print "</div>"; | |
619 | ||
620 | print "<div align='center'>"; | |
bec2ecd9 AD |
621 | print "<button dojoType=\"dijit.form.Button\" |
622 | onclick=\"return closeInfoBox()\">". | |
d60009cd | 623 | __('Close this window')."</button>"; |
0979b696 AD |
624 | print "</div>"; |
625 | ||
951906dc | 626 | print "]]></content>"; |
0979b696 | 627 | |
951906dc | 628 | //return; |
0979b696 AD |
629 | } |
630 | ||
31a53903 AD |
631 | if ($id == "emailArticle") { |
632 | ||
736e8977 | 633 | $secretkey = sha1(uniqid(rand(), true)); |
87b16a0a | 634 | |
31a53903 | 635 | $_SESSION['email_secretkey'] = $secretkey; |
87b16a0a | 636 | |
18606807 AD |
637 | print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"secretkey\" value=\"$secretkey\">"; |
638 | print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"rpc\">"; | |
639 | print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"subop\" value=\"sendEmail\">"; | |
87b16a0a | 640 | |
73fe13af | 641 | $result = db_query($link, "SELECT email, full_name FROM ttrss_users WHERE |
f72a7b66 AD |
642 | id = " . $_SESSION["uid"]); |
643 | ||
644 | $user_email = htmlspecialchars(db_fetch_result($result, 0, "email")); | |
73fe13af AD |
645 | $user_name = htmlspecialchars(db_fetch_result($result, 0, "full_name")); |
646 | ||
647 | if (!$user_name) $user_name = $_SESSION['name']; | |
f72a7b66 AD |
648 | |
649 | $_SESSION['email_replyto'] = $user_email; | |
650 | $_SESSION['email_fromname'] = $user_name; | |
651 | ||
31a53903 | 652 | require_once "lib/MiniTemplator.class.php"; |
87b16a0a | 653 | |
31a53903 AD |
654 | $tpl = new MiniTemplator; |
655 | $tpl_t = new MiniTemplator; | |
87b16a0a | 656 | |
31a53903 | 657 | $tpl->readTemplateFromFile("templates/email_article_template.txt"); |
6a1cd591 | 658 | |
f72a7b66 AD |
659 | $tpl->setVariable('USER_NAME', $_SESSION["name"]); |
660 | $tpl->setVariable('USER_EMAIL', $user_email); | |
661 | $tpl->setVariable('TTRSS_HOST', $_SERVER["HTTP_HOST"]); | |
31a53903 | 662 | |
f72a7b66 | 663 | // $tpl->addBlock('header'); |
31a53903 | 664 | |
f72a7b66 AD |
665 | $result = db_query($link, "SELECT link, content, title |
666 | FROM ttrss_user_entries, ttrss_entries WHERE id = ref_id AND | |
667 | id IN ($param) AND owner_uid = " . $_SESSION["uid"]); | |
31a53903 | 668 | |
f72a7b66 AD |
669 | if (db_num_rows($result) > 1) { |
670 | $subject = __("[Forwarded]") . " " . __("Multiple articles"); | |
671 | } | |
31a53903 | 672 | |
f72a7b66 | 673 | while ($line = db_fetch_assoc($result)) { |
31a53903 | 674 | |
f72a7b66 AD |
675 | if (!$subject) |
676 | $subject = __("[Forwarded]") . " " . htmlspecialchars($line["title"]); | |
31a53903 | 677 | |
f72a7b66 AD |
678 | $tpl->setVariable('ARTICLE_TITLE', strip_tags($line["title"])); |
679 | $tpl->setVariable('ARTICLE_URL', strip_tags($line["link"])); | |
31a53903 | 680 | |
f72a7b66 AD |
681 | $tpl->addBlock('article'); |
682 | } | |
31a53903 AD |
683 | |
684 | $tpl->addBlock('email'); | |
f72a7b66 | 685 | |
31a53903 AD |
686 | $content = ""; |
687 | $tpl->generateOutputToString($content); | |
688 | ||
689 | print "<table width='100%'><tr><td>"; | |
690 | ||
691 | print __('From:'); | |
692 | ||
693 | print "</td><td>"; | |
694 | ||
18606807 | 695 | print "<input dojoType=\"dijit.form.TextBox\" disabled=\"1\" style=\"width : 30em;\" |
31a53903 AD |
696 | value=\"$user_name <$user_email>\">"; |
697 | ||
698 | print "</td></tr><tr><td>"; | |
699 | ||
700 | print __('To:'); | |
701 | ||
702 | print "</td><td>"; | |
703 | ||
18606807 AD |
704 | print "<input dojoType=\"dijit.form.ValidationTextBox\" required=\"true\" |
705 | style=\"width : 30em;\" | |
706 | name=\"destination\" id=\"emailArticleDlg_destination\">"; | |
31a53903 | 707 | |
18606807 AD |
708 | print "<div class=\"autocomplete\" id=\"emailArticleDlg_dst_choices\" |
709 | style=\"z-index: 30; display : none\"></div>"; | |
31a53903 AD |
710 | |
711 | print "</td></tr><tr><td>"; | |
712 | ||
713 | print __('Subject:'); | |
714 | ||
715 | print "</td><td>"; | |
716 | ||
18606807 AD |
717 | print "<input dojoType=\"dijit.form.ValidationTextBox\" required=\"true\" |
718 | style=\"width : 30em;\" | |
31a53903 AD |
719 | name=\"subject\" value=\"$subject\" id=\"subject\">"; |
720 | ||
18606807 | 721 | print "</td></tr>"; |
31a53903 | 722 | |
18606807 | 723 | print "<tr><td colspan='2'><textarea dojoType=\"dijit.form.SimpleTextarea\" style='font-size : 12px; width : 100%' rows=\"20\" |
31a53903 | 724 | name='content'>$content</textarea>"; |
87b16a0a | 725 | |
18606807 | 726 | print "</td></tr></table>"; |
87b16a0a | 727 | |
31a53903 | 728 | print "<div class='dlgButtons'>"; |
18606807 AD |
729 | print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('emailArticleDlg').execute()\">".__('Send e-mail')."</button> "; |
730 | print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('emailArticleDlg').hide()\">".__('Cancel')."</button>"; | |
731 | print "</div>"; | |
87b16a0a | 732 | |
951906dc | 733 | //return; |
31a53903 | 734 | } |
87b16a0a | 735 | |
8801fb01 AD |
736 | if ($id == "generatedFeed") { |
737 | ||
951906dc AD |
738 | print "<title>".__('View as RSS')."</title>"; |
739 | print "<content><![CDATA["; | |
8801fb01 AD |
740 | |
741 | $params = explode(":", $param, 3); | |
742 | $feed_id = db_escape_string($params[0]); | |
743 | $is_cat = (bool) $params[1]; | |
744 | ||
745 | $key = get_feed_access_key($link, $feed_id, $is_cat); | |
746 | ||
747 | $url_path = htmlspecialchars($params[2]) . "&key=" . $key; | |
748 | ||
749 | print __("You can view this feed as RSS using the following URL:"); | |
750 | ||
751 | print "<div class=\"tagCloudContainer\">"; | |
752 | print "<a id='gen_feed_url' href='$url_path' target='_blank'>$url_path</a>"; | |
753 | print "</div>"; | |
754 | ||
755 | print "<div align='center'>"; | |
756 | ||
18606807 | 757 | print "<button dojoType=\"dijit.form.Button\" onclick=\"return genUrlChangeKey('$feed_id', '$is_cat')\">". |
8801fb01 AD |
758 | __('Generate new URL')."</button> "; |
759 | ||
18606807 | 760 | print "<button dojoType=\"dijit.form.Button\" onclick=\"return closeInfoBox()\">". |
a918f5f9 | 761 | __('Close this window')."</button>"; |
8801fb01 | 762 | |
951906dc AD |
763 | print "</div>"; |
764 | print "]]></content>"; | |
8801fb01 | 765 | |
951906dc | 766 | //return; |
8801fb01 AD |
767 | } |
768 | ||
63855db1 AD |
769 | if ($id == "newVersion") { |
770 | $version = check_for_update($link); | |
771 | ||
772 | $version_link = "<a class=\"visibleLink\" target=\"_blank\" | |
773 | href=\"http://tt-rss.org\">http://tt-rss.org</a>"; | |
774 | ||
775 | print "<div class='tagCloudContainer'>"; | |
776 | ||
777 | print T_sprintf("New version of Tiny Tiny RSS is available (%s).<br/>Visit %s for more information.", "<b>$version</b>", $version_link); | |
778 | ||
779 | print "</div>"; | |
780 | ||
781 | print "<div style='text-align : center'>"; | |
782 | print "<button dojoType=\"dijit.form.Button\" | |
783 | onclick=\"return dijit.byId('newVersionDlg').hide()\">". | |
784 | __('Close this window')."</button>"; | |
785 | print "</div>"; | |
786 | ||
787 | } | |
788 | ||
951906dc | 789 | print "</dlg>"; |
ef8be8ea AD |
790 | } |
791 | ?> |