<commit_before><?php

namespace Likeme\SystemBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;

class PictureController extends Controller
{
    /**
     * @Route("/pictures", name="pictures")
     * @Template()
     */
    public function showAction()
    {
    
    	// Create our Application instance (replace this with your appId and secret).
		$facebook = new \Facebook(array(
  			'appId'  => '100806270069332',
  			'secret' => '98c29a3bd105813b3308e24a404d23f1',
		));

    	// See if there is a user from a cookie
        $user = $facebook->getUser();
        
        if ($user) {
        	try {
        		// Proceed knowing you have a logged in user who's authenticated.
        		$user_profile = $facebook->api('/me');
        	} catch (FacebookApiException $e) {
        		echo '<pre>'.htmlspecialchars(print_r($e, true)).'</pre>';
        		$user = null;
        	}
        }
        
        echo $user_profile['name'];
        
        return array('name' => $user_profile['name']);
       
    }
    
}<commit_msg>Load Pictures from FB (beta with all albums)<commit_after><?php

namespace Likeme\SystemBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;

class PictureController extends Controller
{
    /**
     * @Route("/pictures", name="pictures")
     * @Template()
     */
    public function showAction()
    {
    
    	// Create our Application instance (replace this with your appId and secret).
		$facebook = new \Facebook(array(
  			'appId'  => '100806270069332',
  			'secret' => '98c29a3bd105813b3308e24a404d23f1',
		));

    	// See if there is a user from a cookie
        $user = $facebook->getUser();
        
        if ($user) {
        	try {
        		// Proceed knowing you have a logged in user who's authenticated.
        		$user_profile = $facebook->api('/me');
        	} catch (FacebookApiException $e) {
        		echo '<pre>'.htmlspecialchars(print_r($e, true)).'</pre>';
        		$user = null;
        	}
        }

	
        $token = $facebook->getAccessToken();     
          
     	$extAlbumUrl = "https://graph.facebook.com/".$user_profile['id']."/albums?fields=id,name,type&access_token=".$token."&limit=0";
       
    	$albums = json_decode(file_get_contents($extAlbumUrl),true);
    	$albums = $albums['data'];
    	
    	foreach ($albums as $row)
    	{
    		//if ($row['type'] == 'normal')
    		//{
    			echo '<a href="photos.php?albumid=' . $row['id'] . '">';
    			echo $row['name'];
    			echo '</a><br>';
    			
    			$contents = file_get_contents("https://graph.facebook.com/" . $row['id'] . "/photos?access_token=".$token."&limit=30");
    			$photos = json_decode($contents,true);
    			$photos = $photos['data'];
    			 
    			foreach ($photos as $row)
    			{
    				echo '<img src="' . $row['images'][1]['source'] . '" /><br>';
    			}
    		//}
    	}
    	
    	
    	var_dump($albums);

    	
        return array('name' => $user_profile['name']);
       
    }
    
}
{'fraction_non_alphanumeric': 0.15382253607614368, 'fraction_numerical': 0.024562480810561865, 'mean_word_length': 2.3691830403309204, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 23, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3136204', 'n_tokens_mistral': 1148, 'n_tokens_neox': 1055, 'n_words': 198}