Merging in some changes from Nighthawk
authorDan
Wed, 24 Oct 2007 18:30:03 -0400
changeset 5 6eea55374f5b
parent 4 c31210950118
child 6 3f66ec435f08
Merging in some changes from Nighthawk
decir/forum_index.php
plugins/Decir.php
--- a/decir/forum_index.php	Wed Oct 17 23:44:22 2007 -0400
+++ b/decir/forum_index.php	Wed Oct 24 18:30:03 2007 -0400
@@ -49,24 +49,16 @@
       case FORUM_FORUM:
         $color = ( $row['user_level'] >= USER_LEVEL_ADMIN ) ? 'AA0000' : ( ( $row['user_level'] >= USER_LEVEL_MOD ) ? '00AA00' : '0000AA' );
         // Forum
-        if ( $row['post_id'] )
-        {
-          $last_post_data = '<small>
-                   <a href="' . makeUrlNS('DecirTopic', $row['topic_id']) . '#post' . $row['post_id'] . '">' . $row['topic_title'] . '</a><br />
-                   ' . date('d M Y h:i a', $row['timestamp']) . '<br />
-                   by <b><a style="color: #' . $color . '" href="' . makeUrlNS('User', $row['username']) . '">' . $row['username'] . '</a></b>
-                 </small>';
-        }
-        else
-        {
-          $last_post_data = 'No posts';
-        }
         echo '<tr><td class="row3" style="text-align: center;">&lt;icon&gt;</td><td class="row2"><b><a href="' . makeUrlNS('DecirForum', $row['forum_id']) . '">'
              . $row['forum_name'] . '</a></b><br />' . $row['forum_desc'].'</td>
              <td class="row3" style="text-align: center;">' . $row['num_topics'] . '</td>
              <td class="row3" style="text-align: center;">' . $row['num_posts'] . '</td>
              <td class="row1" style="text-align: center;">
-               ' . $last_post_data . '
+               <small>
+                 <a href="' . makeUrlNS('DecirTopic', $row['topic_id']) . '#post' . $row['post_id'] . '">' . $row['topic_title'] . '</a><br />
+                 ' . date('d M Y h:i a', $row['timestamp']) . '<br />
+                 by <b><a style="color: #' . $color . '" href="' . makeUrlNS('User', $row['username']) . '">' . $row['username'] . '</a></b>
+               </small>
              </td>
              </tr>';
         break;
--- a/plugins/Decir.php	Wed Oct 17 23:44:22 2007 -0400
+++ b/plugins/Decir.php	Wed Oct 24 18:30:03 2007 -0400
@@ -36,30 +36,14 @@
 function decir_early_init(&$paths, &$session)
 {
   $paths->addAdminNode('Decir forum configuration', 'General settings', 'DecirGeneral');
-  $paths->create_namespace('DecirForum', $paths->nslist['Special'] . 'Forum/ViewForum/');
-  $paths->create_namespace('DecirPost',  $paths->nslist['Special'] . 'Forum/Post/');
-  $paths->create_namespace('DecirTopic', $paths->nslist['Special'] . 'Forum/Topic/');
-  
-  // Decir's ACL rules
+  $paths->nslist['DecirForum']  = $paths->nslist['Special'] . 'Forum/ViewForum/';
+  $paths->nslist['DecirPost']   = $paths->nslist['Special'] . 'Forum/Post/';
+  $paths->nslist['DecirTopic']  = $paths->nslist['Special'] . 'Forum/Topic/';
   
   $session->register_acl_type('decir_see_forum',  AUTH_ALLOW, 'See forum in index', Array('read'),             'DecirForum');
   $session->register_acl_type('decir_view_forum', AUTH_ALLOW, 'View forum',         Array('decir_see_forum'),  'DecirForum');
   $session->register_acl_type('decir_post',       AUTH_ALLOW, 'Post new topics',    Array('decir_view_forum'), 'DecirForum');
   $session->register_acl_type('decir_reply',      AUTH_ALLOW, 'Reply to topics',    Array('decir_post'),       'DecirTopic');
-  $session->register_acl_type('decir_edit_own',   AUTH_ALLOW, 'Edit own posts',     Array('decir_post'),       'DecirPost');
-  $session->register_acl_type('decir_edit_other', AUTH_DISALLOW, 'Edit others\' posts', Array('decir_post'),   'DecirPost');
-  $session->register_acl_type('decir_delete_own_post_soft', AUTH_ALLOW, 'Delete own posts (soft)', Array('decir_edit_own'), 'DecirPost');
-  $session->register_acl_type('decir_delete_own_post_hard', AUTH_DISALLOW, 'Delete own posts (hard)', Array('decir_delete_own_post_soft'), 'DecirPost');
-  $session->register_acl_type('decir_delete_other_post_soft', AUTH_DISALLOW, 'Delete others\' posts (soft)', Array('decir_edit_other'), 'DecirPost');
-  $session->register_acl_type('decir_delete_other_post_hard', AUTH_DISALLOW, 'Delete others\' posts (hard)', Array('decir_delete_other_post_soft'), 'DecirPost');
-  $session->register_acl_type('decir_undelete_own_post', AUTH_DISALLOW, 'Undelete own posts', Array('decir_edit_own'), 'DecirPost');
-  $session->register_acl_type('decir_undelete_other_post', AUTH_DISALLOW, 'Undelete others\' posts', Array('decir_edit_other'), 'DecirPost');
-  $session->register_acl_type('decir_undelete_own_topic', AUTH_DISALLOW, 'Undelete own topics', Array('read'), 'DecirTopic');
-  $session->register_acl_type('decir_undelete_other_topic', AUTH_DISALLOW, 'Undelete others\' topics', Array('read'), 'DecirTopic');
-  $session->register_acl_type('decir_see_deleted_post', AUTH_ALLOW, 'See placeholders for deleted posts', Array('read'), 'Special|DecirPost|DecirTopic|DecirForum');
-  $session->register_acl_type('decir_see_deleted_post_full', AUTH_DISALLOW, 'Read the full contents of deleted posts', Array('decir_see_deleted_post'), 'Special|DecirPost|DecirTopic|DecirForum');
-  $session->register_acl_type('decir_see_deleted_topic', AUTH_ALLOW, 'See placeholders for deleted topics', Array('read'), 'DecirTopic|DecirForum');
-  $session->register_acl_type('decir_see_deleted_topic_full', AUTH_DISALLOW, 'Read the full contents of deleted topics', Array('decir_see_deleted_topic'), 'Special|DecirTopic|DecirForum');
 }
 
 function page_Special_Forum()
@@ -94,15 +78,6 @@
     case 'new':
       require('posting.php');
       break;
-    case 'edit':
-      require('edit.php');
-      break;
-    case 'delete':
-      require('delete.php');
-      break;
-    case 'restoretopic':
-      require('restoretopic.php');
-      break;
   }
   
   chdir($curdir);
@@ -111,13 +86,7 @@
 
 function page_Admin_DecirGeneral()
 {
-  global $db, $session, $paths, $template, $plugins; // Common objects
-  if ( $session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN )
-  {
-    echo '<h3>Error: Not authenticated</h3><p>It looks like your administration session is invalid or you are not authorized to access this administration page. Please <a href="' . makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true) . '">re-authenticate</a> to continue.</p>';
-    return;
-  }
-  
+  global $db, $session, $paths, $template, $plugins; if($session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN) { header('Location: '.makeUrl($paths->nslist['Special'].'Administration'.urlSeparator.'noheaders')); die('Hacking attempt'); }
   echo 'Hello world!';
 }