summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/action.php20
-rw-r--r--lib/error.php2
-rw-r--r--lib/facebookaction.php171
-rw-r--r--lib/htmloutputter.php4
-rw-r--r--lib/noticelist.php13
-rw-r--r--lib/popularnoticesection.php2
-rw-r--r--lib/settingsaction.php7
-rw-r--r--lib/util.php2
8 files changed, 166 insertions, 55 deletions
diff --git a/lib/action.php b/lib/action.php
index 587d2ab13..c4172ada1 100644
--- a/lib/action.php
+++ b/lib/action.php
@@ -73,7 +73,6 @@ class Action extends HTMLOutputter // lawsuit
parent::__construct($output, $indent);
}
-
/**
* For initializing members of the class.
*
@@ -162,15 +161,15 @@ class Action extends HTMLOutputter // lawsuit
'media' => 'screen, projection, tv'));
$this->comment('[if IE]><link rel="stylesheet" type="text/css" '.
'href="'.theme_path('css/ie.css', 'base').'?version='.LACONICA_VERSION.'" /><![endif]');
- $this->comment('[if IE]><link rel="stylesheet" type="text/css" '.
- 'href="'.theme_path('css/ie.css', null).'?version='.LACONICA_VERSION.'" /><![endif]');
foreach (array(6,7) as $ver) {
- if (file_exists(theme_file('ie'.$ver.'.css'))) {
+ if (file_exists(theme_file('css/ie'.$ver.'.css', 'base'))) {
// Yes, IE people should be put in jail.
$this->comment('[if lte IE '.$ver.']><link rel="stylesheet" type="text/css" '.
'href="'.theme_path('css/ie'.$ver.'.css', 'base').'?version='.LACONICA_VERSION.'" /><![endif]');
}
}
+ $this->comment('[if IE]><link rel="stylesheet" type="text/css" '.
+ 'href="'.theme_path('css/ie.css', null).'?version='.LACONICA_VERSION.'" /><![endif]');
}
/**
@@ -246,7 +245,6 @@ class Action extends HTMLOutputter // lawsuit
// does nothing by default
}
-
/**
* Show body.
*
@@ -257,7 +255,7 @@ class Action extends HTMLOutputter // lawsuit
function showBody()
{
$this->elementStart('body', array('id' => $this->trimmed('action')));
- $this->elementStart('div', 'wrap');
+ $this->elementStart('div', array('id' => 'wrap'));
$this->showHeader();
$this->showCore();
$this->showFooter();
@@ -354,7 +352,7 @@ class Action extends HTMLOutputter // lawsuit
$this->elementEnd('dd');
$this->elementEnd('dl');
}
-
+
/**
* Show site notice.
*
@@ -368,7 +366,9 @@ class Action extends HTMLOutputter // lawsuit
$this->elementStart('dl', array('id' => 'site_notice',
'class' => 'system_notice'));
$this->element('dt', null, _('Site notice'));
- $this->element('dd', null, $text);
+ $this->elementStart('dd', null);
+ $this->raw($text);
+ $this->elementEnd('dd');
$this->elementEnd('dl');
}
}
@@ -385,7 +385,7 @@ class Action extends HTMLOutputter // lawsuit
$notice_form = new NoticeForm($this);
$notice_form->show();
}
-
+
/**
* Show anonymous message.
*
@@ -761,7 +761,7 @@ class Action extends HTMLOutputter // lawsuit
/**
* Boolean understands english (yes, no, true, false)
*
- * @param string $key query key we're interested in
+ * @param string $key query key we're interested in
* @param string $def default value
*
* @return boolean interprets yes/no strings as boolean
diff --git a/lib/error.php b/lib/error.php
index 03065bc70..526d9f81b 100644
--- a/lib/error.php
+++ b/lib/error.php
@@ -111,7 +111,7 @@ class ErrorAction extends Action
function showBody()
{
$this->elementStart('body', array('id' => 'error'));
- $this->elementStart('div', 'wrap');
+ $this->elementStart('div', array('id' => 'wrap'));
$this->showHeader();
$this->showCore();
$this->showFooter();
diff --git a/lib/facebookaction.php b/lib/facebookaction.php
index bfba702e6..043a078cd 100644
--- a/lib/facebookaction.php
+++ b/lib/facebookaction.php
@@ -129,7 +129,7 @@ class FacebookAction extends Action
* Start an Facebook ready HTML document
*
* For Facebook we don't want to actually output any headers,
- * DTD info, etc.
+ * DTD info, etc. Just Stylesheet and JavaScript links.
*
* If $type isn't specified, will attempt to do content negotiation.
*
@@ -140,6 +140,9 @@ class FacebookAction extends Action
function startHTML($type=null)
{
+ $this->showStylesheets();
+ $this->showScripts();
+
$this->elementStart('div', array('class' => 'facebook-page'));
}
@@ -168,7 +171,7 @@ class FacebookAction extends Action
function showBody()
{
- $this->elementStart('div', 'wrap');
+ $this->elementStart('div', array('id' => 'wrap'));
$this->showHeader();
$this->showCore();
$this->showFooter();
@@ -181,8 +184,6 @@ class FacebookAction extends Action
function showHead($error, $success)
{
- $this->showStylesheets();
- $this->showScripts();
if ($error) {
$this->element("h1", null, $error);
@@ -204,7 +205,6 @@ class FacebookAction extends Action
// Make this into a widget later
function showLocalNav()
{
-
$this->elementStart('ul', array('class' => 'nav'));
$this->elementStart('li', array('class' =>
@@ -229,18 +229,7 @@ class FacebookAction extends Action
$this->elementEnd('li');
$this->elementEnd('ul');
-
}
-
- /**
- * Show primary navigation.
- *
- * @return nothing
- */
- function showPrimaryNav()
- {
- // we don't want to show anything for this
- }
/**
* Show header of the page.
@@ -254,7 +243,6 @@ class FacebookAction extends Action
$this->elementStart('div', array('id' => 'header'));
$this->showLogo();
$this->showNoticeForm();
- $this->showPrimaryNav();
$this->elementEnd('div');
}
@@ -282,7 +270,6 @@ class FacebookAction extends Action
$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.');
$this->elementStart('dd');
@@ -291,18 +278,18 @@ class FacebookAction extends Action
$this->element('a',
array('href' => common_local_url('register')), _('Register'));
$this->text($loginmsg_part2);
+ $this->elementEnd('p');
$this->elementEnd('dd');
+
$this->elementEnd('dl');
-
$this->elementEnd('div');
-
}
function showLoginForm($msg = null)
{
- $this->elementStart('div', array('class' => 'content'));
+ $this->elementStart('div', array('id' => 'content'));
$this->element('h1', null, _('Login'));
if ($msg) {
@@ -330,6 +317,7 @@ class FacebookAction extends Action
$this->elementEnd('ul');
$this->submit('submit', _('Login'));
+ $this->elementEnd('fieldset');
$this->elementEnd('form');
$this->elementStart('p');
@@ -338,6 +326,7 @@ class FacebookAction extends Action
$this->elementEnd('p');
$this->elementEnd('div');
+ $this->elementEnd('div');
}
@@ -347,42 +336,70 @@ class FacebookAction extends Action
// Need to include inline CSS for styling the Profile box
+ $app_props = $this->facebook->api_client->Admin_getAppProperties(array('icon_url'));
+ $icon_url = $app_props['icon_url'];
+
$style = '<style>
+ .entry-title *,
+ .entry-content * {
+ font-size:14px;
+ font-family:"Lucida Sans Unicode", "Lucida Grande", sans-serif;
+ }
+ .entry-title a,
+ .entry-content a {
+ color:#002E6E;
+ }
+
.entry-title .vcard .photo {
float:left;
display:inline;
+ margin-right:11px;
+ margin-bottom:11px
}
- .entry-title .vcard .nickname {
- margin-left:5px;
- }
-
+ .entry-title {
+ margin-bottom:11px;
+ }
.entry-title p.entry-content {
display:inline;
- margin-left:5px;
+ margin-left:5px;
}
+ div.entry-content {
+ clear:both;
+ }
div.entry-content dl,
div.entry-content dt,
div.entry-content dd {
display:inline;
+ text-transform:lowercase;
}
- div.entry-content dt,
- div.entry-content dd {
- display:inline;
- margin-left:5px;
+ div.entry-content dd,
+ div.entry-content .device dt {
+ margin-left:0;
+ margin-right:5px;
}
- div.entry-content dl.timestamp dt {
+ div.entry-content dl.timestamp dt,
+ div.entry-content dl.response dt {
display:none;
}
div.entry-content dd a {
display:inline-block;
}
+
+ #facebook_laconica_app {
+ text-indent:-9999px;
+ height:16px;
+ width:16px;
+ display:block;
+ background:url('.$icon_url.') no-repeat 0 0;
+ float:right;
+ }
</style>';
$this->xw->openMemory();
- $item = new FacebookNoticeListItem($notice, $this);
+ $item = new FacebookProfileBoxNotice($notice, $this);
$item->show();
$fbml = "<fb:wide>$style " . $this->xw->outputMemory(false) . "</fb:wide>";
@@ -465,8 +482,6 @@ class FacebookAction extends Action
$content_shortened = common_shorten_links($content);
if (mb_strlen($content_shortened) > 140) {
- common_debug("Content = '$content_shortened'", __FILE__);
- common_debug("mb_strlen(\$content) = " . mb_strlen($content_shortened), __FILE__);
$this->showPage(_('That\'s too long. Max notice size is 140 chars.'));
return;
}
@@ -539,6 +554,18 @@ class FacebookNoticeForm extends NoticeForm
class FacebookNoticeList extends NoticeList
{
+
+ /**
+ * constructor
+ *
+ * @param Notice $notice stream of notices from DB_DataObject
+ */
+
+ function __construct($notice, $out=null)
+ {
+ parent::__construct($notice, $out);
+ }
+
/**
* show the list of notices
*
@@ -593,6 +620,20 @@ class FacebookNoticeList extends NoticeList
class FacebookNoticeListItem extends NoticeListItem
{
+
+ /**
+ * constructor
+ *
+ * Also initializes the profile attribute.
+ *
+ * @param Notice $notice The notice we'll display
+ */
+
+ function __construct($notice, $out=null)
+ {
+ parent::__construct($notice, $out);
+ }
+
/**
* recipe function for displaying a single notice in the Facebook App.
*
@@ -645,3 +686,65 @@ class FacebookNoticeListItem extends NoticeListItem
}
}
+
+
+class FacebookProfileBoxNotice extends FacebookNoticeListItem
+{
+
+ /**
+ * constructor
+ *
+ * Also initializes the profile attribute.
+ *
+ * @param Notice $notice The notice we'll display
+ */
+
+ function __construct($notice, $out=null)
+ {
+ parent::__construct($notice, $out);
+ }
+
+ /**
+ * Recipe function for displaying a single notice in the
+ * Facebook App's Profile
+ *
+ * @return void
+ */
+
+ function show()
+ {
+
+ $this->out->elementStart('div', 'entry-title');
+ $this->showAuthor();
+ $this->showContent();
+ $this->out->elementEnd('div');
+
+ $this->out->elementStart('div', 'entry-content');
+
+ $this->showNoticeLink();
+ $this->showNoticeSource();
+ $this->showReplyTo();
+ $this->out->elementEnd('div');
+
+ $this->showAppLink();
+
+ }
+
+ function showAppLink()
+ {
+
+ $this->facebook = getFacebook();
+
+ $app_props = $this->facebook->api_client->Admin_getAppProperties(
+ array('canvas_name', 'application_name'));
+
+ $this->app_uri = 'http://apps.facebook.com/' . $app_props['canvas_name'];
+ $this->app_name = $app_props['application_name'];
+
+ $this->out->elementStart('a', array('id' => 'facebook_laconica_app',
+ 'href' => $this->app_uri));
+ $this->out->text($this->app_name);
+ $this->out->elementEnd('a');
+ }
+
+}
diff --git a/lib/htmloutputter.php b/lib/htmloutputter.php
index f9245414f..7780b1c19 100644
--- a/lib/htmloutputter.php
+++ b/lib/htmloutputter.php
@@ -172,7 +172,7 @@ class HTMLOutputter extends XMLOutputter
'type' => 'text',
'id' => $id);
if ($value) {
- $attrs['value'] = htmlspecialchars($value);
+ $attrs['value'] = $value;
}
$this->element('input', $attrs);
if ($instructions) {
@@ -206,7 +206,7 @@ class HTMLOutputter extends XMLOutputter
'class' => 'checkbox',
'id' => $id);
if ($value) {
- $attrs['value'] = htmlspecialchars($value);
+ $attrs['value'] = $value;
}
if ($checked) {
$attrs['checked'] = 'checked';
diff --git a/lib/noticelist.php b/lib/noticelist.php
index 7c88c33cc..3ef6691af 100644
--- a/lib/noticelist.php
+++ b/lib/noticelist.php
@@ -203,11 +203,14 @@ class NoticeListItem extends Widget
function showNoticeOptions()
{
- $this->out->elementStart('div', 'notice-options');
- $this->showFaveForm();
- $this->showReplyLink();
- $this->showDeleteLink();
- $this->out->elementEnd('div');
+ $user = common_current_user();
+ if ($user) {
+ $this->out->elementStart('div', 'notice-options');
+ $this->showFaveForm();
+ $this->showReplyLink();
+ $this->showDeleteLink();
+ $this->out->elementEnd('div');
+ }
}
/**
diff --git a/lib/popularnoticesection.php b/lib/popularnoticesection.php
index 89daaa563..5734d8001 100644
--- a/lib/popularnoticesection.php
+++ b/lib/popularnoticesection.php
@@ -31,7 +31,7 @@ if (!defined('LACONICA')) {
exit(1);
}
-define('NOTICES_PER_SECTION', 6);
+define('NOTICES_PER_SECTION', 5);
/**
* Base class for sections showing lists of notices
diff --git a/lib/settingsaction.php b/lib/settingsaction.php
index dfe1f114b..53c807c6f 100644
--- a/lib/settingsaction.php
+++ b/lib/settingsaction.php
@@ -76,7 +76,12 @@ class SettingsAction extends Action
// change important settings or see private info, and
// _all_ our settings are important
common_set_returnto($this->selfUrl());
- common_redirect(common_local_url('login'));
+ $user = common_current_user();
+ if ($user->hasOpenID()) {
+ common_redirect(common_local_url('openidlogin'));
+ } else {
+ common_redirect(common_local_url('login'));
+ }
} else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$this->handlePost();
} else {
diff --git a/lib/util.php b/lib/util.php
index e96317520..330e5d12d 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -937,7 +937,7 @@ function common_fancy_url($action, $args=null)
case 'grouprss':
return common_path('group/'.$args['nickname'].'/rss');
case 'groupmembers':
- return common_path('group/'.$args['nickname'].'/members');
+ return common_path('group/'.$args['nickname'].'/members' . (($args['page']) ? ('?page=' . $args['page']) : ''));
case 'grouplogo':
return common_path('group/'.$args['nickname'].'/logo');
case 'usergroups':