summaryrefslogtreecommitdiff
path: root/plugins/FBConnect/FBC_XDReceiver.php
blob: 57c98b4f14370e24df0e4fd93963295d936a6dae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php

if (!defined('LACONICA')) {
    exit(1);
}

/*
 * Generates the cross domain communication channel file
 * (xd_receiver.html). By generating it we can add some caching
 * instructions.
 *
 * See: http://wiki.developers.facebook.com/index.php/Cross_Domain_Communication_Channel
 */
class FBC_XDReceiverAction extends Action
{

    /**
     * Do we need to write to the database?
     *
     * @return boolean true
     */

    function isReadonly()
    {
        return true;
    }

    /**
     * Handle a request
     *
     * @param array $args Arguments from $_REQUEST
     *
     * @return void
     */

    function handle($args)
    {
        // Parent handling, including cache check
        parent::handle($args);
        $this->showPage();
    }

    function showPage()
    {
        // cache the xd_receiver
        header('Cache-Control: max-age=225065900');
        header('Expires:');
        header('Pragma:');

        $this->startXML('html',
                        '-//W3C//DTD XHTML 1.0 Strict//EN',
                        'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd');

        $language = $this->getLanguage();

        $this->elementStart('html', array('xmlns' => 'http://www.w3.org/1999/xhtml',
                                          'xml:lang' => $language,
                                          'lang' => $language));
        $this->elementStart('head');
        $this->element('title', null, 'cross domain receiver page');
        $this->element('script',
            array('src' =>
                'http://static.ak.connect.facebook.com/js/api_lib/v0.4/XdCommReceiver.debug.js',
                'type' => 'text/javascript'), '');
        $this->elementEnd('head');
        $this->elementStart('body');
        $this->elementEnd('body');

        $this->elementEnd('html');
    }

}