plugins/Nuggie.php
changeset 7 cd46e29ae699
parent 3 a050ff3d4509
child 8 160f1170aa32
--- a/plugins/Nuggie.php	Sat Jun 14 22:01:05 2008 -0400
+++ b/plugins/Nuggie.php	Mon Jun 16 12:54:24 2008 -0400
@@ -59,6 +59,11 @@
   
   $paths->create_namespace('Blog', 'Blog:');
   $paths->create_namespace('Planet', 'Planet:');
+  $paths->create_namespace('BlogPost', 'Blog_post:');
+  
+  // Register namespace processors
+  $paths->register_namespace_processor('BlogPost', 'nuggie_blogpost_uri_handler');
+  $paths->register_namespace_processor('Planet', 'nuggie_planet_uri_handler');
   
   // Create custom permissions for Nuggie
   
@@ -75,14 +80,17 @@
   
   // Extend the core permission set
   
-  $session->acl_extend_scope('read', 'Blog|Planet', $paths);
-  $session->acl_extend_scope('edit_comments', 'Blog', $paths);
-  $session->acl_extend_scope('post_comments', 'Blog', $paths);
-  $session->acl_extend_scope('mod_comments', 'Blog', $paths);
+  $session->acl_extend_scope('read', 'Blog|Planet|BlogPost', $paths);
+  $session->acl_extend_scope('edit_comments', 'BlogPost', $paths);
+  $session->acl_extend_scope('post_comments', 'BlogPost', $paths);
+  $session->acl_extend_scope('mod_comments', 'BlogPost', $paths);
 }
 
 $plugins->attachHook('page_type_string_set', 'nuggie_set_page_string();');
 
+require( ENANO_ROOT . '/plugins/nuggie/planet.php' );
+require( ENANO_ROOT . '/plugins/nuggie/postbit.php' );
+
 function nuggie_set_page_string()
 {
   global $db, $session, $paths, $template, $plugins; // Common objects
@@ -112,8 +120,7 @@
   
   if ( $processor->namespace == 'Blog' )
   {
-    require( ENANO_ROOT . '/plugins/nuggie/postbit.php' );
-    $result = nuggie_blog_uri_handler($processor->page_id);
+    $result = nuggie_blog_uri_handler($processor);
     if ( $result === '_err_access_denied' )
     {
       $processor->err_access_denied();
@@ -122,12 +129,7 @@
   }
   else if ( $processor->namespace == 'Planet' )
   {
-    $result = nuggie_planet_uri_handler($processor->page_id);
-    if ( $result === '_err_access_denied' )
-    {
-      $processor->err_access_denied();
-      return true;
-    }
+    // revision 7: never called anymore
   }
 }