plugins/PunBB.php
changeset 5 e3d7322305bf
parent 4 eb9ed4c366d0
child 6 5e1f1e916419
equal deleted inserted replaced
4:eb9ed4c366d0 5:e3d7322305bf
    34   ');
    34   ');
    35 
    35 
    36 $plugins->attachHook('session_started', '
    36 $plugins->attachHook('session_started', '
    37     $pid = RenderMan::strToPageId($paths->get_pageid_from_url());
    37     $pid = RenderMan::strToPageId($paths->get_pageid_from_url());
    38 
    38 
    39     if ( getConfig("punbb_installed") == "yes" && getConfig("punbb_version") == PUNANO_VERSION && preg_match("#^Forum(/.*)?$#", $pid[0]) && $pid[1] == "Special" )
    39     if ( getConfig("punbb_installed") == "yes" && getConfig("punbb_version") == PUNANO_VERSION && $pid[0] == "Forum" && $pid[1] == "Special" )
    40     {
    40     {
    41       require( ENANO_ROOT . "/punbb/include/common.php" );
    41       require( "punbb/include/common.php" );
    42     }
    42     }
    43     ');
    43     ');
    44 
    44 
    45 define('PUNANO_VERSION', '0.1.12.15');
    45 define('PUNANO_VERSION', '0.1.12.15');
    46 define('PUNBB_VERSION',  '1.2.15');
    46 define('PUNBB_VERSION',  '1.2.15');
   202 }
   202 }
   203 
   203 
   204 function punano_upgrade()
   204 function punano_upgrade()
   205 {
   205 {
   206   global $db, $session, $paths, $template, $plugins; // Common objects
   206   global $db, $session, $paths, $template, $plugins; // Common objects
   207   die('Punano upgrade was requested but this isn\'t implemented yet.');
   207   
   208 }
   208 }
   209 
   209 
   210 function punano_main()
   210 function punano_main()
   211 {
   211 {
   212   global $db, $session, $paths, $template, $plugins; // Common objects
   212   global $db, $session, $paths, $template, $plugins; // Common objects
   259     $need_level = USER_LEVEL_ADMIN;
   259     $need_level = USER_LEVEL_ADMIN;
   260   }
   260   }
   261 
   261 
   262   if ( $session->auth_level < $need_level )
   262   if ( $session->auth_level < $need_level )
   263   {
   263   {
   264     $need_level = ( $session->user_level > $need_level ) ? $session->user_level : $need_level;
   264     redirect( makeUrlNS('Special', 'Login/' . $paths->fullpage, 'level=' . $session->user_level, false), 'Permission denied', 'You need to have permission level ' . $session->userlevel_to_string($need_level) . ' to use the PunBB administration console.', 2);
   265     redirect( makeUrlNS('Special', 'Login/' . $paths->fullpage, 'level=' . $need_level, false), 'Permission denied', 'You need to have permission level ' . $session->userlevel_to_string($need_level) . ' to use the PunBB administration console.', 2);
       
   266   }
   265   }
   267   
   266   
   268   // Don't worry. This is sanitized.
   267   // Don't worry. This is sanitized.
   269   require PUN_ROOT . 'admin_' . $file . '.php';
   268   require PUN_ROOT . 'admin_' . $file . '.php';
   270   
   269