<?php 
# ************** LICENCE ****************
/*
	Copyright (c) PORTANEO.
*/
# ***************************************
# save user mobile configuration
#
# !! be careful, this file must be saved under uft8 format, and display an e accentuated here : é
# ***************************************
$not_access=1;
$granted="I";

require_once('includes_mobile.php'); 
require_once('../../../feed.inc.php');
require_once('../../../xml.inc.php');

$id_user=$_SESSION['user_id'];
$check=$_POST['check'];
$nbportal=$_POST['nbportal'];
$nbrssreader=$_POST['nbrssreader'];
$pref_exist=$_POST['pref_exist'];
$nbchecked=count($check);

//--------delete previous widgets config--------
$DB->execute($delete_mobileconfig,$DB->escape($id_user));
$DB->freeResults();
//----------------------------------------------

for ($i = 0; $i < $nbchecked; $i++)
{
$profile_id=parser($check[$i],'profile_id=');
$uniq=parser($check[$i],'uniq=');

$DB->execute($display_widget,$DB->escape($id_user),$DB->escape($profile_id),$DB->escape($uniq));
$DB->freeResults();
}

//-------------update pref with inputs-------------
if ($pref_exist==0)
{
$DB->execute($user_pref,$DB->escape($id_user),$DB->escape($nbportal),$DB->escape($nbrssreader));
$DB->freeResults();
}
else
{
$DB->execute($user_pref_update,$DB->escape($nbportal),$DB->escape($nbrssreader),$DB->escape($id_user));
$DB->freeResults();
}
//-------------------------------------------------

header('location:portal.php');


?>  
      