summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README97
-rw-r--r--db/foreign_services.sql7
-rw-r--r--db/notice_source.sql46
-rw-r--r--index.php8
-rw-r--r--install.php42
-rw-r--r--lib/action.php8
-rw-r--r--lib/clienterroraction.php15
-rw-r--r--lib/common.php6
-rw-r--r--lib/servererroraction.php20
-rw-r--r--lib/util.php6
10 files changed, 181 insertions, 74 deletions
diff --git a/README b/README
index 67dc9a66b..388d67ed2 100644
--- a/README
+++ b/README
@@ -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
- 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
@@ -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).
-
-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
@@ -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.
diff --git a/db/foreign_services.sql b/db/foreign_services.sql
index 512d42513..557ede024 100644
--- a/db/foreign_services.sql
+++ b/db/foreign_services.sql
@@ -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());
diff --git a/db/notice_source.sql b/db/notice_source.sql
new file mode 100644
index 000000000..ea04862e0
--- /dev/null
+++ b/db/notice_source.sql
@@ -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());
diff --git a/index.php b/index.php
index 03c044415..dae1ae751 100644
--- a/index.php
+++ b/index.php
@@ -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');
diff --git a/install.php b/install.php
index 18fc362b6..0240349bb 100644
--- a/install.php
+++ b/install.php
@@ -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);
diff --git a/lib/action.php b/lib/action.php
index 9c71a153d..812df635e 100644
--- a/lib/action.php
+++ b/lib/action.php
@@ -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');
}
diff --git a/lib/clienterroraction.php b/lib/clienterroraction.php
index 5019dc06d..0c48414d5 100644
--- a/lib/clienterroraction.php
+++ b/lib/clienterroraction.php
@@ -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];
+ }
}
diff --git a/lib/common.php b/lib/common.php
index 3df68d98a..f215192f4 100644
--- a/lib/common.php
+++ b/lib/common.php
@@ -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
diff --git a/lib/servererroraction.php b/lib/servererroraction.php
index 80a3fdd7b..595dcf147 100644
--- a/lib/servererroraction.php
+++ b/lib/servererroraction.php
@@ -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];
+ }
}
diff --git a/lib/util.php b/lib/util.php
index 18e4f310c..f9a787d47 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -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()]) || (isset($_SESSION['userid']) && $_SESSION['userid'])) {