<?php

renew_session();
$update_msg = '';
if (isset($_POST) && !empty($_POST)) {
    if (update_rss_channel($_POST)) {
        $update_msg = '<div class="green-msg"><p>New settings have been succesfully accepted.</p></div>';
    } else {
        $update_msg = '<div class="warning-msg"><p>Something went wrong, changes were not accepted.</p></div>';
    }
}
$actual_rss = get_rss_channel();
?>
<article id="rss-settings" class="container ibs-body">
	<header>
		<h2>RSS Feed Settings</h2>
		<p>
			<label>Your RSS Feed URL: </label>
			<input type="url" onclick="this.select()" value="<?php 
echo $actual_rss->link . '/rss-blogfeed.xml';
?>
" readonly>
		</p>
        <br />
        <?php 
echo $update_msg;
?>
		<p>Changes made here only affect your blog RSS feed file, therefor will be visible on the RSS Feed.</p>
		<p>Every post you publish and every revision you make to any of your posts will be reflected in your RSS Feed.</p>
        <div class="button-wrapper">
			<a class="button mat-button" onclick="enable_button(this)" ontouch="enable_button(this)" data-switch="OFF" data-button="go">Edit</a>
function rssitem_exist($guid)
{
    $channel = get_rss_channel();
    foreach ($channel[0] as $tag => $value) {
        if ($tag == 'item') {
        }
    }
}