plugins/Decir.php
changeset 7 37387f84fe25
parent 6 3f66ec435f08
child 11 5585ac341820
equal deleted inserted replaced
6:3f66ec435f08 7:37387f84fe25
    36 require( DECIR_ROOT . '/admincp/admin_base.php' );
    36 require( DECIR_ROOT . '/admincp/admin_base.php' );
    37 
    37 
    38 function decir_early_init(&$paths, &$session)
    38 function decir_early_init(&$paths, &$session)
    39 {
    39 {
    40   $paths->addAdminNode('Decir forum configuration', 'General settings', 'DecirGeneral');
    40   $paths->addAdminNode('Decir forum configuration', 'General settings', 'DecirGeneral');
    41   $paths->nslist['DecirForum']  = $paths->nslist['Special'] . 'Forum/ViewForum/';
    41   $paths->create_namespace('DecirForum', $paths->nslist['Special'] . 'Forum/ViewForum/');
    42   $paths->nslist['DecirPost']   = $paths->nslist['Special'] . 'Forum/Post/';
    42   $paths->create_namespace('DecirPost',  $paths->nslist['Special'] . 'Forum/Post/');
    43   $paths->nslist['DecirTopic']  = $paths->nslist['Special'] . 'Forum/Topic/';
    43   $paths->create_namespace('DecirTopic', $paths->nslist['Special'] . 'Forum/Topic/');
    44   
    44   
    45   $session->register_acl_type('decir_see_forum',  AUTH_ALLOW, 'See forum in index', Array('read'),             'DecirForum');
    45   $session->register_acl_type('decir_see_forum',  AUTH_ALLOW, 'See forum in index', Array('read'),             'DecirForum');
    46   $session->register_acl_type('decir_view_forum', AUTH_ALLOW, 'View forum',         Array('decir_see_forum'),  'DecirForum');
    46   $session->register_acl_type('decir_view_forum', AUTH_ALLOW, 'View forum',         Array('decir_see_forum'),  'DecirForum');
    47   $session->register_acl_type('decir_post',       AUTH_ALLOW, 'Post new topics',    Array('decir_view_forum'), 'DecirForum');
    47   $session->register_acl_type('decir_post',       AUTH_ALLOW, 'Post new topics',    Array('decir_view_forum'), 'DecirForum');
    48   $session->register_acl_type('decir_reply',      AUTH_ALLOW, 'Reply to topics',    Array('decir_post'),       'DecirTopic');
    48   $session->register_acl_type('decir_reply',      AUTH_ALLOW, 'Reply to topics',    Array('decir_post'),       'DecirTopic');
       
    49   $session->register_acl_type('decir_edit_own',   AUTH_ALLOW, 'Edit own posts',     Array('decir_post'),       'DecirPost');
       
    50   $session->register_acl_type('decir_edit_other', AUTH_DISALLOW, 'Edit others\' posts', Array('decir_post'),   'DecirPost');
       
    51   $session->register_acl_type('decir_delete_own_post_soft', AUTH_ALLOW, 'Delete own posts (soft)', Array('decir_edit_own'), 'DecirPost');
       
    52   $session->register_acl_type('decir_delete_own_post_hard', AUTH_DISALLOW, 'Delete own posts (hard)', Array('decir_delete_own_post_soft'), 'DecirPost');
       
    53   $session->register_acl_type('decir_delete_other_post_soft', AUTH_DISALLOW, 'Delete others\' posts (soft)', Array('decir_edit_other'), 'DecirPost');
       
    54   $session->register_acl_type('decir_delete_other_post_hard', AUTH_DISALLOW, 'Delete others\' posts (hard)', Array('decir_delete_other_post_soft'), 'DecirPost');
       
    55   $session->register_acl_type('decir_undelete_own_post', AUTH_DISALLOW, 'Undelete own posts', Array('decir_edit_own'), 'DecirPost');
       
    56   $session->register_acl_type('decir_undelete_other_post', AUTH_DISALLOW, 'Undelete others\' posts', Array('decir_edit_other'), 'DecirPost');
       
    57   $session->register_acl_type('decir_undelete_own_topic', AUTH_DISALLOW, 'Undelete own topics', Array('read'), 'DecirTopic');
       
    58   $session->register_acl_type('decir_undelete_other_topic', AUTH_DISALLOW, 'Undelete others\' topics', Array('read'), 'DecirTopic');
       
    59   $session->register_acl_type('decir_see_deleted_post', AUTH_ALLOW, 'See placeholders for deleted posts', Array('read'), 'Special|DecirPost|DecirTopic|DecirForum');
       
    60   $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');
       
    61   $session->register_acl_type('decir_see_deleted_topic', AUTH_ALLOW, 'See placeholders for deleted topics', Array('read'), 'DecirTopic|DecirForum');
       
    62   $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');
    49 }
    63 }
    50 
    64 
    51 function page_Special_Forum()
    65 function page_Special_Forum()
    52 {
    66 {
    53   global $db, $session, $paths, $template, $plugins; // Common objects
    67   global $db, $session, $paths, $template, $plugins; // Common objects
    79       require('viewtopic.php');
    93       require('viewtopic.php');
    80       break;
    94       break;
    81     case 'new':
    95     case 'new':
    82       require('posting.php');
    96       require('posting.php');
    83       break;
    97       break;
       
    98     case 'edit':
       
    99       require('edit.php');
       
   100       break;
       
   101     case 'delete':
       
   102       require('delete.php');
       
   103       break;
       
   104     case 'restoretopic':
       
   105       require('restoretopic.php');
       
   106       break;
    84   }
   107   }
    85   
   108   
    86   chdir($curdir);
   109   chdir($curdir);
    87   
   110   
    88 }
   111 }