plugins/Decir.php
changeset 1 6f8b7c6fac02
parent 0 0417a5a0c7be
child 2 253118325c65
equal deleted inserted replaced
0:0417a5a0c7be 1:6f8b7c6fac02
    34   ');
    34   ');
    35 
    35 
    36 function decir_early_init(&$paths, &$session)
    36 function decir_early_init(&$paths, &$session)
    37 {
    37 {
    38   $paths->addAdminNode('Decir forum configuration', 'General settings', 'DecirGeneral');
    38   $paths->addAdminNode('Decir forum configuration', 'General settings', 'DecirGeneral');
    39   $paths->nslist['DecirForum']  = $paths->nslist['Special'] . 'Forum/ViewForum/';
    39   $paths->create_namespace('DecirForum', $paths->nslist['Special'] . 'Forum/ViewForum/');
    40   $paths->nslist['DecirPost']   = $paths->nslist['Special'] . 'Forum/Post/';
    40   $paths->create_namespace('DecirPost',  $paths->nslist['Special'] . 'Forum/Post/');
    41   $paths->nslist['DecirTopic']  = $paths->nslist['Special'] . 'Forum/Topic/';
    41   $paths->create_namespace('DecirTopic', $paths->nslist['Special'] . 'Forum/Topic/');
    42   
    42   
    43   $session->register_acl_type('decir_see_forum',  AUTH_ALLOW, 'See forum in index', Array('read'),             'DecirForum');
    43   $session->register_acl_type('decir_see_forum',  AUTH_ALLOW, 'See forum in index', Array('read'),             'DecirForum');
    44   $session->register_acl_type('decir_view_forum', AUTH_ALLOW, 'View forum',         Array('decir_see_forum'),  'DecirForum');
    44   $session->register_acl_type('decir_view_forum', AUTH_ALLOW, 'View forum',         Array('decir_see_forum'),  'DecirForum');
    45   $session->register_acl_type('decir_post',       AUTH_ALLOW, 'Post new topics',    Array('decir_view_forum'), 'DecirForum');
    45   $session->register_acl_type('decir_post',       AUTH_ALLOW, 'Post new topics',    Array('decir_view_forum'), 'DecirForum');
    46   $session->register_acl_type('decir_reply',      AUTH_ALLOW, 'Reply to topics',    Array('decir_post'),       'DecirTopic');
    46   $session->register_acl_type('decir_reply',      AUTH_ALLOW, 'Reply to topics',    Array('decir_post'),       'DecirTopic');
       
    47   $session->register_acl_type('decir_edit_own',   AUTH_ALLOW, 'Edit own posts',     Array('decir_post'),       'DecirPost');
       
    48   $session->register_acl_type('decir_edit_other', AUTH_DISALLOW, 'Edit others\' posts', Array('decir_post'),   'DecirPost');
    47 }
    49 }
    48 
    50 
    49 function page_Special_Forum()
    51 function page_Special_Forum()
    50 {
    52 {
    51   global $db, $session, $paths, $template, $plugins; // Common objects
    53   global $db, $session, $paths, $template, $plugins; // Common objects
    52   
    54   
    53   if ( getConfig('decir_version') != ENANO_DECIR_VERSION || isset($_POST['do_install_finish']) )
    55   if ( getConfig('decir_version') != ENANO_DECIR_VERSION || isset($_POST['do_install_finish']) )
    54   {
    56   {
    55     require(DECIR_ROOT . '/install.php');
    57     require(DECIR_ROOT . '/install.php');
       
    58     return false;
    56   }
    59   }
    57   
    60   
    58   $act = strtolower( ( $n = $paths->getParam(0) ) ? $n : 'Index' );
    61   $act = strtolower( ( $n = $paths->getParam(0) ) ? $n : 'Index' );
    59   
    62   
    60   $curdir = getcwd();
    63   $curdir = getcwd();
    75       require('viewtopic.php');
    78       require('viewtopic.php');
    76       break;
    79       break;
    77     case 'new':
    80     case 'new':
    78       require('posting.php');
    81       require('posting.php');
    79       break;
    82       break;
       
    83     case 'edit':
       
    84       require('edit.php');
       
    85       break;
       
    86     case 'delete':
       
    87       require('delete.php');
       
    88       break;
    80   }
    89   }
    81   
    90   
    82   chdir($curdir);
    91   chdir($curdir);
    83   
    92   
    84 }
    93 }
    85 
    94 
    86 function page_Admin_DecirGeneral()
    95 function page_Admin_DecirGeneral()
    87 {
    96 {
    88   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'); }
    97   global $db, $session, $paths, $template, $plugins; // Common objects
       
    98   if ( $session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN )
       
    99   {
       
   100     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>';
       
   101     return;
       
   102   }
       
   103   
    89   echo 'Hello world!';
   104   echo 'Hello world!';
    90 }
   105 }
    91 
   106 
    92 ?>
   107 ?>