<?
if (!isset($_GET['get'])) {
header('Content-type: text/html; encoding=utf-8');
?>
<!--

* Copyright (c) 2009, Ivan Vucica
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*     * Redistributions of source code must retain the above copyright
*       notice, this list of conditions and the following disclaimer.
*     * Redistributions in binary form must reproduce the above copyright
*       notice, this list of conditions and the following disclaimer in the
*       documentation and/or other materials provided with the distribution.
*     * Neither the name of Ivan Vucica nor the
*       names of its contributors may be used to endorse or promote products
*       derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY Ivan Vucica ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL Ivan Vucica BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


Full source code, including proxy, available if you change .php into .phps or upon request

-->


<html>
<head>
<title>MediaRSS Viewer</title>
</head>
<body>
<h1>MediaRSS Viewer</h1>
<i>written in javascript :)</i><br>
<i>&copy; 2009 Ivan Vucica; see the source code for license</i>
<pre style="font-size: 80%;">
spec of media rss:
http://search.yahoo.com/mrss/

you'll need to do this in case you're running locally 
(you'll need to remove php portions of code then):
  about:config
then change
  signed.applets.codebase_principal_support
to true.

Tested only in Firefox 3. (Iceweasel probably works too, for some reason ^^)

please notify me if you use this at: ivan@vucica.net
also notify me how to improve the proxy ... it smells of security breaches to me :/

<a href="mediarss.phps">source</a>
</pre>



<script language="javascript">
// from php.js project (php in javascript project)
// http://kevin.vanzonneveld.net/techblog/article/javascript_equivalent_for_phps_htmlspecialchars/

function get_html_translation_table(table, quote_style) {
    // http://kevin.vanzonneveld.net
    // +   original by: Philip Peterson
    // +    revised by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   bugfixed by: noname
    // %          note: It has been decided that we're not going to add global
    // %          note: dependencies to php.js. Meaning the constants are not
    // %          note: real constants, but strings instead. integers are also supported if someone
    // %          note: chooses to create the constants themselves.
    // %          note: Table from http://www.the-art-of-web.com/html/character-codes/
    // *     example 1: get_html_translation_table('HTML_SPECIALCHARS');
    // *     returns 1: {'"': '&quot;', '&': '&amp;', '<': '&lt;', '>': '&gt;'}
    
    var entities = {}, histogram = {}, decimal = 0, symbol = '';
    var constMappingTable = {}, constMappingQuoteStyle = {};
    var useTable = {}, useQuoteStyle = {};
    
    useTable      = (table ? table.toUpperCase() : 'HTML_SPECIALCHARS');
    useQuoteStyle = (quote_style ? quote_style.toUpperCase() : 'ENT_COMPAT');
    
    // Translate arguments
    constMappingTable[0]      = 'HTML_SPECIALCHARS';
    constMappingTable[1]      = 'HTML_ENTITIES';
    constMappingQuoteStyle[0] = 'ENT_NOQUOTES';
    constMappingQuoteStyle[2] = 'ENT_COMPAT';
    constMappingQuoteStyle[3] = 'ENT_QUOTES';
    
    // Map numbers to strings for compatibilty with PHP constants
    if (!isNaN(useTable)) {
        useTable = constMappingTable[useTable];
    }
    if (!isNaN(useQuoteStyle)) {
        useQuoteStyle = constMappingQuoteStyle[useQuoteStyle];
    }
    
    if (useQuoteStyle != 'ENT_NOQUOTES') {
        entities['34'] = '&quot;';
    }
 
    if (useQuoteStyle == 'ENT_QUOTES') {
        entities['39'] = '&#039;';
    }
 
    if (useTable == 'HTML_SPECIALCHARS') {
        // ascii decimals for better compatibility
        entities['38'] = '&amp;';
        entities['60'] = '&lt;';
        entities['62'] = '&gt;';
    } else if (useTable == 'HTML_ENTITIES') {
        // ascii decimals for better compatibility
      entities['38']  = '&amp;';
      entities['60']  = '&lt;';
      entities['62']  = '&gt;';
      entities['160'] = '&nbsp;';
      entities['161'] = '&iexcl;';
      entities['162'] = '&cent;';
      entities['163'] = '&pound;';
      entities['164'] = '&curren;';
      entities['165'] = '&yen;';
      entities['166'] = '&brvbar;';
      entities['167'] = '&sect;';
      entities['168'] = '&uml;';
      entities['169'] = '&copy;';
      entities['170'] = '&ordf;';
      entities['171'] = '&laquo;';
      entities['172'] = '&not;';
      entities['173'] = '&shy;';
      entities['174'] = '&reg;';
      entities['175'] = '&macr;';
      entities['176'] = '&deg;';
      entities['177'] = '&plusmn;';
      entities['178'] = '&sup2;';
      entities['179'] = '&sup3;';
      entities['180'] = '&acute;';
      entities['181'] = '&micro;';
      entities['182'] = '&para;';
      entities['183'] = '&middot;';
      entities['184'] = '&cedil;';
      entities['185'] = '&sup1;';
      entities['186'] = '&ordm;';
      entities['187'] = '&raquo;';
      entities['188'] = '&frac14;';
      entities['189'] = '&frac12;';
      entities['190'] = '&frac34;';
      entities['191'] = '&iquest;';
      entities['192'] = '&Agrave;';
      entities['193'] = '&Aacute;';
      entities['194'] = '&Acirc;';
      entities['195'] = '&Atilde;';
      entities['196'] = '&Auml;';
      entities['197'] = '&Aring;';
      entities['198'] = '&AElig;';
      entities['199'] = '&Ccedil;';
      entities['200'] = '&Egrave;';
      entities['201'] = '&Eacute;';
      entities['202'] = '&Ecirc;';
      entities['203'] = '&Euml;';
      entities['204'] = '&Igrave;';
      entities['205'] = '&Iacute;';
      entities['206'] = '&Icirc;';
      entities['207'] = '&Iuml;';
      entities['208'] = '&ETH;';
      entities['209'] = '&Ntilde;';
      entities['210'] = '&Ograve;';
      entities['211'] = '&Oacute;';
      entities['212'] = '&Ocirc;';
      entities['213'] = '&Otilde;';
      entities['214'] = '&Ouml;';
      entities['215'] = '&times;';
      entities['216'] = '&Oslash;';
      entities['217'] = '&Ugrave;';
      entities['218'] = '&Uacute;';
      entities['219'] = '&Ucirc;';
      entities['220'] = '&Uuml;';
      entities['221'] = '&Yacute;';
      entities['222'] = '&THORN;';
      entities['223'] = '&szlig;';
      entities['224'] = '&agrave;';
      entities['225'] = '&aacute;';
      entities['226'] = '&acirc;';
      entities['227'] = '&atilde;';
      entities['228'] = '&auml;';
      entities['229'] = '&aring;';
      entities['230'] = '&aelig;';
      entities['231'] = '&ccedil;';
      entities['232'] = '&egrave;';
      entities['233'] = '&eacute;';
      entities['234'] = '&ecirc;';
      entities['235'] = '&euml;';
      entities['236'] = '&igrave;';
      entities['237'] = '&iacute;';
      entities['238'] = '&icirc;';
      entities['239'] = '&iuml;';
      entities['240'] = '&eth;';
      entities['241'] = '&ntilde;';
      entities['242'] = '&ograve;';
      entities['243'] = '&oacute;';
      entities['244'] = '&ocirc;';
      entities['245'] = '&otilde;';
      entities['246'] = '&ouml;';
      entities['247'] = '&divide;';
      entities['248'] = '&oslash;';
      entities['249'] = '&ugrave;';
      entities['250'] = '&uacute;';
      entities['251'] = '&ucirc;';
      entities['252'] = '&uuml;';
      entities['253'] = '&yacute;';
      entities['254'] = '&thorn;';
      entities['255'] = '&yuml;';
    } else {
        throw Error("Table: "+useTable+' not supported');
        return false;
    }
    
    // ascii decimals to real symbols
    for (decimal in entities) {
        symbol = String.fromCharCode(decimal)
        histogram[symbol] = entities[decimal];
    }
    
    return histogram;
}

function htmlspecialchars (string, quote_style) {
    // http://kevin.vanzonneveld.net
    // +   original by: Mirek Slugen
    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   bugfixed by: Nathan
    // +   bugfixed by: Arno
    // +    revised by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // -    depends on: get_html_translation_table
    // *     example 1: htmlspecialchars("<a href='test'>Test</a>", 'ENT_QUOTES');
    // *     returns 1: '&lt;a href=&#039;test&#039;&gt;Test&lt;/a&gt;'
 
    var histogram = {}, symbol = '', tmp_str = '', entity = '';
    tmp_str = string.toString();
    
    if (false === (histogram = get_html_translation_table('HTML_SPECIALCHARS', quote_style))) {
        return false;
    }
    
    for (symbol in histogram) {
        entity = histogram[symbol];
        tmp_str = tmp_str.split(symbol).join(entity);
    }
    
    return tmp_str;
}

</script>


<script language="javascript">


var _MediaRSS = new Object;


if (!console)
{
    var console = new Object;
}

if (!console.log)    console.log = function(text) {}
if (!console.error)    console.error = function(text) {}


function MediaRSS(url) 
{

    if (!_MediaRSS.reportError) 
        _MediaRSS.reportError = function (text)
        {
            if (console)
                console.error(text);
            return null;
        }
    this.reportError = _MediaRSS.reportError;
    
    ///////////////////////////////
    
    if (!_MediaRSS.parseChannel)
        _MediaRSS.parseChannel = function ()
        {
            // 'this' is now the httpRequest, in which we stored the real 'this'.
            self = this.owner;
            if (self.httpRequest.readyState == 4 && self.httpRequest.status == 200) {
                var xml = self.httpRequest.responseXML;
                if (!xml)
                    return self.reportError('Invalid XML: ' + self.httpRequest.responseText);
                var root = xml.firstChild;
                if (root.nodeName == 'xml-stylesheet') // FIXME hack for feedburner
                    root = xml.childNodes[2];
                    
                if (root.nodeName != 'rss')
                    return self.reportError('Invalid RSS2.0: Root is not called rss; it is ' + root.nodeName + ': ' + self.httpRequest.responseText);
                if (!root.attributes.getNamedItem('version')) 
                    return self.reportError('Invalid RSS2.0: No version attribute');
                if (root.attributes.getNamedItem('version').nodeValue != '2.0')
                    return self.reportError('Invalid RSS2.0: Version not 2.0');
                
                var children = root.childNodes;
                for (var i = 0; i < children.length; i++)
                    if (children[i].nodeName == 'channel')
                    {
                        self.parseChannelProps(self,children[i].childNodes);
                        break;
                    }
                    
                for (var i = 0; i < children.length; i++)
                    if (children[i].nodeName == 'channel')
                    {
                        console.log("Entering parsing channel items...");
                        self.parseChannelItems(self,children[i].childNodes);
                        console.log("Parsed them");
                        break;
                    }
                    
                if (self.onfetch)
                    self.onfetch();
            }
        }
    this.parseChannel = _MediaRSS.parseChannel;
    
    ///////////////////////////////
    
    
    /////////// parsers of individual properties ////////////////////
    
    // generic <propname>content</propname> parser
    if (!_MediaRSS.parseRSSProp)
        _MediaRSS.parseRSSProp = function (propnode) {
            if (!(propnode.childNodes && propnode.childNodes.length > 0))
            {
                return undefined;
            }
            return propnode.childNodes[0].nodeValue;
        }
    this.parseRSSProp = _MediaRSS.parseRSSProp;
    
    if (!_MediaRSS.parseAtomLink)
        _MediaRSS.parseAtomLink = function (propnode) {
            var rel = propnode.attributes.getNamedItem('rel');
            if (!rel) 
                throw "Cannot establish relationship for <atom:link> tag";
            
            var href = propnode.attributes.getNamedItem('href');
            if (!href) 
                throw "Cannot establish hyperreference for <atom:link> tag";
            
            rel = rel.nodeValue;
            href = href.nodeValue;
            
            switch (rel)
            {
                case 'self':
                    this.atom_link_self = href;
                    break;
                case 'next':
                    this.atom_link_next = href;
                    break;
                case 'previous':
                    this.atom_link_prev = href;
                    break;
            }
        }
    this.parseAtomLink = _MediaRSS.parseAtomLink;
    
    ///////////////////////////////
    
    if (!_MediaRSS.parseChannelProps)
        _MediaRSS.parseChannelProps = function (self,children)
        {
            for (var i = 0; i < children.length; i++)
            {
                var child = children[i];
                
                if (child.nodeName == 'title')
                    self.title = self.parseRSSProp(child);
                if (child.nodeName == 'link')
                    self.link = self.parseRSSProp(child);
                if (child.nodeName == 'description')
                    self.description = self.parseRSSProp(child);
                if (child.nodeName == 'copyright')
                    self.copyright = self.parseRSSProp(child);
                if (child.nodeName == 'pubDate')
                    self.pubDate = self.parseRSSProp(child);
                if (child.nodeName == 'generator')
                    self.generator = self.parseRSSProp(child);
                if (child.nodeName == 'docs')
                    self.docs = self.parseRSSProp(child);
                    
                // from atom namespace...
                if (child.nodeName == 'atom:icon')
                    self.atom_icon = self.parseRSSProp(child);
                if (child.nodeName == 'atom:link')
                    self.parseAtomLink(child);
                    
            }
        }
    this.parseChannelProps = _MediaRSS.parseChannelProps;
    
    ///////////////////////////////
    
    // parses properties of individual item node
    if (!_MediaRSS.parseChannelItemProps)
        _MediaRSS.parseChannelItemProps = function (children,item)
        {
            for (var i = 0; i < children.length; i++) {
                var child = children[i];
                if (child.nodeName == 'title')
                    item.title = self.parseRSSProp(child);
                if (child.nodeName == 'link')
                    item.link = self.parseRSSProp(child);
                if (child.nodeName == 'description')
                    item.description = self.parseRSSProp(child);
                
                // dc namespace
                if (child.nodeName == 'dc:creator')
                    item.dc_creator = self.parseRSSProp(child);
                
                // media namespace
                if (child.nodeName == 'media:title' || child.nodeName == 'media:description')
                {
                    var type = 'plain';
                    if (child.attributes.getNamedItem('type'))
                        type = child.attributes.getNamedItem('type').nodeValue;
                        
                    var value = undefined;
                    if (type == 'html')
                        value = self.parseRSSProp(child);
                    else
                        value = htmlspecialchars(self.parseRSSProp(child),'ENT_QUOTES');
                        
                    if (child.nodeName == 'media:title')
                        item.media_title = value;
                    else if (child.nodeName == 'media:description')
                        item.media_description = value;
                }
                
                if (child.nodeName == 'media:thumbnail')
                {
                    if (!item.media_thumbnail)
                        item.media_thumbnail = new Array();
                    
                    var thumb = new Object;
                    item.media_thumbnail[item.media_thumbnail.length] = thumb;
                    
                    if (child.attributes.getNamedItem('width'))
                        thumb.width = child.attributes.getNamedItem('width').nodeValue;
                    if (child.attributes.getNamedItem('height'))
                        thumb.height = child.attributes.getNamedItem('height').nodeValue;
                    if (child.attributes.getNamedItem('url'))
                        thumb.url = child.attributes.getNamedItem('url').nodeValue;

                }
                
                if (child.nodeName == 'media:content')
                {
                    if (!item.media_content)
                        item.media_content = new Array();
                    
                    var content = new Object;
                    
                    if (child.attributes.getNamedItem('width'))
                        content.width = child.attributes.getNamedItem('width').nodeValue;
                    if (child.attributes.getNamedItem('height'))
                        content.height = child.attributes.getNamedItem('height').nodeValue;
                    if (child.attributes.getNamedItem('medium'))
                        content.medium = child.attributes.getNamedItem('medium').nodeValue;
                    if (child.attributes.getNamedItem('url'))
                        content.url = child.attributes.getNamedItem('url').nodeValue;

                    item.media_content[item.media_content.length] = content;
                }
                
            }
        }
    this.parseChannelItemProps = _MediaRSS.parseChannelItemProps;
    
    ///////////////////////////////

    // parses all items in a channel
    if (!_MediaRSS.parseChannelItems)
        _MediaRSS.parseChannelItems = function (self,children)
        {
            console.log("Parsing items...");
            self.items = new Array();
            for (var i = 0; i < children.length; i++)
            {
                var child = children[i];
                
                if (child.nodeName == 'item') {
                    var item = new Object;
                    self.items[self.items.length] = item;
                    
                    self.parseChannelItemProps(child.childNodes,item);
                    
                }
            }
        }
    this.parseChannelItems = _MediaRSS.parseChannelItems;
    
    ///////////////////////////////
    
    if (!_MediaRSS.fetchStuff)
        _MediaRSS.fetchStuff = function()
        {
                
            if (window.XMLHttpRequest)
                this.httpRequest = new XMLHttpRequest();
            else if (window.ActiveXObject)
                this.httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
            else 
            {
                alert("No XMLHttpRequest support");
                return;
            }

            try {
                if (netscape.security)
                    if (netscape.security.PrivilegeManager) 
                        try {
                            netscape.security.PrivilegeManager.enablePrivilege('UniversalBrowserRead');
                            console.log('Enabled privilege');
                        } catch (err) {
                            console.error('Privilege denied: ' + err);
                            //return;
                        }
                
            } catch (err) { // no netscape
            }
            

            try {
                this.httpRequest.open("GET", "?get=" + encodeURIComponent(this.url));
                this.httpRequest.owner = this;
                this.httpRequest.onreadystatechange = this.parseChannel;
                this.httpRequest.send(null);
                console.log('Requested ' + this.url);
            } catch (err) {
                console.error('Failed to get ' + this.url + ": " + err);
            }
            
            

        }
    this.fetchStuff = _MediaRSS.fetchStuff;
    
    // init code

    this.url = url;
    this.onfetch = undefined;
}


/////// helper function for rendering a gallery ////////////////////


function RenderMediaRSS()
{
    var out = '';

    // first put out the title
    out += "<h1>";
    // along with an icon
    if (this.atom_icon)
        out += "<img src=\"" + this.atom_icon + "\" height=\"25\" />";
    out += this.title;
    if (this.link) 
        out += "<a href=\"" + this.link + "\">[-]</a>";
    out += "</h1>";


    if (this.description)
        out += "<p><i>" + this.description + "</i></p>";
    
    
    out += "<hr>";
    
    
    // now lets output items
    for (var i = 0; i < this.items.length; i++)
    {
        var item = this.items[i];
        
        out += "<h2>";
        out += item.title;
        if (item.link)
            out += "<a href=\"" + item.link + "\">[-]</a>";
        out += "</h2>";
        
        if (item.media_title)
            out += "<p><i>media title: " + item.media_title + "</i></p>";
        if (item.media_description)
            out += "<p><i>media description: " + item.media_description + "</i></p>";
        if (item.description)
            out += "<p>" + item.description + "</p>";

            
        if (item.media_thumbnail) {
            var content = undefined;
            if (item.media_content)
            {
                
                for (var j = 0; j < item.media_content.length; j++)
                {
                    content = item.media_content[j];
                    
                    if (content.medium == 'image')
                        break;
                }
                if (!content)
                    content = item.media_content[0];
            }
            
            out += "<img onLoad=\"this.style.opacity='1.0';\" src=\"" + item.media_thumbnail[0].url + "\" ";
            if (content) {
                out += "onclick=\"";
                out += "  this.style.opacity='.25';";
                out += "  if (this.src=='" + content.url + "')"
                out += "    this.src='" + item.media_thumbnail[0].url + "';";
                out += "  else";
                out += "    this.src='" + content.url + "';";
                out += "  ";
                out += "\";";
            }
            out += "/>";
            
        }
        
        
        out += "<hr>";
            
    }
    
    // bottom navigation
    if (this.atom_link_prev) // FIXME need to encode the url entities
        out += "<a href=\"javascript:void(0);\" onclick=\"document.getElementById('gallery').innerHTML='loading...';  mediarss = new MediaRSS('" + this.atom_link_prev + "'); mediarss.onfetch = RenderMediaRSS; mediarss.fetchStuff();\">&lt; prev</a>";
    else
        out += "&lt; prev";
    
    out += " - ";
    
    if (this.atom_link_next) // FIXME need to encode the url entities
        out += "<a href=\"javascript:void(0);\" onclick=\"document.getElementById('gallery').innerHTML='loading...'; mediarss = new MediaRSS('" + this.atom_link_next + "'); mediarss.onfetch = RenderMediaRSS; mediarss.fetchStuff();\">next &gt;</a>";
    else
        out += "next &gt;";
        
    out += "<hr>";
    if (this.copyright)
        out += "<p><i>rss data: " + this.copyright + "</i></p>";
    out += "<p><i>mediarss: &copy; Ivan Vucica, 2009</i></p>";
    
    document.getElementById('gallery').innerHTML = out;
    
}

/////////// what happens ... /////////////
var mediarss = null;

function ExecMediaRSS() 
{
    var url = document.getElementById('galleryurl').value;
    var privileges = false;


    try {
        if (netscape.security)
            if (netscape.security.PrivilegeManager) 
                try {
                    netscape.security.PrivilegeManager.enablePrivilege('UniversalBrowserRead');
                    console.log('Enabled privilege');
                    
                                    
                    mediarss = new MediaRSS(url);
                    mediarss.onfetch = RenderMediaRSS;
                    mediarss.fetchStuff();
                    
                    document.getElementById('gallery').style.display = 'inherit';
                    privileges = true;
                } catch (err) {
                    console.log('Enabling privilege failed: ' + err);
                }
            else
                console.log('No privilegemanager');
        else
            console.log('No netscape.security');
    } catch (no_netscape_err) {
    }
    if (!privileges) {
        // try anyways ... we just might succeed
        mediarss = new MediaRSS(url);
        mediarss.onfetch = RenderMediaRSS;
        mediarss.fetchStuff();
        
        document.getElementById('gallery').style.display = 'inherit';
        
    }
    
}
</script>

<input size="50" id="galleryurl" value="http://ivan.vucica.net/thumber/rss.php?path=iskon/vic/"/>
<button onclick="document.getElementById('gallery').innerHTML='loading...'; ExecMediaRSS();">Get the gallery</button>
<br>
<button onclick="document.getElementById('galleryurl').value='http://ivan.vucica.net/thumber/rss.php?path=iskon/vic/';">Thumber Vic dana</button>
<button onclick="document.getElementById('galleryurl').value='http://backend.deviantart.com/rss.xml?q=gallery%3Agoranbaotic%2F479348&type=deviation&offset=0';">DeviantArt Goran</button>
<button onclick="document.getElementById('galleryurl').value='http://feedproxy.google.com/ZagrebackiRacunalniSavez-Novosti';">ZRS Novosti</button>


<div id="gallery" style="display:none;">
loading...
</div>



<hr>

For security reasons we allow URLs that begin only with:
<ul>
  <li>http://backend.deviantart.com/
  <li>http://ivan.vucica.net/
  <li>http://tornado.zrs.hr/~dcihlar/
  <li>http://feedproxy.google.com/
  <li>http://otfans.net/
  <li>http://www.zrs.hr/
</ul>
This is mostly because of the proxying using PHP that we need to do in order to bypass Firefox security measures. You can get the source and adapt to your needs, without these limitations.


</body>
</html>

<?
} else {

    if (
substr($_GET['get'], 07) != 'http://' &&
        
substr($_GET['get'], 08) != 'https://' )
          die();

    if (
substr($_GET['get'], 0strlen("http://backend.deviantart.com/")) != "http://backend.deviantart.com/" && 
        
substr($_GET['get'], 0strlen("http://feedproxy.google.com/")) != "http://feedproxy.google.com/" && 
        
substr($_GET['get'], 0strlen("http://ivan.vucica.net/")) != "http://ivan.vucica.net/" &&
        
substr($_GET['get'], 0strlen("http://tornado.zrs.hr/~dcihlar/")) != "http://tornado.zrs.hr/~dcihlar/" &&
        
substr($_GET['get'], 0strlen("http://www.zrs.hr/")) != "http://www.zrs.hr/" &&
        
substr($_GET['get'], 0strlen("http://otfans.net/")) != "http://otfans.net/")
        die();


    
header('Content-type: application/xml');
    echo 
file_get_contents($_GET['get']);

}
?>