summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2009-11-14 17:14:35 +0100
committerEvan Prodromou <evan@status.net>2009-11-14 17:14:35 +0100
commit959d278c347fdf90e0227adc57c0215f5d82404a (patch)
tree16eb3b0155b446ada520566e187b4c47b0b9e76b /lib
parent093857c582a68b39e0d65523d27f25ede7b7fed6 (diff)
parent2147ac510f5489c860a4bebf3ab48a069b89ecfb (diff)
Merge branch '0.9.x' of git@gitorious.org:statusnet/mainline into 0.9.x
Diffstat (limited to 'lib')
-rw-r--r--lib/Shorturl_api.php67
-rw-r--r--lib/action.php4
-rw-r--r--lib/common.php6
-rw-r--r--lib/default.php2
-rw-r--r--lib/grouplist.php6
-rw-r--r--lib/jabber.php8
-rw-r--r--lib/plugin.php14
-rw-r--r--lib/profilelist.php8
-rw-r--r--lib/subs.php2
-rw-r--r--lib/util.php32
10 files changed, 31 insertions, 118 deletions
diff --git a/lib/Shorturl_api.php b/lib/Shorturl_api.php
deleted file mode 100644
index de4d55012..000000000
--- a/lib/Shorturl_api.php
+++ /dev/null
@@ -1,67 +0,0 @@
-<?php
-/*
- * StatusNet - the distributed open-source microblogging tool
- * Copyright (C) 2008, 2009, StatusNet, 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
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
-
-abstract class ShortUrlApi
-{
- protected $service_url;
- protected $long_limit = 27;
-
- function __construct($service_url)
- {
- $this->service_url = $service_url;
- }
-
- function shorten($url)
- {
- if ($this->is_long($url)) return $this->shorten_imp($url);
- return $url;
- }
-
- protected abstract function shorten_imp($url);
-
- protected function is_long($url) {
- return strlen($url) >= common_config('site', 'shorturllength');
- }
-
- protected function http_post($data)
- {
- $request = HTTPClient::start();
- $response = $request->post($this->service_url, null, $data);
- return $response->getBody();
- }
-
- protected function http_get($url)
- {
- $request = HTTPClient::start();
- $response = $request->get($this->service_url . urlencode($url));
- return $response->getBody();
- }
-
- protected function tidy($response) {
- $response = str_replace('&nbsp;', ' ', $response);
- $config = array('output-xhtml' => true);
- $tidy = new tidy;
- $tidy->parseString($response, $config, 'utf8');
- $tidy->cleanRepair();
- return (string)$tidy;
- }
-}
-
diff --git a/lib/action.php b/lib/action.php
index 80f398fbd..b5cf3240c 100644
--- a/lib/action.php
+++ b/lib/action.php
@@ -1048,8 +1048,7 @@ class Action extends HTMLOutputter // lawsuit
{
// Does a little before-after block for next/prev page
if ($have_before || $have_after) {
- $this->elementStart('div', array('class' => 'pagination'));
- $this->elementStart('dl', null);
+ $this->elementStart('dl', 'pagination');
$this->element('dt', null, _('Pagination'));
$this->elementStart('dd', null);
$this->elementStart('ul', array('class' => 'nav'));
@@ -1074,7 +1073,6 @@ class Action extends HTMLOutputter // lawsuit
$this->elementEnd('ul');
$this->elementEnd('dd');
$this->elementEnd('dl');
- $this->elementEnd('div');
}
}
diff --git a/lib/common.php b/lib/common.php
index 6aac46807..4524d50fa 100644
--- a/lib/common.php
+++ b/lib/common.php
@@ -19,6 +19,9 @@
if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
+//exit with 200 response, if this is checking fancy from the installer
+if (isset($_REQUEST['p']) && $_REQUEST['p'] == 'check-fancy') { exit; }
+
define('STATUSNET_VERSION', '0.9.0dev');
define('LACONICA_VERSION', STATUSNET_VERSION); // compatibility
@@ -38,8 +41,6 @@ define('FOREIGN_NOTICE_SEND_REPLY', 4);
define('FOREIGN_FRIEND_SEND', 1);
define('FOREIGN_FRIEND_RECV', 2);
-define_syslog_variables();
-
# append our extlib dir as the last-resort place to find libs
set_include_path(get_include_path() . PATH_SEPARATOR . INSTALLDIR . '/extlib/');
@@ -229,7 +230,6 @@ require_once INSTALLDIR.'/lib/util.php';
require_once INSTALLDIR.'/lib/action.php';
require_once INSTALLDIR.'/lib/mail.php';
require_once INSTALLDIR.'/lib/subs.php';
-require_once INSTALLDIR.'/lib/Shorturl_api.php';
require_once INSTALLDIR.'/lib/clientexception.php';
require_once INSTALLDIR.'/lib/serverexception.php';
diff --git a/lib/default.php b/lib/default.php
index 95366e0b3..82b6910ab 100644
--- a/lib/default.php
+++ b/lib/default.php
@@ -159,7 +159,7 @@ $default =
array('default' => null,
'welcome' => null),
'snapshot' =>
- array('run' => 'web',
+ array('run' => 'never',
'frequency' => 10000,
'reporturl' => 'http://status.net/stats/report'),
'attachments' =>
diff --git a/lib/grouplist.php b/lib/grouplist.php
index cc734bdd0..99bff9cdc 100644
--- a/lib/grouplist.php
+++ b/lib/grouplist.php
@@ -85,18 +85,18 @@ class GroupList extends Widget
function showGroup()
{
- $this->out->elementStart('li', array('class' => 'profile',
+ $this->out->elementStart('li', array('class' => 'profile hentry',
'id' => 'group-' . $this->group->id));
$user = common_current_user();
- $this->out->elementStart('div', 'entity_profile vcard');
+ $this->out->elementStart('div', 'entity_profile vcard entry-content');
$logo = ($this->group->stream_logo) ?
$this->group->stream_logo : User_group::defaultLogo(AVATAR_STREAM_SIZE);
$this->out->elementStart('a', array('href' => $this->group->homeUrl(),
- 'class' => 'url',
+ 'class' => 'url entry-title',
'rel' => 'contact group'));
$this->out->element('img', array('src' => $logo,
'class' => 'photo avatar',
diff --git a/lib/jabber.php b/lib/jabber.php
index 73f2ec660..a8e295ea5 100644
--- a/lib/jabber.php
+++ b/lib/jabber.php
@@ -176,7 +176,7 @@ function jabber_format_entry($profile, $notice)
$xs = new XMLStringer();
$xs->elementStart('html', array('xmlns' => 'http://jabber.org/protocol/xhtml-im'));
$xs->elementStart('body', array('xmlns' => 'http://www.w3.org/1999/xhtml'));
- $xs->element("img", array('src'=> $profile->avatarUrl(AVATAR_MINI_SIZE) , 'alt' => $profile->nickname));
+ $xs->element("img", array('src'=> $profile->avatarUrl(AVATAR_MINI_SIZE)));
$xs->element('a', array('href' => $profile->profileurl),
$profile->nickname);
$xs->text(": ");
@@ -185,11 +185,11 @@ function jabber_format_entry($profile, $notice)
} else {
$xs->raw(common_render_content($notice->content, $notice));
}
- $xs->raw(" ");
+ $xs->text(" ");
$xs->element('a', array(
'href'=>common_local_url('conversation',
array('id' => $notice->conversation)).'#notice-'.$notice->id
- ),sprintf(_('notice id: %s'),$notice->id));
+ ),sprintf(_('[%s]'),$notice->id));
$xs->elementEnd('body');
$xs->elementEnd('html');
@@ -481,5 +481,5 @@ function jabber_public_notice($notice)
function jabber_format_notice(&$profile, &$notice)
{
- return $profile->nickname . ': ' . $notice->content;
+ return $profile->nickname . ': ' . $notice->content . ' [' . $notice->id . ']';
}
diff --git a/lib/plugin.php b/lib/plugin.php
index 59bf3ba9d..87d7be5a7 100644
--- a/lib/plugin.php
+++ b/lib/plugin.php
@@ -76,18 +76,4 @@ class Plugin
{
return true;
}
-
- /*
- * the name of the shortener
- * shortenerInfo associative array with additional information. One possible element is 'freeService' which can be true or false
- * shortener array, first element is the name of the class, second element is an array to be passed as constructor parameters to the class
- */
- function registerUrlShortener($name, $shortenerInfo, $shortener)
- {
- global $_shorteners;
- if(!is_array($_shorteners)){
- $_shorteners=array();
- }
- $_shorteners[$name]=array('info'=>$shortenerInfo, 'callInfo'=>$shortener);
- }
}
diff --git a/lib/profilelist.php b/lib/profilelist.php
index bbb722701..3412d41d1 100644
--- a/lib/profilelist.php
+++ b/lib/profilelist.php
@@ -76,7 +76,7 @@ class ProfileList extends Widget
function startList()
{
- $this->out->elementStart('ul', 'profiles');
+ $this->out->elementStart('ul', 'profiles xoxo');
}
function endList()
@@ -140,7 +140,7 @@ class ProfileListItem extends Widget
function startItem()
{
- $this->out->elementStart('li', array('class' => 'profile',
+ $this->out->elementStart('li', array('class' => 'profile hentry',
'id' => 'profile-' . $this->profile->id));
}
@@ -175,14 +175,14 @@ class ProfileListItem extends Widget
function startProfile()
{
- $this->out->elementStart('div', 'entity_profile vcard');
+ $this->out->elementStart('div', 'entity_profile vcard entry-content');
}
function showAvatar()
{
$avatar = $this->profile->getAvatar(AVATAR_STREAM_SIZE);
$this->out->elementStart('a', array('href' => $this->profile->profileurl,
- 'class' => 'url',
+ 'class' => 'url entry-title',
'rel' => 'contact'));
$this->out->element('img', array('src' => ($avatar) ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_STREAM_SIZE),
'class' => 'photo avatar',
diff --git a/lib/subs.php b/lib/subs.php
index 934380b76..2f0f97049 100644
--- a/lib/subs.php
+++ b/lib/subs.php
@@ -121,7 +121,7 @@ function subs_unsubscribe_user($user, $other_nickname)
function subs_unsubscribe_to($user, $other)
{
if (!$user->isSubscribed($other))
- return _('Not subscribed!.');
+ return _('Not subscribed!');
$sub = DB_DataObject::factory('subscription');
diff --git a/lib/util.php b/lib/util.php
index 81160d052..68f3520db 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -350,8 +350,11 @@ function common_current_user()
common_ensure_session();
$id = isset($_SESSION['userid']) ? $_SESSION['userid'] : false;
if ($id) {
- $_cur = User::staticGet($id);
- return $_cur;
+ $user = User::staticGet($id);
+ if ($user) {
+ $_cur = $user;
+ return $_cur;
+ }
}
}
@@ -1420,25 +1423,18 @@ function common_shorten_url($long_url)
if (empty($user)) {
// common current user does not find a user when called from the XMPP daemon
// therefore we'll set one here fix, so that XMPP given URLs may be shortened
- $svc = 'ur1.ca';
+ $shortenerName = 'ur1.ca';
} else {
- $svc = $user->urlshorteningservice;
- }
- global $_shorteners;
- if (!isset($_shorteners[$svc])) {
- //the user selected service doesn't exist, so default to ur1.ca
- $svc = 'ur1.ca';
- }
- if (!isset($_shorteners[$svc])) {
- // no shortener plugins installed.
- return $long_url;
+ $shortenerName = $user->urlshorteningservice;
}
- $reflectionObj = new ReflectionClass($_shorteners[$svc]['callInfo'][0]);
- $short_url_service = $reflectionObj->newInstanceArgs($_shorteners[$svc]['callInfo'][1]);
- $short_url = $short_url_service->shorten($long_url);
-
- return $short_url;
+ if(Event::handle('StartShortenUrl', array($long_url,$shortenerName,&$shortenedUrl))){
+ //URL wasn't shortened, so return the long url
+ return $long_url;
+ }else{
+ //URL was shortened, so return the result
+ return $shortenedUrl;
+ }
}
function common_client_ip()