<?php

//header("Content-Type: application/xml; charset=ISO-8859-1");
include_once "addlogic.inc.php";
include_once "lifestylelinking/rsscode/classes/RSS.class.php";
$lifestylelid = escapeinteger($_GET['lifestyleid']);
//echo $lifestylelid;
//$lifestylesubid = escapeinteger($_GET['lifestylesubid']);
//echo $lifestylesubid;
$rss = new RSS();
echo $rss->GetFeed($lifestylelid);
function magazinesections()
{
    global $magsect;
    // display lifestyle magazine sections
    // first find out which magazine section have been setup
    $db->query = "SELECT * FROM " . RSSDATA . ".lifestylegroups LIMIT 6 ";
    $resultlg = mysql_query($db->query) or die("Error in query: {$db->query}. " . mysql_error());
    if (mysql_num_rows($resultslg) > 0) {
        while ($row = mysql_fetch_object($resultlg)) {
            $livegroup[] = $row->groupid;
        }
    }
    // closesif
    $db->query = "SELECT * FROM " . RSSDATA . ".lifestylegroups WHERE ";
    foreach ($livegroup as $lgrp) {
        $db->query .= " " . RSSDATA . ".lifestylegroups.groupid = {$lgrp} OR";
    }
    // closes foreach
    $db->query = substr($db->query, 0, strLen($db->query) - 3);
    //this will eat the last OR
    $resultslg = mysql_query($db->query) or die("Error in query: {$db->query}. " . mysql_error());
    if (mysql_num_rows($resultslg) > 0) {
        $magsect = '';
        //  need to find out current magazine section selected, via getmags or via lifestylelid
        if (!$_GET['mags']) {
            if ($_GET['lifestyleid']) {
                $lifeselmag = escapeinteger($_GET['lifestyleid']);
                $db->query = "SELECT * FROM  " . RSSDATA . ".grouplink WHERE " . RSSDATA . ".grouplink.idlifestyle = '{$lifeselmag}' ";
                $resultcmagl = mysql_query($db->query) or die("Error in query: {$db->query}. " . mysql_error());
                if (mysql_num_rows($resultcmagl) == 1) {
                    $row = mysql_fetch_object($resultcmagl);
                    $curmagset = $row->groupid;
                }
            } else {
                $_GET['mags'] = 1;
            }
        } else {
            $curmagset = escapeinteger($_GET['mags']);
        }
        while ($row = mysql_fetch_object($resultslg)) {
            //  if groupid matches currentid then underline
            if ($curmagset == $row->groupid) {
                $magsect .= "<div class=\"magalist\"><b><a href=\"" . makeurla('index.php') . "?mags={$row->groupid}\" id=\"current\" >{$row->groupname}</a></b>&nbsp &nbsp</div>";
            } else {
                $magsect .= "<div class=\"magalist\"><b><a href=\"" . makeurla('index.php') . "?mags={$row->groupid}\">{$row->groupname}</a></b>&nbsp &nbsp</div>";
            }
        }
        //$magsect .= "<div class=\"magalist\"><a href=\"".makeurla('index.php')."?metext=3\">more</a></div>";
    }
    echo $magsect;
}

          <div class="leftbox">           
               <div class="leftboxedit">
               <a href="/lifestylelinking/me/index.php?metext=3">Add/Edit lifestyle</a>
               </div>
<?php 
echo $memenulist;
?>

        </div> <!-- closes leftbox-->

<?php 
// what content to display logic
if ($_GET['metext']) {
    $_SESSION[metext] = escapeinteger($_GET['metext']);
}
if ($_SESSION[metext] == 4) {
    include_once 'lifestylelinking/me/homestart.php';
} elseif ($_SESSION[metext] == 3) {
    include_once 'lifestylelinking/me/lifestylelist.php';
}
?>

</div> <!-- closes topbox-->

<br />
<br />

</div>   <!-- closes mid -->
	
<?php

include_once "addlogic.inc.php";
include_once "lifestylelinking/widgets/widgetapi.php";
// get info from url to find out what has been asked for.   START of mepath API/ REST/Oauth implementation
$lifestylelidr = escapeinteger($_REQUEST['lifestyleid']);
//echo $lifestylelid;
$lifestylesubid = escapeinteger($_GET['lifestylesubid']);
//echo $lifestylesubid;
$widlim = escapeinteger($_GET['widlim']);
//echo $widlim;
if ($widim = null) {
    $widlim = 5;
}
widgetcodelimit($lifestylelidr, $widlim);
//echo $file;
//echo $widgetcode;
$widget = '';
$widget .= "\r\n\r\nvar lifestylelinks = '';   \r\n\r\n// write the badge\r\n\t\r\nlifestylelinks+= '" . $widgetcode . "';\r\n\r\nlifestylelinks = unescape(lifestylelinks);\r\n\r\ndocument.write(lifestylelinks); \r\n\r\n";
echo $widget;
<div class="peergroup">

<?php 
    //mostlikelifestyle ($lifestylelid);
    pergroupdplay($lifestylelid, $feedid);
    echo $ppeergroup;
} elseif (($_GET['filtext'] == 2 || $_SESSION['filtext'] == 2) && $_SESSION[metext] == 1) {
    // latest from personalized peer group and filter to pick out the best from the posts. (also can have publics peer groups)
    //echo 'filtered';
    $lifestylelid = $_SESSION[mecid];
    //echo $lifestylelid.' lifestlyeid??';
    $lifestylelidaa = idstartconvert($_SESSION[mecid]);
    //echo $lifestylelidaa.' lifestlyeid??';
    $feedid = $_SESSION[mefid];
    if (isset($_GET['filtext'])) {
        $filtext = escapeinteger($_GET['filtext']);
    } else {
        $filtext = $_SESSION['filtext'];
    }
    pergrpposts($feedid, $lifestylelidaa, $filtext);
    ?>

<br /><br />

<?php 
    //echo $llpaging;
    ?>

</div>  <!-- closes postbox-->

</div>  <!-- closes contenttab-->
?>
<div align="right" ><a href="/lifestylelinking/rsscode/index.php?lifestyleid=<?php 
echo $lifestylelid;
?>
"><img src="/lifestylelinking/images/rssicon.gif"></a></div>

</div>  <!-- closes metext -->

<?php 
if ($lifestylelid == 46 && $_SESSION[mefid] != 598) {
    //converts the data into proper XML form and finally
    //relays XML data document to the chart
    $strDataURL = "/lifestylelinking/charts/melifestyle.php";
} elseif ($lifestylelid == 46 && $_SESSION[mefid] == 598) {
    $strDataURL = "/lifestylelinking/charts/meaverage.php";
} elseif ($_REQUEST['lifestyleid'] && $_REQUEST['feedid']) {
    $_SESSION[chartlid] = escapeinteger($_REQUEST['lifestyleid']);
    $_SESSION[chartfeed] = escapeinteger($_REQUEST['feedid']);
    //relays XML data document to the chart
    $strDataURL = "/lifestylelinking/charts/melifedata.php";
} else {
    $strDataURL = "/lifestylelinking/charts/mevpeers.php";
}
//Create the chart - Pie 3D Chart with dataURL as strDataURL
echo renderChart("/fusioncharts/Charts/FCF_MSLine.swf", $strDataURL, "", "reltime", 550, 400, false, false);
?>



       </div> <!-- closes rightbox-->