]>
Commit | Line | Data |
---|---|---|
1 | <?php | |
2 | function module_popup_dialog($link) { | |
3 | $id = $_REQUEST["id"]; | |
4 | $param = db_escape_string($_REQUEST["param"]); | |
5 | ||
6 | print "<dlg id=\"$id\">"; | |
7 | ||
8 | if ($id == "importOpml") { | |
9 | print "<div class=\"prefFeedOPMLHolder\">"; | |
10 | header("Content-Type: text/html"); # required for iframe | |
11 | ||
12 | $owner_uid = $_SESSION["uid"]; | |
13 | ||
14 | db_query($link, "BEGIN"); | |
15 | ||
16 | /* create Imported feeds category just in case */ | |
17 | ||
18 | $result = db_query($link, "SELECT id FROM | |
19 | ttrss_feed_categories WHERE title = 'Imported feeds' AND | |
20 | owner_uid = '$owner_uid' LIMIT 1"); | |
21 | ||
22 | if (db_num_rows($result) == 0) { | |
23 | db_query($link, "INSERT INTO ttrss_feed_categories | |
24 | (title,owner_uid) | |
25 | VALUES ('Imported feeds', '$owner_uid')"); | |
26 | } | |
27 | ||
28 | db_query($link, "COMMIT"); | |
29 | ||
30 | /* Handle OPML import by DOMXML/DOMDocument */ | |
31 | ||
32 | if (function_exists('domxml_open_file')) { | |
33 | print "<ul class='nomarks'>"; | |
34 | print "<li>".__("Importing using DOMXML.")."</li>"; | |
35 | require_once "opml_domxml.php"; | |
36 | opml_import_domxml($link, $owner_uid); | |
37 | print "</ul>"; | |
38 | } else if (PHP_VERSION >= 5) { | |
39 | print "<ul class='nomarks'>"; | |
40 | print "<li>".__("Importing using DOMDocument.")."</li>"; | |
41 | require_once "opml_domdoc.php"; | |
42 | opml_import_domdoc($link, $owner_uid); | |
43 | print "</ul>"; | |
44 | } else { | |
45 | print_error(__("DOMXML extension is not found. It is required for PHP versions below 5.")); | |
46 | } | |
47 | ||
48 | print "</div>"; | |
49 | ||
50 | print "<div align='center'>"; | |
51 | print "<button dojoType=\"dijit.form.Button\" | |
52 | onclick=\"dijit.byId('opmlImportDlg').hide()\">". | |
53 | __('Close this window')."</button>"; | |
54 | print "</div>"; | |
55 | ||
56 | print "</div>"; | |
57 | ||
58 | //return; | |
59 | } | |
60 | ||
61 | if ($id == "editPrefProfiles") { | |
62 | ||
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()\">". | |
80 | __('Create profile')."</button></div>"; | |
81 | ||
82 | # print "</div>"; | |
83 | ||
84 | ||
85 | $result = db_query($link, "SELECT title,id FROM ttrss_settings_profiles | |
86 | WHERE owner_uid = ".$_SESSION["uid"]." ORDER BY title"); | |
87 | ||
88 | print "<div class=\"prefFeedCatHolder\">"; | |
89 | ||
90 | print "<form id=\"profile_edit_form\" onsubmit=\"return false\">"; | |
91 | ||
92 | print "<table width=\"100%\" class=\"prefFeedProfileList\" | |
93 | cellspacing=\"0\" id=\"prefFeedProfileList\">"; | |
94 | ||
95 | print "<tr class=\"\" id=\"FCATR-0\">"; #odd | |
96 | ||
97 | print "<td width='5%' align='center'><input | |
98 | onclick='toggleSelectRow2(this);' | |
99 | dojoType=\"dijit.form.CheckBox\" | |
100 | type=\"checkbox\"></td>"; | |
101 | ||
102 | if (!$_SESSION["profile"]) { | |
103 | $is_active = __("(active)"); | |
104 | } else { | |
105 | $is_active = ""; | |
106 | } | |
107 | ||
108 | print "<td><span>" . | |
109 | __("Default profile") . " $is_active</span></td>"; | |
110 | ||
111 | print "</tr>"; | |
112 | ||
113 | $lnum = 1; | |
114 | ||
115 | while ($line = db_fetch_assoc($result)) { | |
116 | ||
117 | $class = ($lnum % 2) ? "even" : "odd"; | |
118 | ||
119 | $profile_id = $line["id"]; | |
120 | $this_row_id = "id=\"FCATR-$profile_id\""; | |
121 | ||
122 | print "<tr class=\"\" $this_row_id>"; | |
123 | ||
124 | $edit_title = htmlspecialchars($line["title"]); | |
125 | ||
126 | print "<td width='5%' align='center'><input | |
127 | onclick='toggleSelectRow2(this);' | |
128 | dojoType=\"dijit.form.CheckBox\" | |
129 | type=\"checkbox\"></td>"; | |
130 | ||
131 | if ($_SESSION["profile"] == $line["id"]) { | |
132 | $is_active = __("(active)"); | |
133 | } else { | |
134 | $is_active = ""; | |
135 | } | |
136 | ||
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', method: '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 | ||
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'> | |
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> | |
169 | </div>"; | |
170 | ||
171 | print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('profileEditDlg').hide()\">". | |
172 | __('Close this window')."</button>"; | |
173 | print "</div>"; | |
174 | ||
175 | } | |
176 | ||
177 | if ($id == "pubOPMLUrl") { | |
178 | ||
179 | print "<title>".__('Public OPML URL')."</title>"; | |
180 | print "<content><![CDATA["; | |
181 | ||
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 | ||
192 | print "<button dojoType=\"dijit.form.Button\" onclick=\"return opmlRegenKey()\">". | |
193 | __('Generate new URL')."</button> "; | |
194 | ||
195 | print "<button dojoType=\"dijit.form.Button\" onclick=\"return closeInfoBox()\">". | |
196 | __('Close this window')."</button>"; | |
197 | ||
198 | print "</div>"; | |
199 | print "]]></content>"; | |
200 | ||
201 | //return; | |
202 | } | |
203 | ||
204 | if ($id == "explainError") { | |
205 | ||
206 | print "<title>".__('Notice')."</title>"; | |
207 | print "<content><![CDATA["; | |
208 | ||
209 | print "<div class=\"errorExplained\">"; | |
210 | ||
211 | if ($param == 1) { | |
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."); | |
213 | ||
214 | $stamp = (int) file_get_contents(LOCK_DIRECTORY . "/update_daemon.stamp"); | |
215 | ||
216 | print "<p>" . __("Last update:") . " " . date("Y.m.d, G:i", $stamp); | |
217 | ||
218 | } | |
219 | ||
220 | if ($param == 3) { | |
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."); | |
222 | ||
223 | $stamp = (int) file_get_contents(LOCK_DIRECTORY . "/update_daemon.stamp"); | |
224 | ||
225 | print "<p>" . __("Last update:") . " " . date("Y.m.d, G:i", $stamp); | |
226 | ||
227 | } | |
228 | ||
229 | print "</div>"; | |
230 | ||
231 | print "<div align='center'>"; | |
232 | ||
233 | print "<button onclick=\"return closeInfoBox()\">". | |
234 | __('Close this window')."</button>"; | |
235 | ||
236 | print "</div>"; | |
237 | print "]]></content>"; | |
238 | ||
239 | //return; | |
240 | } | |
241 | ||
242 | if ($id == "quickAddFeed") { | |
243 | ||
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=\"method\" value=\"addfeed\">"; | |
246 | ||
247 | print "<div class=\"dlgSec\">".__("Feed")."</div>"; | |
248 | print "<div class=\"dlgSecCont\">"; | |
249 | ||
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\">"; | |
253 | ||
254 | print "<hr/>"; | |
255 | ||
256 | if (get_pref($link, 'ENABLE_FEED_CATS')) { | |
257 | print __('Place in category:') . " "; | |
258 | print_feed_cat_select($link, "cat", false, 'dojoType="dijit.form.Select"'); | |
259 | } | |
260 | ||
261 | print "</div>"; | |
262 | ||
263 | print '<div id="feedDlg_feedsContainer" style="display : none"> | |
264 | ||
265 | <div class="dlgSec">' . __('Available feeds') . '</div> | |
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'> | |
276 | ||
277 | <div class=\"dlgSec\">".__("Authentication")."</div> | |
278 | <div class=\"dlgSecCont\">". | |
279 | ||
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'\"> | |
287 | </div></div>"; | |
288 | ||
289 | ||
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\">". | |
294 | __('This feed requires authentication.')."</div>"; | |
295 | ||
296 | print "</form>"; | |
297 | ||
298 | print "<div class=\"dlgButtons\"> | |
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>"; | |
303 | ||
304 | //return; | |
305 | } | |
306 | ||
307 | if ($id == "feedBrowser") { | |
308 | ||
309 | $browser_search = db_escape_string($_REQUEST["search"]); | |
310 | ||
311 | # print "<form onsubmit='return false;' display='inline' | |
312 | # name='feed_browser' id='feed_browser'>"; | |
313 | ||
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=\"method\" value=\"updateFeedBrowser\">"; | |
316 | ||
317 | print "<div dojoType=\"dijit.Toolbar\"> | |
318 | <div style='float : right'> | |
319 | <img style='display : none' | |
320 | id='feed_browser_spinner' src='". | |
321 | theme_image($link, 'images/indicator_white.gif')."'> | |
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> | |
325 | </div>"; | |
326 | ||
327 | print " <select name=\"mode\" dojoType=\"dijit.form.Select\" onchange=\"dijit.byId('feedBrowserDlg').update()\"> | |
328 | <option value='1'>" . __('Popular feeds') . "</option> | |
329 | <option value='2'>" . __('Feed archive') . "</option> | |
330 | </select> "; | |
331 | ||
332 | print __("limit:"); | |
333 | ||
334 | print " <select dojoType=\"dijit.form.Select\" name=\"limit\" onchange=\"dijit.byId('feedBrowserDlg').update()\">"; | |
335 | ||
336 | foreach (array(25, 50, 100, 200) as $l) { | |
337 | $issel = ($l == $limit) ? "selected=\"1\"" : ""; | |
338 | print "<option $issel value=\"$l\">$l</option>"; | |
339 | } | |
340 | ||
341 | print "</select> "; | |
342 | ||
343 | print "</div>"; | |
344 | ||
345 | $owner_uid = $_SESSION["uid"]; | |
346 | ||
347 | print "<ul class='browseFeedList' id='browseFeedList'>"; | |
348 | print make_feed_browser($link, $search, 25); | |
349 | print "</ul>"; | |
350 | ||
351 | print "<div align='center'> | |
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>"; | |
355 | ||
356 | } | |
357 | ||
358 | if ($id == "search") { | |
359 | ||
360 | $params = explode(":", db_escape_string($_REQUEST["param"]), 2); | |
361 | ||
362 | $active_feed_id = sprintf("%d", $params[0]); | |
363 | $is_cat = $params[1] != "false"; | |
364 | ||
365 | print "<div class=\"dlgSec\">".__('Look for')."</div>"; | |
366 | ||
367 | print "<div class=\"dlgSecCont\">"; | |
368 | ||
369 | if (!SPHINX_ENABLED) { | |
370 | ||
371 | print "<input dojoType=\"dijit.form.ValidationTextBox\" | |
372 | style=\"font-size : 16px; width : 12em;\" | |
373 | required=\"1\" name=\"query\" type=\"search\" value=''>"; | |
374 | ||
375 | print " " . __('match on')." "; | |
376 | ||
377 | $search_fields = array( | |
378 | "title" => __("Title"), | |
379 | "content" => __("Content"), | |
380 | "both" => __("Title or content")); | |
381 | ||
382 | print_select_hash("match_on", 3, $search_fields, | |
383 | 'dojoType="dijit.form.Select"'); | |
384 | } else { | |
385 | print "<input dojoType=\"dijit.form.ValidationTextBox\" | |
386 | style=\"font-size : 16px; width : 20em;\" | |
387 | required=\"1\" name=\"query\" type=\"search\" value=''>"; | |
388 | } | |
389 | ||
390 | ||
391 | print "<hr/>".__('Limit search to:')." "; | |
392 | ||
393 | print "<select name=\"search_mode\" dojoType=\"dijit.form.Select\"> | |
394 | <option value=\"all_feeds\">".__('All feeds')."</option>"; | |
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) { | |
405 | print "<option selected=\"1\" value=\"this_feed\">$feed_title</option>"; | |
406 | } else { | |
407 | print "<option disabled=\"1\" value=\"false\">".__('This feed')."</option>"; | |
408 | } | |
409 | ||
410 | if ($is_cat) { | |
411 | $cat_preselected = "selected=\"1\""; | |
412 | } | |
413 | ||
414 | if (get_pref($link, 'ENABLE_FEED_CATS') && ($active_feed_id > 0 || $is_cat)) { | |
415 | print "<option $cat_preselected value=\"this_cat\">$feed_cat_title</option>"; | |
416 | } else { | |
417 | //print "<option disabled>".__('This category')."</option>"; | |
418 | } | |
419 | ||
420 | print "</select>"; | |
421 | ||
422 | print "</div>"; | |
423 | ||
424 | print "<div class=\"dlgButtons\">"; | |
425 | ||
426 | if (!SPHINX_ENABLED) { | |
427 | print "<div style=\"float : left\"> | |
428 | <a class=\"visibleLink\" target=\"_blank\" href=\"http://tt-rss.org/redmine/wiki/tt-rss/SearchSyntax\">Search syntax</a> | |
429 | </div>"; | |
430 | } | |
431 | ||
432 | print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('searchDlg').execute()\">".__('Search')."</button> | |
433 | <button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('searchDlg').hide()\">".__('Cancel')."</button> | |
434 | </div>"; | |
435 | } | |
436 | ||
437 | if ($id == "quickAddFilter") { | |
438 | ||
439 | $active_feed_id = db_escape_string($_REQUEST["param"]); | |
440 | ||
441 | print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pref-filters\">"; | |
442 | print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"quiet\" value=\"1\">"; | |
443 | print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"add\">"; | |
444 | ||
445 | $result = db_query($link, "SELECT id,description | |
446 | FROM ttrss_filter_types ORDER BY description"); | |
447 | ||
448 | $filter_types = array(); | |
449 | ||
450 | while ($line = db_fetch_assoc($result)) { | |
451 | //array_push($filter_types, $line["description"]); | |
452 | $filter_types[$line["id"]] = __($line["description"]); | |
453 | } | |
454 | ||
455 | print "<div class=\"dlgSec\">".__("Match")."</div>"; | |
456 | ||
457 | print "<div class=\"dlgSecCont\">"; | |
458 | ||
459 | print "<span id=\"filterDlg_dateModBox\" style=\"display : none\">"; | |
460 | ||
461 | $filter_params = array( | |
462 | "before" => __("before"), | |
463 | "after" => __("after")); | |
464 | ||
465 | print_select_hash("filter_date_modifier", "before", | |
466 | $filter_params, 'dojoType="dijit.form.Select"'); | |
467 | ||
468 | print " </span>"; | |
469 | ||
470 | print "<input dojoType=\"dijit.form.ValidationTextBox\" | |
471 | required=\"true\" id=\"filterDlg_regExp\" | |
472 | style=\"font-size : 16px\" | |
473 | name=\"reg_exp\" value=\"$reg_exp\"/>"; | |
474 | ||
475 | print "<span id=\"filterDlg_dateChkBox\" style=\"display : none\">"; | |
476 | print " <button dojoType=\"dijit.form.Button\" | |
477 | onclick=\"return filterDlgCheckDate()\">". | |
478 | __('Check it')."</button>"; | |
479 | print "</span>"; | |
480 | ||
481 | print "<hr/>" . __("on field") . " "; | |
482 | print_select_hash("filter_type", 1, $filter_types, | |
483 | 'onchange="filterDlgCheckType(this)" dojoType="dijit.form.Select"'); | |
484 | ||
485 | print "<hr/>"; | |
486 | ||
487 | print __("in") . " "; | |
488 | print_feed_select($link, "feed_id", $active_feed_id, | |
489 | 'dojoType="dijit.form.FilteringSelect"'); | |
490 | ||
491 | print "</div>"; | |
492 | ||
493 | print "<div class=\"dlgSec\">".__("Perform Action")."</div>"; | |
494 | ||
495 | print "<div class=\"dlgSecCont\">"; | |
496 | ||
497 | print "<select name=\"action_id\" dojoType=\"dijit.form.Select\" | |
498 | onchange=\"filterDlgCheckAction(this)\">"; | |
499 | ||
500 | $result = db_query($link, "SELECT id,description FROM ttrss_filter_actions | |
501 | ORDER BY name"); | |
502 | ||
503 | while ($line = db_fetch_assoc($result)) { | |
504 | printf("<option value='%d'>%s</option>", $line["id"], __($line["description"])); | |
505 | } | |
506 | ||
507 | print "</select>"; | |
508 | ||
509 | print "<span id=\"filterDlg_paramBox\" style=\"display : none\">"; | |
510 | print " " . __("with parameters:") . " "; | |
511 | print "<input dojoType=\"dijit.form.TextBox\" | |
512 | id=\"filterDlg_actionParam\" | |
513 | name=\"action_param\">"; | |
514 | ||
515 | print_label_select($link, "action_param_label", $action_param, | |
516 | 'id="filterDlg_actionParamLabel" dojoType="dijit.form.Select"'); | |
517 | ||
518 | print "</span>"; | |
519 | ||
520 | print " "; // tiny layout hack | |
521 | ||
522 | print "</div>"; | |
523 | ||
524 | print "<div class=\"dlgSec\">".__("Options")."</div>"; | |
525 | print "<div class=\"dlgSecCont\">"; | |
526 | ||
527 | print "<input dojoType=\"dijit.form.CheckBox\" type=\"checkbox\" name=\"enabled\" id=\"enabled\" checked=\"1\"> | |
528 | <label for=\"enabled\">".__('Enabled')."</label><hr/>"; | |
529 | ||
530 | print "<input dojoType=\"dijit.form.CheckBox\" type=\"checkbox\" name=\"inverse\" id=\"inverse\"> | |
531 | <label for=\"inverse\">".__('Inverse match')."</label>"; | |
532 | ||
533 | print "</div>"; | |
534 | ||
535 | print "<div class=\"dlgButtons\">"; | |
536 | ||
537 | print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('filterEditDlg').test()\">". | |
538 | __('Test')."</button> "; | |
539 | ||
540 | print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('filterEditDlg').execute()\">". | |
541 | __('Create')."</button> "; | |
542 | ||
543 | print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('filterEditDlg').hide()\">". | |
544 | __('Cancel')."</button>"; | |
545 | ||
546 | print "</div>"; | |
547 | ||
548 | //return; | |
549 | } | |
550 | ||
551 | if ($id == "inactiveFeeds") { | |
552 | ||
553 | if (DB_TYPE == "pgsql") { | |
554 | $interval_qpart = "NOW() - INTERVAL '3 months'"; | |
555 | } else { | |
556 | $interval_qpart = "DATE_SUB(NOW(), INTERVAL 3 MONTH)"; | |
557 | } | |
558 | ||
559 | $result = db_query($link, "SELECT ttrss_feeds.title, ttrss_feeds.site_url, | |
560 | ttrss_feeds.feed_url, ttrss_feeds.id, MAX(updated) AS last_article | |
561 | FROM ttrss_feeds, ttrss_entries, ttrss_user_entries WHERE | |
562 | (SELECT MAX(updated) FROM ttrss_entries, ttrss_user_entries WHERE | |
563 | ttrss_entries.id = ref_id AND | |
564 | ttrss_user_entries.feed_id = ttrss_feeds.id) < $interval_qpart | |
565 | AND ttrss_feeds.owner_uid = ".$_SESSION["uid"]." AND | |
566 | ttrss_user_entries.feed_id = ttrss_feeds.id AND | |
567 | ttrss_entries.id = ref_id | |
568 | GROUP BY ttrss_feeds.title, ttrss_feeds.id, ttrss_feeds.site_url, ttrss_feeds.feed_url | |
569 | ORDER BY last_article"); | |
570 | ||
571 | print __("These feeds have not been updated with new content for 3 months (oldest first):"); | |
572 | ||
573 | print "<div class=\"inactiveFeedHolder\">"; | |
574 | ||
575 | print "<table width=\"100%\" cellspacing=\"0\" id=\"prefInactiveFeedList\">"; | |
576 | ||
577 | $lnum = 1; | |
578 | ||
579 | while ($line = db_fetch_assoc($result)) { | |
580 | ||
581 | $class = ($lnum % 2) ? "even" : "odd"; | |
582 | $feed_id = $line["id"]; | |
583 | $this_row_id = "id=\"FUPDD-$feed_id\""; | |
584 | ||
585 | print "<tr class=\"\" $this_row_id>"; | |
586 | ||
587 | $edit_title = htmlspecialchars($line["title"]); | |
588 | ||
589 | print "<td width='5%' align='center'><input | |
590 | onclick='toggleSelectRow2(this);' dojoType=\"dijit.form.CheckBox\" | |
591 | type=\"checkbox\"></td>"; | |
592 | print "<td>"; | |
593 | ||
594 | print "<a class=\"visibleLink\" href=\"#\" ". | |
595 | "title=\"".__("Click to edit feed")."\" ". | |
596 | "onclick=\"editFeed(".$line["id"].")\">". | |
597 | htmlspecialchars($line["title"])."</a>"; | |
598 | ||
599 | print "</td><td class=\"insensitive\" align='right'>"; | |
600 | print make_local_datetime($link, $line['last_article'], false); | |
601 | print "</td>"; | |
602 | print "</tr>"; | |
603 | ||
604 | ++$lnum; | |
605 | } | |
606 | ||
607 | print "</table>"; | |
608 | print "</div>"; | |
609 | ||
610 | print "<div class='dlgButtons'>"; | |
611 | print "<div style='float : left'>"; | |
612 | print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('inactiveFeedsDlg').removeSelected()\">" | |
613 | .__('Unsubscribe from selected feeds')."</button> "; | |
614 | print "</div>"; | |
615 | ||
616 | print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('inactiveFeedsDlg').hide()\">". | |
617 | __('Close this window')."</button>"; | |
618 | ||
619 | print "</div>"; | |
620 | ||
621 | } | |
622 | ||
623 | if ($id == "feedsWithErrors") { | |
624 | ||
625 | # print "<title>".__('Feeds with update errors')."</title>"; | |
626 | # print "<content><![CDATA["; | |
627 | ||
628 | print __("These feeds have not been updated because of errors:"); | |
629 | ||
630 | $result = db_query($link, "SELECT id,title,feed_url,last_error,site_url | |
631 | FROM ttrss_feeds WHERE last_error != '' AND owner_uid = ".$_SESSION["uid"]); | |
632 | ||
633 | print "<div class=\"inactiveFeedHolder\">"; | |
634 | ||
635 | print "<table width=\"100%\" cellspacing=\"0\" id=\"prefErrorFeedList\">"; | |
636 | ||
637 | $lnum = 1; | |
638 | ||
639 | while ($line = db_fetch_assoc($result)) { | |
640 | ||
641 | $class = ($lnum % 2) ? "even" : "odd"; | |
642 | $feed_id = $line["id"]; | |
643 | $this_row_id = "id=\"FUPDD-$feed_id\""; | |
644 | ||
645 | print "<tr class=\"\" $this_row_id>"; | |
646 | ||
647 | $edit_title = htmlspecialchars($line["title"]); | |
648 | ||
649 | print "<td width='5%' align='center'><input | |
650 | onclick='toggleSelectRow2(this);' dojoType=\"dijit.form.CheckBox\" | |
651 | type=\"checkbox\"></td>"; | |
652 | print "<td>"; | |
653 | ||
654 | print "<a class=\"visibleLink\" href=\"#\" ". | |
655 | "title=\"".__("Click to edit feed")."\" ". | |
656 | "onclick=\"editFeed(".$line["id"].")\">". | |
657 | htmlspecialchars($line["title"])."</a>: "; | |
658 | ||
659 | print "<span class=\"insensitive\">"; | |
660 | print htmlspecialchars($line["last_error"]); | |
661 | print "</span>"; | |
662 | ||
663 | print "</td>"; | |
664 | print "</tr>"; | |
665 | ||
666 | ++$lnum; | |
667 | } | |
668 | ||
669 | print "</table>"; | |
670 | print "</div>"; | |
671 | ||
672 | print "<div class='dlgButtons'>"; | |
673 | print "<div style='float : left'>"; | |
674 | print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('errorFeedsDlg').removeSelected()\">" | |
675 | .__('Unsubscribe from selected feeds')."</button> "; | |
676 | print "</div>"; | |
677 | ||
678 | print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('errorFeedsDlg').hide()\">". | |
679 | __('Close this window')."</button>"; | |
680 | ||
681 | print "</div>"; | |
682 | } | |
683 | ||
684 | if ($id == "editArticleTags") { | |
685 | ||
686 | # print "<form id=\"tag_edit_form\" onsubmit='return false'>"; | |
687 | ||
688 | print __("Tags for this article (separated by commas):")."<br>"; | |
689 | ||
690 | $tags = get_article_tags($link, $param); | |
691 | ||
692 | $tags_str = join(", ", $tags); | |
693 | ||
694 | print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"id\" value=\"$param\">"; | |
695 | print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"rpc\">"; | |
696 | print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"setArticleTags\">"; | |
697 | ||
698 | print "<table width='100%'><tr><td>"; | |
699 | ||
700 | print "<textarea dojoType=\"dijit.form.SimpleTextarea\" rows='4' | |
701 | style='font-size : 12px; width : 100%' id=\"tags_str\" | |
702 | name='tags_str'>$tags_str</textarea> | |
703 | <div class=\"autocomplete\" id=\"tags_choices\" | |
704 | style=\"display:none\"></div>"; | |
705 | ||
706 | print "</td></tr></table>"; | |
707 | ||
708 | # print "</form>"; | |
709 | ||
710 | print "<div class='dlgButtons'>"; | |
711 | ||
712 | print "<button dojoType=\"dijit.form.Button\" | |
713 | onclick=\"dijit.byId('editTagsDlg').execute()\">".__('Save')."</button> "; | |
714 | print "<button dojoType=\"dijit.form.Button\" | |
715 | onclick=\"dijit.byId('editTagsDlg').hide()\">".__('Cancel')."</button>"; | |
716 | print "</div>"; | |
717 | ||
718 | } | |
719 | ||
720 | if ($id == "printTagCloud") { | |
721 | print "<title>".__('Tag Cloud')."</title>"; | |
722 | print "<content><![CDATA["; | |
723 | ||
724 | # print __("Showing most popular tags ")." (<a | |
725 | # href='javascript:toggleTags(true)'>".__('more tags')."</a>):<br/>"; | |
726 | ||
727 | print "<div class=\"tagCloudContainer\">"; | |
728 | ||
729 | printTagCloud($link); | |
730 | ||
731 | print "</div>"; | |
732 | ||
733 | print "<div align='center'>"; | |
734 | print "<button dojoType=\"dijit.form.Button\" | |
735 | onclick=\"return closeInfoBox()\">". | |
736 | __('Close this window')."</button>"; | |
737 | print "</div>"; | |
738 | ||
739 | print "]]></content>"; | |
740 | } | |
741 | ||
742 | if ($id == 'printTagSelect') { | |
743 | print "<title>" . __('Select item(s) by tags') . "</title>"; | |
744 | print "<content><![CDATA["; | |
745 | ||
746 | print __("Match:"). " " . | |
747 | "<input class=\"noborder\" dojoType=\"dijit.form.RadioButton\" type=\"radio\" checked value=\"any\" name=\"tag_mode\"> Any "; | |
748 | print "<input class=\"noborder\" dojoType=\"dijit.form.RadioButton\" type=\"radio\" value=\"all\" name=\"tag_mode\"> All "; | |
749 | print " tags."; | |
750 | ||
751 | print "<select id=\"all_tags\" name=\"all_tags\" title=\"" . __('Which Tags?') . "\" multiple=\"multiple\" size=\"10\" style=\"width : 100%\">"; | |
752 | $result = db_query($link, "SELECT DISTINCT tag_name FROM ttrss_tags WHERE owner_uid = ".$_SESSION['uid']." | |
753 | AND LENGTH(tag_name) <= 30 ORDER BY tag_name ASC"); | |
754 | ||
755 | while ($row = db_fetch_assoc($result)) { | |
756 | $tmp = htmlspecialchars($row["tag_name"]); | |
757 | print "<option value=\"" . str_replace(" ", "%20", $tmp) . "\">$tmp</option>"; | |
758 | } | |
759 | ||
760 | print "</select>"; | |
761 | ||
762 | print "<div align='right'>"; | |
763 | print "<button dojoType=\"dijit.form.Button\" onclick=\"viewfeed(get_all_tags($('all_tags')), | |
764 | get_radio_checked($('tag_mode')));\">" . __('Display entries') . "</button>"; | |
765 | print " "; | |
766 | print "<button dojoType=\"dijit.form.Button\" | |
767 | onclick=\"return closeInfoBox()\">" . | |
768 | __('Close this window') . "</button>"; | |
769 | print "</div>"; | |
770 | ||
771 | print "]]></content>"; | |
772 | } | |
773 | ||
774 | if ($id == "emailArticle") { | |
775 | ||
776 | $secretkey = sha1(uniqid(rand(), true)); | |
777 | ||
778 | $_SESSION['email_secretkey'] = $secretkey; | |
779 | ||
780 | print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"secretkey\" value=\"$secretkey\">"; | |
781 | print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"rpc\">"; | |
782 | print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"sendEmail\">"; | |
783 | ||
784 | $result = db_query($link, "SELECT email, full_name FROM ttrss_users WHERE | |
785 | id = " . $_SESSION["uid"]); | |
786 | ||
787 | $user_email = htmlspecialchars(db_fetch_result($result, 0, "email")); | |
788 | $user_name = htmlspecialchars(db_fetch_result($result, 0, "full_name")); | |
789 | ||
790 | if (!$user_name) $user_name = $_SESSION['name']; | |
791 | ||
792 | $_SESSION['email_replyto'] = $user_email; | |
793 | $_SESSION['email_fromname'] = $user_name; | |
794 | ||
795 | require_once "lib/MiniTemplator.class.php"; | |
796 | ||
797 | $tpl = new MiniTemplator; | |
798 | $tpl_t = new MiniTemplator; | |
799 | ||
800 | $tpl->readTemplateFromFile("templates/email_article_template.txt"); | |
801 | ||
802 | $tpl->setVariable('USER_NAME', $_SESSION["name"]); | |
803 | $tpl->setVariable('USER_EMAIL', $user_email); | |
804 | $tpl->setVariable('TTRSS_HOST', $_SERVER["HTTP_HOST"]); | |
805 | ||
806 | // $tpl->addBlock('header'); | |
807 | ||
808 | $result = db_query($link, "SELECT link, content, title | |
809 | FROM ttrss_user_entries, ttrss_entries WHERE id = ref_id AND | |
810 | id IN ($param) AND owner_uid = " . $_SESSION["uid"]); | |
811 | ||
812 | if (db_num_rows($result) > 1) { | |
813 | $subject = __("[Forwarded]") . " " . __("Multiple articles"); | |
814 | } | |
815 | ||
816 | while ($line = db_fetch_assoc($result)) { | |
817 | ||
818 | if (!$subject) | |
819 | $subject = __("[Forwarded]") . " " . htmlspecialchars($line["title"]); | |
820 | ||
821 | $tpl->setVariable('ARTICLE_TITLE', strip_tags($line["title"])); | |
822 | $tpl->setVariable('ARTICLE_URL', strip_tags($line["link"])); | |
823 | ||
824 | $tpl->addBlock('article'); | |
825 | } | |
826 | ||
827 | $tpl->addBlock('email'); | |
828 | ||
829 | $content = ""; | |
830 | $tpl->generateOutputToString($content); | |
831 | ||
832 | print "<table width='100%'><tr><td>"; | |
833 | ||
834 | print __('From:'); | |
835 | ||
836 | print "</td><td>"; | |
837 | ||
838 | print "<input dojoType=\"dijit.form.TextBox\" disabled=\"1\" style=\"width : 30em;\" | |
839 | value=\"$user_name <$user_email>\">"; | |
840 | ||
841 | print "</td></tr><tr><td>"; | |
842 | ||
843 | print __('To:'); | |
844 | ||
845 | print "</td><td>"; | |
846 | ||
847 | print "<input dojoType=\"dijit.form.ValidationTextBox\" required=\"true\" | |
848 | style=\"width : 30em;\" | |
849 | name=\"destination\" id=\"emailArticleDlg_destination\">"; | |
850 | ||
851 | print "<div class=\"autocomplete\" id=\"emailArticleDlg_dst_choices\" | |
852 | style=\"z-index: 30; display : none\"></div>"; | |
853 | ||
854 | print "</td></tr><tr><td>"; | |
855 | ||
856 | print __('Subject:'); | |
857 | ||
858 | print "</td><td>"; | |
859 | ||
860 | print "<input dojoType=\"dijit.form.ValidationTextBox\" required=\"true\" | |
861 | style=\"width : 30em;\" | |
862 | name=\"subject\" value=\"$subject\" id=\"subject\">"; | |
863 | ||
864 | print "</td></tr>"; | |
865 | ||
866 | print "<tr><td colspan='2'><textarea dojoType=\"dijit.form.SimpleTextarea\" style='font-size : 12px; width : 100%' rows=\"20\" | |
867 | name='content'>$content</textarea>"; | |
868 | ||
869 | print "</td></tr></table>"; | |
870 | ||
871 | print "<div class='dlgButtons'>"; | |
872 | print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('emailArticleDlg').execute()\">".__('Send e-mail')."</button> "; | |
873 | print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('emailArticleDlg').hide()\">".__('Cancel')."</button>"; | |
874 | print "</div>"; | |
875 | ||
876 | //return; | |
877 | } | |
878 | ||
879 | if ($id == "generatedFeed") { | |
880 | ||
881 | print "<title>".__('View as RSS')."</title>"; | |
882 | print "<content><![CDATA["; | |
883 | ||
884 | $params = explode(":", $param, 3); | |
885 | $feed_id = db_escape_string($params[0]); | |
886 | $is_cat = (bool) $params[1]; | |
887 | ||
888 | $key = get_feed_access_key($link, $feed_id, $is_cat); | |
889 | ||
890 | $url_path = htmlspecialchars($params[2]) . "&key=" . $key; | |
891 | ||
892 | print __("You can view this feed as RSS using the following URL:"); | |
893 | ||
894 | print "<div class=\"tagCloudContainer\">"; | |
895 | print "<a id='gen_feed_url' href='$url_path' target='_blank'>$url_path</a>"; | |
896 | print "</div>"; | |
897 | ||
898 | print "<div align='center'>"; | |
899 | ||
900 | print "<button dojoType=\"dijit.form.Button\" onclick=\"return genUrlChangeKey('$feed_id', '$is_cat')\">". | |
901 | __('Generate new URL')."</button> "; | |
902 | ||
903 | print "<button dojoType=\"dijit.form.Button\" onclick=\"return closeInfoBox()\">". | |
904 | __('Close this window')."</button>"; | |
905 | ||
906 | print "</div>"; | |
907 | print "]]></content>"; | |
908 | ||
909 | //return; | |
910 | } | |
911 | ||
912 | if ($id == "newVersion") { | |
913 | $version_data = check_for_update($link); | |
914 | $version = $version_data['version']; | |
915 | $id = $version_data['version_id']; | |
916 | ||
917 | print "<div class='tagCloudContainer'>"; | |
918 | ||
919 | print T_sprintf("New version of Tiny Tiny RSS is available (%s).", | |
920 | "<b>$version</b>"); | |
921 | ||
922 | print "</div>"; | |
923 | ||
924 | $details = "http://tt-rss.org/redmine/versions/show/$id"; | |
925 | $download = "http://tt-rss.org/#Download"; | |
926 | ||
927 | print "<div style='text-align : center'>"; | |
928 | print "<button dojoType=\"dijit.form.Button\" | |
929 | onclick=\"return window.open('$details')\">".__("Details")."</button>"; | |
930 | print "<button dojoType=\"dijit.form.Button\" | |
931 | onclick=\"return window.open('$download')\">".__("Download")."</button>"; | |
932 | print "<button dojoType=\"dijit.form.Button\" | |
933 | onclick=\"return dijit.byId('newVersionDlg').hide()\">". | |
934 | __('Close this window')."</button>"; | |
935 | print "</div>"; | |
936 | ||
937 | } | |
938 | ||
939 | if ($id == "customizeCSS") { | |
940 | ||
941 | $value = get_pref($link, "USER_STYLESHEET"); | |
942 | ||
943 | $value = str_replace("<br/>", "\n", $value); | |
944 | ||
945 | print T_sprintf("You can override colors, fonts and layout of your currently selected theme with custom CSS declarations here. <a target=\"_blank\" class=\"visibleLink\" href=\"%s\">This file</a> can be used as a baseline.", "tt-rss.css"); | |
946 | ||
947 | print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"rpc\">"; | |
948 | print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"setpref\">"; | |
949 | print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"key\" value=\"USER_STYLESHEET\">"; | |
950 | ||
951 | print "<table width='100%'><tr><td>"; | |
952 | print "<textarea dojoType=\"dijit.form.SimpleTextarea\" | |
953 | style='font-size : 12px; width : 100%; height: 200px;' | |
954 | placeHolder='body#ttrssMain { font-size : 14px; };' | |
955 | name='value'>$value</textarea>"; | |
956 | print "</td></tr></table>"; | |
957 | ||
958 | print "<div class='dlgButtons'>"; | |
959 | print "<button dojoType=\"dijit.form.Button\" | |
960 | onclick=\"dijit.byId('cssEditDlg').execute()\">".__('Save')."</button> "; | |
961 | print "<button dojoType=\"dijit.form.Button\" | |
962 | onclick=\"dijit.byId('cssEditDlg').hide()\">".__('Cancel')."</button>"; | |
963 | print "</div>"; | |
964 | ||
965 | } | |
966 | ||
967 | if ($id == "editArticleNote") { | |
968 | ||
969 | $result = db_query($link, "SELECT note FROM ttrss_user_entries WHERE | |
970 | ref_id = '$param' AND owner_uid = " . $_SESSION['uid']); | |
971 | ||
972 | $note = db_fetch_result($result, 0, "note"); | |
973 | ||
974 | print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"id\" value=\"$param\">"; | |
975 | print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"rpc\">"; | |
976 | print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"setNote\">"; | |
977 | ||
978 | print "<table width='100%'><tr><td>"; | |
979 | print "<textarea dojoType=\"dijit.form.SimpleTextarea\" | |
980 | style='font-size : 12px; width : 100%; height: 100px;' | |
981 | placeHolder='body#ttrssMain { font-size : 14px; };' | |
982 | name='note'>$note</textarea>"; | |
983 | print "</td></tr></table>"; | |
984 | ||
985 | print "<div class='dlgButtons'>"; | |
986 | print "<button dojoType=\"dijit.form.Button\" | |
987 | onclick=\"dijit.byId('editNoteDlg').execute()\">".__('Save')."</button> "; | |
988 | print "<button dojoType=\"dijit.form.Button\" | |
989 | onclick=\"dijit.byId('editNoteDlg').hide()\">".__('Cancel')."</button>"; | |
990 | print "</div>"; | |
991 | ||
992 | } | |
993 | ||
994 | if ($id == "about") { | |
995 | print "<table width='100%'><tr><td align='center'>"; | |
996 | print "<img src=\"images/logo_big.png\">"; | |
997 | print "</td>"; | |
998 | print "<td width='70%'>"; | |
999 | ||
1000 | print "<h1>Tiny Riny RSS</h1> | |
1001 | <strong>Version ".VERSION."</strong> | |
1002 | <p>Copyright © 2005-".date('Y')." | |
1003 | <a target=\"_blank\" class=\"visibleLink\" | |
1004 | href=\"http://fakecake.org/\">Andrew Dolgov</a> | |
1005 | and other contributors.</p> | |
1006 | <p class=\"insensitive\">Licensed under GNU GPL version 2.</p>"; | |
1007 | ||
1008 | print "<p class=\"insensitive\"> | |
1009 | <a class=\"visibleLink\" target=\"_blank\" | |
1010 | href=\"http://tt-rss.org/\">Official site</a> — | |
1011 | <a href=\"http://tt-rss.org/redmine/wiki/tt-rss/Donate\" | |
1012 | target=\"_blank\" class=\"visibleLink\"> | |
1013 | Support the project.</a></p>"; | |
1014 | ||
1015 | print "</td></tr>"; | |
1016 | print "</table>"; | |
1017 | ||
1018 | print "<div align='center'>"; | |
1019 | print "<button dojoType=\"dijit.form.Button\" | |
1020 | type=\"submit\">". | |
1021 | __('Close this window')."</button>"; | |
1022 | print "</div>"; | |
1023 | } | |
1024 | ||
1025 | if ($id == "addInstance") { | |
1026 | ||
1027 | print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pref-instances\">"; | |
1028 | print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"add\">"; | |
1029 | ||
1030 | print "<div class=\"dlgSec\">".__("Instance")."</div>"; | |
1031 | ||
1032 | print "<div class=\"dlgSecCont\">"; | |
1033 | ||
1034 | /* URL */ | |
1035 | ||
1036 | print __("URL:") . " "; | |
1037 | ||
1038 | print "<input dojoType=\"dijit.form.ValidationTextBox\" required=\"1\" | |
1039 | placeHolder=\"".__("Instance URL")."\" | |
1040 | regExp='^(http|https)://.*' | |
1041 | style=\"font-size : 16px; width: 20em\" name=\"access_url\">"; | |
1042 | ||
1043 | print "<hr/>"; | |
1044 | ||
1045 | $access_key = sha1(uniqid(rand(), true)); | |
1046 | ||
1047 | /* Access key */ | |
1048 | ||
1049 | print __("Access key:") . " "; | |
1050 | ||
1051 | print "<input dojoType=\"dijit.form.ValidationTextBox\" required=\"1\" | |
1052 | placeHolder=\"".__("Access key")."\" regExp='\w{40}' | |
1053 | style=\"width: 20em\" name=\"access_key\" id=\"instance_add_key\" | |
1054 | value=\"$access_key\">"; | |
1055 | ||
1056 | print "<p class='insensitive'>" . __("Use one access key for both linked instances."); | |
1057 | ||
1058 | print "</div>"; | |
1059 | ||
1060 | print "<div class=\"dlgButtons\"> | |
1061 | <div style='float : left'> | |
1062 | <button dojoType=\"dijit.form.Button\" | |
1063 | onclick=\"return dijit.byId('instanceAddDlg').regenKey()\">". | |
1064 | __('Generate new key')."</button> | |
1065 | </div> | |
1066 | <button dojoType=\"dijit.form.Button\" | |
1067 | onclick=\"return dijit.byId('instanceAddDlg').execute()\">". | |
1068 | __('Create link')."</button> | |
1069 | <button dojoType=\"dijit.form.Button\" | |
1070 | onclick=\"return dijit.byId('instanceAddDlg').hide()\"\">". | |
1071 | __('Cancel')."</button></div>"; | |
1072 | ||
1073 | return; | |
1074 | } | |
1075 | ||
1076 | if ($id == "shareArticle") { | |
1077 | ||
1078 | $result = db_query($link, "SELECT uuid, ref_id FROM ttrss_user_entries WHERE int_id = '$param' | |
1079 | AND owner_uid = " . $_SESSION['uid']); | |
1080 | ||
1081 | if (db_num_rows($result) == 0) { | |
1082 | print "Article not found."; | |
1083 | } else { | |
1084 | ||
1085 | $uuid = db_fetch_result($result, 0, "uuid"); | |
1086 | $ref_id = db_fetch_result($result, 0, "ref_id"); | |
1087 | ||
1088 | if (!$uuid) { | |
1089 | $uuid = db_escape_string(sha1(uniqid(rand(), true))); | |
1090 | db_query($link, "UPDATE ttrss_user_entries SET uuid = '$uuid' WHERE int_id = '$param' | |
1091 | AND owner_uid = " . $_SESSION['uid']); | |
1092 | } | |
1093 | ||
1094 | print __("You can share this article by the following unique URL:"); | |
1095 | ||
1096 | $url_path = get_self_url_prefix(); | |
1097 | $url_path .= "/public.php?op=share&key=$uuid"; | |
1098 | ||
1099 | print "<div class=\"tagCloudContainer\">"; | |
1100 | print "<a id='pub_opml_url' href='$url_path' target='_blank'>$url_path</a>"; | |
1101 | print "</div>"; | |
1102 | ||
1103 | /* if (!label_find_id($link, __('Shared'), $_SESSION["uid"])) | |
1104 | label_create($link, __('Shared'), $_SESSION["uid"]); | |
1105 | ||
1106 | label_add_article($link, $ref_id, __('Shared'), $_SESSION['uid']); */ | |
1107 | } | |
1108 | ||
1109 | print "<div align='center'>"; | |
1110 | ||
1111 | print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('shareArticleDlg').hide()\">". | |
1112 | __('Close this window')."</button>"; | |
1113 | ||
1114 | print "</div>"; | |
1115 | ||
1116 | return; | |
1117 | } | |
1118 | ||
1119 | print "</dlg>"; | |
1120 | ||
1121 | } | |
1122 | ?> |