From 033b6b3e65f2dbb8e94a563bb48052cedc8da443 Mon Sep 17 00:00:00 2001
From: jomsrv10 <no-reply@joomlates.de>
Date: Sat, 19 Mar 2011 17:39:28 +0000
Subject: [PATCH 1/4] added page as canvas type

---
 fb_settings.inc |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/fb_settings.inc b/fb_settings.inc
index 4e51223..f83b25f 100644
--- a/fb_settings.inc
+++ b/fb_settings.inc
@@ -31,7 +31,8 @@ define('FB_SETTINGS_COOKIE_DOMAIN', 'cookie_domain');
 define('FB_SETTINGS_TYPE_CANVAS', 'canvas');
 define('FB_SETTINGS_TYPE_CONNECT', 'connect');
 define('FB_SETTINGS_TYPE_PROFILE', 'profile');
-
+// new since march 2011
+define('FB_SETTINGS_TYPE_PAGE', 'page');
 
 /**
  * Helper function to remember values as we learn them.
@@ -95,6 +96,13 @@ function _fb_settings_honor_signed_request($sr) {
       fb_settings(FB_SETTINGS_FBU, $sr['user_id']);
     }
   }
+  // since march 2011 page canvas becomes own parameter for detection
+  elseif (isset($sr['page'])){
+    // on a page we get never the id of the user who use them...
+    // whats the right way here ?
+    fb_settings(FB_SETTINGS_PROFILE_ID, $sr['page']['id']);
+    fb_settings(FB_SETTINGS_TYPE, FB_SETTINGS_TYPE_PAGE);
+  }
   elseif (isset($sr['user_id'])) {
     // Probably a canvas page.
     fb_settings(FB_SETTINGS_FBU, $sr['user_id']);
-- 
1.7.2.3


From 51872ba960fd6abfe2e7478a2f118a8c27897104 Mon Sep 17 00:00:00 2001
From: jomsrv10 <no-reply@joomlates.de>
Date: Sat, 19 Mar 2011 17:41:02 +0000
Subject: [PATCH 2/4] changed TYPE on fb_is_tab

---
 fb.module |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fb.module b/fb.module
index edcf34a..ad2c3c3 100644
--- a/fb.module
+++ b/fb.module
@@ -677,7 +677,7 @@ function fb_is_canvas() {
  */
 function fb_is_tab() {
   global $_fb;
-  if (fb_settings(FB_SETTINGS_TYPE) == FB_SETTINGS_TYPE_PROFILE) {
+  if (fb_settings(FB_SETTINGS_TYPE) == FB_SETTINGS_TYPE_PAGE) {
     return TRUE;
   }
   elseif (isset($_REQUEST['fb_sig_in_profile_tab']) &&
-- 
1.7.2.3


From f3649125598c00f046aa103a54fb107e8ccc7856 Mon Sep 17 00:00:00 2001
From: jomsrv10 <no-reply@joomlates.de>
Date: Sat, 19 Mar 2011 18:10:33 +0000
Subject: [PATCH 3/4] added hook_custom_theme to tab module / renamed fb_canvas_process to fb_canvas_adjust_html... please dokument it next time somewhere...

---
 fb_tab.module |   27 +++++++++++++++++++++------
 1 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/fb_tab.module b/fb_tab.module
index c8bb0bc..df4c639 100644
--- a/fb_tab.module
+++ b/fb_tab.module
@@ -76,7 +76,6 @@ function fb_tab_fb($op, $data, &$return) {
         $GLOBALS['custom_theme'] = $config['custom_theme'];
       }
       $use_ob = variable_get(FB_TAB_VAR_PROCESS, TRUE);
-
       // Hack to init the theme before _drupal_maintenance_theme initializes the wrong one.
       if (variable_get('site_offline', FALSE)) {
         $dummy = theme('dummy');
@@ -92,14 +91,20 @@ function fb_tab_fb($op, $data, &$return) {
     }
   }
   elseif ($op == FB_OP_EXIT && fb_is_tab()) {
+
     if (isset($GLOBALS['fb_tab_post_process']) && $GLOBALS['fb_tab_post_process']) {
       $output = ob_get_contents();
       ob_end_clean();
-      //print '<pre>' . htmlentities($output) . '</pre>'; flush();
-      $output = fb_canvas_process($output, array(
-                  'add_target' => FALSE,
-                  'absolute_links' => TRUE,
-                ));
+     // print '<pre>' . htmlentities($output) . '</pre>'; flush();
+      
+      //$output = fb_canvas_process($output, array(
+      //          'add_target' => FALSE,
+      //          'absolute_links' => TRUE,
+      //        ));
+      $output = fb_canvas_adjust_html($output, array(
+        'add_target' => FALSE,
+        'absolute_links' => TRUE,
+      ));
 
       if (isset($output)) {
         print($output);
@@ -379,3 +384,13 @@ function fb_tab_config_url($profile_id = NULL, $options = array()) {
   return url(FB_TAB_PATH_FORM . '/' . $profile_id, $options);
 }
 
+
+function fb_tab_custom_theme() {
+  if (fb_is_tab()) {
+    // Get our configuration settings.
+    $fb_tab_data = _fb_tab_get_config($GLOBALS['_fb_app']);
+    if ($custom_theme = $fb_tab_data['custom_theme']) {
+      return $custom_theme;
+    }
+  }
+}
\ No newline at end of file
-- 
1.7.2.3


From 1038432d5c24db29c7512c9e168b00db8579f5df Mon Sep 17 00:00:00 2001
From: jomsrv10 <no-reply@joomlates.de>
Date: Sat, 19 Mar 2011 18:16:16 +0000
Subject: [PATCH 4/4] nothing changed here

---
 fb_tab.module |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/fb_tab.module b/fb_tab.module
index df4c639..b11ffe5 100644
--- a/fb_tab.module
+++ b/fb_tab.module
@@ -393,4 +393,5 @@ function fb_tab_custom_theme() {
       return $custom_theme;
     }
   }
-}
\ No newline at end of file
+}
+
-- 
1.7.2.3

