]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Merge branch '0.7.x' of git@gitorious.org:laconica/dev into 0.7.x
authorEvan Prodromou <evan@controlyourself.ca>
Wed, 4 Mar 2009 19:05:58 +0000 (11:05 -0800)
committerEvan Prodromou <evan@controlyourself.ca>
Wed, 4 Mar 2009 19:05:58 +0000 (11:05 -0800)
README
db/foreign_services.sql
db/notice_source.sql [new file with mode: 0644]
index.php
install.php
lib/action.php
lib/clienterroraction.php
lib/common.php
lib/servererroraction.php
lib/util.php

diff --git a/README b/README
index 67dc9a66b3f95f95af2563a9f21c48e248cc3045..388d67ed2a5bf40dfcf62380dbeab4b40147f41b 100644 (file)
--- 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.
 
index 512d425138d05dbac84dc2b0371865443da5a79f..557ede0246781024e509146d68353c55f5f02796 100644 (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());
diff --git a/db/notice_source.sql b/db/notice_source.sql
new file mode 100644 (file)
index 0000000..ea04862
--- /dev/null
@@ -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());
index 03c044415dc2f31e6178afded3236ec92efbad18..dae1ae75145e127a906b64a488f5248ebae05ae8 100644 (file)
--- 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');
index 18fc362b62e6e9dce09ffe6779824538f23da1cb..0240349bb15d1220f2cdd7babdef83c720febabd 100644 (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);
index 9c71a153dd98cc124b88bcc0e68d4e1d8990b96f..812df635e31f5b2e31403bbff23e0e44810651e1 100644 (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');
         }
index 5019dc06deb7ec9bc18f8dd8a3d626be0fa02af9..0c48414d55f066c774c2e41a4aebc6b3ec98b0d4 100644 (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];
+    }
 }
index 3df68d98a2140cf6e43ac85c1bc787a6c0b3d625..f215192f45ef6489cb77c83b5c8e2b0c4d6c0d0d 100644 (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
index 80a3fdd7b408f39b487bc80282f1a684f1c3f5bd..595dcf1470a438fa4c94151cfaf057a730f9b381 100644 (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];
+    }
 }
index 18e4f310ce0ef4b951809628dad0cb992fb0a0ee..f9a787d473262b52ad9ea5862803c36feda6fc06 100644 (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()]) || (isset($_SESSION['userid']) && $_SESSION['userid'])) {