Esempio n. 1
0
function startup_gettext()
{
    # Get locale from Accept-Language header
    $lang = al2gt(array_keys(get_translations()), "text/html");
    if (defined('_TRANSLATION_OVERRIDE_DEFAULT')) {
        $lang = _TRANSLATION_OVERRIDE_DEFAULT;
    }
    if ($_SESSION["uid"] && get_schema_version() >= 120) {
        $pref_lang = get_pref("USER_LANGUAGE", $_SESSION["uid"]);
        if ($pref_lang && $pref_lang != 'auto') {
            $lang = $pref_lang;
        }
    }
    if ($lang) {
        if (defined('LC_MESSAGES')) {
            _setlocale(LC_MESSAGES, $lang);
        } else {
            if (defined('LC_ALL')) {
                _setlocale(LC_ALL, $lang);
            }
        }
        _bindtextdomain("messages", "locale");
        _textdomain("messages");
        _bind_textdomain_codeset("messages", "UTF-8");
    }
}
Esempio n. 2
0
function startup_gettext()
{
    # Get locale from Accept-Language header
    $lang = al2gt(array_keys(get_translations()), "text/html");
    if (defined('_TRANSLATION_OVERRIDE_DEFAULT')) {
        $lang = _TRANSLATION_OVERRIDE_DEFAULT;
    }
    /* In login action of mobile version */
    if ($_POST["language"] && defined('MOBILE_VERSION')) {
        $lang = $_POST["language"];
    } else {
        if ($_SESSION["language"] && $_SESSION["language"] != "auto") {
            $lang = $_SESSION["language"];
        }
    }
    if ($lang) {
        if (defined('LC_MESSAGES')) {
            _setlocale(LC_MESSAGES, $lang);
        } else {
            if (defined('LC_ALL')) {
                _setlocale(LC_ALL, $lang);
            }
        }
        if (defined('MOBILE_VERSION')) {
            _bindtextdomain("messages", "../locale");
        } else {
            _bindtextdomain("messages", "locale");
        }
        _textdomain("messages");
        _bind_textdomain_codeset("messages", "UTF-8");
    }
}
Esempio n. 3
0
<?php

include BASE_PATH . 'app/utils/initialize.php';
$country_id = get_country_id($first);
echo $twig->render('article.html', array('data' => $data, 'utils' => $utils, 'link' => get_article_link($url), 'countries' => get_countries($first), 'translations' => get_translations($country_id)));
 function index()
 {
     global $access_level_names;
     $prefs_blacklist = array("STRIP_UNSAFE_TAGS", "REVERSE_HEADLINES", "SORT_HEADLINES_BY_FEED_DATE", "DEFAULT_ARTICLE_LIMIT", "FEEDS_SORT_BY_UNREAD");
     /* "FEEDS_SORT_BY_UNREAD", "HIDE_READ_FEEDS", "REVERSE_HEADLINES" */
     $profile_blacklist = array("ALLOW_DUPLICATE_POSTS", "PURGE_OLD_DAYS", "PURGE_UNREAD_ARTICLES", "DIGEST_ENABLE", "DIGEST_CATCHUP", "BLACKLISTED_TAGS", "ENABLE_API_ACCESS", "UPDATE_POST_ON_CHECKSUM_CHANGE", "DEFAULT_UPDATE_INTERVAL", "USER_TIMEZONE", "SORT_HEADLINES_BY_FEED_DATE", "SSL_CERT_SERIAL", "DIGEST_PREFERRED_TIME");
     $_SESSION["prefs_op_result"] = "";
     print "<div dojoType=\"dijit.layout.AccordionContainer\" region=\"center\">";
     print "<div dojoType=\"dijit.layout.AccordionPane\" title=\"" . __('Personal data / Authentication') . "\">";
     print "<form dojoType=\"dijit.form.Form\" id=\"changeUserdataForm\">";
     print "<script type=\"dojo/method\" event=\"onSubmit\" args=\"evt\">\n\t\tevt.preventDefault();\n\t\tif (this.validate()) {\n\t\t\tnotify_progress('Saving data...', true);\n\n\t\t\tnew Ajax.Request('backend.php', {\n\t\t\t\tparameters: dojo.objectToQuery(this.getValues()),\n\t\t\t\tonComplete: function(transport) {\n\t\t\t\t\tnotify_callback2(transport);\n\t\t\t} });\n\n\t\t}\n\t\t</script>";
     print "<table width=\"100%\" class=\"prefPrefsList\">";
     print "<h2>" . __("Personal data") . "</h2>";
     $result = $this->dbh->query("SELECT email,full_name,otp_enabled,\n\t\t\taccess_level FROM ttrss_users\n\t\t\tWHERE id = " . $_SESSION["uid"]);
     $email = htmlspecialchars($this->dbh->fetch_result($result, 0, "email"));
     $full_name = htmlspecialchars($this->dbh->fetch_result($result, 0, "full_name"));
     $otp_enabled = sql_bool_to_bool($this->dbh->fetch_result($result, 0, "otp_enabled"));
     print "<tr><td width=\"40%\">" . __('Full name') . "</td>";
     print "<td class=\"prefValue\"><input dojoType=\"dijit.form.ValidationTextBox\" name=\"full_name\" required=\"1\"\n\t\t\tvalue=\"{$full_name}\"></td></tr>";
     print "<tr><td width=\"40%\">" . __('E-mail') . "</td>";
     print "<td class=\"prefValue\"><input dojoType=\"dijit.form.ValidationTextBox\" name=\"email\" required=\"1\" value=\"{$email}\"></td></tr>";
     if (!SINGLE_USER_MODE && !$_SESSION["hide_hello"]) {
         $access_level = $this->dbh->fetch_result($result, 0, "access_level");
         print "<tr><td width=\"40%\">" . __('Access level') . "</td>";
         print "<td>" . $access_level_names[$access_level] . "</td></tr>";
     }
     print "</table>";
     print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pref-prefs\">";
     print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"changeemail\">";
     print "<p><button dojoType=\"dijit.form.Button\" type=\"submit\">" . __("Save data") . "</button>";
     print "</form>";
     if ($_SESSION["auth_module"]) {
         $authenticator = PluginHost::getInstance()->get_plugin($_SESSION["auth_module"]);
     } else {
         $authenticator = false;
     }
     if ($authenticator && method_exists($authenticator, "change_password")) {
         print "<h2>" . __("Password") . "</h2>";
         $result = $this->dbh->query("SELECT id FROM ttrss_users\n\t\t\t\tWHERE id = " . $_SESSION["uid"] . " AND pwd_hash\n\t\t\t\t= 'SHA1:5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8'");
         if ($this->dbh->num_rows($result) != 0) {
             print format_warning(__("Your password is at default value, please change it."), "default_pass_warning");
         }
         print "<form dojoType=\"dijit.form.Form\">";
         print "<script type=\"dojo/method\" event=\"onSubmit\" args=\"evt\">\n\t\t\tevt.preventDefault();\n\t\t\tif (this.validate()) {\n\t\t\t\tnotify_progress('Changing password...', true);\n\n\t\t\t\tnew Ajax.Request('backend.php', {\n\t\t\t\t\tparameters: dojo.objectToQuery(this.getValues()),\n\t\t\t\t\tonComplete: function(transport) {\n\t\t\t\t\t\tnotify('');\n\t\t\t\t\t\tif (transport.responseText.indexOf('ERROR: ') == 0) {\n\t\t\t\t\t\t\tnotify_error(transport.responseText.replace('ERROR: ', ''));\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tnotify_info(transport.responseText);\n\t\t\t\t\t\t\tvar warn = \$('default_pass_warning');\n\t\t\t\t\t\t\tif (warn) Element.hide(warn);\n\t\t\t\t\t\t}\n\t\t\t\t}});\n\t\t\t\tthis.reset();\n\t\t\t}\n\t\t\t</script>";
         if ($otp_enabled) {
             print_notice(__("Changing your current password will disable OTP."));
         }
         print "<table width=\"100%\" class=\"prefPrefsList\">";
         print "<tr><td width=\"40%\">" . __("Old password") . "</td>";
         print "<td class=\"prefValue\"><input dojoType=\"dijit.form.ValidationTextBox\" type=\"password\" required=\"1\" name=\"old_password\"></td></tr>";
         print "<tr><td width=\"40%\">" . __("New password") . "</td>";
         print "<td class=\"prefValue\"><input dojoType=\"dijit.form.ValidationTextBox\" type=\"password\" required=\"1\"\n\t\t\t\tname=\"new_password\"></td></tr>";
         print "<tr><td width=\"40%\">" . __("Confirm password") . "</td>";
         print "<td class=\"prefValue\"><input dojoType=\"dijit.form.ValidationTextBox\" type=\"password\" required=\"1\" name=\"confirm_password\"></td></tr>";
         print "</table>";
         print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pref-prefs\">";
         print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"changepassword\">";
         print "<p><button dojoType=\"dijit.form.Button\" type=\"submit\">" . __("Change password") . "</button>";
         print "</form>";
         if ($_SESSION["auth_module"] == "auth_internal") {
             print "<h2>" . __("One time passwords / Authenticator") . "</h2>";
             if ($otp_enabled) {
                 print_notice(__("One time passwords are currently enabled. Enter your current password below to disable."));
                 print "<form dojoType=\"dijit.form.Form\">";
                 print "<script type=\"dojo/method\" event=\"onSubmit\" args=\"evt\">\n\t\t\t\tevt.preventDefault();\n\t\t\t\tif (this.validate()) {\n\t\t\t\t\tnotify_progress('Disabling OTP', true);\n\n\t\t\t\t\tnew Ajax.Request('backend.php', {\n\t\t\t\t\t\tparameters: dojo.objectToQuery(this.getValues()),\n\t\t\t\t\t\tonComplete: function(transport) {\n\t\t\t\t\t\t\tnotify('');\n\t\t\t\t\t\t\tif (transport.responseText.indexOf('ERROR: ') == 0) {\n\t\t\t\t\t\t\t\tnotify_error(transport.responseText.replace('ERROR: ', ''));\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\twindow.location.reload();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t}});\n\t\t\t\t\tthis.reset();\n\t\t\t\t}\n\t\t\t\t</script>";
                 print "<table width=\"100%\" class=\"prefPrefsList\">";
                 print "<tr><td width=\"40%\">" . __("Enter your password") . "</td>";
                 print "<td class=\"prefValue\"><input dojoType=\"dijit.form.ValidationTextBox\" type=\"password\" required=\"1\"\n\t\t\t\t\tname=\"password\"></td></tr>";
                 print "</table>";
                 print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pref-prefs\">";
                 print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"otpdisable\">";
                 print "<p><button dojoType=\"dijit.form.Button\" type=\"submit\">" . __("Disable OTP") . "</button>";
                 print "</form>";
             } else {
                 if (function_exists("imagecreatefromstring")) {
                     print_warning(__("You will need a compatible Authenticator to use this. Changing your password would automatically disable OTP."));
                     print "<p>" . __("Scan the following code by the Authenticator application:") . "</p>";
                     $csrf_token = $_SESSION["csrf_token"];
                     print "<img src=\"backend.php?op=pref-prefs&method=otpqrcode&csrf_token={$csrf_token}\">";
                     print "<form dojoType=\"dijit.form.Form\" id=\"changeOtpForm\">";
                     print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pref-prefs\">";
                     print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"otpenable\">";
                     print "<script type=\"dojo/method\" event=\"onSubmit\" args=\"evt\">\n\t\t\t\t\tevt.preventDefault();\n\t\t\t\t\tif (this.validate()) {\n\t\t\t\t\t\tnotify_progress('Saving data...', true);\n\n\t\t\t\t\t\tnew Ajax.Request('backend.php', {\n\t\t\t\t\t\t\tparameters: dojo.objectToQuery(this.getValues()),\n\t\t\t\t\t\t\tonComplete: function(transport) {\n\t\t\t\t\t\t\t\tnotify('');\n\t\t\t\t\t\t\t\tif (transport.responseText.indexOf('ERROR:') == 0) {\n\t\t\t\t\t\t\t\t\tnotify_error(transport.responseText.replace('ERROR:', ''));\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\twindow.location.reload();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} });\n\n\t\t\t\t\t}\n\t\t\t\t\t</script>";
                     print "<table width=\"100%\" class=\"prefPrefsList\">";
                     print "<tr><td width=\"40%\">" . __("Enter your password") . "</td>";
                     print "<td class=\"prefValue\"><input dojoType=\"dijit.form.ValidationTextBox\" type=\"password\" required=\"1\"\n\t\t\t\t\t\tname=\"password\"></td></tr>";
                     print "<tr><td width=\"40%\">" . __("Enter the generated one time password") . "</td>";
                     print "<td class=\"prefValue\"><input dojoType=\"dijit.form.ValidationTextBox\" autocomplete=\"off\"\n\t\t\t\t\t\trequired=\"1\"\n\t\t\t\t\t\tname=\"otp\"></td></tr>";
                     print "<tr><td colspan=\"2\">";
                     print "</td></tr><tr><td colspan=\"2\">";
                     print "</td></tr>";
                     print "</table>";
                     print "<p><button dojoType=\"dijit.form.Button\" type=\"submit\">" . __("Enable OTP") . "</button>";
                     print "</form>";
                 } else {
                     print_notice(__("PHP GD functions are required for OTP support."));
                 }
             }
         }
     }
     PluginHost::getInstance()->run_hooks(PluginHost::HOOK_PREFS_TAB_SECTION, "hook_prefs_tab_section", "prefPrefsAuth");
     print "</div>";
     #pane
     print "<div dojoType=\"dijit.layout.AccordionPane\" selected=\"true\" title=\"" . __('Preferences') . "\">";
     print "<form dojoType=\"dijit.form.Form\" id=\"changeSettingsForm\">";
     print "<script type=\"dojo/method\" event=\"onSubmit\" args=\"evt, quit\">\n\t\tif (evt) evt.preventDefault();\n\t\tif (this.validate()) {\n\t\t\tconsole.log(dojo.objectToQuery(this.getValues()));\n\n\t\t\tnew Ajax.Request('backend.php', {\n\t\t\t\tparameters: dojo.objectToQuery(this.getValues()),\n\t\t\t\tonComplete: function(transport) {\n\t\t\t\t\tvar msg = transport.responseText;\n\t\t\t\t\tif (quit) {\n\t\t\t\t\t\tgotoMain();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (msg == 'PREFS_NEED_RELOAD') {\n\t\t\t\t\t\t\twindow.location.reload();\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tnotify_info(msg);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t} });\n\t\t}\n\t\t</script>";
     print '<div dojoType="dijit.layout.BorderContainer" gutters="false">';
     print '<div dojoType="dijit.layout.ContentPane" region="center" style="overflow-y : auto">';
     if ($_SESSION["profile"]) {
         print_notice(__("Some preferences are only available in default profile."));
     }
     if ($_SESSION["profile"]) {
         initialize_user_prefs($_SESSION["uid"], $_SESSION["profile"]);
         $profile_qpart = "profile = '" . $_SESSION["profile"] . "'";
     } else {
         initialize_user_prefs($_SESSION["uid"]);
         $profile_qpart = "profile IS NULL";
     }
     /* if ($_SESSION["prefs_show_advanced"])
     			$access_query = "true";
     		else
     			$access_query = "(access_level = 0 AND section_id != 3)"; */
     $access_query = 'true';
     $result = $this->dbh->query("SELECT DISTINCT\n\t\t\tttrss_user_prefs.pref_name,value,type_name,\n\t\t\tttrss_prefs_sections.order_id,\n\t\t\tdef_value,section_id\n\t\t\tFROM ttrss_prefs,ttrss_prefs_types,ttrss_prefs_sections,ttrss_user_prefs\n\t\t\tWHERE type_id = ttrss_prefs_types.id AND\n\t\t\t\t{$profile_qpart} AND\n\t\t\t\tsection_id = ttrss_prefs_sections.id AND\n\t\t\t\tttrss_user_prefs.pref_name = ttrss_prefs.pref_name AND\n\t\t\t\t{$access_query} AND\n\t\t\t\towner_uid = " . $_SESSION["uid"] . "\n\t\t\tORDER BY ttrss_prefs_sections.order_id,pref_name");
     $lnum = 0;
     $active_section = "";
     $listed_boolean_prefs = array();
     while ($line = $this->dbh->fetch_assoc($result)) {
         if (in_array($line["pref_name"], $prefs_blacklist)) {
             continue;
         }
         $type_name = $line["type_name"];
         $pref_name = $line["pref_name"];
         $section_name = $this->getSectionName($line["section_id"]);
         $value = $line["value"];
         $short_desc = $this->getShortDesc($pref_name);
         $help_text = $this->getHelpText($pref_name);
         if (!$short_desc) {
             continue;
         }
         if ($_SESSION["profile"] && in_array($line["pref_name"], $profile_blacklist)) {
             continue;
         }
         if ($active_section != $line["section_id"]) {
             if ($active_section != "") {
                 print "</table>";
             }
             print "<table width=\"100%\" class=\"prefPrefsList\">";
             $active_section = $line["section_id"];
             print "<tr><td colspan=\"3\"><h3>" . $section_name . "</h3></td></tr>";
             $lnum = 0;
         }
         print "<tr>";
         print "<td width=\"40%\" class=\"prefName\" id=\"{$pref_name}\">";
         print "<label for='CB_{$pref_name}'>";
         print $short_desc;
         print "</label>";
         if ($help_text) {
             print "<div class=\"prefHelp\">" . __($help_text) . "</div>";
         }
         print "</td>";
         print "<td class=\"prefValue\">";
         if ($pref_name == "USER_LANGUAGE") {
             print_select_hash($pref_name, $value, get_translations(), "style='width : 220px; margin : 0px' dojoType='dijit.form.Select'");
         } else {
             if ($pref_name == "USER_TIMEZONE") {
                 $timezones = explode("\n", file_get_contents("lib/timezones.txt"));
                 print_select($pref_name, $value, $timezones, 'dojoType="dijit.form.FilteringSelect"');
             } else {
                 if ($pref_name == "USER_STYLESHEET") {
                     print "<button dojoType=\"dijit.form.Button\"\n\t\t\t\t\tonclick=\"customizeCSS()\">" . __('Customize') . "</button>";
                 } else {
                     if ($pref_name == "USER_CSS_THEME") {
                         $themes = array_map("basename", glob("themes/*.css"));
                         print_select($pref_name, $value, $themes, 'dojoType="dijit.form.Select"');
                     } else {
                         if ($pref_name == "DEFAULT_UPDATE_INTERVAL") {
                             global $update_intervals_nodefault;
                             print_select_hash($pref_name, $value, $update_intervals_nodefault, 'dojoType="dijit.form.Select"');
                         } else {
                             if ($type_name == "bool") {
                                 array_push($listed_boolean_prefs, $pref_name);
                                 $checked = $value == "true" ? "checked=\"checked\"" : "";
                                 if ($pref_name == "PURGE_UNREAD_ARTICLES" && FORCE_ARTICLE_PURGE != 0) {
                                     $disabled = "disabled=\"1\"";
                                     $checked = "checked=\"checked\"";
                                 } else {
                                     $disabled = "";
                                 }
                                 print "<input type='checkbox' name='{$pref_name}' {$checked} {$disabled}\n\t\t\t\t\tdojoType='dijit.form.CheckBox' id='CB_{$pref_name}' value='1'>";
                             } else {
                                 if (array_search($pref_name, array('FRESH_ARTICLE_MAX_AGE', 'PURGE_OLD_DAYS', 'LONG_DATE_FORMAT', 'SHORT_DATE_FORMAT')) !== false) {
                                     $regexp = $type_name == 'integer' ? 'regexp="^\\d*$"' : '';
                                     if ($pref_name == "PURGE_OLD_DAYS" && FORCE_ARTICLE_PURGE != 0) {
                                         $disabled = "disabled=\"1\"";
                                         $value = FORCE_ARTICLE_PURGE;
                                     } else {
                                         $disabled = "";
                                     }
                                     print "<input dojoType=\"dijit.form.ValidationTextBox\"\n\t\t\t\t\trequired=\"1\" {$regexp} {$disabled}\n\t\t\t\t\tname=\"{$pref_name}\" value=\"{$value}\">";
                                 } else {
                                     if ($pref_name == "SSL_CERT_SERIAL") {
                                         print "<input dojoType=\"dijit.form.ValidationTextBox\"\n\t\t\t\t\tid=\"SSL_CERT_SERIAL\" readonly=\"1\"\n\t\t\t\t\tname=\"{$pref_name}\" value=\"{$value}\">";
                                         $cert_serial = htmlspecialchars(get_ssl_certificate_id());
                                         $has_serial = $cert_serial ? "false" : "true";
                                         print " <button dojoType=\"dijit.form.Button\" disabled=\"{$has_serial}\"\n\t\t\t\t\tonclick=\"insertSSLserial('{$cert_serial}')\">" . __('Register') . "</button>";
                                         print " <button dojoType=\"dijit.form.Button\"\n\t\t\t\t\tonclick=\"insertSSLserial('')\">" . __('Clear') . "</button>";
                                     } else {
                                         if ($pref_name == 'DIGEST_PREFERRED_TIME') {
                                             print "<input dojoType=\"dijit.form.ValidationTextBox\"\n\t\t\t\t\tid=\"{$pref_name}\" regexp=\"[012]?\\d:\\d\\d\" placeHolder=\"12:00\"\n\t\t\t\t\tname=\"{$pref_name}\" value=\"{$value}\"><div class=\"insensitive\">" . T_sprintf("Current server time: %s (UTC)", date("H:i")) . "</div>";
                                         } else {
                                             $regexp = $type_name == 'integer' ? 'regexp="^\\d*$"' : '';
                                             print "<input dojoType=\"dijit.form.ValidationTextBox\"\n\t\t\t\t\t{$regexp}\n\t\t\t\t\tname=\"{$pref_name}\" value=\"{$value}\">";
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
         print "</td>";
         print "</tr>";
         $lnum++;
     }
     print "</table>";
     $listed_boolean_prefs = htmlspecialchars(join(",", $listed_boolean_prefs));
     print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"boolean_prefs\" value=\"{$listed_boolean_prefs}\">";
     PluginHost::getInstance()->run_hooks(PluginHost::HOOK_PREFS_TAB_SECTION, "hook_prefs_tab_section", "prefPrefsPrefsInside");
     print '</div>';
     # inside pane
     print '<div dojoType="dijit.layout.ContentPane" region="bottom">';
     print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pref-prefs\">";
     print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"saveconfig\">";
     print "<div dojoType=\"dijit.form.ComboButton\" type=\"submit\">\n\t\t\t<span>" . __('Save configuration') . "</span>\n\t\t\t<div dojoType=\"dijit.DropDownMenu\">\n\t\t\t\t<div dojoType=\"dijit.MenuItem\"\n\t\t\t\t\tonclick=\"dijit.byId('changeSettingsForm').onSubmit(null, true)\">" . __("Save and exit preferences") . "</div>\n\t\t\t</div>\n\t\t\t</div>";
     print "<button dojoType=\"dijit.form.Button\" onclick=\"return editProfiles()\">" . __('Manage profiles') . "</button> ";
     print "<button dojoType=\"dijit.form.Button\" onclick=\"return validatePrefsReset()\">" . __('Reset to defaults') . "</button>";
     print "&nbsp;";
     /* $checked = $_SESSION["prefs_show_advanced"] ? "checked='1'" : "";
     
     		print "<input onclick='toggleAdvancedPrefs()'
     				id='prefs_show_advanced'
     				dojoType=\"dijit.form.CheckBox\"
     				$checked
     				type=\"checkbox\"></input>
     				<label for='prefs_show_advanced'>" .
     				__("Show additional preferences") . "</label>"; */
     PluginHost::getInstance()->run_hooks(PluginHost::HOOK_PREFS_TAB_SECTION, "hook_prefs_tab_section", "prefPrefsPrefsOutside");
     print "</form>";
     print '</div>';
     # inner pane
     print '</div>';
     # border container
     print "</div>";
     #pane
     print "<div dojoType=\"dijit.layout.AccordionPane\" title=\"" . __('Plugins') . "\">";
     print "<p>" . __("You will need to reload Tiny Tiny RSS for plugin changes to take effect.") . "</p>";
     print_notice(__("Download more plugins at tt-rss.org <a class=\"visibleLink\" target=\"_blank\" href=\"http://tt-rss.org/forum/viewforum.php?f=22\">forums</a> or <a target=\"_blank\" class=\"visibleLink\" href=\"http://tt-rss.org/wiki/Plugins\">wiki</a>."));
     print "<form dojoType=\"dijit.form.Form\" id=\"changePluginsForm\">";
     print "<script type=\"dojo/method\" event=\"onSubmit\" args=\"evt\">\n\t\tevt.preventDefault();\n\t\tif (this.validate()) {\n\t\t\tnotify_progress('Saving data...', true);\n\n\t\t\tnew Ajax.Request('backend.php', {\n\t\t\t\tparameters: dojo.objectToQuery(this.getValues()),\n\t\t\t\tonComplete: function(transport) {\n\t\t\t\t\tnotify('');\n\t\t\t\t\tif (confirm(__('Selected plugins have been enabled. Reload?'))) {\n\t\t\t\t\t\twindow.location.reload();\n\t\t\t\t\t}\n\t\t\t} });\n\n\t\t}\n\t\t</script>";
     print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pref-prefs\">";
     print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"setplugins\">";
     print "<table width='100%' class='prefPluginsList'>";
     print "<tr><td colspan='4'><h3>" . __("System plugins") . "</h3></td></tr>";
     print "<tr class=\"title\">\n\t\t\t\t<td width=\"5%\">&nbsp;</td>\n\t\t\t\t<td width='10%'>" . __('Plugin') . "</td>\n\t\t\t\t<td width=''>" . __('Description') . "</td>\n\t\t\t\t<td width='5%'>" . __('Version') . "</td>\n\t\t\t\t<td width='10%'>" . __('Author') . "</td></tr>";
     $system_enabled = array_map("trim", explode(",", PLUGINS));
     $user_enabled = array_map("trim", explode(",", get_pref("_ENABLED_PLUGINS")));
     $tmppluginhost = new PluginHost();
     $tmppluginhost->load_all($tmppluginhost::KIND_ALL, $_SESSION["uid"]);
     $tmppluginhost->load_data(true);
     foreach ($tmppluginhost->get_plugins() as $name => $plugin) {
         $about = $plugin->about();
         if ($about[3] && strpos($name, "example") === FALSE) {
             if (in_array($name, $system_enabled)) {
                 $checked = "checked='1'";
             } else {
                 $checked = "";
             }
             print "<tr>";
             print "<td align='center'><input disabled='1'\n\t\t\t\t\t\tdojoType=\"dijit.form.CheckBox\" {$checked}\n\t\t\t\t\t\ttype=\"checkbox\"></td>";
             $plugin_icon = $checked ? "plugin.png" : "plugin_disabled.png";
             print "<td><label><img src='images/{$plugin_icon}' alt=''> {$name}</label></td>";
             print "<td>" . htmlspecialchars($about[1]);
             if (@$about[4]) {
                 print " &mdash; <a target=\"_blank\" class=\"visibleLink\"\n\t\t\t\t\t\thref=\"" . htmlspecialchars($about[4]) . "\">" . __("more info") . "</a>";
             }
             print "</td>";
             print "<td>" . htmlspecialchars(sprintf("%.2f", $about[0])) . "</td>";
             print "<td>" . htmlspecialchars($about[2]) . "</td>";
             if (count($tmppluginhost->get_all($plugin)) > 0) {
                 if (in_array($name, $system_enabled)) {
                     print "<td><a href='#' onclick=\"clearPluginData('{$name}')\"\n\t\t\t\t\t\t\tclass='visibleLink'>" . __("Clear data") . "</a></td>";
                 }
             }
             print "</tr>";
         }
     }
     print "<tr><td colspan='4'><h3>" . __("User plugins") . "</h3></td></tr>";
     print "<tr class=\"title\">\n\t\t\t\t<td width=\"5%\">&nbsp;</td>\n\t\t\t\t<td width='10%'>" . __('Plugin') . "</td>\n\t\t\t\t<td width=''>" . __('Description') . "</td>\n\t\t\t\t<td width='5%'>" . __('Version') . "</td>\n\t\t\t\t<td width='10%'>" . __('Author') . "</td></tr>";
     foreach ($tmppluginhost->get_plugins() as $name => $plugin) {
         $about = $plugin->about();
         if (!$about[3] && strpos($name, "example") === FALSE) {
             if (in_array($name, $system_enabled)) {
                 $checked = "checked='1'";
                 $disabled = "disabled='1'";
                 $rowclass = '';
             } else {
                 if (in_array($name, $user_enabled)) {
                     $checked = "checked='1'";
                     $disabled = "";
                     $rowclass = "Selected";
                 } else {
                     $checked = "";
                     $disabled = "";
                     $rowclass = '';
                 }
             }
             print "<tr class='{$rowclass}'>";
             $plugin_icon = $checked ? "plugin.png" : "plugin_disabled.png";
             print "<td align='center'><input id='FPCHK-{$name}' name='plugins[]' value='{$name}' onclick='toggleSelectRow2(this);'\n\t\t\t\t\tdojoType=\"dijit.form.CheckBox\" {$checked} {$disabled}\n\t\t\t\t\ttype=\"checkbox\"></td>";
             print "<td><label for='FPCHK-{$name}'><img src='images/{$plugin_icon}' alt=''> {$name}</label></td>";
             print "<td><label for='FPCHK-{$name}'>" . htmlspecialchars($about[1]) . "</label>";
             if (@$about[4]) {
                 print " &mdash; <a target=\"_blank\" class=\"visibleLink\"\n\t\t\t\t\t\thref=\"" . htmlspecialchars($about[4]) . "\">" . __("more info") . "</a>";
             }
             print "</td>";
             print "<td>" . htmlspecialchars(sprintf("%.2f", $about[0])) . "</td>";
             print "<td>" . htmlspecialchars($about[2]) . "</td>";
             if (count($tmppluginhost->get_all($plugin)) > 0) {
                 if (in_array($name, $system_enabled) || in_array($name, $user_enabled)) {
                     print "<td><a href='#' onclick=\"clearPluginData('{$name}')\" class='visibleLink'>" . __("Clear data") . "</a></td>";
                 }
             }
             print "</tr>";
         }
     }
     print "</table>";
     print "<p><button dojoType=\"dijit.form.Button\" type=\"submit\">" . __("Enable selected plugins") . "</button></p>";
     print "</form>";
     print "</div>";
     #pane
     PluginHost::getInstance()->run_hooks(PluginHost::HOOK_PREFS_TAB, "hook_prefs_tab", "prefPrefs");
     print "</div>";
     #container
 }
Esempio n. 5
0
echo __("Password:"******"right"><input type="password" name="password"
				onchange="fetchProfiles()" onfocus="fetchProfiles()"
				value="<?php 
echo get_remote_fakepass($link);
?>
"></td></tr>
			<tr><td align="right"><?php 
echo __("Language:");
?>
</td>
			<td align="right">
			<?php 
print_select_hash("language", $_COOKIE["ttrss_lang"], get_translations(), "style='width : 100%' onchange='languageChange(this)'");
?>
			</td></tr>

			<tr><td align="right"><?php 
echo __("Profile:");
?>
</td>
			<td align="right" id="profile_box">
			<select style='width : 100%' disabled='1'>
				<option><?php 
echo __("Default profile");
?>
</option></select>
			</td></tr>
</label>
			<input type="password" name="password" required="1"
					style="width : 220px" class="input"
					value="<?php 
echo $_SESSION["fake_password"];
?>
"/>
		</div>

		<div class="row">
			<label><?php 
echo __("Language:");
?>
</label>
			<?php 
print_select_hash("language", $_COOKIE["ttrss_lang"], get_translations(), "style='width : 220px; margin : 0px' dojoType='dijit.form.Select'");
?>
		</div>

		<div class="row">
			<label><?php 
echo __("Profile:");
?>
</label>

			<span id='profile_box'><select disabled='disabled' dojoType='dijit.form.Select'
				style='width : 220px; margin : 0px'>
				<option><?php 
echo __("Default profile");
?>
</option></select></span>
    function sharepopup()
    {
        if (SINGLE_USER_MODE) {
            login_sequence($this->link);
        }
        header('Content-Type: text/html; charset=utf-8');
        print "<html>\n\t\t\t\t<head>\n\t\t\t\t\t<title>Tiny Tiny RSS</title>\n\t\t\t\t\t<link rel=\"stylesheet\" type=\"text/css\" href=\"utility.css\">\n\t\t\t\t\t<script type=\"text/javascript\" src=\"lib/prototype.js\"></script>\n\t\t\t\t\t<script type=\"text/javascript\" src=\"lib/scriptaculous/scriptaculous.js?load=effects,dragdrop,controls\"></script>\n\t\t\t\t\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/>\n\t\t\t\t</head>\n\t\t\t\t<body id='sharepopup'>";
        $action = $_REQUEST["action"];
        if ($_SESSION["uid"]) {
            if ($action == 'share') {
                $title = db_escape_string(strip_tags($_REQUEST["title"]));
                $url = db_escape_string(strip_tags($_REQUEST["url"]));
                $content = db_escape_string(strip_tags($_REQUEST["content"]));
                $labels = db_escape_string(strip_tags($_REQUEST["labels"]));
                Article::create_published_article($this->link, $title, $url, $content, $labels, $_SESSION["uid"]);
                print "<script type='text/javascript'>";
                print "window.close();";
                print "</script>";
            } else {
                $title = htmlspecialchars($_REQUEST["title"]);
                $url = htmlspecialchars($_REQUEST["url"]);
                ?>

				<table height='100%' width='100%'><tr><td colspan='2'>
				<h1><?php 
                echo __("Share with Tiny Tiny RSS");
                ?>
</h1>
				</td></tr>

				<form id='share_form' name='share_form'>

				<input type="hidden" name="op" value="sharepopup">
				<input type="hidden" name="action" value="share">

				<tr><td align='right'><?php 
                echo __("Title:");
                ?>
</td>
				<td width='80%'><input name='title' value="<?php 
                echo $title;
                ?>
"></td></tr>
				<tr><td align='right'><?php 
                echo __("URL:");
                ?>
</td>
				<td><input name='url' value="<?php 
                echo $url;
                ?>
"></td></tr>
				<tr><td align='right'><?php 
                echo __("Content:");
                ?>
</td>
				<td><input name='content' value=""></td></tr>
				<tr><td align='right'><?php 
                echo __("Labels:");
                ?>
</td>
				<td><input name='labels' id="labels_value"
					placeholder='Alpha, Beta, Gamma' value="">
				</td></tr>

				<tr><td>
					<div class="autocomplete" id="labels_choices"
						style="display : block"></div></td></tr>

				<script type='text/javascript'>document.forms[0].title.focus();</script>

				<script type='text/javascript'>
					new Ajax.Autocompleter('labels_value', 'labels_choices',
				   "backend.php?op=rpc&method=completeLabels",
				   { tokens: ',', paramName: "search" });
				</script>

				<tr><td colspan='2'>
					<div style='float : right' class='insensitive-small'>
					<?php 
                echo __("Shared article will appear in the Published feed.");
                ?>
					</div>
					<button type="submit"><?php 
                echo __('Share');
                ?>
</button>
					<button onclick="return window.close()"><?php 
                echo __('Cancel');
                ?>
</button>
					</div>

				</form>
				</td></tr></table>
				</body></html>
				<?php 
            }
        } else {
            $return = urlencode($_SERVER["REQUEST_URI"]);
            ?>

			<form action="public.php?return=<?php 
            echo $return;
            ?>
"
				method="POST" id="loginForm" name="loginForm">

			<input type="hidden" name="op" value="login">

			<table height='100%' width='100%'><tr><td colspan='2'>
			<h1><?php 
            echo __("Not logged in");
            ?>
</h1></td></tr>

			<tr><td align="right"><?php 
            echo __("Login:"******"right"><input name="login"
				value="<?php 
            echo $_SESSION["fake_login"];
            ?>
"></td></tr>
				<tr><td align="right"><?php 
            echo __("Password:"******"right"><input type="password" name="password"
				value="<?php 
            echo $_SESSION["fake_password"];
            ?>
"></td></tr>
			<tr><td align="right"><?php 
            echo __("Language:");
            ?>
</td>
			<td align="right">
			<?php 
            print_select_hash("language", $_COOKIE["ttrss_lang"], get_translations(), "style='width : 100%''");
            ?>
			</td></tr>
			<tr><td colspan='2'>
				<button type="submit">
					<?php 
            echo __('Log in');
            ?>
</button>

				<button onclick="return window.close()">
					<?php 
            echo __('Cancel');
            ?>
</button>
			</td></tr>
			</table>

			</form>
			<?php 
        }
    }
Esempio n. 8
0
function __n($singular, $plural, $count, $domain = 'default')
{
    $translations =& get_translations($domain);
    return $translations->translate_plural($singular, $plural, $count);
}
Esempio n. 9
0
    //Open directory
    $path = $csd . "/../assets/data/";
    $dir = dir($path);
    //List files in directory
    while (($file = $dir->read()) !== false) {
        //Make sure it's a .txt file
        if (strlen($file) < 5 or $file == ".DS_Store") {
            continue;
        }
        $yaml .= file_get_contents($path . $file);
        $yaml .= "\n";
    }
    $dir->close();
    $parsed = Spyc::YAMLLoad($yaml);
    if (!empty($parsed['translations_url']) && strlen($parsed['translations_url']) > 0) {
        $parsed['translations'] = get_translations($parsed['translations_url']);
    }
    // if(!empty($parsed['linkedData'])){
    //     foreach ($parsed['linkedData'] as $key => $link) {
    //         $parsed[$key] = get_spreadsheetData($link, $key);
    //     }
    // }
    $_SESSION = $parsed;
    $_SESSION['prototype'] = $csd;
}
// Handle datachanges
$sessiondata = "";
if (!empty($_POST['session'])) {
    foreach ($_POST['session'] as $key => $postSession) {
        setSessionVar($key, $postSession);
        $sessiondata .= print_r($postSession, true);
Esempio n. 10
0
<?php

include BASE_PATH . 'app/utils/initialize.php';
$country_id = get_country_id($first);
echo $twig->render('index.html', array('data' => $data, 'utils' => $utils, 'countries' => get_countries($first), 'articles' => get_articles($country_id), 'authors' => get_unique_authors($country_id), 'translations' => get_translations($country_id)));
?>