plugins/PunBB.php
changeset 1 8f6143115bf5
parent 0 f9ffdbd96607
child 2 a8a21e1c7afa
equal deleted inserted replaced
0:f9ffdbd96607 1:8f6143115bf5
       
     1 <?php
       
     2 /*
       
     3 Plugin Name: PunBB forum integration
       
     4 Plugin URI: http://enanocms.org/PunBB_plugin
       
     5 Description: Provides a complete forum solution in PunBB, a separately maintained and very lightweight GPL forum.
       
     6 Author: Dan Fuhry
       
     7 Version: 0.1.12.15
       
     8 Author URI: http://enanocms.org/
       
     9 */
     1 
    10 
       
    11 /*
       
    12  * PunBB Plugin for Enano CMS
       
    13  * Version 0.1.12.15
       
    14  * Copyright (C) 2006-2007 Dan Fuhry
       
    15  * Copyright (C) 2002-2007 Rickard Andersson
       
    16  *
       
    17  * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
       
    18  * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
       
    19  *
       
    20  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
       
    21  * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
       
    22  */
       
    23 
       
    24 $plugins->attachHook('base_classes_initted', '
       
    25     global $paths;
       
    26     
       
    27     $paths->add_page(Array(
       
    28       \'name\'=>\'Forum\',
       
    29       \'urlname\'=>\'Forum\',
       
    30       \'namespace\'=>\'Special\',
       
    31       \'special\'=>0,\'visible\'=>1,\'comments_on\'=>0,\'protected\'=>1,\'delvotes\'=>0,\'delvote_ips\'=>\'\',
       
    32     ));
       
    33   ');
       
    34 
       
    35 define('PUNANO_VERSION', '0.1.12.15');
       
    36 
       
    37 function page_Special_Forum()
       
    38 {
       
    39   if ( getConfig('punbb_installed') != 'yes' )
       
    40   {
       
    41     punano_installer();
       
    42   }
       
    43   else if ( getConfig('punbb_version') != PUNANO_VERSION )
       
    44   {
       
    45     punano_upgrade();
       
    46   }
       
    47   else
       
    48   {
       
    49     punano_main();
       
    50   }
       
    51 }
       
    52 
       
    53 function punano_installer()
       
    54 {
       
    55   global $db, $session, $paths, $template, $plugins; // Common objects
       
    56   // First check our permissions
       
    57   if ( $session->user_level < USER_LEVEL_ADMIN )
       
    58   {
       
    59     die_friendly('Punano initialization error', '<p>The Punano plugin doesn\'t have its database schema installed yet, and your user account doesn\'t have permission to install it. Please ask the administrator of this site to set up Punano.</p>');
       
    60   }
       
    61   else if ( $session->auth_level < USER_LEVEL_ADMIN )
       
    62   {
       
    63     $url = makeUrlNS('Special', 'Login/' . $paths->page, 'level=' . USER_LEVEL_ADMIN, true);
       
    64     redirect($url, 'Permission denied', 'You need to have an active high-privilege session to set up Punano.', 4);
       
    65   }
       
    66   // Permissions are good
       
    67 }
       
    68 
       
    69 function punano_upgrade()
       
    70 {
       
    71   global $db, $session, $paths, $template, $plugins; // Common objects
       
    72   
       
    73 }
       
    74 
       
    75 function punano_main()
       
    76 {
       
    77   global $db, $session, $paths, $template, $plugins; // Common objects
       
    78   
       
    79 }
       
    80 
       
    81 ?>