| 1 | <?php |
|---|
| 2 | ############################################################################### |
|---|
| 3 | # Gregarius - A PHP based RSS aggregator. |
|---|
| 4 | # Copyright (C) 2003 - 2006 Marco Bonetti |
|---|
| 5 | # |
|---|
| 6 | ############################################################################### |
|---|
| 7 | # This program is free software and open source software; you can redistribute |
|---|
| 8 | # it and/or modify it under the terms of the GNU General Public License as |
|---|
| 9 | # published by the Free Software Foundation; either version 2 of the License, |
|---|
| 10 | # or (at your option) any later version. |
|---|
| 11 | # |
|---|
| 12 | # This program is distributed in the hope that it will be useful, but WITHOUT |
|---|
| 13 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|---|
| 14 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
|---|
| 15 | # more details. |
|---|
| 16 | # |
|---|
| 17 | # You should have received a copy of the GNU General Public License along |
|---|
| 18 | # with this program; if not, write to the Free Software Foundation, Inc., |
|---|
| 19 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA or visit |
|---|
| 20 | # http://www.gnu.org/licenses/gpl.html |
|---|
| 21 | # |
|---|
| 22 | ############################################################################### |
|---|
| 23 | # E-mail: mbonetti at gmail dot com |
|---|
| 24 | # Web page: http://gregarius.net/ |
|---|
| 25 | # |
|---|
| 26 | ############################################################################### |
|---|
| 27 | |
|---|
| 28 | /** |
|---|
| 29 | * renders the opml export form |
|---|
| 30 | */ |
|---|
| 31 | function opml() { |
|---|
| 32 | |
|---|
| 33 | |
|---|
| 34 | // import |
|---|
| 35 | |
|---|
| 36 | //disable file upload formfields when file_upload is false |
|---|
| 37 | $disableupload = ini_get('file_uploads') ? "":" disabled=\"disabled\" "; |
|---|
| 38 | echo "<h2>". __('OPML:') ."</h2>\n"; |
|---|
| 39 | echo "<div id=\"admin_opml\">\n"; |
|---|
| 40 | |
|---|
| 41 | echo "<fieldset id=\"opmlimport\">\n" |
|---|
| 42 | ."<legend>" . __('Import OPML:') . "</legend>"; |
|---|
| 43 | |
|---|
| 44 | echo "<form enctype=\"multipart/form-data\" method=\"post\" action=\"" .$_SERVER['PHP_SELF'] ."\">\n"; |
|---|
| 45 | echo "<p><input type=\"hidden\" name=\"". CST_ADMIN_DOMAIN ."\" value=\"".CST_ADMIN_DOMAIN_CHANNEL."\"/>\n"; |
|---|
| 46 | echo "<label for=\"opml\">" . __('... from URL:') ."</label>\n"; |
|---|
| 47 | echo "<input type=\"text\" name=\"opml\" id=\"opml\" value=\"http://\" onfocus=\"this.select()\"/></p>\n"; |
|---|
| 48 | |
|---|
| 49 | |
|---|
| 50 | echo '<p><input type="hidden" name="' . CST_ADMIN_DOMAIN . '" value="' . CST_ADMIN_DOMAIN_CHANNEL . "\" />\n"; |
|---|
| 51 | echo '<input type="hidden" name="MAX_FILE_SIZE" value="150000" />' . "\n"; |
|---|
| 52 | echo '<label for="opmlfile">' . __('... from File:') . "</label>\n"; |
|---|
| 53 | echo '<input name="opmlfile" type="file" id="opmlfile" '.$disableupload.'/></p>' . "\n"; |
|---|
| 54 | |
|---|
| 55 | /* |
|---|
| 56 | |
|---|
| 57 | define ('CST_ADMIN_OPML_IMPORT_WIPE',1); |
|---|
| 58 | define ('CST_ADMIN_OPML_IMPORT_FOLDER',2); |
|---|
| 59 | define ('CST_ADMIN_OPML_IMPORT_MERGE',3); |
|---|
| 60 | */ |
|---|
| 61 | |
|---|
| 62 | echo "\n" |
|---|
| 63 | ."<p>".__('Import new feeds and:')."</p>" |
|---|
| 64 | |
|---|
| 65 | ."<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" |
|---|
| 66 | ."<label for=\"opml_import_option_merge\" >".__('... merge them with the existing ones.')."</label></p>\n" |
|---|
| 67 | |
|---|
| 68 | |
|---|
| 69 | ."<p style=\"padding-left:1em;\"><input type=\"radio\" id=\"opml_import_option_folder\" name=\"opml_import_option\" value=\"".CST_ADMIN_OPML_IMPORT_FOLDER."\" />\n" |
|---|
| 70 | ."<label for=\"opml_import_option_folder\" >".__('... add them to the folder:')."</label>" |
|---|
| 71 | .rss_toolkit_folders_combo('opml_import_to_folder',null) |
|---|
| 72 | ."</p>\n" |
|---|
| 73 | |
|---|
| 74 | ."<p style=\"padding-left:1em;\"><input type=\"radio\" id=\"opml_import_option_wipe\" name=\"opml_import_option\" value=\"".CST_ADMIN_OPML_IMPORT_WIPE."\" />\n" |
|---|
| 75 | ."<label for=\"opml_import_option_wipe\" >".__('... replace all existing feeds and items.')."</label></p>\n" |
|---|
| 76 | |
|---|
| 77 | .""; |
|---|
| 78 | |
|---|
| 79 | |
|---|
| 80 | echo "<p style=\"text-align:center\"><input type=\"hidden\" name=\"". CST_ADMIN_METAACTION ."\" value=\"ACT_ADMIN_IMPORT\" />\n"; |
|---|
| 81 | echo "<input type=\"submit\" name=\"action\" value=\"". __('Import') ."\" /></p>\n"; |
|---|
| 82 | |
|---|
| 83 | |
|---|
| 84 | |
|---|
| 85 | |
|---|
| 86 | echo "</form>\n"; |
|---|
| 87 | echo "</fieldset>\n"; |
|---|
| 88 | |
|---|
| 89 | |
|---|
| 90 | |
|---|
| 91 | // export |
|---|
| 92 | opml_export_form(); |
|---|
| 93 | dump_export_form(); |
|---|
| 94 | echo "</div>\n"; |
|---|
| 95 | } |
|---|
| 96 | |
|---|
| 97 | /*************** OPML Export ************/ |
|---|
| 98 | |
|---|
| 99 | function opml_export_form() { |
|---|
| 100 | if (getConfig('rss.output.usemodrewrite')) { |
|---|
| 101 | $method ="post"; |
|---|
| 102 | $action = getPath() ."opml"; |
|---|
| 103 | } else { |
|---|
| 104 | $method ="get"; |
|---|
| 105 | $action = getPath() ."opml.php"; |
|---|
| 106 | } |
|---|
| 107 | echo "<fieldset style=\"vertical-align:top\">\n<legend>".__('Export OPML:')."</legend>\n"; |
|---|
| 108 | echo "<form method=\"$method\" action=\"$action\">\n" |
|---|
| 109 | ."<p><label for=\"action\">". __('Export OPML:'). "</label>\n" |
|---|
| 110 | ."<input type=\"submit\" name=\"act\" id=\"action\" value=\"". __('Export') ."\" />" |
|---|
| 111 | ."</p>\n</form>\n" |
|---|
| 112 | ."</fieldset>\n"; |
|---|
| 113 | } |
|---|
| 114 | |
|---|
| 115 | |
|---|
| 116 | /***** DUMP ******/ |
|---|
| 117 | |
|---|
| 118 | function dump_export_form() { |
|---|
| 119 | |
|---|
| 120 | echo "<fieldset style=\"vertical-align:top\">\n<legend>".__('XML Dump:')."</legend>\n"; |
|---|
| 121 | echo "<form method=\"post\" action=\"".$_SERVER['PHP_SELF']."\">\n" |
|---|
| 122 | ."<p><label for=\"action\">". __('Dump your Gregarius installation to XML'). "</label>\n" |
|---|
| 123 | ."<input type=\"submit\" name=\"dumpact\" id=\"action\" value=\"".__('Dump!')."\" />" |
|---|
| 124 | ."<input type=\"hidden\" name=\"". CST_ADMIN_DOMAIN ."\" value=\"".CST_ADMIN_DOMAIN_CHANNEL."\"/>\n" |
|---|
| 125 | ."<input type=\"hidden\" name=\"".CST_ADMIN_METAACTION."\" value=\"dump\"/>\n" |
|---|
| 126 | ."</p>\n</form>\n" |
|---|
| 127 | ."</fieldset>\n"; |
|---|
| 128 | } |
|---|
| 129 | |
|---|
| 130 | ?> |
|---|