<?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'); 

$check = $_POST['check'];
$nbchecked = count($check);
$tab = $_REQUEST['tab'];

$DB->execute($mobScrConfiguration_deleteOldConfiguration,$DB->escape($_SESSION['user_id']));

for ($i = 0; $i < $nbchecked; $i++) {
	$profile_id = parser($check[$i],'profile_id=');
	$uniq = parser($check[$i],'uniq=');
	$item_id = parser($check[$i],'item_id=');
    $nb_articles = (isset($_POST["nbart_".$uniq]))    ?     $_POST["nbart_".$uniq]
                                                      :     ''; 
    if ($nb_articles>35) $nb_articles = 35;                                                  
	$DB->execute($mobScrConfiguration_addWidget,$DB->escape($_SESSION['user_id']),$DB->escape($profile_id),$DB->escape($uniq),$DB->escape($nb_articles),$DB->escape($item_id));
}

header('location:portal.php?tab='.$tab);
?>