Esempio n. 1
0
/**
 * renders the opml export form
 */
function opml()
{
    // import
    //disable file upload formfields when file_upload is false
    $disableupload = ini_get('file_uploads') ? "" : " disabled=\"disabled\" ";
    echo "<h2>" . __('OPML:') . "</h2>\n";
    echo "<div id=\"admin_opml\">\n";
    echo "<fieldset id=\"opmlimport\">\n" . "<legend>" . __('Import OPML:') . "</legend>";
    echo "<form enctype=\"multipart/form-data\" method=\"post\" action=\"" . $_SERVER['PHP_SELF'] . "\">\n";
    echo "<p><input type=\"hidden\" name=\"" . CST_ADMIN_DOMAIN . "\" value=\"" . CST_ADMIN_DOMAIN_CHANNEL . "\"/>\n";
    echo "<label for=\"opml\">" . __('... from URL:') . "</label>\n";
    echo "<input type=\"text\"\tname=\"opml\" id=\"opml\" value=\"http://\" onfocus=\"this.select()\"/></p>\n";
    echo '<p><input type="hidden" name="' . CST_ADMIN_DOMAIN . '" value="' . CST_ADMIN_DOMAIN_CHANNEL . "\" />\n";
    echo '<input type="hidden" name="MAX_FILE_SIZE" value="150000" />' . "\n";
    echo '<label for="opmlfile">' . __('... from File:') . "</label>\n";
    echo '<input name="opmlfile" type="file" id="opmlfile" ' . $disableupload . '/></p>' . "\n";
    /*
    
    define ('CST_ADMIN_OPML_IMPORT_WIPE',1);
    define ('CST_ADMIN_OPML_IMPORT_FOLDER',2);
    define ('CST_ADMIN_OPML_IMPORT_MERGE',3);
    */
    echo "\n" . "<p>" . __('Import new feeds and:') . "</p>" . "<p style=\"padding-left:1em;\"><input checked=\"checked\" type=\"radio\" id=\"opml_import_option_merge\" name=\"opml_import_option\" value=\"" . CST_ADMIN_OPML_IMPORT_MERGE . "\" />\n" . "<label for=\"opml_import_option_merge\" >" . __('... merge them with the existing ones.') . "</label></p>\n" . "<p style=\"padding-left:1em;\"><input type=\"radio\" id=\"opml_import_option_folder\" name=\"opml_import_option\" value=\"" . CST_ADMIN_OPML_IMPORT_FOLDER . "\" />\n" . "<label for=\"opml_import_option_folder\" >" . __('... add them to the folder:') . "</label>" . rss_toolkit_folders_combo('opml_import_to_folder', null) . "</p>\n" . "<p style=\"padding-left:1em;\"><input type=\"radio\" id=\"opml_import_option_wipe\" name=\"opml_import_option\" value=\"" . CST_ADMIN_OPML_IMPORT_WIPE . "\" />\n" . "<label for=\"opml_import_option_wipe\" >" . __('... replace all existing feeds and items.') . "</label></p>\n" . "";
    echo "<p style=\"text-align:center\"><input type=\"hidden\" name=\"" . CST_ADMIN_METAACTION . "\" value=\"ACT_ADMIN_IMPORT\" />\n";
    echo "<input type=\"submit\" name=\"action\" value=\"" . __('Import') . "\" /></p>\n";
    echo "</form>\n";
    echo "</fieldset>\n";
    // export
    opml_export_form();
    dump_export_form();
    echo "</div>\n";
}
Esempio n. 2
0
function channel_edit_form($cid)
{
    $sql = "select id, title, url, siteurl, parent, descr, icon, mode, daterefreshed, dateadded from " . getTable("channels") . " where id={$cid}";
    $res = rss_query($sql);
    list($id, $title, $url, $siteurl, $parent, $descr, $icon, $mode, $daterefreshed, $dateadded) = rss_fetch_row($res);
    $title = htmlentities($title, ENT_QUOTES);
    // get tags
    $sql = "select t.tag from " . getTable('tag') . " t " . "  inner join " . getTable('metatag') . " m " . "    on m.tid = t.id " . "where m.ttype = 'channel' and m.fid = {$cid}";
    $res = rss_query($sql);
    $tags = "";
    while ($r = rss_fetch_assoc($res)) {
        $tags .= $r['tag'] . " ";
    }
    echo "<div>\n";
    echo "\n\n<h2>" . __('Edit the feed ') . " '{$title}'</h2>\n";
    echo "<form method=\"post\" action=\"" . $_SERVER['PHP_SELF'] . "#fa{$cid}\" id=\"channeledit\">\n";
    echo "<fieldset id=\"channeleditfs\">";
    // Timestamps
    if (!empty($daterefreshed)) {
        echo "<p><label>" . __('Added') . ": " . date("M-d-Y H:i", strtotime($dateadded)) . "</label></p>" . "<p><label>" . __('Last Update') . ": " . date("M-d-Y H:i", strtotime($daterefreshed)) . " (Age: " . round((time() - strtotime($daterefreshed)) / 60) . " minutes)</label></p>\n";
    } else {
        echo "<p><label>" . __('Added') . ": " . date("M-d-Y H:i", strtotime($dateadded)) . "</label></p>" . "<p><label>" . __('Last Update') . ": " . __('Never') . "</label></p>\n";
    }
    // Item name
    echo "<p><label for=\"c_name\">" . __('Title:') . "</label>\n" . "<input type=\"text\" id=\"c_name\" name=\"c_name\" value=\"{$title}\" />" . "<input type=\"hidden\" name=\"" . CST_ADMIN_DOMAIN . "\" value=\"" . CST_ADMIN_DOMAIN_CHANNEL . "\" />\n" . "<input type=\"hidden\" name=\"action\" value=\"" . CST_ADMIN_SUBMIT_EDIT . "\" />\n" . "<input type=\"hidden\" name=\"cid\" value=\"{$cid}\" /></p>\n" . "<p><label for=\"c_url\">" . __('RSS URL:') . "</label>\n" . "<a href=\"{$url}\">" . __('(visit)') . "</a>\n" . "<input type=\"text\" id=\"c_url\" name=\"c_url\" value=\"{$url}\" /></p>" . "<p><label for=\"c_siteurl\">" . __('Site URL:') . "</label>\n" . "<a href=\"{$siteurl}\">" . __('(visit)') . "</a>\n" . "<input type=\"text\" id=\"c_siteurl\" name=\"c_siteurl\" value=\"{$siteurl}\" /></p>" . "<p><label for=\"c_parent\">" . __('In folder:') . "</label>\n" . rss_toolkit_folders_combo('c_parent', $parent) . "</p>\n";
    // Tags
    echo "<p><label for=\"c_tags\">" . __('Categories') . ":</label>\n" . "<input type=\"text\" id=\"c_tags\" name=\"c_tags\" value=\"{$tags}\" /></p>";
    // Items state
    if ($mode & RSS_MODE_PRIVATE_STATE) {
        $pchk = " checked=\"checked\" ";
        $old_priv = "1";
    } else {
        $pchk = "";
        $old_priv = "0";
    }
    if ($mode & RSS_MODE_DELETED_STATE) {
        $dchk = " checked=\"checked\" ";
        $old_del = "1";
    } else {
        $dchk = "";
        $old_del = "0";
    }
    echo "<p>\n" . "<input style=\"display:inline\" type=\"checkbox\" id=\"c_private\" " . " name=\"c_private\" value=\"1\"{$pchk} />\n" . "<label for=\"c_private\">" . __('This feed is <strong>private</strong>, only admins see it.') . "</label>\n" . "<input type=\"hidden\" name=\"old_priv\" value=\"{$old_priv}\" />\n" . "</p>\n";
    echo "<p>\n" . "<input style=\"display:inline\" type=\"checkbox\" id=\"c_deleted\" " . " name=\"c_deleted\" value=\"1\"{$dchk} />\n" . "<label for=\"c_deleted\">" . __("This feed is <strong>deprecated</strong>, it won't be updated anymore and won't be visible in the feeds column.") . "</label>\n" . "<input type=\"hidden\" name=\"old_del\" value=\"{$old_del}\" />\n" . "</p>\n";
    // Description
    $descr = trim(htmlentities(strip_tags($descr), ENT_QUOTES));
    echo "<p><label for=\"c_descr\">" . __('Description:') . "</label>\n" . "<input type=\"text\" id=\"c_descr\" name=\"c_descr\" value=\"{$descr}\" /></p>\n";
    // Icon
    if (getConfig('rss.output.showfavicons')) {
        echo "<p><label for=\"c_icon\">" . __('Shown favicon:') . "</label>\n";
        if (trim($icon) != "") {
            if (substr($icon, 0, 5) == 'blob:') {
                $icon = substr($icon, 5);
            }
            echo "<img src=\"{$icon}\" alt=\"{$title}\" class=\"favicon\" width=\"16\" height=\"16\" />\n";
            echo "<span>" . __('(Leave blank for no icon)') . "</span>";
        }
        echo "<input type=\"text\" id=\"c_icon\" name=\"c_icon\" value=\"{$icon}\" /></p>\n";
    } else {
        echo "<p><input type=\"hidden\" name=\"c_icon\" id=\"c_icon\" value=\"{$icon}\" /></p>\n";
    }
    rss_plugin_hook('rss.plugins.admin.feed.properties', $cid);
    echo "</fieldset>\n";
    // Feed properties
    echo "<fieldset id=\"channeleditpropfs\">";
    echo "<p>" . "<span style=\"float:left;\">Allow Gregarius to look for updates in existing items for this feed?</span>" . "<span style=\"float:right;\">[<a  href=\"index.php?domain=config&amp;action=edit&amp;key=rss.input.allowupdates&amp;view=config\">Edit the global option</a>]</span>\n" . "&nbsp;" . "</p>";
    $rss_input_allowupdates_default_current = getProperty($cid, 'rss.input.allowupdates');
    $rss_input_allowupdates_default_value = $rss_input_allowupdates_default = "Use global option (" . (getConfig('rss.input.allowupdates') ? "Yes" : "No") . ")";
    echo "<p id=\"rss_input_allowupdates_options\">" . "<input type=\"radio\" " . "id=\"rss_input_allowupdates_yes\" " . "name=\"prop_rss_input_allowupdates\" value=\"1\"  " . ($rss_input_allowupdates_default_current === true ? " checked=\"checked\" " : "") . "/>\n" . "<label for=\"rss_input_allowupdates_yes\">Yes</label>\n" . "<input type=\"radio\" " . "id=\"rss_input_allowupdates_no\" " . "name=\"prop_rss_input_allowupdates\" value=\"0\"  " . ($rss_input_allowupdates_default_current === false ? " checked=\"checked\" " : "") . "/>\n" . "<label for=\"rss_input_allowupdates_no\">No</label>" . "<input type=\"radio\" " . "id=\"rss_input_allowupdates_default\" " . "name=\"prop_rss_input_allowupdates\" value=\"default\"  " . ($rss_input_allowupdates_default_current === null ? " checked=\"checked\" " : "") . "/>\n" . "<label for=\"rss_input_allowupdates_default\">{$rss_input_allowupdates_default}</label>" . "</p>\n";
    echo "<p>" . "<span style=\"float:left;\">Refresh Interval (minutes): </span>" . "&nbsp;" . "</p>";
    $rss_config_refreshinterval_default_current = getProperty($cid, 'rss.config.refreshinterval');
    echo "<p id=\"rss_config_refreshinterval_options\">" . "<input type=\"text\" id=\"rss_config_refreshinterval\" name=\"rss_config_refreshinterval\" value=\"" . (true == empty($rss_config_refreshinterval_default_current) ? 60 : $rss_config_refreshinterval_default_current) . "\">" . "</p>";
    echo "</fieldset>\n";
    echo "<p style=\"clear:both; padding: 1em 0\"><input type=\"submit\" name=\"action_\" value=\"" . __('Submit Changes') . "\" />" . "<input type=\"button\" name=\"_cancel\" value=\"" . __('Cancel') . "\" onclick=\"history.back(-1);\"></p>";
    echo "</form></div>\n";
}