plugins/PunBB.php
author Dan
Wed, 11 Jul 2007 21:28:39 -0400
changeset 1 8f6143115bf5
parent 0 f9ffdbd96607
child 2 a8a21e1c7afa
permissions -rwxr-xr-x
Nothing exciting, just syncing with Scribus...

<?php
/*
Plugin Name: PunBB forum integration
Plugin URI: http://enanocms.org/PunBB_plugin
Description: Provides a complete forum solution in PunBB, a separately maintained and very lightweight GPL forum.
Author: Dan Fuhry
Version: 0.1.12.15
Author URI: http://enanocms.org/
*/

/*
 * PunBB Plugin for Enano CMS
 * Version 0.1.12.15
 * Copyright (C) 2006-2007 Dan Fuhry
 * Copyright (C) 2002-2007 Rickard Andersson
 *
 * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
 */

$plugins->attachHook('base_classes_initted', '
    global $paths;
    
    $paths->add_page(Array(
      \'name\'=>\'Forum\',
      \'urlname\'=>\'Forum\',
      \'namespace\'=>\'Special\',
      \'special\'=>0,\'visible\'=>1,\'comments_on\'=>0,\'protected\'=>1,\'delvotes\'=>0,\'delvote_ips\'=>\'\',
    ));
  ');

define('PUNANO_VERSION', '0.1.12.15');

function page_Special_Forum()
{
  if ( getConfig('punbb_installed') != 'yes' )
  {
    punano_installer();
  }
  else if ( getConfig('punbb_version') != PUNANO_VERSION )
  {
    punano_upgrade();
  }
  else
  {
    punano_main();
  }
}

function punano_installer()
{
  global $db, $session, $paths, $template, $plugins; // Common objects
  // First check our permissions
  if ( $session->user_level < USER_LEVEL_ADMIN )
  {
    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>');
  }
  else if ( $session->auth_level < USER_LEVEL_ADMIN )
  {
    $url = makeUrlNS('Special', 'Login/' . $paths->page, 'level=' . USER_LEVEL_ADMIN, true);
    redirect($url, 'Permission denied', 'You need to have an active high-privilege session to set up Punano.', 4);
  }
  // Permissions are good
}

function punano_upgrade()
{
  global $db, $session, $paths, $template, $plugins; // Common objects
  
}

function punano_main()
{
  global $db, $session, $paths, $template, $plugins; // Common objects
  
}

?>