<?PHP
#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|
#|                                                                        #|
#|         JabboCMS - Website and Content Management System               #|
#|         Copyright © 2011 Jor.dan. All rights reserved.                 #|
#|																		  #|
#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|

	include("./global.php");
	if(!session_is_registered(username))
		{
			Redirect("".$url."");
			exit();
		}
		else {
		$id = Securise($_GET['id']);
		
			if($id == "motto") {
				$sql = mysql_query("SELECT spam FROM users WHERE username = '".$user['username']."'");
				$assoc = mysql_fetch_assoc($sql);
				if($assoc['spam'] > 3) {
					echo "<script> alert('Le spam est interdit sur Jabbo!'); </script>";
					echo "Le spam est interdit sur Jabbo!";
					mysql_query("UPDATE users SET spam = '0' WHERE username = '".$user['username']."'");
									   } else {
				$motto = Securise($_POST['motto']);
				mysql_query("UPDATE users SET motto = '".$motto."', spam = spam + 1 WHERE username = '".$user['username']."'");
				echo $motto;
											  }
							   }
			 elseif($id == "viewtag") {
					$sql = mysql_query("SELECT tag FROM user_tags ORDER BY RAND() LIMIT 0,10");
					echo "<div class=\"habblet box-content\">
<ul class=\"tag-list\">";
					while($tag = mysql_fetch_array($sql))
						{
							echo "<li>
									<a class=\"tag\" href=\"".$url."/tag.php?tag=".$tag['tag']."\" style=\"font-size:11px;\">".$tag['tag']."</a></li>";
						}
					echo "</ul><div class=\"tag-search-form\">

<form name=\"tag_search_form\" action=\"".$url."/tag.php\" class=\"search-box\">

    <input type=\"text\" name=\"tag\" id=\"search_query\" value=\"\" class=\"search-box-query\" style=\"float: left\"/>

	<a onclick=\"$(this).up('form').submit(); return false;\" href=\"#\" class=\"new-button search-icon\" style=\"float: left\"><b><span></span></b><i></i></a>	

</form>    </div>
</div>";
				} elseif($id == "deletefriends") {
							
							if(isset($_POST['friendList']))	
							{
								$friend = $_POST['friendList'];
									
								
								foreach($friend as $val) {
								$id = Securise($val);
								if(is_numeric($id)) {
								mysql_query("DELETE FROM messenger_friendships WHERE user_one_id = '".$user['id']."' AND user_two_id = '".$id."'");
								mysql_query("DELETE FROM messenger_friendships WHERE user_two_id = '".$user['id']."' AND user_one_id = '".$id."'");
								}
								
								
														 }
														 echo "<br>Supression r&eacute;ussi. <a href=\"".$url."/friend.php\">Cliquer ici pour retourner &agrave; la gestion d'amis.</a>";
										 
							
			} elseif(isset($_POST['friendList']))
				{	
				$id = Securise($_POST['friendList']);
				mysql_query("DELETE FROM messenger_friendships WHERE user_one_id = '".$user['id']."' AND user_two_id = '".$id."'");
				mysql_query("DELETE FROM messenger_friendships WHERE user_two_id = '".$user['id']."' AND user_one_id = '".$id."'");
				}
				else {
					echo "Il est impossible de supprimer cet amis.";
				}
			} 
								
					}
				
			
?>