version may render your Laconica site unable to send or receive XMPP
messages.
- Facebook library. Used for the Facebook application.
+- PEAR Services_oEmbed. Used for some multimedia integration.
+- PEAR HTTP_Request is an oEmbed dependency.
+- PEAR Validat is an oEmbed dependency.e
+- PEAR Net_URL is an oEmbed dependency.2
A design goal of Laconica is that the basic Web functionality should
work on even the most restrictive commercial hosting services.
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
- writeable by the Web server. An insecure way to do this is:
+ 3. Make your target directory writeable by the Web server.
- chmod a+w /var/www/mublog/avatar
+ chmod a+w /var/www/mublog/
On some systems, this will probably work:
- chgrp www-data /var/www/mublog/avatar
- chmod g+w /var/www/mublog/avatar
+ 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 "avatar" and add the Web server's user to the group.
+ a new group like "mublog" and add the Web server's user to the group.
- 4. Create a database to hold your microblog data. Something like this
+ 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
+
+ You can also make the avatar directory writeable by the Web server
+ group, as noted above.
+
+ 5. Create a database to hold your microblog data. Something like this
should work:
mysqladmin -u "username" --password="password" create laconica
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).
-
- 7. Copy the config.php.sample in the Laconica directory to config.php.
-
- 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.
-
- 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.
+ username and password. You may want to test logging in to MySQL as
+ this new user.
+
+ 7. In a browser, navigate to the Laconica install script; something like:
+
+ http://yourserver.example.com/mublog/install.php
+
+ 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
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
------
# 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
Quick setup instructions*:
- Install the Facebook Developer application on Facebook:
+ Install the Facebook Developer application on Facebook:
http://www.facebook.com/developers/
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.
public $reply_to; // int(4)
public $is_local; // tinyint(1)
public $source; // varchar(32)
+ public $conversation; // int(4)
/* Static get */
function staticGet($k,$v=NULL) {
$notice->query('BEGIN');
- $notice->reply_to = $reply_to;
$notice->created = common_sql_now();
$notice->content = common_shorten_links($content);
$notice->rendered = common_render_content($notice->content, $notice);
$notice->source = $source;
$notice->uri = $uri;
+ if (!empty($reply_to)) {
+ $reply_notice = Notice::staticGet('id', $reply_to);
+ if (!empty($reply_notice)) {
+ $notice->reply_to = $reply_to;
+ $notice->conversation = $reply_notice->conversation;
+ }
+ }
+
if (Event::handle('StartNoticeSave', array(&$notice))) {
$id = $notice->insert();
$inbox = new Notice_inbox();
$UT = common_config('db','type')=='pgsql'?'"user"':'user';
$qry = 'INSERT INTO notice_inbox (user_id, notice_id, created) ' .
- "SELECT $UT.id, " . $this->id . ', "' . $this->created . '" ' .
+ "SELECT $UT.id, " . $this->id . ", '" . $this->created . "' " .
"FROM $UT JOIN subscription ON $UT.id = subscription.subscriber " .
'WHERE subscription.subscribed = ' . $this->profile_id . ' ' .
'AND NOT EXISTS (SELECT user_id, notice_id ' .
$inbox = new Notice_inbox();
$UT = common_config('db','type')=='pgsql'?'"user"':'user';
$qry = 'INSERT INTO notice_inbox (user_id, notice_id, created, source) ' .
- "SELECT $UT.id, " . $this->id . ', "' . $this->created . '", 2 ' .
+ "SELECT $UT.id, " . $this->id . ", '" . $this->created . "', 2 " .
"FROM $UT JOIN group_member ON $UT.id = group_member.profile_id " .
'WHERE group_member.group_id = ' . $group->id . ' ' .
'AND NOT EXISTS (SELECT user_id, notice_id ' .
if ($recipient_notice) {
$orig = clone($this);
$this->reply_to = $recipient_notice->id;
+ $this->conversation = $recipient_notice->conversation;
$this->update($orig);
}
}
}
}
+ // If it's not a reply, make it the root of a new conversation
+
+ if (empty($this->conversation)) {
+ $orig = clone($this);
+ $this->conversation = $this->id;
+ $this->update($orig);
+ }
+
foreach (array_keys($replied) as $recipient) {
$user = User::staticGet('id', $recipient);
if ($user) {
}
if ($lm) {
header('Last-Modified: ' . date(DATE_RFC1123, $lm));
- $if_modified_since = $_SERVER['HTTP_IF_MODIFIED_SINCE'];
- if ($if_modified_since) {
+ if (array_key_exists('HTTP_IF_MODIFIED_SINCE', $_SERVER)) {
+ $if_modified_since = $_SERVER['HTTP_IF_MODIFIED_SINCE'];
$ims = strtotime($if_modified_since);
if ($lm <= $ims) {
- $if_none_match = $_SERVER['HTTP_IF_NONE_MATCH'];
+ $if_none_match = (array_key_exists('HTTP_IF_NONE_MATCH', $_SERVER)) ?
+ $_SERVER['HTTP_IF_NONE_MATCH'] : null;
if (!$if_none_match ||
!$etag ||
$this->_hasEtag($etag, $if_none_match)) {
}
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');
}
array('action' => 'deletenotice'),
array('notice' => '[0-9]+'));
+ // conversation
+
+ $m->connect('conversation/:id',
+ array('action' => 'conversation'),
+ array('id' => '[0-9]+'));
+
$m->connect('message/new', array('action' => 'newmessage'));
$m->connect('message/new?to=:to', array('action' => 'newmessage'), array('to' => '[A-Za-z0-9_-]'));
$m->connect('message/:message',
// 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
'apiaction' => 'friendships'),
array('method' => 'exists(\.(xml|json|rss|atom))'));
-
// Social graph
$m->connect('api/friends/ids/:argument',
array('action' => 'api',
'apiaction' => 'laconica'));
+
+ // search
+ $m->connect('api/search.atom', array('action' => 'twitapisearchatom'));
+ $m->connect('api/search.json', array('action' => 'twitapisearchjson'));
+ $m->connect('api/trends.json', array('action' => 'twitapitrends'));
+
// user stuff
- foreach (array('subscriptions', 'subscribers',
+ foreach (array('subscriptions', 'subscribers',
'nudge', 'xrds', 'all', 'foaf',
'replies', 'inbox', 'outbox', 'microsummary') as $a) {
$m->connect(':nickname/'.$a,
array('action' => 'showstream'),
array('nickname' => '[a-zA-Z0-9]{1,64}'));
+ Event::handle('RouterInitialized', array($m));
+
return $m;
}