? facebook-platform
? themes/ep_fbml
Index: README.txt
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/fb/README.txt,v
retrieving revision 1.17
diff -u -r1.17 README.txt
--- README.txt 2 Mar 2009 20:38:34 -0000 1.17
+++ README.txt 5 Mar 2009 14:52:07 -0000
@@ -5,7 +5,7 @@
Primary author and maintainer: Dave Cohen (http://www.dave-cohen.com/contact)
-Version: HEAD (version 2.x for Drupal 5.x)
+Version: N/A (version 2.x for Drupal 6.x)
Please read http://drupal.org/node/288721#version and confirm that
you are using the correct version.
Index: fb.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/fb/fb.info,v
retrieving revision 1.2
diff -u -r1.2 fb.info
--- fb.info 5 Feb 2009 03:34:50 -0000 1.2
+++ fb.info 5 Mar 2009 14:52:07 -0000
@@ -1,3 +1,5 @@
name = DFF Facebook API
description = Imports and uses the Facebook API.
package = Drupal for Facebook
+core = 6.x
+php = 5
Index: fb.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/fb/fb.install,v
retrieving revision 1.2
diff -u -r1.2 fb.install
--- fb.install 7 Apr 2008 20:56:49 -0000 1.2
+++ fb.install 5 Mar 2009 14:52:07 -0000
@@ -7,18 +7,8 @@
function fb_install() {
_fb_install_set_weight();
}
-function fb_update_1() {
- _fb_install_set_weight();
-}
-/**
- * The callback URL has changed and this requires manual updates to App settings.
- */
-function fb_update_2() {
- $message = t('Warning! The Drupal for Facebook modules have changed. Manual intervention is required! See !url1 or !url2.',
- array('!url1' => l('http://apps.facebook.com/drupalforfacebook/node/1055', 'http://apps.facebook.com/drupalforfacebook/node/1055'),
- '!url2' => l('http://drupalforfacebook.org/node/1055','http://drupalforfacebook.org/node/1055')));
- drupal_set_message($message);
- watchdog('fb', $message);
+function fb_uninstall() {
+ _fb_install_set_weight();
}
-?>
\ No newline at end of file
+
Index: fb.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/fb/fb.module,v
retrieving revision 1.42
diff -u -r1.42 fb.module
--- fb.module 2 Mar 2009 20:42:24 -0000 1.42
+++ fb.module 5 Mar 2009 14:52:07 -0000
@@ -70,12 +70,12 @@
if (strpos($key, 'fb_') === 0)
$req[] = $key . '=' . $val;
}
- $url = url($_REQUEST['q'], implode('&', $req), NULL, TRUE);
+ $url = url($_REQUEST['q'], array('query' => $req, 'absolute' => TRUE));
if (fb_verbose())
- watchdog('fb_debug', t('Facebook session key was %old, now %new. Destroying session and sending user to %url.',
- array('%old' => $_SESSION['fb_frame_params']['session_key'],
- '%new' => $_REQUEST['fb_sig_session_key'],
- '%url' => $url)));
+ watchdog('fb_debug', 'Facebook session key was %old, now %new. Destroying session and sending user to %url.',
+ array('%old' => $_SESSION['fb_frame_params']['session_key'],
+ '%new' => $_REQUEST['fb_sig_session_key'],
+ '%url' => $url));
session_destroy();
drupal_goto($url);
@@ -96,7 +96,7 @@
array('!drupal_for_facebook' => l(t('Drupal for Facebook'), 'http://drupal.org/project/fb'),
// This link should work with clean URLs
// disabled.
- '!readme' => 'README.txt')), 'error');
+ '!readme' => 'README.txt')), 'error');
}
// Ask other modules for app detail
@@ -121,7 +121,7 @@
}
}
else
- watchdog('fb', "URL indicates a facebook app, but could not initialize Facebook", WATCHDOG_ERROR);
+ watchdog('fb', "URL indicates a facebook app, but could not initialize Facebook", array(), WATCHDOG_ERROR);
}
@@ -188,24 +188,26 @@
$fbu_orig = $fbu;
// Determine the actual facebook user id to use.
- if ($GLOBALS['fb'] && $GLOBALS['fb']->validate_fb_params() &&
+ if ($GLOBALS['fb'] && $GLOBALS['fb']->api_key == $fb_app->apikey &&
+ $GLOBALS['fb']->validate_fb_params() &&
($fbu == FB_FBU_CURRENT || $fbu == FB_FBU_ANY ||
$fbu == $GLOBALS['fb']->get_loggedin_user())) {
return $GLOBALS['fb'];
}
- else if (($fbu == FB_FBU_CURRENT || $fbu == FB_FBU_ANY)
+ else if ($GLOBALS['fb']->api_key == $fb_app->apikey &&
+ ($fbu == FB_FBU_CURRENT || $fbu == FB_FBU_ANY)
&& isset($_SESSION['fb_frame_params']) && !$_REQUEST['fb_sig']) {
$params = $_SESSION['fb_frame_params'];
$fbu = $params['user'];
$session = $params['session_key'];
}
- else if ($fbu == FB_FBU_CURRENT && $GLOBALS['fb']) {
+ else if ($GLOBALS['fb'] && $GLOBALS['fb']->api_key == $fb_app->apikey &&
+ $fbu == FB_FBU_CURRENT) {
// No current user to use, probably anonymous canvas page.
return $GLOBALS['fb'];
}
else if ($fbu == FB_FBU_INFINITE_SESSION || $fbu == FB_FBU_ANY) {
// Learn the infinite session id and key
- // Infinite session is deprecated!!! XXX
$data = fb_invoke(FB_OP_GET_INFINITE_SESSION, array('fb_app' => $fb_app,
'fb' => $GLOBALS['fb']),
array());
@@ -250,7 +252,7 @@
else if ($fbu == FB_FBU_NO_SESSION) {
$fb->set_user(NULL, NULL);
}
-
+
// Cache the result, in case we're called again.
$cache[$fb_app->apikey][$fbu] = $fb;
@@ -260,9 +262,9 @@
if ($fbu_orig != FB_FBU_NO_SESSION &&
$fbu_orig != FB_FBU_CURRENT && !$fb->get_loggedin_user()) {
// An FBU other than CURRENT was specified, but we failed to log in.
- watchdog('fb', t('Failed to log into facebook app %app as user %user',
- array('%app' => $fb_app->title,
- '%user' => $fbu_orig)), WATCHDOG_ERROR);
+ watchdog('fb', 'Failed to log into facebook app %app as user %user',
+ array('%app' => $fb_app->title,
+ '%user' => $fbu_orig), WATCHDOG_ERROR);
}
}
@@ -287,8 +289,8 @@
$fb = fb_api_init($fb_app, FB_FBU_ANY);
if (!$fb) {
- watchdog('fb', t('%function unable to initialize Facebook API.',
- array('%function' => '_fb_api_init()')), WATCHDOG_ERROR);
+ watchdog('fb', '%function unable to initialize Facebook API.',
+ array('%function' => '_fb_api_init()'), WATCHDOG_ERROR);
return;
}
else
@@ -309,14 +311,26 @@
$fbu = $fb->get_loggedin_user();
if ($fb->api_client->error_code) {
- watchdog('fb', 'Failed to get Facebook user id.', 'error');
+ watchdog('fb', 'Failed to get Facebook user id.', array(), WATCHDOG_ERROR);
if (function_exists('dprint_r'))
- watchdog('fb', 'Failed to get Facebook user id. detail:' . dprint_r($_REQUEST, 1), 'error');
+ watchdog('fb', 'Failed to get Facebook user id. detail:' . dprint_r($_REQUEST, 1), array(), WATCHDOG_ERROR);
}
return $fbu;
}
/**
+ * Facebook provides a method, users_isAppUser(), which is buggy and
+ * unreliable. So we need to implement our own.
+ */
+function fb_is_app_user($fb) {
+ if ($fb->api_client->added || $fb->api_client->is_user)
+ return TRUE;
+ else
+ return $fb->api_client->users_isAppUser;
+}
+
+
+/**
* Given a local user id, find the facebook id.
*/
function fb_get_fbu($uid, $fb_app = NULL) {
@@ -344,7 +358,7 @@
* TODO: This code will probably not handle every case and may need some work.
*/
function fb_get_callback_url($fb_app) {
- $url = url('', NULL, NULL, TRUE) . FB_SETTINGS_APP_NID . '/'. $fb_app->nid . '/';
+ $url = url('', array('absolute' => TRUE)) . FB_SETTINGS_APP_NID . '/'. $fb_app->nid . '/';
return $url;
}
@@ -364,7 +378,7 @@
* Convenience method to return a list of all known apps, suitable for form
* elements.
*/
-function fb_get_app_options($include_current) {
+function fb_get_app_options($include_current = FALSE) {
$apps = fb_get_all_apps();
$options = array();
if ($include_current)
@@ -473,15 +487,15 @@
if (!$account)
$account = user_load(array('uid' => variable_get('fb_facebook_user', 2)));
if (!$account)
- watchdog('fb', t('Failed to load user from facebook fbu=%fbu',
- array('%fbu' => $fbu)), 'error');
+ watchdog('fb', 'Failed to load user from facebook fbu=%fbu',
+ array('%fbu' => $fbu), WATCHDOG_ERROR);
$account->fbu = $fbu;
return $account;
}
}
-function fb_form_alter($form_id, &$form) {
+function fb_form_alter(&$form, &$form_state, $form_id) {
// Because facebook users don't have email, it can't be required on user form
if ($form_id == 'user_register') {
if (user_access('administer users')) {
@@ -496,26 +510,21 @@
}
-function fb_menu($may_cache) {
+function fb_menu() {
$items = array();
- if (!$may_cache) {
- // Initialization moved to fb_init(), nothing to do here.
- }
- else {
// When forms are submitted directly to us, we cache the results,
// and show them later via this callback
- $items[] = array('path' => 'fb/form_cache',
- 'callback' => '_fb_form_cache_cb',
+ $items['fb/form_cache'] = array(
+ 'page callback' => '_fb_form_cache_cb',
'type' => MENU_CALLBACK,
- 'access' => TRUE);
+ 'access callback' => TRUE);
// A page to help determine infinite session keys
- $items[] = array('path' => 'fb/session',
- 'callback' => '_fb_session_cb',
+ $items['fb/session'] = array(
+ 'page callback' => '_fb_session_cb',
'type' => MENU_CALLBACK,
- 'access' => TRUE); // TODO: restrict access?
- }
+ 'access callback' => TRUE); // TODO: restrict access?
return $items;
}
@@ -651,7 +660,7 @@
'!link' => l(t('error codes'), "http://wiki.developers.facebook.com/index.php/Error_codes"),
'!message' => $message,
));
- watchdog('fb', $message, WATCHDOG_ERROR);
+ watchdog('fb', $message, array(), WATCHDOG_ERROR);
drupal_set_message($message, 'error');
}
}
@@ -667,7 +676,7 @@
if ($fb) {
$message .= '. (' . t('logged into facebook as %fbu', array('%fbu' => $fb->get_loggedin_user())) . ')';
}
- watchdog('fb', $message, WATCHDOG_ERROR);
+ watchdog('fb', $message, array(), WATCHDOG_ERROR);
if (user_access('administer fb apps')) {
drupal_set_message($message, 'error');
}
@@ -681,7 +690,7 @@
array('%message' => $exception->getMessage(),
'!trace' => '
'.$exception->getTraceAsString().'
',
));
- watchdog('fb', $message, WATCHDOG_ERROR);
+ watchdog('fb', $message, array(), WATCHDOG_ERROR);
//drupal_set_message($message, 'error');
print $message;
@@ -756,14 +765,14 @@
static $cache;
if (!$cache) {
$cache = array();
-
+
// Add the most basic file we need.
$base_file = drupal_get_path('module', 'fb') . '/fb_fbml.js';
$base_file .= "?v=".filemtime($base_file);
drupal_add_js($base_file, 'module', 'fbml');
// Add some settings that FBJS code will often need.
- $baseUrl = url('', NULL, NULL, TRUE);
+ $baseUrl = url('', array('absolute' => TRUE));
drupal_add_js(array('fbjs' => array('baseUrlFb' => $baseUrl,
'baseUrl' => fb_scrub_urls($baseUrl),
),
@@ -791,4 +800,4 @@
return variable_get('fb_verbose', NULL);
}
-?>
\ No newline at end of file
+?>
Index: fb_actions.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/fb/fb_actions.module,v
retrieving revision 1.13
diff -u -r1.13 fb_actions.module
--- fb_actions.module 4 Mar 2009 23:09:28 -0000 1.13
+++ fb_actions.module 5 Mar 2009 14:52:07 -0000
@@ -161,9 +161,9 @@
}
if (variable_get('fb_actions_verbose', FALSE))
- watchdog('fb_actions', t('Setting Facebook profile markup for !user to !body',
- array('!user' => theme('username', $user),
- '!body' => htmlentities($body))));
+ watchdog('fb_actions', 'Setting Facebook profile markup for !user to !body',
+ array('!user' => theme('username', $user),
+ '!body' => htmlentities($body)));
try {
// http://wiki.developers.facebook.com/index.php/Profile.setFBML
$fb->api_client->profile_setFBML(NULL, $fbu, $body, NULL, $mobile_profile, $profile_main);
@@ -249,9 +249,9 @@
$body = fb_canvas_process_fbml($body, $fb_app);
}
if (variable_get('fb_actions_verbose', FALSE))
- watchdog('fb_actions', t('Setting Facebook ref FBML for %handle to %body',
- array('%handle' => $values['handle'],
- '%body' => htmlentities($body))));
+ watchdog('fb_actions', 'Setting Facebook ref FBML for %handle to %body',
+ array('%handle' => $values['handle'],
+ '%body' => htmlentities($body)));
$fb->api_client->fbml_setRefHandle($values['handle'], $body);
fb_report_errors($fb);
}
@@ -328,11 +328,11 @@
// Find a local account for the application user
$account = fb_user_get_local_user($data->fbu, $fb_app);
if (variable_get('fb_actions_verbose', FALSE))
- watchdog('fb_action_debug', "fb_actions_cron_per_user fbu is $data->fbu, local user is " . theme('username', $account), WATCHDOG_ERROR);
+ watchdog('fb_action_debug', "fb_actions_cron_per_user fbu is $data->fbu, local user is " . theme('username', $account), array(), WATCHDOG_ERROR);
if (!$account || !$account->uid) {
- watchdog('fb cron', t('Facebook user %fbu does not correspond to a local account.',
- array('%fbu' => $data->fbu)));
+ watchdog('fb cron', 'Facebook user %fbu does not correspond to a local account.',
+ array('%fbu' => $data->fbu));
//db_query("DELETE FROM {fb_user_app} WHERE apikey='%s' AND fbu = %d",
// $fb_app->apikey,
// $data->fbu);
@@ -354,7 +354,7 @@
array('fb' => $fb,
'fb_app' => $fb_app));
} catch (Exception $e) {
- watchdog('fb cron', "Action per user failed. " . $e->getMessage(), WATCHDOG_ERROR);
+ watchdog('fb cron', "Action per user failed. " . $e->getMessage(), array(), WATCHDOG_ERROR);
}
} // end if able to log into facebook
Index: fb_app.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/fb/fb_app.info,v
retrieving revision 1.2
diff -u -r1.2 fb_app.info
--- fb_app.info 5 Feb 2009 03:34:50 -0000 1.2
+++ fb_app.info 5 Mar 2009 14:52:07 -0000
@@ -1,5 +1,6 @@
name = DFF Applications
description = Allows Drupal to host Facebook Applications
package = Drupal for Facebook
-dependencies = fb
+dependencies[] = fb
+core = 6.x
Index: fb_app.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/fb/fb_app.install,v
retrieving revision 1.6
diff -u -r1.6 fb_app.install
--- fb_app.install 5 Aug 2008 20:27:30 -0000 1.6
+++ fb_app.install 5 Mar 2009 14:52:07 -0000
@@ -6,36 +6,62 @@
*/
// TODO: some of these tables should be created by othe module install files.
+/**
+ * hook_install()
+ */
function fb_app_install() {
- switch ($GLOBALS['db_type']) {
- case 'mysql':
- case 'mysqli':
- db_query("
-CREATE TABLE IF NOT EXISTS {fb_app} (
-nid int(11) unsigned NOT NULL,
-label varchar(128) NOT NULL,
-apikey varchar(128) NOT NULL,
-id varchar(128) NOT NULL,
-secret varchar(128) NOT NULL,
-canvas varchar(128) NOT NULL,
-require_login int(4) NOT NULL,
-create_account int(4) NOT NULL,
-unique_account int(4) NOT NULL,
-data longtext,
-PRIMARY KEY (nid),
-UNIQUE KEY (apikey)
-) /*!40100 DEFAULT CHARACTER SET UTF8 */;
-");
-
- }
-
- drupal_set_message(t('Facebook Application module installed. Please grant yourself permissions and then browse to Create Content => Facebook Application to get started.', array('!perm' => url('admin/user/access'), '!create' => url('node/add/fb-app'))));
+ // Create tables.
+ drupal_install_schema('fb_app');
+ drupal_set_message(t('Facebook Application module installed. Please grant yourself permissions and then browse to Create Content => Facebook Application to get started.', array('!perm' => url('admin/user/permissions'), '!create' => url('node/add/fb-app'))));
}
-function fb_app_update_1() {
- // Add id field
- $ret[] = update_sql('ALTER TABLE {fb_app} ADD id varchar(128) NOT NULL');
- return $ret;
+/**
+ * hook_uninstall()
+ */
+function fb_app_uninstall() {
+ // Remove tables.
+ drupal_uninstall_schema('fb_app');
+}
+
+function fb_app_schema() {
+ $schema['fb_app'] = array(
+ 'description' => 'Main FB_APP table',
+ 'fields' => array(
+ 'nid' => array('type' => 'int', 'length' => 11, 'unsigned' => TRUE, 'not null' => TRUE, ),
+ 'label' => array('type' => 'varchar', 'length' => 128, 'not null' => TRUE, ),
+ 'apikey' => array('type' => 'varchar', 'length' => 128, 'not null' => TRUE, ),
+ 'id' => array('type' => 'varchar', 'length' => 128, 'not null' => TRUE, ),
+ 'secret' => array('type' => 'varchar', 'length' => 128, 'not null' => TRUE, ),
+ 'canvas' => array('type' => 'varchar', 'length' => 128, 'not null' => TRUE, ),
+ 'require_login' => array('type' => 'int', 'length' => 4, 'not null' => TRUE, ),
+ 'create_account' => array('type' => 'int', 'length' => 4, 'not null' => TRUE, ),
+ 'unique_account' => array('type' => 'int', 'length' => 4, 'not null' => TRUE, ),
+ 'rid' => array('type' => 'int', 'length' => 10, 'unsigned' => TRUE, 'not null' => TRUE, ),
+ 'data' => array('type' => 'text', 'size' => 'big', ),
+ ),
+ 'unique keys' => array(
+ 'apikey' => array('apikey'),
+ ),
+ 'primary key' => array('nid'),
+ );
+ $schema['fb_app_block'] = array(
+ 'fields' => array(
+ 'nid' => array('type' => 'int', 'length' => 11, 'unsigned' => TRUE, 'not null' => TRUE, ),
+ 'delta' => array('type' => 'varchar', 'length' => 32, 'not null' => TRUE, ),
+ 'format' => array('type' => 'int', 'length' => 11, 'default' => 0, ),
+ 'body' => array('type' => 'text', 'size' => 'big', 'not null' => TRUE, ),
+ ),
+ 'primary key' => array('nid', 'delta'),
+ );
+ $schema['fb_cache_filter'] = drupal_get_schema_unprocessed('system', 'cache');
+
+ return $schema;
}
-?>
\ No newline at end of file
+
+function fb_app_update_6100() {
+ // Add id field
+ $ret = array();
+ db_add_field($ret, 'fb_app', 'id', array('type' => 'varchar', 'length' => 128, 'not null' => TRUE, ));
+ return $ret;
+}
\ No newline at end of file
Index: fb_app.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/fb/fb_app.module,v
retrieving revision 1.24
diff -u -r1.24 fb_app.module
--- fb_app.module 2 Mar 2009 20:42:24 -0000 1.24
+++ fb_app.module 5 Mar 2009 14:52:07 -0000
@@ -45,7 +45,7 @@
}
}
else if ($op == FB_OP_SET_PROPERTIES) {
- $url = url(FB_SETTINGS_APP_NID . '/' . $fb_app->nid . '/' . FB_APP_PATH_EVENT, NULL, NULL, TRUE) . '/';
+ $url = url(FB_SETTINGS_APP_NID . '/' . $fb_app->nid . '/' . FB_APP_PATH_EVENT, array('absolute' => TRUE)) . '/';
$return['uninstall_url'] = $url . FB_APP_EVENT_POST_REMOVE;
$return['authorize_url'] = $url . FB_APP_EVENT_POST_AUTHORIZE;
}
@@ -58,18 +58,26 @@
}
/**
- * hook_menu
+ * Loader callback for drupal menu api.
*/
-function fb_app_menu($may_cache) {
+function fb_app_nid_load($nid) {
+ $node = node_load($nid);
+ if ($node->type == 'fb_app') {
+ return $node;
+ }
+}
+
+/**
+ * Implementation of hook_menu().
+ */
+function fb_app_menu() {
$items = array();
- if ($may_cache) {
- // Allow facebook to notify on various events, like adding or removing an app.
- $items[] = array('path' => FB_APP_PATH_EVENT,
- 'access' => TRUE,
- 'callback' => 'fb_app_event_cb',
- 'type' => MENU_CALLBACK,
+ // Allow facebook to notify on various events, like adding or removing an app.
+ $items[FB_APP_PATH_EVENT] =
+ array('access callback' => TRUE,
+ 'page callback' => 'fb_app_event_cb',
+ 'type' => MENU_CALLBACK,
);
- }
return $items;
}
@@ -101,15 +109,14 @@
);
}
-function fb_app_access($op, $node) {
- global $user;
- if (user_access('administer fb apps'))
+function fb_app_access($op, $node, $account) {
+ if (user_access('administer fb apps', $account))
return TRUE;
- if ($op == 'create' && user_access('create fb apps'))
+ if ($op == 'create' && user_access('create fb apps', $account))
return TRUE;
else if ($op == 'update' || $op == 'delete') {
if ($node->uid == $user->uid &&
- user_access('edit own fb apps'))
+ user_access('edit own fb apps', $account))
return TRUE;
}
}
@@ -245,9 +252,24 @@
return $node;
}
+function fb_app_theme() {
+ return array(
+ 'fb_app' => array(
+ 'arguments' => array('data' => NULL),
+ ),
+ 'dl' => array(
+ 'arguments' => array('items' => NULL),
+ ),
+ 'fb_app_user_info' => array(
+ 'arguments' => array('fb_app' => NULL, 'info' => NULL),
+ ),
+ );
+}
+
function fb_app_get_about_url($fb_app) {
if ($fb_app->id)
- return url("http://www.facebook.com/apps/application.php", "id=$fb_app->id");
+ return url("http://www.facebook.com/apps/application.php",
+ array('query' => array('id' => $fb_app->id)));
}
function theme_fb_app($fb_app) {
@@ -301,10 +323,10 @@
if ($fb = fb_api_init($fb_app, FB_FBU_NO_SESSION)) {
try {
$props = $fb->api_client->admin_getAppProperties(array_values($props_map));
+ $cache[$fb_app->apikey] = $props;
} catch (Exception $e) {
fb_log_exception($e, t('Failed to get application properties from Facebook'));
}
- $cache[$fb_app->apikey] = $props;
}
}
else {
@@ -349,9 +371,9 @@
$fb_app->unique_account, $fb_app->data
);
- watchdog('fb_app', t('Created Facebook Application %label.',
- array('%label' => $fb_app->label,
- )),
+ watchdog('fb_app', 'Created Facebook Application %label.',
+ array('%label' => $fb_app->label,
+ ),
WATCHDOG_NOTICE,
l($node->title, 'node/'.$node->nid));
@@ -451,7 +473,7 @@
function theme_fb_app_user_info($fb_app, $info) {
if ($info['pic_big'])
$output .= '
';
- $fb_link = l($info['name'], 'http://www.facebook.com/profile.php', NULL, 'id='.$info['uid']);
+ $fb_link = l($info['name'], 'http://www.facebook.com/profile.php', array('query' => 'id=' . $info['uid']));
if ($info['is_app_user'])
$output .= '' . t('!fb_link uses %title',
array('!fb_link' => $fb_link,
@@ -482,5 +504,4 @@
}
return $values;
}
-
?>
\ No newline at end of file
Index: fb_canvas.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/fb/fb_canvas.info,v
retrieving revision 1.2
diff -u -r1.2 fb_canvas.info
--- fb_canvas.info 5 Feb 2009 03:34:50 -0000 1.2
+++ fb_canvas.info 5 Mar 2009 14:52:07 -0000
@@ -1,5 +1,6 @@
name = DFF Canvas Pages
description = Support for Facebook Canvas Pages. You will also need an FBML theme.
package = Drupal for Facebook
-dependencies = fb fb_app
-
+dependencies[] = fb
+dependencies[] = fb_app
+core = 6.x
Index: fb_canvas.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/fb/fb_canvas.module,v
retrieving revision 1.23
diff -u -r1.23 fb_canvas.module
--- fb_canvas.module 2 Mar 2009 20:42:24 -0000 1.23
+++ fb_canvas.module 5 Mar 2009 14:52:07 -0000
@@ -7,13 +7,14 @@
*
*/
-function fb_canvas_menu($may_cache) {
+function fb_canvas_menu() {
$items = array();
if ($may_cache) {
- $items[] = array('path' => 'fb/canvas/session',
- 'callback' => 'fb_canvas_session_cb',
- 'type' => MENU_CALLBACK,
- 'access' => TRUE);
+ $items['fb/canvas/session'] = array(
+ 'page callback' => 'fb_canvas_session_cb',
+ 'type' => MENU_CALLBACK,
+ 'access callback' => TRUE,
+ );
}
return $items;
}
@@ -51,7 +52,7 @@
}
$_SESSION['fb_canvas_session'] = TRUE;
- $url = url('fb/canvas/session', NULL, NULL, TRUE);
+ $url = url('fb/canvas/session', array('absolute' => TRUE));
return array('subject' => NULL,
'content' => "");
}
@@ -92,7 +93,8 @@
$custom_theme = $fb_canvas_data['theme_fbml'];
else if (fb_canvas_is_iframe())
$custom_theme = $fb_canvas_data['theme_iframe'];
-
+
+
// Special handling for forms, as they are submitted directly to us, not
// to apps.facebook.com/canvas
// we will buffer, and later cache, the results.
@@ -121,6 +123,7 @@
ob_end_clean();
if ($destination) {
+ watchdog('fb_debug', "FB_OP_EXIT, handling form, original destination: $destination");
// Fully qualified URLs need to be modified to point to facebook app.
// URLs are fully qualified when a form submit handler returns a path,
// or any call to drupal_goto.
@@ -130,6 +133,7 @@
// canvas page, so we'll use Facebook's method.
// Will this preempt other hook_exits?
if ($fb) {
+ watchdog('fb_debug', "FB_OP_EXIT, handling form, redirecting to $destination");
$fb->redirect($destination);
}
}
@@ -138,7 +142,7 @@
$token = uniqid('fb_');
$cid = session_id() . "_$token";
watchdog('fb', "Storing cached form page $cid, then redirecting");
- cache_set($cid, 'cache_page', $output, time() + (60 * 5), drupal_get_headers()); // (60 * 5) == 5 minutes
+ cache_set($cid, $output, 'cache_page', time() + (60 * 5), drupal_get_headers()); // (60 * 5) == 5 minutes
$dest = 'http://apps.facebook.com/' . $fb_app->canvas . "/fb/form_cache/$cid";
// $fb->redirect($url); // Does not work!
@@ -163,7 +167,7 @@
}
else if ($op == FB_OP_SET_PROPERTIES) {
// Compute properties which we can set automatically.
- $callback_url = url('', NULL, NULL, TRUE) . FB_SETTINGS_APP_NID . '/' . $fb_app->nid . '/';
+ $callback_url = url('',array('absolute' => TRUE)) . FB_SETTINGS_APP_NID . '/' . $fb_app->nid . '/';
$return['callback_url'] = $callback_url;
}
else if ($op == FB_OP_LIST_PROPERTIES) {
@@ -176,7 +180,7 @@
/**
* Implementation of hook_form_alter.
*/
-function fb_canvas_form_alter($form_id, &$form) {
+function fb_canvas_form_alter(&$form, &$form_state, $form_id) {
// Add our settings to the fb_app edit form.
if (is_array($form['fb_app_data'])) {
$node = $form['#node'];
@@ -217,31 +221,34 @@
'#default_value' => $fb_canvas_data['front_added'],
);
+ /* XXX menu code here needs updating to D6
// Allow primary links to be different on facebook versus the rest of the
// site. Code from menu_configure() in menu.module.
- $root_menus = menu_get_root_menus();
-
- $primary_options = $root_menus;
- $primary_options[0] = t('