]> git.wh0rd.org - tt-rss.git/blame - classes/pref/prefs.php
ttrss_zoom: fix CSS
[tt-rss.git] / classes / pref / prefs.php
CommitLineData
1395083e 1<?php
dfad9d7a 2
369dbc19 3class Pref_Prefs extends Handler_Protected {
1395083e 4
dfad9d7a
AD
5 private $pref_help = array();
6 private $pref_sections = array();
7
8484ce22 8 function csrf_ignore($method) {
9d76e754 9 $csrf_ignored = array("index", "updateself", "customizecss", "editprefprofiles");
8484ce22
AD
10
11 return array_search($method, $csrf_ignored) !== false;
12 }
13
48ed517e
AD
14 function __construct($args) {
15 parent::__construct($args);
dfad9d7a
AD
16
17 $this->pref_sections = array(
18 1 => __('General'),
19 2 => __('Interface'),
20 3 => __('Advanced'),
21 4 => __('Digest')
22 );
23
24 $this->pref_help = array(
9db8e607 25 "ALLOW_DUPLICATE_POSTS" => array(__("Allow duplicate articles"), ""),
9db8e607
AD
26 "BLACKLISTED_TAGS" => array(__("Blacklisted tags"), __("When auto-detecting tags in articles these tags will not be applied (comma-separated list).")),
27 "CDM_AUTO_CATCHUP" => array(__("Automatically mark articles as read"), __("This option enables marking articles as read automatically while you scroll article list.")),
5f462963 28 "CDM_EXPANDED" => array(__("Automatically expand articles in combined mode"), ""),
dfad9d7a 29 "COMBINED_DISPLAY_MODE" => array(__("Combined feed display"), __("Display expanded list of feed articles, instead of separate displays for headlines and article content")),
5f462963
AD
30 "CONFIRM_FEED_CATCHUP" => array(__("Confirm marking feed as read"), ""),
31 "DEFAULT_ARTICLE_LIMIT" => array(__("Amount of articles to display at once"), ""),
723bcdb2 32 "DEFAULT_UPDATE_INTERVAL" => array(__("Default feed update interval"), __("Shortest interval at which a feed will be checked for updates regardless of update method")),
5f462963 33 "DIGEST_CATCHUP" => array(__("Mark articles in e-mail digest as read"), ""),
9db8e607 34 "DIGEST_ENABLE" => array(__("Enable e-mail digest"), __("This option enables sending daily digest of new (and unread) headlines on your configured e-mail address")),
dfad9d7a 35 "DIGEST_PREFERRED_TIME" => array(__("Try to send digests around specified time"), __("Uses UTC timezone")),
9db8e607 36 "ENABLE_API_ACCESS" => array(__("Enable API access"), __("Allows external clients to access this account through the API")),
5f462963
AD
37 "ENABLE_FEED_CATS" => array(__("Enable feed categories"), ""),
38 "FEEDS_SORT_BY_UNREAD" => array(__("Sort feeds by unread articles count"), ""),
39 "FRESH_ARTICLE_MAX_AGE" => array(__("Maximum age of fresh articles (in hours)"), ""),
40 "HIDE_READ_FEEDS" => array(__("Hide feeds with no unread articles"), ""),
9db8e607 41 "HIDE_READ_SHOWS_SPECIAL" => array(__("Show special feeds when hiding read feeds"), ""),
8429af52 42 "LONG_DATE_FORMAT" => array(__("Long date format"), __("The syntax used is identical to the PHP <a href='http://php.net/manual/function.date.php'>date()</a> function.")),
dfad9d7a 43 "ON_CATCHUP_SHOW_NEXT_FEED" => array(__("On catchup show next feed"), __("Automatically open next feed with unread articles after marking one as read")),
5f462963
AD
44 "PURGE_OLD_DAYS" => array(__("Purge articles after this number of days (0 - disables)"), ""),
45 "PURGE_UNREAD_ARTICLES" => array(__("Purge unread articles"), ""),
46 "REVERSE_HEADLINES" => array(__("Reverse headline order (oldest first)"), ""),
47 "SHORT_DATE_FORMAT" => array(__("Short date format"), ""),
48 "SHOW_CONTENT_PREVIEW" => array(__("Show content preview in headlines list"), ""),
dfad9d7a
AD
49 "SORT_HEADLINES_BY_FEED_DATE" => array(__("Sort headlines by feed date"), __("Use feed-specified date to sort headlines instead of local import date.")),
50 "SSL_CERT_SERIAL" => array(__("Login with an SSL certificate"), __("Click to register your SSL client certificate with tt-rss")),
5f462963 51 "STRIP_IMAGES" => array(__("Do not embed images in articles"), ""),
dfad9d7a 52 "STRIP_UNSAFE_TAGS" => array(__("Strip unsafe tags from articles"), __("Strip all but most common HTML tags when reading articles.")),
dfad9d7a 53 "USER_STYLESHEET" => array(__("Customize stylesheet"), __("Customize CSS stylesheet to your liking")),
bd02d29e 54 "USER_TIMEZONE" => array(__("Time zone"), ""),
8ef9645d 55 "VFEED_GROUP_BY_FEED" => array(__("Group headlines in virtual feeds"), __("Special feeds, labels, and categories are grouped by originating feeds")),
7b149552 56 "USER_LANGUAGE" => array(__("Language")),
bd02d29e 57 "USER_CSS_THEME" => array(__("Theme"), __("Select one of the available CSS themes"))
dfad9d7a
AD
58 );
59 }
60
1395083e
AD
61 function changepassword() {
62
63 $old_pw = $_POST["old_password"];
64 $new_pw = $_POST["new_password"];
65 $con_pw = $_POST["confirm_password"];
66
67 if ($old_pw == "") {
5956f312 68 print "ERROR: ".format_error("Old password cannot be blank.");
1395083e
AD
69 return;
70 }
71
72 if ($new_pw == "") {
5956f312 73 print "ERROR: ".format_error("New password cannot be blank.");
1395083e
AD
74 return;
75 }
76
77 if ($new_pw != $con_pw) {
5956f312 78 print "ERROR: ".format_error("Entered passwords do not match.");
1395083e
AD
79 return;
80 }
81
1ffe3391 82 $authenticator = PluginHost::getInstance()->get_plugin($_SESSION["auth_module"]);
1395083e 83
d5fd183d 84 if (method_exists($authenticator, "change_password")) {
5956f312 85 print format_notice($authenticator->change_password($_SESSION["uid"], $old_pw, $new_pw));
098df83b 86 } else {
5956f312 87 print "ERROR: ".format_error("Function not supported by authentication module.");
098df83b 88 }
1395083e
AD
89 }
90
91 function saveconfig() {
451ff722
AD
92 $boolean_prefs = explode(",", $_POST["boolean_prefs"]);
93
94 foreach ($boolean_prefs as $pref) {
95 if (!isset($_POST[$pref])) $_POST[$pref] = 'false';
96 }
97
29c8fa08
AD
98 $need_reload = false;
99
1395083e
AD
100 foreach (array_keys($_POST) as $pref_name) {
101
70393703
AD
102 $pref_name = $pref_name;
103 $value = $_POST[$pref_name];
1395083e 104
1b9b19af 105 if ($pref_name == 'DIGEST_PREFERRED_TIME') {
a42c55f0 106 if (get_pref('DIGEST_PREFERRED_TIME') != $value) {
1b9b19af 107
70393703
AD
108 $sth = $this->pdo->prepare("UPDATE ttrss_users SET
109 last_digest_sent = NULL WHERE id = ?");
110 $sth->execute([$_SESSION['uid']]);
1b9b19af
AD
111
112 }
113 }
114
7b149552 115 if ($pref_name == "USER_LANGUAGE") {
29c8fa08 116 if ($_SESSION["language"] != $value) {
29c8fa08
AD
117 $need_reload = true;
118 }
29c8fa08 119 }
1395083e 120
7b149552 121 set_pref($pref_name, $value);
1395083e
AD
122 }
123
29c8fa08
AD
124 if ($need_reload) {
125 print "PREFS_NEED_RELOAD";
126 } else {
127 print __("The configuration was saved.");
128 }
1395083e
AD
129 }
130
1395083e
AD
131 function changeemail() {
132
70393703
AD
133 $email = $_POST["email"];
134 $full_name = $_POST["full_name"];
1395083e
AD
135 $active_uid = $_SESSION["uid"];
136
70393703
AD
137 $sth = $this->pdo->prepare("UPDATE ttrss_users SET email = ?,
138 full_name = ? WHERE id = ?");
139 $sth->execute([$email, $full_name, $active_uid]);
1395083e
AD
140
141 print __("Your personal data has been saved.");
142
143 return;
144 }
145
146 function resetconfig() {
147
148 $_SESSION["prefs_op_result"] = "reset-to-defaults";
149
70393703
AD
150 $sth = $this->pdo->query("DELETE FROM ttrss_user_prefs
151 WHERE (profile = :profile OR (:profile IS NULL AND profile IS NULL))
152 AND owner_uid = :uid");
153 $sth->execute([":profile" => $_SESSION['profile'], ":uid" => $_SESSION['uid']]);
1395083e 154
a42c55f0 155 initialize_user_prefs($_SESSION["uid"], $_SESSION["profile"]);
bf878338
AD
156
157 echo __("Your preferences are now set to default values.");
1395083e
AD
158 }
159
160 function index() {
161
162 global $access_level_names;
163
5bdcb8fd 164 $prefs_blacklist = array("ALLOW_DUPLICATE_POSTS", "STRIP_UNSAFE_TAGS", "REVERSE_HEADLINES",
78744d48
AD
165 "SORT_HEADLINES_BY_FEED_DATE", "DEFAULT_ARTICLE_LIMIT",
166 "FEEDS_SORT_BY_UNREAD");
33b3db33
AD
167
168 /* "FEEDS_SORT_BY_UNREAD", "HIDE_READ_FEEDS", "REVERSE_HEADLINES" */
1395083e
AD
169
170 $profile_blacklist = array("ALLOW_DUPLICATE_POSTS", "PURGE_OLD_DAYS",
171 "PURGE_UNREAD_ARTICLES", "DIGEST_ENABLE", "DIGEST_CATCHUP",
172 "BLACKLISTED_TAGS", "ENABLE_API_ACCESS", "UPDATE_POST_ON_CHECKSUM_CHANGE",
173 "DEFAULT_UPDATE_INTERVAL", "USER_TIMEZONE", "SORT_HEADLINES_BY_FEED_DATE",
6d9455e9 174 "SSL_CERT_SERIAL", "DIGEST_PREFERRED_TIME");
1395083e
AD
175
176
d4c64ecc 177 $_SESSION["prefs_op_result"] = "";
1395083e 178
d4c64ecc
AD
179 print "<div dojoType=\"dijit.layout.AccordionContainer\" region=\"center\">";
180 print "<div dojoType=\"dijit.layout.AccordionPane\" title=\"".__('Personal data / Authentication')."\">";
1395083e 181
d4c64ecc 182 print "<form dojoType=\"dijit.form.Form\" id=\"changeUserdataForm\">";
1395083e 183
d4c64ecc
AD
184 print "<script type=\"dojo/method\" event=\"onSubmit\" args=\"evt\">
185 evt.preventDefault();
186 if (this.validate()) {
187 notify_progress('Saving data...', true);
1395083e 188
d4c64ecc
AD
189 new Ajax.Request('backend.php', {
190 parameters: dojo.objectToQuery(this.getValues()),
191 onComplete: function(transport) {
192 notify_callback2(transport);
193 } });
1395083e 194
d4c64ecc
AD
195 }
196 </script>";
1395083e 197
d4c64ecc 198 print "<table width=\"100%\" class=\"prefPrefsList\">";
1395083e 199
fb70f26e
AD
200 print "<h2>" . __("Personal data") . "</h2>";
201
70393703 202 $sth = $this->pdo->prepare("SELECT email,full_name,otp_enabled,
d4c64ecc 203 access_level FROM ttrss_users
70393703
AD
204 WHERE id = ?");
205 $sth->execute([$_SESSION["uid"]]);
206 $row = $sth->fetch();
1395083e 207
70393703
AD
208 $email = htmlspecialchars($row["email"]);
209 $full_name = htmlspecialchars($row["full_name"]);
187abfe7 210 $otp_enabled = $row["otp_enabled"];
1395083e 211
d4c64ecc
AD
212 print "<tr><td width=\"40%\">".__('Full name')."</td>";
213 print "<td class=\"prefValue\"><input dojoType=\"dijit.form.ValidationTextBox\" name=\"full_name\" required=\"1\"
214 value=\"$full_name\"></td></tr>";
1395083e 215
d4c64ecc
AD
216 print "<tr><td width=\"40%\">".__('E-mail')."</td>";
217 print "<td class=\"prefValue\"><input dojoType=\"dijit.form.ValidationTextBox\" name=\"email\" required=\"1\" value=\"$email\"></td></tr>";
1395083e 218
0d421af8 219 if (!SINGLE_USER_MODE && !$_SESSION["hide_hello"]) {
949b1a94 220
70393703 221 $access_level = $row["access_level"];
d4c64ecc
AD
222 print "<tr><td width=\"40%\">".__('Access level')."</td>";
223 print "<td>" . $access_level_names[$access_level] . "</td></tr>";
224 }
1395083e 225
d4c64ecc 226 print "</table>";
1395083e 227
328118d1
AD
228 print_hidden("op", "pref-prefs");
229 print_hidden("method", "changeemail");
1395083e 230
d4c64ecc
AD
231 print "<p><button dojoType=\"dijit.form.Button\" type=\"submit\">".
232 __("Save data")."</button>";
1395083e 233
d4c64ecc 234 print "</form>";
1395083e 235
0f28f81f 236 if ($_SESSION["auth_module"]) {
1ffe3391 237 $authenticator = PluginHost::getInstance()->get_plugin($_SESSION["auth_module"]);
d5fd183d
AD
238 } else {
239 $authenticator = false;
240 }
241
242 if ($authenticator && method_exists($authenticator, "change_password")) {
1395083e 243
fb70f26e
AD
244 print "<h2>" . __("Password") . "</h2>";
245
5956f312
AD
246 print "<div style='display : none' id='pwd_change_infobox'></div>";
247
1395083e
AD
248 print "<form dojoType=\"dijit.form.Form\">";
249
250 print "<script type=\"dojo/method\" event=\"onSubmit\" args=\"evt\">
251 evt.preventDefault();
252 if (this.validate()) {
253 notify_progress('Changing password...', true);
254
255 new Ajax.Request('backend.php', {
256 parameters: dojo.objectToQuery(this.getValues()),
257 onComplete: function(transport) {
258 notify('');
259 if (transport.responseText.indexOf('ERROR: ') == 0) {
5956f312
AD
260
261 $('pwd_change_infobox').innerHTML =
262 transport.responseText.replace('ERROR: ', '');
263
1395083e 264 } else {
5956f312
AD
265 $('pwd_change_infobox').innerHTML =
266 transport.responseText.replace('ERROR: ', '');
267
1395083e
AD
268 var warn = $('default_pass_warning');
269 if (warn) Element.hide(warn);
270 }
5956f312
AD
271
272 new Effect.Appear('pwd_change_infobox');
273
1395083e
AD
274 }});
275 this.reset();
276 }
277 </script>";
278
3ca8af7f 279 if ($otp_enabled) {
9a73994c 280 print_notice(__("Changing your current password will disable OTP."));
3ca8af7f
AD
281 }
282
1395083e
AD
283 print "<table width=\"100%\" class=\"prefPrefsList\">";
284
285 print "<tr><td width=\"40%\">".__("Old password")."</td>";
286 print "<td class=\"prefValue\"><input dojoType=\"dijit.form.ValidationTextBox\" type=\"password\" required=\"1\" name=\"old_password\"></td></tr>";
287
288 print "<tr><td width=\"40%\">".__("New password")."</td>";
289
290 print "<td class=\"prefValue\"><input dojoType=\"dijit.form.ValidationTextBox\" type=\"password\" required=\"1\"
291 name=\"new_password\"></td></tr>";
292
293 print "<tr><td width=\"40%\">".__("Confirm password")."</td>";
294
295 print "<td class=\"prefValue\"><input dojoType=\"dijit.form.ValidationTextBox\" type=\"password\" required=\"1\" name=\"confirm_password\"></td></tr>";
296
297 print "</table>";
298
328118d1
AD
299 print_hidden("op", "pref-prefs");
300 print_hidden("method", "changepassword");
1395083e
AD
301
302 print "<p><button dojoType=\"dijit.form.Button\" type=\"submit\">".
303 __("Change password")."</button>";
304
305 print "</form>";
306
0f28f81f 307 if ($_SESSION["auth_module"] == "auth_internal") {
fb70f26e
AD
308
309 print "<h2>" . __("One time passwords / Authenticator") . "</h2>";
310
311 if ($otp_enabled) {
312
9a73994c 313 print_notice(__("One time passwords are currently enabled. Enter your current password below to disable."));
3ca8af7f
AD
314
315 print "<form dojoType=\"dijit.form.Form\">";
316
317 print "<script type=\"dojo/method\" event=\"onSubmit\" args=\"evt\">
318 evt.preventDefault();
319 if (this.validate()) {
320 notify_progress('Disabling OTP', true);
321
322 new Ajax.Request('backend.php', {
323 parameters: dojo.objectToQuery(this.getValues()),
324 onComplete: function(transport) {
325 notify('');
326 if (transport.responseText.indexOf('ERROR: ') == 0) {
327 notify_error(transport.responseText.replace('ERROR: ', ''));
328 } else {
329 window.location.reload();
330 }
331 }});
332 this.reset();
333 }
334 </script>";
335
336 print "<table width=\"100%\" class=\"prefPrefsList\">";
337
338 print "<tr><td width=\"40%\">".__("Enter your password")."</td>";
339
340 print "<td class=\"prefValue\"><input dojoType=\"dijit.form.ValidationTextBox\" type=\"password\" required=\"1\"
341 name=\"password\"></td></tr>";
342
343 print "</table>";
344
328118d1
AD
345 print_hidden("op", "pref-prefs");
346 print_hidden("method", "otpdisable");
3ca8af7f
AD
347
348 print "<p><button dojoType=\"dijit.form.Button\" type=\"submit\">".
349 __("Disable OTP")."</button>";
350
351 print "</form>";
fb70f26e 352
a845a3d5 353 } else if (function_exists("imagecreatefromstring")) {
fb70f26e 354
11334fdf 355 print_warning(__("You will need a compatible Authenticator to use this. Changing your password would automatically disable OTP."));
fb70f26e
AD
356
357 print "<p>".__("Scan the following code by the Authenticator application:")."</p>";
358
359 $csrf_token = $_SESSION["csrf_token"];
360
361 print "<img src=\"backend.php?op=pref-prefs&method=otpqrcode&csrf_token=$csrf_token\">";
362
363 print "<form dojoType=\"dijit.form.Form\" id=\"changeOtpForm\">";
364
328118d1
AD
365 print_hidden("op", "pref-prefs");
366 print_hidden("method", "otpenable");
fb70f26e
AD
367
368 print "<script type=\"dojo/method\" event=\"onSubmit\" args=\"evt\">
369 evt.preventDefault();
370 if (this.validate()) {
371 notify_progress('Saving data...', true);
372
373 new Ajax.Request('backend.php', {
374 parameters: dojo.objectToQuery(this.getValues()),
375 onComplete: function(transport) {
3ca8af7f 376 notify('');
9deca86d
AD
377 if (transport.responseText.indexOf('ERROR:') == 0) {
378 notify_error(transport.responseText.replace('ERROR:', ''));
3ca8af7f
AD
379 } else {
380 window.location.reload();
381 }
fb70f26e
AD
382 } });
383
384 }
385 </script>";
386
3ca8af7f
AD
387 print "<table width=\"100%\" class=\"prefPrefsList\">";
388
389 print "<tr><td width=\"40%\">".__("Enter your password")."</td>";
390
391 print "<td class=\"prefValue\"><input dojoType=\"dijit.form.ValidationTextBox\" type=\"password\" required=\"1\"
392 name=\"password\"></td></tr>";
393
9deca86d
AD
394 print "<tr><td width=\"40%\">".__("Enter the generated one time password")."</td>";
395
396 print "<td class=\"prefValue\"><input dojoType=\"dijit.form.ValidationTextBox\" autocomplete=\"off\"
397 required=\"1\"
398 name=\"otp\"></td></tr>";
3ca8af7f 399
9deca86d 400 print "<tr><td colspan=\"2\">";
fb70f26e 401
3ca8af7f
AD
402 print "</td></tr><tr><td colspan=\"2\">";
403
404 print "</td></tr>";
405 print "</table>";
406
fb70f26e 407 print "<p><button dojoType=\"dijit.form.Button\" type=\"submit\">".
3ca8af7f 408 __("Enable OTP")."</button>";
fb70f26e
AD
409
410 print "</form>";
411
a845a3d5
AD
412 } else {
413
414 print_notice(__("PHP GD functions are required for OTP support."));
415
fb70f26e
AD
416 }
417
418 }
1395083e
AD
419 }
420
1ffe3391 421 PluginHost::getInstance()->run_hooks(PluginHost::HOOK_PREFS_TAB_SECTION,
699daf58
AD
422 "hook_prefs_tab_section", "prefPrefsAuth");
423
d4c64ecc
AD
424 print "</div>"; #pane
425
1395083e
AD
426 print "<div dojoType=\"dijit.layout.AccordionPane\" selected=\"true\" title=\"".__('Preferences')."\">";
427
428 print "<form dojoType=\"dijit.form.Form\" id=\"changeSettingsForm\">";
429
122e9d78
AD
430 print "<script type=\"dojo/method\" event=\"onSubmit\" args=\"evt, quit\">
431 if (evt) evt.preventDefault();
1395083e
AD
432 if (this.validate()) {
433 console.log(dojo.objectToQuery(this.getValues()));
434
435 new Ajax.Request('backend.php', {
436 parameters: dojo.objectToQuery(this.getValues()),
437 onComplete: function(transport) {
438 var msg = transport.responseText;
29c8fa08
AD
439 if (quit) {
440 gotoMain();
441 } else {
442 if (msg == 'PREFS_NEED_RELOAD') {
443 window.location.reload();
444 } else {
445 notify_info(msg);
446 }
447 }
1395083e
AD
448 } });
449 }
450 </script>";
451
452 print '<div dojoType="dijit.layout.BorderContainer" gutters="false">';
453
454 print '<div dojoType="dijit.layout.ContentPane" region="center" style="overflow-y : auto">';
455
456 if ($_SESSION["profile"]) {
9a73994c 457 print_notice(__("Some preferences are only available in default profile."));
1395083e
AD
458 }
459
460 if ($_SESSION["profile"]) {
a42c55f0 461 initialize_user_prefs($_SESSION["uid"], $_SESSION["profile"]);
1395083e 462 } else {
a42c55f0 463 initialize_user_prefs($_SESSION["uid"]);
1395083e
AD
464 }
465
70393703 466 $sth = $this->pdo->prepare("SELECT DISTINCT
dfad9d7a 467 ttrss_user_prefs.pref_name,value,type_name,
f9ebb32c 468 ttrss_prefs_sections.order_id,
dfad9d7a 469 def_value,section_id
1395083e
AD
470 FROM ttrss_prefs,ttrss_prefs_types,ttrss_prefs_sections,ttrss_user_prefs
471 WHERE type_id = ttrss_prefs_types.id AND
70393703 472 (profile = :profile OR (:profile IS NULL AND profile IS NULL)) AND
1395083e
AD
473 section_id = ttrss_prefs_sections.id AND
474 ttrss_user_prefs.pref_name = ttrss_prefs.pref_name AND
70393703 475 owner_uid = :uid
dfad9d7a 476 ORDER BY ttrss_prefs_sections.order_id,pref_name");
70393703 477 $sth->execute([":uid" => $_SESSION['uid'], ":profile" => $_SESSION['profile']]);
1395083e
AD
478
479 $lnum = 0;
480
481 $active_section = "";
482
451ff722
AD
483 $listed_boolean_prefs = array();
484
70393703 485 while ($line = $sth->fetch()) {
1395083e
AD
486
487 if (in_array($line["pref_name"], $prefs_blacklist)) {
488 continue;
489 }
490
dfad9d7a
AD
491 $type_name = $line["type_name"];
492 $pref_name = $line["pref_name"];
493 $section_name = $this->getSectionName($line["section_id"]);
494 $value = $line["value"];
495
496 $short_desc = $this->getShortDesc($pref_name);
497 $help_text = $this->getHelpText($pref_name);
498
499 if (!$short_desc) continue;
500
1395083e
AD
501 if ($_SESSION["profile"] && in_array($line["pref_name"],
502 $profile_blacklist)) {
503 continue;
504 }
505
dfad9d7a 506 if ($active_section != $line["section_id"]) {
1395083e
AD
507
508 if ($active_section != "") {
509 print "</table>";
510 }
511
512 print "<table width=\"100%\" class=\"prefPrefsList\">";
513
dfad9d7a 514 $active_section = $line["section_id"];
1395083e 515
dfad9d7a 516 print "<tr><td colspan=\"3\"><h3>".$section_name."</h3></td></tr>";
1395083e 517
1395083e
AD
518 $lnum = 0;
519 }
520
521 print "<tr>";
522
451ff722
AD
523 print "<td width=\"40%\" class=\"prefName\" id=\"$pref_name\">";
524 print "<label for='CB_$pref_name'>";
dfad9d7a 525 print $short_desc;
451ff722 526 print "</label>";
1395083e
AD
527
528 if ($help_text) print "<div class=\"prefHelp\">".__($help_text)."</div>";
529
530 print "</td>";
531
532 print "<td class=\"prefValue\">";
533
7b149552
AD
534 if ($pref_name == "USER_LANGUAGE") {
535 print_select_hash($pref_name, $value, get_translations(),
536 "style='width : 220px; margin : 0px' dojoType='dijit.form.Select'");
537
538 } else if ($pref_name == "USER_TIMEZONE") {
1395083e
AD
539
540 $timezones = explode("\n", file_get_contents("lib/timezones.txt"));
541
542 print_select($pref_name, $value, $timezones, 'dojoType="dijit.form.FilteringSelect"');
543 } else if ($pref_name == "USER_STYLESHEET") {
544
545 print "<button dojoType=\"dijit.form.Button\"
546 onclick=\"customizeCSS()\">" . __('Customize') . "</button>";
547
5d40efc9
AD
548 } else if ($pref_name == "USER_CSS_THEME") {
549
e432b8fb 550 $themes = array_merge(glob("themes/*.php"), glob("themes/*.css"), glob("themes.local/*.css"));
b9634eb8
AD
551 $themes = array_map("basename", $themes);
552 $themes = array_filter($themes, "theme_valid");
553 asort($themes);
5d40efc9 554
22387de2
AD
555 if (!theme_valid($value)) $value = "default.php";
556
5d40efc9
AD
557 print_select($pref_name, $value, $themes,
558 'dojoType="dijit.form.Select"');
559
560
1395083e
AD
561 } else if ($pref_name == "DEFAULT_UPDATE_INTERVAL") {
562
563 global $update_intervals_nodefault;
564
565 print_select_hash($pref_name, $value, $update_intervals_nodefault,
566 'dojoType="dijit.form.Select"');
567
568 } else if ($type_name == "bool") {
569
451ff722
AD
570 array_push($listed_boolean_prefs, $pref_name);
571
572 $checked = ($value == "true") ? "checked=\"checked\"" : "";
1395083e
AD
573
574 if ($pref_name == "PURGE_UNREAD_ARTICLES" && FORCE_ARTICLE_PURGE != 0) {
575 $disabled = "disabled=\"1\"";
451ff722 576 $checked = "checked=\"checked\"";
1395083e
AD
577 } else {
578 $disabled = "";
579 }
580
451ff722
AD
581 print "<input type='checkbox' name='$pref_name' $checked $disabled
582 dojoType='dijit.form.CheckBox' id='CB_$pref_name' value='1'>";
1395083e 583
f17cac6b 584 } else if (array_search($pref_name, array('FRESH_ARTICLE_MAX_AGE',
1395083e
AD
585 'PURGE_OLD_DAYS', 'LONG_DATE_FORMAT', 'SHORT_DATE_FORMAT')) !== false) {
586
587 $regexp = ($type_name == 'integer') ? 'regexp="^\d*$"' : '';
588
589 if ($pref_name == "PURGE_OLD_DAYS" && FORCE_ARTICLE_PURGE != 0) {
590 $disabled = "disabled=\"1\"";
591 $value = FORCE_ARTICLE_PURGE;
592 } else {
593 $disabled = "";
594 }
595
596 print "<input dojoType=\"dijit.form.ValidationTextBox\"
597 required=\"1\" $regexp $disabled
598 name=\"$pref_name\" value=\"$value\">";
599
600 } else if ($pref_name == "SSL_CERT_SERIAL") {
601
602 print "<input dojoType=\"dijit.form.ValidationTextBox\"
603 id=\"SSL_CERT_SERIAL\" readonly=\"1\"
604 name=\"$pref_name\" value=\"$value\">";
605
606 $cert_serial = htmlspecialchars(get_ssl_certificate_id());
607 $has_serial = ($cert_serial) ? "false" : "true";
608
e79e274f
AD
609 print "<br/>";
610
1395083e
AD
611 print " <button dojoType=\"dijit.form.Button\" disabled=\"$has_serial\"
612 onclick=\"insertSSLserial('$cert_serial')\">" .
613 __('Register') . "</button>";
614
615 print " <button dojoType=\"dijit.form.Button\"
616 onclick=\"insertSSLserial('')\">" .
617 __('Clear') . "</button>";
618
76c843a9 619 } else if ($pref_name == 'DIGEST_PREFERRED_TIME') {
61c1812f 620 print "<input dojoType=\"dijit.form.ValidationTextBox\"
1b92f543 621 id=\"$pref_name\" regexp=\"[012]?\d:\d\d\" placeHolder=\"12:00\"
61c1812f 622 name=\"$pref_name\" value=\"$value\"><div class=\"insensitive\">".
8eba830f 623 T_sprintf("Current server time: %s (UTC)", date("H:i")) . "</div>";
1395083e
AD
624 } else {
625 $regexp = ($type_name == 'integer') ? 'regexp="^\d*$"' : '';
626
627 print "<input dojoType=\"dijit.form.ValidationTextBox\"
628 $regexp
629 name=\"$pref_name\" value=\"$value\">";
630 }
631
632 print "</td>";
633
634 print "</tr>";
635
636 $lnum++;
637 }
638
639 print "</table>";
640
451ff722
AD
641 $listed_boolean_prefs = htmlspecialchars(join(",", $listed_boolean_prefs));
642
328118d1 643 print_hidden("boolean_prefs", "$listed_boolean_prefs");
451ff722 644
1ffe3391 645 PluginHost::getInstance()->run_hooks(PluginHost::HOOK_PREFS_TAB_SECTION,
699daf58
AD
646 "hook_prefs_tab_section", "prefPrefsPrefsInside");
647
1395083e
AD
648 print '</div>'; # inside pane
649 print '<div dojoType="dijit.layout.ContentPane" region="bottom">';
650
328118d1
AD
651 print_hidden("op", "pref-prefs");
652 print_hidden("method", "saveconfig");
1395083e 653
122e9d78
AD
654 print "<div dojoType=\"dijit.form.ComboButton\" type=\"submit\">
655 <span>".__('Save configuration')."</span>
656 <div dojoType=\"dijit.DropDownMenu\">
657 <div dojoType=\"dijit.MenuItem\"
658 onclick=\"dijit.byId('changeSettingsForm').onSubmit(null, true)\">".
659 __("Save and exit preferences")."</div>
660 </div>
661 </div>";
1395083e
AD
662
663 print "<button dojoType=\"dijit.form.Button\" onclick=\"return editProfiles()\">".
664 __('Manage profiles')."</button> ";
665
666 print "<button dojoType=\"dijit.form.Button\" onclick=\"return validatePrefsReset()\">".
667 __('Reset to defaults')."</button>";
668
f9ebb32c
AD
669 print "&nbsp;";
670
1ffe3391 671 PluginHost::getInstance()->run_hooks(PluginHost::HOOK_PREFS_TAB_SECTION,
699daf58
AD
672 "hook_prefs_tab_section", "prefPrefsPrefsOutside");
673
de612e7a 674 print "</form>";
1395083e
AD
675 print '</div>'; # inner pane
676 print '</div>'; # border container
de612e7a
AD
677
678 print "</div>"; #pane
679
680 print "<div dojoType=\"dijit.layout.AccordionPane\" title=\"".__('Plugins')."\">";
681
667d32fd 682 print_notice(__("You will need to reload Tiny Tiny RSS for plugin changes to take effect."));
de612e7a 683
312742db
AD
684 if (ini_get("open_basedir") && function_exists("curl_init") && !defined("NO_CURL")) {
685 print_warning("Your PHP configuration has open_basedir restrictions enabled. Some plugins relying on CURL for functionality may not work correctly.");
686 }
687
de612e7a
AD
688 print "<form dojoType=\"dijit.form.Form\" id=\"changePluginsForm\">";
689
690 print "<script type=\"dojo/method\" event=\"onSubmit\" args=\"evt\">
691 evt.preventDefault();
692 if (this.validate()) {
693 notify_progress('Saving data...', true);
694
695 new Ajax.Request('backend.php', {
696 parameters: dojo.objectToQuery(this.getValues()),
697 onComplete: function(transport) {
698 notify('');
699 if (confirm(__('Selected plugins have been enabled. Reload?'))) {
700 window.location.reload();
701 }
702 } });
703
704 }
705 </script>";
706
328118d1
AD
707 print_hidden("op", "pref-prefs");
708 print_hidden("method", "setplugins");
de612e7a 709
65d1e250 710 print "<table width='100%' class='prefPluginsList'>";
de612e7a 711
667d32fd
AD
712 print "<tr><td colspan='5'><h3>".__("System plugins")."</h3>".
713 format_notice(__("System plugins are enabled in <strong>config.php</strong> for all users.")).
714 "</td></tr>";
de612e7a
AD
715
716 print "<tr class=\"title\">
717 <td width=\"5%\">&nbsp;</td>
718 <td width='10%'>".__('Plugin')."</td>
719 <td width=''>".__('Description')."</td>
720 <td width='5%'>".__('Version')."</td>
721 <td width='10%'>".__('Author')."</td></tr>";
722
723 $system_enabled = array_map("trim", explode(",", PLUGINS));
e130b283 724 $user_enabled = array_map("trim", explode(",", get_pref("_ENABLED_PLUGINS", $_SESSION['uid'])));
de612e7a 725
6f7798b6 726 $tmppluginhost = new PluginHost();
583f163f 727 $tmppluginhost->load_all($tmppluginhost::KIND_ALL, $_SESSION["uid"], true);
5d9abb1e 728 $tmppluginhost->load_data(true);
de612e7a
AD
729
730 foreach ($tmppluginhost->get_plugins() as $name => $plugin) {
d2a421e3 731 $about = $plugin->about();
de612e7a 732
b8774453 733 if ($about[3]) {
de612e7a
AD
734 if (in_array($name, $system_enabled)) {
735 $checked = "checked='1'";
736 } else {
737 $checked = "";
738 }
739
740 print "<tr>";
741
742 print "<td align='center'><input disabled='1'
743 dojoType=\"dijit.form.CheckBox\" $checked
744 type=\"checkbox\"></td>";
745
2f20dd58
AD
746 $plugin_icon = $checked ? "plugin.png" : "plugin_disabled.png";
747
06a39024 748 print "<td><label><img src='images/$plugin_icon' alt=''> $name</label></td>";
bb5e1a32
AD
749 print "<td>" . htmlspecialchars($about[1]);
750 if (@$about[4]) {
ba2853ca 751 print " &mdash; <a target=\"_blank\" rel=\"noopener noreferrer\" class=\"visibleLink\"
bb5e1a32
AD
752 href=\"".htmlspecialchars($about[4])."\">".__("more info")."</a>";
753 }
754 print "</td>";
de612e7a
AD
755 print "<td>" . htmlspecialchars(sprintf("%.2f", $about[0])) . "</td>";
756 print "<td>" . htmlspecialchars($about[2]) . "</td>";
757
5d9abb1e 758 if (count($tmppluginhost->get_all($plugin)) > 0) {
81c54e3d
AD
759 if (in_array($name, $system_enabled)) {
760 print "<td><a href='#' onclick=\"clearPluginData('$name')\"
761 class='visibleLink'>".__("Clear data")."</a></td>";
762 }
5d9abb1e
AD
763 }
764
de612e7a
AD
765 print "</tr>";
766
767 }
768 }
769
770 print "<tr><td colspan='4'><h3>".__("User plugins")."</h3></td></tr>";
771
772 print "<tr class=\"title\">
773 <td width=\"5%\">&nbsp;</td>
774 <td width='10%'>".__('Plugin')."</td>
775 <td width=''>".__('Description')."</td>
776 <td width='5%'>".__('Version')."</td>
777 <td width='10%'>".__('Author')."</td></tr>";
778
779
780 foreach ($tmppluginhost->get_plugins() as $name => $plugin) {
d2a421e3 781 $about = $plugin->about();
de612e7a 782
b8774453 783 if (!$about[3]) {
de612e7a
AD
784
785 if (in_array($name, $system_enabled)) {
786 $checked = "checked='1'";
787 $disabled = "disabled='1'";
65d1e250 788 $rowclass = '';
de612e7a
AD
789 } else if (in_array($name, $user_enabled)) {
790 $checked = "checked='1'";
791 $disabled = "";
65d1e250 792 $rowclass = "Selected";
de612e7a
AD
793 } else {
794 $checked = "";
795 $disabled = "";
65d1e250 796 $rowclass = '';
de612e7a
AD
797 }
798
65d1e250 799 print "<tr class='$rowclass'>";
de612e7a 800
2f20dd58
AD
801 $plugin_icon = $checked ? "plugin.png" : "plugin_disabled.png";
802
de612e7a
AD
803 print "<td align='center'><input id='FPCHK-$name' name='plugins[]' value='$name' onclick='toggleSelectRow2(this);'
804 dojoType=\"dijit.form.CheckBox\" $checked $disabled
805 type=\"checkbox\"></td>";
806
2f20dd58 807 print "<td><label for='FPCHK-$name'><img src='images/$plugin_icon' alt=''> $name</label></td>";
bb5e1a32
AD
808 print "<td><label for='FPCHK-$name'>" . htmlspecialchars($about[1]) . "</label>";
809 if (@$about[4]) {
ba2853ca 810 print " &mdash; <a target=\"_blank\" rel=\"noopener noreferrer\" class=\"visibleLink\"
bb5e1a32
AD
811 href=\"".htmlspecialchars($about[4])."\">".__("more info")."</a>";
812 }
813 print "</td>";
814
de612e7a
AD
815 print "<td>" . htmlspecialchars(sprintf("%.2f", $about[0])) . "</td>";
816 print "<td>" . htmlspecialchars($about[2]) . "</td>";
817
5d9abb1e 818 if (count($tmppluginhost->get_all($plugin)) > 0) {
81c54e3d
AD
819 if (in_array($name, $system_enabled) || in_array($name, $user_enabled)) {
820 print "<td><a href='#' onclick=\"clearPluginData('$name')\" class='visibleLink'>".__("Clear data")."</a></td>";
821 }
5d9abb1e
AD
822 }
823
de612e7a
AD
824 print "</tr>";
825
826
827
828 }
829
830 }
831
832 print "</table>";
833
834 print "<p><button dojoType=\"dijit.form.Button\" type=\"submit\">".
835 __("Enable selected plugins")."</button></p>";
836
1395083e
AD
837 print "</form>";
838
839 print "</div>"; #pane
27211afe 840
1ffe3391 841 PluginHost::getInstance()->run_hooks(PluginHost::HOOK_PREFS_TAB,
6065f3ad
AD
842 "hook_prefs_tab", "prefPrefs");
843
1395083e
AD
844 print "</div>"; #container
845 }
27211afe 846
f9ebb32c
AD
847 function toggleAdvanced() {
848 $_SESSION["prefs_show_advanced"] = !$_SESSION["prefs_show_advanced"];
849 }
fb70f26e
AD
850
851 function otpqrcode() {
852 require_once "lib/otphp/vendor/base32.php";
853 require_once "lib/otphp/lib/otp.php";
854 require_once "lib/otphp/lib/totp.php";
855 require_once "lib/phpqrcode/phpqrcode.php";
856
70393703 857 $sth = $this->pdo->prepare("SELECT login,salt,otp_enabled
fb70f26e 858 FROM ttrss_users
70393703
AD
859 WHERE id = ?");
860 $sth->execute([$_SESSION['uid']]);
fb70f26e 861
70393703 862 if ($row = $sth->fetch()) {
fb70f26e 863
70393703 864 $base32 = new Base32();
fb70f26e 865
70393703 866 $login = $row["login"];
187abfe7 867 $otp_enabled = $row["otp_enabled"];
ab85ad89 868
70393703
AD
869 if (!$otp_enabled) {
870 $secret = $base32->encode(sha1($row["salt"]));
871
872 QRcode::png("otpauth://totp/".urlencode($login).
873 "?secret=$secret&issuer=".urlencode("Tiny Tiny RSS"));
874
875 }
973392b9 876 }
fb70f26e
AD
877 }
878
3ca8af7f 879 function otpenable() {
9deca86d
AD
880 require_once "lib/otphp/vendor/base32.php";
881 require_once "lib/otphp/lib/otp.php";
882 require_once "lib/otphp/lib/totp.php";
883
884 $password = $_REQUEST["password"];
885 $otp = $_REQUEST["otp"];
3ca8af7f 886
1ffe3391 887 $authenticator = PluginHost::getInstance()->get_plugin($_SESSION["auth_module"]);
0f28f81f 888
3ca8af7f
AD
889 if ($authenticator->check_password($_SESSION["uid"], $password)) {
890
e4291ba1 891 $sth = $this->pdo->prepare("SELECT salt
9deca86d 892 FROM ttrss_users
70393703
AD
893 WHERE id = ?");
894 $sth->execute([$_SESSION['uid']]);
9deca86d 895
70393703 896 if ($row = $sth->fetch()) {
9deca86d 897
70393703 898 $base32 = new Base32();
9deca86d 899
70393703
AD
900 $secret = $base32->encode(sha1($row["salt"]));
901 $topt = new \OTPHP\TOTP($secret);
9deca86d 902
70393703 903 $otp_check = $topt->now();
3ca8af7f 904
70393703
AD
905 if ($otp == $otp_check) {
906 $sth = $this->pdo->prepare("UPDATE ttrss_users
907 SET otp_enabled = true WHERE id = ?");
908
909 $sth->execute([$_SESSION['uid']]);
910
911 print "OK";
912 } else {
913 print "ERROR:".__("Incorrect one time password");
914 }
3ca8af7f 915 }
70393703 916
3ca8af7f 917 } else {
9deca86d 918 print "ERROR:".__("Incorrect password");
3ca8af7f 919 }
fb70f26e 920
3ca8af7f
AD
921 }
922
923 function otpdisable() {
70393703 924 $password = $_REQUEST["password"];
3ca8af7f 925
1ffe3391 926 $authenticator = PluginHost::getInstance()->get_plugin($_SESSION["auth_module"]);
3ca8af7f
AD
927
928 if ($authenticator->check_password($_SESSION["uid"], $password)) {
929
70393703
AD
930 $sth = $this->pdo->prepare("UPDATE ttrss_users SET otp_enabled = false WHERE
931 id = ?");
932 $sth->execute([$_SESSION['uid']]);
3ca8af7f
AD
933
934 print "OK";
935 } else {
936 print "ERROR: ".__("Incorrect password");
fb70f26e 937 }
3ca8af7f 938
fb70f26e 939 }
de612e7a
AD
940
941 function setplugins() {
f4c02a15
AD
942 if (is_array($_REQUEST["plugins"]))
943 $plugins = join(",", $_REQUEST["plugins"]);
944 else
945 $plugins = "";
de612e7a 946
e130b283 947 set_pref("_ENABLED_PLUGINS", $plugins, $_SESSION["uid"]);
de612e7a 948 }
5d9abb1e
AD
949
950 function clearplugindata() {
70393703 951 $name = $_REQUEST["name"];
5d9abb1e 952
1ffe3391 953 PluginHost::getInstance()->clear_data(PluginHost::getInstance()->get_plugin($name));
5d9abb1e 954 }
00e34741
AD
955
956 function customizeCSS() {
a42c55f0 957 $value = get_pref("USER_STYLESHEET");
00e34741
AD
958
959 $value = str_replace("<br/>", "\n", $value);
960
5bbc4bb4 961 print_notice(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.", "css/tt-rss.css"));
00e34741 962
328118d1
AD
963 print_hidden("op", "rpc");
964 print_hidden("method", "setpref");
965 print_hidden("key", "USER_STYLESHEET");
00e34741
AD
966
967 print "<table width='100%'><tr><td>";
968 print "<textarea dojoType=\"dijit.form.SimpleTextarea\"
fb8a032a 969 style='font-size : 12px; width : 98%; height: 200px;'
00e34741
AD
970 placeHolder='body#ttrssMain { font-size : 14px; };'
971 name='value'>$value</textarea>";
972 print "</td></tr></table>";
973
974 print "<div class='dlgButtons'>";
975 print "<button dojoType=\"dijit.form.Button\"
976 onclick=\"dijit.byId('cssEditDlg').execute()\">".__('Save')."</button> ";
977 print "<button dojoType=\"dijit.form.Button\"
978 onclick=\"dijit.byId('cssEditDlg').hide()\">".__('Cancel')."</button>";
979 print "</div>";
980
981 }
982
9d76e754
AD
983 function editPrefProfiles() {
984 print "<div dojoType=\"dijit.Toolbar\">";
985
986 print "<div dojoType=\"dijit.form.DropDownButton\">".
987 "<span>" . __('Select')."</span>";
988 print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">";
989 print "<div onclick=\"selectTableRows('prefFeedProfileList', 'all')\"
990 dojoType=\"dijit.MenuItem\">".__('All')."</div>";
991 print "<div onclick=\"selectTableRows('prefFeedProfileList', 'none')\"
992 dojoType=\"dijit.MenuItem\">".__('None')."</div>";
993 print "</div></div>";
994
995 print "<div style=\"float : right\">";
996
997 print "<input name=\"newprofile\" dojoType=\"dijit.form.ValidationTextBox\"
998 required=\"1\">
999 <button dojoType=\"dijit.form.Button\"
1000 onclick=\"dijit.byId('profileEditDlg').addProfile()\">".
1001 __('Create profile')."</button></div>";
1002
1003 print "</div>";
1004
70393703
AD
1005 $sth = $this->pdo->prepare("SELECT title,id FROM ttrss_settings_profiles
1006 WHERE owner_uid = ? ORDER BY title");
1007 $sth->execute([$_SESSION['uid']]);
9d76e754
AD
1008
1009 print "<div class=\"prefProfileHolder\">";
1010
1011 print "<form id=\"profile_edit_form\" onsubmit=\"return false\">";
1012
1013 print "<table width=\"100%\" class=\"prefFeedProfileList\"
1014 cellspacing=\"0\" id=\"prefFeedProfileList\">";
1015
1016 print "<tr class=\"placeholder\" id=\"FCATR-0\">"; #odd
1017
1018 print "<td width='5%' align='center'><input
1019 id='FCATC-0'
1020 onclick='toggleSelectRow2(this);'
1021 dojoType=\"dijit.form.CheckBox\"
1022 type=\"checkbox\"></td>";
1023
1024 if (!$_SESSION["profile"]) {
1025 $is_active = __("(active)");
1026 } else {
1027 $is_active = "";
1028 }
1029
1030 print "<td><span>" .
1031 __("Default profile") . " $is_active</span></td>";
1032
1033 print "</tr>";
1034
1035 $lnum = 1;
1036
70393703 1037 while ($line = $sth->fetch()) {
9d76e754 1038
9d76e754
AD
1039 $profile_id = $line["id"];
1040 $this_row_id = "id=\"FCATR-$profile_id\"";
1041
1042 print "<tr class=\"placeholder\" $this_row_id>";
1043
1044 $edit_title = htmlspecialchars($line["title"]);
1045
1046 print "<td width='5%' align='center'><input
1047 onclick='toggleSelectRow2(this);'
1048 id='FCATC-$profile_id'
1049 dojoType=\"dijit.form.CheckBox\"
1050 type=\"checkbox\"></td>";
1051
1052 if ($_SESSION["profile"] == $line["id"]) {
1053 $is_active = __("(active)");
1054 } else {
1055 $is_active = "";
1056 }
1057
1058 print "<td><span dojoType=\"dijit.InlineEditBox\"
1059 width=\"300px\" autoSave=\"false\"
1060 profile-id=\"$profile_id\">" . $edit_title .
1061 "<script type=\"dojo/method\" event=\"onChange\" args=\"item\">
1062 var elem = this;
1063 dojo.xhrPost({
1064 url: 'backend.php',
1065 content: {op: 'rpc', method: 'saveprofile',
1066 value: this.value,
1067 id: this.srcNodeRef.getAttribute('profile-id')},
1068 load: function(response) {
1069 elem.attr('value', response);
1070 }
1071 });
1072 </script>
1073 </span> $is_active</td>";
1074
1075 print "</tr>";
1076
1077 ++$lnum;
1078 }
1079
1080 print "</table>";
1081 print "</form>";
1082 print "</div>";
1083
1084 print "<div class='dlgButtons'>
1085 <div style='float : left'>
1086 <button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('profileEditDlg').removeSelected()\">".
1087 __('Remove selected profiles')."</button>
1088 <button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('profileEditDlg').activateProfile()\">".
1089 __('Activate profile')."</button>
1090 </div>";
1091
1092 print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('profileEditDlg').hide()\">".
1093 __('Close this window')."</button>";
1094 print "</div>";
1095
1096 }
1097
dfad9d7a
AD
1098 private function getShortDesc($pref_name) {
1099 if (isset($this->pref_help[$pref_name])) {
1100 return $this->pref_help[$pref_name][0];
1101 }
1102 return "";
1103 }
9d76e754 1104
dfad9d7a
AD
1105 private function getHelpText($pref_name) {
1106 if (isset($this->pref_help[$pref_name])) {
1107 return $this->pref_help[$pref_name][1];
1108 }
1109 return "";
1110 }
1111
1112 private function getSectionName($id) {
1113 if (isset($this->pref_sections[$id])) {
1114 return $this->pref_sections[$id];
1115 }
1116
1117 return "";
1118 }
ea79a0e0 1119}