|
From: Sebastian D. <se...@us...> - 2006-03-06 13:50:35
|
Update of /cvsroot/wackofork/wiki/actions/magpierss/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1832/scripts Modified Files: magpie_debug.php magpie_simple.php Log Message: - Version 0.72 eingespielt Index: magpie_simple.php =================================================================== RCS file: /cvsroot/wackofork/wiki/actions/magpierss/scripts/magpie_simple.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** magpie_simple.php 3 Feb 2006 23:09:01 -0000 1.1 --- magpie_simple.php 6 Mar 2006 13:50:11 -0000 1.2 *************** *** 8,12 **** if ( $url ) { $rss = fetch_rss( $url ); - echo "Channel: " . $rss->channel['title'] . "<p>"; echo "<ul>"; --- 8,11 ---- *************** *** 24,25 **** --- 23,29 ---- <input type="submit" value="Parse RSS"> </form> + + <p> + <h2>Security Note:</h2> + This is a simple <b>example</b> script. If this was a <b>real</b> script we probably wouldn't allow strangers to submit random URLs, and we certainly wouldn't simply echo anything passed in the URL. Additionally its a bad idea to leave this example script lying around. + </p> \ No newline at end of file Index: magpie_debug.php =================================================================== RCS file: /cvsroot/wackofork/wiki/actions/magpierss/scripts/magpie_debug.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** magpie_debug.php 3 Feb 2006 23:09:01 -0000 1.1 --- magpie_debug.php 6 Mar 2006 13:50:11 -0000 1.2 *************** *** 3,32 **** ini_set('display_errors', 1); ini_set('error_reporting', E_ALL); ! define('MAGPIE_DIR', '../'); ! define('MAGPIE_DEBUG', 2); // flush cache quickly for debugging purposes, don't do this on a live site ! define('MAGPIE_CACHE_AGE', 2); require_once(MAGPIE_DIR.'rss_fetch.inc'); - $url = $_GET['url']; ! if ( $url ) { ! $rss = fetch_rss( $url ); ! if ($rss) { ! echo "Channel: " . $rss->channel['title'] . "<p>"; ! echo "<ul>"; ! foreach ($rss->items as $item) { ! $href = $item['link']; ! $title = $item['title']; ! echo "<li><a href=$href>$title</a></li>"; ! } ! echo "</ul>"; ! } ! else { ! echo "Error: " . magpie_error(); } } ?> --- 3,41 ---- ini_set('display_errors', 1); ini_set('error_reporting', E_ALL); ! define('MAGPIE_OUTPUT_ENCODING', 'UTF-8'); define('MAGPIE_DIR', '../'); ! define('MAGPIE_DEBUG', 1); ! // flush cache quickly for debugging purposes, don't do this on a live site ! define('MAGPIE_CACHE_AGE', 10); require_once(MAGPIE_DIR.'rss_fetch.inc'); ! if ( isset($_GET['url']) ) { ! $url = $_GET['url']; ! } ! else { ! $url = 'http://magpierss.sf.net/test.rss'; ! } ! ! ! test_library_support(); ! ! $rss = fetch_rss( $url ); ! if ($rss) { ! echo "<h3>Example Output</h3>"; ! echo "Channel: " . $rss->channel['title'] . "<p>"; ! echo "<ul>"; ! foreach ($rss->items as $item) { ! $href = $item['link']; ! $title = $item['title']; ! echo "<li><a href=$href>$title</a></li>"; } + echo "</ul>"; + } + else { + echo "Error: " . magpie_error(); } ?> *************** *** 37,41 **** </form> <pre> <?php var_dump($rss); ?> ! </pre> \ No newline at end of file --- 46,80 ---- </form> + <h3>Parsed Results (var_dump'ed)</h3> <pre> <?php var_dump($rss); ?> ! </pre> ! ! <?php ! ! function test_library_support() { ! if (!function_exists('xml_parser_create')) { ! echo "<b>Error:</b> PHP compiled without XML support (--with-xml), Mapgie won't work without PHP support for XML.<br />\n"; ! exit; ! } ! else { ! echo "<b>OK:</b> Found an XML parser. <br />\n"; ! } ! ! if ( ! function_exists('gzinflate') ) { ! echo "<b>Warning:</b> PHP compiled without Zlib support (--with-zlib). No support for GZIP encoding.<br />\n"; ! } ! else { ! echo "<b>OK:</b> Support for GZIP encoding.<br />\n"; ! } ! ! if ( ! (function_exists('iconv') and function_exists('mb_convert_encoding') ) ) { ! echo "<b>Warning:</b> No support for iconv (--with-iconv) or multi-byte strings (--enable-mbstring)." . ! "No support character set munging.<br />\n"; ! } ! else { ! echo "<b>OK:</b> Support for character munging.<br />\n"; ! } ! } ! ! ?> |