+ $id = $_REQUEST["id"];
+ $param = db_escape_string($_REQUEST["param"]);
+
+ print "<dlg id=\"$id\">";
+
+ if ($id == "importOpml") {
+ print "<title>".__('OPML Import')."</title>";
+ print "<content><![CDATA[";
+
+ print "<div class=\"prefFeedCatHolder\">";
+
+ $owner_uid = $_SESSION["uid"];
+
+ db_query($link, "BEGIN");
+
+ /* create Imported feeds category just in case */
+
+ $result = db_query($link, "SELECT id FROM
+ ttrss_feed_categories WHERE title = 'Imported feeds' AND
+ owner_uid = '$owner_uid' LIMIT 1");
+
+ if (db_num_rows($result) == 0) {
+ db_query($link, "INSERT INTO ttrss_feed_categories
+ (title,owner_uid)
+ VALUES ('Imported feeds', '$owner_uid')");
+ }
+
+ db_query($link, "COMMIT");
+
+ /* Handle OPML import by DOMXML/DOMDocument */
+
+ if (function_exists('domxml_open_file')) {
+ print "<ul class='nomarks'>";
+ print "<li>".__("Importing using DOMXML.")."</li>";
+ require_once "opml_domxml.php";
+ opml_import_domxml($link, $owner_uid);
+ print "</ul>";
+ } else if (PHP_VERSION >= 5) {
+ print "<ul class='nomarks'>";
+ print "<li>".__("Importing using DOMDocument.")."</li>";
+ require_once "opml_domdoc.php";
+ opml_import_domdoc($link, $owner_uid);
+ print "</ul>";
+ } else {
+ print_error(__("DOMXML extension is not found. It is required for PHP versions below 5."));
+ }
+
+ print "</div>";
+
+ print "<div align='center'>";
+
+ print "<button onclick=\"return opmlImportDone()\">".
+ __('Close this window')."</button>";
+
+ print "</div>";
+
+ print "<script type=\"text/javascript\">";
+ print "parent.opmlImportHandler(this)";
+ print "</script>";
+
+ print "</div>";
+ print "]]></content>";
+
+ //return;
+ }
+
+ if ($id == "editPrefProfiles") {
+
+ print "<title>".__('Settings Profiles')."</title>";
+ print "<content><![CDATA[";
+
+ print "<div><input id=\"fadd_profile\"
+ onkeypress=\"return filterCR(event, addPrefProfile)\"
+ size=\"40\">
+ <button onclick=\"javascript:addPrefProfile()\">".
+ __('Create profile')."</button></div>";
+
+ print "<p>";
+
+ $result = db_query($link, "SELECT title,id FROM ttrss_settings_profiles
+ WHERE owner_uid = ".$_SESSION["uid"]." ORDER BY title");
+
+ print __('Select:')."
+ <a href=\"#\" onclick=\"selectTableRows('prefFeedCatList', 'all')\">".__('All')."</a>,
+ <a href=\"#\" onclick=\"selectTableRows('prefFeedCatList', 'none')\">".__('None')."</a>";
+
+ print "<div class=\"prefFeedCatHolder\">";
+
+ print "<form id=\"profile_edit_form\" onsubmit=\"return false\">";
+
+ print "<table width=\"100%\" class=\"prefFeedCatList\"
+ cellspacing=\"0\" id=\"prefFeedCatList\">";
+
+ print "<tr class=\"odd\" id=\"FCATR-0\">";
+
+ print "<td width='5%' align='center'><input
+ onclick='toggleSelectRow(this);'
+ type=\"checkbox\" id=\"FCCHK-0\"></td>";
+
+ if (!$_SESSION["profile"]) {
+ $is_active = __("(active)");
+ } else {
+ $is_active = "";
+ }
+
+ print "<td><span id=\"FCATT-0\">" .
+ __("Default profile") . " $is_active</span></td>";
+
+ print "</tr>";
+
+ $lnum = 1;
+
+ while ($line = db_fetch_assoc($result)) {
+
+ $class = ($lnum % 2) ? "even" : "odd";
+
+ $cat_id = $line["id"];
+ $this_row_id = "id=\"FCATR-$cat_id\"";
+
+ print "<tr class=\"$class\" $this_row_id>";
+
+ $edit_title = htmlspecialchars($line["title"]);
+
+ print "<td width='5%' align='center'><input
+ onclick='toggleSelectRow(this);'
+ type=\"checkbox\" id=\"FCCHK-$cat_id\"></td>";
+
+ if ($_SESSION["profile"] == $line["id"]) {
+ $is_active = __("(active)");
+ } else {
+ $is_active = "";
+ }
+
+ print "<td><span id=\"FCATT-$cat_id\">" .
+ $edit_title . "</span> $is_active</td>";
+
+ print "</tr>";
+
+ ++$lnum;
+ }
+
+ print "</table>";
+ print "</form>";
+ print "</div>";
+
+ print "<div class='dlgButtons'>
+ <div style='float : left'>
+ <button onclick=\"return removeSelectedPrefProfiles()\">".
+ __('Remove')."</button>
+ <button onclick=\"return activatePrefProfile()\">".
+ __('Activate')."</button>
+ </div>";
+
+ print "<button onclick=\"return closeInfoBox()\">".
+ __('Close this window')."</button>";
+
+ print "</div>";
+ print "]]></content>";
+
+ //return;
+ }
+
+ if ($id == "pubOPMLUrl") {
+
+ print "<title>".__('Public OPML URL')."</title>";
+ print "<content><![CDATA[";
+
+ $url_path = opml_publish_url($link);
+
+ print __("Your Public OPML URL is:");
+
+ print "<div class=\"tagCloudContainer\">";
+ print "<a id='pub_opml_url' href='$url_path' target='_blank'>$url_path</a>";
+ print "</div>";
+
+ print "<div align='center'>";
+
+ print "<button dojoType=\"dijit.form.Button\" onclick=\"return opmlRegenKey()\">".
+ __('Generate new URL')."</button> ";
+
+ print "<button dojoType=\"dijit.form.Button\" onclick=\"return closeInfoBox()\">".
+ __('Close this window')."</button>";
+
+ print "</div>";
+ print "]]></content>";
+
+ //return;
+ }