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