Saturday, October 21, 2006

Hacking s9y into a multi-user, centrally controlled tool, continued

Now that authors can only manage their own posts and have everything managed centrally, I just have to display filtered results, so each author has their own main page. Since s9y already has a way to filter by author, we just need to trigger that without the full query having to appear in the URL request.

The index.php in whatever directory you want. For this install, I'll have it as /username/index.php.

// Get the journal contents for the current journal
$_SERVER['REQUEST_URI'] .= '?/authors/(authorid)-(Hyphenated-Full-Name)';
require 'includes/journals.php';

Then, journals.php simple follows the standard, embedding practice for s9y:

$pwd = dirname(__FILE__);
chdir($p . 'journals/');
include 'index.php';
chdir($pwd);
Since my own code already logs you into s9y and, in doing so, starts the session, I just need to quiet the notice that will otherwise pepper the error log from serendipity_config.inc.php:

Index: serendipity_config.inc.php
===================================================================
--- serendipity_config.inc.php  (revision 162)
+++ serendipity_config.inc.php  (working copy)
@@ -3,7 +3,7 @@
 # All rights reserved.  See LICENSE file for licensing details
 
 if (!headers_sent()) {
-    session_start();
+    @session_start();
 }

Since s9y didn't get built with this kind of behavior in mind, this definitely falls into the realm of sketchiness. But it works solidly and since any distribution of this will get included with my own web application (source code and license for s9y included, of course), only I have to worry about upgrade paths.

Until, of course, they do this for real.

Labels:

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home