source: extensions/FacebookPlug/Server/include/common.php @ 8425

Last change on this file since 8425 was 8425, checked in by rub, 13 years ago

Happy new year!

Change header of maintained extensions

  • Property svn:eol-style set to LF
File size: 2.5 KB
Line 
1<?php
2// +-----------------------------------------------------------------------+
3// | FacebookPlug - a Piwigo Plugin                                        |
4// | Copyright (C) 2010-2011 Ruben ARNAUD - rub@piwigo.org                 |
5// +-----------------------------------------------------------------------+
6// | This program is free software; you can redistribute it and/or modify  |
7// | it under the terms of the GNU General Public License as published by  |
8// | the Free Software Foundation                                          |
9// |                                                                       |
10// | This program is distributed in the hope that it will be useful, but   |
11// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
12// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
13// | General Public License for more details.                              |
14// |                                                                       |
15// | You should have received a copy of the GNU General Public License     |
16// | along with this program; if not, write to the Free Software           |
17// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
18// | USA.                                                                  |
19// +-----------------------------------------------------------------------+
20
21defined('FACEBOOKPLUG_ROOT_PATH') or trigger_error('Hacking attempt!', E_USER_ERROR);
22
23require_once(FACEBOOKPLUG_ROOT_PATH . 'include/constants.php');
24require_once(FACEBOOKPLUG_ROOT_PATH . 'include/constants_secret.php');
25require_once(FACEBOOKPLUG_ROOT_PATH . 'include/facebook.php');
26require_once(FACEBOOKPLUG_ROOT_PATH . 'include/functions.php');
27
28// Main global var
29$conf = array();
30
31// Default config
32include(FACEBOOKPLUG_ROOT_PATH . 'include/config_default.php');
33
34// Init Facebook
35$facebook = new Facebook(array(
36  'appId'  => FACEBOOK_APP_ID,
37  'secret' => FACEBOOK_SECRET,
38  'cookie' => true, // enable optional cookie support
39));
40
41//~ print_r($_COOKIE);
42
43
44function d($d)
45{
46  echo '<pre>';
47  print_r($d);
48  echo '</pre>';
49}
50
51$session = $facebook->getSession();
52// Session based graph API call.
53if (! $session)
54{
55  // Redirect to facebook page reconnect
56  $url = $facebook->getLoginUrl(
57    array
58    (
59      //ici on demande les permissions email, publication sur le mur, et changement du status
60      'req_perms' => 'email,publish_stream,status_update',
61    ));
62  header( 'Request-URI: '.$url );
63  header( 'Content-Location: '.$url );
64  header( 'Location: '.$url );
65  exit();
66}
67
68?>
Note: See TracBrowser for help on using the repository browser.