Index: README.txt
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/fb/README.txt,v
retrieving revision 1.9
diff -u -u -p -r1.9 README.txt
--- README.txt 7 Apr 2008 20:56:49 -0000 1.9
+++ README.txt 23 May 2008 06:34:22 -0000
@@ -19,7 +19,7 @@ To install:
- Download the facebook-platform PHP code from developer.facebook.com.
Extract it into the 'modules/fb' directory, so you have
- modules/fb/facebook-application/
+ modules/fb/facebook-platform/
wget http://developers.facebook.com/clientlibs/facebook-platform.tar.gz
tar xvzf facebook-platform.tar.gz
@@ -30,13 +30,15 @@ tar xvzf facebook-platform.tar.gz
you may encounter uncaught exceptions using the PHP5 API.
- Edit your settings.php file (sites/default/settings.php, depending
- on your install) to include settings.inc (in this directory). For
+ on your install) to include fb_settings.inc (in this directory). For
example:
require_once "profiles/custom/modules/fb/fb_settings.inc";
(Or whatever path is appropriate, could be
- "sites/all/module/fb/fb_settings.inc")
+ "sites/all/module/fb/fb_settings.inc").
+ Include fb_settings.inc at the *end* of your settings.php file to
+ avoid overwriting optional $conf array manual overrides.
- Enable the Facebook modules via the drupal admin pages, as usual.
You must enable at least fb.module and fb_app.module. You will
Index: fb.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/fb/fb.info,v
retrieving revision 1.1
diff -u -u -p -r1.1 fb.info
--- fb.info 26 Sep 2007 17:08:21 -0000 1.1
+++ fb.info 23 May 2008 06:34:22 -0000
@@ -1,3 +1,4 @@
name = Facebook API
description = Imports and uses the Facebook API.
package = Facebook
+core = 6.x
Index: fb.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/fb/fb.install,v
retrieving revision 1.2
diff -u -u -p -r1.2 fb.install
--- fb.install 7 Apr 2008 20:56:49 -0000 1.2
+++ fb.install 23 May 2008 06:34:22 -0000
@@ -5,20 +5,19 @@ function _fb_install_set_weight() {
}
function fb_install() {
+ //drupal_install_schema('fb');
_fb_install_set_weight();
}
-function fb_update_1() {
- _fb_install_set_weight();
+
+function fb_uninstall() {
+ //drupal_uninstall_schema('fb');
+ _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_schema() {
+ //this cannot return nothing, or common.inc reports error
+ $schema = array();
+ return $schema;
}
-?>
\ No newline at end of file
+*/
\ No newline at end of file
Index: fb.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/fb/fb.module,v
retrieving revision 1.18
diff -u -u -p -r1.18 fb.module
--- fb.module 20 May 2008 05:36:59 -0000 1.18
+++ fb.module 23 May 2008 06:34:23 -0000
@@ -48,7 +48,7 @@ function fb_init() {
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');
}
@@ -192,9 +192,9 @@ function fb_api_init($fb_app, $fbu) {
// get_loggedin_user does not really test it.
if ($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);
}
}
@@ -246,7 +246,7 @@ function fb_init_pathXXX($fb_app, $resto
$original = array('base_url' => $base_url,
'base_path' => $base_path);
- /**
+ /*
$base_path = "/$fb_app->canvas/";
// TODO: make the "apps.facebook.com" part configurable.
$base_url = "http://apps.facebook.com/$fb_app->canvas";
@@ -254,7 +254,7 @@ function fb_init_pathXXX($fb_app, $resto
// New way:
$base_path = $fb_old_base_url . '/';
$base_url = '';
- **/
+ */
if (!variable_get('clean_url', FALSE)) {
$original['clean_url'] = FALSE;
@@ -438,15 +438,15 @@ function fb_user_load($fbu = NULL) {
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), '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')) {
@@ -461,26 +461,21 @@ function fb_form_alter($form_id, &$form)
}
-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;
}
@@ -627,4 +622,3 @@ function fb_report_exception($exception)
}
-?>
\ No newline at end of file
Index: fb_app.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/fb/fb_app.info,v
retrieving revision 1.1
diff -u -u -p -r1.1 fb_app.info
--- fb_app.info 26 Sep 2007 17:08:21 -0000 1.1
+++ fb_app.info 23 May 2008 06:34:23 -0000
@@ -1,5 +1,6 @@
name = Facebook Application
description = Create one or more facebook applications.
package = 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.3
diff -u -u -p -r1.3 fb_app.install
--- fb_app.install 18 Mar 2008 02:47:55 -0000 1.3
+++ fb_app.install 23 May 2008 06:34:23 -0000
@@ -6,60 +6,63 @@
*/
// TODO: some of these tables should be created by othe module install files.
-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,
-rid int(10) unsigned NOT NULL,
-data longtext,
-PRIMARY KEY (nid),
-UNIQUE KEY (apikey)
-) /*!40100 DEFAULT CHARACTER SET UTF8 */;
-");
- db_query("
-CREATE TABLE IF NOT EXISTS {fb_app_block} (
-nid int(11) unsigned NOT NULL,
-delta varchar(32) NOT NULL,
-format int(11) DEFAULT 0,
-body longtext NOT NULL,
-PRIMARY KEY (nid, delta)
-) /*!40100 DEFAULT CHARACTER SET UTF8 */;
-");
+/**
+ * hook_install()
+ */
+function fb_app_install() {
+ // 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'))));
+}
- // This table schema has to match the cache_filter table.
- db_query("
-CREATE TABLE {fb_cache_filter} (
-cid varchar(255) NOT NULL default '',
-data longblob,
-expire int NOT NULL default '0',
-created int NOT NULL default '0',
-headers text,
-PRIMARY KEY (cid),
-INDEX expire (expire)
-) /*!40100 DEFAULT CHARACTER SET UTF8 */;
+/**
+ * hook_uninstall()
+ */
+function fb_app_uninstall() {
+ // Remove tables.
+ drupal_uninstall_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/access'), '!create' => url('node/add/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;
}
-function fb_app_update_1() {
+function fb_app_update_6100() {
// Add id field
- $ret[] = update_sql('ALTER TABLE {fb_app} ADD id varchar(128) NOT NULL');
- return $ret;
-}
-?>
\ No newline at end of file
+ $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.11
diff -u -u -p -r1.11 fb_app.module
--- fb_app.module 20 May 2008 05:33:08 -0000 1.11
+++ fb_app.module 23 May 2008 06:34:23 -0000
@@ -34,7 +34,7 @@ function fb_app_fb($fb, $fb_app, $op, &$
}
else {
if (function_exists('fb_settings')) {
- // See settings.inc
+ // See fb_settings.inc
if ($nid = fb_settings(FB_SETTINGS_APP_NID)) {
// Here if we're in iframe, using our /fb_canvas/nid/ path convention.
$fb_app = db_fetch_object(db_query("SELECT * FROM {fb_app} fb INNER JOIN {node} n ON n.nid=fb.nid WHERE fb.nid=%d and status=1",
@@ -84,7 +84,7 @@ function fb_app_node_info() {
);
}
-function fb_app_access($op, $node) {
+function fb_app_access($op, $node, $account) {
if (user_access('administer fb apps'))
return TRUE;
if ($op == 'create' && user_access('create fb apps'))
@@ -231,11 +231,26 @@ function fb_app_view($node, $teaser=FALS
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 theme_fb_app($data) {
return theme('dl', array(t('Label') => $data->label,
t('API Key') => $data->apikey,
t('Secret') => $data->secret,
- t('About page') => $data->id ? url("http://www.facebook.com/apps/application.php", "id=$data->id") : t('N/A'),
+ t('About page') => $data->id ? url("http://www.facebook.com/apps/application.php", array('query' => "id=$data->id")) : t('N/A'),
// TODO: edit and logout URLs
));
@@ -275,9 +290,9 @@ function fb_app_insert($node) {
_fb_app_blocks_update($node);
- watchdog('fb_app', t('Created Facebook Application %label. Created role %role.',
+ watchdog('fb_app', 'Created Facebook Application %label. Created role %role.',
array('%label' => $fb_app->label,
- '%role' => $role_name)),
+ '%role' => $role_name),
WATCHDOG_NOTICE,
l($node->title, 'node/'.$node->nid));
@@ -413,7 +428,7 @@ function fb_app_user($op, &$edit, &$acco
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,
@@ -444,5 +459,4 @@ function fb_app_token_values($type = 'al
}
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.1
diff -u -u -p -r1.1 fb_canvas.info
--- fb_canvas.info 7 Apr 2008 20:56:49 -0000 1.1
+++ fb_canvas.info 23 May 2008 06:34:23 -0000
@@ -1,5 +1,8 @@
name=Facebook Application Canvas Pages
description=Support for Facebook Canvas Pages
package = Facebook
-dependencies = fb fb_app
+dependencies[] = fb
+dependencies[] = fb_app
+core = 6.x
+version = "6.x-1.x-dev"
Index: fb_canvas.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/fb/fb_canvas.module,v
retrieving revision 1.7
diff -u -u -p -r1.7 fb_canvas.module
--- fb_canvas.module 20 May 2008 05:35:09 -0000 1.7
+++ fb_canvas.module 23 May 2008 06:34:23 -0000
@@ -71,7 +71,7 @@ function fb_canvas_fb($fb, $fb_app, $op,
$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!
@@ -100,7 +100,7 @@ function fb_canvas_fb($fb, $fb_app, $op,
/**
* 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'];
@@ -142,26 +142,27 @@ function fb_canvas_form_alter($form_id,
// 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('