Merge branch '0.7.x' of git@gitorious.org:laconica/dev into 0.7.x

This commit is contained in:
CiaranG 2009-03-05 16:18:59 +00:00
commit 3c53e821cc
20 changed files with 544 additions and 127 deletions

97
README
View File

@ -236,21 +236,28 @@ especially if you've previously installed PHP/MySQL packages.
configure virtual hosts on your web server, you can try setting up
"http://micro.example.net/" or the like.
3. You should also take this moment to make your avatar subdirectory
3. Make your target directory writeable by the Web server.
chmod a+w /var/www/mublog/
On some systems, this will probably work:
chgrp www-data /var/www/mublog/
chmod g+w /var/www/mublog/
If your Web server runs as another user besides "www-data", try
that user's default group instead. As a last resort, you can create
a new group like "mublog" and add the Web server's user to the group.
4. You should also take this moment to make your avatar subdirectory
writeable by the Web server. An insecure way to do this is:
chmod a+w /var/www/mublog/avatar
On some systems, this will probably work:
You can also make the avatar directory writeable by the Web server
group, as noted above.
chgrp www-data /var/www/mublog/avatar
chmod g+w /var/www/mublog/avatar
If your Web server runs as another user besides "www-data", try
that user's default group instead. As a last resort, you can create
a new group like "avatar" and add the Web server's user to the group.
4. Create a database to hold your microblog data. Something like this
5. Create a database to hold your microblog data. Something like this
should work:
mysqladmin -u "username" --password="password" create laconica
@ -263,63 +270,55 @@ especially if you've previously installed PHP/MySQL packages.
a tool like PHPAdmin to create a database. Check your hosting
service's documentation for how to create a new MySQL database.)
5. Run the laconica.sql SQL script in the db subdirectory to create
the database tables in the database. A typical system would work
like this:
mysql -u "username" --password="password" laconica < /var/www/mublog/db/laconica.sql
You may want to test by logging into the database and checking that
the tables were created. Here's an example:
SHOW TABLES;
6. Create a new database account that Laconica will use to access the
database. If you have shell access, this will probably work from the
MySQL shell:
GRANT SELECT,INSERT,DELETE,UPDATE on laconica.*
GRANT ALL on laconica.*
TO 'lacuser'@'localhost'
IDENTIFIED BY 'lacpassword';
You should change 'lacuser' and 'lacpassword' to your preferred new
username and password. You may want to test logging in as this new
user and testing that you can SELECT from some of the tables in the
DB (use SHOW TABLES to see which ones are there).
username and password. You may want to test logging in to MySQL as
this new user.
7. Copy the config.php.sample in the Laconica directory to config.php.
7. In a browser, navigate to the Laconica install script; something like:
8. Edit config.php to set the basic configuration for your system.
(See descriptions below for basic config options.) Note that there
are lots of options and if you try to do them all at once, you will
have a hard time making sure what's working and what's not. So,
stick with the basics at first. In particular, customizing the
'site' and 'db' settings will almost definitely be needed.
http://yourserver.example.com/mublog/install.php
9. At this point, you should be able to navigate in a browser to your
microblog's main directory and see the "Public Timeline", which
will be empty. If not, magic has happened! You can now register a
new user, post some notices, edit your profile, etc. However, you
may want to wait to do that stuff if you think you can set up
"fancy URLs" (see below), since some URLs are stored in the database.
Enter the database connection information and your site name. The
install program will configure your site and install the initial,
almost-empty database.
8. You should now be able to navigate to your microblog's main directory
and see the "Public Timeline", which will be empty. If not, magic
has happened! You can now register a new user, post some notices,
edit your profile, etc. However, you may want to wait to do that stuff
if you think you can set up "fancy URLs" (see below), since some
URLs are stored in the database.
Fancy URLs
----------
By default, Laconica will have big long sloppy URLs that are hard for
people to remember or use. For example, a user's home profile might be
By default, Laconica will use URLs that include the main PHP program's
name in them. For example, a user's home profile might be
found at:
http://example.org/mublog/index.php?action=showstream&nickname=fred
http://example.org/mublog/index.php/mublog/fred
On certain systems that don't support this kind of syntax, they'll
look like this:
http://example.org/mublog/index.php?p=mublog/fred
It's possible to configure the software so it looks like this instead:
http://example.org/mublog/fred
These "fancy URLs" are more readable and memorable for users. To use
fancy URLs, you must either have Apache 2.2.x with .htaccess enabled
and mod_redirect enabled, -OR- know how to configure "url redirection"
in your server.
fancy URLs, you must either have Apache 2.x with .htaccess enabled and
mod_redirect enabled, -OR- know how to configure "url redirection" in
your server.
1. Copy the htaccess.sample file to .htaccess in your Laconica
directory. Note: if you have control of your server's httpd.conf or
@ -344,10 +343,6 @@ like:
If you changed your HTTP server configuration, you may need to restart
the server first.
If you have problems with the .htaccess file on versions of Apache
earlier than 2.2.x, try changing the regular expressions in the
htaccess.sample file that use "\w" to just use ".".
Sphinx
------
@ -557,7 +552,7 @@ Sample cron job:
# Update Twitter friends subscriptions every half hour
0,30 * * * * /path/to/php /path/to/laconica/scripts/synctwitterfriends.php>&/dev/null
Built-in Facebook Application
Built-in Facebook Application
-----------------------------
Laconica's Facebook application allows your users to automatically
@ -571,7 +566,7 @@ above).
Quick setup instructions*:
Install the Facebook Developer application on Facebook:
Install the Facebook Developer application on Facebook:
http://www.facebook.com/developers/
@ -644,7 +639,7 @@ to these resources.
Themes
------
There are two themes shipped with this version of Laconica: "stoica",
There are two themes shipped with this version of Laconica: "identica",
which is what the Identi.ca site uses, and "default", which is a good
basis for other sites.

View File

@ -23,22 +23,24 @@ require_once(INSTALLDIR.'/lib/twitterapi.php');
class TwitapiaccountAction extends TwitterapiAction
{
function verify_credentials($args, $apidata)
{
if ($apidata['content-type'] == 'xml') {
header('Content-Type: application/xml; charset=utf-8');
print '<authorized>true</authorized>';
} elseif ($apidata['content-type'] == 'json') {
header('Content-Type: application/json; charset=utf-8');
print '{"authorized":true}';
} else {
parent::handle($args);
switch ($apidata['content-type']) {
case 'xml':
case 'json':
$action_obj = new TwitapiusersAction();
$action_obj->prepare($args);
call_user_func(array($action_obj, 'show'), $args, $apidata);
break;
default:
header('Content-Type: text/html; charset=utf-8');
print 'Authorized';
}
}
function end_session($args, $apidata)
function end_session($args, $apidata)
{
parent::handle($args);
$this->serverError(_('API method under construction.'), $code=501);

97
actions/twitapisearch.php Normal file
View File

@ -0,0 +1,97 @@
<?php
/**
* Laconica, the distributed open-source microblogging tool
*
* List of replies
*
* PHP version 5
*
* LICENCE: 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/>.
*
* @category Search
* @package Laconica
* @author Zach Copley <zach@controlyourself.ca>
* @copyright 2008-2009 Control Yourself, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://laconi.ca/
*/
if (!defined('LACONICA')) {
exit(1);
}
require_once INSTALLDIR.'/lib/twitterapi.php';
/**
* Action handler for Twitter-compatible API search
*
* @category Search
* @package Laconica
* @author Zach Copley <zach@controlyourself.ca>
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://laconi.ca/
* @see TwitterapiAction
*/
class TwitapisearchAction extends TwitterapiAction
{
var $query;
var $limit;
var $callback;
/**
* Initialization.
*
* @param array $args Web and URL arguments
*
* @return boolean false if user doesn't exist
*/
function prepare($args)
{
parent::prepare($args);
$qeury = $this->trimmed('query');
return true;
}
/**
* Handle a request
*
* @param array $args Arguments from $_REQUEST
*
* @return void
*/
function handle($args)
{
parent::handle($args);
$this->showResults($this->limit);
}
/**
* Show search results
*
* @param int $limit Number of notices to show
*
* @return void
*/
function showResults($limit)
{
$this->serverError(_('API method under construction.'), $code = 501);
}
}

90
actions/twitapitrends.php Normal file
View File

@ -0,0 +1,90 @@
<?php
/**
* Laconica, the distributed open-source microblogging tool
*
* List of replies
*
* PHP version 5
*
* LICENCE: 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/>.
*
* @category Search
* @package Laconica
* @author Zach Copley <zach@controlyourself.ca>
* @copyright 2008-2009 Control Yourself, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://laconi.ca/
*/
if (!defined('LACONICA')) {
exit(1);
}
require_once INSTALLDIR.'/lib/twitterapi.php';
/**
* Returns the top ten queries that are currently trending
*
* @category Search
* @package Laconica
* @author Zach Copley <zach@controlyourself.ca>
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://laconi.ca/
*
* @see TwitterapiAction
*/
class TwitapitrendsAction extends TwitterapiAction
{
var $callback;
/**
* Initialization.
*
* @param array $args Web and URL arguments
*
* @return boolean false if user doesn't exist
*/
function prepare($args)
{
parent::prepare($args);
return true;
}
/**
* Handle a request
*
* @param array $args Arguments from $_REQUEST
*
* @return void
*/
function handle($args)
{
parent::handle($args);
$this->showTrends();
}
/**
* Output the trends
*
* @return void
*/
function showTrends()
{
$this->serverError(_('API method under construction.'), $code = 501);
}
}

View File

@ -25,25 +25,29 @@ class TwitapiusersAction extends TwitterapiAction
{
function show($args, $apidata)
{
{
parent::handle($args);
if (!in_array($apidata['content-type'], array('xml', 'json'))) {
if (!in_array($apidata['content-type'], array('xml', 'json'))) {
$this->clientError(_('API method not found!'), $code = 404);
return;
}
$this->auth_user = $apidata['user'];
$user = null;
$email = $this->arg('email');
$user_id = $this->arg('user_id');
if ($email) {
$user = User::staticGet('email', $email);
} elseif ($user_id) {
$user = $this->get_user($user_id);
} elseif (isset($apidata['api_arg'])) {
$user = $this->get_user($apidata['api_arg']);
}
if (!$user) {
} elseif (isset($apidata['user'])) {
$user = $apidata['user'];
}
if (!$user) {
// XXX: Twitter returns a random(?) user instead of throwing and err! -- Zach
$this->client_error(_('Not found.'), 404, $apidata['content-type']);
return;
@ -74,9 +78,12 @@ class TwitapiusersAction extends TwitterapiAction
// Other fields Twitter sends...
$twitter_user['profile_background_color'] = '';
$twitter_user['profile_background_image_url'] = '';
$twitter_user['profile_text_color'] = '';
$twitter_user['profile_link_color'] = '';
$twitter_user['profile_sidebar_fill_color'] = '';
$twitter_user['profile_sidebar_border_color'] = '';
$twitter_user['profile_background_tile'] = 'false';
$faves = DB_DataObject::factory('fave');
$faves->user_id = $user->id;
@ -94,18 +101,27 @@ class TwitapiusersAction extends TwitterapiAction
$twitter_user['utc_offset'] = $t->format('Z');
$twitter_user['time_zone'] = $timezone;
if (isset($this->auth_user)) {
if (isset($apidata['user'])) {
if ($this->auth_user->isSubscribed($profile)) {
if ($apidata['user']->isSubscribed($profile)) {
$twitter_user['following'] = 'true';
} else {
$twitter_user['following'] = 'false';
}
// Not implemented yet
$twitter_user['notifications'] = 'false';
}
// Notifications on?
$sub = Subscription::pkeyGet(array('subscriber' =>
$apidata['user']->id, 'subscribed' => $profile->id));
if ($sub) {
if ($sub->jabber || $sub->sms) {
$twitter_user['notifications'] = 'true';
} else {
$twitter_user['notifications'] = 'false';
}
}
}
if ($apidata['content-type'] == 'xml') {
$this->init_document('xml');
$this->show_twitter_xml_user($twitter_user);
@ -114,7 +130,13 @@ class TwitapiusersAction extends TwitterapiAction
$this->init_document('json');
$this->show_json_objects($twitter_user);
$this->end_document('json');
}
} else {
// This is in case 'show' was called via /account/verify_credentials
// without a format (xml or json).
header('Content-Type: text/html; charset=utf-8');
print 'Authorized';
}
}
}

View File

@ -1,8 +1,5 @@
insert into foreign_service
(id, name, description, created)
values
('1','Twitter', 'Twitter Micro-blogging service', now());
insert into foreign_service
(id, name, description, created)
values
('2','Facebook', 'Facebook', now());
('1','Twitter', 'Twitter Micro-blogging service', now()),
('2','Facebook', 'Facebook', now());

46
db/notice_source.sql Normal file
View File

@ -0,0 +1,46 @@
INSERT INTO notice_source
(code, name, url, created)
VALUES
('Do','Gnome Do','http://do.davebsd.com/wiki/index.php?title=Microblog_Plugin', now()),
('Facebook','Facebook','http://apps.facebook.com/identica/', now()),
('Gwibber','Gwibber','http://launchpad.net/gwibber', now()),
('HelloTxt','HelloTxt','http://hellotxt.com/', now()),
('IdentiFox','IdentiFox','http://www.bitbucket.org/uncryptic/identifox/', now()),
('LaTwit','LaTwit','http://latwit.mac65.com/', now()),
('Nambu','Nambu','http://www.nambu.com/', now()),
('Pikchur','Pikchur','http://www.pikchur.com/', now()),
('Ping.fm','Ping.fm','http://ping.fm/', now()),
('Twidge','Twidge','http://software.complete.org/twidge', now()),
('Updating.Me','Updating.Me','http://updating.me/', now()),
('betwittered','BeTwittered','http://www.32hours.com/betwitteredinfo/', now()),
('bti','bti','http://gregkh.github.com/bti/', now()),
('deskbar','Deskbar-Applet','http://www.gnome.org/projects/deskbar-applet/', now()),
('identicatools','Laconica Tools','http://bitbucketlabs.net/laconica-tools/', now()),
('identichat','identichat','http://identichat.prosody.im/', now()),
('identitwitch','IdentiTwitch','http://richfish.org/identitwitch/', now()),
('mbpidgin','mbpidgin','http://code.google.com/p/microblog-purple/', now()),
('moconica','Moconica','http://moconica.com/', now()),
('pocketwit','PockeTwit','http://code.google.com/p/pocketwit/', now()),
('posty','Posty','http://spreadingfunkyness.com/posty/', now()),
('royalewithcheese','Royale With Cheese','http://p.hellyeah.org/', now()),
('rssdent','rssdent','http://github.com/zcopley/rssdent/tree/master', now()),
('rygh.no','rygh.no','http://rygh.no/', now()),
('ryghsms','ryghsms','http://sms.rygh.no/', now()),
('smob','SMOB','http://smob.sioc-project.org/', now()),
('spaz','Spaz','http://funkatron.com/spaz', now()),
('tarpipe','tarpipe','http://tarpipe.com/', now()),
('tjunar','Tjunar','http://nederflash.nl/boek/titels/tjunar-air', now()),
('tr.im','tr.im','http://tr.im/', now()),
('tweenky','Tweenky','http://beta.tweenky.com/', now()),
('twhirl','Twhirl','http://www.twhirl.org/', now()),
('twibble','twibble','http://www.twibble.de/', now()),
('twidge','Twidge','http://software.complete.org/twidge', now()),
('twidroid','twidroid','http://www.twidroid.com/', now()),
('twittelator','Twittelator','http://www.stone.com/iPhone/Twittelator/', now()),
('twitterfeed','twitterfeed','http://twitterfeed.com/', now()),
('twitterphoto','TwitterPhoto','http://richfish.org/twitterphoto/', now()),
('twitterpm','Net::Twitter','http://search.cpan.org/dist/Net-Twitter/', now()),
('twittertools','Twitter Tools','http://wordpress.org/extend/plugins/twitter-tools/', now()),
('twitux','Twitux','http://live.gnome.org/DanielMorales/Twitux', now()),
('twitvim','TwitVim','http://vim.sourceforge.net/scripts/script.php?script_id=2204', now()),
('urfastr','urfastr','http://urfastr.net/', now());

View File

@ -65,6 +65,14 @@ function main()
{
global $user, $action;
if (!_have_config()) {
$msg = sprintf(_("No configuration file found. Try running ".
"the installation program first."));
$sac = new ServerErrorAction($msg);
$sac->showPage();
return;
}
// For database errors
PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'handleError');

View File

@ -130,6 +130,36 @@ function handlePost()
$password = $_POST['password'];
$sitename = $_POST['sitename'];
if (empty($host)) {
updateStatus("No hostname specified.", true);
showForm();
return;
}
if (empty($database)) {
updateStatus("No database specified.", true);
showForm();
return;
}
if (empty($username)) {
updateStatus("No username specified.", true);
showForm();
return;
}
if (empty($password)) {
updateStatus("No password specified.", true);
showForm();
return;
}
if (empty($sitename)) {
updateStatus("No sitename specified.", true);
showForm();
return;
}
updateStatus("Starting installation...");
updateStatus("Checking database...");
$conn = mysql_connect($host, $username, $password);
@ -152,6 +182,18 @@ function handlePost()
showForm();
return;
}
foreach (array('sms_carrier' => 'SMS carrier',
'notice_source' => 'notice source',
'foreign_services' => 'foreign service')
as $scr => $name) {
updateStatus(sprintf("Adding %s data to database...", $name));
$res = runDbScript(INSTALLDIR.'/db/'.$scr.'.sql', $conn);
if ($res === false) {
updateStatus(sprintf("Can't run %d script.", $name), true);
showForm();
return;
}
}
updateStatus("Writing config file...");
$sqlUrl = "mysqli://$username:$password@$host/$database";
$res = writeConf($sitename, $sqlUrl);

View File

@ -976,17 +976,17 @@ class Action extends HTMLOutputter // lawsuit
}
if ($have_before) {
$pargs = array('page' => $page-1);
$newargs = $args ? array_merge($args, $pargs) : $pargs;
$this->elementStart('li', array('class' => 'nav_prev'));
$this->element('a', array('href' => common_local_url($action, $newargs), 'rel' => 'prev'),
$this->element('a', array('href' => common_local_url($action, $args, $pargs),
'rel' => 'prev'),
_('After'));
$this->elementEnd('li');
}
if ($have_after) {
$pargs = array('page' => $page+1);
$newargs = $args ? array_merge($args, $pargs) : $pargs;
$this->elementStart('li', array('class' => 'nav_next'));
$this->element('a', array('href' => common_local_url($action, $newargs), 'rel' => 'next'),
$this->element('a', array('href' => common_local_url($action, $args, $pargs),
'rel' => 'next'),
_('Before'));
$this->elementEnd('li');
}

View File

@ -49,7 +49,7 @@ class ClientErrorAction extends ErrorAction
function __construct($message='Error', $code=400)
{
parent::__construct($message, $code);
$this->status = array(400 => 'Bad Request',
401 => 'Unauthorized',
402 => 'Payment Required',
@ -72,7 +72,7 @@ class ClientErrorAction extends ErrorAction
}
// XXX: Should these error actions even be invokable via URI?
function handle($args)
{
parent::handle($args);
@ -84,11 +84,16 @@ class ClientErrorAction extends ErrorAction
}
$this->message = $this->trimmed('message');
if (!$this->message) {
$this->message = "Client Error $this->code";
}
$this->message = "Client Error $this->code";
}
$this->showPage();
}
function title()
{
return $this->status[$this->code];
}
}

View File

@ -188,6 +188,12 @@ foreach ($_config_files as $_config_file) {
}
}
function _have_config()
{
global $_have_a_config;
return $_have_a_config;
}
// XXX: Throw a conniption if database not installed
// Fixup for laconica.ini

View File

@ -54,10 +54,12 @@ class PopularNoticeSection extends NoticeSection
$weightexpr='sum(exp(-(now() - fave.modified) / %s))';
}
$qry = 'SELECT notice.id, '.
$qry = 'SELECT notice.*, '.
$weightexpr . ' as weight ' .
'FROM notice JOIN fave ON notice.id = fave.notice_id ' .
'GROUP BY notice.id ' .
'GROUP BY notice.id,notice.profile_id,notice.content,notice.uri,' .
'notice.rendered,notice.url,notice.created,notice.modified,' .
'notice.reply_to,notice.is_local,notice.source ' .
'ORDER BY weight DESC';
$offset = 0;

View File

@ -228,14 +228,15 @@ class Router
// users
$m->connect('api/users/show/:argument',
$m->connect('api/users/:method/:argument',
array('action' => 'api',
'apiaction' => 'users'));
'apiaction' => 'users'),
array('method' => 'show(\.(xml|json))?'));
$m->connect('api/users/:method',
array('action' => 'api',
'apiaction' => 'users'),
array('method' => 'show(\.(xml|json|atom|rss))?'));
array('method' => 'show(\.(xml|json))?'));
// direct messages
@ -283,14 +284,14 @@ class Router
array('action' => 'api',
'apiaction' => 'statuses',
'method' => 'friendsIDs'));
foreach (array('xml', 'json') as $e) {
$m->connect('api/friends/ids.'.$e,
array('action' => 'api',
'apiaction' => 'statuses',
'method' => 'friendsIDs.'.$e));
}
$m->connect('api/followers/ids/:argument',
array('action' => 'api',
'apiaction' => 'statuses',
@ -351,6 +352,16 @@ class Router
array('action' => 'api',
'apiaction' => 'laconica'));
// search
foreach (array('json', 'atom') as $e) {
$m->connect('api/search.'.$e,
array('action' => 'twitapisearch'));
}
$m->connect('api/trends.json', array('action' => 'twitapitrends'));
// user stuff
foreach (array('subscriptions', 'subscribers',

View File

@ -42,7 +42,7 @@ require_once INSTALLDIR.'/lib/error.php';
* says that 500 errors should be treated similarly to 400 errors, and
* it's easier to give an HTML response. Maybe we can customize these
* to display some funny animal cartoons. If not, we can probably role
* these classes up into a single class.
* these classes up into a single class.
*
* See: http://tools.ietf.org/html/rfc2616#section-10
*
@ -57,19 +57,19 @@ class ServerErrorAction extends ErrorAction
function __construct($message='Error', $code=500)
{
parent::__construct($message, $code);
$this->status = array(500 => 'Internal Server Error',
501 => 'Not Implemented',
502 => 'Bad Gateway',
503 => 'Service Unavailable',
504 => 'Gateway Timeout',
505 => 'HTTP Version Not Supported');
$this->default = 500;
}
// XXX: Should these error actions even be invokable via URI?
function handle($args)
{
parent::handle($args);
@ -81,12 +81,16 @@ class ServerErrorAction extends ErrorAction
}
$this->message = $this->trimmed('message');
if (!$this->message) {
$this->message = "Server Error $this->code";
}
$this->message = "Server Error $this->code";
}
$this->showPage();
}
function title()
{
return $this->status[$this->code];
}
}

View File

@ -60,20 +60,34 @@ class TwitterapiAction extends Action
function twitter_status_array($notice, $include_user=true)
{
$profile = $notice->getProfile();
$twitter_status = array();
$twitter_status['text'] = $notice->content;
$twitter_status['truncated'] = 'false'; # Not possible on Laconica
$twitter_status['created_at'] = $this->date_twitter($notice->created);
$twitter_status['in_reply_to_status_id'] = ($notice->reply_to) ? intval($notice->reply_to) : null;
$twitter_status['in_reply_to_status_id'] = ($notice->reply_to) ?
intval($notice->reply_to) : null;
$twitter_status['source'] = $this->source_link($notice->source);
$twitter_status['id'] = intval($notice->id);
$twitter_status['in_reply_to_user_id'] = ($notice->reply_to) ? $this->replier_by_reply(intval($notice->reply_to)) : null;
$replier_profile = null;
if ($notice->reply_to) {
$reply = Notice::staticGet(intval($notice->reply_to));
if ($reply) {
$replier_profile = $reply->getProfile();
}
}
$twitter_status['in_reply_to_user_id'] =
($replier_profile) ? intval($replier_profile->id) : null;
$twitter_status['in_reply_to_screen_name'] =
($replier_profile) ? $replier_profile->nickname : null;
if (isset($this->auth_user)) {
$twitter_status['favorited'] = ($this->auth_user->hasFave($notice)) ? 'true' : 'false';
$twitter_status['favorited'] =
($this->auth_user->hasFave($notice)) ? 'true' : 'false';
} else {
$twitter_status['favorited'] = 'false';
}
@ -137,7 +151,6 @@ class TwitterapiAction extends Action
function twitter_dmsg_array($message)
{
$twitter_dm = array();
$from_profile = $message->getFrom();
@ -386,23 +399,7 @@ class TwitterapiAction extends Action
$t = strtotime($dt);
return date("D M d G:i:s O Y", $t);
}
function replier_by_reply($reply_id)
{
$notice = Notice::staticGet($reply_id);
if ($notice) {
$profile = $notice->getProfile();
if ($profile) {
return intval($profile->id);
} else {
common_debug('Can\'t find a profile for notice: ' . $notice->id, __FILE__);
}
} else {
common_debug("Can't get notice: $reply_id", __FILE__);
}
return null;
}
// XXX: Candidate for a general utility method somewhere?
function count_subscriptions($profile)
{

View File

@ -81,7 +81,7 @@ function common_language()
// If there is a user logged in and they've set a language preference
// then return that one...
if (common_logged_in()) {
if (_have_config() && common_logged_in()) {
$user = common_current_user();
$user_language = $user->language;
if ($user_language)
@ -315,6 +315,10 @@ function common_current_user()
{
global $_cur;
if (!_have_config()) {
return null;
}
if ($_cur === false) {
if (isset($_REQUEST[session_name()]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File

@ -0,0 +1,87 @@
BuildRequires: php-pear
BuildRequires: httpd-devel
Name: laconica
Version: 0.7.2
Release: 1%{?dist}
License: GAGPL v3 or later
Source: laconica-0.7.2.tar.gz
Group: Applications/Internet
Summary: Laconica, the Open Source microblogging platform
BuildArch: noarch
Requires: httpd
Requires: php >= 5
Requires: php-pear-Mail-Mime
Requires: php-curl
Requires: php-mysql
Requires: php-mbstring
Requires: php-gettext
Requires: php-xml
Requires: php-gd
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%define apache_serverroot %(/usr/sbin/apxs -q DATADIR)
%define apache_sysconfdir %(/usr/sbin/apxs -q SYSCONFDIR)
%define wwwpath %{apache_serverroot}/%{name}
%define confpath %{_sysconfdir}/%{name}
%description
From the ABOUT file: Laconica (pronounced "luh-KAWN-ih-kuh") is a Free
and Open Source microblogging platform. It helps people in a
community, company or group to exchange short (140 character) messages
over the Web. Users can choose which people to "follow" and receive
only their friends' or colleagues' status messages. It provides a
similar service to sites like Twitter, Jaiku, and Plurk.
%prep
%setup -q
%build
%install
mkdir -p %{buildroot}%{wwwpath}
cp -a * %{buildroot}%{wwwpath}
mkdir -p %{buildroot}%{_datadir}/laconica
cp -a db %{buildroot}%{_datadir}/laconica/db
mkdir -p %{buildroot}%{_sysconfdir}/httpd/conf.d
cat > %{buildroot}%{_sysconfdir}/httpd/conf.d/laconica.conf <<"EOF"
Alias /laconica/ "/var/www/laconica/"
<Directory "/var/www/laconica">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
EOF
%clean
rm -rf %buildroot
%files
%defattr(-,root,root)
%dir %{wwwpath}
%{wwwpath}/*
%{_datadir}/laconica/*
%attr(-,apache,apache) %dir %{_datadir}/laconica/avatar
%doc COPYING README doc-src/*
%config(noreplace) %{_sysconfdir}/httpd/conf.d/laconica.conf
%changelog
* Wed Mar 03 2009 Zach Copley <zach@controlyourself.ca> - 0.7.2
- Changed version number to 0.7.2.
* Sat Feb 28 2009 Ken Sedgwick <ken@bonsai.com> - 0.7.1-1
- Modified RPM for Fedora.
* Thu Feb 13 2009 tuukka.pasanen@ilmi.fi
- packaged laconica version 0.7.1
* Wed Feb 04 2009 tuukka.pasanen@ilmi.fi
- packaged laconica version 0.7.0 using the buildservice spec file wizard