Exemplo n.º 1
0
}


	$smarty->assign("submit", isset($_POST['submit']), true);
	//has user generated profile yet?
	$profileExists = dibi::query('SELECT count(*) FROM [user] where [fb_id]=%i', $_SESSION['user']['id'])->fetchSingle();
	
	//there isn't user profile, let's search just the web and facebook
	if ( $profileExists == "0" )
	{
		$smarty->assign("noProfile", true, true);
	}

	if (isset($_POST['submit'])){
		
		$sWords = new StopWordsDictionary();
		
		//if there is user profile
		if ( $profileExists == "1" )
		{		
			$result = dibi::query('SELECT * FROM [user_word] WHERE %and ORDER BY priority desc, count desc', array(
				array('[priority] >=%i', 0),
				array('[id_user] = %i', $_SESSION['user']['id']),
			));
			
			$results = array();
			$yourWords = "";
			foreach ($result as $n => $row) {
				$results[$row['word']]= $row['count'];
				$yourWords.= $row['count'].": ".$row['word']."<br>";
			}
Exemplo n.º 2
0
<?php

require('./config.php');
if(!isset($_SESSION['loggedin'])) {
	header("location: ./index.php");
}



	if (isset($_POST['generate'])){
		
		
		$sWords 		= new StopWordsDictionary();
		$error = false;
		dibi::begin();
		
		
		/*
		 * Parse groups 
		 */
		$groups = json_decode(Content::getUrl("https://api.facebook.com/method/groups.get?access_token=".$_SESSION['access_token']."&format=json"), true);
		foreach ($groups as $group){

			
			$gDescription = strtolower(strip_tags($group['description']));
			//remove links
			$gDescription = preg_replace('@(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?)@', ' ', $gDescription);
			
			/*
			 * Parse words from group name
			 */