<?php
# ************** LICENCE ****************
/*
	Copyright (c) PORTANEO.
*/
# !! be careful, this file must be saved under uft8 format, and display an e accentuated here : é
$mobNotebook_getFriendsList="
	SELECT	a.friend_id,b.long_name,b.picture
	FROM	users AS b,
			network AS a
	WHERE	a.user_id=%u  
			AND b.id=a.friend_id";
// recovers info FROM users (alphabetical)
$mobNetwork_getAllUsersInfo= "
	SELECT 	a.id, 
			a.long_name, 
			a.stat, 
			a.picture,
			b.friend_id 
	FROM 	users AS a
			LEFT JOIN network AS b 
				ON (b.user_id=%u AND b.friend_id=a.id)
	WHERE 	a.long_name LIKE %s 
			AND a.typ='I'
	LIMIT %u,6
"; 
				  
//is friend
$mobProfile_checkIfItIsAFriend= "
               SELECT a.id, 
					  a.long_name, 
					  a.stat, 
					  a.picture,
					  b.friend_id 
			     FROM users AS a LEFT JOIN network AS b ON (b.user_id=%u AND b.friend_id=a.id)
				WHERE a.typ='I'
				  AND a.id=%u"; 
						
//recover 10 last news FROM friends
$mobNews_getNetworkNews= "SELECT b.*, 
					   c.picture , 
					   c.long_name 
			      FROM network AS a, 
					   network_news AS b, 
					   users AS c 
				 WHERE a.user_id=%u 
				   AND b.user_id=a.friend_id  
				   AND b.user_id=c.id 
		      ORDER BY pubdate  DESC  
		         LIMIT 0, 10";
				 			 
//recover 10 last news FROM user
$mobProfile_getUserNews="
                SELECT *  
			      FROM network_news 
				 WHERE user_id=%u  
		      ORDER BY pubdate  DESC  
		         LIMIT 0, 10";
		   
//recover pubdate commentary
$mobNotebook_newComments= "
	SELECT 	a.id, 
			a.pubdate 
	FROM 	notebook_comments AS a,
			notebook_article_users AS b 
	WHERE 	b.user_id=%u 
			AND b.article_id=a.article_id 
	ORDER BY pubdate";
			   
//recover pubdate (day) of friends article
$mobNotebook_countFriendsNewArticles= "
	SELECT a.friend_id, 
		   b.long_name, 
		   b.picture,
		   c.pubdate  
	  FROM network AS a,
		   users AS b, 
		   notebook_article_users AS c
	 WHERE a.user_id=%u 
	   AND b.id=a.friend_id
	   AND c.user_id=a.friend_id
	   AND DATE(c.pubdate)= CURRENT_DATE";
						   					   
//recover pubdate (week) of friends article
$mobNotebook_countFriendsNewArticlesToday= "
	SELECT a.friend_id, 
		   b.long_name, 
		   b.picture,
		   c.pubdate  
	  FROM network AS a,
		   users AS b, 
		   notebook_article_users AS c
	 WHERE a.user_id=%u 
	   AND b.id=a.friend_id
	   AND c.user_id=a.friend_id
	   AND TO_DAYS(NOW()) - TO_DAYS(c.pubdate) <= 7";
							   
//recover user article (display blog)
$mobNotebookArticles_getArticles= " SELECT a.id,
					 a.type,
					 a.commentsnb,
 					 a.title,
					 a.keywords,
					 a.description,
					 b.pubdate,
					 a.status,
					 b.user_id,
					 c.long_name,
					 b.take_on,
					 a.trackbacknb,
					 b.owner_id
				FROM notebook_article AS a,
				     notebook_article_users AS b,
					 users AS c
			   WHERE a.id=b.article_id
			     AND b.user_id=%u
				 AND c.id=b.owner_id
				 AND a.status IN ( %s )
		    ORDER BY a.id DESC
			LIMIT %u,5";
						   
//recover article & commentary (display blog)
$mobNotebookArticle_getArticle=" 
	  SELECT a.id,
			 a.title,
			 a.description,
			 a.pubdate AS article_pubdate,
			 a.type,
			 a.status,
			 a.keywords,
			 a.commentsnb,
			 b.user_id,
			 d.long_name,
			 d.picture,
			 c.message,
			 c.pubdate,
			 e.long_name
		FROM notebook_article_users AS b,
			 users AS e,
			 notebook_article AS a 
			 LEFT JOIN (notebook_comments AS c, users AS d) ON (a.id=c.article_id AND d.id=c.user_id)						 
	   WHERE a.id=%u
		 AND a.id=b.article_id
		 AND a.status IN ( %s )
		 AND b.user_id=%u
		 AND e.id=b.user_id
	ORDER BY c.pubdate ASC";
					   
//recover url of existing feed
$rss_url=" SELECT m.variables, m.pfid 
			 FROM (SELECT *, TRIM('pfid=' FROM LEFT(a.variables, LOCATE('&',a.variables)-1)) AS pfid FROM module AS a) AS m
			WHERE m.user_id = %u
			  AND pfid IN (SELECT pfid_view FROM mobile_selectedwidgets AS b WHERE b.user_id = m.user_id)";
		  
//recover last uniq of a user
$mobScrAddModule_getModulesPosition="
	SELECT 	MAX(uniq) AS uniqmax,
			MAX(posy) AS posymax
	FROM 	module
    WHERE 	user_id=%u";
							
//pour recupérer le dernier posy d'un utilisateur dans la table module
$last_posy_user_module=" SELECT 
						   FROM module
						  WHERE user_id=%u";							
							
//check if the feed already exist
$mobScrAddModule_checkIfFeedExist="
              SELECT url
 			    FROM dir_rss";
			   
//get pfid in dir_rss
$mobScrAddModule_getPfid="
           SELECT id
			 FROM dir_rss
			WHERE url=%s";
			
//check if the feed already exist for 
$check_module="SELECT uniq
				 FROM module
				WHERE user_id=%u
				  AND item_id=86
				  AND variables LIKE %s";
 
//fil mobile_userpref with
$mobScrConfiguration_addPreference="
	INSERT INTO mobile_userpref (user_id,nb_portal,nb_reader)
	VALUES (%u,%u,%u)";
				 
//update mobile_userpref with
$mobScrConfiguration_updatePreference="
	UPDATE 	mobile_userpref 
	SET 	nb_portal=%u,nb_reader=%u
	WHERE 	user_id=%u";
			 		   
//Retrieve note with noteid
$widNote_getNote="SELECT notes FROM users_notes WHERE id=%u";
		 								   
// to count the number of blog articles
$mobNotebookArticles_countArticles="SELECT  a.id,
					 a.status,
					 b.user_id
				FROM notebook_article AS a,
				     notebook_article_users AS b,
					 users AS c
			   WHERE a.id=b.article_id
			     AND b.user_id=%u
				 AND c.id=b.user_id
				 AND a.status IN ( 1, 2, 3 )
		    ORDER BY a.id DESC";		
$check_firstportal="SELECT DISTINCT a.name,
						  b.profile_id,
						  a.id
					 FROM profile AS a,
					      mobile_selectedwidgets AS b
					WHERE a.user_id=%u
				      AND b.profile_id=a.id
				 ORDER BY a.id ASC
					LIMIT 0,1";
					
//Get saved articles				
$mobXmlarticles_getArticles = "SELECT id,title,link,source,icon,pubdate,feedarticle_id 
							  FROM users_articles 
							 WHERE user_id=%u 
							   AND classified=0 
						  ORDER BY id DESC
							 LIMIT %u,%u ";						 
//delete user mobile config
$delete_searchpref="DELETE FROM mobile_usersearchpref 
					 WHERE user_id=%u";

//check user preference for search
$check_search_pref="SELECT *
					  FROM mobile_usersearchpref
					  WHERE user_id=%u";
					  
//fil mobile_usersearchpref with
$user_searchpref="
	INSERT INTO 	mobile_usersearchpref (user_id,cb)
	VALUES 			(%u,%u)
";
				 
//get comments
$detail_getComments_mobile = "
	SELECT		notebook_comments.id,user_id,long_name,pubdate,message,picture 
	FROM 		notebook_comments,users 
	WHERE 		article_id=%u 
				AND 	users.id=user_id 
				AND notebook_comments.status='O'
";
				
$widFav_getFavorite="SELECT a.url, a.name, a.tags, a.link_id FROM users_favorites AS a, users_favorites_id AS b WHERE a.link_id=%u AND a.id=b.id AND b.user_id=%u";
$widFav_addFavorite="INSERT INTO users_favorites(id,name,url,tags) SELECT id,%s,%s,%s FROM users_favorites_id WHERE user_id=%u";
$widFav_updateFavorite="UPDATE users_favorites,users_favorites_id SET name=%s,url=%s,tags=%s WHERE link_id=%u AND users_favorites.id=users_favorites_id.id AND user_id=%u";
$widFav_deleteFavorite="
	DELETE 	uf
	FROM 	users_favorites AS uf,
			users_favorites_id AS ufi
	WHERE 	link_id=%u
			AND uf.id=ufi.id
			AND user_id=%u ";

$widTask_getTasks="SELECT a.task_id, a.name, a.done FROM users_tasks AS a, users_tasks_id AS b WHERE a.id=%u AND a.id=b.id AND b.user_id=%u LIMIT %u,6";
$widTask_getTask=" SELECT a.task_id, a.comments, a.name, a.done FROM users_tasks AS a, users_tasks_id AS b WHERE a.task_id=%u AND a.id=b.user_id AND b.user_id=%u";
$widTask_addTask="
	INSERT INTO 	users_tasks (id,comments,name)
	SELECT 			id,
					%s,
					%s
	FROM 			users_tasks_id
	WHERE 			id=%u
					AND user_id=%u ";
$widTask_RemoveTask="DELETE users_tasks FROM users_tasks, users_tasks_id WHERE task_id=%u AND users_tasks.id=users_tasks_id.user_id AND user_id=%u";
$widTask_updateTask="UPDATE users_tasks,users_tasks_id SET name=%s,comments=%s WHERE task_id=%u AND users_tasks.id=users_tasks_id.id AND user_id=%u";
//cancel a done task
$widTask_changeStatus="
	UPDATE 	users_tasks,
			users_tasks_id
	SET		done=%s
	WHERE	task_id=%u
			AND users_tasks.id=users_tasks_id.id
			AND user_id=%u";

$widAddress_getContacts="SELECT a.add_id,a.firstname,a.lastname FROM widget_addressbook AS a,widget_addressbook_id AS b WHERE a.id=%u AND a.id=b.id AND b.user_id=%u LIMIT %u,6";
$widAddress_getContact="SELECT a.add_id,a.firstname,a.lastname,a.email,a.company,a.func,a.phone1,a.phone2,a.other,a.tags FROM widget_addressbook AS a,widget_addressbook_id AS b WHERE a.add_id=%u AND a.id=b.id AND b.user_id=%u";
$widAddress_addContact="
	INSERT INTO	widget_addressbook (id,firstname,lastname,email,company,func,phone1,phone2,other,tags)
	SELECT		id,%s,%s,%s,%s,%s,%s,%s,%s,%s
	FROM		widget_addressbook_id
	WHERE		id=%u
				AND user_id=%u ";
$widAddress_removeContact="
	DELETE		a
	FROM		widget_addressbook AS a,
				widget_addressbook_id AS b
	WHERE 		add_id=%u
				AND a.id=b.id
				AND user_id=%u ";
$widAddress_updateContact="
	UPDATE	widget_addressbook,
			widget_addressbook_id
	SET		firstname=%s,
			lastname=%s,
			email=%s,
			company=%s,
			func=%s,
			phone1=%s,
			phone2=%s,
			other=%s,
			tags=%s
	WHERE	add_id=%u
			AND widget_addressbook.id=widget_addressbook_id.id
			AND user_id=%u ";

// display the 5 first event
$widCal_getEvents="SELECT a.cal_id,a.title,a.comments,a.pubdate,a.time,a.endtime FROM users_calendar AS a, users_calendar_id AS b WHERE a.id=%u AND a.id=b.id AND b.user_id=%u ORDER BY pubdate,time asc LIMIT %u,6";
$widCal_getEvent="
	SELECT	a.cal_id,
			a.title,
			a.comments,
			a.pubdate,
			a.time,
			a.endtime
	FROM	users_calendar AS a,
			users_calendar_id AS b
	WHERE	a.cal_id=%u
			AND a.id=b.id
			AND b.user_id=%u";
$widCal_addEvent="INSERT INTO users_calendar (id,title,comments,pubdate,time,endtime) SELECT id,%s,%s,%s,%s,%s FROM users_calendar_id WHERE id=%u AND user_id=%u";
$widCal_updateEvent="
	UPDATE	users_calendar,
			users_calendar_id
	SET		title=%s,
			comments=%s,
			pubdate=%s,
			time=%s,
			endtime=%s
	WHERE	cal_id=%u
			AND users_calendar.id=users_calendar_id.id
			AND user_id=%u ";
$widCal_removeEvent="
	DELETE	uc
	FROM	users_calendar AS uc,
			users_calendar_id AS uci
	WHERE	cal_id=%u
			AND uc.id=uci.id
			AND user_id=%u ";

//display all article of my notebook
$mobNotebookArticles_getArticlesListId="
	SELECT	article_id
	FROM	notebook_article_users
	WHERE	user_id =%u";

$scraddmodule_getPosition="
	SELECT	MAX(posy) as posy,
			MAX(uniq) as uniq
	FROM	module
	WHERE	user_id=%u
	GROUP BY user_id";





    
    
    
    


//New queries since V2
$login_check_user_access = "SELECT access FROM mobile_grantedusers WHERE user_id = %u";
$portalConfiguration_getUserWidgets='
SELECT modu.profile_id,
       modu.item_id,
       modu.variables,
       modu.uniq,
       mob_widgets.title AS widget_name,
       dir.format,
       prof.name AS tab_name,
       mob_selected.uniq AS check_uniq,
       mob_selected.nb_articles,
       mob_widgets.available
FROM module AS modu
INNER JOIN profile AS prof ON (prof.id = modu.profile_id)
INNER JOIN dir_item AS dir ON dir.id = modu.item_id
INNER JOIN mobile_widgets AS mob_widgets ON mob_widgets.item_id = modu.item_id
LEFT JOIN mobile_selectedwidgets AS mob_selected ON ( mob_selected.uniq = modu.uniq 
                                                      AND mob_selected.profile_id = modu.profile_id )                                              
WHERE modu.user_id = %u
AND mob_widgets.available = 1
ORDER BY modu.profile_id ASC , modu.posx ASC , modu.posy ASC';
$portalConfiguration_getUserPreferences="SELECT user_id, nb_portal FROM mobile_userpref WHERE user_id=%u";
$mobScrConfiguration_deleteOldConfiguration="
	DELETE 
	FROM	mobile_selectedwidgets 
    WHERE	user_id=%u";	
$mobScrConfiguration_addWidget="
	INSERT INTO mobile_selectedwidgets (user_id,profile_id,uniq,nb_articles,item_id) 
	VALUES 		(%u,%u,%u,%u,%u)";
$mobPortal_getTabs="
	SELECT DISTINCT 	a.name,
						a.id
	FROM 				profile AS a,
						mobile_selectedwidgets AS b 
	WHERE				b.profile_id=a.id
						AND a.user_id=%u
	ORDER BY 			a.id ASC";
$mobPortal_getWidgets="
SELECT modu.item_id,
       modu.variables,
       mob_widgets.title AS widget_name,
       mob_widgets.picture,
       dir.format,
       mob_selected.nb_articles
FROM module AS modu
INNER JOIN profile AS prof ON (prof.id = modu.profile_id)
INNER JOIN dir_item AS dir ON dir.id = modu.item_id
RIGHT JOIN mobile_widgets AS mob_widgets ON mob_widgets.item_id = modu.item_id
RIGHT JOIN mobile_selectedwidgets AS mob_selected ON ( mob_selected.uniq = modu.uniq 
                                                       AND mob_selected.profile_id = modu.profile_id )                                              
WHERE modu.user_id = %u
AND prof.id = %u
AND mob_widgets.available = 1
ORDER BY modu.profile_id ASC , modu.posx ASC , modu.posy ASC
LIMIT 0 , 30";
$checkIfNewUser = "
    SELECT profile_id
    FROM mobile_selectedwidgets
    WHERE user_id = %u
    LIMIT 1";
$login_check_modules_uniq = "
    SELECT item_id 
    FROM module
    WHERE user_id = %u
    AND uniq = 0";
$portal_getwidget_properties = "
	SELECT a.variables,
		   c.format,
           c.url,
           c.typ,
		   a.uniq,
		   c.height,
		   d.title AS widget_name,
		   b.nb_articles
	  FROM module AS a,
		   mobile_selectedwidgets AS b,
		   dir_item AS c,
           mobile_widgets AS d
	 WHERE a.uniq = b.uniq
	   AND a.user_id = %u
	   AND b.profile_id = %u
       AND a.item_id = %u
	   AND a.profile_id = b.profile_id
	   AND a.user_id = b.user_id
	   AND a.item_id = c.id
       AND a.item_id = d.item_id
  ORDER BY a.profile_id ASC,
		   a.posx ASC,
		   a.posy ASC";
$widFav_getFavorites=" 
    SELECT a.url,a.name,a.tags,a.link_id 
    FROM users_favorites AS a, users_favorites_id AS b 
    WHERE a.id=%u 
    AND a.id=b.id 
    AND b.user_id=%u 
    LIMIT %u,6";
$mobPortalAddModule_getAvailableWidgetsList="
    SELECT *
    FROM mobile_widgets AS mob_widgets
    WHERE mob_widgets.available = 1
    ORDER BY mob_widgets.item_id ASC
    LIMIT 0 , 30";
$mobPortalAddModule_getUserTabs="
	SELECT	id,
			name
	FROM	profile
	WHERE	user_id = %u";
$xmlfeeds_getItem = "
    SELECT a.title,a.link,a.description,a.image,
	       a.video,a.audio,a.pubdate,a.source,b.status
      FROM feed_articles AS a
      LEFT JOIN feed_articles_read AS b ON a.id = b.article_id
	  WHERE a.feed_id = %u
      AND a.id = %u";
$info_user= "
	SELECT 	a.id, 
			a.long_name, 
			a.picture, 
			a.stat,
			a.description,
			a.lastconnect_date,
			a.keywords 
	FROM 	users AS a
	WHERE a.id=%u";
$mobNetwork_getFriends= "
	SELECT DISTINCT 	a.friend_id, 
						a.description, 
						b.long_name,
						b.firstname,
						b.stat, 
						b.picture
	FROM 				network AS a,
						users AS b
	WHERE 				a.user_id=%u  
	AND 	            b.id=a.friend_id
    ORDER BY            b.long_name,b.firstname ASC
	LIMIT 				%u,6";
$mobNetwork_getFriendsFiltered= "
	SELECT DISTINCT 	a.friend_id, 
						a.description, 
						b.long_name, 
						b.stat, 
                        b.firstname,
						b.picture,
						d.label 
	FROM 				users AS b,
						network AS a,
						network_keywords AS c,
						search_keyword AS d
	WHERE 				a.user_id=%u 
				AND 	c.friend_id=a.friend_id 
				AND 	c.user_id=a.user_id 
				AND 	d.label LIKE %s 
				AND 	d.id=c.kw_id  
				AND 	b.id=a.friend_id
    ORDER BY            b.long_name,b.firstname ASC
	LIMIT 				%u,6";
$mobUsers_getUserDescription = "SELECT description FROM users WHERE id = %u";
$mobNetwork_getUserDescription = "SELECT description FROM network WHERE user_id = %u AND friend_id = %u";
$mobNotebookArticle_getUserInfo= "
	SELECT 	a.id, 
			a.long_name, 
			a.picture, 
			a.stat,
            a.firstname,
			a.description,
			a.lastconnect_date,
			b.friend_id,
			a.keywords 
	FROM 	users AS a
			LEFT JOIN network AS b 
				ON (b.user_id=%u AND b.friend_id=a.id) 
	WHERE a.id=%u";
$mobRssWidgetUnreadArticles = "            
    SELECT DISTINCT a.id,b.status
    FROM feed_articles AS a
    LEFT JOIN feed_articles_read AS b ON b.article_id = a.id
                                      AND b.user_id = %u
    WHERE a.feed_id = %u
    AND (b.status <>2
        OR b.status IS NULL)
    ORDER BY a.id DESC
    LIMIT 0,%u";
$mobGetUserWorkingGroups = "
SELECT  a.id,
            a.name,
            a.description,
            a.picture,
            a.created_by,
            a.status
    FROM    notebook_groups a
    INNER JOIN notebook_groups_users_map AS d ON (d.group_id = a.id)
    WHERE d.user_id = %u
    AND d.status = 'O'
    ORDER BY a.name ASC
    LIMIT %u,11";
$mobNetworkusers_getUsersByNotebook = "
	SELECT	b.id,
			b.long_name,
            b.firstname,
			b.username,
			b.email,
			b.picture,
			b.description,
			b.stat,
			b.statdate,
			b.activity,
			b.lastconnect_date,
			NOW() AS dbdate,
			c.id AS created_by
	FROM	notebook_groups_users_map AS a 
	INNER JOIN users AS b ON (a.user_id = b.id) 
	INNER JOIN notebook_groups AS d ON (d.id = a.group_id) 
	INNER JOIN users AS c ON (c.id = d.created_by) 
	WHERE	a.group_id = %u 
    AND b.typ IN ('I','A') 
    AND a.status = 'O'
	ORDER BY b.long_name ASC
    LIMIT %u,11";
    
    
//Modules
$addmodul="INSERT INTO module (item_id, user_id, profile_id, posx, posy, posj, x, y, variables, uniq) VALUES (%u, %u, %u, 1, %u, 1, 150, 150, %s, %u)";
$widlink_addNewLink = "INSERT INTO users_favorites (id,name,url,tags) VALUES (%u,%s,%s,%s) ";
$widlink_addNewLinkId2 = "INSERT INTO users_favorites_id (id,user_id,status,shared) VALUES(%u,%u,'A',%s) ";
$widlink_getIdLink = "SELECT id FROM users_favorites_id WHERE id=%u  AND user_id=%u";
$delete_favorits = "DELETE uf FROM users_favorites AS uf, users_favorites_id AS ufi WHERE link_id=%u AND uf.id=ufi.id AND user_id=%u";
$widcal_newModuleId2 = "INSERT INTO users_calendar_id (user_id,status,shared) VALUES(%u,'A',%s) ";
$widcal_newModuleEvent = "INSERT INTO users_calendar (id,title,comments,pubdate,time,endtime) VALUES (%u,%s,%s,%s,%s,%s) ";
$widCal_updateEvent="UPDATE users_calendar,users_calendar_id SET title=%s,comments=%s,pubdate=%s,time=%s,endtime=%s WHERE cal_id=%u AND users_calendar.id=users_calendar_id.id AND users_calendar_id.user_id=%u";
$widAddr_createNewId="INSERT INTO widget_addressbook_id(user_id,status,shared)VALUES(%u,'A',%s)";
$widAddr_addNewContact="INSERT INTO widget_addressbook (id,firstname,lastname,email,company,func,phone1,phone2,other,tags)VALUES(%u,%s,%s,%s,%s,%s,%s,%s,%s,%s)";
$widAddr_updateContact="UPDATE widget_addressbook,widget_addressbook_id SET firstname=%s,lastname=%s,email=%s,company=%s,func=%s,phone1=%s,phone2=%s,other=%s,tags=%s WHERE add_id=%u AND widget_addressbook.id=widget_addressbook_id.id AND user_id=%u";
$widtask_addNewTaskId = "INSERT INTO users_tasks_id (user_id,status,shared) VALUES(%u,'A',%s) ";
$widAddress_getContact2="SELECT a.add_id,a.firstname,a.lastname,a.email,a.company,a.func,a.phone1,a.phone2,a.other,a.tags FROM widget_addressbook AS a,widget_addressbook_id AS b WHERE a.add_id=%u AND a.id=b.id AND b.user_id=%u";
$widAddr_RemoveContact="DELETE a FROM widget_addressbook AS a,widget_addressbook_id AS b WHERE a.add_id=%u AND a.id=b.id AND user_id=%u";
$widtask_newModInsertTask = "INSERT INTO users_tasks (id,comments,name) VALUES (%u,%s,%s)";
$widtask_newModUpdateTask = "UPDATE users_tasks SET name=%s,comments=%s WHERE task_id=%u";
$widTask_getTasks2="SELECT a.task_id, a.name, a.done FROM users_tasks AS a, users_tasks_id AS b WHERE a.id=%u AND a.id=b.id AND b.user_id=%u LIMIT %u,6";
$widTask_getOneTask=" SELECT a.task_id, a.comments, a.name, a.done FROM users_tasks AS a, users_tasks_id AS b WHERE a.task_id=%u AND a.id=b.id AND b.user_id=%u";
$widTask_RemoveOneTask="DELETE users_tasks FROM users_tasks, users_tasks_id WHERE task_id=%u AND users_tasks.id=users_tasks_id.id AND user_id=%u";
$widlink_addModLink = "INSERT INTO users_favorites_id (user_id,status,shared) VALUES(%u,'A',%s) ";
$widlink_addModNote = "INSERT INTO users_notes (user_id,notes,shared) VALUES(%u,'',%s) ";
$mobScrConfiguration_deleteOldConfigurationModule="
	DELETE 
	FROM	mobile_selectedwidgets 
    WHERE	user_id=%u AND uniq=%u";
$delete_calendarEvent = "DELETE uc FROM users_calendar AS uc, users_calendar_id AS uci WHERE cal_id=%u AND uc.id=uci.id AND user_id=%u";
$updModule="UPDATE module SET variables=%s WHERE user_id=%u AND uniq=%u";
$widlink_addNewLinkId = "INSERT INTO users_favorites_id (user_id,status,shared) VALUES(%u,'A',%s) ";    
?>