2008-12-06 03:01:32 +00:00
|
|
|
<?php
|
|
|
|
/*
|
|
|
|
* Laconica - a distributed open-source microblogging tool
|
|
|
|
* Copyright (C) 2008, Controlez-Vous, Inc.
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2008-12-23 19:19:07 +00:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2008-12-06 03:01:32 +00:00
|
|
|
* GNU Affero General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public License
|
2008-12-23 19:19:07 +00:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2008-12-06 03:01:32 +00:00
|
|
|
*/
|
|
|
|
|
2009-01-18 01:31:39 +00:00
|
|
|
if (!defined('LACONICA')) {
|
|
|
|
exit(1);
|
|
|
|
}
|
2008-12-06 03:01:32 +00:00
|
|
|
|
2009-01-18 01:31:39 +00:00
|
|
|
require_once INSTALLDIR.'/lib/facebookutil.php';
|
2009-01-05 01:04:07 +00:00
|
|
|
|
2008-12-23 19:49:23 +00:00
|
|
|
class FacebookAction extends Action
|
|
|
|
{
|
2008-12-06 03:01:32 +00:00
|
|
|
|
2008-12-23 19:33:23 +00:00
|
|
|
function handle($args)
|
|
|
|
{
|
2008-12-23 19:19:07 +00:00
|
|
|
parent::handle($args);
|
|
|
|
}
|
|
|
|
|
2009-01-18 01:31:39 +00:00
|
|
|
function showLogo(){
|
|
|
|
|
|
|
|
global $xw;
|
|
|
|
|
|
|
|
common_element('link', array('rel' => 'stylesheet',
|
|
|
|
'type' => 'text/css',
|
2009-01-18 06:12:47 +00:00
|
|
|
'href' => getFacebookCSS()));
|
|
|
|
|
|
|
|
common_element('script', array('type' => 'text/javascript',
|
|
|
|
'src' => getFacebookJS()),
|
|
|
|
' ');
|
2009-01-18 01:31:39 +00:00
|
|
|
|
|
|
|
common_element_start('a', array('class' => 'url home bookmark',
|
|
|
|
'href' => common_local_url('public')));
|
|
|
|
if (common_config('site', 'logo') || file_exists(theme_file('logo.png'))) {
|
|
|
|
common_element('img', array('class' => 'logo photo',
|
|
|
|
'src' => (common_config('site', 'logo')) ?
|
|
|
|
common_config('site', 'logo') : theme_path('logo.png'),
|
|
|
|
'alt' => common_config('site', 'name')));
|
|
|
|
}
|
|
|
|
|
|
|
|
common_element('span', array('class' => 'fn org'), common_config('site', 'name'));
|
|
|
|
common_element_end('a');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function showHeader($selected = 'Home', $msg = null, $success = false)
|
2008-12-23 19:33:23 +00:00
|
|
|
{
|
2008-12-23 19:19:07 +00:00
|
|
|
|
2009-01-11 07:03:59 +00:00
|
|
|
start_fbml();
|
|
|
|
|
2009-01-18 06:12:47 +00:00
|
|
|
common_element_start('fb:if-section-not-added', array('section' => 'profile'));
|
|
|
|
common_element_start('span', array('id' => 'add_to_profile'));
|
|
|
|
common_element('fb:add-section-button', array('section' => 'profile'));
|
|
|
|
common_element_end('span');
|
|
|
|
common_element_end('fb:if-section-not-added');
|
|
|
|
|
2009-01-18 01:31:39 +00:00
|
|
|
$this->showLogo();
|
2008-12-23 19:19:07 +00:00
|
|
|
|
2009-01-18 01:31:39 +00:00
|
|
|
common_element_start('dl', array("id" => 'site_nav_local_views'));
|
|
|
|
common_element('dt', null, _('Local Views'));
|
|
|
|
common_element_start('dd');
|
|
|
|
|
|
|
|
common_element_start('ul', array('class' => 'nav'));
|
|
|
|
|
|
|
|
common_element_start('li', array('class' =>
|
|
|
|
($selected == 'Home') ? 'current' : 'facebook_home'));
|
|
|
|
common_element('a',
|
|
|
|
array('href' => 'index.php', 'title' => _('Home')), _('Home'));
|
|
|
|
common_element_end('li');
|
2008-12-23 19:19:07 +00:00
|
|
|
|
2009-01-18 01:31:39 +00:00
|
|
|
|
|
|
|
common_element_start('li',
|
|
|
|
array('class' =>
|
|
|
|
($selected == 'Invite') ? 'current' : 'facebook_invite'));
|
|
|
|
common_element('a',
|
|
|
|
array('href' => 'invite.php', 'title' => _('Invite')), _('Invite'));
|
|
|
|
common_element_end('li');
|
2008-12-23 19:19:07 +00:00
|
|
|
|
2009-01-18 01:31:39 +00:00
|
|
|
common_element_start('li',
|
|
|
|
array('class' =>
|
|
|
|
($selected == 'Settings') ? 'current' : 'facebook_settings'));
|
|
|
|
common_element('a',
|
|
|
|
array('href' => 'settings.php',
|
|
|
|
'title' => _('Settings')), _('Settings'));
|
|
|
|
common_element_end('li');
|
|
|
|
|
|
|
|
common_element_end('ul');
|
|
|
|
|
|
|
|
common_element_end('dd');
|
|
|
|
common_element_end('dl');
|
2008-12-23 19:19:07 +00:00
|
|
|
|
|
|
|
|
2009-01-11 07:03:59 +00:00
|
|
|
if ($msg) {
|
|
|
|
if ($success) {
|
|
|
|
common_element('fb:success', array('message' => $msg));
|
|
|
|
} else {
|
|
|
|
// XXX do an error message here
|
|
|
|
}
|
2008-12-23 19:19:07 +00:00
|
|
|
}
|
|
|
|
|
2009-01-11 07:03:59 +00:00
|
|
|
common_element_start('div', 'main_body');
|
2008-12-23 19:19:07 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2009-01-18 01:31:39 +00:00
|
|
|
function showFooter()
|
2008-12-23 19:33:23 +00:00
|
|
|
{
|
2009-01-11 07:03:59 +00:00
|
|
|
common_element_end('div');
|
|
|
|
common_end_xml();
|
2008-12-23 19:19:07 +00:00
|
|
|
}
|
|
|
|
|
2009-01-18 01:31:39 +00:00
|
|
|
|
|
|
|
function showInstructions()
|
|
|
|
{
|
|
|
|
global $xw;
|
|
|
|
|
|
|
|
common_element_start('dl', array('class' => 'system_notice'));
|
|
|
|
common_element('dt', null, 'Page Notice');
|
|
|
|
|
|
|
|
$loginmsg_part1 = _('To use the %s Facebook Application you need to login ' .
|
|
|
|
'with your username and password. Don\'t have a username yet? ');
|
|
|
|
|
|
|
|
$loginmsg_part2 = _(' a new account.');
|
|
|
|
|
|
|
|
common_element_start('dd');
|
|
|
|
common_element_start('p');
|
|
|
|
common_text(sprintf($loginmsg_part1, common_config('site', 'name')));
|
|
|
|
common_element('a',
|
|
|
|
array('href' => common_local_url('register')), _('Register'));
|
|
|
|
common_text($loginmsg_part2);
|
|
|
|
common_element_end('dd');
|
|
|
|
common_element_end('dl');
|
|
|
|
}
|
|
|
|
|
2009-01-11 07:03:59 +00:00
|
|
|
function showLoginForm($msg = null)
|
2008-12-23 19:33:23 +00:00
|
|
|
{
|
2009-01-11 07:03:59 +00:00
|
|
|
start_fbml();
|
2008-12-23 19:19:07 +00:00
|
|
|
|
2009-01-18 01:31:39 +00:00
|
|
|
common_element('link', array('rel' => 'stylesheet',
|
|
|
|
'type' => 'text/css',
|
2009-01-18 06:12:47 +00:00
|
|
|
'href' => getFacebookCSS()));
|
2009-01-18 01:31:39 +00:00
|
|
|
|
|
|
|
$this->showLogo();
|
|
|
|
|
|
|
|
common_element_start('div', array('class' => 'content'));
|
|
|
|
common_element('h1', null, _('Login'));
|
|
|
|
|
2009-01-11 07:03:59 +00:00
|
|
|
if ($msg) {
|
|
|
|
common_element('fb:error', array('message' => $msg));
|
2008-12-23 19:19:07 +00:00
|
|
|
}
|
2009-01-18 01:31:39 +00:00
|
|
|
|
|
|
|
$this->showInstructions();
|
2008-12-23 19:19:07 +00:00
|
|
|
|
2009-01-18 01:31:39 +00:00
|
|
|
common_element_start('div', array('id' => 'content_inner'));
|
2008-12-23 19:19:07 +00:00
|
|
|
|
2009-01-11 07:03:59 +00:00
|
|
|
common_element_start('form', array('method' => 'post',
|
|
|
|
'id' => 'login',
|
|
|
|
'action' => 'index.php'));
|
2009-01-18 01:31:39 +00:00
|
|
|
|
|
|
|
common_element_start('fieldset');
|
|
|
|
common_element('legend', null, _('Login to site'));
|
|
|
|
|
|
|
|
common_element_start('ul', array('class' => 'form_datas'));
|
|
|
|
common_element_start('li');
|
2009-01-11 07:03:59 +00:00
|
|
|
common_input('nickname', _('Nickname'));
|
2009-01-18 01:31:39 +00:00
|
|
|
common_element_end('li');
|
|
|
|
common_element_start('li');
|
2009-01-11 07:03:59 +00:00
|
|
|
common_password('password', _('Password'));
|
2009-01-18 01:31:39 +00:00
|
|
|
common_element_end('li');
|
|
|
|
common_element_end('ul');
|
|
|
|
|
2009-01-11 07:03:59 +00:00
|
|
|
common_submit('submit', _('Login'));
|
|
|
|
common_element_end('form');
|
2008-12-23 19:19:07 +00:00
|
|
|
|
2009-01-11 07:03:59 +00:00
|
|
|
common_element_start('p');
|
|
|
|
common_element('a', array('href' => common_local_url('recoverpassword')),
|
|
|
|
_('Lost or forgotten password?'));
|
|
|
|
common_element_end('p');
|
2009-01-18 01:31:39 +00:00
|
|
|
|
2009-01-11 07:03:59 +00:00
|
|
|
common_element_end('div');
|
|
|
|
|
|
|
|
common_end_xml();
|
2008-12-23 19:19:07 +00:00
|
|
|
|
|
|
|
}
|
2008-12-08 01:54:12 +00:00
|
|
|
|
2009-01-11 07:03:59 +00:00
|
|
|
|
2008-12-06 03:01:32 +00:00
|
|
|
}
|